Merge remote-tracking branch 'official/master' into contrib

pull/1208/head
Léo Terziman 2016-08-23 12:00:32 +02:00
commit b68ad60b52
340 changed files with 5971 additions and 2520 deletions

2
.gitignore vendored
View File

@ -18,6 +18,7 @@ assimp.pc
revision.h
contrib/zlib/zconf.h
contrib/zlib/zlib.pc
include/assimp/config.h
# CMake
CMakeCache.txt
@ -72,3 +73,4 @@ lib64/assimp-vc120-mtd.pdb
lib64/assimp-vc120-mtd.ilk
lib64/assimp-vc120-mtd.exp
lib64/assimp-vc120-mt.exp
xcuserdata

View File

@ -11,6 +11,6 @@ else
&& sudo make install \
&& sudo ldconfig \
&& (cd test/unit; ../../bin/unit) \
&& (cd test/regression; chmod 755 run.py; ./run.py ../../bin/assimp; \
chmod 755 result_checker.py; ./result_checker.py)
#&& (cd test/regression; chmod 755 run.py; ./run.py ../../bin/assimp; \
# chmod 755 result_checker.py; ./result_checker.py)
fi

View File

@ -39,15 +39,58 @@ SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
cmake_minimum_required( VERSION 2.8 )
PROJECT( Assimp )
OPTION(BUILD_SHARED_LIBS "Build package with shared libraries." ON)
# All supported options ###############################################
OPTION( BUILD_SHARED_LIBS
"Build package with shared libraries."
ON
)
OPTION( ASSIMP_DOUBLE_PRECISION
"Set to ON to enable double precision processing"
OFF
)
OPTION( ASSIMP_OPT_BUILD_PACKAGES
"Set to ON to generate CPack configuration files and packaging targets"
OFF
)
OPTION( ASSIMP_ANDROID_JNIIOSYSTEM
"Android JNI IOSystem support is active"
OFF
)
OPTION( ASSIMP_NO_EXPORT
"Disable Assimp's export functionality."
OFF
)
OPTION( ASSIMP_BUILD_ZLIB
"Build your own zlib"
OFF
)
option( ASSIMP_BUILD_ASSIMP_TOOLS
"If the supplementary tools for Assimp are built in addition to the library."
ON
)
option ( ASSIMP_BUILD_SAMPLES
"If the official samples are built as well (needs Glut)."
OFF
)
OPTION ( ASSIMP_BUILD_TESTS
"If the test suite for Assimp is built in addition to the library."
ON
)
IF(MSVC)
OPTION( ASSIMP_INSTALL_PDB
"Install MSVC debug files."
ON
)
ENDIF(MSVC)
IF(NOT BUILD_SHARED_LIBS)
SET(LINK_SEARCH_START_STATIC TRUE)
ENDIF(NOT BUILD_SHARED_LIBS)
# Define here the needed parameters
SET (ASSIMP_VERSION_MAJOR 3)
SET (ASSIMP_VERSION_MINOR 2)
SET (ASSIMP_VERSION_PATCH 0) # subversion revision?
SET (ASSIMP_VERSION_MINOR 3)
SET (ASSIMP_VERSION_PATCH 1) # subversion revision?
SET (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
SET (ASSIMP_SOVERSION 3)
SET (PROJECT_VERSION "${ASSIMP_VERSION}")
@ -80,30 +123,48 @@ IF(NOT GIT_COMMIT_HASH)
SET(GIT_COMMIT_HASH 0)
ENDIF(NOT GIT_COMMIT_HASH)
IF(ASSIMP_DOUBLE_PRECISION)
ADD_DEFINITIONS(-DAI_DOUBLE_PRECISION)
ENDIF(ASSIMP_DOUBLE_PRECISION)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/revision.h.in
${CMAKE_CURRENT_LIST_DIR}/revision.h.in
${CMAKE_CURRENT_BINARY_DIR}/revision.h
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
configure_file(
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h.in
${CMAKE_CURRENT_LIST_DIR}/include/assimp/config.h
)
include_directories(
./
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/include
)
OPTION(ASSIMP_OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules" )
SET(LIBASSIMP_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}" )
SET(LIBASSIMP-DEV_COMPONENT "libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}-dev" )
SET(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev)
SET(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names")
OPTION(ASSIMP_ANDROID_JNIIOSYSTEM "Android JNI IOSystem support is active" OFF)
# Workaround to be able to deal with compiler bug "Too many sections" with mingw.
IF( CMAKE_COMPILER_IS_MINGW )
ADD_DEFINITIONS(-DASSIMP_BUILD_NO_IFC_IMPORTER )
ENDIF()
# Ensure that we do not run into issues like http://www.tcm.phy.cam.ac.uk/sw/inodes64.html on 32 bit linux
IF( UNIX )
IF ( CMAKE_SIZEOF_VOID_P EQUAL 4) # only necessary for 32-bit linux
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 )
ENDIF()
ENDIF()
IF((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW)
IF (BUILD_SHARED_LIBS AND CMAKE_SIZEOF_VOID_P EQUAL 8) # -fPIC is only required for shared libs on 64 bit
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
ENDIF()
# hide all not-exported symbols
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -std=c++0x" )
@ -132,11 +193,11 @@ IF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
ENDIF ( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
# Cache these to allow the user to override them manually.
SET( ASSIMP_LIB_INSTALL_DIR "lib" CACHE PATH
SET( ASSIMP_LIB_INSTALL_DIR "lib" CACHE STRING
"Path the built library files are installed to." )
SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE PATH
SET( ASSIMP_INCLUDE_INSTALL_DIR "include" CACHE STRING
"Path the header files are installed to." )
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE PATH
SET( ASSIMP_BIN_INSTALL_DIR "bin" CACHE STRING
"Path the tool executables are installed to." )
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
@ -152,8 +213,6 @@ IF (NOT TARGET uninstall)
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
ENDIF()
# cmake configuration files
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE)
@ -161,18 +220,16 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" "${C
FIND_PACKAGE( DirectX )
OPTION ( ASSIMP_NO_EXPORT
"Disable Assimp's export functionality."
OFF
)
IF( CMAKE_COMPILER_IS_GNUCXX )
SET(LIBSTDC++_LIBRARIES -lstdc++)
ENDIF( CMAKE_COMPILER_IS_GNUCXX )
# Search for external dependencies, and build them from source if not found
# Search for zlib
IF ( NOT ASSIMP_BUILD_ZLIB )
find_package(ZLIB)
ENDIF( NOT ASSIMP_BUILD_ZLIB )
IF( NOT ZLIB_FOUND )
message(STATUS "compiling zlib from souces")
include(CheckIncludeFile)
@ -225,31 +282,33 @@ SET ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER OFF CACHE BOOL
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
IF ( MSVC )
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/_melange/includes")
SET(C4D_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/includes")
# pick the correct prebuilt library
IF(MSVC11)
SET(C4D_LIB_POSTFIX "_2012md")
IF(MSVC14)
SET(C4D_LIB_POSTFIX "_2015")
ELSEIF(MSVC12)
SET(C4D_LIB_POSTFIX "_2013")
ELSEIF(MSVC11)
SET(C4D_LIB_POSTFIX "_2012")
ELSEIF(MSVC10)
SET(C4D_LIB_POSTFIX "_2010md")
ELSEIF(MSVC90)
SET(C4D_LIB_POSTFIX "_2008md")
SET(C4D_LIB_POSTFIX "_2010")
ELSE()
MESSAGE( FATAL_ERROR
"C4D is currently only supported with MSVC 9, 10, 11"
"C4D is currently only supported with MSVC 10, 11, 12, 14"
)
ENDIF()
IF(CMAKE_CL_64)
SET(C4D_LIB_ARCH_POSTFIX "_x64")
ELSE()
SET(C4D_LIB_ARCH_POSTFIX "")
ENDIF()
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/libraries/win")
SET(C4D_LIB_BASE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/contrib/Melange/_melange/lib/WIN")
SET(C4D_DEBUG_LIBRARY "${C4D_LIB_BASE_PATH}/debug/_melange_lib${C4D_LIB_ARCH_POSTFIX}${C4D_LIB_POSTFIX}.lib")
SET(C4D_RELEASE_LIBRARY "${C4D_LIB_BASE_PATH}/release/_melange_lib${C4D_LIB_ARCH_POSTFIX}${C4D_LIB_POSTFIX}.lib")
SET(C4D_DEBUG_LIBRARIES
"${C4D_LIB_BASE_PATH}/melangelib${C4D_LIB_POSTFIX}/melangelib_debug.lib"
"${C4D_LIB_BASE_PATH}/jpeglib${C4D_LIB_POSTFIX}/jpeglib_debug.lib"
)
SET(C4D_RELEASE_LIBRARIES
"${C4D_LIB_BASE_PATH}/melangelib${C4D_LIB_POSTFIX}/melangelib_release.lib"
"${C4D_LIB_BASE_PATH}/jpeglib${C4D_LIB_POSTFIX}/jpeglib_release.lib"
)
# winsock and winmm are necessary dependencies of melange (this is undocumented, but true.)
SET(C4D_EXTRA_LIBRARIES WSock32.lib Winmm.lib)
@ -264,10 +323,6 @@ ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
ADD_SUBDIRECTORY( code/ )
option ( ASSIMP_BUILD_ASSIMP_TOOLS
"If the supplementary tools for Assimp are built in addition to the library."
ON
)
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
IF ( WIN32 )
option ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} )
@ -277,12 +332,34 @@ IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
ENDIF ( WIN32 )
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
# Check dependencies for assimp_qt_viewer.
# Why here? Maybe user do not want Qt viewer and have no Qt.
# Why assimp_qt_viewer/CMakeLists.txt still contain similar check?
# Because viewer can be build independently of Assimp.
FIND_PACKAGE(Qt4 QUIET)
FIND_PACKAGE(DevIL QUIET)
FIND_PACKAGE(OpenGL QUIET)
IF ( Qt4_FOUND AND IL_FOUND AND OPENGL_FOUND)
ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ )
ELSE()
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "")
IF (NOT Qt4_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} Qt4")
ENDIF (NOT Qt4_FOUND)
IF (NOT IL_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} DevIL")
ENDIF (NOT IL_FOUND)
IF (NOT OPENGL_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} OpengGL")
ENDIF (NOT OPENGL_FOUND)
MESSAGE (WARNING "Build of assimp_qt_viewer is disabled. Unsatisfied dendencies: ${ASSIMP_QT_VIEWER_DEPENDENCIES}")
ENDIF ( Qt4_FOUND AND IL_FOUND AND OPENGL_FOUND)
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
option ( ASSIMP_BUILD_SAMPLES
"If the official samples are built as well (needs Glut)."
OFF
)
IF ( ASSIMP_BUILD_SAMPLES)
IF ( WIN32 )
@ -291,22 +368,10 @@ IF ( ASSIMP_BUILD_SAMPLES)
ADD_SUBDIRECTORY( samples/SimpleOpenGL/ )
ENDIF ( ASSIMP_BUILD_SAMPLES )
OPTION ( ASSIMP_BUILD_TESTS
"If the test suite for Assimp is built in addition to the library."
ON
)
IF ( ASSIMP_BUILD_TESTS )
ADD_SUBDIRECTORY( test/ )
ENDIF ( ASSIMP_BUILD_TESTS )
IF(MSVC)
OPTION ( ASSIMP_INSTALL_PDB
"Install MSVC debug files."
ON
)
ENDIF(MSVC)
# Generate a pkg-config .pc for the Assimp library.
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/assimp.pc.in" "${PROJECT_BINARY_DIR}/assimp.pc" @ONLY )
INSTALL( FILES "${PROJECT_BINARY_DIR}/assimp.pc" DESTINATION ${ASSIMP_LIB_INSTALL_DIR}/pkgconfig/ COMPONENT ${LIBASSIMP-DEV_COMPONENT})

View File

@ -1,6 +1,5 @@
Open Asset Import Library (assimp)
==================================
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
APIs are provided for C and C++. There are various bindings to other languages (C#, Java, Python, Delphi, D). Assimp also runs on Android and iOS.
@ -15,7 +14,7 @@ Coverity<a href="https://scan.coverity.com/projects/5607">
<img alt="Coverity Scan Build Status"
src="https://scan.coverity.com/projects/5607/badge.svg"/>
</a>
<br>
__[open3mod](https://github.com/acgessler/open3mod) is a powerful 3D model viewer based on Assimp's import and export abilities.__
#### Supported file formats ####
@ -115,8 +114,9 @@ If the docs don't solve your problem, ask on [StackOverflow](http://stackoverflo
For development discussions, there is also a (very low-volume) mailing list, _assimp-discussions_
[(subscribe here)]( https://lists.sourceforge.net/lists/listinfo/assimp-discussions)
And we also have an IRC-channel at freenode: #assetimporterlib . You can easily join us via: [KiwiIRC/freenote](https://kiwiirc.com/client/irc.freenode.net), choose your nickname and type
> /join #assetimporterlib
Open Asset Import Library is a library to load various 3d file formats into a shared, in-memory format. It supports more than __40 file formats__ for import and a growing selection of file formats for export.
And we also have a Gitter-channel:Gitter [![Join the chat at https://gitter.im/assimp/assimp](https://badges.gitter.im/assimp/assimp.svg)](https://gitter.im/assimp/assimp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)<br>
### Contributing ###
Contributions to assimp are highly appreciated. The easiest way to get involved is to submit

View File

@ -1,5 +1,5 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@/@ASSIMP_BIN_INSTALL_DIR@
exec_prefix=@CMAKE_INSTALL_PREFIX@/
libdir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_LIB_INSTALL_DIR@
includedir=@CMAKE_INSTALL_PREFIX@/@ASSIMP_INCLUDE_INSTALL_DIR@/assimp

View File

@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers
#include "3DSLoader.h"
#include "TargetAnimation.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include "StringComparison.h"
#include <memory>
#include <cctype>
@ -197,7 +197,7 @@ void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type)
// Setup the texture blend factor
if (is_not_qnan(texture.mTextureBlend))
mat.AddProperty<float>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0));
mat.AddProperty<ai_real>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0));
// Setup the texture mapping mode
mat.AddProperty<int>((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_U(type,0));
@ -207,14 +207,14 @@ void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type)
// FIXME: this is not really correct ...
if (texture.mMapMode == aiTextureMapMode_Mirror)
{
texture.mScaleU *= 2.f;
texture.mScaleV *= 2.f;
texture.mOffsetU /= 2.f;
texture.mOffsetV /= 2.f;
texture.mScaleU *= 2.0;
texture.mScaleV *= 2.0;
texture.mOffsetU /= 2.0;
texture.mOffsetV /= 2.0;
}
// Setup texture UV transformations
mat.AddProperty<float>(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0));
mat.AddProperty<ai_real>(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0));
}
// ------------------------------------------------------------------------------------------------
@ -265,10 +265,10 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material& oldMat,
}
// Opacity
mat.AddProperty<float>( &oldMat.mTransparency,1,AI_MATKEY_OPACITY);
mat.AddProperty<ai_real>( &oldMat.mTransparency,1,AI_MATKEY_OPACITY);
// Bump height scaling
mat.AddProperty<float>( &oldMat.mBumpHeight,1,AI_MATKEY_BUMPSCALING);
mat.AddProperty<ai_real>( &oldMat.mBumpHeight,1,AI_MATKEY_BUMPSCALING);
// Two sided rendering?
if (oldMat.mTwoSided)

View File

@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SceneCombiner.h"
#include "SplitLargeMeshes.h"
#include "StringComparison.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/Exporter.hpp"
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/Exporter.hpp>
#include <memory>
using namespace Assimp;

View File

