diff --git a/CMakeLists.txt b/CMakeLists.txt index 9829cd306..50159bb2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,9 +62,9 @@ if( CMAKE_COMPILER_IS_MINGW ) endif() if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW) - set(CMAKE_CXX_FLAGS "-fPIC") # this is a very important switch and some libraries seem now to have it.... + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") # this is a very important switch and some libraries seem now to have it.... # hide all not-exported symbols - set(CMAKE_CXX_FLAGS "-fvisibility=hidden -Wall" ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall" ) elseif(MSVC) # enable multi-core compilation with MSVC add_definitions(/MP) diff --git a/code/3DSExporter.cpp b/code/3DSExporter.cpp index b16a3b2c7..1bd341c78 100644 --- a/code/3DSExporter.cpp +++ b/code/3DSExporter.cpp @@ -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 "../include/assimp/IOSystem.hpp" +#include "../include/assimp/DefaultLogger.hpp" +#include "../include/assimp/Exporter.hpp" #include using namespace Assimp; @@ -324,6 +324,7 @@ void Discreet3DSExporter::WriteMaterials() break; default: + shading_mode_out = Discreet3DS::Flat; ai_assert(false); }; writer.PutU2(static_cast(shading_mode_out)); diff --git a/code/AssbinLoader.cpp b/code/AssbinLoader.cpp index 6818929fb..8788adbd7 100644 --- a/code/AssbinLoader.cpp +++ b/code/AssbinLoader.cpp @@ -51,8 +51,8 @@ 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/mesh.h" +#include "../include/assimp/anim.h" #include "../include/assimp/scene.h" #include @@ -199,7 +199,8 @@ template void ReadBounds( IOStream * stream, T* /*p*/, unsigned int void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node ) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AINODE); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AINODE); /*uint32_t size =*/ Read(stream); *node = new aiNode(); @@ -230,7 +231,8 @@ void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node ) // ----------------------------------------------------------------------------------- void AssbinImporter::ReadBinaryBone( IOStream * stream, aiBone* b ) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AIBONE ); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AIBONE); /*uint32_t size =*/ Read(stream); b->mName = Read(stream); @@ -253,7 +255,8 @@ void AssbinImporter::ReadBinaryBone( IOStream * stream, aiBone* b ) void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh ) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AIMESH); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AIMESH); /*uint32_t size =*/ Read(stream); mesh->mPrimitiveTypes = Read(stream); @@ -377,7 +380,8 @@ void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh ) void AssbinImporter::ReadBinaryMaterialProperty(IOStream * stream, aiMaterialProperty* prop) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AIMATERIALPROPERTY); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AIMATERIALPROPERTY); /*uint32_t size =*/ Read(stream); prop->mKey = Read(stream); @@ -393,7 +397,8 @@ void AssbinImporter::ReadBinaryMaterialProperty(IOStream * stream, aiMaterialPro // ----------------------------------------------------------------------------------- void AssbinImporter::ReadBinaryMaterial(IOStream * stream, aiMaterial* mat) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AIMATERIAL); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AIMATERIAL); /*uint32_t size =*/ Read(stream); mat->mNumAllocated = mat->mNumProperties = Read(stream); @@ -414,7 +419,8 @@ void AssbinImporter::ReadBinaryMaterial(IOStream * stream, aiMaterial* mat) // ----------------------------------------------------------------------------------- void AssbinImporter::ReadBinaryNodeAnim(IOStream * stream, aiNodeAnim* nd) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AINODEANIM); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AINODEANIM); /*uint32_t size =*/ Read(stream); nd->mNodeName = Read(stream); @@ -462,7 +468,8 @@ void AssbinImporter::ReadBinaryNodeAnim(IOStream * stream, aiNodeAnim* nd) // ----------------------------------------------------------------------------------- void AssbinImporter::ReadBinaryAnim( IOStream * stream, aiAnimation* anim ) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AIANIMATION); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AIANIMATION); /*uint32_t size =*/ Read(stream); anim->mName = Read (stream); @@ -482,7 +489,8 @@ void AssbinImporter::ReadBinaryAnim( IOStream * stream, aiAnimation* anim ) void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AITEXTURE); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AITEXTURE); /*uint32_t size =*/ Read(stream); tex->mWidth = Read(stream); @@ -505,7 +513,8 @@ void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex) // ----------------------------------------------------------------------------------- void AssbinImporter::ReadBinaryLight( IOStream * stream, aiLight* l ) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AILIGHT); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AILIGHT); /*uint32_t size =*/ Read(stream); l->mName = Read(stream); @@ -531,7 +540,8 @@ void AssbinImporter::ReadBinaryLight( IOStream * stream, aiLight* l ) // ----------------------------------------------------------------------------------- void AssbinImporter::ReadBinaryCamera( IOStream * stream, aiCamera* cam ) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AICAMERA); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AICAMERA); /*uint32_t size =*/ Read(stream); cam->mName = Read(stream); @@ -546,7 +556,8 @@ void AssbinImporter::ReadBinaryCamera( IOStream * stream, aiCamera* cam ) void AssbinImporter::ReadBinaryScene( IOStream * stream, aiScene* scene ) { - ai_assert( Read(stream) == ASSBIN_CHUNK_AISCENE); + uint32_t chunkID = Read(stream); + ai_assert(chunkID == ASSBIN_CHUNK_AISCENE); /*uint32_t size =*/ Read(stream); scene->mFlags = Read(stream); diff --git a/code/Assimp.cpp b/code/Assimp.cpp index f8df73415..ec5fd7ab7 100644 --- a/code/Assimp.cpp +++ b/code/Assimp.cpp @@ -423,6 +423,21 @@ const char* aiGetErrorString() return gLastErrorString.c_str(); } +// ----------------------------------------------------------------------------------------------- +// Return the description of a importer given its index +const aiImporterDesc* aiGetImportFormatDescription( size_t pIndex) +{ + return Importer().GetImporterInfo(pIndex); +} + +// ----------------------------------------------------------------------------------------------- +// Return the number of importers +size_t aiGetImportFormatCount(void) +{ + return Importer().GetImporterCount(); +} + + // ------------------------------------------------------------------------------------------------ // Returns the error text of the last failed import process. aiBool aiIsExtensionSupported(const char* szExtension) diff --git a/code/BaseImporter.cpp b/code/BaseImporter.cpp index 1bb0a1cee..38de47432 100644 --- a/code/BaseImporter.cpp +++ b/code/BaseImporter.cpp @@ -480,7 +480,9 @@ namespace Assimp struct Assimp::BatchData { BatchData() - : next_id(0xffff) + : pIOSystem() + , pImporter() + , next_id(0xffff) {} // IO system to be used for all imports diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp index 078ac0a56..6c87c3de8 100644 --- a/code/ColladaExporter.cpp +++ b/code/ColladaExporter.cpp @@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "XMLTools.h" #include "../include/assimp/IOSystem.hpp" #include "../include/assimp/Exporter.hpp" -#include "../include/assimp/scene.h" +#include "../include/assimp/scene.h" #include "Exceptional.h" @@ -127,6 +127,8 @@ void ColladaExporter::WriteFile() WriteTextures(); WriteHeader(); + WriteCamerasLibrary(); + WriteLightsLibrary(); WriteMaterials(); WriteGeometryLibrary(); @@ -165,8 +167,6 @@ void ColladaExporter::WriteHeader() std::time_t date = std::time(NULL); std::strftime(date_str, date_nb_chars, "%Y-%m-%dT%H:%M:%S", std::localtime(&date)); - std::string scene_name = mScene->mRootNode->mName.C_Str(); - aiVector3D scaling; aiQuaternion rotation; aiVector3D position; @@ -286,6 +286,201 @@ void ColladaExporter::WriteTextures() { } } +// ------------------------------------------------------------------------------------------------ +// Write the embedded textures +void ColladaExporter::WriteCamerasLibrary() { + if(mScene->HasCameras()) { + + mOutput << startstr << "" << endstr; + PushTag(); + + for( size_t a = 0; a < mScene->mNumCameras; ++a) + WriteCamera( a); + + PopTag(); + mOutput << startstr << "" << endstr; + + } +} + +void ColladaExporter::WriteCamera(size_t pIndex){ + + const aiCamera *cam = mScene->mCameras[pIndex]; + const std::string idstrEscaped = XMLEscape(cam->mName.C_Str()); + + mOutput << startstr << "" << endstr; + PushTag(); + mOutput << startstr << "" << endstr; + PushTag(); + mOutput << startstr << "" << endstr; + PushTag(); + //assimp doesn't support the import of orthographic cameras! se we write + //always perspective + mOutput << startstr << "" << endstr; + PushTag(); + mOutput << startstr << ""<< + AI_RAD_TO_DEG(cam->mHorizontalFOV) + <<"" << endstr; + mOutput << startstr << "" + << cam->mAspect + << "" << endstr; + mOutput << startstr << "" + << cam->mClipPlaneNear + << "" << endstr; + mOutput << startstr << "" + << cam->mClipPlaneFar + << "" << endstr; + PopTag(); + mOutput << startstr << "" << endstr; + PopTag(); + mOutput << startstr << "" << endstr; + PopTag(); + mOutput << startstr << "" << endstr; + PopTag(); + mOutput << startstr << "" << endstr; + +} + + +// ------------------------------------------------------------------------------------------------ +// Write the embedded textures +void ColladaExporter::WriteLightsLibrary() { + if(mScene->HasLights()) { + + mOutput << startstr << "" << endstr; + PushTag(); + + for( size_t a = 0; a < mScene->mNumLights; ++a) + WriteLight( a); + + PopTag(); + mOutput << startstr << "" << endstr; + + } +} + +void ColladaExporter::WriteLight(size_t pIndex){ + + const aiLight *light = mScene->mLights[pIndex]; + const std::string idstrEscaped = XMLEscape(light->mName.C_Str()); + + mOutput << startstr << "" << endstr; + PushTag(); + mOutput << startstr << "" << endstr; + PushTag(); + switch(light->mType){ + case aiLightSource_AMBIENT: + WriteAmbienttLight(light); + break; + case aiLightSource_DIRECTIONAL: + WriteDirectionalLight(light); + break; + case aiLightSource_POINT: + WritePointLight(light); + break; + case aiLightSource_SPOT: + WriteSpotLight(light); + break; + case aiLightSource_UNDEFINED: + case _aiLightSource_Force32Bit: + break; + } + PopTag(); + mOutput << startstr << "" << endstr; + + PopTag(); + mOutput << startstr << "" << endstr; + +} + +void ColladaExporter::WritePointLight(const aiLight *const light){ + const aiColor3D &color= light->mColorDiffuse; + mOutput << startstr << "" << endstr; + PushTag(); + mOutput << startstr << "" + << color.r<<" "<" << endstr; + mOutput << startstr << "" + << light->mAttenuationConstant + <<"" << endstr; + mOutput << startstr << "" + << light->mAttenuationLinear + <<"" << endstr; + mOutput << startstr << "" + << light->mAttenuationQuadratic + <<"" << endstr; + + PopTag(); + mOutput << startstr << "" << endstr; + +} +void ColladaExporter::WriteDirectionalLight(const aiLight *const light){ + const aiColor3D &color= light->mColorDiffuse; + mOutput << startstr << "" << endstr; + PushTag(); + mOutput << startstr << "" + << color.r<<" "<" << endstr; + + PopTag(); + mOutput << startstr << "" << endstr; + +} +void ColladaExporter::WriteSpotLight(const aiLight *const light){ + + const aiColor3D &color= light->mColorDiffuse; + mOutput << startstr << "" << endstr; + PushTag(); + mOutput << startstr << "" + << color.r<<" "<" << endstr; + mOutput << startstr << "" + << light->mAttenuationConstant + <<"" << endstr; + mOutput << startstr << "" + << light->mAttenuationLinear + <<"" << endstr; + mOutput << startstr << "" + << light->mAttenuationQuadratic + <<"" << endstr; + /* + out->mAngleOuterCone = AI_DEG_TO_RAD (std::acos(std::pow(0.1f,1.f/srcLight->mFalloffExponent))+ + srcLight->mFalloffAngle); + */ + + const float fallOffAngle = AI_RAD_TO_DEG(light->mAngleInnerCone); + mOutput << startstr <<"" + << fallOffAngle + <<"" << endstr; + double temp = light->mAngleOuterCone-light->mAngleInnerCone; + + temp = std::cos(temp); + temp = std::log(temp)/std::log(0.1); + temp = 1/temp; + mOutput << startstr << "" + << temp + <<"" << endstr; + + + PopTag(); + mOutput << startstr << "" << endstr; + +} + +void ColladaExporter::WriteAmbienttLight(const aiLight *const light){ + + const aiColor3D &color= light->mColorAmbient; + mOutput << startstr << "" << endstr; + PushTag(); + mOutput << startstr << "" + << color.r<<" "<" << endstr; + + PopTag(); + mOutput << startstr << "" << endstr; +} + // ------------------------------------------------------------------------------------------------ // Reads a single surface entry from the given material keys void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial* pSrcMat, aiTextureType pTexture, const char* pKey, size_t pType, size_t pIndex) @@ -425,8 +620,6 @@ void ColladaExporter::WriteMaterials() { materials.resize( mScene->mNumMaterials); - std::set material_names; - /// collect all materials from the scene size_t numTextures = 0; for( size_t a = 0; a < mScene->mNumMaterials; ++a ) @@ -847,6 +1040,23 @@ void ColladaExporter::WriteNode(aiNode* pNode) mOutput << mat.d1 << " " << mat.d2 << " " << mat.d3 << " " << mat.d4; mOutput << "" << endstr; + if(pNode->mNumMeshes==0){ + //check if it is a camera node + for(size_t i=0; imNumCameras; i++){ + if(mScene->mCameras[i]->mName == pNode->mName){ + mOutput << startstr <<"" << endstr; + break; + } + } + //check if it is a light node + for(size_t i=0; imNumLights; i++){ + if(mScene->mLights[i]->mName == pNode->mName){ + mOutput << startstr <<"" << endstr; + break; + } + } + + }else // instance every geometry for( size_t a = 0; a < pNode->mNumMeshes; ++a ) { @@ -854,9 +1064,8 @@ void ColladaExporter::WriteNode(aiNode* pNode) // do not instanciate mesh if empty. I wonder how this could happen if( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 ) continue; - - mOutput << startstr << "mMeshes[a])) << "\">" << endstr; - PushTag(); + mOutput << startstr << "mMeshes[a])) << "\">" << endstr; + PushTag(); mOutput << startstr << "" << endstr; PushTag(); mOutput << startstr << "" << endstr; diff --git a/code/ColladaExporter.h b/code/ColladaExporter.h index 9456508ce..1312ab9ce 100644 --- a/code/ColladaExporter.h +++ b/code/ColladaExporter.h @@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #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 #include @@ -83,6 +84,22 @@ protected: /// Writes the material setup void WriteMaterials(); + /// Writes the cameras library + void WriteCamerasLibrary(); + + // Write a camera entry + void WriteCamera(size_t pIndex); + + /// Writes the cameras library + void WriteLightsLibrary(); + + // Write a camera entry + void WriteLight(size_t pIndex); + void WritePointLight(const aiLight *const light); + void WriteDirectionalLight(const aiLight *const light); + void WriteSpotLight(const aiLight *const light); + void WriteAmbienttLight(const aiLight *const light); + /// Writes the geometry library void WriteGeometryLibrary(); @@ -144,8 +161,11 @@ protected: struct Property { bool exist; - float value; - Property() { exist = false; } + float value; + Property() + : exist(false) + , value(0.0f) + {} }; // summarize a material in an convinient way. diff --git a/code/ColladaHelper.h b/code/ColladaHelper.h index 71ccd2dfc..8a4e38d53 100644 --- a/code/ColladaHelper.h +++ b/code/ColladaHelper.h @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include "../include/assimp/types.h" +#include "../include/assimp/light.h" #include "../include/assimp/mesh.h" #include "../include/assimp/material.h" @@ -134,7 +134,8 @@ struct Camera struct Light { Light() - : mAttConstant (1.f) + : mType (aiLightSource_UNDEFINED) + , mAttConstant (1.f) , mAttLinear (0.f) , mAttQuadratic (0.f) , mFalloffAngle (180.f) @@ -172,13 +173,14 @@ struct Light struct InputSemanticMapEntry { InputSemanticMapEntry() - : mSet (0) + : mSet(0) + , mType(IT_Invalid) {} //! Index of set, optional unsigned int mSet; - //! Name of referenced vertex input + //! Type of referenced vertex input InputType mType; }; @@ -235,7 +237,7 @@ struct Node { std::string mName; std::string mID; - std::string mSID; + std::string mSID; Node* mParent; std::vector mChildren; @@ -384,8 +386,8 @@ struct Controller // accessor URL of the joint names 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]; + ///< 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]; // accessor URL of the joint inverse bind matrices std::string mJointOffsetMatrixSource; @@ -609,7 +611,15 @@ struct ChannelEntry const Collada::Accessor* mValueAccessor; ///> Collada accessor to the key value values const Collada::Data* mValueData; ///> Source datat array for the key value values - ChannelEntry() { mChannel = NULL; mSubElement = 0; } + ChannelEntry() + : mChannel() + , mTransformIndex() + , mSubElement() + , mTimeAccessor() + , mTimeData() + , mValueAccessor() + , mValueData() + {} }; } // end of namespace Collada diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 735eede18..3a981b538 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -81,7 +81,10 @@ static const aiImporterDesc desc = { // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer ColladaLoader::ColladaLoader() -: noSkeletonMesh(), ignoreUpDirection(false), mNodeNameCounter() + : noSkeletonMesh() + , ignoreUpDirection(false) + , invertTransparency(false) + , mNodeNameCounter() {} // ------------------------------------------------------------------------------------------------ @@ -346,8 +349,8 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll { // Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess .... // epsilon chosen to be 0.1 - out->mAngleOuterCone = AI_DEG_TO_RAD (std::acos(std::pow(0.1f,1.f/srcLight->mFalloffExponent))+ - srcLight->mFalloffAngle); + out->mAngleOuterCone = std::acos(std::pow(0.1f,1.f/srcLight->mFalloffExponent))+ + out->mAngleInnerCone; } else { out->mAngleOuterCone = out->mAngleInnerCone + AI_DEG_TO_RAD( srcLight->mPenumbraAngle ); @@ -916,7 +919,7 @@ void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pPars // ------------------------------------------------------------------------------------------------ // Constructs the animations for the given source anim -void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string pPrefix) +void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string &pPrefix) { std::string animName = pPrefix.empty() ? pSrcAnim->mName : pPrefix + "_" + pSrcAnim->mName; diff --git a/code/ColladaLoader.h b/code/ColladaLoader.h index 4ff0a667d..5e1098727 100644 --- a/code/ColladaLoader.h +++ b/code/ColladaLoader.h @@ -155,7 +155,7 @@ protected: * @param pSrcAnim the source animation to process * @param pPrefix Prefix to the name in case of nested animations */ - void StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string pPrefix); + void StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pPrefix); /** Constructs the animation for the given source anim */ void CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName); diff --git a/code/ComputeUVMappingProcess.cpp b/code/ComputeUVMappingProcess.cpp index 172268b66..3ed8f9a9e 100644 --- a/code/ComputeUVMappingProcess.cpp +++ b/code/ComputeUVMappingProcess.cpp @@ -412,7 +412,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene) { if (!DefaultLogger::isNullLogger()) { - sprintf(buffer, "Found non-UV mapped texture (%s,%i). Mapping type: %s", + sprintf(buffer, "Found non-UV mapped texture (%s,%u). Mapping type: %s", TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex, MappingTypeToString(mapping)); diff --git a/code/FBXParser.cpp b/code/FBXParser.cpp index f77c24a8d..4e4668902 100644 --- a/code/FBXParser.cpp +++ b/code/FBXParser.cpp @@ -86,27 +86,6 @@ namespace { } - // ------------------------------------------------------------------------------------------------ - // print warning, do return - void ParseWarning(const std::string& message, const Token& token) - { - if(DefaultLogger::get()) { - DefaultLogger::get()->warn(Util::AddTokenText("FBX-Parser",message,&token)); - } - } - - // ------------------------------------------------------------------------------------------------ -/* void ParseWarning(const std::string& message, const Element* element = NULL) - { - if(element) { - ParseWarning(message,element->KeyToken()); - return; - } - if(DefaultLogger::get()) { - DefaultLogger::get()->warn("FBX-Parser: " + message); - } - } -*/ // ------------------------------------------------------------------------------------------------ void ParseError(const std::string& message, TokenPtr token) { diff --git a/code/FindInvalidDataProcess.cpp b/code/FindInvalidDataProcess.cpp index 450c5f873..e82aedc36 100644 --- a/code/FindInvalidDataProcess.cpp +++ b/code/FindInvalidDataProcess.cpp @@ -58,6 +58,7 @@ using namespace Assimp; // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer FindInvalidDataProcess::FindInvalidDataProcess() + : configEpsilon(0.0f) { // nothing to do here } diff --git a/code/FixNormalsStep.cpp b/code/FixNormalsStep.cpp index d3d53ac15..608a145e0 100644 --- a/code/FixNormalsStep.cpp +++ b/code/FixNormalsStep.cpp @@ -158,7 +158,7 @@ bool FixInfacingNormalsProcess::ProcessMesh( aiMesh* pcMesh, unsigned int index) if (!DefaultLogger::isNullLogger()) { char buffer[128]; // should be sufficiently large - ::sprintf(buffer,"Mesh %i: Normals are facing inwards (or the mesh is planar)",index); + ::sprintf(buffer,"Mesh %u: Normals are facing inwards (or the mesh is planar)",index); DefaultLogger::get()->info(buffer); } diff --git a/code/IFCCurve.cpp b/code/IFCCurve.cpp index 0625ea631..aca350fc9 100644 --- a/code/IFCCurve.cpp +++ b/code/IFCCurve.cpp @@ -173,7 +173,6 @@ public: // -------------------------------------------------- Line(const IfcLine& entity, ConversionData& conv) : Curve(entity,conv) - , entity(entity) { ConvertCartesianPoint(p,entity.Pnt); ConvertVector(v,entity.Dir); @@ -221,7 +220,6 @@ public: } private: - const IfcLine& entity; IfcVector3 p,v; }; @@ -238,7 +236,6 @@ public: // -------------------------------------------------- CompositeCurve(const IfcCompositeCurve& entity, ConversionData& conv) : BoundedCurve(entity,conv) - , entity(entity) , total() { curves.reserve(entity.Segments.size()); @@ -331,7 +328,6 @@ public: } private: - const IfcCompositeCurve& entity; std::vector< CurveEntry > curves; IfcFloat total; @@ -349,8 +345,6 @@ public: // -------------------------------------------------- TrimmedCurve(const IfcTrimmedCurve& entity, ConversionData& conv) : BoundedCurve(entity,conv) - , entity(entity) - , ok() { base = boost::shared_ptr(Curve::Convert(entity.BasisCurve,conv)); @@ -448,11 +442,9 @@ private: private: - const IfcTrimmedCurve& entity; ParamRange range; IfcFloat maxval; bool agree_sense; - bool ok; boost::shared_ptr base; }; @@ -469,7 +461,6 @@ public: // -------------------------------------------------- PolyLine(const IfcPolyline& entity, ConversionData& conv) : BoundedCurve(entity,conv) - , entity(entity) { points.reserve(entity.Points.size()); @@ -507,7 +498,6 @@ public: } private: - const IfcPolyline& entity; std::vector points; }; diff --git a/code/IFCLoader.cpp b/code/IFCLoader.cpp index 34f176c89..8ffefcb91 100644 --- a/code/IFCLoader.cpp +++ b/code/IFCLoader.cpp @@ -60,9 +60,9 @@ 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 "../include/assimp/scene.h" +#include "../include/assimp/Importer.hpp" + namespace Assimp { template<> const std::string LogFunctions::log_prefix = "IFC: "; @@ -93,8 +93,6 @@ namespace { void SetUnits(ConversionData& conv); void SetCoordinateSpace(ConversionData& conv); void ProcessSpatialStructures(ConversionData& conv); -aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el ,ConversionData& conv); -void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, ConversionData& conv); void MakeTreeRelative(ConversionData& conv); void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv); @@ -421,16 +419,6 @@ void ResolveObjectPlacement(aiMatrix4x4& m, const IfcObjectPlacement& place, Con } } -// ------------------------------------------------------------------------------------------------ -void GetAbsTransform(aiMatrix4x4& out, const aiNode* nd, ConversionData& conv) -{ - aiMatrix4x4 t; - if (nd->mParent) { - GetAbsTransform(t,nd->mParent,conv); - } - out = t*nd->mTransformation; -} - // ------------------------------------------------------------------------------------------------ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, unsigned int matid, ConversionData& conv) { @@ -682,14 +670,14 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion // skip over space and annotation nodes - usually, these have no meaning in Assimp's context bool skipGeometry = false; if(conv.settings.skipSpaceRepresentations) { - if(const IfcSpace* const space = el.ToPtr()) { + if(el.ToPtr()) { IFCImporter::LogDebug("skipping IfcSpace entity due to importer settings"); skipGeometry = true; } } if(conv.settings.skipAnnotations) { - if(const IfcAnnotation* const ann = el.ToPtr()) { + if(el.ToPtr()) { IFCImporter::LogDebug("skipping IfcAnnotation entity due to importer settings"); return NULL; } @@ -764,7 +752,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion continue; } BOOST_FOREACH(const IfcProduct& pro, cont->RelatedElements) { - if(const IfcOpeningElement* const open = pro.ToPtr()) { + if(pro.ToPtr()) { // IfcOpeningElement is handled below. Sadly we can't use it here as is: // The docs say that opening elements are USUALLY attached to building storey, // but we want them for the building elements to which they belong. diff --git a/code/IFCProfile.cpp b/code/IFCProfile.cpp index 42d090d9d..9e70c2ac1 100644 --- a/code/IFCProfile.cpp +++ b/code/IFCProfile.cpp @@ -114,7 +114,7 @@ void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh& meshout.vertcnt.push_back(4); } else if( const IfcCircleProfileDef* const circle = def.ToPtr()) { - if( const IfcCircleHollowProfileDef* const hollow = def.ToPtr()) { + if(def.ToPtr()) { // TODO } const size_t segments = 32; diff --git a/code/ImproveCacheLocality.cpp b/code/ImproveCacheLocality.cpp index 81617cc49..0f2ecc13a 100644 --- a/code/ImproveCacheLocality.cpp +++ b/code/ImproveCacheLocality.cpp @@ -110,7 +110,7 @@ void ImproveCacheLocalityProcess::Execute( aiScene* pScene) } if (!DefaultLogger::isNullLogger()) { char szBuff[128]; // should be sufficiently large in every case - ::sprintf(szBuff,"Cache relevant are %i meshes (%i faces). Average output ACMR is %f", + ::sprintf(szBuff,"Cache relevant are %u meshes (%u faces). Average output ACMR is %f", numm,numf,out/numf); DefaultLogger::get()->info(szBuff); @@ -182,7 +182,7 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh // the JoinIdenticalVertices process has not been executed on this // mesh, otherwise this value would normally be at least minimally // smaller than 3.0 ... - sprintf(szBuff,"Mesh %i: Not suitable for vcache optimization",meshNum); + sprintf(szBuff,"Mesh %u: Not suitable for vcache optimization",meshNum); DefaultLogger::get()->warn(szBuff); return 0.f; } @@ -361,7 +361,7 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh if ( DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) { char szBuff[128]; // should be sufficiently large in every case - ::sprintf(szBuff,"Mesh %i | ACMR in: %f out: %f | ~%.1f%%",meshNum,fACMR,fACMR2, + ::sprintf(szBuff,"Mesh %u | ACMR in: %f out: %f | ~%.1f%%",meshNum,fACMR,fACMR2, ((fACMR - fACMR2) / fACMR) * 100.f); DefaultLogger::get()->debug(szBuff); } diff --git a/code/ObjFileMtlImporter.cpp b/code/ObjFileMtlImporter.cpp index 80d0416d3..244027036 100644 --- a/code/ObjFileMtlImporter.cpp +++ b/code/ObjFileMtlImporter.cpp @@ -263,16 +263,21 @@ void ObjFileMtlImporter::createMaterial() } std::vector token; - const unsigned int numToken = tokenize( line, token, " " ); - std::string name( "" ); - if ( numToken == 1 ) { - name = AI_DEFAULT_MATERIAL_NAME; - } else { - name = token[ 1 ]; - } + const unsigned int numToken = tokenize( line, token, " \t" ); + std::string name( "" ); + if ( numToken == 1 ) { + name = AI_DEFAULT_MATERIAL_NAME; + } else { + // skip newmtl and all following white spaces + std::size_t first_ws_pos = line.find_first_of(" \t"); + std::size_t first_non_ws_pos = line.find_first_not_of(" \t", first_ws_pos); + if (first_non_ws_pos != std::string::npos) { + name = line.substr(first_non_ws_pos); + } + } - std::map::iterator it = m_pModel->m_MaterialMap.find( name ); - if ( m_pModel->m_MaterialMap.end() == it) { + std::map::iterator it = m_pModel->m_MaterialMap.find( name ); + if ( m_pModel->m_MaterialMap.end() == it) { // New Material created m_pModel->m_pCurrentMaterial = new ObjFile::Material(); m_pModel->m_pCurrentMaterial->MaterialName.Set( name ); diff --git a/code/ObjFileParser.cpp b/code/ObjFileParser.cpp index 9c5982861..a185ff249 100644 --- a/code/ObjFileParser.cpp +++ b/code/ObjFileParser.cpp @@ -469,7 +469,7 @@ void ObjFileParser::getMaterialDesc() return; char *pStart = &(*m_DataIt); - while( m_DataIt != m_DataItEnd && !IsSpaceOrNewLine( *m_DataIt ) ) { + while( m_DataIt != m_DataItEnd && !IsLineEnd( *m_DataIt ) ) { ++m_DataIt; } diff --git a/code/OpenGEXImporter.cpp b/code/OpenGEXImporter.cpp index 20da427fd..c68bfe2b7 100644 --- a/code/OpenGEXImporter.cpp +++ b/code/OpenGEXImporter.cpp @@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include #include static const aiImporterDesc desc = { @@ -184,12 +185,11 @@ USE_ODDLPARSER_NS //------------------------------------------------------------------------------------------------ OpenGEXImporter::VertexContainer::VertexContainer() : m_numVerts( 0 ) -, m_vertices() +, m_vertices(NULL) , m_numNormals( 0 ) -, m_normals() -, m_textureCoords() -, m_numUVComps() { - // empty +, m_normals(NULL) { + std::fill(&m_numUVComps[0], &m_numUVComps[AI_MAX_NUMBER_OF_TEXTURECOORDS], 0U); + std::fill(&m_textureCoords[0], &m_textureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS], static_cast(NULL)); } //------------------------------------------------------------------------------------------------ @@ -216,9 +216,9 @@ OpenGEXImporter::RefInfo::~RefInfo() { //------------------------------------------------------------------------------------------------ OpenGEXImporter::OpenGEXImporter() -: m_meshCache() -, m_root( NULL ) +: m_root( NULL ) , m_nodeChildMap() +, m_meshCache() , m_mesh2refMap() , m_ctx( NULL ) , m_currentNode( NULL ) @@ -227,7 +227,7 @@ OpenGEXImporter::OpenGEXImporter() , m_tokenType( Grammar::NoneType ) , m_nodeStack() , m_unresolvedRefStack() { - // empty + std::fill(&m_metrics[0], &m_metrics[MetricInfo::Max], MetricInfo()); } //------------------------------------------------------------------------------------------------ @@ -666,7 +666,6 @@ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene } const size_t numItems( countDataArrayListItems( vaList ) ); - Value *next( vaList->m_dataList ); if( Position == attribType ) { m_currentVertices.m_numVerts = numItems; m_currentVertices.m_vertices = new aiVector3D[ numItems ]; diff --git a/code/OptimizeGraph.cpp b/code/OptimizeGraph.cpp index d418655bf..25dca7923 100644 --- a/code/OptimizeGraph.cpp +++ b/code/OptimizeGraph.cpp @@ -71,6 +71,10 @@ using namespace Assimp; // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer OptimizeGraphProcess::OptimizeGraphProcess() + : mScene() + , nodes_in() + , nodes_out() + , count_merged() {} // ------------------------------------------------------------------------------------------------ @@ -122,7 +126,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list& no ++it; } - if (nd->mNumMeshes || child_nodes.size()) { + if (nd->mNumMeshes || !child_nodes.empty()) { nodes.push_back(nd); } else { @@ -172,7 +176,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list& no } ++it; } - if (join_master && join.size()) { + if (join_master && !join.empty()) { join_master->mName.length = sprintf(join_master->mName.data,"$MergedNode_%i",count_merged++); unsigned int out_meshes = 0; diff --git a/code/OptimizeMeshes.cpp b/code/OptimizeMeshes.cpp index cbd5ea693..870369315 100644 --- a/code/OptimizeMeshes.cpp +++ b/code/OptimizeMeshes.cpp @@ -60,9 +60,10 @@ static const unsigned int DeadBeef = 0xdeadbeef; // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer OptimizeMeshesProcess::OptimizeMeshesProcess() -: pts (false) -, max_verts( NotSet ) -, max_faces( NotSet ) { + : mScene() + , pts(false) + , max_verts( NotSet ) + , max_faces( NotSet ) { // empty } diff --git a/code/OptimizeMeshes.h b/code/OptimizeMeshes.h index 88e81629c..38c06e221 100644 --- a/code/OptimizeMeshes.h +++ b/code/OptimizeMeshes.h @@ -164,9 +164,6 @@ private: //! Per mesh info std::vector meshes; - //! Next output mesh - aiMesh* mesh; - //! Output meshes std::vector output; diff --git a/code/PlyExporter.cpp b/code/PlyExporter.cpp index 0a4c94a48..12e59f2b6 100644 --- a/code/PlyExporter.cpp +++ b/code/PlyExporter.cpp @@ -43,14 +43,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if !defined(ASSIMP_BUILD_NO_EXPORT) && !defined(ASSIMP_BUILD_NO_PLY_EXPORTER) #include "PlyExporter.h" -#include +#include #include -#include "Exceptional.h" -#include "../include/assimp/scene.h" -#include "../include/assimp/version.h" -#include "../include/assimp/IOSystem.hpp" +#include "Exceptional.h" +#include "../include/assimp/scene.h" +#include "../include/assimp/version.h" +#include "../include/assimp/IOSystem.hpp" #include "../include/assimp/Exporter.hpp" -#include "qnan.h" +#include "qnan.h" using namespace Assimp; @@ -96,8 +96,7 @@ void ExportScenePlyBinary(const char* pFile, IOSystem* pIOSystem, const aiScene* // ------------------------------------------------------------------------------------------------ PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool binary) : filename(_filename) -, pScene(pScene) -, endl("\n") +, endl("\n") { // make sure that all formatting happens using the standard, C locale and not the user's current locale const std::locale& l = std::locale("C"); diff --git a/code/PlyExporter.h b/code/PlyExporter.h index ec20903d7..64649d7cc 100644 --- a/code/PlyExporter.h +++ b/code/PlyExporter.h @@ -78,7 +78,6 @@ private: private: const std::string filename; - const aiScene* const pScene; // obviously, this endl() doesn't flush() the stream const std::string endl; diff --git a/code/RemoveVCProcess.cpp b/code/RemoveVCProcess.cpp index 2b551bacf..9fe4e8de2 100644 --- a/code/RemoveVCProcess.cpp +++ b/code/RemoveVCProcess.cpp @@ -54,7 +54,9 @@ using namespace Assimp; // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -RemoveVCProcess::RemoveVCProcess() +RemoveVCProcess::RemoveVCProcess() : + configDeleteFlags() + , mScene() {} // ------------------------------------------------------------------------------------------------ diff --git a/code/STEPFileReader.cpp b/code/STEPFileReader.cpp index 113ab50a1..d7780e317 100644 --- a/code/STEPFileReader.cpp +++ b/code/STEPFileReader.cpp @@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "STEPFileReader.h" #include "STEPFileEncoding.h" #include "TinyFormatter.h" -#include "fast_atof.h" +#include "fast_atof.h" #include @@ -55,28 +55,6 @@ namespace EXPRESS = STEP::EXPRESS; #include -// ------------------------------------------------------------------------------------------------ -// From http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring - -// trim from start -static inline std::string <rim(std::string &s) { - s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1( std::ptr_fun(Assimp::IsSpace)))); - return s; -} - -// trim from end -static inline std::string &rtrim(std::string &s) { - s.erase(std::find_if(s.rbegin(), s.rend(), std::not1( std::ptr_fun(Assimp::IsSpace))).base(),s.end()); - return s; -} -// trim from both ends -static inline std::string &trim(std::string &s) { - return ltrim(rtrim(s)); -} - - - - // ------------------------------------------------------------------------------------------------ std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = "") { diff --git a/code/STLExporter.cpp b/code/STLExporter.cpp index 1bc631ef7..f1ac8a53c 100644 --- a/code/STLExporter.cpp +++ b/code/STLExporter.cpp @@ -43,13 +43,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if !defined(ASSIMP_BUILD_NO_EXPORT) && !defined(ASSIMP_BUILD_NO_STL_EXPORTER) #include "STLExporter.h" -#include "../include/assimp/version.h" -#include "../include/assimp/IOSystem.hpp" -#include "../include/assimp/scene.h" -#include "../include/assimp/Exporter.hpp" -#include -#include "Exceptional.h" -#include "ByteSwapper.h" +#include "../include/assimp/version.h" +#include "../include/assimp/IOSystem.hpp" +#include "../include/assimp/scene.h" +#include "../include/assimp/Exporter.hpp" +#include +#include "Exceptional.h" +#include "ByteSwapper.h" using namespace Assimp; namespace Assimp { @@ -75,7 +75,7 @@ void ExportSceneSTLBinary(const char* pFile,IOSystem* pIOSystem, const aiScene* STLExporter exporter(pFile, pScene, true); // we're still here - export successfully completed. Write the file. - boost::scoped_ptr outfile (pIOSystem->Open(pFile,"wt")); + boost::scoped_ptr outfile (pIOSystem->Open(pFile,"wb")); if(outfile == NULL) { throw DeadlyExportError("could not open output .stl file: " + std::string(pFile)); } @@ -89,8 +89,7 @@ void ExportSceneSTLBinary(const char* pFile,IOSystem* pIOSystem, const aiScene* // ------------------------------------------------------------------------------------------------ STLExporter :: STLExporter(const char* _filename, const aiScene* pScene, bool binary) : filename(_filename) -, pScene(pScene) -, endl("\n") +, endl("\n") { // make sure that all formatting happens using the standard, C locale and not the user's current locale const std::locale& l = std::locale("C"); diff --git a/code/STLExporter.h b/code/STLExporter.h index 3284650c3..de7fce43e 100644 --- a/code/STLExporter.h +++ b/code/STLExporter.h @@ -75,7 +75,6 @@ private: private: const std::string filename; - const aiScene* const pScene; // this endl() doesn't flush() the stream const std::string endl; diff --git a/code/SortByPTypeProcess.cpp b/code/SortByPTypeProcess.cpp index 096b3fcf1..34bb830fd 100644 --- a/code/SortByPTypeProcess.cpp +++ b/code/SortByPTypeProcess.cpp @@ -397,11 +397,11 @@ void SortByPTypeProcess::Execute( aiScene* pScene) if (!DefaultLogger::isNullLogger()) { char buffer[1024]; - ::sprintf(buffer,"Points: %i%s, Lines: %i%s, Triangles: %i%s, Polygons: %i%s (Meshes, X = removed)", - aiNumMeshesPerPType[0], (configRemoveMeshes & aiPrimitiveType_POINT ? "X" : ""), - aiNumMeshesPerPType[1], (configRemoveMeshes & aiPrimitiveType_LINE ? "X" : ""), - aiNumMeshesPerPType[2], (configRemoveMeshes & aiPrimitiveType_TRIANGLE ? "X" : ""), - aiNumMeshesPerPType[3], (configRemoveMeshes & aiPrimitiveType_POLYGON ? "X" : "")); + ::sprintf(buffer,"Points: %u%s, Lines: %u%s, Triangles: %u%s, Polygons: %u%s (Meshes, X = removed)", + aiNumMeshesPerPType[0], ((configRemoveMeshes & aiPrimitiveType_POINT) ? "X" : ""), + aiNumMeshesPerPType[1], ((configRemoveMeshes & aiPrimitiveType_LINE) ? "X" : ""), + aiNumMeshesPerPType[2], ((configRemoveMeshes & aiPrimitiveType_TRIANGLE) ? "X" : ""), + aiNumMeshesPerPType[3], ((configRemoveMeshes & aiPrimitiveType_POLYGON) ? "X" : "")); DefaultLogger::get()->info(buffer); DefaultLogger::get()->debug("SortByPTypeProcess finished"); } diff --git a/code/StepExporter.cpp b/code/StepExporter.cpp index 0ce273313..845396780 100644 --- a/code/StepExporter.cpp +++ b/code/StepExporter.cpp @@ -115,21 +115,6 @@ void ExportSceneStep(const char* pFile,IOSystem* pIOSystem, const aiScene* pScen namespace { - inline uint64_t toIndexHash(int32_t id1, int32_t id2) - { - // dont wonder that -1/-1 -> hash=-1 - uint64_t hash = (uint32_t) id1; - hash = (hash << 32); - hash += (uint32_t) id2; - return hash; - } - - inline void fromIndexHash(uint64_t hash, int32_t &id1, int32_t &id2) - { - id1 = (hash & 0xFFFFFFFF00000000) >> 32; - id2 = (hash & 0xFFFFFFFF); - } - // Collect world transformations for each node void CollectTrafos(const aiNode* node, std::map& trafos) { const aiMatrix4x4& parent = node->mParent ? trafos[node->mParent] : aiMatrix4x4(); @@ -152,7 +137,7 @@ namespace { // ------------------------------------------------------------------------------------------------ // Constructor for a specific scene to export -StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mIOSystem(pIOSystem), mPath(path), mFile(file), mProperties(pProperties) +StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mProperties(pProperties), mIOSystem(pIOSystem), mFile(file), mPath(path), mScene(pScene), endstr(";\n") { CollectTrafos(pScene->mRootNode, trafos); CollectMeshes(pScene->mRootNode, meshes); @@ -160,11 +145,6 @@ StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std // make sure that all formatting happens using the standard, C locale and not the user's current locale mOutput.imbue( std::locale("C") ); - mScene = pScene; - - // set up strings - endstr = ";\n"; - // start writing WriteFile(); } diff --git a/code/TextureTransform.cpp b/code/TextureTransform.cpp index 98e1becb9..29257404d 100644 --- a/code/TextureTransform.cpp +++ b/code/TextureTransform.cpp @@ -54,7 +54,8 @@ using namespace Assimp; // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -TextureTransformStep::TextureTransformStep() +TextureTransformStep::TextureTransformStep() : + configFlags() { // nothing to do here } diff --git a/code/ValidateDataStructure.cpp b/code/ValidateDataStructure.cpp index 98d16be5e..2a2e1a0d6 100644 --- a/code/ValidateDataStructure.cpp +++ b/code/ValidateDataStructure.cpp @@ -60,7 +60,8 @@ using namespace Assimp; // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer -ValidateDSProcess::ValidateDSProcess() +ValidateDSProcess::ValidateDSProcess() : + mScene() {} // ------------------------------------------------------------------------------------------------ @@ -690,8 +691,7 @@ void ValidateDSProcess::Validate( const aiMaterial* pMaterial) if (aiPTI_String == prop->mType) { // FIX: strings are now stored in a less expensive way, but we can't use the // validation routine for 'normal' aiStrings - uint32_t len; - if (prop->mDataLength < 5 || prop->mDataLength < 4 + (len=*reinterpret_cast(prop->mData)) + 1) { + if (prop->mDataLength < 5 || prop->mDataLength < 4 + (*reinterpret_cast(prop->mData)) + 1) { ReportError("aiMaterial::mProperties[%i].mDataLength is " "too small to contain a string (%i, needed: %i)", i,prop->mDataLength,sizeof(aiString)); diff --git a/code/XFileExporter.cpp b/code/XFileExporter.cpp index 276b309dd..278bf12a8 100644 --- a/code/XFileExporter.cpp +++ b/code/XFileExporter.cpp @@ -95,17 +95,18 @@ void ExportSceneXFile(const char* pFile,IOSystem* pIOSystem, const aiScene* pSce // ------------------------------------------------------------------------------------------------ // Constructor for a specific scene to export -XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mIOSystem(pIOSystem), mPath(path), mFile(file), mProperties(pProperties) +XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) + : mProperties(pProperties), + mIOSystem(pIOSystem), + mPath(path), + mFile(file), + mScene(pScene), + mSceneOwned(false), + endstr("\n") { // make sure that all formatting happens using the standard, C locale and not the user's current locale mOutput.imbue( std::locale("C") ); - mScene = pScene; - mSceneOwned = false; - - // set up strings - endstr = "\n"; - // start writing WriteFile(); } diff --git a/include/assimp/Exporter.hpp b/include/assimp/Exporter.hpp index fb890129e..4e5a1131a 100644 --- a/include/assimp/Exporter.hpp +++ b/include/assimp/Exporter.hpp @@ -109,7 +109,14 @@ public: mEnforcePP = pEnforcePP; } - ExportFormatEntry() : mExportFunction(), mEnforcePP() {} + ExportFormatEntry() : + mExportFunction() + , mEnforcePP() + { + mDescription.id = NULL; + mDescription.description = NULL; + mDescription.fileExtension = NULL; + } }; diff --git a/include/assimp/cimport.h b/include/assimp/cimport.h index 6e85882d1..3dc95c00b 100644 --- a/include/assimp/cimport.h +++ b/include/assimp/cimport.h @@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_ASSIMP_H_INC #define AI_ASSIMP_H_INC #include "types.h" +#include #ifdef __cplusplus extern "C" { @@ -539,7 +540,20 @@ ASSIMP_API void aiIdentityMatrix3( ASSIMP_API void aiIdentityMatrix4( C_STRUCT aiMatrix4x4* mat); +// -------------------------------------------------------------------------------- +/** Returns the number of import file formats available in the current Assimp build. + * Use aiGetImportFormatDescription() to retrieve infos of a specific import format. + */ +ASSIMP_API size_t aiGetImportFormatCount(void); +// -------------------------------------------------------------------------------- +/** Returns a description of the nth import file format. Use #aiGetImportFormatCount() + * to learn how many import formats are supported. + * @param pIndex Index of the import format to retrieve information for. Valid range is + * 0 to #aiGetImportFormatCount() + * @return A description of that specific import format. NULL if pIndex is out of range. + */ +ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImportFormatDescription( size_t pIndex); #ifdef __cplusplus } #endif diff --git a/include/assimp/defs.h b/include/assimp/defs.h index 6b8ac3416..c21b3cf2b 100644 --- a/include/assimp/defs.h +++ b/include/assimp/defs.h @@ -209,7 +209,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__)) #error Currently, Borland is unsupported. Feel free to port Assimp. -// "W8059 Packgröße der Struktur geändert" +// "W8059 Packgr��e der Struktur ge�ndert" #endif ////////////////////////////////////////////////////////////////////////// @@ -257,8 +257,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f) /* Tiny macro to convert from radians to degrees and back */ -#define AI_DEG_TO_RAD(x) (x*0.0174532925f) -#define AI_RAD_TO_DEG(x) (x*57.2957795f) +#define AI_DEG_TO_RAD(x) ((x)*0.0174532925f) +#define AI_RAD_TO_DEG(x) ((x)*57.2957795f) /* Support for big-endian builds */ #if defined(__BYTE_ORDER__) diff --git a/include/assimp/importerdesc.h b/include/assimp/importerdesc.h index e61112a17..a7bbb4da1 100644 --- a/include/assimp/importerdesc.h +++ b/include/assimp/importerdesc.h @@ -138,6 +138,6 @@ Will return a NULL-pointer if no assigned importer desc. was found for the given \param extension [in] The extension to look for \return A pointer showing to the ImporterDesc, \see aiImporterDesc. */ -ASSIMP_API C_STRUCT const aiImporterDesc* aiGetImporterDesc( const char *extension ); +ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImporterDesc( const char *extension ); #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f4b67bad6..287f51698 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -40,6 +40,8 @@ SET( TEST_SRCS unit/utTriangulate.cpp unit/utVertexTriangleAdjacency.cpp unit/utNoBoostTest.cpp + unit/utColladaExportCamera.cpp + unit/utColladaExportLight.cpp ) SOURCE_GROUP( tests FILES ${TEST_SRCS} ) diff --git a/test/models/Collada/cameras.dae b/test/models/Collada/cameras.dae new file mode 100644 index 000000000..d514b0f3d --- /dev/null +++ b/test/models/Collada/cameras.dae @@ -0,0 +1,93 @@ + + + + + Blender User + Blender 2.74.0 commit date:2015-03-31, commit time:13:39, hash:000dfc0 + + 2015-05-17T19:24:51 + 2015-05-17T19:24:51 + + Z_UP + + + + + + + 49.13434 + 1.777778 + 0.1 + 100 + + + + + + 0 + 0 + 0 + + + + + + + + 3 + 1.777778 + 0.1 + 100 + + + + + + 0 + 0 + 0 + + + + + + + + 29.86284 + 1.777778 + 0.1 + 50 + + + + + + 0 + 0 + 0 + + + + + + + + + + 7.54979e-8 0 1 10 0 1 0 0 -1 0 7.54979e-8 0 0 0 0 1 + + + + 7.54979e-8 0 -1 -10 0 1 0 0 1 0 7.54979e-8 0 0 0 0 1 + + + + 3.09086e-8 -1 1.58933e-8 0 -3.09086e-8 1.58933e-8 1 5 -1 -3.09086e-8 -3.09086e-8 0 0 0 0 1 + + + + + + + + diff --git a/test/models/Collada/lights.dae b/test/models/Collada/lights.dae new file mode 100644 index 000000000..9e040aac6 --- /dev/null +++ b/test/models/Collada/lights.dae @@ -0,0 +1,380 @@ + + + + + Blender User + Blender 2.74.0 commit date:2015-03-31, commit time:13:39, hash:000dfc0 + + 2015-05-17T21:55:44 + 2015-05-17T21:55:44 + + Z_UP + + + + + + 1 1 1 + 1 + 0 + 0.00111109 + + + + + 0.000999987 + 1 + 0.1 + 0.1 + 1 + 1 + 1 + 2 + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 2880 + 2 + 30.002 + 1.000799 + 0.04999995 + 29.99998 + 1 + 2 + 0 + 0 + 1 + 1 + 1 + 1 + 8192 + 1 + 1 + 0 + 1 + 1 + 1 + 3 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 3 + 0.15 + 75 + 1 + 1 + 0 + 1 + 1 + 0 + + + + + + + 1 1 1 + + + + + 0.000999987 + 0 + 0.1 + 0.1 + 0.1 + 1 + 1 + 2 + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 512 + 2 + 40 + 0.5 + 0.04999995 + 25 + 1 + 2 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 3 + 0 + 0 + 0 + 0 + 2 + 1 + 1 + 1 + 3 + 0.15 + 45 + 1 + 1 + 0 + 1 + 1 + 1 + + + + + + + 1 1 1 + 1 + 0 + 0.001599967 + 45 + 0.15 + + + + + 0.000999987 + 0 + 0.1 + 0.1 + 0.1 + 1 + 1 + 2 + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 512 + 2 + 40 + 0.5 + 0.04999995 + 25 + 1 + 2 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 3 + 0 + 0 + 0 + 0 + 2 + 1 + 1 + 1 + 3 + 0.15 + 45 + 1 + 1 + 0 + 1 + 1 + 2 + + + + + + + 1 1 1 + + + + + 0.000999987 + 0 + 0.1 + 0.1 + 0.1 + 1 + 1 + 2 + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 512 + 2 + 40 + 0.5 + 0.04999995 + 25 + 1 + 2 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 3 + 0 + 0 + 0 + 0 + 2 + 1 + 1 + 1 + 3 + 0.15 + 45 + 1 + 1 + 0 + 1 + 1 + 3 + + + + + + + 1 1 1 + 1 + 0 + 0.001599967 + + + + + 0.000999987 + 0 + 0.1 + 0.1 + 0.1 + 1 + 1 + 2 + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 512 + 2 + 40 + 0.5 + 0.04999995 + 25 + 1 + 2 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 3 + 0 + 0 + 0 + 0 + 2 + 1 + 1 + 1 + 3 + 0.15 + 45 + 1 + 1 + 0 + 1 + 1 + 4 + + + + + + + + + + 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 + + + + 1 0 0 7.076701 0 1 0 -5.572294 0 0 1 5.147222 0 0 0 1 + + + + 1 0 0 8.888217 0 1 0 -5.016863 0 0 1 5.336025 0 0 0 1 + + + + 1 0 0 7.326984 0 1 0 -4.602942 0 0 1 5.554852 0 0 0 1 + + + + 1 0 0 8.063721 0 1 0 -4.19857 0 0 1 5.273283 0 0 0 1 + + + + + + + + \ No newline at end of file diff --git a/test/models/OBJ/space_in_material_name.mtl b/test/models/OBJ/space_in_material_name.mtl new file mode 100644 index 000000000..2f210fd48 --- /dev/null +++ b/test/models/OBJ/space_in_material_name.mtl @@ -0,0 +1,13 @@ + +# Example for github issue #545: spaces in material names. + +newmtl Hard Shiny Plastic White +Ka 0 0 0 +Kd 0.141176 0.184314 0.411765 +Ks 0 0 0 +Ni 1 +Ns 400 +Tf 1 1 1 +d 1 + + diff --git a/test/models/OBJ/space_in_material_name.obj b/test/models/OBJ/space_in_material_name.obj new file mode 100644 index 000000000..d5824e113 --- /dev/null +++ b/test/models/OBJ/space_in_material_name.obj @@ -0,0 +1,77 @@ +#### +# +# OBJ File Generated by LightWave3D +# LightWave3D OBJ Export v2.3 +# +#### +o concave_test.obj +mtllib space_in_material_name.mtl +g default +v -1.146 1.6575 2.348 +v -1.146 1.67177 2.49285 +v -1.146 1.67177 2.20315 +v -1.146 1.7125 2.35 +v -1.146 1.71402 2.63214 +v -1.146 1.71402 2.06386 +v -1.146 1.72571 2.48412 +v -1.146 1.72571 2.21588 +v -1.146 1.76483 2.61309 +v -1.146 1.76483 2.08691 +v -1.146 1.78263 2.76051 +v -1.146 1.78263 1.93549 +v -1.146 1.82836 2.73195 +v -1.146 1.82836 1.96805 +v -1.146 1.87497 2.87303 +v -1.146 1.87497 1.82297 +v -1.146 1.91386 2.83614 +v -1.146 1.91386 1.86386 +v -1.146 1.98749 2.96537 +v -1.146 1.98749 1.73063 +v -1.146 2.01805 2.92164 +v -1.146 2.01805 1.77836 +v -1.146 2.11586 3.03398 +v -1.146 2.11586 1.66202 +v -1.146 2.13691 2.98517 +v -1.146 2.13691 1.71483 +v -1.146 2.25515 3.07623 +v -1.146 2.25515 1.61977 +v -1.146 2.26588 3.02429 +v -1.146 2.26588 1.67571 +v -1.146 2.4 3.0905 +v -1.146 2.4 3.0375 +v -1.146 2.4 1.6625 +v -1.146 2.4 1.6055 +v -1.146 2.53412 3.02429 +v -1.146 2.53412 1.67571 +v -1.146 2.54485 3.07623 +v -1.146 2.54485 1.61977 +v -1.146 2.66309 2.98517 +v -1.146 2.66309 1.71483 +v -1.146 2.68414 3.03398 +v -1.146 2.68414 1.66202 +v -1.146 2.78195 2.92164 +v -1.146 2.78195 1.77836 +v -1.146 2.81251 2.96537 +v -1.146 2.81251 1.73063 +v -1.146 2.88614 2.83614 +v -1.146 2.88614 1.86386 +v -1.146 2.92503 2.87303 +v -1.146 2.92503 1.82297 +v -1.146 2.97164 2.73195 +v -1.146 2.97164 1.96805 +v -1.146 3.01737 2.76051 +v -1.146 3.01737 1.93549 +v -1.146 3.03517 2.61309 +v -1.146 3.03517 2.08691 +v -1.146 3.07429 2.48412 +v -1.146 3.07429 2.21588 +v -1.146 3.08598 2.63214 +v -1.146 3.08598 2.06386 +v -1.146 3.0875 2.35 +v -1.146 3.12823 2.49285 +v -1.146 3.12823 2.20315 +v -1.146 3.1425 2.348 +vn 1 0 -0 +usemtl Hard Shiny Plastic White +s 1 +f 27//1 23//1 19//1 15//1 11//1 5//1 2//1 1//1 3//1 6//1 12//1 16//1 20//1 24//1 28//1 34//1 38//1 42//1 46//1 50//1 54//1 60//1 63//1 64//1 62//1 59//1 53//1 49//1 45//1 41//1 37//1 31//1 32//1 35//1 39//1 43//1 47//1 51//1 55//1 57//1 61//1 58//1 56//1 52//1 48//1 44//1 40//1 36//1 33//1 30//1 26//1 22//1 18//1 14//1 10//1 8//1 4//1 7//1 9//1 13//1 17//1 21//1 25//1 29//1 32//1 31//1 diff --git a/test/regression/db.zip b/test/regression/db.zip index d1a4edf76..ee68fc8cd 100644 Binary files a/test/regression/db.zip and b/test/regression/db.zip differ diff --git a/test/unit/utColladaExportCamera.cpp b/test/unit/utColladaExportCamera.cpp new file mode 100644 index 000000000..c647684b6 --- /dev/null +++ b/test/unit/utColladaExportCamera.cpp @@ -0,0 +1,80 @@ +/* + * ColladaCameraExporter.cpp + * + * Created on: May 17, 2015 + * Author: wise + */ + + +#include "UnitTestPCH.h" + +#include +#include +#include +#include + +#ifndef ASSIMP_BUILD_NO_EXPORT + +class ColladaExportCamera : public ::testing::Test { +public: + + virtual void SetUp() + { + ex = new Assimp::Exporter(); + im = new Assimp::Importer(); + + } + + virtual void TearDown() + { + delete ex; + delete im; + } + +protected: + + + Assimp::Exporter* ex; + Assimp::Importer* im; +}; + +// ------------------------------------------------------------------------------------------------ +TEST_F(ColladaExportCamera, testExportCamera) +{ + const char* file = "cameraExp.dae"; + + const aiScene* pTest = im->ReadFile("../test/models/Collada/cameras.dae",0); + ASSERT_TRUE(pTest!=NULL); + ASSERT_TRUE(pTest->HasCameras()); + + + EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file)); + + const aiScene* imported = im->ReadFile(file,0); + + ASSERT_TRUE(imported!=NULL); + + EXPECT_TRUE(imported->HasCameras()); + EXPECT_EQ(pTest->mNumCameras,imported->mNumCameras); + + for(size_t i=0; i< pTest->mNumCameras;i++){ + + const aiCamera *orig = pTest->mCameras[i]; + const aiCamera *read = imported->mCameras[i]; + + EXPECT_TRUE(orig->mName==read->mName); + EXPECT_FLOAT_EQ(orig->mHorizontalFOV,read->mHorizontalFOV); + EXPECT_FLOAT_EQ(orig->mClipPlaneNear,read->mClipPlaneNear); + EXPECT_FLOAT_EQ(orig->mClipPlaneFar,read->mClipPlaneFar); + + EXPECT_FLOAT_EQ(orig->mPosition.x,read->mPosition.x); + EXPECT_FLOAT_EQ(orig->mPosition.y,read->mPosition.y); + EXPECT_FLOAT_EQ(orig->mPosition.z,read->mPosition.z); + } + +} + + +#endif + + diff --git a/test/unit/utColladaExportLight.cpp b/test/unit/utColladaExportLight.cpp new file mode 100644 index 000000000..510be7ee2 --- /dev/null +++ b/test/unit/utColladaExportLight.cpp @@ -0,0 +1,92 @@ +/* + * ColladaCameraExporter.cpp + * + * Created on: May 17, 2015 + * Author: wise + */ + + +#include "UnitTestPCH.h" + +#include +#include +#include +#include + +#ifndef ASSIMP_BUILD_NO_EXPORT + +class ColladaExportLight : public ::testing::Test { +public: + + virtual void SetUp() + { + ex = new Assimp::Exporter(); + im = new Assimp::Importer(); + + } + + virtual void TearDown() + { + delete ex; + delete im; + } + +protected: + + + Assimp::Exporter* ex; + Assimp::Importer* im; +}; + +// ------------------------------------------------------------------------------------------------ +TEST_F(ColladaExportLight, testExportLight) +{ + const char* file = "cameraExp.dae"; + + const aiScene* pTest = im->ReadFile("../test/models/Collada/lights.dae",0); + ASSERT_TRUE(pTest!=NULL); + ASSERT_TRUE(pTest->HasLights()); + + + EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file)); + EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada","/home/wise/lightsExp.dae")); + + const aiScene* imported = im->ReadFile(file,0); + + ASSERT_TRUE(imported!=NULL); + + EXPECT_TRUE(imported->HasLights()); + EXPECT_EQ(pTest->mNumLights,imported->mNumLights); + + for(size_t i=0; i< pTest->mNumLights;i++){ + + const aiLight *orig = pTest->mLights[i]; + const aiLight *read = imported->mLights[i]; + + EXPECT_TRUE(orig->mName==read->mName); + EXPECT_EQ(orig->mType,read->mType); + EXPECT_FLOAT_EQ(orig->mAttenuationConstant,read->mAttenuationConstant); + EXPECT_FLOAT_EQ(orig->mAttenuationLinear,read->mAttenuationLinear); + EXPECT_FLOAT_EQ(orig->mAttenuationQuadratic,read->mAttenuationQuadratic); + + EXPECT_FLOAT_EQ(orig->mColorAmbient.r,read->mColorAmbient.r); + EXPECT_FLOAT_EQ(orig->mColorAmbient.g,read->mColorAmbient.g); + EXPECT_FLOAT_EQ(orig->mColorAmbient.b,read->mColorAmbient.b); + + EXPECT_FLOAT_EQ(orig->mColorDiffuse.r,read->mColorDiffuse.r); + EXPECT_FLOAT_EQ(orig->mColorDiffuse.g,read->mColorDiffuse.g); + EXPECT_FLOAT_EQ(orig->mColorDiffuse.b,read->mColorDiffuse.b); + + EXPECT_FLOAT_EQ(orig->mColorSpecular.r,read->mColorSpecular.r); + EXPECT_FLOAT_EQ(orig->mColorSpecular.g,read->mColorSpecular.g); + EXPECT_FLOAT_EQ(orig->mColorSpecular.b,read->mColorSpecular.b); + + EXPECT_NEAR(orig->mAngleInnerCone,read->mAngleInnerCone,0.001); + EXPECT_NEAR(orig->mAngleOuterCone,read->mAngleOuterCone,0.001); + } +} + + +#endif + + diff --git a/test/unit/utImporter.cpp b/test/unit/utImporter.cpp index c7094229a..164c51bff 100644 --- a/test/unit/utImporter.cpp +++ b/test/unit/utImporter.cpp @@ -1,7 +1,7 @@ #include "UnitTestPCH.h" - + #include "../../include/assimp/postprocess.h" -#include "../../include/assimp/scene.h" +#include "../../include/assimp/scene.h" #include #include @@ -219,13 +219,13 @@ TEST_F(ImporterTest, testMultipleReads) aiProcess_OptimizeMeshes | aiProcess_OptimizeGraph; - EXPECT_TRUE(pImp->ReadFile("../../test/models/X/test.x",flags)); + EXPECT_TRUE(pImp->ReadFile("../test/models/X/test.x",flags)); //EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd - EXPECT_TRUE(pImp->ReadFile("../../test/models/X/Testwuson.X",flags)); - EXPECT_TRUE(pImp->ReadFile("../../test/models/X/anim_test.x",flags)); + EXPECT_TRUE(pImp->ReadFile("../test/models/X/Testwuson.X",flags)); + EXPECT_TRUE(pImp->ReadFile("../test/models/X/anim_test.x",flags)); //EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd - EXPECT_TRUE(pImp->ReadFile("../../test/models/X/anim_test.x",flags)); - EXPECT_TRUE(pImp->ReadFile("../../test/models/X/BCN_Epileptic.X",flags)); + EXPECT_TRUE(pImp->ReadFile("../test/models/X/anim_test.x",flags)); + EXPECT_TRUE(pImp->ReadFile("../test/models/X/BCN_Epileptic.X",flags)); //EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd }