From 8991496cf5c671c4aec5ca5744b2bee69d549072 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Fri, 12 Sep 2008 20:25:11 +0000 Subject: [PATCH] Fixes for build with mingw (no warnings in 32 Bit build, even with -wall). SMD bugfix. Makefile is up to date now. Added pack-attribute for aiVector3D and aiVector2D. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@132 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/3DSHelper.h | 12 +-- code/3DSLoader.cpp | 6 +- code/ASELoader.cpp | 5 +- code/ASEParser.cpp | 3 +- code/ASEParser.h | 6 +- code/BaseProcess.h | 2 +- code/CalcTangentsProcess.h | 2 +- code/ConvertToLHProcess.h | 2 +- code/DXFLoader.h | 2 +- code/DefaultIOStream.h | 1 + code/FileLogStream.h | 6 +- code/FixNormalsStep.cpp | 2 +- code/FixNormalsStep.h | 2 +- code/GenFaceNormalsProcess.cpp | 2 +- code/GenFaceNormalsProcess.h | 2 +- code/GenVertexNormalsProcess.cpp | 2 +- code/GenVertexNormalsProcess.h | 1 + code/GenericProperty.h | 6 +- code/HMPFileData.h | 21 ++-- code/HMPLoader.cpp | 1 - code/HMPLoader.h | 1 + code/HalfLifeFileData.h | 14 +-- code/Hash.h | 2 +- code/IFF.h | 2 +- code/ImproveCacheLocality.cpp | 4 +- code/ImproveCacheLocality.h | 2 +- code/JoinVerticesProcess.cpp | 4 +- code/JoinVerticesProcess.h | 2 +- code/KillNormalsProcess.cpp | 2 +- code/LWOBLoader.cpp | 3 +- code/LWOFileData.h | 8 +- code/LWOLoader.cpp | 8 +- code/LWOLoader.h | 2 +- code/LWOMaterial.cpp | 10 +- code/MD2FileData.h | 12 ++- code/MD2Loader.cpp | 2 +- code/MD2Loader.h | 2 +- code/MD3FileData.h | 12 ++- code/MD3Loader.h | 2 +- code/MD5Loader.cpp | 10 +- code/MD5Loader.h | 2 +- code/MD5Parser.cpp | 10 +- code/MD5Parser.h | 2 +- code/MDCFileData.h | 14 ++- code/MDCLoader.h | 1 + code/MDCNormalTable.h | 2 +- code/MDLFileData.h | 54 +++++----- code/MDLLoader.cpp | 12 +-- code/MDRFileData.h | 26 ++--- code/NFFLoader.cpp | 24 ++--- code/NFFLoader.h | 2 +- code/ObjFileMtlImporter.cpp | 4 +- code/ObjFileParser.cpp | 4 +- code/OptimizeGraphProcess.cpp | 11 +- code/ParsingUtils.h | 2 +- code/PlyLoader.cpp | 3 +- code/PlyLoader.h | 2 +- code/PlyParser.cpp | 82 ++++---------- code/PlyParser.h | 4 +- code/PretransformVertices.h | 2 +- code/RemoveComments.cpp | 3 +- code/SGSpatialSort.cpp | 1 + code/SMDLoader.cpp | 56 +++++----- code/STLLoader.cpp | 12 +-- code/STLLoader.h | 2 +- code/SmoothingGroups.inl | 4 +- code/SpatialSort.cpp | 1 + code/SplitLargeMeshes.cpp | 9 +- code/SplitLargeMeshes.h | 2 +- code/StandardShapes.cpp | Bin 20776 -> 10618 bytes code/StandardShapes.h | 52 ++++++++- code/TextureTransform.cpp | 4 +- code/TriangulateProcess.h | 2 +- code/ValidateDataStructure.cpp | 9 +- code/ValidateDataStructure.h | 2 +- code/VertexTriangleAdjacency.cpp | 2 +- code/VertexTriangleAdjacency.h | 2 +- code/XFileHelper.h | 2 +- code/XFileImporter.cpp | 39 +++---- code/XFileImporter.h | 2 +- code/XFileParser.cpp | 8 +- code/XFileParser.h | 2 +- code/aiAssert.cpp | 2 +- code/extra/MakeVerboseFormat.cpp | 2 +- code/makefile | 143 ++++++++++++------------- {code => include}/Compiler/poppack1.h | 2 +- {code => include}/Compiler/pushpack1.h | 0 include/aiTypes.h | 10 +- include/aiVector3D.h | 6 +- include/assimp.h | 2 +- 90 files changed, 421 insertions(+), 415 deletions(-) rename {code => include}/Compiler/poppack1.h (90%) rename {code => include}/Compiler/pushpack1.h (100%) diff --git a/code/3DSHelper.h b/code/3DSHelper.h index 3bdf0ded7..29d25f0d9 100644 --- a/code/3DSHelper.h +++ b/code/3DSHelper.h @@ -60,7 +60,7 @@ http://www.jalix.org/ressources/graphics/3DS/_unofficials/3ds-unofficial.txt */ namespace Assimp { namespace Dot3DS { -#include "./Compiler/pushpack1.h" +#include "./../include/Compiler/pushpack1.h" // --------------------------------------------------------------------------- /** Dot3DSFile class: Helper class for loading 3ds files. Defines chunks @@ -75,8 +75,8 @@ public: //! data structure for a single chunk in a .3ds file struct Chunk { - unsigned short Flag; - long Size; + uint16_t Flag; + uint32_t Size; } PACK_STRUCT; //! source for this used own structures, @@ -305,7 +305,7 @@ public: }; }; -#include "./Compiler/poppack1.h" +#include "./../include/Compiler/poppack1.h" // --------------------------------------------------------------------------- /** Helper structure representing a 3ds mesh face */ @@ -360,12 +360,12 @@ struct Material Material() : mSpecularExponent (0.0f), + mShininessStrength (1.0f), mShading(Dot3DSFile::Gouraud), mTransparency (1.0f), mBumpHeight (1.0f), - iBakeUVTransform (0), - mShininessStrength (1.0f), mTwoSided (false), + iBakeUVTransform (0), pcSingleTexture (NULL) { static int iCnt = 0; diff --git a/code/3DSLoader.cpp b/code/3DSLoader.cpp index 36caa4550..11405406c 100644 --- a/code/3DSLoader.cpp +++ b/code/3DSLoader.cpp @@ -490,7 +490,7 @@ void Dot3DSImporter::ParseHierarchyChunk(int& piRemaining) // pivot = origin of rotation and scaling this->mCurrentNode->vPivot = *((const aiVector3D*)this->mCurrent); - std::swap(this->mCurrentNode->vPivot.y,this->mCurrentNode->vPivot.z); + std::swap((float&)mCurrentNode->vPivot.y,(float&)mCurrentNode->vPivot.z); this->mCurrent += sizeof(aiVector3D); break; @@ -734,8 +734,6 @@ void Dot3DSImporter::ParseMeshChunk(int& piRemaining) Dot3DS::Mesh& mMesh = this->mScene->mMeshes.back(); // get chunk type - const unsigned char* sz = this->mCurrent; - unsigned int iCnt = 0; int iRemaining; uint16_t iNum = 0; float* pf; @@ -749,7 +747,7 @@ void Dot3DSImporter::ParseMeshChunk(int& piRemaining) { mMesh.mPositions.push_back(*((aiVector3D*)this->mCurrent)); aiVector3D& v = mMesh.mPositions.back(); - std::swap( v.y, v.z); + std::swap( (float&)v.y, (float&)v.z); //v.y *= -1.0f; this->mCurrent += sizeof(aiVector3D); } diff --git a/code/ASELoader.cpp b/code/ASELoader.cpp index c608b5030..55e16079c 100644 --- a/code/ASELoader.cpp +++ b/code/ASELoader.cpp @@ -525,7 +525,7 @@ void ASEImporter::BuildUniqueRepresentation(ASE::Mesh& mesh) for (unsigned int n = 0; n < 3;++n,++iCurrent) { mPositions[iCurrent] = mesh.mPositions[(*i).mIndices[n]]; - std::swap(mPositions[iCurrent].z,mPositions[iCurrent].y); // DX-to-OGL + std::swap((float&)mPositions[iCurrent].z,(float&)mPositions[iCurrent].y); // DX-to-OGL // add texture coordinates for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c) @@ -545,7 +545,7 @@ void ASEImporter::BuildUniqueRepresentation(ASE::Mesh& mesh) if (!mesh.mNormals.empty()) { mNormals[iCurrent] = mesh.mNormals[(*i).mIndices[n]]; - std::swap(mNormals[iCurrent].z,mNormals[iCurrent].y); // DX-to-OGL + std::swap((float&)mNormals[iCurrent].z,(float&)mNormals[iCurrent].y); // DX-to-OGL } // handle bone vertices @@ -743,7 +743,6 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector& avOutMesh vSubMaterials.size()]; // build a list of all faces per submaterial - unsigned int iNum = 0; for (unsigned int i = 0; i < mesh.mFaces.size();++i) { // check range diff --git a/code/ASEParser.cpp b/code/ASEParser.cpp index dba8cbc1b..46508a3d4 100644 --- a/code/ASEParser.cpp +++ b/code/ASEParser.cpp @@ -633,7 +633,6 @@ void Parser::ParseLV2MaterialBlock(ASE::Material& mat) void Parser::ParseLV3MapBlock(Texture& map) { int iDepth = 0; - unsigned int iNumSubMaterials = 0; while (true) { if ('*' == *this->m_szFile) @@ -1740,4 +1739,4 @@ void Parser::ParseLV4MeshLong(unsigned int& iOut) } // parse the value iOut = strtol10(this->m_szFile,&this->m_szFile); -} \ No newline at end of file +} diff --git a/code/ASEParser.h b/code/ASEParser.h index 4d326aaa0..dc73d35b6 100644 --- a/code/ASEParser.h +++ b/code/ASEParser.h @@ -194,9 +194,9 @@ struct InheritanceInfo struct DecompTransform { //! Construction from a reference to an existing matrix - DecompTransform(aiMatrix4x4& ref) - : vScaling(1.0f,1.0f,1.0f) - , vPosition(std::numeric_limits::quiet_NaN(),0.0f,0.0f) + DecompTransform(aiMatrix4x4& ref) + : vPosition(std::numeric_limits::quiet_NaN(),0.0f,0.0f) + , vScaling(1.0f,1.0f,1.0f) , mMatrix(ref) {} diff --git a/code/BaseProcess.h b/code/BaseProcess.h index 61995a401..78a6177b1 100644 --- a/code/BaseProcess.h +++ b/code/BaseProcess.h @@ -112,4 +112,4 @@ public: } // end of namespace Assimp -#endif // AI_BASEPROCESS_H_INC \ No newline at end of file +#endif // AI_BASEPROCESS_H_INC diff --git a/code/CalcTangentsProcess.h b/code/CalcTangentsProcess.h index 4f0dc8c9d..5802f7a23 100644 --- a/code/CalcTangentsProcess.h +++ b/code/CalcTangentsProcess.h @@ -114,4 +114,4 @@ private: } // end of namespace Assimp -#endif // AI_CALCTANGENTSPROCESS_H_INC \ No newline at end of file +#endif // AI_CALCTANGENTSPROCESS_H_INC diff --git a/code/ConvertToLHProcess.h b/code/ConvertToLHProcess.h index 49390fe83..dd6846bf3 100644 --- a/code/ConvertToLHProcess.h +++ b/code/ConvertToLHProcess.h @@ -129,4 +129,4 @@ public: } // end of namespace Assimp -#endif // AI_CONVERTTOLHPROCESS_H_INC \ No newline at end of file +#endif // AI_CONVERTTOLHPROCESS_H_INC diff --git a/code/DXFLoader.h b/code/DXFLoader.h index a55aa0a83..8cb45d320 100644 --- a/code/DXFLoader.h +++ b/code/DXFLoader.h @@ -144,4 +144,4 @@ private: } // end of namespace Assimp -#endif // AI_3DSIMPORTER_H_INC \ No newline at end of file +#endif // AI_3DSIMPORTER_H_INC diff --git a/code/DefaultIOStream.h b/code/DefaultIOStream.h index 1ef9cdcc0..a48138549 100644 --- a/code/DefaultIOStream.h +++ b/code/DefaultIOStream.h @@ -120,3 +120,4 @@ inline DefaultIOStream::DefaultIOStream (FILE* pFile, } // ns assimp #endif //!!AI_DEFAULTIOSTREAM_H_INC + diff --git a/code/FileLogStream.h b/code/FileLogStream.h index 8c5f1fd49..fba5fb5f0 100644 --- a/code/FileLogStream.h +++ b/code/FileLogStream.h @@ -52,10 +52,10 @@ inline void FileLogStream::write( const std::string &message ) { if (m_pStream != NULL) { - size_t size = m_pStream->Write(message.c_str(), sizeof(char), + m_pStream->Write(message.c_str(), sizeof(char), message.size()); - int i=0; - i++; + /*int i=0; + i++;*/ } } diff --git a/code/FixNormalsStep.cpp b/code/FixNormalsStep.cpp index 304b7da0a..34dbc3884 100644 --- a/code/FixNormalsStep.cpp +++ b/code/FixNormalsStep.cpp @@ -177,4 +177,4 @@ bool FixInfacingNormalsProcess::ProcessMesh( aiMesh* pcMesh, unsigned int index) return true; } return false; -} \ No newline at end of file +} diff --git a/code/FixNormalsStep.h b/code/FixNormalsStep.h index 8c08d7af8..98c1999d4 100644 --- a/code/FixNormalsStep.h +++ b/code/FixNormalsStep.h @@ -93,4 +93,4 @@ protected: } // end of namespace Assimp -#endif // AI_FIXNORMALSPROCESS_H_INC \ No newline at end of file +#endif // AI_FIXNORMALSPROCESS_H_INC diff --git a/code/GenFaceNormalsProcess.cpp b/code/GenFaceNormalsProcess.cpp index f7a7a7c84..b8d8b0c0e 100644 --- a/code/GenFaceNormalsProcess.cpp +++ b/code/GenFaceNormalsProcess.cpp @@ -122,4 +122,4 @@ bool GenFaceNormalsProcess::GenMeshFaceNormals (aiMesh* pMesh) } } return true; -} \ No newline at end of file +} diff --git a/code/GenFaceNormalsProcess.h b/code/GenFaceNormalsProcess.h index 2a5abdb6b..603c74ccb 100644 --- a/code/GenFaceNormalsProcess.h +++ b/code/GenFaceNormalsProcess.h @@ -85,4 +85,4 @@ private: } // end of namespace Assimp -#endif // !!AI_GENFACENORMALPROCESS_H_INC \ No newline at end of file +#endif // !!AI_GENFACENORMALPROCESS_H_INC diff --git a/code/GenVertexNormalsProcess.cpp b/code/GenVertexNormalsProcess.cpp index 69ad7d3a6..9a1648af9 100644 --- a/code/GenVertexNormalsProcess.cpp +++ b/code/GenVertexNormalsProcess.cpp @@ -176,4 +176,4 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals (aiMesh* pMesh) pMesh->mNormals = pcNew; return true; -} \ No newline at end of file +} diff --git a/code/GenVertexNormalsProcess.h b/code/GenVertexNormalsProcess.h index a627cf157..938baea60 100644 --- a/code/GenVertexNormalsProcess.h +++ b/code/GenVertexNormalsProcess.h @@ -114,3 +114,4 @@ private: } // end of namespace Assimp #endif // !!AI_GENVERTEXNORMALPROCESS_H_INC + diff --git a/code/GenericProperty.h b/code/GenericProperty.h index b7712a21f..f7052fe88 100644 --- a/code/GenericProperty.h +++ b/code/GenericProperty.h @@ -56,7 +56,7 @@ inline void SetGenericProperty(std::map< uint32_t, T >& list, uint32_t hash = SuperFastHash(szName); - GenericPropertyMap::iterator it = list.find(hash); + typename GenericPropertyMap::iterator it = list.find(hash); if (it == list.end()) { if (bWasExisting)*bWasExisting = false; @@ -80,9 +80,9 @@ inline T GetGenericProperty(const std::map< uint32_t, T >& list, uint32_t hash = SuperFastHash(szName); - GenericPropertyMap::const_iterator it = list.find(hash); + typename GenericPropertyMap::const_iterator it = list.find(hash); if (it == list.end())return errorReturn; return (*it).second; } -#endif // !! AI_GENERIC_PROPERTY_H_INCLUDED \ No newline at end of file +#endif // !! AI_GENERIC_PROPERTY_H_INCLUDED diff --git a/code/HMPFileData.h b/code/HMPFileData.h index a61c3b407..b236bc376 100644 --- a/code/HMPFileData.h +++ b/code/HMPFileData.h @@ -44,16 +44,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { namespace HMP { -#include "./Compiler/pushpack1.h" +#include "./../include/Compiler/pushpack1.h" -#define AI_HMP_MAGIC_NUMBER_BE_4 'HMP4' -#define AI_HMP_MAGIC_NUMBER_LE_4 '4PMH' +// to make it easier for ourselfes, we test the magic word against both "endianesses" +#define HMP_MAKE(string) ((uint32_t)((string[0] << 24) + (string[1] << 16) + (string[2] << 8) + string[3])) -#define AI_HMP_MAGIC_NUMBER_BE_5 'HMP5' -#define AI_HMP_MAGIC_NUMBER_LE_5 '5PMH' +#define AI_HMP_MAGIC_NUMBER_BE_4 HMP_MAKE("HMP4") +#define AI_HMP_MAGIC_NUMBER_LE_4 HMP_MAKE("4PMH") -#define AI_HMP_MAGIC_NUMBER_BE_7 'HMP7' -#define AI_HMP_MAGIC_NUMBER_LE_7 '7PMH' +#define AI_HMP_MAGIC_NUMBER_BE_5 HMP_MAKE("HMP5") +#define AI_HMP_MAGIC_NUMBER_LE_5 HMP_MAKE("5PMH") + +#define AI_HMP_MAGIC_NUMBER_BE_7 HMP_MAKE("HMP7") +#define AI_HMP_MAGIC_NUMBER_LE_7 HMP_MAKE("7PMH") // --------------------------------------------------------------------------- /** Data structure for the header of a HMP5 file. @@ -127,7 +130,7 @@ struct Vertex_HMP7 int8_t normal_x,normal_y; } PACK_STRUCT; -#include "./Compiler/poppack1.h" +#include "./../include/Compiler/poppack1.h" } //! namespace HMP -} //! namespace Assimp \ No newline at end of file +} //! namespace Assimp diff --git a/code/HMPLoader.cpp b/code/HMPLoader.cpp index 12905db31..01aa1c6c6 100644 --- a/code/HMPLoader.cpp +++ b/code/HMPLoader.cpp @@ -50,7 +50,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../include/DefaultLogger.h" #include "../include/IOStream.h" #include "../include/IOSystem.h" -#include "../include/aiMesh.h" #include "../include/aiScene.h" #include "../include/aiAssert.h" diff --git a/code/HMPLoader.h b/code/HMPLoader.h index 203784c82..441d113c2 100644 --- a/code/HMPLoader.h +++ b/code/HMPLoader.h @@ -157,3 +157,4 @@ private: } // end of namespace Assimp #endif // AI_HMPIMPORTER_H_INC + diff --git a/code/HalfLifeFileData.h b/code/HalfLifeFileData.h index 00e1c248e..28c1ed983 100644 --- a/code/HalfLifeFileData.h +++ b/code/HalfLifeFileData.h @@ -49,16 +49,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AI_MDLFILEHELPER2_H_INC #define AI_MDLFILEHELPER2_H_INC -#include "./Compiler/pushpack1.h" +#include "./../include/Compiler/pushpack1.h" + +#include "MDLFileData.h" namespace Assimp { namespace MDL { // magic bytes used in Half Life 2 MDL models -#define AI_MDL_MAGIC_NUMBER_BE_HL2a 'IDST' -#define AI_MDL_MAGIC_NUMBER_LE_HL2a 'TSDI' -#define AI_MDL_MAGIC_NUMBER_BE_HL2b 'IDSQ' -#define AI_MDL_MAGIC_NUMBER_LE_HL2b 'QSDI' +#define AI_MDL_MAGIC_NUMBER_BE_HL2a MDL_MAKE("IDST") +#define AI_MDL_MAGIC_NUMBER_LE_HL2a MDL_MAKE("TSDI") +#define AI_MDL_MAGIC_NUMBER_BE_HL2b MDL_MAKE("IDSQ") +#define AI_MDL_MAGIC_NUMBER_LE_HL2b MDL_MAKE("QSDI") // --------------------------------------------------------------------------- /** \struct Header_HL2 @@ -140,7 +142,7 @@ struct Header_HL2 int32_t transitionindex; } PACK_STRUCT; -#include "./Compiler/poppack1.h" +#include "./../include/Compiler/poppack1.h" } } // end namespaces diff --git a/code/Hash.h b/code/Hash.h index e6f8eab1d..56949966f 100644 --- a/code/Hash.h +++ b/code/Hash.h @@ -104,4 +104,4 @@ int rem; return hash; } -#endif // !! AI_HASH_H_INCLUDED \ No newline at end of file +#endif // !! AI_HASH_H_INCLUDED diff --git a/code/IFF.h b/code/IFF.h index fc3e4002b..69b9fa407 100644 --- a/code/IFF.h +++ b/code/IFF.h @@ -54,4 +54,4 @@ inline const char* ReadHeader(const uint8_t* outFile,uint32_t& fileType) }} -#endif // !! AI_IFF_H_INCLUDED \ No newline at end of file +#endif // !! AI_IFF_H_INCLUDED diff --git a/code/ImproveCacheLocality.cpp b/code/ImproveCacheLocality.cpp index 68733b950..bce299236 100644 --- a/code/ImproveCacheLocality.cpp +++ b/code/ImproveCacheLocality.cpp @@ -271,7 +271,7 @@ void ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshN const unsigned int dp = *p; // the current vertex won't have any free triangles after this step - if (ivdx != dp) + if (ivdx != (int)dp) { // append the vertex to the dead-end stack sDeadEndVStack.push(dp); @@ -381,4 +381,4 @@ void ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshN delete[] piIBOutput; delete[] piCandidates; delete[] piNumTriPtrNoModify; -} \ No newline at end of file +} diff --git a/code/ImproveCacheLocality.h b/code/ImproveCacheLocality.h index 772dc654e..6d884e527 100644 --- a/code/ImproveCacheLocality.h +++ b/code/ImproveCacheLocality.h @@ -101,4 +101,4 @@ protected: } // end of namespace Assimp -#endif // AI_IMPROVECACHELOCALITY_H_INC \ No newline at end of file +#endif // AI_IMPROVECACHELOCALITY_H_INC diff --git a/code/JoinVerticesProcess.cpp b/code/JoinVerticesProcess.cpp index 0c8c881c8..dec52413a 100644 --- a/code/JoinVerticesProcess.cpp +++ b/code/JoinVerticesProcess.cpp @@ -134,7 +134,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) std::vector uniqueVertices; uniqueVertices.reserve( pMesh->mNumVertices); - unsigned int iOldVerts = pMesh->mNumVertices; + //unsigned int iOldVerts = pMesh->mNumVertices; // For each vertex the index of the vertex it was replaced by. std::vector replaceIndex( pMesh->mNumVertices, 0xffffffff); @@ -314,7 +314,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) for( unsigned int b = 0; b < face.mNumIndices; b++) { const size_t index = face.mIndices[b]; - face.mIndices[b] = replaceIndex[face.mIndices[b]]; + face.mIndices[b] = replaceIndex[index]; } } diff --git a/code/JoinVerticesProcess.h b/code/JoinVerticesProcess.h index 7cf3e76cb..2b495c4d5 100644 --- a/code/JoinVerticesProcess.h +++ b/code/JoinVerticesProcess.h @@ -113,4 +113,4 @@ protected: } // end of namespace Assimp -#endif // AI_CALCTANGENTSPROCESS_H_INC \ No newline at end of file +#endif // AI_CALCTANGENTSPROCESS_H_INC diff --git a/code/KillNormalsProcess.cpp b/code/KillNormalsProcess.cpp index 5da70cc68..e5df21939 100644 --- a/code/KillNormalsProcess.cpp +++ b/code/KillNormalsProcess.cpp @@ -91,4 +91,4 @@ bool KillNormalsProcess::KillMeshNormals(aiMesh* pMesh) delete[] pMesh->mNormals; pMesh->mNormals = NULL; return true; -} \ No newline at end of file +} diff --git a/code/LWOBLoader.cpp b/code/LWOBLoader.cpp index eca5c0988..adf6c2ff2 100644 --- a/code/LWOBLoader.cpp +++ b/code/LWOBLoader.cpp @@ -175,7 +175,6 @@ void LWOImporter::LoadLWOBSurface(unsigned int size) { LE_NCONST uint8_t* const end = mFileBuffer + size; - uint32_t iCursor = 0; mSurfaces->push_back( LWO::Surface () ); LWO::Surface& surf = mSurfaces->back(); LWO::Texture* pTex = NULL; @@ -305,4 +304,4 @@ void LWOImporter::LoadLWOBSurface(unsigned int size) } mFileBuffer = next; } -} \ No newline at end of file +} diff --git a/code/LWOFileData.h b/code/LWOFileData.h index fba4b10fc..82b21aaf7 100644 --- a/code/LWOFileData.h +++ b/code/LWOFileData.h @@ -331,9 +331,9 @@ struct WeightChannel : public VMapEntry struct Texture { Texture() - : mStrength (1.0f) + : mClipIdx(0xffffffff) + , mStrength (1.0f) , mUVChannelIndex ("unknown") - , mClipIdx(0xffffffff) {} //! File name of the texture @@ -425,9 +425,9 @@ typedef std::vector < Clip > ClipList; struct Layer { Layer() - : mParent (0xffff) - , mFaceIDXOfs(0) + : mFaceIDXOfs(0) , mPointIDXOfs(0) + , mParent (0xffff) {} /** Temporary point list from the file */ diff --git a/code/LWOLoader.cpp b/code/LWOLoader.cpp index a490fe60f..5f96966c3 100644 --- a/code/LWOLoader.cpp +++ b/code/LWOLoader.cpp @@ -321,7 +321,7 @@ void LWOImporter::InternReadFile( const std::string& pFile, pf->mIndices = face.mIndices; pf->mNumIndices = face.mNumIndices; - const_cast(face.mIndices) = NULL; // make sure it won't be deleted + unsigned int** p = (unsigned int**)&face.mIndices;*p = NULL; // make sure it won't be deleted pf++; } ++p; @@ -365,7 +365,7 @@ void LWOImporter::GenerateNodeGraph(std::vector& apcNodes) for (unsigned int i = 0; i < apcNodes.size();++i) { if (i == iCurParent)continue; - if ( reinterpret_cast(apcNodes[i]->mParent) == iCurParent)++numChilds; + if ( (uint16_t)(uintptr_t)apcNodes[i]->mParent == iCurParent)++numChilds; } if (numChilds) { @@ -377,7 +377,7 @@ void LWOImporter::GenerateNodeGraph(std::vector& apcNodes) for (unsigned int i = 0, p = 0; i < apcNodes.size();++i) { if (i == iCurParent)continue; - uint16_t parent = reinterpret_cast(apcNodes[i]->mParent); + uint16_t parent = (uint16_t)(uintptr_t)(apcNodes[i]->mParent); if (parent == iCurParent) { node->mChildren[p++] = apcNodes[i]; @@ -816,4 +816,4 @@ void LWOImporter::LoadLWO2File() } mFileBuffer = next; } -} \ No newline at end of file +} diff --git a/code/LWOLoader.h b/code/LWOLoader.h index e1f6ed449..e2a35f449 100644 --- a/code/LWOLoader.h +++ b/code/LWOLoader.h @@ -298,4 +298,4 @@ protected: } // end of namespace Assimp -#endif // AI_LWOIMPORTER_H_INCLUDED \ No newline at end of file +#endif // AI_LWOIMPORTER_H_INCLUDED diff --git a/code/LWOMaterial.cpp b/code/LWOMaterial.cpp index a8fa4f453..9f5590951 100644 --- a/code/LWOMaterial.cpp +++ b/code/LWOMaterial.cpp @@ -129,7 +129,7 @@ void LWOImporter::FindVCChannels(const LWO::Surface& surf, const LWO::Layer& lay // ------------------------------------------------------------------------------------------------ void LWOImporter::LoadLWO2ImageMap(unsigned int size, LWO::Texture& tex ) { - LE_NCONST uint8_t* const end = mFileBuffer + size; + //LE_NCONST uint8_t* const end = mFileBuffer + size; } // ------------------------------------------------------------------------------------------------ @@ -147,16 +147,16 @@ void LWOImporter::LoadLWO2Gradient(unsigned int size, LWO::Texture& tex ) // ------------------------------------------------------------------------------------------------ void LWOImporter::LoadLWO2TextureHeader(unsigned int size, LWO::Texture& tex ) { - LE_NCONST uint8_t* const end = mFileBuffer + size; + //LE_NCONST uint8_t* const end = mFileBuffer + size; } // ------------------------------------------------------------------------------------------------ void LWOImporter::LoadLWO2TextureBlock(uint32_t type, unsigned int size ) { - LE_NCONST uint8_t* const end = mFileBuffer + size; + //LE_NCONST uint8_t* const end = mFileBuffer + size; - LWO::Surface& surf = mSurfaces->back(); - LWO::Texture tex; + //LWO::Surface& surf = mSurfaces->back(); + //LWO::Texture tex; // now get the exact type of the texture } diff --git a/code/MD2FileData.h b/code/MD2FileData.h index 5d7e94b0c..45981becb 100644 --- a/code/MD2FileData.h +++ b/code/MD2FileData.h @@ -57,13 +57,16 @@ File format specification: #include "../include/aiMesh.h" #include "../include/aiAnim.h" -#include "./Compiler/pushpack1.h" +#include "./../include/Compiler/pushpack1.h" namespace Assimp { namespace MD2 { -#define AI_MD2_MAGIC_NUMBER_BE 'IDP2' -#define AI_MD2_MAGIC_NUMBER_LE '2PDI' +// to make it easier for ourselfes, we test the magic word against both "endianesses" +#define MD2_MAKE(string) ((uint32_t)((string[0] << 24) + (string[1] << 16) + (string[2] << 8) + string[3])) + +#define AI_MD2_MAGIC_NUMBER_BE MD2_MAKE("IDP2") +#define AI_MD2_MAGIC_NUMBER_LE MD2_MAKE("2PDI") // common limitations #define AI_MD2_VERSION 15 @@ -153,7 +156,7 @@ struct Skin char name[AI_MD2_MAXQPATH]; /* texture file name */ } PACK_STRUCT; -#include "./Compiler/poppack1.h" +#include "./../include/Compiler/poppack1.h" // --------------------------------------------------------------------------- @@ -167,3 +170,4 @@ void LookupNormalIndex(uint8_t index,aiVector3D& vOut); } #endif // !! include guard + diff --git a/code/MD2Loader.cpp b/code/MD2Loader.cpp index 42bad2349..08763d31f 100644 --- a/code/MD2Loader.cpp +++ b/code/MD2Loader.cpp @@ -151,7 +151,7 @@ void MD2Importer::ValidateHeader( ) if (0 == this->m_pcHeader->numFrames) throw new ImportErrorException( "Invalid md2 file: NUM_FRAMES is 0"); - if (this->m_pcHeader->offsetEnd > (int32_t)fileSize) + if (this->m_pcHeader->offsetEnd > (uint32_t)fileSize) throw new ImportErrorException( "Invalid md2 file: File is too small"); if (this->m_pcHeader->offsetSkins + this->m_pcHeader->numSkins * sizeof (MD2::Skin) >= this->fileSize || diff --git a/code/MD2Loader.h b/code/MD2Loader.h index b0d3e858b..b0c38073e 100644 --- a/code/MD2Loader.h +++ b/code/MD2Loader.h @@ -124,4 +124,4 @@ protected: } // end of namespace Assimp -#endif // AI_3DSIMPORTER_H_INC \ No newline at end of file +#endif // AI_3DSIMPORTER_H_INC diff --git a/code/MD3FileData.h b/code/MD3FileData.h index 40f447d2c..0ea6529dd 100644 --- a/code/MD3FileData.h +++ b/code/MD3FileData.h @@ -52,13 +52,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../include/aiMesh.h" #include "../include/aiAnim.h" -#include "./Compiler/pushpack1.h" +#include "./../include/Compiler/pushpack1.h" namespace Assimp { namespace MD3 { -#define AI_MD3_MAGIC_NUMBER_BE 'IDP3' -#define AI_MD3_MAGIC_NUMBER_LE '3PDI' +// to make it easier for ourselfes, we test the magic word against both "endianesses" +#define MD3_MAKE(string) ((uint32_t)((string[0] << 24) + (string[1] << 16) + (string[2] << 8) + string[3])) + +#define AI_MD3_MAGIC_NUMBER_BE MD3_MAKE("IDP3") +#define AI_MD3_MAGIC_NUMBER_LE MD3_MAKE("3PDI") // common limitations #define AI_MD3_VERSION 15 @@ -230,7 +233,7 @@ struct Vertex uint16_t NORMAL; } PACK_STRUCT; -#include "./Compiler/poppack1.h" +#include "./../include/Compiler/poppack1.h" // --------------------------------------------------------------------------- /** \brief Unpack a Q3 16 bit vector to its full float3 representation @@ -298,3 +301,4 @@ inline void Vec3NormalToLatLng( const aiVector3D& p_vIn, uint16_t& p_iOut ) } #endif // !! AI_MD3FILEHELPER_H_INC + diff --git a/code/MD3Loader.h b/code/MD3Loader.h index 3939b87c3..59922dc7b 100644 --- a/code/MD3Loader.h +++ b/code/MD3Loader.h @@ -126,4 +126,4 @@ protected: } // end of namespace Assimp -#endif // AI_3DSIMPORTER_H_INC \ No newline at end of file +#endif // AI_3DSIMPORTER_H_INC diff --git a/code/MD5Loader.cpp b/code/MD5Loader.cpp index 53755d972..fa90b1501 100644 --- a/code/MD5Loader.cpp +++ b/code/MD5Loader.cpp @@ -195,7 +195,7 @@ void MakeDataUnique (MD5::MeshDesc& meshSrc) void AttachChilds(int iParentID,aiNode* piParent,BoneList& bones) { ai_assert(NULL != piParent && !piParent->mNumChildren); - for (unsigned int i = 0; i < bones.size();++i) + for (int i = 0; i < (int)bones.size();++i) { // (avoid infinite recursion) if (iParentID != i && bones[i].mParentIndex == iParentID) @@ -207,7 +207,7 @@ void AttachChilds(int iParentID,aiNode* piParent,BoneList& bones) if (piParent->mNumChildren) { piParent->mChildren = new aiNode*[piParent->mNumChildren]; - for (unsigned int i = 0; i < bones.size();++i) + for (int i = 0; i < (int)bones.size();++i) { // (avoid infinite recursion) if (iParentID != i && bones[i].mParentIndex == iParentID) @@ -372,7 +372,7 @@ void MD5Importer::LoadMD5MeshFile () meshParser.mJoints[q].mMap = h++; } - unsigned int g = 0; + //unsigned int g = 0; pv = mesh->mVertices; for (MD5::VertexList::const_iterator iter = meshSrc.mVertices.begin(); @@ -410,7 +410,7 @@ void MD5Importer::LoadMD5MeshFile () *bone->mWeights++ = aiVertexWeight((unsigned int)(pv-mesh->mVertices),fNewWeight); } // convert from DOOM coordinate system to OGL - std::swap(pv->z,pv->y); + std::swap((float&)pv->z,(float&)pv->y); } // undo our nice offset tricks ... @@ -567,4 +567,4 @@ void MD5Importer::LoadMD5AnimFile () // delete the file again this->UnloadFileFromMemory(); -} \ No newline at end of file +} diff --git a/code/MD5Loader.h b/code/MD5Loader.h index 695c703c1..76b026234 100644 --- a/code/MD5Loader.h +++ b/code/MD5Loader.h @@ -151,4 +151,4 @@ protected: } // end of namespace Assimp -#endif // AI_3DSIMPORTER_H_INC \ No newline at end of file +#endif // AI_3DSIMPORTER_H_INC diff --git a/code/MD5Parser.cpp b/code/MD5Parser.cpp index f9796a595..c5d157380 100644 --- a/code/MD5Parser.cpp +++ b/code/MD5Parser.cpp @@ -205,11 +205,11 @@ bool MD5Parser::ParseSection(Section& out) if ('(' != *sz++) \ MD5Parser::ReportWarning("Unexpected token: ( was expected",(*eit).iLineNumber); \ AI_MD5_SKIP_SPACES(); \ - sz = fast_atof_move(sz,vec.x); \ + sz = fast_atof_move(sz,(float&)vec.x); \ AI_MD5_SKIP_SPACES(); \ - sz = fast_atof_move(sz,vec.y); \ + sz = fast_atof_move(sz,(float&)vec.y); \ AI_MD5_SKIP_SPACES(); \ - sz = fast_atof_move(sz,vec.z); \ + sz = fast_atof_move(sz,(float&)vec.z); \ AI_MD5_SKIP_SPACES(); \ if (')' != *sz++) \ MD5Parser::ReportWarning("Unexpected token: ) was expected",(*eit).iLineNumber); @@ -354,9 +354,9 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections) if ('(' != *sz++) MD5Parser::ReportWarning("Unexpected token: ( was expected",(*eit).iLineNumber); AI_MD5_SKIP_SPACES(); - sz = fast_atof_move(sz,vert.mUV.x); + sz = fast_atof_move(sz,(float&)vert.mUV.x); AI_MD5_SKIP_SPACES(); - sz = fast_atof_move(sz,vert.mUV.y); + sz = fast_atof_move(sz,(float&)vert.mUV.y); AI_MD5_SKIP_SPACES(); if (')' != *sz++) MD5Parser::ReportWarning("Unexpected token: ) was expected",(*eit).iLineNumber); diff --git a/code/MD5Parser.h b/code/MD5Parser.h index a0e1dd8c0..dade131da 100644 --- a/code/MD5Parser.h +++ b/code/MD5Parser.h @@ -416,4 +416,4 @@ private: }; }} -#endif // AI_MD5PARSER_H_INCLUDED \ No newline at end of file +#endif // AI_MD5PARSER_H_INCLUDED diff --git a/code/MDCFileData.h b/code/MDCFileData.h index dfd1a8124..e2438f0d0 100644 --- a/code/MDCFileData.h +++ b/code/MDCFileData.h @@ -53,14 +53,18 @@ http://themdcfile.planetwolfenstein.gamespy.com/MDC_File_Format.pdf #include "../include/aiMesh.h" #include "../include/aiAnim.h" -#include "./Compiler/pushpack1.h" +#include "./../include/Compiler/pushpack1.h" namespace Assimp { namespace MDC { -#define AI_MDC_MAGIC_NUMBER_BE 'CPDI' -#define AI_MDC_MAGIC_NUMBER_LE 'IDPC' + +// to make it easier for ourselfes, we test the magic word against both "endianesses" +#define MDC_MAKE(string) ((uint32_t)((string[0] << 24) + (string[1] << 16) + (string[2] << 8) + string[3])) + +#define AI_MDC_MAGIC_NUMBER_BE MDC_MAKE("CPDI") +#define AI_MDC_MAGIC_NUMBER_LE MDC_MAKE("IDPC") // common limitations #define AI_MDC_VERSION 2 @@ -181,7 +185,7 @@ struct Shader } PACK_STRUCT; -#include "./Compiler/poppack1.h" +#include "./../include/Compiler/poppack1.h" // --------------------------------------------------------------------------- @@ -194,4 +198,4 @@ void BuildVertex(const Frame& frame, aiVector3D& vNorOut); }} -#endif // !! AI_MDCFILEHELPER_H_INC \ No newline at end of file +#endif // !! AI_MDCFILEHELPER_H_INC diff --git a/code/MDCLoader.h b/code/MDCLoader.h index e394c2abf..08d24b392 100644 --- a/code/MDCLoader.h +++ b/code/MDCLoader.h @@ -130,3 +130,4 @@ protected: } // end of namespace Assimp #endif // AI_3DSIMPORTER_H_INC + diff --git a/code/MDCNormalTable.h b/code/MDCNormalTable.h index 198fef3ac..fbe47db86 100644 --- a/code/MDCNormalTable.h +++ b/code/MDCNormalTable.h @@ -296,4 +296,4 @@ float mdcNormals[ 256 ][ 3 ] = { 0.000000f, -0.195090f, 0.980785f } }; -#endif // !! MDC_NORMAL_TABLE_INCLUDED \ No newline at end of file +#endif // !! MDC_NORMAL_TABLE_INCLUDED diff --git a/code/MDLFileData.h b/code/MDLFileData.h index be0eed673..a1c3ea937 100644 --- a/code/MDLFileData.h +++ b/code/MDLFileData.h @@ -58,36 +58,35 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../include/aiAnim.h" #include "../include/aiMaterial.h" -#include "./Compiler/pushpack1.h" +#include "./../include/Compiler/pushpack1.h" namespace Assimp { namespace MDL { +// to make it easier for ourselfes, we test the magic word against both "endianesses" +#define MDL_MAKE(string) ((uint32_t)((string[0] << 24) + (string[1] << 16) + (string[2] << 8) + string[3])) + // magic bytes used in Quake 1 MDL meshes -#define AI_MDL_MAGIC_NUMBER_BE 'IDPO' -#define AI_MDL_MAGIC_NUMBER_LE 'OPDI' +#define AI_MDL_MAGIC_NUMBER_BE MDL_MAKE("IDPO") +#define AI_MDL_MAGIC_NUMBER_LE MDL_MAKE("OPDI") // magic bytes used in GameStudio A MDL meshes -#define AI_MDL_MAGIC_NUMBER_BE_GS3 'MDL2' -#define AI_MDL_MAGIC_NUMBER_LE_GS3 '2LDM' +#define AI_MDL_MAGIC_NUMBER_BE_GS3 MDL_MAKE("MDL2") +#define AI_MDL_MAGIC_NUMBER_LE_GS3 MDL_MAKE("2LDM") // magic bytes used in GameStudio A4 MDL meshes -#define AI_MDL_MAGIC_NUMBER_BE_GS4 'MDL3' -#define AI_MDL_MAGIC_NUMBER_LE_GS4 '3LDM' +#define AI_MDL_MAGIC_NUMBER_BE_GS4 MDL_MAKE("MDL3") +#define AI_MDL_MAGIC_NUMBER_LE_GS4 MDL_MAKE("3LDM") // magic bytes used in GameStudio A5+ MDL meshes -#define AI_MDL_MAGIC_NUMBER_BE_GS5a 'MDL4' -#define AI_MDL_MAGIC_NUMBER_LE_GS5a '4LDM' -#define AI_MDL_MAGIC_NUMBER_BE_GS5b 'MDL5' -#define AI_MDL_MAGIC_NUMBER_LE_GS5b '5LDM' - -// magic bytes used in GameStudio A6+ MDL meshes -#define AI_MDL_MAGIC_NUMBER_BE_GS6 'MDL6' -#define AI_MDL_MAGIC_NUMBER_LE_GS6 '6LDM' +#define AI_MDL_MAGIC_NUMBER_BE_GS5a MDL_MAKE("MDL4") +#define AI_MDL_MAGIC_NUMBER_LE_GS5a MDL_MAKE("4LDM") +#define AI_MDL_MAGIC_NUMBER_BE_GS5b MDL_MAKE("MDL5") +#define AI_MDL_MAGIC_NUMBER_LE_GS5b MDL_MAKE("5LDM") // magic bytes used in GameStudio A7+ MDL meshes -#define AI_MDL_MAGIC_NUMBER_BE_GS7 'MDL7' -#define AI_MDL_MAGIC_NUMBER_LE_GS7 '7LDM' +#define AI_MDL_MAGIC_NUMBER_BE_GS7 MDL_MAKE("MDL7") +#define AI_MDL_MAGIC_NUMBER_LE_GS7 MDL_MAKE("7LDM") // common limitations for Quake1 meshes. The loader does not check them, @@ -121,7 +120,7 @@ namespace MDL { struct Header { //! magic number: "IDPO" - int32_t ident; + uint32_t ident; //! version number: 6 int32_t version; @@ -730,7 +729,7 @@ struct GroupFrame SimpleFrame *frames; } PACK_STRUCT; -#include "./Compiler/poppack1.h" +#include "./../include/Compiler/poppack1.h" // --------------------------------------------------------------------------- @@ -815,7 +814,8 @@ struct IntFrameInfo_MDL7 { //! Construction from an existing frame header IntFrameInfo_MDL7(const MDL::Frame_MDL7* _pcFrame,unsigned int _iIndex) - : pcFrame(_pcFrame), iIndex(_iIndex) + : iIndex(_iIndex) + , pcFrame(_pcFrame) {} //! Index of the frame @@ -830,16 +830,18 @@ struct IntFrameInfo_MDL7 struct IntGroupInfo_MDL7 { //! Default constructor - IntGroupInfo_MDL7() : - iIndex(0), - pcGroup(NULL), pcGroupUVs(NULL), - pcGroupTris(NULL), pcGroupVerts(NULL) + IntGroupInfo_MDL7() + : iIndex(0) + , pcGroup(NULL) + , pcGroupUVs(NULL) + , pcGroupTris(NULL) + , pcGroupVerts(NULL) {} //! Construction from an existing group header IntGroupInfo_MDL7(const MDL::Group_MDL7* _pcGroup,unsigned int _iIndex) - : - pcGroup(_pcGroup),iIndex(_iIndex) + : iIndex(_iIndex) + , pcGroup(_pcGroup) {} //! Index of the group diff --git a/code/MDLLoader.cpp b/code/MDLLoader.cpp index b7da74f9c..96fbaf413 100644 --- a/code/MDLLoader.cpp +++ b/code/MDLLoader.cpp @@ -198,14 +198,6 @@ void MDLImporter::InternReadFile( const std::string& pFile, this->iGSFileVersion = 5; this->InternReadFile_3DGS_MDL345(); } - // GameStudio A6+ MDL6 format (not sure whether it is really existing ... ) - else if (AI_MDL_MAGIC_NUMBER_BE_GS6 == iMagicWord || - AI_MDL_MAGIC_NUMBER_LE_GS6 == iMagicWord) - { - DefaultLogger::get()->debug("MDL subtype: 3D GameStudio A6, magic word is MDL6"); - this->iGSFileVersion = 6; - this->InternReadFile_3DGS_MDL345(); - } // GameStudio A7 MDL7 format else if (AI_MDL_MAGIC_NUMBER_BE_GS7 == iMagicWord || AI_MDL_MAGIC_NUMBER_LE_GS7 == iMagicWord) @@ -1990,5 +1982,5 @@ void MDLImporter::JoinSkins_3DGS_MDL7( // ------------------------------------------------------------------------------------------------ void MDLImporter::InternReadFile_HL2( ) { - const MDL::Header_HL2* pcHeader = (const MDL::Header_HL2*)this->mBuffer; -} \ No newline at end of file + //const MDL::Header_HL2* pcHeader = (const MDL::Header_HL2*)this->mBuffer; +} diff --git a/code/MDRFileData.h b/code/MDRFileData.h index 9ef5da3a6..2c543afcd 100644 --- a/code/MDRFileData.h +++ b/code/MDRFileData.h @@ -46,21 +46,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "../include/aiMesh.h" #include "../include/aiAnim.h" -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) -# pragma pack(push,1) -# define PACK_STRUCT -#elif defined( __GNUC__ ) -# define PACK_STRUCT __attribute__((packed)) -#else -# error Compiler not supported -#endif - +#include "./../include/Compiler/pushpack1.h" namespace Assimp { namespace MDR { -#define AI_MDR_MAGIC_NUMBER_BE 'RDM5' -#define AI_MDR_MAGIC_NUMBER_LE '5MDR' +// to make it easier for ourselfes, we test the magic word against both "endianesses" +#define MDR_MAKE(string) ((uint32_t)((string[0] << 24) + (string[1] << 16) + (string[2] << 8) + string[3])) + +#define AI_MDR_MAGIC_NUMBER_BE MDR_MAKE("RDM5") +#define AI_MDR_MAGIC_NUMBER_LE MDR_MAKE("5MDR") // common limitations #define AI_MDR_VERSION 2 @@ -224,14 +219,9 @@ struct Header } PACK_STRUCT; -// reset packing to the original value -#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) -# pragma pack( pop ) -#endif -#undef PACK_STRUCT - +#include "./../include/Compiler/poppack1.h" }; }; -#endif // !! AI_MDRFILEHELPER_H_INC \ No newline at end of file +#endif // !! AI_MDRFILEHELPER_H_INC diff --git a/code/NFFLoader.cpp b/code/NFFLoader.cpp index d532f82b8..05dbad30f 100644 --- a/code/NFFLoader.cpp +++ b/code/NFFLoader.cpp @@ -106,7 +106,7 @@ bool GetNextLine(const char*& buffer, char out[4096]) // ------------------------------------------------------------------------------------------------ #define AI_NFF_PARSE_FLOAT(f) \ SkipSpaces(&sz); \ - if (!::IsLineEnd(*sz))sz = fast_atof_move(sz, f); + if (!::IsLineEnd(*sz))sz = fast_atof_move(sz, (float&)f); // ------------------------------------------------------------------------------------------------ #define AI_NFF_PARSE_TRIPLE(v) \ @@ -160,7 +160,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, char line[4096]; const char* sz; unsigned int sphere = 0,cylinder = 0,cone = 0,numNamed = 0, - dodecahedron = 0,octecahedron = 0,octahedron = 0,tetrahedron = 0, hexahedron = 0; + dodecahedron = 0,octahedron = 0,tetrahedron = 0, hexahedron = 0; while (GetNextLine(buffer,line)) { @@ -223,11 +223,11 @@ void NFFImporter::InternReadFile( const std::string& pFile, SkipSpaces(&line[1],&sz); // read just the RGB colors, the rest is ignored for the moment - sz = fast_atof_move(sz, s.color.r); + sz = fast_atof_move(sz, (float&)s.color.r); SkipSpaces(&sz); - sz = fast_atof_move(sz, s.color.g); + sz = fast_atof_move(sz, (float&)s.color.g); SkipSpaces(&sz); - sz = fast_atof_move(sz, s.color.b); + sz = fast_atof_move(sz, (float&)s.color.b); // check whether we have this material already - // although we have the RRM-Step, this is necessary here. @@ -270,7 +270,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, AI_NFF_PARSE_SHAPE_INFORMATION(); // we don't need scaling or translation here - we do it in the node's transform - StandardShapes::MakeSphere(aiVector3D(), 1.0f, iTesselation, currentMesh.vertices); + StandardShapes::MakeSphere(iTesselation, currentMesh.vertices); currentMesh.faces.resize(currentMesh.vertices.size()/3,3); // generate a name for the mesh @@ -287,7 +287,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, AI_NFF_PARSE_SHAPE_INFORMATION(); // we don't need scaling or translation here - we do it in the node's transform - StandardShapes::MakeDodecahedron(aiVector3D(), 1.0f, currentMesh.vertices); + StandardShapes::MakeDodecahedron(currentMesh.vertices); currentMesh.faces.resize(currentMesh.vertices.size()/3,3); // generate a name for the mesh @@ -305,11 +305,11 @@ void NFFImporter::InternReadFile( const std::string& pFile, AI_NFF_PARSE_SHAPE_INFORMATION(); // we don't need scaling or translation here - we do it in the node's transform - StandardShapes::MakeOctahedron(aiVector3D(), 1.0f, currentMesh.vertices); + StandardShapes::MakeOctahedron(currentMesh.vertices); currentMesh.faces.resize(currentMesh.vertices.size()/3,3); // generate a name for the mesh - ::sprintf(currentMesh.name,"octecahedron_%i",octecahedron++); + ::sprintf(currentMesh.name,"octahedron_%i",octahedron++); } // 'tet' - tetrahedron @@ -323,7 +323,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, AI_NFF_PARSE_SHAPE_INFORMATION(); // we don't need scaling or translation here - we do it in the node's transform - StandardShapes::MakeTetrahedron(aiVector3D(), 1.0f, currentMesh.vertices); + StandardShapes::MakeTetrahedron(currentMesh.vertices); currentMesh.faces.resize(currentMesh.vertices.size()/3,3); // generate a name for the mesh @@ -341,7 +341,7 @@ void NFFImporter::InternReadFile( const std::string& pFile, AI_NFF_PARSE_SHAPE_INFORMATION(); // we don't need scaling or translation here - we do it in the node's transform - StandardShapes::MakeHexahedron(aiVector3D(),1.0f, currentMesh.vertices); + StandardShapes::MakeHexahedron(currentMesh.vertices); currentMesh.faces.resize(currentMesh.vertices.size()/3,3); // generate a name for the mesh @@ -495,4 +495,4 @@ void NFFImporter::InternReadFile( const std::string& pFile, pcMat->AddProperty(&src.shader.color,1,AI_MATKEY_COLOR_SPECULAR); } pScene->mRootNode = root; -} \ No newline at end of file +} diff --git a/code/NFFLoader.h b/code/NFFLoader.h index 82767c441..2c2421d93 100644 --- a/code/NFFLoader.h +++ b/code/NFFLoader.h @@ -130,4 +130,4 @@ private: } // end of namespace Assimp -#endif // AI_NFFIMPORTER_H_IN \ No newline at end of file +#endif // AI_NFFIMPORTER_H_IN diff --git a/code/ObjFileMtlImporter.cpp b/code/ObjFileMtlImporter.cpp index 33904628d..b729d0f1f 100644 --- a/code/ObjFileMtlImporter.cpp +++ b/code/ObjFileMtlImporter.cpp @@ -56,8 +56,8 @@ ObjFileMtlImporter::ObjFileMtlImporter( std::vector &buffer, ObjFile::Model *pModel ) : m_DataIt( buffer.begin() ), m_DataItEnd( buffer.end() ), - m_uiLine( 0 ), - m_pModel( pModel ) + m_pModel( pModel ), + m_uiLine( 0 ) { ai_assert ( NULL != m_pModel ); if ( NULL == m_pModel->m_pDefaultMaterial ) diff --git a/code/ObjFileParser.cpp b/code/ObjFileParser.cpp index aec92cf0a..af98e19b6 100644 --- a/code/ObjFileParser.cpp +++ b/code/ObjFileParser.cpp @@ -411,7 +411,7 @@ void ObjFileParser::getMaterialLib() size_t size = pFile->FileSize(); std::vector buffer; buffer.resize( size ); - size_t read_size = pFile->Read( &buffer[ 0 ], sizeof( char ), size ); + pFile->Read( &buffer[ 0 ], sizeof( char ), size ); FileSystem.Close( pFile ); // Importing the material library @@ -494,7 +494,7 @@ void ObjFileParser::getGroupName() ObjFile::Model::ConstGroupMapIt it = m_pModel->m_Groups.find(&strGroupName); // New group name, creating a new entry - ObjFile::Object *pObject = m_pModel->m_pCurrent; + //ObjFile::Object *pObject = m_pModel->m_pCurrent; if (it == m_pModel->m_Groups.end()) { std::vector *pFaceIDArray = new std::vector; diff --git a/code/OptimizeGraphProcess.cpp b/code/OptimizeGraphProcess.cpp index b444d7a2c..738fbcccc 100644 --- a/code/OptimizeGraphProcess.cpp +++ b/code/OptimizeGraphProcess.cpp @@ -417,10 +417,11 @@ void OptimizeGraphProcess::JoinBones( wmit = (*it).pSrcBones.begin(); wmit != wend; ++wmit) { aiBone* pip = (*wmit).first; - for (unsigned int mp = 0; mp < pip->mNumWeights;++mp) + for (unsigned int mp = 0; mp < pip->mNumWeights;++mp,++avw) { - aiVertexWeight& vf = aiVertexWeight(pip->mWeights[mp]); - vf.mVertexId += (*wmit).second; + const aiVertexWeight& vfi = pip->mWeights[mp]; + avw->mWeight = vfi.mWeight; + avw->mVertexId = vfi.mVertexId + (*wmit).second; } } } @@ -592,9 +593,9 @@ void OptimizeGraphProcess::ApplyNodeMeshesOptimization(aiNode* pNode) // ------------------------------------------------------------------------------------------------ void OptimizeGraphProcess::TransformMeshes(aiNode* quak,aiNode* pNode) { - for (unsigned int ä = 0; ä < quak->mNumMeshes;++ä) + for (unsigned int pl = 0; pl < quak->mNumMeshes;++pl) { - aiMesh* mariusIsHot = pScene->mMeshes[quak->mMeshes[ä]]; + aiMesh* mariusIsHot = pScene->mMeshes[quak->mMeshes[pl]]; aiMatrix4x4 mMatTransform = pNode->mTransformation; // transformation: first back to the parent's local space, diff --git a/code/ParsingUtils.h b/code/ParsingUtils.h index e028ceaeb..752e22628 100644 --- a/code/ParsingUtils.h +++ b/code/ParsingUtils.h @@ -109,4 +109,4 @@ inline bool SkipSpacesAndLineEnd( const char_t** inout) } -#endif // ! AI_PARSING_UTILS_H_INC \ No newline at end of file +#endif // ! AI_PARSING_UTILS_H_INC diff --git a/code/PlyLoader.cpp b/code/PlyLoader.cpp index c7f2d8556..8ecabe4e9 100644 --- a/code/PlyLoader.cpp +++ b/code/PlyLoader.cpp @@ -593,6 +593,7 @@ float PLYImporter::NormalizeColorValue (PLY::PropertyInstance::ValueUnion val, return (float)val.iUInt / (float)0xFFFF; case EDT_Int: return ((float)val.iInt / (float)0xFF) + 0.5f; + default: ; }; return 0.0f; } @@ -1077,4 +1078,4 @@ void PLYImporter::LoadMaterial(std::vector* pvOut) } } return; -} \ No newline at end of file +} diff --git a/code/PlyLoader.h b/code/PlyLoader.h index e99f1ec0e..ab857e3e1 100644 --- a/code/PlyLoader.h +++ b/code/PlyLoader.h @@ -173,4 +173,4 @@ protected: } // end of namespace Assimp -#endif // AI_3DSIMPORTER_H_INC \ No newline at end of file +#endif // AI_3DSIMPORTER_H_INC diff --git a/code/PlyParser.cpp b/code/PlyParser.cpp index 86f852b9c..4382f44ef 100644 --- a/code/PlyParser.cpp +++ b/code/PlyParser.cpp @@ -60,10 +60,7 @@ using namespace Assimp; // ------------------------------------------------------------------------------------------------ PLY::EDataType PLY::Property::ParseDataType(const char* p_szIn,const char** p_szOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - - + ai_assert(NULL != p_szIn && NULL != p_szOut); PLY::EDataType eOut = PLY::EDT_INVALID; if (0 == ASSIMP_strincmp(p_szIn,"char",4) || @@ -150,8 +147,7 @@ PLY::EDataType PLY::Property::ParseDataType(const char* p_szIn,const char** p_sz // ------------------------------------------------------------------------------------------------ PLY::ESemantic PLY::Property::ParseSemantic(const char* p_szIn,const char** p_szOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); + ai_assert(NULL != p_szIn && NULL != p_szOut); PLY::ESemantic eOut = PLY::EST_INVALID; if (0 == ASSIMP_strincmp(p_szIn,"red",3)) @@ -330,8 +326,7 @@ bool PLY::Property::ParseProperty (const char* p_szIn, const char** p_szOut, PLY::Property* pOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); + ai_assert(NULL != p_szIn && NULL != p_szOut); // Forms supported: // "property float x" @@ -405,9 +400,7 @@ bool PLY::Property::ParseProperty (const char* p_szIn, PLY::EElementSemantic PLY::Element::ParseSemantic(const char* p_szIn, const char** p_szOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - + ai_assert(NULL != p_szIn && NULL != p_szOut); PLY::EElementSemantic eOut = PLY::EEST_INVALID; if (0 == ASSIMP_strincmp(p_szIn,"vertex",6)) { @@ -455,9 +448,7 @@ bool PLY::Element::ParseElement (const char* p_szIn, const char** p_szOut, PLY::Element* pOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - ai_assert(NULL != pOut); + ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != pOut); // Example format: "element vertex 8" *p_szOut = p_szIn; @@ -514,9 +505,7 @@ bool PLY::Element::ParseElement (const char* p_szIn, bool PLY::DOM::SkipComments (const char* p_szIn, const char** p_szOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - + ai_assert(NULL != p_szIn && NULL != p_szOut); *p_szOut = p_szIn; // skip spaces @@ -538,13 +527,10 @@ bool PLY::DOM::SkipComments (const char* p_szIn, // ------------------------------------------------------------------------------------------------ bool PLY::DOM::ParseHeader (const char* p_szIn,const char** p_szOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - + ai_assert(NULL != p_szIn && NULL != p_szOut); DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin"); // after ply and format line - const char* szMax = *p_szOut; *p_szOut = p_szIn; // parse all elements @@ -578,12 +564,9 @@ bool PLY::DOM::ParseElementInstanceLists ( const char* p_szIn, const char** p_szOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); + ai_assert(NULL != p_szIn && NULL != p_szOut); DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceLists() begin"); - - const char* szMax = *p_szOut; *p_szOut = p_szIn; this->alElementData.resize(this->alElements.size()); @@ -608,8 +591,7 @@ bool PLY::DOM::ParseElementInstanceListsBinary ( const char** p_szOut, bool p_bBE) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); + ai_assert(NULL != p_szIn && NULL != p_szOut); DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceListsBinary() begin"); *p_szOut = p_szIn; @@ -633,8 +615,7 @@ bool PLY::DOM::ParseElementInstanceListsBinary ( // ------------------------------------------------------------------------------------------------ bool PLY::DOM::ParseInstanceBinary (const char* p_szIn,DOM* p_pcOut,bool p_bBE) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_pcOut); + ai_assert(NULL != p_szIn && NULL != p_pcOut); DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin"); @@ -680,12 +661,7 @@ bool PLY::ElementInstanceList::ParseInstanceList ( const PLY::Element* pcElement, PLY::ElementInstanceList* p_pcOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - ai_assert(NULL != pcElement); - ai_assert(NULL != p_pcOut); - - const char* szMax = *p_szOut; + ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != pcElement && NULL != p_pcOut); if (EEST_INVALID == pcElement->eSemantic) { @@ -722,10 +698,7 @@ bool PLY::ElementInstanceList::ParseInstanceListBinary ( PLY::ElementInstanceList* p_pcOut, bool p_bBE /* = false */) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - ai_assert(NULL != pcElement); - ai_assert(NULL != p_pcOut); + ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != pcElement && NULL != p_pcOut); // we can add special handling code for unknown element semantics since // we can't skip it as a whole block (we don't know its exact size @@ -748,10 +721,7 @@ bool PLY::ElementInstance::ParseInstance ( const PLY::Element* pcElement, PLY::ElementInstance* p_pcOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - ai_assert(NULL != pcElement); - ai_assert(NULL != p_pcOut); + ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != pcElement && NULL != p_pcOut); if (!SkipSpaces(p_szIn, &p_szIn))return false; @@ -785,10 +755,7 @@ bool PLY::ElementInstance::ParseInstanceBinary ( PLY::ElementInstance* p_pcOut, bool p_bBE /* = false */) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - ai_assert(NULL != pcElement); - ai_assert(NULL != p_pcOut); + ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != pcElement && NULL != p_pcOut); // allocate enough storage p_pcOut->alProperties.resize(pcElement->alProperties.size()); @@ -813,10 +780,7 @@ bool PLY::ElementInstance::ParseInstanceBinary ( bool PLY::PropertyInstance::ParseInstance (const char* p_szIn,const char** p_szOut, const PLY::Property* prop, PLY::PropertyInstance* p_pcOut) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - ai_assert(NULL != prop); - ai_assert(NULL != p_pcOut); + ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != prop && NULL != p_pcOut); *p_szOut = p_szIn; @@ -856,10 +820,7 @@ bool PLY::PropertyInstance::ParseInstance (const char* p_szIn,const char** p_szO bool PLY::PropertyInstance::ParseInstanceBinary (const char* p_szIn,const char** p_szOut, const PLY::Property* prop, PLY::PropertyInstance* p_pcOut,bool p_bBE) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - ai_assert(NULL != prop); - ai_assert(NULL != p_pcOut); + ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != prop && NULL != p_pcOut); if (prop->bIsList) { @@ -902,6 +863,8 @@ PLY::PropertyInstance::ValueUnion PLY::PropertyInstance::DefaultValue( case EDT_Double: out.fDouble = 0.0; return out; + + default: ; }; out.iUInt = 0; return out; @@ -910,9 +873,7 @@ PLY::PropertyInstance::ValueUnion PLY::PropertyInstance::DefaultValue( bool PLY::PropertyInstance::ParseValue(const char* p_szIn,const char** p_szOut, PLY::EDataType eType,PLY::PropertyInstance::ValueUnion* out) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - ai_assert(NULL != out); + ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != out); switch (eType) { @@ -956,6 +917,7 @@ bool PLY::PropertyInstance::ParseValue(const char* p_szIn,const char** p_szOut, float f; p_szIn = fast_atof_move(p_szIn,f); out->fDouble = (double)f; + break; default: *p_szOut = p_szIn; @@ -972,9 +934,7 @@ bool PLY::PropertyInstance::ParseValueBinary( PLY::PropertyInstance::ValueUnion* out, bool p_bBE) { - ai_assert(NULL != p_szIn); - ai_assert(NULL != p_szOut); - ai_assert(NULL != out); + ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != out); switch (eType) { diff --git a/code/PlyParser.h b/code/PlyParser.h index 914bf28d5..49ffc29f5 100644 --- a/code/PlyParser.h +++ b/code/PlyParser.h @@ -264,7 +264,8 @@ public: //! Default constructor Element() - : NumOccur(0), eSemantic (EEST_INVALID) + : eSemantic (EEST_INVALID) + , NumOccur(0) {} //! Destructor. Dallocates all storage @@ -548,6 +549,7 @@ TYPE PLY::PropertyInstance::ConvertTo( case EDT_Short: case EDT_Char: return (TYPE)v.iInt; + default: ; }; return (TYPE)0; } diff --git a/code/PretransformVertices.h b/code/PretransformVertices.h index 1692940e7..9e1cb2685 100644 --- a/code/PretransformVertices.h +++ b/code/PretransformVertices.h @@ -85,4 +85,4 @@ public: } // end of namespace Assimp -#endif // !!AI_GENFACENORMALPROCESS_H_INC \ No newline at end of file +#endif // !!AI_GENFACENORMALPROCESS_H_INC diff --git a/code/RemoveComments.cpp b/code/RemoveComments.cpp index 18f66cd3a..50a5138cd 100644 --- a/code/RemoveComments.cpp +++ b/code/RemoveComments.cpp @@ -101,7 +101,8 @@ void CommentRemover::RemoveMultiLineComments(const char* szCommentStart, ++szBuffer; __continue_outer: int i = 4; // NOP dummy + ++i; } } -}; // !! Assimp \ No newline at end of file +}; // !! Assimp diff --git a/code/SGSpatialSort.cpp b/code/SGSpatialSort.cpp index 83135df2e..95bd52977 100644 --- a/code/SGSpatialSort.cpp +++ b/code/SGSpatialSort.cpp @@ -140,3 +140,4 @@ void SGSpatialSort::FindPositions( const aiVector3D& pPosition, } } + diff --git a/code/SMDLoader.cpp b/code/SMDLoader.cpp index 8529ff6d4..62bb0b979 100644 --- a/code/SMDLoader.cpp +++ b/code/SMDLoader.cpp @@ -712,7 +712,7 @@ void SMDImporter::ParseFile() DefaultLogger::get()->warn("SMD.version is not 1. This " "file format is not known. Continuing happily ..."); } - //continue; + continue; } // "nodes\n" - Starts the node section if (0 == ASSIMP_strincmp(szCurrent,"nodes",5) && @@ -720,7 +720,7 @@ void SMDImporter::ParseFile() { szCurrent += 6; this->ParseNodesSection(szCurrent,&szCurrent); - //continue; + continue; } // "triangles\n" - Starts the triangle section if (0 == ASSIMP_strincmp(szCurrent,"triangles",9) && @@ -728,7 +728,7 @@ void SMDImporter::ParseFile() { szCurrent += 10; this->ParseTrianglesSection(szCurrent,&szCurrent); - //continue; + continue; } // "vertexanimation\n" - Starts the vertex animation section if (0 == ASSIMP_strincmp(szCurrent,"vertexanimation",15) && @@ -737,7 +737,7 @@ void SMDImporter::ParseFile() this->bHasUVs = false; szCurrent += 16; this->ParseVASection(szCurrent,&szCurrent); - //continue; + continue; } // "skeleton\n" - Starts the skeleton section if (0 == ASSIMP_strincmp(szCurrent,"skeleton",8) && @@ -745,9 +745,9 @@ void SMDImporter::ParseFile() { szCurrent += 9; this->ParseSkeletonSection(szCurrent,&szCurrent); - //continue; + continue; } - else SkipLine(szCurrent,&szCurrent); + SkipLine(szCurrent,&szCurrent); } return; } @@ -782,8 +782,8 @@ void SMDImporter::ParseNodesSection(const char* szCurrent, } this->ParseNodeInfo(szCurrent,&szCurrent); } - *szCurrentOut = szCurrent; SkipSpacesAndLineEnd(szCurrent,&szCurrent); + *szCurrentOut = szCurrent; } // ------------------------------------------------------------------------------------------------ // Parse the triangles section of the file @@ -805,8 +805,8 @@ void SMDImporter::ParseTrianglesSection(const char* szCurrent, } this->ParseTriangle(szCurrent,&szCurrent); } - *szCurrentOut = szCurrent; SkipSpacesAndLineEnd(szCurrent,&szCurrent); + *szCurrentOut = szCurrent; } // ------------------------------------------------------------------------------------------------ // Parse the vertex animation section of the file @@ -823,7 +823,7 @@ void SMDImporter::ParseVASection(const char* szCurrent, IsSpaceOrNewLine(*(szCurrent+3))) { szCurrent += 4; - SkipLine(szCurrent,&szCurrent); + //SkipLine(szCurrent,&szCurrent); break; } // "time \n" @@ -834,7 +834,7 @@ void SMDImporter::ParseVASection(const char* szCurrent, // NOTE: The doc says that time values COULD be negative ... // note2: this is the shape key -> valve docs int iTime = 0; - if(!this->ParseSignedInt(szCurrent,&szCurrent,iTime) || this->configFrameID != iTime)break; + if(!this->ParseSignedInt(szCurrent,&szCurrent,iTime) || this->configFrameID != (unsigned int)iTime)break; SkipLine(szCurrent,&szCurrent); } else @@ -854,8 +854,8 @@ void SMDImporter::ParseVASection(const char* szCurrent, this->aszTextures.pop_back(); } - *szCurrentOut = szCurrent; SkipSpacesAndLineEnd(szCurrent,&szCurrent); + *szCurrentOut = szCurrent; } // ------------------------------------------------------------------------------------------------ // Parse the skeleton section of the file @@ -872,7 +872,7 @@ void SMDImporter::ParseSkeletonSection(const char* szCurrent, IsSpaceOrNewLine(*(szCurrent+3))) { szCurrent += 4; - SkipLine(szCurrent,&szCurrent); + //SkipLine(szCurrent,&szCurrent); break; } // "time \n" - Specifies the current animation frame @@ -981,32 +981,32 @@ void SMDImporter::ParseSkeletonElement(const char* szCurrent, SMD::Bone::Animation::MatrixKey& key = bone.sAnim.asKeys.back(); key.dTime = (double)iTime; - if(!this->ParseFloat(szCurrent,&szCurrent,vPos.x)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vPos.x)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.pos.x"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vPos.y)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vPos.y)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.pos.y"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vPos.z)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vPos.z)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.pos.z"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vRot.x)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vRot.x)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.rot.x"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vRot.y)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vRot.y)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.rot.y"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vRot.z)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vRot.z)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.rot.z"); SMDI_PARSE_RETURN; @@ -1099,32 +1099,32 @@ void SMDImporter::ParseVertex(const char* szCurrent, this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.parent"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vertex.pos.x)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vertex.pos.x)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.pos.x"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vertex.pos.y)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vertex.pos.y)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.pos.y"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vertex.pos.z)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vertex.pos.z)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.pos.z"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vertex.nor.x)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vertex.nor.x)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.nor.x"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vertex.nor.y)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vertex.nor.y)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.nor.y"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vertex.nor.z)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vertex.nor.z)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.nor.z"); SMDI_PARSE_RETURN; @@ -1132,12 +1132,12 @@ void SMDImporter::ParseVertex(const char* szCurrent, if (bVASection)SMDI_PARSE_RETURN; - if(!this->ParseFloat(szCurrent,&szCurrent,vertex.uv.x)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vertex.uv.x)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.uv.x"); SMDI_PARSE_RETURN; } - if(!this->ParseFloat(szCurrent,&szCurrent,vertex.uv.y)) + if(!this->ParseFloat(szCurrent,&szCurrent,(float&)vertex.uv.y)) { this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.uv.y"); SMDI_PARSE_RETURN; @@ -1147,7 +1147,7 @@ void SMDImporter::ParseVertex(const char* szCurrent, // all elements from now are fully optional, we don't need them unsigned int iSize = 0; if(!this->ParseUnsignedInt(szCurrent,&szCurrent,iSize))SMDI_PARSE_RETURN; - vertex.aiBoneLinks.resize(iSize,std::pair(-1,0.0f)); + vertex.aiBoneLinks.resize(iSize,std::pair(0,0.0f)); for (std::vector >::iterator i = vertex.aiBoneLinks.begin(); @@ -1159,4 +1159,4 @@ void SMDImporter::ParseVertex(const char* szCurrent, // go to the beginning of the next line SMDI_PARSE_RETURN; -} \ No newline at end of file +} diff --git a/code/STLLoader.cpp b/code/STLLoader.cpp index c100185e5..630ba9bb9 100644 --- a/code/STLLoader.cpp +++ b/code/STLLoader.cpp @@ -240,11 +240,11 @@ void STLImporter::LoadASCIIFile() { sz += 7; SkipSpaces(&sz); - sz = fast_atof_move(sz, vn->x ); + sz = fast_atof_move(sz, (float&)vn->x ); SkipSpaces(&sz); - sz = fast_atof_move(sz, vn->y ); + sz = fast_atof_move(sz, (float&)vn->y ); SkipSpaces(&sz); - sz = fast_atof_move(sz, vn->z ); + sz = fast_atof_move(sz, (float&)vn->z ); *(vn+1) = *vn; *(vn+2) = *vn; } @@ -261,11 +261,11 @@ void STLImporter::LoadASCIIFile() sz += 7; SkipSpaces(&sz); aiVector3D* vn = &pMesh->mVertices[(curFace-1)*3 + curVertex++]; - sz = fast_atof_move(sz, vn->x ); + sz = fast_atof_move(sz, (float&)vn->x ); SkipSpaces(&sz); - sz = fast_atof_move(sz, vn->y ); + sz = fast_atof_move(sz, (float&)vn->y ); SkipSpaces(&sz); - sz = fast_atof_move(sz, vn->z ); + sz = fast_atof_move(sz, (float&)vn->z ); } } else if (!::strncmp(sz,"endsolid",8)) diff --git a/code/STLLoader.h b/code/STLLoader.h index a18099674..a89d551d9 100644 --- a/code/STLLoader.h +++ b/code/STLLoader.h @@ -115,4 +115,4 @@ protected: } // end of namespace Assimp -#endif // AI_3DSIMPORTER_H_IN \ No newline at end of file +#endif // AI_3DSIMPORTER_H_IN diff --git a/code/SmoothingGroups.inl b/code/SmoothingGroups.inl index da43c8dea..cebd20f03 100644 --- a/code/SmoothingGroups.inl +++ b/code/SmoothingGroups.inl @@ -95,7 +95,7 @@ void ComputeNormalsWithSmoothingsGroups(MeshWithSmoothingGroups& sMesh) // now generate the spatial sort tree SGSpatialSort sSort; - for( std::vector::iterator i = sMesh.mFaces.begin(); + for( typename std::vector::iterator i = sMesh.mFaces.begin(); i != sMesh.mFaces.end();++i) { sSort.Add(sMesh.mPositions[(*i).mIndices[0]],(*i).mIndices[0],(*i).iSmoothGroup); @@ -104,7 +104,7 @@ void ComputeNormalsWithSmoothingsGroups(MeshWithSmoothingGroups& sMesh) } sSort.Prepare(); - for( std::vector::iterator i = sMesh.mFaces.begin(); + for( typename std::vector::iterator i = sMesh.mFaces.begin(); i != sMesh.mFaces.end();++i) { std::vector poResult; diff --git a/code/SpatialSort.cpp b/code/SpatialSort.cpp index 6ab44e85c..6032316ad 100644 --- a/code/SpatialSort.cpp +++ b/code/SpatialSort.cpp @@ -132,3 +132,4 @@ void SpatialSort::FindPositions( const aiVector3D& pPosition, float pRadius, std // that's it } + diff --git a/code/SplitLargeMeshes.cpp b/code/SplitLargeMeshes.cpp index 986508e08..be5641cc4 100644 --- a/code/SplitLargeMeshes.cpp +++ b/code/SplitLargeMeshes.cpp @@ -274,15 +274,14 @@ void SplitLargeMeshesProcess_Triangle::SplitMesh( // setup face type and number of indices pcMesh->mFaces[p].mNumIndices = iNumIndices; unsigned int* pi = pMesh->mFaces[iTemp].mIndices; - - pcMesh->mFaces[p].mIndices = new unsigned int[iNumIndices]; + unsigned int* piOut = pcMesh->mFaces[p].mIndices = new unsigned int[iNumIndices]; // and copy the contents of the old array, offset by current base for (unsigned int v = 0; v < iNumIndices;++v) { - unsigned int iIndex = pMesh->mFaces[iTemp].mIndices[v]; + unsigned int iIndex = pi[v]; unsigned int iIndexOut = iCurrent++; - pcMesh->mFaces[p].mIndices[v] = iIndexOut; + piOut[v] = iIndexOut; // copy positions if (pMesh->mVertices != NULL) @@ -407,7 +406,7 @@ void SplitLargeMeshesProcess_Vertex::SplitMesh( // determine the estimated size of a submesh // (this could be too large. Max waste is a single digit percentage) const unsigned int iSubMeshes = (pMesh->mNumVertices / SplitLargeMeshesProcess_Vertex::LIMIT) + 1; - const unsigned int iOutVertexNum2 = pMesh->mNumVertices /iSubMeshes; + //const unsigned int iOutVertexNum2 = pMesh->mNumVertices /iSubMeshes; // create a std::vector to indicate which vertices // have already been copied diff --git a/code/SplitLargeMeshes.h b/code/SplitLargeMeshes.h index f474a9470..6481f44db 100644 --- a/code/SplitLargeMeshes.h +++ b/code/SplitLargeMeshes.h @@ -213,4 +213,4 @@ public: } // end of namespace Assimp -#endif // !!AI_SPLITLARGEMESHES_H_INC \ No newline at end of file +#endif // !!AI_SPLITLARGEMESHES_H_INC diff --git a/code/StandardShapes.cpp b/code/StandardShapes.cpp index e8a74dd4bed9b926e48900a7a5e47bd129a769af..b8b687411ab0d19fadfdc1c4e4e6e9e483bdb83a 100644 GIT binary patch literal 10618 zcmd5?dvDrU7XKS0zQdhXsvt4%JldvRtpiSCi2!4pW~1FvWQ<9y0h_fAZ91CoKEHEq zuzfLs-R;h#4|3!4KKH!tHT9!Xaj>vmCI^8XGIhT2{E+pWv2Xg%tSsxgdONI?iq#+T zr&KHzJKo~icOIWYR<1_T^quiCbUc@t?u0D^n|V_fJ~;skylME=^lj$2STB9c<|t#wCDW#!KMy2U zDt>jsC+7K#etOH0&Ao{;bu5#3N{r|iwm)~m(4Me`@2#8(7U7c_;=>00)SJz`ua5i3 zEYF=dL>6$exgCBaHIGgk_-#MTw_5_EvVO$iQ&zD%T4g%a$U; zX0V!gq~*bOkP=a%54>Z|OlNNU++EvxKwiolYdv7(WC>^ee^jB}AkGudTGAeKKhwt4 zu?HR?J{d7LL)&-ES&+D#?-Qp?ZF+22-^S+IK4BZ;{XK=g#b_rM8* z$jfdNM4lf&@G~3R6i0BV$82|kr{L$4B6BZ9G;sGsq!TEKXk=5sz&jmu>u?Gdwngy- zI>+O-ef24r+$gMqfI^pt>_%NN1GtgKjjA(!aAn-dn!>OiYJ)FoSLw3LduH4ytTPzi zYwGol!EOeYqt7x4Y@R2Xoo@(54iC3!8 zCuvs$4Oz{GvSz5AQBT&`aHI_fy28k|uBvx>vU;m@Yfu0}nes*H8%)2Edp*Ha6tBC! zqLKa?OD`4HQ{~H^Lb4$H9$Yo0V~|P7sssN)!=6+s>O-ZYVg-*VaD=SgOEFVj`FR8^ z09jYQm9G_@mG}Auo6{L-$}Q;)XXv9#-B68@p|I=0pv(QOE7}*eqv#i`H=rH3Vk2FF zCSBQ(xoq%&!vKc`mm^)}u2cJlqG_X{p$_^L?DQRc1KVZLcDauSeQs{4h?p2?_r#Yx z!8bu-cQ*>2W3&5_zhrWWjtJ=(X*5Vgz|dwVrn0_r-BYiXen%mV2E^x1)s+f1O@(&X z#FRXJCqpWt1(GQ)p&9t_Us4eaM`Kf&dd1}K7jWsW(Gdo^8pjNX^ik&~_B&65AJT@Z zD9Uvz&Gn-r_V=kXv#IgT?4%yW38{xDOr}54pUeen2C8X5C4-3HI<7TaqI$on)#~xO zZaT&@5Nl6wb|7@^skxkmJ@4@mRe2|x=}S_bT5H?a8$=$Tte~r#uEqfMVR=_?S z>{>BI7-EF2gJc`n0@)#}tm;TuQ~2=S-Ns z98VmY5z9e1`S@{VTcPKFGMz7c(eD239owW7#%g3LX!$7JoZA|*qAR6Iu>8F1fgt2A`?B!X6@VY zxb_VvfZ8(_&$RfC#rI0BkE4S*<1RUZtG76jUIHg;&BG&*ehMCk2u{Y&rZOV>WtJZ3tHO|gIoS#oC^;T_4z895a zK{iBK@NYki8H7h+g;iLcMfwvt{w0PnWMY;&lptDSjT!_7gr7!k3dq$Lv0DOmC{ZPj_Kg^RUkZ?2R5$9`^Z8>|EyW1$1~CI!g=&T)Ut-2=n#}ibIV&N0B3-N1k`dB#7ht#mo4g zI8@~n@h)!8tXELQn++Z~*qQVMMq>x^4z;&gJ8!odr;Yci@*PcSG?DOXU2fN=)uh@Z zThEZPwApEvG`DQfkMqz$kfi^1aW^IWtexukIq+FZoY;R=HRL+@p1D>x@4jU|iJ9+#b z86lkGgQF+?FhL_}#G*-yQ~Xcniv)>F<19!)E;Z?(DKrwt)uxX~_NLJ$Xk;8oYVr?4 z<&AaA8Jq#vjihq%Ni$8@adn6%H-Y2lDMw!561h}vcAlvmjhJxh+!)@b`CO6+!Ksm`;)(#r6d#;U;;!`3n6GSm$>r6=2vN%ng3!95%nlX0_w9ydE$5vr>24u&m z3kXKt^_e+)G{MNad#DD#q=+Qifo45A3pzxDIM2sdkQ#;^`mZ22)~A{DNE%JKC(V;q zb6Up`OM#Py(}dfqot%6)S%ZZ<5p#}HQ)=)_1JYz4wU}&}1~I}w z>>s2;u7d=0*Hd~3GLd)$PKtMCOeyw~H;vtIq5qn7*PcY5LW KQ~Vu`Qt=Nd&zq3| literal 20776 zcmeI4`%fF$702(dRO+9|Mj-t z&pkfA9(!KKR+To$8qfI7ocFosac9Q={?}Z%7ycOj5H`a5a2U=)BP@kWeGWrM$7|tK z4MXbP;*!h669 zrcRWNu?s<7YwVyq0u|s*7T}-{M`-UnQa+Q78lrTSmUBemjbVSKC3dg3)Jza|zz;Qz#U`;3{> z70d%{iS;jfHb0Ht%gC{gPGr$MFZcPAyu4_pr+9$H-iVgXL?|TaGtq)u_hFZ$Kl*aD zMI-zUKg`3B<^gmrdvcjK_D3S%xf+Ry^?Q-N#Umn9M-&+*t0J@7N3kBku=%uL!@JoiTIkL6}ir%Zi=#S zoz-qt4oH^V4zH9E+rrRRR(+u?@m9FD!m37Wd{e(R!VmhjqR|zNKMz0Z8%VBN*4a&s zZ0U-Z8r#;`D~+wk>$f8AC3y>wT>C~>aP9N3qoWNSL!IbxCrV*-?`X`S*h6tO{8g0T zjeOULuv|?(U)SEaGybAmU6_999LH%r2@sqZb(UlXPsLGz2z z9ql)DWm|CQ%j|}H?I`P#j^JQL(H2d;(KnK!%OA913oH+J>-r=a^Q;Ot8}bjhgg&+_ zv*~kP*NCzr^?Lkea+z(hDZIkk;VV z$B4C`Q*`wgY0hvNBz!ChYDr#!cTp{l?=LoUuox0z2h+ECMqA_0MGLEL>lklqi2jB? zE0G7|8h*Fp{9D#hJ3P}>>$=A00A9AEU#nf6APG7`n})&oFb^|$8^`ylhm+TF3?Ezi z>`1rp#*C%*WKO@;IsC@#zSO15%yvKK>SSF!#%2u^vA4<249m_0xP2=ctKI9N05|>q zwbb(xv_=fUYm$ehd6i_h2*XwIl4n(B#H#cTPgtKQfh9~wL%=F7B}%y&rYQpJV1ciMiT3K92M1qilw3E5BQ(LS23!{ZZYM zTQ7yxYE$wnv>Kvhl)qNKJ&R|ry0!Nm#nM@w&5q9r*Ribqv5Rq5*zZJK^)ZmOkA&w+ zwOU91c&^^!oyMq@N5=*~-W}5sCmcwa$5okzvd~`RQO)djt8Al1b^kt0h2MI1o06{P zq*3cO4s|r6?MN~n>&jF&BDvM;)Iwfu(O((Aj8HS3X>YS&CHy3fGZUG4%-~hc@H2JD z_x0V1-}7<4{ypND620?SL8UHjR%6tOKMU7h=#Z@&Lq3R*NXwS5w+~Tz zDqy_iKpa|SPkn1OCh~Oj>nL7vq9eM3f9kq-y5dZ-5>>2&Z-j?Bwo010@lH5xK6vly zd#ZJ6Pp|c%$NZt92ByqL#=WVbgtHo{&HqrDzw>_x0Avoctmx^7>6YRd8*jeM&Q{pP-Y5f#6aR~#$*r;&%U)%W2WVHu8Xw#I3Z*rN%v z_)_$&L#H>l&eb|(>zl2=h6Cm|v4n_COCs zH?k!PmI=-yq#d^e`KJgy7_0xL$o>!Iv31E$tb+UIK+L?-8RFDC?X6FTZ)8A!jJNgu zN#~48Q@Y59xSONV*@zqHM0ZM&7Toj=OktauM(Z*mc{c{pbhGwC+S z4b-&vBP^MKTu}r;rR$l;R-mRL#AGw|a3-G>hyC~Fnw7a}T6YNt`-!5gi^R*IcH+>1BBU7zzO71+(EP0xIr1?p+# zX-(YbGo#^d_3G8U8P@F1Md#b~UytvWq%8As*Gbmb`*B-TDXRlmWx5VLfpHzz0X!a6 z!#s{K$e(g~859)TwUMS}ucFh;UDOa8q$rAb%~!Y9YQ&CyOuX35gkvYBs~pVaj#^Fq^#t#($^ zF|RNWp*yYP^JXiT&0(r(na+(O>uhysnZ`{Ubv?>G!t_zscil=RU7BC18vl|j@fB6x ztk?7W6|2u*dM%ERrHEs`-(NLzH^kS#e6_=Caq3=<7gdY%)ZgQXE5G{g$FtYXfT^}_ z3IlaJPY({)_Ey<1bSq$=ZADz}7h-2!ryh3GLtgf$zh*V7EQjwZ2iV5iOIxcBr|JZ` zE7HvL2`O?EQL3usozjfxjZ3SlvWFIQkZoLARh53CH3`Y8Du0)15|UMQ0*TfnB&+TX zk|xKuT6MROs7*q;s{Ub5zPPW=d*kuuT2)6eqczt_(j)SgMG>gYOi(`Rf--t0-()HJ zx@TT|P)DDQZ<^E+-_X(^AC$v8+6na8I|d?{XuHjPeNPU6fcG$$h|@urw+za_CO zE6L-{$(Cx1dKArjCqt9CQ(sE#JHDJmpE@*M&iYid{mk$a57aYQ%T^57)2pzjTVdbI z?SacMwNz<2tlb^(yAn`Ib&sztl;fh)GCt^OI7-;_`olbI^lXO1_dY^*#hKLArd~J? zQ<5!l;TlY`=JlZY*j&1#Z9noe%z}D4bIZ9*E!E^MuVYOeYqe)24*Xt^^`u!F)a5Q| z$N6lT1q?A<39zb=$UTTQy;GNt5iZIVjb$L&D~gCfVIr`d43WdvorRZ77m* zKkc?Jr&ArAr+GCLGpDK>?Y}eS_rg=A_S%_eKgzq_s$O&^)7utPs-jcXhbG>$l6{Pk z&gH41Qq_SbDuZ&3MyIOxOmxywRxX~FsFJ3t>rA-Q(V$$3PBt$LKga4T{-dqX5=AX@ zQwt=Syap(yGuo=I(IMV4H=ItjOk@w|FTtf+Adf$TG5+!@kzyF*udW`9j_Et)$J?wy z*4Wm@bHcZInF>`x-7Qs*m(}s%;Ru zJfBqMEss>b_q)U6c9i97xAS_kgHs#Ta{1C2m9~c=2zrD zW$IvC)#Q(o? zoO*UY8Of{fgk`DTMDlD#O>aNhdaXTm?fpt#o*Ra+EN8t$T3txlbQr>VDOR)c^KU-{ z>t#I8WqCK7N%LtKggqN%{ZQUY;xG;4$9PLCaw%JX9p84bw=#?0$3(wuU-Hv1Z9T0` zUgsI^X36@`H+sKkN~?4IPof3mBJY6~YcgtR@ zaw&TPKPwYmWa57KY4>ba9_{Tadwc4;p3KkGtxZc){wCE_?%Q_7JS2brl0A4izDY5v z_Yw)K{Wo2eSN{yp2_jiF)^t^!d13#?FqwBbxD#aj@gH3LR~Yx){U7V>okaf2fcucV z^UnV=9qRX7*GGSg(6@d^JXzMv<^SQR>_?59ZiQm6vj3erjW$SD`@Caq@{8Z)KNgd| K(oz4vFZ>5wCthm+ diff --git a/code/StandardShapes.h b/code/StandardShapes.h index e0f7763d4..590465e82 100644 --- a/code/StandardShapes.h +++ b/code/StandardShapes.h @@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include + namespace Assimp { // --------------------------------------------------------------------------- @@ -65,6 +66,9 @@ public: * @param center Center point of the hexahedron * @param length Radius of the hexahedron * @param positions Receives output triangles. + * + * @note If you define AI_STANDARD_SHAPES_OUTPUT_POLYGONS quads + * instead of triangles are returned. */ static void MakeHexahedron(aiVector3D& center,const aiVector3D& length, std::vector& positions); @@ -85,6 +89,8 @@ public: * @param center Center point of the dodecahedron * @param length Radius of the dodecahedron * @param positions Receives output triangles + * @note If you define AI_STANDARD_SHAPES_OUTPUT_POLYGONS pentagons + * instead of triangles are returned. */ static void MakeDodecahedron(aiVector3D& center,const aiVector3D& length, std::vector& positions); @@ -165,6 +171,7 @@ public: // simplified versions - the radius is a single float and applies // to all axes. These version of the functions must be used if ou // REALLY want a platonic primitive :-) + // --------------------------------------------------------------------- static void MakeHexahedron(aiVector3D& center,float length, std::vector& positions) { @@ -177,7 +184,7 @@ public: MakeDodecahedron(center,aiVector3D(length),positions); } - static void MakeOcathedron(aiVector3D& center,float length, + static void MakeOctahedron(aiVector3D& center,float length, std::vector& positions) { MakeOctahedron(center,aiVector3D(length),positions); @@ -194,8 +201,49 @@ public: { MakeIcosahedron(center,aiVector3D(length),positions); } + + + // simplified versions - radius is 1, position is 0|0|0 + // --------------------------------------------------------------------- + static void MakeHexahedron(std::vector& positions) + { + aiVector3D v; + MakeHexahedron(v,1.0f,positions); + } + + static void MakeDodecahedron(std::vector& positions) + { + aiVector3D v; + MakeDodecahedron(v,1.0f,positions); + } + + static void MakeOctahedron(std::vector& positions) + { + aiVector3D v; + MakeOctahedron(v,1.0f,positions); + } + + static void MakeTetrahedron(std::vector& positions) + { + aiVector3D v; + MakeTetrahedron(v,1.0f,positions); + } + + static void MakeIcosahedron(std::vector& positions) + { + aiVector3D v; + MakeIcosahedron(v,1.0f,positions); + } + + + static void MakeSphere(unsigned int tess, + std::vector& positions) + { + aiVector3D v; + MakeSphere(v,1.0f,tess,positions); + } }; } // ! Assimp -#endif // !! AI_STANDARD_SHAPES_H_INC \ No newline at end of file +#endif // !! AI_STANDARD_SHAPES_H_INC diff --git a/code/TextureTransform.cpp b/code/TextureTransform.cpp index 1fdb09ea2..3d41150bf 100644 --- a/code/TextureTransform.cpp +++ b/code/TextureTransform.cpp @@ -158,7 +158,7 @@ void TextureTransform::AddToList(std::vector& rasVec, (*i).fScaleU == pcTex->mScaleU && (*i).fScaleV == pcTex->mScaleV && (*i).fRotation == pcTex->mRotation && - (*i).iUVIndex == pcTex->iUVSrc) + (*i).iUVIndex == (unsigned int)pcTex->iUVSrc) { (*i).pcTextures.push_back(pcTex); return; @@ -577,4 +577,4 @@ void TextureTransform::SetupMatUVSrc (aiMaterial* pcMat, const Dot3DS::Material* pcHelper->AddProperty(&pcMatIn->sTexAmbient.iUVSrc,1, AI_MATKEY_UVWSRC_AMBIENT(0)); } -}; \ No newline at end of file +}; diff --git a/code/TriangulateProcess.h b/code/TriangulateProcess.h index c3a091772..445c22750 100644 --- a/code/TriangulateProcess.h +++ b/code/TriangulateProcess.h @@ -93,4 +93,4 @@ protected: } // end of namespace Assimp -#endif // AI_TRIANGULATEPROCESS_H_INC \ No newline at end of file +#endif // AI_TRIANGULATEPROCESS_H_INC diff --git a/code/ValidateDataStructure.cpp b/code/ValidateDataStructure.cpp index 85e758ea9..0a811bd8f 100644 --- a/code/ValidateDataStructure.cpp +++ b/code/ValidateDataStructure.cpp @@ -472,7 +472,7 @@ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial* pMaterial, } if (aiPTI_String != prop->mType) - this->ReportError("Material property %s is expected to be a string",prop->mKey); + this->ReportError("Material property %s is expected to be a string",prop->mKey.data); } } if (iIndex +1 != iNumIndices) @@ -491,7 +491,7 @@ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial* pMaterial, if (0 == ASSIMP_strincmp( prop->mKey.data, szBaseBuf, iLen )) { if (aiPTI_Integer != prop->mType || sizeof(int) > prop->mDataLength) - this->ReportError("Material property %s is expected to be an integer",prop->mKey); + this->ReportError("Material property %s is expected to be an integer",prop->mKey.data); const char* sz = &prop->mKey.data[iLen]; if (*sz) @@ -510,14 +510,14 @@ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial* pMaterial, for (unsigned int a = 0; a < this->mScene->mNumMeshes;++a) { aiMesh* mesh = this->mScene->mMeshes[a]; - if(mesh->mMaterialIndex == iIndex) + if(mesh->mMaterialIndex == (unsigned int)iIndex) { int iChannels = 0; while (mesh->HasTextureCoords(iChannels++)); if (iIndex >= iChannels) { this->ReportError("Invalid UV index: %i (key %s). Mesh %i has only %i UV channels", - iIndex,prop->mKey,a,iChannels); + iIndex,prop->mKey.data,a,iChannels); } } } @@ -598,6 +598,7 @@ void ValidateDSProcess::Validate( const aiMaterial* pMaterial) "AI_MATKEY_SHININESS_STRENGTH key is 0.0"); } break; + default: ; }; } diff --git a/code/ValidateDataStructure.h b/code/ValidateDataStructure.h index 1108820f6..a9a6e78b8 100644 --- a/code/ValidateDataStructure.h +++ b/code/ValidateDataStructure.h @@ -173,4 +173,4 @@ private: } // end of namespace Assimp -#endif // AI_VALIDATEPROCESS_H_INC \ No newline at end of file +#endif // AI_VALIDATEPROCESS_H_INC diff --git a/code/VertexTriangleAdjacency.cpp b/code/VertexTriangleAdjacency.cpp index 4a751ccd8..f67b6a6f1 100644 --- a/code/VertexTriangleAdjacency.cpp +++ b/code/VertexTriangleAdjacency.cpp @@ -133,4 +133,4 @@ VertexTriangleAdjacency::~VertexTriangleAdjacency() delete[] this->mOffsetTable; delete[] this->mAdjacencyTable; delete[] this->mLiveTriangles; -} \ No newline at end of file +} diff --git a/code/VertexTriangleAdjacency.h b/code/VertexTriangleAdjacency.h index b2fcc82f1..c762e10e1 100644 --- a/code/VertexTriangleAdjacency.h +++ b/code/VertexTriangleAdjacency.h @@ -123,4 +123,4 @@ public: }; } -#endif // !! AI_VTADJACENCY_H_INC \ No newline at end of file +#endif // !! AI_VTADJACENCY_H_INC diff --git a/code/XFileHelper.h b/code/XFileHelper.h index f13cab0ae..e4302ef87 100644 --- a/code/XFileHelper.h +++ b/code/XFileHelper.h @@ -197,4 +197,4 @@ struct Scene } // end of namespace XFile } // end of namespace Assimp -#endif // AI_XFILEHELPER_H_INC \ No newline at end of file +#endif // AI_XFILEHELPER_H_INC diff --git a/code/XFileImporter.cpp b/code/XFileImporter.cpp index 60ff258eb..cf9db9beb 100644 --- a/code/XFileImporter.cpp +++ b/code/XFileImporter.cpp @@ -54,6 +54,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using namespace Assimp; +#if _MSC_VER >= 1400 +# define sprintf sprintf_s +#endif + // ------------------------------------------------------------------------------------------------ // Constructor to be privately used by Importer XFileImporter::XFileImporter() @@ -153,9 +157,13 @@ void XFileImporter::CreateDataRepresentationFromImport( aiScene* pScene, const X mat->AddProperty( &shadeMode, 1, AI_MATKEY_SHADING_MODEL); // material colours int specExp = 1; - mat->AddProperty( &aiColor3D( 0, 0, 0), 1, AI_MATKEY_COLOR_EMISSIVE); - mat->AddProperty( &aiColor3D( 0.5f, 0.5f, 0.5f), 1, AI_MATKEY_COLOR_DIFFUSE); - mat->AddProperty( &aiColor3D( 0, 0, 0), 1, AI_MATKEY_COLOR_SPECULAR); + + aiColor3D clr = aiColor3D( 0, 0, 0); + mat->AddProperty( &clr, 1, AI_MATKEY_COLOR_EMISSIVE); + mat->AddProperty( &clr, 1, AI_MATKEY_COLOR_SPECULAR); + + clr = aiColor3D( 0.5f, 0.5f, 0.5f); + mat->AddProperty( &clr, 1, AI_MATKEY_COLOR_DIFFUSE); mat->AddProperty( &specExp, 1, AI_MATKEY_SHININESS); pScene->mMaterials = new aiMaterial*[1]; @@ -628,51 +636,27 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, const std::vector= 1400 - ::sprintf_s(key,AI_MATKEY_TEXTURE_HEIGHT_ "[%i]",iHM++); -#else ::sprintf(key,AI_MATKEY_TEXTURE_HEIGHT_ "[%i]",iHM++); -#endif } else if (otex.mIsNormalMap || std::string::npos != sz.find( "normal", s) || std::string::npos != sz.find("nm", s)) { -#if _MSC_VER >= 1400 - ::sprintf_s(key,AI_MATKEY_TEXTURE_NORMALS_ "[%i]",iNM++); -#else ::sprintf(key,AI_MATKEY_TEXTURE_NORMALS_ "[%i]",iNM++); -#endif } else if (std::string::npos != sz.find( "spec", s) || std::string::npos != sz.find( "glanz", s)) { -#if _MSC_VER >= 1400 - ::sprintf_s(key,AI_MATKEY_TEXTURE_SPECULAR_ "[%i]",iSM++); -#else ::sprintf(key,AI_MATKEY_TEXTURE_SPECULAR_ "[%i]",iSM++); -#endif } else if (std::string::npos != sz.find( "ambi", s) || std::string::npos != sz.find( "env", s)) { -#if _MSC_VER >= 1400 - ::sprintf_s(key,AI_MATKEY_TEXTURE_AMBIENT_ "[%i]",iAM++); -#else ::sprintf(key,AI_MATKEY_TEXTURE_AMBIENT_ "[%i]",iAM++); -#endif } else if (std::string::npos != sz.find( "emissive", s) || std::string::npos != sz.find( "self", s)) { -#if _MSC_VER >= 1400 - ::sprintf_s(key,AI_MATKEY_TEXTURE_EMISSIVE_ "[%i]",iEM++); -#else ::sprintf(key,AI_MATKEY_TEXTURE_EMISSIVE_ "[%i]",iEM++); -#endif } else { // assume it is a diffuse texture -#if _MSC_VER >= 1400 - ::sprintf_s(key,AI_MATKEY_TEXTURE_DIFFUSE_ "[%i]",iDM++); -#else ::sprintf(key,AI_MATKEY_TEXTURE_DIFFUSE_ "[%i]",iDM++); -#endif } // place texture filename property under the corresponding name @@ -686,3 +670,4 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, const std::vectormNumMaterials++; } } + diff --git a/code/XFileImporter.h b/code/XFileImporter.h index b929056bd..cb0abd928 100644 --- a/code/XFileImporter.h +++ b/code/XFileImporter.h @@ -154,4 +154,4 @@ protected: } // end of namespace Assimp -#endif // AI_BASEIMPORTER_H_INC \ No newline at end of file +#endif // AI_BASEIMPORTER_H_INC diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index 75bb806f9..e625c5fb3 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -391,9 +391,9 @@ void XFileParser::ParseDataObjectSkinMeshHeader( Mesh* pMesh) { readHeadOfDataObject(); - unsigned int maxSkinWeightsPerVertex = ReadInt(); - unsigned int maxSkinWeightsPerFace = ReadInt(); - unsigned int numBonesInMesh = ReadInt(); + /*unsigned int maxSkinWeightsPerVertex =*/ ReadInt(); + /*unsigned int maxSkinWeightsPerFace =*/ ReadInt(); + /*unsigned int numBonesInMesh = */ReadInt(); CheckForClosingBrace(); } @@ -478,7 +478,7 @@ void XFileParser::ParseDataObjectMeshMaterialList( Mesh* pMesh) readHeadOfDataObject(); // read material count - unsigned int numMaterials = ReadInt(); + /*unsigned int numMaterials =*/ ReadInt(); // read non triangulated face material index count unsigned int numMatIndices = ReadInt(); diff --git a/code/XFileParser.h b/code/XFileParser.h index 16f8be747..fca00a1a3 100644 --- a/code/XFileParser.h +++ b/code/XFileParser.h @@ -156,4 +156,4 @@ protected: }; } -#endif // AI_XFILEPARSER_H_INC \ No newline at end of file +#endif // AI_XFILEPARSER_H_INC diff --git a/code/aiAssert.cpp b/code/aiAssert.cpp index a194115d2..3fa8048b0 100644 --- a/code/aiAssert.cpp +++ b/code/aiAssert.cpp @@ -24,4 +24,4 @@ void Assimp::aiAssert (bool expression, const std::string &message, unsigned int exit (1); #endif } -} \ No newline at end of file +} diff --git a/code/extra/MakeVerboseFormat.cpp b/code/extra/MakeVerboseFormat.cpp index b052c368d..1c1f9c69f 100644 --- a/code/extra/MakeVerboseFormat.cpp +++ b/code/extra/MakeVerboseFormat.cpp @@ -217,4 +217,4 @@ bool MakeVerboseFormatProcess::MakeVerboseFormat(aiMesh* pcMesh) pcMesh->mBitangents = pvBitangents; } return (pcMesh->mNumVertices != iOldNumVertices); -} \ No newline at end of file +} diff --git a/code/makefile b/code/makefile index 50ffa044f..1d6c9672c 100644 --- a/code/makefile +++ b/code/makefile @@ -1,72 +1,71 @@ -#rough makefile for linux/gnu systems. requires that boost libs are installed -#produces shared library output in bin/libassimp.so - -SOURCES = \ - 3DSConverter.cpp \ - 3DSGenNormals.cpp \ - 3DSLoader.cpp \ - 3DSSpatialSort.cpp \ - aiAssert.cpp \ - ASELoader.cpp \ - ASEParser.cpp \ - Assimp.cpp \ - BaseImporter.cpp \ - BaseProcess.cpp \ - CalcTangentsProcess.cpp \ - ConvertToLHProcess.cpp \ - DefaultIOStream.cpp \ - DefaultIOSystem.cpp \ - DefaultLogger.cpp \ - extra/MakeVerboseFormat.cpp \ - FixNormalsStep.cpp \ - GenFaceNormalsProcess.cpp \ - GenVertexNormalsProcess.cpp \ - HMPLoader.cpp \ - Importer.cpp \ - ImproveCacheLocality.cpp \ - JoinVerticesProcess.cpp \ - KillNormalsProcess.cpp \ - LimitBoneWeightsProcess.cpp \ - LWOMaterial.cpp \ - LWOLoader.cpp \ - MaterialSystem.cpp \ - MD2Loader.cpp \ - MD3Loader.cpp \ - MD5Loader.cpp \ - MD5Parser.cpp \ - MDCLoader.cpp \ - MDLLoader.cpp \ - MDLMaterialLoader.cpp \ - ObjFileImporter.cpp \ - ObjFileMtlImporter.cpp \ - ObjFileParser.cpp \ - PlyLoader.cpp \ - PlyParser.cpp \ - PretransformVertices.cpp \ - RemoveComments.cpp \ - RemoveRedundantMaterials.cpp \ - SMDLoader.cpp \ - SpatialSort.cpp \ - SplitLargeMeshes.cpp \ - STLLoader.cpp \ - TextureTransform.cpp \ - TriangulateProcess.cpp \ - ValidateDataStructure.cpp \ - VertexTriangleAdjacency.cpp \ - XFileImporter.cpp \ - XFileParser.cpp - -OBJECTS = $(SOURCES:.cpp=.o) - -TARGET = ../bin/libassimp.so - -all: $(TARGET) - -$(TARGET): $(OBJECTS) - gcc -o $@ $(OBJECTS) -shared -lstdc++ -lboost_thread-mt -lboost_date_time-mt - -%.o:%.cpp - $(CXX) -g -Wall -c $? -o $@ -I../include -fPIC - -clean: - rm -f $(OBJECTS) $(TARGET) +#rough makefile for linux/gnu systems. requires that boost libs are installed +#produces shared library output in bin/libassimp.so + + +SOURCES = 3DSConverter.cpp \ + 3DSLoader.cpp \ + aiAssert.cpp \ + ASELoader.cpp \ + ASEParser.cpp \ + Assimp.cpp BaseImporter.cpp BaseProcess.cpp \ + CalcTangentsProcess.cpp \ + ConvertToLHProcess.cpp \ + DefaultIOStream.cpp \ + DefaultIOSystem.cpp \ + DefaultLogger.cpp \ + DXFLoader.cpp \ + FixNormalsStep.cpp \ + GenFaceNormalsProcess.cpp \ + GenVertexNormalsProcess.cpp \ + HMPLoader.cpp \ + Importer.cpp \ + ImproveCacheLocality.cpp \ + JoinVerticesProcess.cpp \ + KillNormalsProcess.cpp \ + LimitBoneWeightsProcess.cpp \ + LWOBLoader.cpp \ + LWOLoader.cpp \ + LWOMaterial.cpp \ + MaterialSystem.cpp \ + MD2Loader.cpp \ + MD3Loader.cpp \ + MD5Loader.cpp \ + MD5Parser.cpp \ + MDCLoader.cpp \ + MDLLoader.cpp \ + MDLMaterialLoader.cpp \ + NFFLoader.cpp \ + ObjFileImporter.cpp \ + ObjFileMtlImporter.cpp \ + ObjFileParser.cpp \ + OptimizeGraphProcess.cpp \ + PlyLoader.cpp \ + PlyParser.cpp \ + PretransformVertices.cpp \ + RemoveComments.cpp \ + RemoveRedundantMaterials.cpp \ + SGSpatialSort.cpp \ + SMDLoader.cpp \ + SpatialSort.cpp \ + SplitLargeMeshes.cpp \ + StandardShapes.cpp \ + STLLoader.cpp \ + TextureTransform.cpp \ + TriangulateProcess.cpp \ + ValidateDataStructure.cpp \ + VertexTriangleAdjacency.cpp \ + XFileImporter.cpp \ + XFileParser.cpp + +OBJECTS = $(SOURCES:.cpp=.o) + +TARGET = ./../bin/libassimp.so + +all: $(TARGET) + +$(TARGET): $(OBJECTS) + gcc -o $@ $(OBJECTS) -shared -lstdc++ +%.o:%.cpp + $(CXX) -g -Wall -c $? -o $@ -I../include -fPIC +clean: + rm -f $(OBJECTS) $(TARGET) diff --git a/code/Compiler/poppack1.h b/include/Compiler/poppack1.h similarity index 90% rename from code/Compiler/poppack1.h rename to include/Compiler/poppack1.h index f4f312377..3fc1e847a 100644 --- a/code/Compiler/poppack1.h +++ b/include/Compiler/poppack1.h @@ -13,4 +13,4 @@ #endif #undef PACK_STRUCT -#undef AI_PUSHPACK_IS_DEFINED \ No newline at end of file +#undef AI_PUSHPACK_IS_DEFINED diff --git a/code/Compiler/pushpack1.h b/include/Compiler/pushpack1.h similarity index 100% rename from code/Compiler/pushpack1.h rename to include/Compiler/pushpack1.h diff --git a/include/aiTypes.h b/include/aiTypes.h index 1c876a09b..1ad52d646 100644 --- a/include/aiTypes.h +++ b/include/aiTypes.h @@ -67,6 +67,8 @@ const size_t MAXLEN = 1024; # define MAXLEN 1024 #endif +#include "./Compiler/pushpack1.h" + // --------------------------------------------------------------------------- /** Represents a two-dimensional vector. */ @@ -82,7 +84,7 @@ struct aiVector2D //! X and y coordinates float x, y; -} ; +} PACK_STRUCT; // aiVector3D type moved to separate header due to size of operators // aiQuaternion type moved to separate header due to size of operators @@ -109,7 +111,7 @@ struct aiColor3D //! Red, green and blue color values float r, g, b; -}; +} PACK_STRUCT; // --------------------------------------------------------------------------- @@ -136,7 +138,9 @@ struct aiColor4D //! Red, green, blue and alpha color values float r, g, b, a; -}; +} PACK_STRUCT; + +#include "./Compiler/poppack1.h" // --------------------------------------------------------------------------- diff --git a/include/aiVector3D.h b/include/aiVector3D.h index c2164969d..494c2a152 100644 --- a/include/aiVector3D.h +++ b/include/aiVector3D.h @@ -48,6 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. extern "C" { #endif +#include "./Compiler/pushpack1.h" + // --------------------------------------------------------------------------- /** Represents a three-dimensional vector. */ struct aiVector3D @@ -85,7 +87,9 @@ struct aiVector3D #endif // __cplusplus float x, y, z; -}; +} PACK_STRUCT; + +#include "./Compiler/poppack1.h" #ifdef __cplusplus } // end extern "C" diff --git a/include/assimp.h b/include/assimp.h index 37960460d..45a52fa5c 100644 --- a/include/assimp.h +++ b/include/assimp.h @@ -181,4 +181,4 @@ ASSIMP_API void aiSetImportPropertyString(const char* szName, } #endif -#endif // AI_ASSIMP_H_INC \ No newline at end of file +#endif // AI_ASSIMP_H_INC