@ -327,11 +327,11 @@ struct Texture
{
//! Default constructor
Texture()
: mOffsetU (0.0f)
, mOffsetV (0.0f)
, mScaleU (1.0f)
, mScaleV (1.0f)
, mRotation (0.0f)
: mOffsetU (0.0)
, mOffsetV (0.0)
, mScaleU (1.0)
, mScaleV (1.0)
, mRotation (0.0)
, mMapMode (aiTextureMapMode_Wrap)
, bPrivate()
, iUVSrc (0)
@ -340,17 +340,17 @@ struct Texture
}
//! Specifies the blend factor for the texture
float mTextureBlend;
ai_real mTextureBlend;
//! Specifies the filename of the texture
std::string mMapName;
//! Specifies texture coordinate offsets/scaling/rotations
float mOffsetU;
float mOffsetV;
float mScaleU;
float mScaleV;
float mRotation;
ai_real mOffsetU;
ai_real mOffsetV;
ai_real mScaleU;
ai_real mScaleV;
ai_real mRotation;
//! Specifies the mapping mode to be used for the texture
aiTextureMapMode mMapMode;
@ -369,12 +369,12 @@ struct Material
//! Default constructor. Builds a default name for the material
Material()
:
mDiffuse (0.6f,0.6f,0.6f), // FIX ... we won't want object to be black
mSpecularExponent (0.0f),
mShininessStrength (1.0f),
mDiffuse (0.6,0.6,0.6), // FIX ... we won't want object to be black
mSpecularExponent (0.0),
mShininessStrength (1.0),
mShading(Discreet3DS::Gouraud),
mTransparency (1.0f),
mBumpHeight (1.0f),
mTransparency (1.0),
mBumpHeight (1.0),
mTwoSided (false)
{
static int iCnt = 0;
@ -389,9 +389,9 @@ struct Material
//! Diffuse color of the material
aiColor3D mDiffuse;
//! Specular exponent
float mSpecularExponent;
ai_real mSpecularExponent;
//! Shininess strength, in percent
float mShininessStrength;
ai_real mShininessStrength;
//! Specular color of the material
aiColor3D mSpecular;
//! Ambient color of the material
@ -399,7 +399,7 @@ struct Material
//! Shading type to be used
Discreet3DS::shadetype3ds mShading;
//! Opacity of the material
float mTransparency;
ai_real mTransparency;
//! Diffuse texture channel
Texture sTexDiffuse;
//! Opacity texture channel
@ -415,7 +415,7 @@ struct Material
//! Shininess texture channel
Texture sTexShininess;
//! Scaling factor for the bump values
float mBumpHeight;
ai_real mBumpHeight;
//! Emissive color
aiColor3D mEmissive;
//! Ambient texture channel
@ -459,7 +459,7 @@ struct Mesh : public MeshWithSmoothingGroups<D3DS::Face>
struct aiFloatKey
{
double mTime; ///< The time of this key
float mValue; ///< The value of this key
ai_real mValue; ///< The value of this key
#ifdef __cplusplus

View File

@ -51,9 +51,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers
#include "3DSLoader.h"
#include "Macros.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/scene.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/IOSystem.hpp>
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include "StringComparison.h"
using namespace Assimp;
@ -186,15 +186,14 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile,
// internal verbose representation. Finally compute normal
// vectors from the smoothing groups we read from the
// file.
for (std::vector<D3DS::Mesh>::iterator i = mScene->mMeshes.begin(),
end = mScene->mMeshes.end(); i != end;++i) {
if ((*i).mFaces.size() > 0 && (*i).mPositions.size() == 0) {
for (auto &mesh : mScene->mMeshes) {
if (mesh.mFaces.size() > 0 && mesh.mPositions.size() == 0) {
delete mScene;
throw DeadlyImportError("3DS file contains faces but no vertices: " + pFile);
}
CheckIndices(*i);
MakeUnique (*i);
ComputeNormalsWithSmoothingsGroups<D3DS::Face>(*i);
CheckIndices(mesh);
MakeUnique (mesh);
ComputeNormalsWithSmoothingsGroups<D3DS::Face>(mesh);
}
// Replace all occurrences of the default material with a
@ -459,20 +458,20 @@ void Discreet3DSImporter::ParseChunk(const char* name, unsigned int num)
camera->mLookAt.x = stream->GetF4() - camera->mPosition.x;
camera->mLookAt.y = stream->GetF4() - camera->mPosition.y;
camera->mLookAt.z = stream->GetF4() - camera->mPosition.z;
float len = camera->mLookAt.Length();
if (len < 1e-5f) {
ai_real len = camera->mLookAt.Length();
if (len < 1e-5) {
// There are some files with lookat == position. Don't know why or whether it's ok or not.
DefaultLogger::get()->error("3DS: Unable to read proper camera look-at vector");
camera->mLookAt = aiVector3D(0.f,1.f,0.f);
camera->mLookAt = aiVector3D(0.0,1.0,0.0);
}
else camera->mLookAt /= len;
// And finally - the camera rotation angle, in counter clockwise direction
const float angle = AI_DEG_TO_RAD( stream->GetF4() );
const ai_real angle = AI_DEG_TO_RAD( stream->GetF4() );
aiQuaternion quat(camera->mLookAt,angle);
camera->mUp = quat.GetMatrix() * aiVector3D(0.f,1.f,0.f);
camera->mUp = quat.GetMatrix() * aiVector3D(0.0,1.0,0.0);
// Read the lense angle
camera->mHorizontalFOV = AI_DEG_TO_RAD ( stream->GetF4() );
@ -1168,13 +1167,13 @@ void Discreet3DSImporter::ParseMaterialChunk()
case Discreet3DS::CHUNK_MAT_TRANSPARENCY:
{
// This is the material's transparency
float* pcf = &mScene->mMaterials.back().mTransparency;
ai_real* pcf = &mScene->mMaterials.back().mTransparency;
*pcf = ParsePercentageChunk();
// NOTE: transparency, not opacity
if (is_qnan(*pcf))
*pcf = 1.0f;
else *pcf = 1.0f - *pcf * (float)0xFFFF / 100.0f;
*pcf = 1.0;
else *pcf = 1.0 - *pcf * (ai_real)0xFFFF / 100.0;
}
break;
@ -1190,30 +1189,30 @@ void Discreet3DSImporter::ParseMaterialChunk()
case Discreet3DS::CHUNK_MAT_SHININESS:
{ // This is the shininess of the material
float* pcf = &mScene->mMaterials.back().mSpecularExponent;
ai_real* pcf = &mScene->mMaterials.back().mSpecularExponent;
*pcf = ParsePercentageChunk();
if (is_qnan(*pcf))
*pcf = 0.0f;
else *pcf *= (float)0xFFFF;
*pcf = 0.0;
else *pcf *= (ai_real)0xFFFF;
}
break;
case Discreet3DS::CHUNK_MAT_SHININESS_PERCENT:
{ // This is the shininess strength of the material
float* pcf = &mScene->mMaterials.back().mShininessStrength;
ai_real* pcf = &mScene->mMaterials.back().mShininessStrength;
*pcf = ParsePercentageChunk();
if (is_qnan(*pcf))
*pcf = 0.0f;
else *pcf *= (float)0xffff / 100.0f;
*pcf = 0.0;
else *pcf *= (ai_real)0xffff / 100.0;
}
break;
case Discreet3DS::CHUNK_MAT_SELF_ILPCT:
{ // This is the self illumination strength of the material
float f = ParsePercentageChunk();
ai_real f = ParsePercentageChunk();
if (is_qnan(f))
f = 0.0f;
else f *= (float)0xFFFF / 100.0f;
f = 0.0;
else f *= (ai_real)0xFFFF / 100.0;
mScene->mMaterials.back().mEmissive = aiColor3D(f,f,f);
}
break;
@ -1278,7 +1277,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
case Discreet3DS::CHUNK_PERCENTW:
// Manually parse the blend factor
pcOut->mTextureBlend = (float)((uint16_t)stream->GetI2()) / 100.0f;
pcOut->mTextureBlend = (ai_real)((uint16_t)stream->GetI2()) / 100.0;
break;
case Discreet3DS::CHUNK_MAT_MAP_USCALE:
@ -1337,7 +1336,7 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
// ------------------------------------------------------------------------------------------------
// Read a percentage chunk
float Discreet3DSImporter::ParsePercentageChunk()
ai_real Discreet3DSImporter::ParsePercentageChunk()
{
Discreet3DS::Chunk chunk;
ReadChunk(&chunk);
@ -1345,7 +1344,7 @@ float Discreet3DSImporter::ParsePercentageChunk()
if (Discreet3DS::CHUNK_PERCENTF == chunk.Flag)
return stream->GetF4();
else if (Discreet3DS::CHUNK_PERCENTW == chunk.Flag)
return (float)((uint16_t)stream->GetI2()) / (float)0xFFFF;
return (ai_real)((uint16_t)stream->GetI2()) / (ai_real)0xFFFF;
return get_qnan();
}
@ -1357,7 +1356,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
ai_assert(out != NULL);
// error return value
const float qnan = get_qnan();
const ai_real qnan = get_qnan();
static const aiColor3D clrError = aiColor3D(qnan,qnan,qnan);
Discreet3DS::Chunk chunk;
@ -1373,7 +1372,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
bGamma = true;
case Discreet3DS::CHUNK_RGBF:
if (sizeof(float) * 3 > diff) {
if (sizeof(ai_real) * 3 > diff) {
*out = clrError;
return;
}
@ -1389,9 +1388,9 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
*out = clrError;
return;
}
out->r = (float)(uint8_t)stream->GetI1() / 255.0f;
out->g = (float)(uint8_t)stream->GetI1() / 255.0f;
out->b = (float)(uint8_t)stream->GetI1() / 255.0f;
out->r = (ai_real)(uint8_t)stream->GetI1() / 255.0;
out->g = (ai_real)(uint8_t)stream->GetI1() / 255.0;
out->b = (ai_real)(uint8_t)stream->GetI1() / 255.0;
break;
// Percentage chunks are accepted, too.
@ -1405,7 +1404,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D* out,
case Discreet3DS::CHUNK_PERCENTW:
if (acceptPercent && 1 <= diff) {
out->g = out->b = out->r = (float)(uint8_t)stream->GetI1() / 255.0f;
out->g = out->b = out->r = (ai_real)(uint8_t)stream->GetI1() / 255.0;
break;
}
*out = clrError;

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_3DSIMPORTER_H_INC
#include "BaseImporter.h"
#include "../include/assimp/types.h"
#include <assimp/types.h>
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
@ -119,7 +119,7 @@ protected:
* chunk behind afterwards. If no percentage chunk is found
* QNAN is returned.
*/
float ParsePercentageChunk();
ai_real ParsePercentageChunk();
// -------------------------------------------------------------------
/** Parse a color chunk. mCurrent will point to the next
@ -265,7 +265,7 @@ protected:
aiColor3D mClrAmbient;
/** Master scaling factor of the scene */
float mMasterScale;
ai_real mMasterScale;
/** Path to the background image of the scene */
std::string mBackgroundImage;

View File

@ -53,13 +53,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Subdivision.h"
#include "Importer.h"
#include "BaseImporter.h"
#include "../include/assimp/Importer.hpp"
#include "../include/assimp/light.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/material.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/config.h"
#include "../include/assimp/IOSystem.hpp"
#include <assimp/Importer.hpp>
#include <assimp/light.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/material.h>
#include <assimp/scene.h>
#include <assimp/config.h>
#include <assimp/IOSystem.hpp>
#include <memory>
using namespace Assimp;

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include "BaseImporter.h"
#include "../include/assimp/types.h"
#include <assimp/types.h>
struct aiNode;
struct aiMesh;

View File

@ -50,12 +50,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StringComparison.h"
#include "SkeletonMeshBuilder.h"
#include "TargetAnimation.h"
#include "../include/assimp/Importer.hpp"
#include <memory>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/scene.h"
#include <assimp/Importer.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
#include <memory>
// utilities
#include "fast_atof.h"
@ -225,17 +225,13 @@ void ASEImporter::InternReadFile( const std::string& pFile,
+ mParser->m_vCameras.size() + mParser->m_vDummies.size());
// Lights
for (std::vector<ASE::Light>::iterator it = mParser->m_vLights.begin(),
end = mParser->m_vLights.end();it != end; ++it)nodes.push_back(&(*it));
for (auto &light : mParser->m_vLights)nodes.push_back(&light);
// Cameras
for (std::vector<ASE::Camera>::iterator it = mParser->m_vCameras.begin(),
end = mParser->m_vCameras.end();it != end; ++it)nodes.push_back(&(*it));
for (auto &camera : mParser->m_vCameras)nodes.push_back(&camera);
// Meshes
for (std::vector<ASE::Mesh>::iterator it = mParser->m_vMeshes.begin(),
end = mParser->m_vMeshes.end();it != end; ++it)nodes.push_back(&(*it));
for (auto &mesh : mParser->m_vMeshes)nodes.push_back(&mesh);
// Dummies
for (std::vector<ASE::Dummy>::iterator it = mParser->m_vDummies.begin(),
end = mParser->m_vDummies.end();it != end; ++it)nodes.push_back(&(*it));
for (auto &dummy : mParser->m_vDummies)nodes.push_back(&dummy);
// build the final node graph
BuildNodes(nodes);
@ -657,8 +653,8 @@ void ASEImporter::BuildNodes(std::vector<BaseNode*>& nodes) {
ch->mParent = root;
// Change the transformation matrix of all nodes
for (std::vector<BaseNode*>::iterator it = nodes.begin(), end = nodes.end();it != end; ++it) {
aiMatrix4x4& m = (*it)->mTransform;
for (BaseNode *node : nodes) {
aiMatrix4x4& m = node->mTransform;
m.Transpose(); // row-order vs column-order
}
@ -823,10 +819,10 @@ void CopyASETexture(aiMaterial& mat, ASE::Texture& texture, aiTextureType type)
// Setup the texture blend factor
if (is_not_qnan(texture.mTextureBlend))
mat.AddProperty<float>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0));
mat.AddProperty<ai_real>( &texture.mTextureBlend, 1, AI_MATKEY_TEXBLEND(type,0));
// Setup texture UV transformations
mat.AddProperty<float>(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0));
mat.AddProperty<ai_real>(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0));
}
// ------------------------------------------------------------------------------------------------
@ -869,7 +865,7 @@ void ASEImporter::ConvertMaterial(ASE::Material& mat)
}
// opacity
mat.pcInstance->AddProperty<float>( &mat.mTransparency,1,AI_MATKEY_OPACITY);
mat.pcInstance->AddProperty<ai_real>( &mat.mTransparency,1,AI_MATKEY_OPACITY);
// Two sided rendering?
if (mat.mTwoSided)

View File

@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_ASELOADER_H_INCLUDED
#include "BaseImporter.h"
#include "../include/assimp/types.h"
#include <assimp/types.h>
struct aiNode;
#include "ASEParser.h"

View File

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ASELoader.h"
#include "MaterialSystem.h"
#include "fast_atof.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/DefaultLogger.hpp>
using namespace Assimp;
using namespace Assimp::ASE;
@ -431,7 +431,7 @@ void Parser::ParseLV1SoftSkinBlock()
ParseString(bone,"*MESH_SOFTSKINVERTS.Bone");
// Find the bone in the mesh's list
std::pair<int,float> me;
std::pair<int,ai_real> me;
me.first = -1;
for (unsigned int n = 0; n < curMesh->mBones.size();++n)
@ -618,12 +618,12 @@ void Parser::ParseLV2MaterialBlock(ASE::Material& mat)
if (TokenMatch(filePtr,"MATERIAL_TRANSPARENCY",21))
{
ParseLV4MeshFloat(mat.mTransparency);
mat.mTransparency = 1.0f - mat.mTransparency;continue;
mat.mTransparency = 1.0 - mat.mTransparency;continue;
}
// material self illumination
if (TokenMatch(filePtr,"MATERIAL_SELFILLUM",18))
{
float f = 0.0f;
ai_real f = 0.0;
ParseLV4MeshFloat(f);
mat.mEmissive.r = f;
@ -1251,7 +1251,7 @@ void Parser::ParseLV3RotAnimationBlock(ASE::Animation& anim)
{
anim.akeyRotations.push_back(aiQuatKey());
aiQuatKey& key = anim.akeyRotations.back();
aiVector3D v;float f;
aiVector3D v;ai_real f;
ParseLV4MeshFloatTriple(&v.x,iIndex);
ParseLV4MeshFloat(f);
key.mTime = (double)iIndex;
@ -1604,7 +1604,7 @@ void Parser::ParseLV4MeshBonesVertices(unsigned int iNumVertices,ASE::Mesh& mesh
}
// --- ignored
float afVert[3];
ai_real afVert[3];
ParseLV4MeshFloatTriple(afVert);
std::pair<int,float> pairOut;
@ -2102,7 +2102,7 @@ void Parser::ParseLV4MeshLongTriple(unsigned int* apOut, unsigned int& rIndexOut
ParseLV4MeshLongTriple(apOut);
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut)
void Parser::ParseLV4MeshFloatTriple(ai_real* apOut, unsigned int& rIndexOut)
{
ai_assert(NULL != apOut);
@ -2113,7 +2113,7 @@ void Parser::ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut)
ParseLV4MeshFloatTriple(apOut);
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshFloatTriple(float* apOut)
void Parser::ParseLV4MeshFloatTriple(ai_real* apOut)
{
ai_assert(NULL != apOut);
@ -2121,19 +2121,19 @@ void Parser::ParseLV4MeshFloatTriple(float* apOut)
ParseLV4MeshFloat(apOut[i]);
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshFloat(float& fOut)
void Parser::ParseLV4MeshFloat(ai_real& fOut)
{
// skip spaces and tabs
if(!SkipSpaces(&filePtr))
{
// LOG
LogWarning("Unable to parse float: unexpected EOL [#1]");
fOut = 0.0f;
fOut = 0.0;
++iLineNumber;
return;
}
// parse the first float
filePtr = fast_atoreal_move<float>(filePtr,fOut);
filePtr = fast_atoreal_move<ai_real>(filePtr,fOut);
}
// ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshLong(unsigned int& iOut)

View File

@ -44,9 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_ASEFILEHELPER_H_INC
// public ASSIMP headers
#include "../include/assimp/types.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/anim.h"
#include <assimp/types.h>
#include <assimp/mesh.h>
#include <assimp/anim.h>
// for some helper routines like IsSpace()
#include "ParsingUtils.h"
@ -222,7 +222,7 @@ struct BaseNode
mName = szTemp;
// Set mTargetPosition to qnan
const float qnan = get_qnan();
const ai_real qnan = get_qnan();
mTargetPosition.x = qnan;
}
@ -317,9 +317,9 @@ struct Light : public BaseNode
LightType mLightType;
aiColor3D mColor;
float mIntensity;
float mAngle; // in degrees
float mFalloff;
ai_real mIntensity;
ai_real mAngle; // in degrees
ai_real mFalloff;
};
// ---------------------------------------------------------------------------
@ -342,7 +342,7 @@ struct Camera : public BaseNode
{
}
float mFOV, mNear, mFar;
ai_real mFOV, mNear, mFar;
CameraType mCameraType;
};
@ -544,13 +544,13 @@ private:
//! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
//! \param apOut Output buffer (3 floats)
//! \param rIndexOut Output index
void ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut);
void ParseLV4MeshFloatTriple(ai_real* apOut, unsigned int& rIndexOut);
// -------------------------------------------------------------------
//! Parse a *MESH_VERT block in a file
//! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
//! \param apOut Output buffer (3 floats)
void ParseLV4MeshFloatTriple(float* apOut);
void ParseLV4MeshFloatTriple(ai_real* apOut);
// -------------------------------------------------------------------
//! Parse a *MESH_TFACE block in a file
@ -568,7 +568,7 @@ private:
// -------------------------------------------------------------------
//! Parse a single float element
//! \param fOut Output float
void ParseLV4MeshFloat(float& fOut);
void ParseLV4MeshFloat(ai_real& fOut);
// -------------------------------------------------------------------
//! Parse a single int element

View File

@ -41,10 +41,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ASSBIN exporter main code
*/
#include "assbin_chunks.h"
#include "../include/assimp/version.h"
#include "../include/assimp/IOStream.hpp"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/Exporter.hpp"
#include <assimp/version.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/Exporter.hpp>
#include "ProcessHelper.h"
#include "Exceptional.h"

View File

@ -51,14 +51,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "AssbinLoader.h"
#include "assbin_chunks.h"
#include "MemoryIOWrapper.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/anim.h"
#include "../include/assimp/scene.h"
#include <assimp/mesh.h>
#include <assimp/anim.h>
#include <assimp/scene.h>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
# include <zlib.h>
#else
# include "../contrib/zlib/zlib.h"
# include <contrib/zlib/zlib.h>
#endif
using namespace Assimp;

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_ASSBINIMPORTER_H_INC
#include "BaseImporter.h"
#include "../include/assimp/types.h"
#include <assimp/types.h>
struct aiMesh;
struct aiNode;

View File

@ -546,11 +546,11 @@ ASSIMP_API void aiSetImportPropertyInteger(aiPropertyStore* p, const char* szNam
// ------------------------------------------------------------------------------------------------
// Importer::SetPropertyFloat
ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName, float value)
ASSIMP_API void aiSetImportPropertyFloat(aiPropertyStore* p, const char* szName, ai_real value)
{
ASSIMP_BEGIN_EXCEPTION_REGION();
PropertyMap* pp = reinterpret_cast<PropertyMap*>(p);
SetGenericProperty<float>(pp->floats,szName,value);
SetGenericProperty<ai_real>(pp->floats,szName,value);
ASSIMP_END_EXCEPTION_REGION(void);
}

View File

@ -47,7 +47,7 @@ Assimp C export interface. See Exporter.cpp for some notes.
#include "CInterfaceIOWrapper.h"
#include "SceneCombiner.h"
#include "ScenePrivate.h"
#include "../include/assimp/Exporter.hpp"
#include <assimp/Exporter.hpp>
using namespace Assimp;

View File

@ -43,14 +43,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdarg.h>
#include "./../include/assimp/version.h"
#include "ProcessHelper.h"
#include "../include/assimp/IOStream.hpp"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/Exporter.hpp"
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/Exporter.hpp>
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
# include <zlib.h>
#else
# include "../contrib/zlib/zlib.h"
# include <contrib/zlib/zlib.h>
#endif
#include <time.h>

View File

@ -52,10 +52,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ConvertToLHProcess.h"
#include "StringUtils.h"
#include <memory>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/anim.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/IOSystem.hpp>
#include <assimp/anim.h>
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
using namespace Assimp;

View File

@ -43,9 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_B3DIMPORTER_H_INC
#define AI_B3DIMPORTER_H_INC
#include "../include/assimp/types.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/material.h"
#include <assimp/types.h>
#include <assimp/mesh.h>
#include <assimp/material.h>
#include "BaseImporter.h"
#include <string>

View File

@ -46,11 +46,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BVHLoader.h"
#include "fast_atof.h"
#include "SkeletonMeshBuilder.h"
#include "../include/assimp/Importer.hpp"
#include <assimp/Importer.hpp>
#include <memory>
#include "TinyFormatter.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/scene.h"
#include <assimp/IOSystem.hpp>
#include <assimp/scene.h>
using namespace Assimp;
using namespace Assimp::Formatter;

View File

@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FileSystemFilter.h"
#include "Importer.h"
#include "ByteSwapper.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/Importer.hpp"
#include "../include/assimp/postprocess.h"
#include <assimp/scene.h>
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <ios>
#include <list>
#include <memory>

View File

@ -48,8 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <vector>
#include <set>
#include "../include/assimp/types.h"
#include "../include/assimp/ProgressHandler.hpp"
#include <assimp/types.h>
#include <assimp/ProgressHandler.hpp>
struct aiScene;

View File

@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BaseImporter.h"
#include "BaseProcess.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/scene.h"
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
#include "Importer.h"
using namespace Assimp;

View File

@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include "../include/assimp/types.h"
#include <assimp/types.h>
#include "GenericProperty.h"
struct aiScene;

View File

@ -47,8 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Bitmap.h"
#include "../include/assimp/texture.h"
#include "../include/assimp/IOStream.hpp"
#include <assimp/texture.h>
#include <assimp/IOStream.hpp>
#include "ByteSwapper.h"
namespace Assimp {

View File

@ -53,7 +53,8 @@ using namespace Assimp;
using namespace Assimp::Blender;
using namespace Assimp::Formatter;
bool match4(StreamReaderAny& stream, const char* string) {
static bool match4(StreamReaderAny& stream, const char* string) {
ai_assert( nullptr != string );
char tmp[] = {
(stream).GetI1(),
(stream).GetI1(),

View File

@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BaseImporter.h"
#include "TinyFormatter.h"
#include "StreamReader.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/DefaultLogger.hpp>
#include <stdint.h>
#include <memory>
@ -61,10 +61,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// #define ASSIMP_BUILD_BLENDER_NO_STATS
namespace Assimp {
template <bool,bool> class StreamReader;
typedef StreamReader<true,true> StreamReaderAny;
namespace Blender {
class FileDatabase;
struct FileBlockHead;
@ -78,20 +80,21 @@ namespace Assimp {
* the loader itself, it will still be caught by Assimp due to its
* ancestry. */
// -------------------------------------------------------------------------------
struct Error : DeadlyImportError
{
struct Error : DeadlyImportError {
Error (const std::string& s)
: DeadlyImportError(s)
{}
: DeadlyImportError(s) {
// empty
}
};
// -------------------------------------------------------------------------------
/** The only purpose of this structure is to feed a virtual dtor into its
* descendents. It serves as base class for all data structure fields. */
// -------------------------------------------------------------------------------
struct ElemBase
{
virtual ~ElemBase() {}
struct ElemBase {
virtual ~ElemBase() {
// empty
}
/** Type name of the element. The type
* string points is the `c_str` of the `name` attribute of the
@ -103,25 +106,28 @@ struct ElemBase
const char* dna_type;
};
// -------------------------------------------------------------------------------
/** Represents a generic pointer to a memory location, which can be either 32
* or 64 bits. These pointers are loaded from the BLEND file and finally
* fixed to point to the real, converted representation of the objects
* they used to point to.*/
// -------------------------------------------------------------------------------
struct Pointer
{
Pointer() : val() {}
struct Pointer {
Pointer()
: val() {
// empty
}
uint64_t val;
};
// -------------------------------------------------------------------------------
/** Represents a generic offset within a BLEND file */
// -------------------------------------------------------------------------------
struct FileOffset
{
FileOffset() : val() {}
struct FileOffset {
FileOffset()
: val() {
// empty
}
uint64_t val;
};
@ -132,8 +138,7 @@ struct FileOffset
* functions of shared_ptr */
// -------------------------------------------------------------------------------
template <typename T>
class vector : public std::vector<T>
{
class vector : public std::vector<T> {
public:
using std::vector<T>::resize;
using std::vector<T>::empty;
@ -150,8 +155,7 @@ public:
// -------------------------------------------------------------------------------
/** Mixed flags for use in #Field */
// -------------------------------------------------------------------------------
enum FieldFlags
{
enum FieldFlags {
FieldFlag_Pointer = 0x1,
FieldFlag_Array = 0x2
};
@ -159,8 +163,7 @@ enum FieldFlags
// -------------------------------------------------------------------------------
/** Represents a single member of a data structure in a BLEND file */
// -------------------------------------------------------------------------------
struct Field
{
struct Field {
std::string name;
std::string type;
@ -180,8 +183,7 @@ struct Field
* mission critical so we need them, while others can silently be default
* initialized and no animations are harmed. */
// -------------------------------------------------------------------------------
enum ErrorPolicy
{
enum ErrorPolicy {
/** Substitute default value and ignore */
ErrorPolicy_Igno,
/** Substitute default value and write to log */
@ -202,15 +204,14 @@ enum ErrorPolicy
* binary `blob` read from the file to such a structure instance with
* meaningful contents. */
// -------------------------------------------------------------------------------
class Structure
{
class Structure {
template <template <typename> class> friend class ObjectCache;
public:
Structure()
: cache_idx(static_cast<size_t>(-1) )
{}
: cache_idx(static_cast<size_t>(-1) ){
// empty
}
public:
@ -709,8 +710,6 @@ class FileDatabase
template <template <typename> class TOUT> friend class ObjectCache;
public:
FileDatabase()
: _cacheArrays(*this)
, _cache(*this)
@ -718,7 +717,6 @@ public:
{}
public:
// publicly accessible fields
bool i64bit;
bool little;

View File

@ -532,7 +532,7 @@ template <typename T> struct signless;
template <> struct signless<char> {typedef unsigned char type;};
template <> struct signless<short> {typedef unsigned short type;};
template <> struct signless<int> {typedef unsigned int type;};
template <> struct signless<unsigned char> { typedef unsigned char type; };
template <typename T>
struct static_cast_silent {
template <typename V>
@ -614,6 +614,22 @@ template <> inline void Structure :: Convert<char> (char& dest,const FileDatab
ConvertDispatcher(dest,*this,db);
}
// ------------------------------------------------------------------------------------------------
template <> inline void Structure::Convert<unsigned char>(unsigned char& dest, const FileDatabase& db) const
{
// automatic rescaling from char to float and vice versa (seems useful for RGB colors)
if (name == "float") {
dest = static_cast<unsigned char>(db.reader->GetF4() * 255.f);
return;
}
else if (name == "double") {
dest = static_cast<unsigned char>(db.reader->GetF8() * 255.f);
return;
}
ConvertDispatcher(dest, *this, db);
}
// ------------------------------------------------------------------------------------------------
template <> inline void Structure :: Convert<float> (float& dest,const FileDatabase& db) const
{

View File

@ -123,7 +123,8 @@ namespace Blender {
struct ObjectCompare {
bool operator() (const Object* left, const Object* right) const {
return strcmp(left->id.name, right->id.name) == -1;
printf( "left: %s, right: %s\n", left->id.name, right->id.name );
return ::strncmp(left->id.name, right->id.name, strlen( left->id.name ) ) == 0;
}
};
@ -144,7 +145,8 @@ namespace Blender {
struct ObjectCompare {
bool operator() (const Object* left, const Object* right) const {
return strcmp(left->id.name, right->id.name) == -1;
printf( "left: %s, right: %s\n", left->id.name, right->id.name );
return ::strncmp( left->id.name, right->id.name, strlen( left->id.name ) ) == 0;
}
};

View File

@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderModifier.h"
#include "BlenderBMesh.h"
#include "StringUtils.h"
#include "../include/assimp/scene.h"
#include <assimp/scene.h>
#include "StringComparison.h"
#include "StreamReader.h"
@ -554,10 +554,8 @@ void BlenderImporter::ResolveTexture(aiMaterial* out, const Material* mat, const
}
// ------------------------------------------------------------------------------------------------
void BlenderImporter::BuildMaterials(ConversionData& conv_data)
void BlenderImporter::BuildDefaultMaterial(Blender::ConversionData& conv_data)
{
conv_data.materials->reserve(conv_data.materials_raw.size());
// add a default material if necessary
unsigned int index = static_cast<unsigned int>( -1 );
for( aiMesh* mesh : conv_data.meshes.get() ) {
@ -588,6 +586,124 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
mesh->mMaterialIndex = index;
}
}
}
void BlenderImporter::AddBlendParams(aiMaterial* result, const Material* source)
{
aiColor3D diffuseColor(source->r, source->g, source->b);
result->AddProperty(&diffuseColor, 1, "$mat.blend.diffuse.color", 0, 0);
float diffuseIntensity = source->ref;
result->AddProperty(&diffuseIntensity, 1, "$mat.blend.diffuse.intensity", 0, 0);
int diffuseShader = source->diff_shader;
result->AddProperty(&diffuseShader, 1, "$mat.blend.diffuse.shader", 0, 0);
int diffuseRamp = 0;
result->AddProperty(&diffuseRamp, 1, "$mat.blend.diffuse.ramp", 0, 0);
aiColor3D specularColor(source->specr, source->specg, source->specb);
result->AddProperty(&specularColor, 1, "$mat.blend.specular.color", 0, 0);
float specularIntensity = source->spec;
result->AddProperty(&specularIntensity, 1, "$mat.blend.specular.intensity", 0, 0);
int specularShader = source->spec_shader;
result->AddProperty(&specularShader, 1, "$mat.blend.specular.shader", 0, 0);
int specularRamp = 0;
result->AddProperty(&specularRamp, 1, "$mat.blend.specular.ramp", 0, 0);
int specularHardness = source->har;
result->AddProperty(&specularHardness, 1, "$mat.blend.specular.hardness", 0, 0);
int transparencyUse = source->mode & MA_TRANSPARENCY ? 1 : 0;
result->AddProperty(&transparencyUse, 1, "$mat.blend.transparency.use", 0, 0);
int transparencyMethod = source->mode & MA_RAYTRANSP ? 2 : (source->mode & MA_ZTRANSP ? 1 : 0);
result->AddProperty(&transparencyMethod, 1, "$mat.blend.transparency.method", 0, 0);
float transparencyAlpha = source->alpha;
result->AddProperty(&transparencyAlpha, 1, "$mat.blend.transparency.alpha", 0, 0);
float transparencySpecular = source->spectra;
result->AddProperty(&transparencySpecular, 1, "$mat.blend.transparency.specular", 0, 0);
float transparencyFresnel = source->fresnel_tra;
result->AddProperty(&transparencyFresnel, 1, "$mat.blend.transparency.fresnel", 0, 0);
float transparencyBlend = source->fresnel_tra_i;
result->AddProperty(&transparencyBlend, 1, "$mat.blend.transparency.blend", 0, 0);
float transparencyIor = source->ang;
result->AddProperty(&transparencyIor, 1, "$mat.blend.transparency.ior", 0, 0);
float transparencyFilter = source->filter;
result->AddProperty(&transparencyFilter, 1, "$mat.blend.transparency.filter", 0, 0);
float transparencyFalloff = source->tx_falloff;
result->AddProperty(&transparencyFalloff, 1, "$mat.blend.transparency.falloff", 0, 0);
float transparencyLimit = source->tx_limit;
result->AddProperty(&transparencyLimit, 1, "$mat.blend.transparency.limit", 0, 0);
int transparencyDepth = source->ray_depth_tra;
result->AddProperty(&transparencyDepth, 1, "$mat.blend.transparency.depth", 0, 0);
float transparencyGlossAmount = source->gloss_tra;
result->AddProperty(&transparencyGlossAmount, 1, "$mat.blend.transparency.glossAmount", 0, 0);
float transparencyGlossThreshold = source->adapt_thresh_tra;
result->AddProperty(&transparencyGlossThreshold, 1, "$mat.blend.transparency.glossThreshold", 0, 0);
int transparencyGlossSamples = source->samp_gloss_tra;
result->AddProperty(&transparencyGlossSamples, 1, "$mat.blend.transparency.glossSamples", 0, 0);
int mirrorUse = source->mode & MA_RAYMIRROR ? 1 : 0;
result->AddProperty(&mirrorUse, 1, "$mat.blend.mirror.use", 0, 0);
float mirrorReflectivity = source->ray_mirror;
result->AddProperty(&mirrorReflectivity, 1, "$mat.blend.mirror.reflectivity", 0, 0);
aiColor3D mirrorColor(source->mirr, source->mirg, source->mirb);
result->AddProperty(&mirrorColor, 1, "$mat.blend.mirror.color", 0, 0);
float mirrorFresnel = source->fresnel_mir;
result->AddProperty(&mirrorFresnel, 1, "$mat.blend.mirror.fresnel", 0, 0);
float mirrorBlend = source->fresnel_mir_i;
result->AddProperty(&mirrorBlend, 1, "$mat.blend.mirror.blend", 0, 0);
int mirrorDepth = source->ray_depth;
result->AddProperty(&mirrorDepth, 1, "$mat.blend.mirror.depth", 0, 0);
float mirrorMaxDist = source->dist_mir;
result->AddProperty(&mirrorMaxDist, 1, "$mat.blend.mirror.maxDist", 0, 0);
int mirrorFadeTo = source->fadeto_mir;
result->AddProperty(&mirrorFadeTo, 1, "$mat.blend.mirror.fadeTo", 0, 0);
float mirrorGlossAmount = source->gloss_mir;
result->AddProperty(&mirrorGlossAmount, 1, "$mat.blend.mirror.glossAmount", 0, 0);
float mirrorGlossThreshold = source->adapt_thresh_mir;
result->AddProperty(&mirrorGlossThreshold, 1, "$mat.blend.mirror.glossThreshold", 0, 0);
int mirrorGlossSamples = source->samp_gloss_mir;
result->AddProperty(&mirrorGlossSamples, 1, "$mat.blend.mirror.glossSamples", 0, 0);
float mirrorGlossAnisotropic = source->aniso_gloss_mir;
result->AddProperty(&mirrorGlossAnisotropic, 1, "$mat.blend.mirror.glossAnisotropic", 0, 0);
}
void BlenderImporter::BuildMaterials(ConversionData& conv_data)
{
conv_data.materials->reserve(conv_data.materials_raw.size());
BuildDefaultMaterial(conv_data);
for(std::shared_ptr<Material> mat : conv_data.materials_raw) {
@ -604,7 +720,6 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
aiString name = aiString(mat->id.name+2); // skip over the name prefix 'MA'
mout->AddProperty(&name,AI_MATKEY_NAME);
// basic material colors
aiColor3D col(mat->r,mat->g,mat->b);
if (mat->r || mat->g || mat->b ) {
@ -647,6 +762,8 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
ResolveTexture(mout,mat.get(),mat->mtex[i].get(),conv_data);
}
AddBlendParams(mout, mat.get());
}
}
@ -1001,12 +1118,13 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
const aiFace& f = out->mFaces[out->mNumFaces++];
aiColor4D* vo = &out->mColors[0][out->mNumVertices];
const ai_real scaleZeroToOne = 1.f/255.f;
for (unsigned int j = 0; j < f.mNumIndices; ++j,++vo,++out->mNumVertices) {
const MLoopCol& col = mesh->mloopcol[v.loopstart + j];
vo->r = col.r;
vo->g = col.g;
vo->b = col.b;
vo->a = col.a;
vo->r = ai_real(col.r) * scaleZeroToOne;
vo->g = ai_real(col.g) * scaleZeroToOne;
vo->b = ai_real(col.b) * scaleZeroToOne;
vo->a = ai_real(col.a) * scaleZeroToOne;
}
}

View File

@ -179,6 +179,15 @@ private:
);
// --------------------
void BuildDefaultMaterial(
Blender::ConversionData& conv_data
);
void AddBlendParams(
aiMaterial* result,
const Blender::Material* source
);
void BuildMaterials(
Blender::ConversionData& conv_data
);

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderModifier.h"
#include "SceneCombiner.h"
#include "Subdivision.h"
#include "../include/assimp/scene.h"
#include <assimp/scene.h>
#include <memory>
#include <functional>

View File

@ -301,7 +301,6 @@ template <> void Structure :: Convert<Material> (
const FileDatabase& db
) const
{
ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Warn>(dest.r,"r",db);
ReadField<ErrorPolicy_Warn>(dest.g,"g",db);
@ -330,6 +329,91 @@ template <> void Structure :: Convert<Material> (
ReadField<ErrorPolicy_Warn>(dest.spec_shader,"spec_shader",db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mtex,"*mtex",db);
ReadField<ErrorPolicy_Igno>(dest.amb, "amb", db);
ReadField<ErrorPolicy_Igno>(dest.ang, "ang", db);
ReadField<ErrorPolicy_Igno>(dest.spectra, "spectra", db);
ReadField<ErrorPolicy_Igno>(dest.spec, "spec", db);
ReadField<ErrorPolicy_Igno>(dest.zoffs, "zoffs", db);
ReadField<ErrorPolicy_Igno>(dest.add, "add", db);
ReadField<ErrorPolicy_Igno>(dest.fresnel_mir, "fresnel_mir", db);
ReadField<ErrorPolicy_Igno>(dest.fresnel_mir_i, "fresnel_mir_i", db);
ReadField<ErrorPolicy_Igno>(dest.fresnel_tra, "fresnel_tra", db);
ReadField<ErrorPolicy_Igno>(dest.fresnel_tra_i, "fresnel_tra_i", db);
ReadField<ErrorPolicy_Igno>(dest.filter, "filter", db);
ReadField<ErrorPolicy_Igno>(dest.tx_limit, "tx_limit", db);
ReadField<ErrorPolicy_Igno>(dest.tx_falloff, "tx_falloff", db);
ReadField<ErrorPolicy_Igno>(dest.gloss_mir, "gloss_mir", db);
ReadField<ErrorPolicy_Igno>(dest.gloss_tra, "gloss_tra", db);
ReadField<ErrorPolicy_Igno>(dest.adapt_thresh_mir, "adapt_thresh_mir", db);
ReadField<ErrorPolicy_Igno>(dest.adapt_thresh_tra, "adapt_thresh_tra", db);
ReadField<ErrorPolicy_Igno>(dest.aniso_gloss_mir, "aniso_gloss_mir", db);
ReadField<ErrorPolicy_Igno>(dest.dist_mir, "dist_mir", db);
ReadField<ErrorPolicy_Igno>(dest.hasize, "hasize", db);
ReadField<ErrorPolicy_Igno>(dest.flaresize, "flaresize", db);
ReadField<ErrorPolicy_Igno>(dest.subsize, "subsize", db);
ReadField<ErrorPolicy_Igno>(dest.flareboost, "flareboost", db);
ReadField<ErrorPolicy_Igno>(dest.strand_sta, "strand_sta", db);
ReadField<ErrorPolicy_Igno>(dest.strand_end, "strand_end", db);
ReadField<ErrorPolicy_Igno>(dest.strand_ease, "strand_ease", db);
ReadField<ErrorPolicy_Igno>(dest.strand_surfnor, "strand_surfnor", db);
ReadField<ErrorPolicy_Igno>(dest.strand_min, "strand_min", db);
ReadField<ErrorPolicy_Igno>(dest.strand_widthfade, "strand_widthfade", db);
ReadField<ErrorPolicy_Igno>(dest.sbias, "sbias", db);
ReadField<ErrorPolicy_Igno>(dest.lbias, "lbias", db);
ReadField<ErrorPolicy_Igno>(dest.shad_alpha, "shad_alpha", db);
ReadField<ErrorPolicy_Igno>(dest.param, "param", db);
ReadField<ErrorPolicy_Igno>(dest.rms, "rms", db);
ReadField<ErrorPolicy_Igno>(dest.rampfac_col, "rampfac_col", db);
ReadField<ErrorPolicy_Igno>(dest.rampfac_spec, "rampfac_spec", db);
ReadField<ErrorPolicy_Igno>(dest.friction, "friction", db);
ReadField<ErrorPolicy_Igno>(dest.fh, "fh", db);
ReadField<ErrorPolicy_Igno>(dest.reflect, "reflect", db);
ReadField<ErrorPolicy_Igno>(dest.fhdist, "fhdist", db);
ReadField<ErrorPolicy_Igno>(dest.xyfrict, "xyfrict", db);
ReadField<ErrorPolicy_Igno>(dest.sss_radius, "sss_radius", db);
ReadField<ErrorPolicy_Igno>(dest.sss_col, "sss_col", db);
ReadField<ErrorPolicy_Igno>(dest.sss_error, "sss_error", db);
ReadField<ErrorPolicy_Igno>(dest.sss_scale, "sss_scale", db);
ReadField<ErrorPolicy_Igno>(dest.sss_ior, "sss_ior", db);
ReadField<ErrorPolicy_Igno>(dest.sss_colfac, "sss_colfac", db);
ReadField<ErrorPolicy_Igno>(dest.sss_texfac, "sss_texfac", db);
ReadField<ErrorPolicy_Igno>(dest.sss_front, "sss_front", db);
ReadField<ErrorPolicy_Igno>(dest.sss_back, "sss_back", db);
ReadField<ErrorPolicy_Igno>(dest.material_type, "material_type", db);
ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db);
ReadField<ErrorPolicy_Igno>(dest.ray_depth, "ray_depth", db);
ReadField<ErrorPolicy_Igno>(dest.ray_depth_tra, "ray_depth_tra", db);
ReadField<ErrorPolicy_Igno>(dest.samp_gloss_mir, "samp_gloss_mir", db);
ReadField<ErrorPolicy_Igno>(dest.samp_gloss_tra, "samp_gloss_tra", db);
ReadField<ErrorPolicy_Igno>(dest.fadeto_mir, "fadeto_mir", db);
ReadField<ErrorPolicy_Igno>(dest.shade_flag, "shade_flag", db);
ReadField<ErrorPolicy_Igno>(dest.flarec, "flarec", db);
ReadField<ErrorPolicy_Igno>(dest.starc, "starc", db);
ReadField<ErrorPolicy_Igno>(dest.linec, "linec", db);
ReadField<ErrorPolicy_Igno>(dest.ringc, "ringc", db);
ReadField<ErrorPolicy_Igno>(dest.pr_lamp, "pr_lamp", db);
ReadField<ErrorPolicy_Igno>(dest.pr_texture, "pr_texture", db);
ReadField<ErrorPolicy_Igno>(dest.ml_flag, "ml_flag", db);
ReadField<ErrorPolicy_Igno>(dest.diff_shader, "diff_shader", db);
ReadField<ErrorPolicy_Igno>(dest.spec_shader, "spec_shader", db);
ReadField<ErrorPolicy_Igno>(dest.texco, "texco", db);
ReadField<ErrorPolicy_Igno>(dest.mapto, "mapto", db);
ReadField<ErrorPolicy_Igno>(dest.ramp_show, "ramp_show", db);
ReadField<ErrorPolicy_Igno>(dest.pad3, "pad3", db);
ReadField<ErrorPolicy_Igno>(dest.dynamode, "dynamode", db);
ReadField<ErrorPolicy_Igno>(dest.pad2, "pad2", db);
ReadField<ErrorPolicy_Igno>(dest.sss_flag, "sss_flag", db);
ReadField<ErrorPolicy_Igno>(dest.sss_preset, "sss_preset", db);
ReadField<ErrorPolicy_Igno>(dest.shadowonly_flag, "shadowonly_flag", db);
ReadField<ErrorPolicy_Igno>(dest.index, "index", db);
ReadField<ErrorPolicy_Igno>(dest.vcol_alpha, "vcol_alpha", db);
ReadField<ErrorPolicy_Igno>(dest.pad4, "pad4", db);
ReadField<ErrorPolicy_Igno>(dest.seed1, "seed1", db);
ReadField<ErrorPolicy_Igno>(dest.seed2, "seed2", db);
db.reader->IncPtr(size);
}

View File

@ -175,7 +175,7 @@ struct MLoopUV : ElemBase {
// -------------------------------------------------------------------------------
// Note that red and blue are not swapped, as with MCol
struct MLoopCol : ElemBase {
char r, g, b, a;
unsigned char r, g, b, a;
};
// -------------------------------------------------------------------------------
@ -242,6 +242,9 @@ struct MDeformVert : ElemBase {
// -------------------------------------------------------------------------------
#define MA_RAYMIRROR 0x40000
#define MA_TRANSPARENCY 0x10000
#define MA_RAYTRANSP 0x20000
#define MA_ZTRANSP 0x00040
struct Material : ElemBase {
ID id FAIL;
@ -261,6 +264,89 @@ struct Material : ElemBase {
float darkness;
float refrac;
float amb;
float ang;
float spectra;
float spec;
float zoffs;
float add;
float fresnel_mir;
float fresnel_mir_i;
float fresnel_tra;
float fresnel_tra_i;
float filter;
float tx_limit;
float tx_falloff;
float gloss_mir;
float gloss_tra;
float adapt_thresh_mir;
float adapt_thresh_tra;
float aniso_gloss_mir;
float dist_mir;
float hasize;
float flaresize;
float subsize;
float flareboost;
float strand_sta;
float strand_end;
float strand_ease;
float strand_surfnor;
float strand_min;
float strand_widthfade;
float sbias;
float lbias;
float shad_alpha;
float param;
float rms;
float rampfac_col;
float rampfac_spec;
float friction;
float fh;
float reflect;
float fhdist;
float xyfrict;
float sss_radius;
float sss_col;
float sss_error;
float sss_scale;
float sss_ior;
float sss_colfac;
float sss_texfac;
float sss_front;
float sss_back;
short material_type;
short flag;
short ray_depth;
short ray_depth_tra;
short samp_gloss_mir;
short samp_gloss_tra;
short fadeto_mir;
short shade_flag;
short flarec;
short starc;
short linec;
short ringc;
short pr_lamp;
short pr_texture;
short ml_flag;
short texco;
short mapto;
short ramp_show;
short pad3;
short dynamode;
short pad2;
short sss_flag;
short sss_preset;
short shadowonly_flag;
short index;
short vcol_alpha;
short pad4;
char seed1;
char seed2;
std::shared_ptr<Group> group;
short diff_shader WARN;

View File

@ -50,6 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "BlenderBMesh.h"
#include "BlenderTessellator.h"
#include <stddef.h>
static const unsigned int BLEND_TESS_MAGIC = 0x83ed9ac3;
#if ASSIMP_BLEND_WITH_GLU_TESSELLATE
@ -372,14 +374,9 @@ void BlenderTessellatorP2T::ReferencePoints( std::vector< Blender::PointP2T >& p
}
// ------------------------------------------------------------------------------------------------
// Yes this is filthy... but we have no choice
#define OffsetOf( Class, Member ) ( static_cast< unsigned int >( \
reinterpret_cast<uint8_t*>(&( reinterpret_cast< Class* >( NULL )->*( &Class::Member ) )) - \
static_cast<uint8_t*>(NULL) ) )
inline PointP2T& BlenderTessellatorP2T::GetActualPointStructure( p2t::Point& point ) const
{
unsigned int pointOffset = OffsetOf( PointP2T, point2D );
unsigned int pointOffset = offsetof( PointP2T, point2D );
PointP2T& pointStruct = *reinterpret_cast< PointP2T* >( reinterpret_cast< char* >( &point ) - pointOffset );
if ( pointStruct.magic != static_cast<int>( BLEND_TESS_MAGIC ) )
{
@ -473,19 +470,19 @@ PlaneP2T BlenderTessellatorP2T::FindLLSQPlane( const std::vector< PointP2T >& po
{
PlaneP2T result;
aiVector3D sum( 0.0f );
aiVector3D sum( 0.0 );
for ( size_t i = 0; i < points.size( ); ++i )
{
sum += points[ i ].point3D;
}
result.centre = sum * ( 1.0f / points.size( ) );
result.centre = sum * (ai_real)( 1.0 / points.size( ) );
float sumXX = 0.0f;
float sumXY = 0.0f;
float sumXZ = 0.0f;
float sumYY = 0.0f;
float sumYZ = 0.0f;
float sumZZ = 0.0f;
ai_real sumXX = 0.0;
ai_real sumXY = 0.0;
ai_real sumXZ = 0.0;
ai_real sumYY = 0.0;
ai_real sumYZ = 0.0;
ai_real sumZZ = 0.0;
for ( size_t i = 0; i < points.size( ); ++i )
{
aiVector3D offset = points[ i ].point3D - result.centre;
@ -499,7 +496,7 @@ PlaneP2T BlenderTessellatorP2T::FindLLSQPlane( const std::vector< PointP2T >& po
aiMatrix3x3 mtx( sumXX, sumXY, sumXZ, sumXY, sumYY, sumYZ, sumXZ, sumYZ, sumZZ );
const float det = mtx.Determinant( );
const ai_real det = mtx.Determinant( );
if ( det == 0.0f )
{
result.normal = aiVector3D( 0.0f );

View File

@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_BYTESWAPPER_H_INC
#define AI_BYTESWAPPER_H_INC
#include "../include/assimp/ai_assert.h"
#include "../include/assimp/types.h"
#include <assimp/ai_assert.h>
#include <assimp/types.h>
#include <stdint.h>
#if _MSC_VER >= 1400

View File

@ -52,6 +52,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "C4DImporter.h"
#include "TinyFormatter.h"
#include <memory>
#include <assimp/IOSystem.hpp>
#include <assimp/scene.h>
#include <assimp/ai_assert.h>
#if defined(_M_X64) || defined(__amd64__)
# define __C4D_64BIT
@ -61,10 +65,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "c4d_file.h"
#include "default_alien_overloads.h"
using namespace _melange_;
using namespace melange;
// overload this function and fill in your own unique data
void GetWriterInfo(LONG &id, String &appname)
void GetWriterInfo(int &id, String &appname)
{
id = 2424226;
appname = "Open Asset Import Library";
@ -197,7 +201,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
// ------------------------------------------------------------------------------------------------
bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader)
bool C4DImporter::ReadShader(aiMaterial* out, melange::BaseShader* shader)
{
// based on Melange sample code (C4DImportExport.cpp)
while(shader) {
@ -263,7 +267,7 @@ bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader)
// ------------------------------------------------------------------------------------------------
void C4DImporter::ReadMaterials(_melange_::BaseMaterial* mat)
void C4DImporter::ReadMaterials(melange::BaseMaterial* mat)
{
// based on Melange sample code
while (mat)
@ -288,7 +292,7 @@ void C4DImporter::ReadMaterials(_melange_::BaseMaterial* mat)
mat->GetParameter(MATERIAL_COLOR_COLOR, data);
Vector color = data.GetVector();
mat->GetParameter(MATERIAL_COLOR_BRIGHTNESS, data);
const Real brightness = data.GetReal();
const Float brightness = data.GetFloat();
color *= brightness;
@ -507,11 +511,13 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
// copy normals
if (normals_src) {
if(i >= normals_src->GetNormalCount()) {
if(i >= normals_src->GetDataCount()) {
LogError("unexpected number of normals, ignoring");
}
else {
const NormalStruct& nor = normals_src->GetNormals(i);
ConstNormalHandle normal_handle = normals_src->GetDataAddressR();
NormalStruct nor;
NormalTag::Get(normal_handle, i, nor);
normals->x = nor.a.x;
normals->y = nor.a.y;
normals->z = nor.a.z;

View File

@ -54,7 +54,7 @@ struct aiMaterial;
struct aiImporterDesc;
namespace _melange_ {
namespace melange {
class BaseObject; // c4d_file.h
class PolygonObject;
class BaseMaterial;
@ -103,17 +103,17 @@ protected:
private:
void ReadMaterials(_melange_::BaseMaterial* mat);
void RecurseHierarchy(_melange_::BaseObject* object, aiNode* parent);
aiMesh* ReadMesh(_melange_::BaseObject* object);
unsigned int ResolveMaterial(_melange_::PolygonObject* obj);
void ReadMaterials(melange::BaseMaterial* mat);
void RecurseHierarchy(melange::BaseObject* object, aiNode* parent);
aiMesh* ReadMesh(melange::BaseObject* object);
unsigned int ResolveMaterial(melange::PolygonObject* obj);
bool ReadShader(aiMaterial* out, _melange_::BaseShader* shader);
bool ReadShader(aiMaterial* out, melange::BaseShader* shader);
std::vector<aiMesh*> meshes;
std::vector<aiMaterial*> materials;
typedef std::map<_melange_::BaseMaterial*, unsigned int> MaterialMap;
typedef std::map<melange::BaseMaterial*, unsigned int> MaterialMap;
MaterialMap material_mapping;
}; // !class C4DImporter

View File

@ -44,9 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_CIOSYSTEM_H_INCLUDED
#define AI_CIOSYSTEM_H_INCLUDED
#include "../include/assimp/cfileio.h"
#include "../include/assimp/IOStream.hpp"
#include "../include/assimp/IOSystem.hpp"
#include <assimp/cfileio.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
namespace Assimp {

View File

@ -367,7 +367,6 @@ ADD_ASSIMP_IMPORTER(OBJ
ObjFileParser.cpp
ObjFileParser.h
ObjTools.h
ObjExporter.h
ObjExporter.cpp
)
@ -605,10 +604,8 @@ ADD_ASSIMP_IMPORTER(GLTF
glTFAsset.inl
glTFAssetWriter.h
glTFAssetWriter.inl
glTFImporter.cpp
glTFImporter.h
glTFExporter.h
glTFExporter.cpp
)
@ -619,7 +616,6 @@ ADD_ASSIMP_IMPORTER(3MF
D3MFImporter.cpp
D3MFOpcPackage.h
D3MFOpcPackage.cpp
)
@ -726,6 +722,7 @@ if (UNZIP_FOUND)
SET (unzip_compile_SRCS "")
else (UNZIP_FOUND)
SET (unzip_compile_SRCS ${unzip_SRCS})
INCLUDE_DIRECTORIES( "../contrib/unzip/" )
endif (UNZIP_FOUND)
MESSAGE(STATUS "Enabled formats:${ASSIMP_IMPORTERS_ENABLED}")
@ -779,8 +776,8 @@ if(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
endif(ANDROID AND ASSIMP_ANDROID_JNIIOSYSTEM)
IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
TARGET_LINK_LIBRARIES(assimp optimized ${C4D_RELEASE_LIBRARY})
TARGET_LINK_LIBRARIES(assimp debug ${C4D_DEBUG_LIBRARY})
TARGET_LINK_LIBRARIES(assimp optimized ${C4D_RELEASE_LIBRARIES})
TARGET_LINK_LIBRARIES(assimp debug ${C4D_DEBUG_LIBRARIES})
TARGET_LINK_LIBRARIES(assimp ${C4D_EXTRA_LIBRARIES})
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
@ -813,7 +810,7 @@ SET_TARGET_PROPERTIES( assimp PROPERTIES
)
if (APPLE)
SET_TARGET_PROPERTIES( assimp PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
SET_TARGET_PROPERTIES( assimp PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${ASSIMP_LIB_INSTALL_DIR}")
endif()
# Build against external unzip, or add ../contrib/unzip so
@ -822,7 +819,7 @@ if (UNZIP_FOUND)
INCLUDE_DIRECTORIES(${UNZIP_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(assimp ${UNZIP_LIBRARIES})
else (UNZIP_FOUND)
INCLUDE_DIRECTORIES("../contrib/unzip")
INCLUDE_DIRECTORIES("../")
endif (UNZIP_FOUND)
INSTALL( TARGETS assimp

View File

@ -54,9 +54,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "LineSplitter.h"
#include "TinyFormatter.h"
#include <memory>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/scene.h"
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
using namespace Assimp;

View File

@ -51,12 +51,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SkeletonMeshBuilder.h"
#include "ParsingUtils.h"
#include "fast_atof.h"
#include "../include/assimp/Importer.hpp"
#include <assimp/Importer.hpp>
#include <memory>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/anim.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/scene.h"
#include <assimp/IOSystem.hpp>
#include <assimp/anim.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
using namespace Assimp;

View File

@ -49,9 +49,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SceneCombiner.h"
#include "DefaultIOSystem.h"
#include "XMLTools.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/Exporter.hpp"
#include "../include/assimp/scene.h"
#include <assimp/IOSystem.hpp>
#include <assimp/Exporter.hpp>
#include <assimp/scene.h>
#include "Exceptional.h"
@ -94,6 +94,7 @@ ColladaExporter::ColladaExporter( const aiScene* pScene, IOSystem* pIOSystem, co
{
// make sure that all formatting happens using the standard, C locale and not the user's current locale
mOutput.imbue( std::locale("C") );
mOutput.precision(16);
mScene = pScene;
mSceneOwned = false;
@ -148,7 +149,7 @@ void ColladaExporter::WriteFile()
// Writes the asset header
void ColladaExporter::WriteHeader()
{
static const float epsilon = 0.00001f;
static const ai_real epsilon = 0.00001;
static const aiQuaternion x_rot(aiMatrix3x3(
0, -1, 0,
1, 0, 0,
@ -175,9 +176,9 @@ void ColladaExporter::WriteHeader()
bool add_root_node = false;
float scale = 1.0;
ai_real scale = 1.0;
if(std::abs(scaling.x - scaling.y) <= epsilon && std::abs(scaling.x - scaling.z) <= epsilon && std::abs(scaling.y - scaling.z) <= epsilon) {
scale = (float) ((((double) scaling.x) + ((double) scaling.y) + ((double) scaling.z)) / 3.0);
scale = (ai_real) ((((double) scaling.x) + ((double) scaling.y) + ((double) scaling.z)) / 3.0);
} else {
add_root_node = true;
}
@ -449,7 +450,7 @@ void ColladaExporter::WriteSpotLight(const aiLight *const light){
srcLight->mFalloffAngle);
*/
const float fallOffAngle = AI_RAD_TO_DEG(light->mAngleInnerCone);
const ai_real fallOffAngle = AI_RAD_TO_DEG(light->mAngleInnerCone);
mOutput << startstr <<"<falloff_angle sid=\"fall_off_angle\">"
<< fallOffAngle
<<"</falloff_angle>" << endstr;
@ -530,7 +531,7 @@ void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial*
// Reimplementation of isalnum(,C locale), because AppVeyor does not see standard version.
static bool isalnum_C(char c)
{
return strchr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",c);
return ( nullptr != strchr("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",c) );
}
// ------------------------------------------------------------------------------------------------
@ -802,10 +803,10 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
PushTag();
// Positions
WriteFloatArray( idstr + "-positions", FloatType_Vector, (float*) mesh->mVertices, mesh->mNumVertices);
WriteFloatArray( idstr + "-positions", FloatType_Vector, (ai_real*) mesh->mVertices, mesh->mNumVertices);
// Normals, if any
if( mesh->HasNormals() )
WriteFloatArray( idstr + "-normals", FloatType_Vector, (float*) mesh->mNormals, mesh->mNumVertices);
WriteFloatArray( idstr + "-normals", FloatType_Vector, (ai_real*) mesh->mNormals, mesh->mNumVertices);
// texture coords
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a)
@ -813,7 +814,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
if( mesh->HasTextureCoords( a) )
{
WriteFloatArray( idstr + "-tex" + std::to_string(a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2,
(float*) mesh->mTextureCoords[a], mesh->mNumVertices);
(ai_real*) mesh->mTextureCoords[a], mesh->mNumVertices);
}
}
@ -821,7 +822,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a)
{
if( mesh->HasVertexColors( a) )
WriteFloatArray( idstr + "-color" + std::to_string(a), FloatType_Color, (float*) mesh->mColors[a], mesh->mNumVertices);
WriteFloatArray( idstr + "-color" + std::to_string(a), FloatType_Color, (ai_real*) mesh->mColors[a], mesh->mNumVertices);
}
// assemble vertex structure
@ -916,7 +917,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
// ------------------------------------------------------------------------------------------------
// Writes a float array of the given type
void ColladaExporter::WriteFloatArray( const std::string& pIdString, FloatDataType pType, const float* pData, size_t pElementCount)
void ColladaExporter::WriteFloatArray( const std::string& pIdString, FloatDataType pType, const ai_real* pData, size_t pElementCount)
{
size_t floatsPerElement = 0;
switch( pType )
@ -1016,7 +1017,7 @@ void ColladaExporter::WriteSceneLibrary()
// start recursive write at the root node
for( size_t a = 0; a < mScene->mRootNode->mNumChildren; ++a )
WriteNode( mScene->mRootNode->mChildren[a]);
WriteNode( mScene, mScene->mRootNode->mChildren[a]);
PopTag();
mOutput << startstr << "</visual_scene>" << endstr;
@ -1024,11 +1025,26 @@ void ColladaExporter::WriteSceneLibrary()
mOutput << startstr << "</library_visual_scenes>" << endstr;
}
// ------------------------------------------------------------------------------------------------
// Helper to find a bone by name in the scene
aiBone* findBone( const aiScene* scene, const char * name) {
for (size_t m=0; m<scene->mNumMeshes; m++) {
aiMesh * mesh = scene->mMeshes[m];
for (size_t b=0; b<mesh->mNumBones; b++) {
aiBone * bone = mesh->mBones[b];
if (0 == strcmp(name, bone->mName.C_Str())) {
return bone;
}
}
}
return NULL;
}
// ------------------------------------------------------------------------------------------------
// Recursively writes the given node
void ColladaExporter::WriteNode(aiNode* pNode)
void ColladaExporter::WriteNode( const aiScene* pScene, aiNode* pNode)
{
// the must have a name
// the node must have a name
if (pNode->mName.length == 0)
{
std::stringstream ss;
@ -1036,8 +1052,21 @@ void ColladaExporter::WriteNode(aiNode* pNode)
pNode->mName.Set(ss.str());
}
// If the node is associated with a bone, it is a joint node (JOINT)
// otherwise it is a normal node (NODE)
const char * node_type;
if (NULL == findBone(pScene, pNode->mName.C_Str())) {
node_type = "NODE";
} else {
node_type = "JOINT";
}
const std::string node_name_escaped = XMLEscape(pNode->mName.data);
mOutput << startstr << "<node id=\"" << node_name_escaped << "\" name=\"" << node_name_escaped << "\">" << endstr;
mOutput << startstr
<< "<node id=\"" << node_name_escaped
<< "\" name=\"" << node_name_escaped
<< "\" type=\"" << node_type
<< "\">" << endstr;
PushTag();
// write transformation - we can directly put the matrix there
@ -1102,7 +1131,7 @@ void ColladaExporter::WriteNode(aiNode* pNode)
// recurse into subnodes
for( size_t a = 0; a < pNode->mNumChildren; ++a )
WriteNode( pNode->mChildren[a]);
WriteNode( pScene, pNode->mChildren[a]);
PopTag();
mOutput << startstr << "</node>" << endstr;

View File

@ -44,11 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_COLLADAEXPORTER_H_INC
#define AI_COLLADAEXPORTER_H_INC
#include "../include/assimp/ai_assert.h"
#include "../include/assimp/material.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/light.h"
#include "../include/assimp/Exporter.hpp"
#include <assimp/ai_assert.h>
#include <assimp/material.h>
#include <assimp/mesh.h>
#include <assimp/light.h>
#include <assimp/Exporter.hpp>
#include <sstream>
#include <vector>
#include <map>
@ -108,13 +108,13 @@ protected:
enum FloatDataType { FloatType_Vector, FloatType_TexCoord2, FloatType_TexCoord3, FloatType_Color };
/// Writes a float array of the given type
void WriteFloatArray( const std::string& pIdString, FloatDataType pType, const float* pData, size_t pElementCount);
void WriteFloatArray( const std::string& pIdString, FloatDataType pType, const ai_real* pData, size_t pElementCount);
/// Writes the scene library
void WriteSceneLibrary();
/// Recursively writes the given node
void WriteNode( aiNode* pNode);
void WriteNode( const aiScene* scene, aiNode* pNode);
/// Enters a new xml element, which increases the indentation
void PushTag() { startstr.append( " "); }
@ -160,10 +160,10 @@ protected:
struct Property
{
bool exist;
float value;
ai_real value;
Property()
: exist(false)
, value(0.0f)
, value(0.0)
{}
};

View File

@ -47,9 +47,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <vector>
#include <stdint.h>
#include "../include/assimp/light.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/material.h"
#include <assimp/light.h>
#include <assimp/mesh.h>
#include <assimp/material.h>
struct aiMaterial;
@ -94,7 +94,7 @@ struct Transform
{
std::string mID; ///< SID of the transform step, by which anim channels address their target node
TransformType mType;
float f[16]; ///< Interpretation of data depends on the type of the transformation
ai_real f[16]; ///< Interpretation of data depends on the type of the transformation
};
/** A collada camera. */
@ -116,16 +116,16 @@ struct Camera
bool mOrtho;
//! Horizontal field of view in degrees
float mHorFov;
ai_real mHorFov;
//! Vertical field of view in degrees
float mVerFov;
ai_real mVerFov;
//! Screen aspect
float mAspect;
ai_real mAspect;
//! Near& far z
float mZNear, mZFar;
ai_real mZNear, mZFar;
};
#define ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET 1e9f
@ -152,21 +152,21 @@ struct Light
aiColor3D mColor;
//! Light attenuation
float mAttConstant,mAttLinear,mAttQuadratic;
ai_real mAttConstant,mAttLinear,mAttQuadratic;
//! Spot light falloff
float mFalloffAngle;
float mFalloffExponent;
ai_real mFalloffAngle;
ai_real mFalloffExponent;
// -----------------------------------------------------
// FCOLLADA extension from here
//! ... related stuff from maja and max extensions
float mPenumbraAngle;
float mOuterAngle;
ai_real mPenumbraAngle;
ai_real mOuterAngle;
//! Common light intensity
float mIntensity;
ai_real mIntensity;
};
/** Short vertex index description */
@ -275,7 +275,7 @@ struct Node
struct Data
{
bool mIsStringArray;
std::vector<float> mValues;
std::vector<ai_real> mValues;
std::vector<std::string> mStrings;
};
@ -387,7 +387,7 @@ struct Controller
std::string mJointNameSource;
///< The bind shape matrix, as array of floats. I'm not sure what this matrix actually describes, but it can't be ignored in all cases
float mBindShapeMatrix[16];
ai_real mBindShapeMatrix[16];
// accessor URL of the joint inverse bind matrices
std::string mJointOffsetMatrixSource;
@ -490,11 +490,11 @@ struct Sampler
/** Weighting factor
*/
float mWeighting;
ai_real mWeighting;
/** Mixing factor from OKINO
*/
float mMixWithPrevious;
ai_real mMixWithPrevious;
};
/** A collada effect. Can contain about anything according to the Collada spec,
@ -513,8 +513,8 @@ struct Effect
mTexTransparent, mTexBump, mTexReflective;
// Scalar factory
float mShininess, mRefractIndex, mReflectivity;
float mTransparency;
ai_real mShininess, mRefractIndex, mReflectivity;
ai_real mTransparency;
bool mHasTransparency;
bool mRGBTransparency;
bool mInvertTransparency;

View File

@ -44,9 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER
#include "../include/assimp/anim.h"
#include "../include/assimp/scene.h"
#include "ColladaLoader.h"
#include <assimp/anim.h>
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/Importer.hpp>
#include "ColladaParser.h"
#include "fast_atof.h"
@ -56,8 +58,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "time.h"
#include "math.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/Importer.hpp"
#include <numeric>
#include "Defines.h"
@ -276,21 +276,20 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co
resolved.reserve(pNode->mNodeInstances.size());
// ... and iterate through all nodes to be instanced as children of pNode
for (std::vector<Collada::NodeInstance>::const_iterator it = pNode->mNodeInstances.begin(),
end = pNode->mNodeInstances.end(); it != end; ++it)
for (const auto &nodeInst: pNode->mNodeInstances)
{
// find the corresponding node in the library
const ColladaParser::NodeLibrary::const_iterator itt = pParser.mNodeLibrary.find((*it).mNode);
const ColladaParser::NodeLibrary::const_iterator itt = pParser.mNodeLibrary.find(nodeInst.mNode);
const Collada::Node* nd = itt == pParser.mNodeLibrary.end() ? NULL : (*itt).second;
// FIX for http://sourceforge.net/tracker/?func=detail&aid=3054873&group_id=226462&atid=1067632
// need to check for both name and ID to catch all. To avoid breaking valid files,
// the workaround is only enabled when the first attempt to resolve the node has failed.
if (!nd) {
nd = FindNode(pParser.mRootNode,(*it).mNode);
nd = FindNode(pParser.mRootNode, nodeInst.mNode);
}
if (!nd)
DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + (*it).mNode);
DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + nodeInst.mNode);
else {
// attach this node to the list of children
@ -705,7 +704,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
size_t jointIndex = iit->first;
size_t vertexIndex = iit->second;
float weight = ReadFloat( weightsAcc, weights, vertexIndex, 0);
ai_real weight = ReadFloat( weightsAcc, weights, vertexIndex, 0);
// one day I gonna kill that XSI Collada exporter
if( weight > 0.0f)
@ -1072,7 +1071,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
continue;
// resolve the data pointers for all anim channels. Find the minimum time while we're at it
float startTime = 1e20f, endTime = -1e20f;
ai_real startTime = 1e20, endTime = -1e20;
for( std::vector<Collada::ChannelEntry>::iterator it = entries.begin(); it != entries.end(); ++it)
{
Collada::ChannelEntry& e = *it;
@ -1101,7 +1100,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
// now for every unique point in time, find or interpolate the key values for that time
// and apply them to the transform chain. Then the node's present transformation can be calculated.
float time = startTime;
ai_real time = startTime;
while( 1)
{
for( std::vector<Collada::ChannelEntry>::iterator it = entries.begin(); it != entries.end(); ++it)
@ -1110,7 +1109,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
// find the keyframe behind the current point in time
size_t pos = 0;
float postTime = 0.f;
ai_real postTime = 0.0;
while( 1)
{
if( pos >= e.mTimeAccessor->mCount)
@ -1124,19 +1123,19 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
pos = std::min( pos, e.mTimeAccessor->mCount-1);
// read values from there
float temp[16];
ai_real temp[16];
for( size_t c = 0; c < e.mValueAccessor->mSize; ++c)
temp[c] = ReadFloat( *e.mValueAccessor, *e.mValueData, pos, c);
// if not exactly at the key time, interpolate with previous value set
if( postTime > time && pos > 0)
{
float preTime = ReadFloat( *e.mTimeAccessor, *e.mTimeData, pos-1, 0);
float factor = (time - postTime) / (preTime - postTime);
ai_real preTime = ReadFloat( *e.mTimeAccessor, *e.mTimeData, pos-1, 0);
ai_real factor = (time - postTime) / (preTime - postTime);
for( size_t c = 0; c < e.mValueAccessor->mSize; ++c)
{
float v = ReadFloat( *e.mValueAccessor, *e.mValueData, pos-1, c);
ai_real v = ReadFloat( *e.mValueAccessor, *e.mValueData, pos-1, c);
temp[c] += (v - temp[c]) * factor;
}
}
@ -1153,7 +1152,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
resultTrafos.push_back( mat);
// find next point in time to evaluate. That's the closest frame larger than the current in any channel
float nextTime = 1e20f;
ai_real nextTime = 1e20;
for( std::vector<Collada::ChannelEntry>::iterator it = entries.begin(); it != entries.end(); ++it)
{
Collada::ChannelEntry& channelElement = *it;
@ -1162,7 +1161,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
size_t pos = 0;
while( pos < channelElement.mTimeAccessor->mCount)
{
const float t = ReadFloat( *channelElement.mTimeAccessor, *channelElement.mTimeData, pos, 0);
const ai_real t = ReadFloat( *channelElement.mTimeAccessor, *channelElement.mTimeData, pos, 0);
if( t > time)
{
nextTime = std::min( nextTime, t);
@ -1175,16 +1174,16 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
// Sub-sample axis-angle channels if the delta between two consecutive
// key-frame angles is >= 180 degrees.
if (transforms[channelElement.mTransformIndex].mType == Collada::TF_ROTATE && channelElement.mSubElement == 3 && pos > 0 && pos < channelElement.mTimeAccessor->mCount) {
const float cur_key_angle = ReadFloat(*channelElement.mValueAccessor, *channelElement.mValueData, pos, 0);
const float last_key_angle = ReadFloat(*channelElement.mValueAccessor, *channelElement.mValueData, pos - 1, 0);
const float cur_key_time = ReadFloat(*channelElement.mTimeAccessor, *channelElement.mTimeData, pos, 0);
const float last_key_time = ReadFloat(*channelElement.mTimeAccessor, *channelElement.mTimeData, pos - 1, 0);
const float last_eval_angle = last_key_angle + (cur_key_angle - last_key_angle) * (time - last_key_time) / (cur_key_time - last_key_time);
const float delta = std::fabs(cur_key_angle - last_eval_angle);
if (delta >= 180.0f) {
const int subSampleCount = static_cast<int>(floorf(delta / 90.0f));
const ai_real cur_key_angle = ReadFloat(*channelElement.mValueAccessor, *channelElement.mValueData, pos, 0);
const ai_real last_key_angle = ReadFloat(*channelElement.mValueAccessor, *channelElement.mValueData, pos - 1, 0);
const ai_real cur_key_time = ReadFloat(*channelElement.mTimeAccessor, *channelElement.mTimeData, pos, 0);
const ai_real last_key_time = ReadFloat(*channelElement.mTimeAccessor, *channelElement.mTimeData, pos - 1, 0);
const ai_real last_eval_angle = last_key_angle + (cur_key_angle - last_key_angle) * (time - last_key_time) / (cur_key_time - last_key_time);
const ai_real delta = std::abs(cur_key_angle - last_eval_angle);
if (delta >= 180.0) {
const int subSampleCount = static_cast<int>(floorf(delta / 90.0));
if (cur_key_time != time) {
const float nextSampleTime = time + (cur_key_time - time) / subSampleCount;
const ai_real nextSampleTime = time + (cur_key_time - time) / subSampleCount;
nextTime = std::min(nextTime, nextSampleTime);
}
}
@ -1290,7 +1289,7 @@ void ColladaLoader::AddTexture ( aiMaterial& mat, const ColladaParser& pParser,
_AI_MATKEY_TEXBLEND_BASE, type, idx);
// Blend factor
mat.AddProperty((float*)&sampler.mWeighting , 1,
mat.AddProperty((ai_real*)&sampler.mWeighting , 1,
_AI_MATKEY_TEXBLEND_BASE, type, idx);
// UV source index ... if we didn't resolve the mapping, it is actually just
@ -1320,11 +1319,10 @@ void ColladaLoader::AddTexture ( aiMaterial& mat, const ColladaParser& pParser,
// Fills materials from the collada material definitions
void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pScene*/)
{
for (std::vector<std::pair<Collada::Effect*, aiMaterial*> >::iterator it = newMats.begin(),
end = newMats.end(); it != end; ++it)
for (auto &elem : newMats)
{
aiMaterial& mat = (aiMaterial&)*it->second;
Collada::Effect& effect = *it->first;
aiMaterial& mat = (aiMaterial&)*elem.second;
Collada::Effect& effect = *elem.first;
// resolve shading mode
int shadeMode;
@ -1466,11 +1464,11 @@ void ColladaLoader::BuildMaterials( ColladaParser& pParser, aiScene* /*pScene*/)
const int shadeMode = aiShadingMode_Phong;
mat->AddProperty<int>( &shadeMode, 1, AI_MATKEY_SHADING_MODEL);
aiColor4D colAmbient( 0.2f, 0.2f, 0.2f, 1.0f), colDiffuse( 0.8f, 0.8f, 0.8f, 1.0f), colSpecular( 0.5f, 0.5f, 0.5f, 0.5f);
aiColor4D colAmbient( 0.2, 0.2, 0.2, 1.0), colDiffuse( 0.8, 0.8, 0.8, 1.0), colSpecular( 0.5, 0.5, 0.5, 0.5);
mat->AddProperty( &colAmbient, 1, AI_MATKEY_COLOR_AMBIENT);
mat->AddProperty( &colDiffuse, 1, AI_MATKEY_COLOR_DIFFUSE);
mat->AddProperty( &colSpecular, 1, AI_MATKEY_COLOR_SPECULAR);
const float specExp = 5.0f;
const ai_real specExp = 5.0;
mat->AddProperty( &specExp, 1, AI_MATKEY_SHININESS);
}
#endif
@ -1589,7 +1587,7 @@ void ColladaLoader::ConvertPath (aiString& ss)
// ------------------------------------------------------------------------------------------------
// Reads a float value from an accessor and its data array.
float ColladaLoader::ReadFloat( const Collada::Accessor& pAccessor, const Collada::Data& pData, size_t pIndex, size_t pOffset) const
ai_real ColladaLoader::ReadFloat( const Collada::Accessor& pAccessor, const Collada::Data& pData, size_t pIndex, size_t pOffset) const
{
// FIXME: (thom) Test for data type here in every access? For the moment, I leave this to the caller
size_t pos = pAccessor.mStride * pIndex + pAccessor.mOffset + pOffset;

View File

@ -190,7 +190,7 @@ protected:
* @param pOffset Offset into the element, for multipart elements such as vectors or matrices
* @return the specified value
*/
float ReadFloat( const Collada::Accessor& pAccessor, const Collada::Data& pData, size_t pIndex, size_t pOffset) const;
ai_real ReadFloat( const Collada::Accessor& pAccessor, const Collada::Data& pData, size_t pIndex, size_t pOffset) const;
/** Reads a string value from an accessor and its data array.
* @param pAccessor The accessor to use for reading

View File

@ -51,12 +51,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ColladaParser.h"
#include "fast_atof.h"
#include "ParsingUtils.h"
#include <memory>
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/light.h"
#include "StringUtils.h"
#include <assimp/DefaultLogger.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/light.h>
#include "TinyFormatter.h"
#include <memory>
using namespace Assimp;
using namespace Assimp::Collada;
@ -126,7 +128,7 @@ bool ColladaParser::ReadBoolFromTextContent()
// ------------------------------------------------------------------------------------------------
// Read float from text contents of current element
float ColladaParser::ReadFloatFromTextContent()
ai_real ColladaParser::ReadFloatFromTextContent()
{
const char* cur = GetTextContent();
return fast_atof(cur);
@ -672,7 +674,7 @@ void ColladaParser::ReadController( Collada::Controller& pController)
for( unsigned int a = 0; a < 16; a++)
{
// read a number
content = fast_atoreal_move<float>( content, pController.mBindShapeMatrix[a]);
content = fast_atoreal_move<ai_real>( content, pController.mBindShapeMatrix[a]);
// skip whitespace after it
SkipSpacesAndLineEnd( &content);
}
@ -1177,13 +1179,13 @@ void ColladaParser::ReadLight( Collada::Light& pLight)
// text content contains 3 floats
const char* content = GetTextContent();
content = fast_atoreal_move<float>( content, (float&)pLight.mColor.r);
content = fast_atoreal_move<ai_real>( content, (ai_real&)pLight.mColor.r);
SkipSpacesAndLineEnd( &content);
content = fast_atoreal_move<float>( content, (float&)pLight.mColor.g);
content = fast_atoreal_move<ai_real>( content, (ai_real&)pLight.mColor.g);
SkipSpacesAndLineEnd( &content);
content = fast_atoreal_move<float>( content, (float&)pLight.mColor.b);
content = fast_atoreal_move<ai_real>( content, (ai_real&)pLight.mColor.b);
SkipSpacesAndLineEnd( &content);
TestClosing( "color");
@ -1576,16 +1578,16 @@ void ColladaParser::ReadEffectColor( aiColor4D& pColor, Sampler& pSampler)
// text content contains 4 floats
const char* content = GetTextContent();
content = fast_atoreal_move<float>( content, (float&)pColor.r);
content = fast_atoreal_move<ai_real>( content, (ai_real&)pColor.r);
SkipSpacesAndLineEnd( &content);
content = fast_atoreal_move<float>( content, (float&)pColor.g);
content = fast_atoreal_move<ai_real>( content, (ai_real&)pColor.g);
SkipSpacesAndLineEnd( &content);
content = fast_atoreal_move<float>( content, (float&)pColor.b);
content = fast_atoreal_move<ai_real>( content, (ai_real&)pColor.b);
SkipSpacesAndLineEnd( &content);
content = fast_atoreal_move<float>( content, (float&)pColor.a);
content = fast_atoreal_move<ai_real>( content, (ai_real&)pColor.a);
SkipSpacesAndLineEnd( &content);
TestClosing( "color");
}
@ -1634,7 +1636,7 @@ void ColladaParser::ReadEffectColor( aiColor4D& pColor, Sampler& pSampler)
// ------------------------------------------------------------------------------------------------
// Reads an effect entry containing a float
void ColladaParser::ReadEffectFloat( float& pFloat)
void ColladaParser::ReadEffectFloat( ai_real& pFloat)
{
while( mReader->read())
{
@ -1643,7 +1645,7 @@ void ColladaParser::ReadEffectFloat( float& pFloat)
{
// text content contains a single floats
const char* content = GetTextContent();
content = fast_atoreal_move<float>( content, pFloat);
content = fast_atoreal_move<ai_real>( content, pFloat);
SkipSpacesAndLineEnd( &content);
TestClosing( "float");
@ -1941,9 +1943,9 @@ void ColladaParser::ReadDataArray()
if( *content == 0)
ThrowException( "Expected more values while reading float_array contents.");
float value;
ai_real value;
// read a number
content = fast_atoreal_move<float>( content, value);
content = fast_atoreal_move<ai_real>( content, value);
data.mValues.push_back( value);
// skip whitespace after it
SkipSpacesAndLineEnd( &content);
@ -2454,11 +2456,11 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
ThrowException( format() << "Invalid data index (" << pLocalIndex << "/" << acc.mCount << ") in primitive specification" );
// get a pointer to the start of the data object referred to by the accessor and the local index
const float* dataObject = &(acc.mData->mValues[0]) + acc.mOffset + pLocalIndex* acc.mStride;
const ai_real* dataObject = &(acc.mData->mValues[0]) + acc.mOffset + pLocalIndex* acc.mStride;
// assemble according to the accessors component sub-offset list. We don't care, yet,
// what kind of object exactly we're extracting here
float obj[4];
ai_real obj[4];
for( size_t c = 0; c < 4; ++c)
obj[c] = dataObject[acc.mSubOffset[c]];
@ -2762,7 +2764,7 @@ void ColladaParser::ReadNodeTransformation( Node* pNode, TransformType pType)
for( unsigned int a = 0; a < sNumParameters[pType]; a++)
{
// read a number
content = fast_atoreal_move<float>( content, tf.f[a]);
content = fast_atoreal_move<ai_real>( content, tf.f[a]);
// skip whitespace after it
SkipSpacesAndLineEnd( &content);
}
@ -3073,7 +3075,7 @@ aiMatrix4x4 ColladaParser::CalculateResultTransform( const std::vector<Transform
case TF_ROTATE:
{
aiMatrix4x4 rot;
float angle = tf.f[3] * float( AI_MATH_PI) / 180.0f;
ai_real angle = tf.f[3] * ai_real( AI_MATH_PI) / 180.0;
aiVector3D axis( tf.f[0], tf.f[1], tf.f[2]);
aiMatrix4x4::Rotation( angle, axis, rot);
res *= rot;
@ -3115,24 +3117,29 @@ aiMatrix4x4 ColladaParser::CalculateResultTransform( const std::vector<Transform
// ------------------------------------------------------------------------------------------------
// Determines the input data type for the given semantic string
Collada::InputType ColladaParser::GetTypeForSemantic( const std::string& pSemantic)
Collada::InputType ColladaParser::GetTypeForSemantic( const std::string& semantic)
{
if( pSemantic == "POSITION")
if ( semantic.empty() ) {
DefaultLogger::get()->warn( format() << "Vertex input type is empty." );
return IT_Invalid;
}
if( semantic == "POSITION")
return IT_Position;
else if( pSemantic == "TEXCOORD")
else if( semantic == "TEXCOORD")
return IT_Texcoord;
else if( pSemantic == "NORMAL")
else if( semantic == "NORMAL")
return IT_Normal;
else if( pSemantic == "COLOR")
else if( semantic == "COLOR")
return IT_Color;
else if( pSemantic == "VERTEX")
else if( semantic == "VERTEX")
return IT_Vertex;
else if( pSemantic == "BINORMAL" || pSemantic == "TEXBINORMAL")
else if( semantic == "BINORMAL" || semantic == "TEXBINORMAL")
return IT_Bitangent;
else if( pSemantic == "TANGENT" || pSemantic == "TEXTANGENT")
else if( semantic == "TANGENT" || semantic == "TEXTANGENT")
return IT_Tangent;
DefaultLogger::get()->warn( format() << "Unknown vertex input type \"" << pSemantic << "\". Ignoring." );
DefaultLogger::get()->warn( format() << "Unknown vertex input type \"" << semantic << "\". Ignoring." );
return IT_Invalid;
}

View File

@ -47,7 +47,7 @@
#include "irrXMLWrapper.h"
#include "ColladaHelper.h"
#include "../include/assimp/ai_assert.h"
#include <assimp/ai_assert.h>
#include "TinyFormatter.h"
#include <memory>
@ -147,7 +147,7 @@ namespace Assimp
void ReadEffectColor( aiColor4D& pColor, Collada::Sampler& pSampler);
/** Reads an effect entry containing a float */
void ReadEffectFloat( float& pFloat);
void ReadEffectFloat( ai_real& pFloat);
/** Reads an effect parameter specification of any kind */
void ReadEffectParam( Collada::EffectParam& pParam);
@ -259,7 +259,7 @@ namespace Assimp
bool ReadBoolFromTextContent();
/** Reads a single float from current text content */
float ReadFloatFromTextContent();
ai_real ReadFloatFromTextContent();
/** Calculates the resulting transformation from all the given transform steps */
aiMatrix4x4 CalculateResultTransform( const std::vector<Collada::Transform>& pTransforms) const;
@ -335,7 +335,7 @@ namespace Assimp
Collada::Animation mAnims;
/** Size unit: how large compared to a meter */
float mUnitSize;
ai_real mUnitSize;
/** Which is the up vector */
enum { UP_X, UP_Y, UP_Z } mUpDirection;

View File

@ -49,10 +49,10 @@ using namespace Assimp;
namespace {
const static aiVector3D base_axis_y(0.f,1.f,0.f);
const static aiVector3D base_axis_x(1.f,0.f,0.f);
const static aiVector3D base_axis_z(0.f,0.f,1.f);
const static float angle_epsilon = 0.95f;
const static aiVector3D base_axis_y(0.0,1.0,0.0);
const static aiVector3D base_axis_x(1.0,0.0,0.0);
const static aiVector3D base_axis_z(0.0,0.0,1.0);
const static ai_real angle_epsilon = 0.95;
}
// ------------------------------------------------------------------------------------------------
@ -81,9 +81,9 @@ bool ComputeUVMappingProcess::IsActive( unsigned int pFlags) const
inline bool PlaneIntersect(const aiRay& ray, const aiVector3D& planePos,
const aiVector3D& planeNormal, aiVector3D& pos)
{
const float b = planeNormal * (planePos - ray.pos);
float h = ray.dir * planeNormal;
if ((h < 10e-5f && h > -10e-5f) || (h = b/h) < 0)
const ai_real b = planeNormal * (planePos - ray.pos);
ai_real h = ray.dir * planeNormal;
if ((h < 10e-5 && h > -10e-5) || (h = b/h) < 0)
return false;
pos = ray.pos + (ray.dir * h);
@ -109,11 +109,11 @@ void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
// much easier, but I don't know how and am currently too tired to
// to think about a better solution.
const static float LOWER_LIMIT = 0.1f;
const static float UPPER_LIMIT = 0.9f;
const static ai_real LOWER_LIMIT = 0.1;
const static ai_real UPPER_LIMIT = 0.9;
const static float LOWER_EPSILON = 10e-3f;
const static float UPPER_EPSILON = 1.f-10e-3f;
const static ai_real LOWER_EPSILON = 10e-3;
const static ai_real UPPER_EPSILON = 1.0-10e-3;
for (unsigned int fidx = 0; fidx < mesh->mNumFaces;++fidx)
{
@ -156,12 +156,12 @@ void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
// If the u value is over the upper limit and no other u
// value of that face is 0, round it to 0
if (out[face.mIndices[n]].x > UPPER_LIMIT && !zero)
out[face.mIndices[n]].x = 0.f;
out[face.mIndices[n]].x = 0.0;
// If the u value is below the lower limit and no other u
// value of that face is 1, round it to 1
else if (out[face.mIndices[n]].x < LOWER_LIMIT && !one)
out[face.mIndices[n]].x = 1.f;
out[face.mIndices[n]].x = 1.0;
// The face contains both 0 and 1 as UV coords. This can occur
// for faces which have an edge that lies directly on the seam.
@ -171,9 +171,9 @@ void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
else if (one && zero)
{
if (round_to_zero && out[face.mIndices[n]].x >= UPPER_EPSILON)
out[face.mIndices[n]].x = 0.f;
out[face.mIndices[n]].x = 0.0;
else if (!round_to_zero && out[face.mIndices[n]].x <= LOWER_EPSILON)
out[face.mIndices[n]].x = 1.f;
out[face.mIndices[n]].x = 1.0;
}
}
}
@ -207,7 +207,7 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D diff = (mesh->mVertices[pnt]-center).Normalize();
out[pnt] = aiVector3D((atan2 (diff.z, diff.y) + AI_MATH_PI_F ) / AI_MATH_TWO_PI_F,
(std::asin (diff.x) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.f);
(std::asin (diff.x) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.0);
}
}
else if (axis * base_axis_y >= angle_epsilon) {
@ -215,7 +215,7 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D diff = (mesh->mVertices[pnt]-center).Normalize();
out[pnt] = aiVector3D((atan2 (diff.x, diff.z) + AI_MATH_PI_F ) / AI_MATH_TWO_PI_F,
(std::asin (diff.y) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.f);
(std::asin (diff.y) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.0);
}
}
else if (axis * base_axis_z >= angle_epsilon) {
@ -223,7 +223,7 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D diff = (mesh->mVertices[pnt]-center).Normalize();
out[pnt] = aiVector3D((atan2 (diff.y, diff.x) + AI_MATH_PI_F ) / AI_MATH_TWO_PI_F,
(std::asin (diff.z) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.f);
(std::asin (diff.z) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.0);
}
}
// slower code path in case the mapping axis is not one of the coordinate system axes
@ -235,7 +235,7 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D diff = ((mTrafo*mesh->mVertices[pnt])-center).Normalize();
out[pnt] = aiVector3D((atan2 (diff.y, diff.x) + AI_MATH_PI_F ) / AI_MATH_TWO_PI_F,
(asin (diff.z) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.f);
(asin (diff.z) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.0);
}
}
@ -257,7 +257,7 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
// thus changing the mapping axis)
if (axis * base_axis_x >= angle_epsilon) {
FindMeshCenter(mesh, center, min, max);
const float diff = max.x - min.x;
const ai_real diff = max.x - min.x;
// If the main axis is 'z', the z coordinate of a point 'p' is mapped
// directly to the texture V axis. The other axis is derived from
@ -268,12 +268,12 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
aiVector3D& uv = out[pnt];
uv.y = (pos.x - min.x) / diff;
uv.x = (atan2 ( pos.z - center.z, pos.y - center.y) +(float)AI_MATH_PI ) / (float)AI_MATH_TWO_PI;
uv.x = (atan2 ( pos.z - center.z, pos.y - center.y) +(ai_real)AI_MATH_PI ) / (ai_real)AI_MATH_TWO_PI;
}
}
else if (axis * base_axis_y >= angle_epsilon) {
FindMeshCenter(mesh, center, min, max);
const float diff = max.y - min.y;
const ai_real diff = max.y - min.y;
// just the same ...
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
@ -281,12 +281,12 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
aiVector3D& uv = out[pnt];
uv.y = (pos.y - min.y) / diff;
uv.x = (atan2 ( pos.x - center.x, pos.z - center.z) +(float)AI_MATH_PI ) / (float)AI_MATH_TWO_PI;
uv.x = (atan2 ( pos.x - center.x, pos.z - center.z) +(ai_real)AI_MATH_PI ) / (ai_real)AI_MATH_TWO_PI;
}
}
else if (axis * base_axis_z >= angle_epsilon) {
FindMeshCenter(mesh, center, min, max);
const float diff = max.z - min.z;
const ai_real diff = max.z - min.z;
// just the same ...
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
@ -294,7 +294,7 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
aiVector3D& uv = out[pnt];
uv.y = (pos.z - min.z) / diff;
uv.x = (atan2 ( pos.y - center.y, pos.x - center.x) +(float)AI_MATH_PI ) / (float)AI_MATH_TWO_PI;
uv.x = (atan2 ( pos.y - center.y, pos.x - center.x) +(ai_real)AI_MATH_PI ) / (ai_real)AI_MATH_TWO_PI;
}
}
// slower code path in case the mapping axis is not one of the coordinate system axes
@ -302,7 +302,7 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
aiMatrix4x4 mTrafo;
aiMatrix4x4::FromToMatrix(axis,base_axis_y,mTrafo);
FindMeshCenterTransformed(mesh, center, min, max,mTrafo);
const float diff = max.y - min.y;
const ai_real diff = max.y - min.y;
// again the same, except we're applying a transformation now
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt){
@ -310,7 +310,7 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
aiVector3D& uv = out[pnt];
uv.y = (pos.y - min.y) / diff;
uv.x = (atan2 ( pos.x - center.x, pos.z - center.z) +(float)AI_MATH_PI ) / (float)AI_MATH_TWO_PI;
uv.x = (atan2 ( pos.x - center.x, pos.z - center.z) +(ai_real)AI_MATH_PI ) / (ai_real)AI_MATH_TWO_PI;
}
}
@ -323,7 +323,7 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
// ------------------------------------------------------------------------------------------------
void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D& axis, aiVector3D* out)
{
float diffu,diffv;
ai_real diffu,diffv;
aiVector3D center, min, max;
// If the axis is one of x,y,z run a faster code path. It's worth the extra effort ...
@ -337,7 +337,7 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D& pos = mesh->mVertices[pnt];
out[pnt].Set((pos.z - min.z) / diffu,(pos.y - min.y) / diffv,0.f);
out[pnt].Set((pos.z - min.z) / diffu,(pos.y - min.y) / diffv,0.0);
}
}
else if (axis * base_axis_y >= angle_epsilon) {
@ -347,7 +347,7 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D& pos = mesh->mVertices[pnt];
out[pnt].Set((pos.x - min.x) / diffu,(pos.z - min.z) / diffv,0.f);
out[pnt].Set((pos.x - min.x) / diffu,(pos.z - min.z) / diffv,0.0);
}
}
else if (axis * base_axis_z >= angle_epsilon) {
@ -357,7 +357,7 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D& pos = mesh->mVertices[pnt];
out[pnt].Set((pos.y - min.y) / diffu,(pos.x - min.x) / diffv,0.f);
out[pnt].Set((pos.y - min.y) / diffu,(pos.x - min.x) / diffv,0.0);
}
}
// slower code path in case the mapping axis is not one of the coordinate system axes
@ -372,7 +372,7 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
// again the same, except we're applying a transformation now
for (unsigned int pnt = 0; pnt < mesh->mNumVertices;++pnt) {
const aiVector3D pos = mTrafo * mesh->mVertices[pnt];
out[pnt].Set((pos.x - min.x) / diffu,(pos.z - min.z) / diffv,0.f);
out[pnt].Set((pos.x - min.x) / diffu,(pos.z - min.z) / diffv,0.0);
}
}

View File

@ -44,14 +44,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_COMPUTEUVMAPPING_H_INC
#include "BaseProcess.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/material.h"
#include "../include/assimp/types.h"
#include <assimp/mesh.h>
#include <assimp/material.h>
#include <assimp/types.h>
class ComputeUVMappingTest;
namespace Assimp
{
namespace Assimp {
// ---------------------------------------------------------------------------
/** ComputeUVMappingProcess - converts special mappings, such as spherical,

View File

@ -49,9 +49,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ConvertToLHProcess.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/postprocess.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#include <assimp/DefaultLogger.hpp>
using namespace Assimp;

View File

@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_CONVERTTOLHPROCESS_H_INC
#define AI_CONVERTTOLHPROCESS_H_INC
#include "../include/assimp/types.h"
#include <assimp/types.h>
#include "BaseProcess.h"
struct aiMesh;

View File

@ -40,13 +40,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "D3MFImporter.h"
#include "../include/assimp/scene.h"
#include "../contrib/unzip/unzip.h"
#include "../include/assimp/IOStream.hpp"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/scene.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <contrib/unzip/unzip.h>
#include "irrXMLWrapper.h"
#include "StringComparison.h"
#include "StringUtils.h"
#include <string>
@ -58,7 +59,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cstdlib>
#include <memory>
#include "../include/assimp/ai_assert.h"
#include <assimp/ai_assert.h>
#include "D3MFOpcPackage.h"
@ -224,9 +225,9 @@ private:
aiVector3D ReadVertex()
{
aiVector3D vertex;
vertex.x = std::strtof(xmlReader->getAttributeValue(D3MF::XmlTag::x.c_str()), nullptr);
vertex.y = std::strtof(xmlReader->getAttributeValue(D3MF::XmlTag::y.c_str()), nullptr);
vertex.z = std::strtof(xmlReader->getAttributeValue(D3MF::XmlTag::z.c_str()), nullptr);
vertex.x = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::x.c_str()), nullptr);
vertex.y = ai_strtof(xmlReader->getAttributeValue(D3MF::XmlTag::y.c_str()), nullptr);
vertex.z = ai_strtof>(xmlReader->getAttributeValue(D3MF::XmlTag::z.c_str()), nullptr);
return vertex;
}

View File

@ -40,6 +40,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "D3MFOpcPackage.h"
#include "Exceptional.h"
#include <contrib/unzip/unzip.h>
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/ai_assert.h>
#include <memory>
#include <vector>
@ -48,19 +55,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cassert>
#include <cstdlib>
#include "../contrib/unzip/unzip.h"
#include "../include/assimp/IOStream.hpp"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/ai_assert.h"
#include "Exceptional.h"
#ifndef ASSIMP_BUILD_NO_3MF_IMPORTER
namespace Assimp {
@ -324,8 +318,8 @@ D3MFZipArchive::D3MFZipArchive(IOSystem* pIOHandler, const std::string& rFile)
// ------------------------------------------------------------------------------------------------
// Destructor.
D3MFZipArchive::~D3MFZipArchive() {
for( std::map<std::string, ZipFile*>::iterator it(m_ArchiveMap.begin()), end(m_ArchiveMap.end()); it != end; ++it ) {
delete it->second;
for(auto &file : m_ArchiveMap) {
delete file.second;
}
m_ArchiveMap.clear();
@ -398,8 +392,8 @@ void D3MFZipArchive::Close(IOStream *pFile) {
void D3MFZipArchive::getFileList(std::vector<std::string> &rFileList) {
rFileList.clear();
for(std::map<std::string, ZipFile*>::iterator it(m_ArchiveMap.begin()), end(m_ArchiveMap.end()); it != end; ++it) {
rFileList.push_back(it->first);
for(const auto &file : m_ArchiveMap) {
rFileList.push_back(file.first);
}
}

View File

@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <string>
#include <memory>
#include "../include/assimp/IOSystem.hpp"
#include <assimp/IOSystem.hpp>
#include "irrXMLWrapper.h"
namespace Assimp {

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StreamReader.h"
#include "fast_atof.h"
#include <vector>
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/DefaultLogger.hpp>
namespace Assimp {
namespace DXF {

View File

@ -52,8 +52,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "fast_atof.h"
#include "DXFHelper.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/scene.h"
#include <assimp/IOSystem.hpp>
#include <assimp/scene.h>
#include <numeric>
using namespace Assimp;

View File

@ -46,8 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <utility>
#include "BaseProcess.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/scene.h"
#include <assimp/mesh.h>
#include <assimp/scene.h>
class DeboneTest;

View File

@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "../include/assimp/ai_assert.h"
#include <assimp/ai_assert.h>
#include "DefaultIOStream.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -55,6 +55,7 @@ DefaultIOStream::~DefaultIOStream()
{
if (mFile) {
::fclose(mFile);
mFile = nullptr;
}
}
@ -109,9 +110,9 @@ size_t DefaultIOStream::FileSize() const
return 0;
}
if (SIZE_MAX == cachedSize) {
if (SIZE_MAX == mCachedSize ) {
// Although fseek/ftell would allow us to reuse the exising file handle here,
// Although fseek/ftell would allow us to reuse the existing file handle here,
// it is generally unsafe because:
// - For binary streams, it is not technically well-defined
// - For text files the results are meaningless
@ -124,16 +125,19 @@ size_t DefaultIOStream::FileSize() const
int err = _stat64( mFilename.c_str(), &fileStat );
if (0 != err)
return 0;
cachedSize = (size_t) (fileStat.st_size);
#else
mCachedSize = (size_t) (fileStat.st_size);
#elif defined __gnu_linux__ || defined __APPLE__ || defined __MACH__
struct stat fileStat;
int err = stat(mFilename.c_str(), &fileStat );
if (0 != err)
return 0;
cachedSize = (size_t) (fileStat.st_size);
const unsigned long long cachedSize = fileStat.st_size;
mCachedSize = static_cast< size_t >( cachedSize );
#else
# error "Unknown platform"
#endif
}
return cachedSize;
return mCachedSize;
}
// ----------------------------------------------------------------------------------

View File

@ -43,8 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_DEFAULTIOSTREAM_H_INC
#include <stdio.h>
#include "../include/assimp/IOStream.hpp"
#include "../include/assimp/importerdesc.h"
#include <assimp/IOStream.hpp>
#include <assimp/importerdesc.h>
#include "Defines.h"
namespace Assimp {
@ -55,7 +55,7 @@ namespace Assimp {
//! @note An instance of this class can exist without a valid file handle
//! attached to it. All calls fail, but the instance can nevertheless be
//! used with no restrictions.
class DefaultIOStream : public IOStream
class ASSIMP_API DefaultIOStream : public IOStream
{
friend class DefaultIOSystem;
#if __ANDROID__
@ -111,7 +111,7 @@ private:
std::string mFilename;
// Cached file size
mutable size_t cachedSize;
mutable size_t mCachedSize;
};
@ -119,7 +119,7 @@ private:
inline DefaultIOStream::DefaultIOStream () :
mFile (NULL),
mFilename (""),
cachedSize (SIZE_MAX)
mCachedSize(SIZE_MAX)
{
// empty
}
@ -130,7 +130,7 @@ inline DefaultIOStream::DefaultIOStream (FILE* pFile,
const std::string &strFilename) :
mFile(pFile),
mFilename(strFilename),
cachedSize (SIZE_MAX)
mCachedSize(SIZE_MAX)
{
// empty
}

View File

@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "DefaultIOStream.h"
#include "StringComparison.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/ai_assert.h"
#include <assimp/DefaultLogger.hpp>
#include <assimp/ai_assert.h>
#include <stdlib.h>

View File

@ -42,7 +42,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_DEFAULTIOSYSTEM_H_INC
#define AI_DEFAULTIOSYSTEM_H_INC
#include "../include/assimp/IOSystem.hpp"
#include <assimp/IOSystem.hpp>
namespace Assimp {

View File

@ -50,9 +50,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StdOStreamLogStream.h"
#include "FileLogStream.h"
#include "StringUtils.h"
#include "../include/assimp/NullLogger.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/ai_assert.h"
#include <assimp/NullLogger.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/ai_assert.h>
#include <iostream>
#include <stdio.h>

View File

@ -44,7 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDED_AI_DEFAULTPROGRESSHANDLER_H
#define INCLUDED_AI_DEFAULTPROGRESSHANDLER_H
#include "../include/assimp/ProgressHandler.hpp"
#include <assimp/ProgressHandler.hpp>
namespace Assimp {
// ------------------------------------------------------------------------------------

View File

@ -58,8 +58,8 @@ class DeadlyImportError
{
public:
/** Constructor with arguments */
explicit DeadlyImportError( const std::string& pErrorText)
: runtime_error(pErrorText)
explicit DeadlyImportError( const std::string& errorText)
: runtime_error(errorText)
{
}

View File

@ -64,10 +64,10 @@ Here we implement only the C++ interface (Assimp::Exporter).
#include "Exceptional.h"
#include "ScenePrivate.h"
#include <memory>
#include "../include/assimp/Exporter.hpp"
#include "../include/assimp/mesh.h"
#include "../include/assimp/postprocess.h"
#include "../include/assimp/scene.h"
#include <assimp/Exporter.hpp>
#include <assimp/mesh.h>
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#include <memory>
namespace Assimp {
@ -534,9 +534,9 @@ bool ExportProperties :: SetPropertyInteger(const char* szName, int iValue)
// ------------------------------------------------------------------------------------------------
// Set a configuration property
bool ExportProperties :: SetPropertyFloat(const char* szName, float iValue)
bool ExportProperties :: SetPropertyFloat(const char* szName, ai_real iValue)
{
return SetGenericProperty<float>(mFloatProperties, szName,iValue);
return SetGenericProperty<ai_real>(mFloatProperties, szName,iValue);
}
// ------------------------------------------------------------------------------------------------
@ -563,10 +563,10 @@ int ExportProperties :: GetPropertyInteger(const char* szName,
// ------------------------------------------------------------------------------------------------
// Get a configuration property
float ExportProperties :: GetPropertyFloat(const char* szName,
float iErrorReturn /*= 10e10*/) const
ai_real ExportProperties :: GetPropertyFloat(const char* szName,
ai_real iErrorReturn /*= 10e10*/) const
{
return GetGenericProperty<float>(mFloatProperties,szName,iErrorReturn);
return GetGenericProperty<ai_real>(mFloatProperties,szName,iErrorReturn);
}
// ------------------------------------------------------------------------------------------------
@ -603,7 +603,7 @@ bool ExportProperties :: HasPropertyBool(const char* szName) const
// Has a configuration property
bool ExportProperties :: HasPropertyFloat(const char* szName) const
{
return HasGenericProperty<float>(mFloatProperties, szName);
return HasGenericProperty<ai_real>(mFloatProperties, szName);
};
// ------------------------------------------------------------------------------------------------

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXTokenizer.h"
#include "FBXUtil.h"
#include "../include/assimp/defs.h"
#include <assimp/defs.h>
#include <stdint.h>
#include "Exceptional.h"
#include "ByteSwapper.h"

View File

@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXImporter.h"
#include "StringComparison.h"
#include "../include/assimp/scene.h"
#include <assimp/scene.h>
#include <tuple>
#include <memory>
@ -1062,8 +1062,8 @@ void Converter::GenerateTransformationNodeChain( const Model& model,
nd->mName.Set( name );
for ( size_t i = 0; i < TransformationComp_MAXIMUM; ++i ) {
nd->mTransformation = nd->mTransformation * chain[ i ];
for (const auto &transform : chain) {
nd->mTransformation = nd->mTransformation * transform;
}
}
@ -1916,18 +1916,26 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextu
return;
}
const Texture* const tex = ( *it ).second->getTexture();
int texCount = (*it).second->textureCount();
// Set the blend mode for layered textures
int blendmode= (*it).second->GetBlendMode();
out_mat->AddProperty(&blendmode,1,_AI_MATKEY_TEXOP_BASE,target,0);
for(int texIndex = 0; texIndex < texCount; texIndex++){
const Texture* const tex = ( *it ).second->getTexture(texIndex);
aiString path;
path.Set( tex->RelativeFilename() );
out_mat->AddProperty( &path, _AI_MATKEY_TEXTURE_BASE, target, 0 );
out_mat->AddProperty( &path, _AI_MATKEY_TEXTURE_BASE, target, texIndex );
aiUVTransform uvTrafo;
// XXX handle all kinds of UV transformations
uvTrafo.mScaling = tex->UVScaling();
uvTrafo.mTranslation = tex->UVTranslation();
out_mat->AddProperty( &uvTrafo, 1, _AI_MATKEY_UVTRANSFORM_BASE, target, 0 );
out_mat->AddProperty( &uvTrafo, 1, _AI_MATKEY_UVTRANSFORM_BASE, target, texIndex );
const PropertyTable& props = tex->Props();
@ -2021,7 +2029,8 @@ void Converter::TrySetTextureProperties( aiMaterial* out_mat, const LayeredTextu
}
}
out_mat->AddProperty( &uvIndex, 1, _AI_MATKEY_UVWSRC_BASE, target, 0 );
out_mat->AddProperty( &uvIndex, 1, _AI_MATKEY_UVWSRC_BASE, target, texIndex );
}
}
void Converter::SetTextureProperties( aiMaterial* out_mat, const TextureMap& textures, const MeshGeometry* const mesh )
@ -2030,6 +2039,7 @@ void Converter::SetTextureProperties( aiMaterial* out_mat, const TextureMap& tex
TrySetTextureProperties( out_mat, textures, "AmbientColor", aiTextureType_AMBIENT, mesh );
TrySetTextureProperties( out_mat, textures, "EmissiveColor", aiTextureType_EMISSIVE, mesh );
TrySetTextureProperties( out_mat, textures, "SpecularColor", aiTextureType_SPECULAR, mesh );
TrySetTextureProperties( out_mat, textures, "SpecularFactor", aiTextureType_SPECULAR, mesh);
TrySetTextureProperties( out_mat, textures, "TransparentColor", aiTextureType_OPACITY, mesh );
TrySetTextureProperties( out_mat, textures, "ReflectionColor", aiTextureType_REFLECTION, mesh );
TrySetTextureProperties( out_mat, textures, "DisplacementColor", aiTextureType_DISPLACEMENT, mesh );
@ -2044,6 +2054,7 @@ void Converter::SetTextureProperties( aiMaterial* out_mat, const LayeredTextureM
TrySetTextureProperties( out_mat, layeredTextures, "AmbientColor", aiTextureType_AMBIENT, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "EmissiveColor", aiTextureType_EMISSIVE, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "SpecularColor", aiTextureType_SPECULAR, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "SpecularFactor", aiTextureType_SPECULAR, mesh);
TrySetTextureProperties( out_mat, layeredTextures, "TransparentColor", aiTextureType_OPACITY, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "ReflectionColor", aiTextureType_REFLECTION, mesh );
TrySetTextureProperties( out_mat, layeredTextures, "DisplacementColor", aiTextureType_DISPLACEMENT, mesh );
@ -3037,7 +3048,7 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
next_pos.resize( inputs.size(), 0 );
for( KeyTimeList::value_type time : keys ) {
float result[ 3 ] = { def_value.x, def_value.y, def_value.z };
ai_real result[ 3 ] = { def_value.x, def_value.y, def_value.z };
for ( size_t i = 0; i < count; ++i ) {
const KeyFrameList& kfl = inputs[ i ];
@ -3060,7 +3071,7 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
// do the actual interpolation in double-precision arithmetics
// because it is a bit sensitive to rounding errors.
const double factor = timeB == timeA ? 0. : static_cast<double>( ( time - timeA ) / ( timeB - timeA ) );
const float interpValue = static_cast<float>( valueA + ( valueB - valueA ) * factor );
const ai_real interpValue = static_cast<ai_real>( valueA + ( valueB - valueA ) * factor );
result[ std::get<2>(kfl) ] = interpValue;
}

View File

@ -269,8 +269,8 @@ Document::Document(const Parser& parser, const ImportSettings& settings)
, parser(parser)
{
// Cannot use array default initialization syntax because vc8 fails on it
for (unsigned int i = 0; i < sizeof(creationTimeStamp) / sizeof(creationTimeStamp[0]); ++i) {
creationTimeStamp[i] = 0;
for (auto &timeStamp : creationTimeStamp) {
timeStamp = 0;
}
ReadHeader();

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <numeric>
#include <stdint.h>
#include "../include/assimp/mesh.h"
#include <assimp/mesh.h>
#include "FBXProperties.h"
#include "FBXParser.h"
@ -594,23 +594,24 @@ public:
BlendMode_BlendModeCount
};
const Texture* getTexture() const
const Texture* getTexture(int index=0) const
{
return texture;
}
return textures[index];
BlendMode GetBlendMode()
}
const int textureCount() const {
return textures.size();
}
const BlendMode GetBlendMode() const
{
return blendMode;
}
float Alpha()
{
return alpha;
}
private:
const Texture* texture;
std::vector<const Texture*> textures;
BlendMode blendMode;
float alpha;
};

View File

@ -57,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StreamReader.h"
#include "MemoryIOWrapper.h"
#include "../include/assimp/Importer.hpp"
#include <assimp/Importer.hpp>
namespace Assimp {
template<> const std::string LogFunctions<FBXImporter>::log_prefix = "FBX: ";

View File

@ -227,7 +227,6 @@ Texture::~Texture()
LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Document& /*doc*/, const std::string& name)
: Object(id,element,name)
,texture(0)
,blendMode(BlendMode_Modulate)
,alpha(1)
{
@ -267,7 +266,7 @@ void LayeredTexture::fillTexture(const Document& doc)
const Texture* const tex = dynamic_cast<const Texture*>(ob);
texture = tex;
textures.push_back(tex);
}
}

View File

@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory>
#include "FBXCompileConfig.h"
#include "../include/assimp/ai_assert.h"
#include <assimp/ai_assert.h>
#include <vector>
#include <string>

View File

@ -1,8 +1,8 @@
#ifndef ASSIMP_FILELOGSTREAM_H_INC
#define ASSIMP_FILELOGSTREAM_H_INC
#include "../include/assimp/LogStream.hpp"
#include "../include/assimp/IOStream.hpp"
#include <assimp/LogStream.hpp>
#include <assimp/IOStream.hpp>
#include "DefaultIOSystem.h"
namespace Assimp {

View File

@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_FINDDEGENERATESPROCESS_H_INC
#include "BaseProcess.h"
#include "../include/assimp/mesh.h"
#include <assimp/mesh.h>
class FindDegeneratesProcessTest;
namespace Assimp {

View File

@ -58,7 +58,7 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
FindInvalidDataProcess::FindInvalidDataProcess()
: configEpsilon(0.0f)
: configEpsilon(0.0)
{
// nothing to do here
}
@ -221,16 +221,16 @@ inline bool ProcessArray(T*& in, unsigned int num,const char* name,
// ------------------------------------------------------------------------------------------------
template <typename T>
AI_FORCE_INLINE bool EpsilonCompare(const T& n, const T& s, float epsilon);
AI_FORCE_INLINE bool EpsilonCompare(const T& n, const T& s, ai_real epsilon);
// ------------------------------------------------------------------------------------------------
AI_FORCE_INLINE bool EpsilonCompare(float n, float s, float epsilon) {
AI_FORCE_INLINE bool EpsilonCompare(ai_real n, ai_real s, ai_real epsilon) {
return std::fabs(n-s)>epsilon;
}
// ------------------------------------------------------------------------------------------------
template <>
bool EpsilonCompare<aiVectorKey>(const aiVectorKey& n, const aiVectorKey& s, float epsilon) {
bool EpsilonCompare<aiVectorKey>(const aiVectorKey& n, const aiVectorKey& s, ai_real epsilon) {
return
EpsilonCompare(n.mValue.x,s.mValue.x,epsilon) &&
EpsilonCompare(n.mValue.y,s.mValue.y,epsilon) &&
@ -239,7 +239,7 @@ bool EpsilonCompare<aiVectorKey>(const aiVectorKey& n, const aiVectorKey& s, flo
// ------------------------------------------------------------------------------------------------
template <>
bool EpsilonCompare<aiQuatKey>(const aiQuatKey& n, const aiQuatKey& s, float epsilon) {
bool EpsilonCompare<aiQuatKey>(const aiQuatKey& n, const aiQuatKey& s, ai_real epsilon) {
return
EpsilonCompare(n.mValue.x,s.mValue.x,epsilon) &&
EpsilonCompare(n.mValue.y,s.mValue.y,epsilon) &&
@ -249,7 +249,7 @@ bool EpsilonCompare<aiQuatKey>(const aiQuatKey& n, const aiQuatKey& s, float eps
// ------------------------------------------------------------------------------------------------
template <typename T>
inline bool AllIdentical(T* in, unsigned int num, float epsilon)
inline bool AllIdentical(T* in, unsigned int num, ai_real epsilon)
{
if (num <= 1) {
return true;

View File

@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_FINDINVALIDDATA_H_INC
#include "BaseProcess.h"
#include "../include/assimp/types.h"
#include "../include/assimp/anim.h"
#include <assimp/types.h>
#include <assimp/anim.h>
struct aiMesh;
class FindInvalidDataProcessTest;
@ -97,7 +97,7 @@ public:
void ProcessAnimationChannel (aiNodeAnim* anim);
private:
float configEpsilon;
ai_real configEpsilon;
};
} // end of namespace Assimp

View File

@ -46,9 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// internal headers
#include "FixNormalsStep.h"
#include "StringUtils.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/postprocess.h"
#include "../include/assimp/scene.h"
#include <assimp/DefaultLogger.hpp>
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#include <stdio.h>

View File

@ -45,9 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "GenFaceNormalsProcess.h"
#include "../include/assimp/postprocess.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/DefaultLogger.hpp"
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#include <assimp/DefaultLogger.hpp>
#include "Exceptional.h"
#include "qnan.h"

View File

@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_GENFACENORMALPROCESS_H_INC
#include "BaseProcess.h"
#include "../include/assimp/mesh.h"
#include <assimp/mesh.h>
namespace Assimp
{

View File

@ -78,8 +78,8 @@ bool GenVertexNormalsProcess::IsActive( unsigned int pFlags) const
void GenVertexNormalsProcess::SetupProperties(const Importer* pImp)
{
// Get the current value of the AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE property
configMaxAngle = pImp->GetPropertyFloat(AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE,175.f);
configMaxAngle = AI_DEG_TO_RAD(std::max(std::min(configMaxAngle,175.0f),0.0f));
configMaxAngle = pImp->GetPropertyFloat(AI_CONFIG_PP_GSN_MAX_SMOOTHING_ANGLE,(ai_real)175.0);
configMaxAngle = AI_DEG_TO_RAD(std::max(std::min(configMaxAngle,(ai_real)175.0),(ai_real)0.0));
}
// ------------------------------------------------------------------------------------------------
@ -123,7 +123,7 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals (aiMesh* pMesh, unsigned int
}
// Allocate the array to hold the output normals
const float qnan = std::numeric_limits<float>::quiet_NaN();
const float qnan = std::numeric_limits<ai_real>::quiet_NaN();
pMesh->mNormals = new aiVector3D[pMesh->mNumVertices];
// Compute per-face normals but store them per-vertex
@ -154,13 +154,13 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals (aiMesh* pMesh, unsigned int
// check whether we can reuse the SpatialSort of a previous step.
SpatialSort* vertexFinder = NULL;
SpatialSort _vertexFinder;
float posEpsilon = 1e-5f;
ai_real posEpsilon = 1e-5;
if (shared) {
std::vector<std::pair<SpatialSort,float> >* avf;
std::vector<std::pair<SpatialSort,ai_real> >* avf;
shared->GetProperty(AI_SPP_SPATIAL_SORT,avf);
if (avf)
{
std::pair<SpatialSort,float>& blubb = avf->operator [] (meshIndex);
std::pair<SpatialSort,ai_real>& blubb = avf->operator [] (meshIndex);
vertexFinder = &blubb.first;
posEpsilon = blubb.second;
}
@ -205,13 +205,13 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals (aiMesh* pMesh, unsigned int
// Slower code path if a smooth angle is set. There are many ways to achieve
// the effect, this one is the most straightforward one.
else {
const float fLimit = std::cos(configMaxAngle);
const ai_real fLimit = std::cos(configMaxAngle);
for (unsigned int i = 0; i < pMesh->mNumVertices;++i) {
// Get all vertices that share this one ...
vertexFinder->FindPositions( pMesh->mVertices[i] , posEpsilon, verticesFound);
aiVector3D vr = pMesh->mNormals[i];
float vrlen = vr.Length();
ai_real vrlen = vr.Length();
aiVector3D pcNor;
for (unsigned int a = 0; a < verticesFound.size(); ++a) {

View File

@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_GENVERTEXNORMALPROCESS_H_INC
#include "BaseProcess.h"
#include "../include/assimp/mesh.h"
#include <assimp/mesh.h>
class GenNormalsTest;
@ -86,7 +86,7 @@ public:
// setter for configMaxAngle
inline void SetMaxSmoothAngle(float f)
inline void SetMaxSmoothAngle(ai_real f)
{
configMaxAngle =f;
}
@ -104,10 +104,9 @@ public:
private:
/** Configuration option: maximum smoothing angle, in radians*/
float configMaxAngle;
ai_real configMaxAngle;
};
} // end of namespace Assimp
#endif // !!AI_GENVERTEXNORMALPROCESS_H_INC

View File

@ -41,8 +41,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_GENERIC_PROPERTY_H_INCLUDED
#define AI_GENERIC_PROPERTY_H_INCLUDED
#include "./../include/assimp/Importer.hpp"
#include "./../include/assimp/ai_assert.h"
#include <assimp/Importer.hpp>
#include <assimp/ai_assert.h>
#include "Hash.h"
#include <map>

View File

@ -48,9 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "HMPLoader.h"
#include "MD2FileData.h"
#include <memory>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/scene.h"
#include <assimp/IOSystem.hpp>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
using namespace Assimp;

View File

@ -45,9 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_HMPLOADER_H_INCLUDED
// public ASSIMP headers
#include "../include/assimp/types.h"
#include "../include/assimp/texture.h"
#include "../include/assimp/material.h"
#include <assimp/types.h>
#include <assimp/texture.h>
#include <assimp/material.h>
// internal headers
#include "BaseImporter.h"

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <tuple>
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
# include "../contrib/unzip/unzip.h"
# include <contrib/unzip/unzip.h>
#endif
#include "IFCLoader.h"
@ -60,8 +60,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StreamReader.h"
#include "MemoryIOWrapper.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/Importer.hpp"
#include <assimp/scene.h>
#include <assimp/Importer.hpp>
namespace Assimp {

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
#include "IFCUtil.h"
#include <limits>
#include "../include/assimp/material.h"
#include <assimp/material.h>
namespace Assimp {
namespace IFC {

View File

@ -48,9 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "IFCReaderGen.h"
#include "IFCLoader.h"
#include "STEPFile.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/material.h"
#include <assimp/mesh.h>
#include <assimp/material.h>
struct aiNode;

View File

@ -59,12 +59,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// We need MathFunctions.h to compute the lcm/gcd of a number
#include "MathFunctions.h"
#include <memory>
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/mesh.h"
#include "../include/assimp/material.h"
#include "../include/assimp/scene.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/postprocess.h"
#include <assimp/DefaultLogger.hpp>
#include <assimp/mesh.h>
#include <assimp/material.h>
#include <assimp/scene.h>
#include <assimp/IOSystem.hpp>
#include <assimp/postprocess.h>
using namespace Assimp;
@ -207,54 +207,54 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
// by six single planes with different textures, so we'll
// need to build six meshes.
const float l = 10.f; // the size used by Irrlicht
const ai_real l = 10.0; // the size used by Irrlicht
// FRONT SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex(-l,-l,-l, 0, 0, 1, 1.f,1.f),
SkyboxVertex( l,-l,-l, 0, 0, 1, 0.f,1.f),
SkyboxVertex( l, l,-l, 0, 0, 1, 0.f,0.f),
SkyboxVertex(-l, l,-l, 0, 0, 1, 1.f,0.f)) );
SkyboxVertex(-l,-l,-l, 0, 0, 1, 1.0,1.0),
SkyboxVertex( l,-l,-l, 0, 0, 1, 0.0,1.0),
SkyboxVertex( l, l,-l, 0, 0, 1, 0.0,0.0),
SkyboxVertex(-l, l,-l, 0, 0, 1, 1.0,0.0)) );
meshes.back()->mMaterialIndex = materials.size()-6u;
// LEFT SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex( l,-l,-l, -1, 0, 0, 1.f,1.f),
SkyboxVertex( l,-l, l, -1, 0, 0, 0.f,1.f),
SkyboxVertex( l, l, l, -1, 0, 0, 0.f,0.f),
SkyboxVertex( l, l,-l, -1, 0, 0, 1.f,0.f)) );
SkyboxVertex( l,-l,-l, -1, 0, 0, 1.0,1.0),
SkyboxVertex( l,-l, l, -1, 0, 0, 0.0,1.0),
SkyboxVertex( l, l, l, -1, 0, 0, 0.0,0.0),
SkyboxVertex( l, l,-l, -1, 0, 0, 1.0,0.0)) );
meshes.back()->mMaterialIndex = materials.size()-5u;
// BACK SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex( l,-l, l, 0, 0, -1, 1.f,1.f),
SkyboxVertex(-l,-l, l, 0, 0, -1, 0.f,1.f),
SkyboxVertex(-l, l, l, 0, 0, -1, 0.f,0.f),
SkyboxVertex( l, l, l, 0, 0, -1, 1.f,0.f)) );
SkyboxVertex( l,-l, l, 0, 0, -1, 1.0,1.0),
SkyboxVertex(-l,-l, l, 0, 0, -1, 0.0,1.0),
SkyboxVertex(-l, l, l, 0, 0, -1, 0.0,0.0),
SkyboxVertex( l, l, l, 0, 0, -1, 1.0,0.0)) );
meshes.back()->mMaterialIndex = materials.size()-4u;
// RIGHT SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex(-l,-l, l, 1, 0, 0, 1.f,1.f),
SkyboxVertex(-l,-l,-l, 1, 0, 0, 0.f,1.f),
SkyboxVertex(-l, l,-l, 1, 0, 0, 0.f,0.f),
SkyboxVertex(-l, l, l, 1, 0, 0, 1.f,0.f)) );
SkyboxVertex(-l,-l, l, 1, 0, 0, 1.0,1.0),
SkyboxVertex(-l,-l,-l, 1, 0, 0, 0.0,1.0),
SkyboxVertex(-l, l,-l, 1, 0, 0, 0.0,0.0),
SkyboxVertex(-l, l, l, 1, 0, 0, 1.0,0.0)) );
meshes.back()->mMaterialIndex = materials.size()-3u;
// TOP SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex( l, l,-l, 0, -1, 0, 1.f,1.f),
SkyboxVertex( l, l, l, 0, -1, 0, 0.f,1.f),
SkyboxVertex(-l, l, l, 0, -1, 0, 0.f,0.f),
SkyboxVertex(-l, l,-l, 0, -1, 0, 1.f,0.f)) );
SkyboxVertex( l, l,-l, 0, -1, 0, 1.0,1.0),
SkyboxVertex( l, l, l, 0, -1, 0, 0.0,1.0),
SkyboxVertex(-l, l, l, 0, -1, 0, 0.0,0.0),
SkyboxVertex(-l, l,-l, 0, -1, 0, 1.0,0.0)) );
meshes.back()->mMaterialIndex = materials.size()-2u;
// BOTTOM SIDE
meshes.push_back( BuildSingleQuadMesh(
SkyboxVertex( l,-l, l, 0, 1, 0, 0.f,0.f),
SkyboxVertex( l,-l,-l, 0, 1, 0, 1.f,0.f),
SkyboxVertex(-l,-l,-l, 0, 1, 0, 1.f,1.f),
SkyboxVertex(-l,-l, l, 0, 1, 0, 0.f,1.f)) );
SkyboxVertex( l,-l, l, 0, 1, 0, 0.0,0.0),
SkyboxVertex( l,-l,-l, 0, 1, 0, 1.0,0.0),
SkyboxVertex(-l,-l,-l, 0, 1, 0, 1.0,1.0),
SkyboxVertex(-l,-l, l, 0, 1, 0, 0.0,1.0)) );
meshes.back()->mMaterialIndex = materials.size()-1u;
}
@ -479,7 +479,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
aiVectorKey& key = anim->mPositionKeys[i];
key.mTime = i * tdelta;
const float t = (float) ( in.speed * key.mTime );
const ai_real t = (ai_real) ( in.speed * key.mTime );
key.mValue = in.circleCenter + in.circleRadius * ((vecU * std::cos(t)) + (vecV * std::sin(t)));
}
@ -498,7 +498,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
aiVector3D diff = in.direction - in.circleCenter;
const float lengthOfWay = diff.Length();
const ai_real lengthOfWay = diff.Length();
diff.Normalize();
const double timeFactor = lengthOfWay / in.timeForWay;
@ -507,7 +507,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
for (unsigned int i = 0; i < anim->mNumPositionKeys;++i) {
aiVectorKey& key = anim->mPositionKeys[i];
key.mTime = i * tdelta;
key.mValue = in.circleCenter + diff * float(timeFactor * key.mTime);
key.mValue = in.circleCenter + diff * ai_real(timeFactor * key.mTime);
}
}
break;
@ -542,8 +542,8 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
{
aiVectorKey& key = anim->mPositionKeys[i];
const float dt = (i * in.speed * 0.001f );
const float u = dt - std::floor(dt);
const ai_real dt = (i * in.speed * 0.001 );
const ai_real u = dt - std::floor(dt);
const int idx = (int)std::floor(dt) % size;
// get the 4 current points to evaluate the spline
@ -553,13 +553,13 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
const aiVector3D& p3 = in.splineKeys[ ClampSpline( idx + 2, size ) ].mValue;
// compute polynomials
const float u2 = u*u;
const float u3 = u2*2;
const ai_real u2 = u*u;
const ai_real u3 = u2*2;
const float h1 = 2.0f * u3 - 3.0f * u2 + 1.0f;
const float h2 = -2.0f * u3 + 3.0f * u3;
const float h3 = u3 - 2.0f * u3;
const float h4 = u3 - u2;
const ai_real h1 = 2.0 * u3 - 3.0 * u2 + 1.0;
const ai_real h2 = -2.0 * u3 + 3.0 * u3;
const ai_real h3 = u3 - 2.0 * u3;
const ai_real h4 = u3 - u2;
// compute the spline tangents
const aiVector3D t1 = ( p2 - p0 ) * in.tightness;
@ -1372,8 +1372,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
/* Now iterate through all cameras and compute their final (horizontal) FOV
*/
for (std::vector<aiCamera*>::iterator it = cameras.begin(), end = cameras.end();it != end; ++it) {
aiCamera* cam = *it;
for (aiCamera *cam : cameras) {
// screen aspect could be missing
if (cam->mAspect) {

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SceneCombiner.h"
#include "Importer.h"
#include "StringUtils.h"
#include "../include/assimp/anim.h"
#include <assimp/anim.h>
namespace Assimp {
@ -116,9 +116,9 @@ private:
explicit Animator(AT t = UNKNOWN)
: type (t)
, speed (0.001f)
, direction (0.f,1.f,0.f)
, circleRadius (1.f)
, speed (0.001)
, direction (0.0,1.0,0.0)
, circleRadius (1.0)
, tightness (0.5f)
, loop (true)
, timeForWay (100)
@ -127,15 +127,15 @@ private:
// common parameters
float speed;
ai_real speed;
aiVector3D direction;
// FLY_CIRCLE
aiVector3D circleCenter;
float circleRadius;
ai_real circleRadius;
// FOLLOW_SPLINE
float tightness;
ai_real tightness;
std::vector<aiVectorKey> splineKeys;
// ROTATION (angles given in direction)
@ -166,11 +166,11 @@ private:
explicit Node(ET t)
: type (t)
, scaling (1.f,1.f,1.f) // assume uniform scaling by default
, scaling (1.0,1.0,1.0) // assume uniform scaling by default
, parent()
, framesPerSecond (0.f)
, framesPerSecond (0.0)
, id()
, sphereRadius (1.f)
, sphereRadius (1.0)
, spherePolyCountX (100)
, spherePolyCountY (100)
{
@ -202,7 +202,7 @@ private:
// Animated meshes: frames per second
// 0.f if not specified
float framesPerSecond;
ai_real framesPerSecond;
// Meshes: path to the mesh to be loaded
std::string meshPath;
@ -213,7 +213,7 @@ private:
std::vector< std::pair<aiMaterial*, unsigned int> > materials;
// Spheres: radius of the sphere to be generates
float sphereRadius;
ai_real sphereRadius;
// Spheres: Number of polygons in the x,y direction
unsigned int spherePolyCountX,spherePolyCountY;
@ -230,13 +230,13 @@ private:
{}
//! Construction from single vertex components
SkyboxVertex(float px, float py, float pz,
float nx, float ny, float nz,
float uvx, float uvy)
SkyboxVertex(ai_real px, ai_real py, ai_real pz,
ai_real nx, ai_real ny, ai_real nz,
ai_real uvx, ai_real uvy)
: position (px,py,pz)
, normal (nx,ny,nz)
, uv (uvx,uvy,0.f)
, uv (uvx,uvy,0.0)
{}
aiVector3D position, normal, uv;

View File

@ -49,11 +49,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ParsingUtils.h"
#include "fast_atof.h"
#include <memory>
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/mesh.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/material.h"
#include "../include/assimp/scene.h"
#include <assimp/IOSystem.hpp>
#include <assimp/mesh.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/material.h>
#include <assimp/scene.h>
#include "Macros.h"

View File

@ -51,8 +51,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "IRRShared.h"
#include "ParsingUtils.h"
#include "fast_atof.h"
#include "../include/assimp/DefaultLogger.hpp"
#include "../include/assimp/material.h"
#include <assimp/DefaultLogger.hpp>
#include <assimp/material.h>
using namespace Assimp;

View File

@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @brief Implementation of the CPP-API class #Importer
*/
#include "../include/assimp/version.h"
#include <assimp/version.h>
// ------------------------------------------------------------------------------------------------
/* Uncomment this line to prevent Assimp from catching unknown exceptions.
@ -1017,11 +1017,11 @@ bool Importer::SetPropertyInteger(const char* szName, int iValue)
// ------------------------------------------------------------------------------------------------
// Set a configuration property
bool Importer::SetPropertyFloat(const char* szName, float iValue)
bool Importer::SetPropertyFloat(const char* szName, ai_real iValue)
{
bool exising;
ASSIMP_BEGIN_EXCEPTION_REGION();
exising = SetGenericProperty<float>(pimpl->mFloatProperties, szName,iValue);
exising = SetGenericProperty<ai_real>(pimpl->mFloatProperties, szName,iValue);
ASSIMP_END_EXCEPTION_REGION(bool);
return exising;
}
@ -1058,10 +1058,10 @@ int Importer::GetPropertyInteger(const char* szName,
// ------------------------------------------------------------------------------------------------
// Get a configuration property
float Importer::GetPropertyFloat(const char* szName,
float iErrorReturn /*= 10e10*/) const
ai_real Importer::GetPropertyFloat(const char* szName,
ai_real iErrorReturn /*= 10e10*/) const
{
return GetGenericProperty<float>(pimpl->mFloatProperties,szName,iErrorReturn);
return GetGenericProperty<ai_real>(pimpl->mFloatProperties,szName,iErrorReturn);
}
// ------------------------------------------------------------------------------------------------

View File

@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map>
#include <string>
#include <vector>
#include "../include/assimp/matrix4x4.h"
#include <assimp/matrix4x4.h>
struct aiScene;
@ -75,7 +75,7 @@ public:
// typedefs for our four configuration maps.
// We don't need more, so there is no need for a generic solution
typedef std::map<KeyType, int> IntPropertyMap;
typedef std::map<KeyType, float> FloatPropertyMap;
typedef std::map<KeyType, ai_real> FloatPropertyMap;
typedef std::map<KeyType, std::string> StringPropertyMap;
typedef std::map<KeyType, aiMatrix4x4> MatrixPropertyMap;

Some files were not shown because too many files have changed in this diff Show More