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
pull/1/head
aramis_acg 2008-09-12 20:25:11 +00:00
parent afdad92229
commit 8991496cf5
90 changed files with 421 additions and 415 deletions

View File

@ -60,7 +60,7 @@ http://www.jalix.org/ressources/graphics/3DS/_unofficials/3ds-unofficial.txt */
namespace Assimp { namespace Assimp {
namespace Dot3DS { namespace Dot3DS {
#include "./Compiler/pushpack1.h" #include "./../include/Compiler/pushpack1.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** Dot3DSFile class: Helper class for loading 3ds files. Defines chunks /** 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 //! data structure for a single chunk in a .3ds file
struct Chunk struct Chunk
{ {
unsigned short Flag; uint16_t Flag;
long Size; uint32_t Size;
} PACK_STRUCT; } PACK_STRUCT;
//! source for this used own structures, //! 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 */ /** Helper structure representing a 3ds mesh face */
@ -360,12 +360,12 @@ struct Material
Material() Material()
: :
mSpecularExponent (0.0f), mSpecularExponent (0.0f),
mShininessStrength (1.0f),
mShading(Dot3DSFile::Gouraud), mShading(Dot3DSFile::Gouraud),
mTransparency (1.0f), mTransparency (1.0f),
mBumpHeight (1.0f), mBumpHeight (1.0f),
iBakeUVTransform (0),
mShininessStrength (1.0f),
mTwoSided (false), mTwoSided (false),
iBakeUVTransform (0),
pcSingleTexture (NULL) pcSingleTexture (NULL)
{ {
static int iCnt = 0; static int iCnt = 0;

View File

@ -490,7 +490,7 @@ void Dot3DSImporter::ParseHierarchyChunk(int& piRemaining)
// pivot = origin of rotation and scaling // pivot = origin of rotation and scaling
this->mCurrentNode->vPivot = *((const aiVector3D*)this->mCurrent); 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); this->mCurrent += sizeof(aiVector3D);
break; break;
@ -734,8 +734,6 @@ void Dot3DSImporter::ParseMeshChunk(int& piRemaining)
Dot3DS::Mesh& mMesh = this->mScene->mMeshes.back(); Dot3DS::Mesh& mMesh = this->mScene->mMeshes.back();
// get chunk type // get chunk type
const unsigned char* sz = this->mCurrent;
unsigned int iCnt = 0;
int iRemaining; int iRemaining;
uint16_t iNum = 0; uint16_t iNum = 0;
float* pf; float* pf;
@ -749,7 +747,7 @@ void Dot3DSImporter::ParseMeshChunk(int& piRemaining)
{ {
mMesh.mPositions.push_back(*((aiVector3D*)this->mCurrent)); mMesh.mPositions.push_back(*((aiVector3D*)this->mCurrent));
aiVector3D& v = mMesh.mPositions.back(); aiVector3D& v = mMesh.mPositions.back();
std::swap( v.y, v.z); std::swap( (float&)v.y, (float&)v.z);
//v.y *= -1.0f; //v.y *= -1.0f;
this->mCurrent += sizeof(aiVector3D); this->mCurrent += sizeof(aiVector3D);
} }

View File

@ -525,7 +525,7 @@ void ASEImporter::BuildUniqueRepresentation(ASE::Mesh& mesh)
for (unsigned int n = 0; n < 3;++n,++iCurrent) for (unsigned int n = 0; n < 3;++n,++iCurrent)
{ {
mPositions[iCurrent] = mesh.mPositions[(*i).mIndices[n]]; 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 // add texture coordinates
for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS;++c) 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()) if (!mesh.mNormals.empty())
{ {
mNormals[iCurrent] = mesh.mNormals[(*i).mIndices[n]]; 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 // handle bone vertices
@ -743,7 +743,6 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
vSubMaterials.size()]; vSubMaterials.size()];
// build a list of all faces per submaterial // build a list of all faces per submaterial
unsigned int iNum = 0;
for (unsigned int i = 0; i < mesh.mFaces.size();++i) for (unsigned int i = 0; i < mesh.mFaces.size();++i)
{ {
// check range // check range

View File

@ -633,7 +633,6 @@ void Parser::ParseLV2MaterialBlock(ASE::Material& mat)
void Parser::ParseLV3MapBlock(Texture& map) void Parser::ParseLV3MapBlock(Texture& map)
{ {
int iDepth = 0; int iDepth = 0;
unsigned int iNumSubMaterials = 0;
while (true) while (true)
{ {
if ('*' == *this->m_szFile) if ('*' == *this->m_szFile)

View File

@ -195,8 +195,8 @@ struct DecompTransform
{ {
//! Construction from a reference to an existing matrix //! Construction from a reference to an existing matrix
DecompTransform(aiMatrix4x4& ref) DecompTransform(aiMatrix4x4& ref)
: vScaling(1.0f,1.0f,1.0f) : vPosition(std::numeric_limits<float>::quiet_NaN(),0.0f,0.0f)
, vPosition(std::numeric_limits<float>::quiet_NaN(),0.0f,0.0f) , vScaling(1.0f,1.0f,1.0f)
, mMatrix(ref) , mMatrix(ref)
{} {}

View File

@ -120,3 +120,4 @@ inline DefaultIOStream::DefaultIOStream (FILE* pFile,
} // ns assimp } // ns assimp
#endif //!!AI_DEFAULTIOSTREAM_H_INC #endif //!!AI_DEFAULTIOSTREAM_H_INC

View File

@ -52,10 +52,10 @@ inline void FileLogStream::write( const std::string &message )
{ {
if (m_pStream != NULL) 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()); message.size());
int i=0; /*int i=0;
i++; i++;*/
} }
} }

View File

@ -114,3 +114,4 @@ private:
} // end of namespace Assimp } // end of namespace Assimp
#endif // !!AI_GENVERTEXNORMALPROCESS_H_INC #endif // !!AI_GENVERTEXNORMALPROCESS_H_INC

View File

@ -56,7 +56,7 @@ inline void SetGenericProperty(std::map< uint32_t, T >& list,
uint32_t hash = SuperFastHash(szName); uint32_t hash = SuperFastHash(szName);
GenericPropertyMap::iterator it = list.find(hash); typename GenericPropertyMap::iterator it = list.find(hash);
if (it == list.end()) if (it == list.end())
{ {
if (bWasExisting)*bWasExisting = false; if (bWasExisting)*bWasExisting = false;
@ -80,7 +80,7 @@ inline T GetGenericProperty(const std::map< uint32_t, T >& list,
uint32_t hash = SuperFastHash(szName); 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; if (it == list.end())return errorReturn;
return (*it).second; return (*it).second;
} }

View File

@ -44,16 +44,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
namespace HMP { namespace HMP {
#include "./Compiler/pushpack1.h" #include "./../include/Compiler/pushpack1.h"
#define AI_HMP_MAGIC_NUMBER_BE_4 'HMP4' // to make it easier for ourselfes, we test the magic word against both "endianesses"
#define AI_HMP_MAGIC_NUMBER_LE_4 '4PMH' #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_BE_4 HMP_MAKE("HMP4")
#define AI_HMP_MAGIC_NUMBER_LE_5 '5PMH' #define AI_HMP_MAGIC_NUMBER_LE_4 HMP_MAKE("4PMH")
#define AI_HMP_MAGIC_NUMBER_BE_7 'HMP7' #define AI_HMP_MAGIC_NUMBER_BE_5 HMP_MAKE("HMP5")
#define AI_HMP_MAGIC_NUMBER_LE_7 '7PMH' #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. /** Data structure for the header of a HMP5 file.
@ -127,7 +130,7 @@ struct Vertex_HMP7
int8_t normal_x,normal_y; int8_t normal_x,normal_y;
} PACK_STRUCT; } PACK_STRUCT;
#include "./Compiler/poppack1.h" #include "./../include/Compiler/poppack1.h"
} //! namespace HMP } //! namespace HMP
} //! namespace Assimp } //! namespace Assimp

View File

@ -50,7 +50,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/DefaultLogger.h" #include "../include/DefaultLogger.h"
#include "../include/IOStream.h" #include "../include/IOStream.h"
#include "../include/IOSystem.h" #include "../include/IOSystem.h"
#include "../include/aiMesh.h"
#include "../include/aiScene.h" #include "../include/aiScene.h"
#include "../include/aiAssert.h" #include "../include/aiAssert.h"

View File

@ -157,3 +157,4 @@ private:
} // end of namespace Assimp } // end of namespace Assimp
#endif // AI_HMPIMPORTER_H_INC #endif // AI_HMPIMPORTER_H_INC

View File

@ -49,16 +49,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_MDLFILEHELPER2_H_INC #ifndef AI_MDLFILEHELPER2_H_INC
#define AI_MDLFILEHELPER2_H_INC #define AI_MDLFILEHELPER2_H_INC
#include "./Compiler/pushpack1.h" #include "./../include/Compiler/pushpack1.h"
#include "MDLFileData.h"
namespace Assimp { namespace Assimp {
namespace MDL { namespace MDL {
// magic bytes used in Half Life 2 MDL models // magic bytes used in Half Life 2 MDL models
#define AI_MDL_MAGIC_NUMBER_BE_HL2a 'IDST' #define AI_MDL_MAGIC_NUMBER_BE_HL2a MDL_MAKE("IDST")
#define AI_MDL_MAGIC_NUMBER_LE_HL2a 'TSDI' #define AI_MDL_MAGIC_NUMBER_LE_HL2a MDL_MAKE("TSDI")
#define AI_MDL_MAGIC_NUMBER_BE_HL2b 'IDSQ' #define AI_MDL_MAGIC_NUMBER_BE_HL2b MDL_MAKE("IDSQ")
#define AI_MDL_MAGIC_NUMBER_LE_HL2b 'QSDI' #define AI_MDL_MAGIC_NUMBER_LE_HL2b MDL_MAKE("QSDI")
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** \struct Header_HL2 /** \struct Header_HL2
@ -140,7 +142,7 @@ struct Header_HL2
int32_t transitionindex; int32_t transitionindex;
} PACK_STRUCT; } PACK_STRUCT;
#include "./Compiler/poppack1.h" #include "./../include/Compiler/poppack1.h"
} }
} // end namespaces } // end namespaces

View File

@ -271,7 +271,7 @@ void ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshN
const unsigned int dp = *p; const unsigned int dp = *p;
// the current vertex won't have any free triangles after this step // 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 // append the vertex to the dead-end stack
sDeadEndVStack.push(dp); sDeadEndVStack.push(dp);

View File

@ -134,7 +134,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
std::vector<Vertex> uniqueVertices; std::vector<Vertex> uniqueVertices;
uniqueVertices.reserve( pMesh->mNumVertices); 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. // For each vertex the index of the vertex it was replaced by.
std::vector<unsigned int> replaceIndex( pMesh->mNumVertices, 0xffffffff); std::vector<unsigned int> 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++) for( unsigned int b = 0; b < face.mNumIndices; b++)
{ {
const size_t index = face.mIndices[b]; const size_t index = face.mIndices[b];
face.mIndices[b] = replaceIndex[face.mIndices[b]]; face.mIndices[b] = replaceIndex[index];
} }
} }

View File

@ -175,7 +175,6 @@ void LWOImporter::LoadLWOBSurface(unsigned int size)
{ {
LE_NCONST uint8_t* const end = mFileBuffer + size; LE_NCONST uint8_t* const end = mFileBuffer + size;
uint32_t iCursor = 0;
mSurfaces->push_back( LWO::Surface () ); mSurfaces->push_back( LWO::Surface () );
LWO::Surface& surf = mSurfaces->back(); LWO::Surface& surf = mSurfaces->back();
LWO::Texture* pTex = NULL; LWO::Texture* pTex = NULL;

View File

@ -331,9 +331,9 @@ struct WeightChannel : public VMapEntry
struct Texture struct Texture
{ {
Texture() Texture()
: mStrength (1.0f) : mClipIdx(0xffffffff)
, mStrength (1.0f)
, mUVChannelIndex ("unknown") , mUVChannelIndex ("unknown")
, mClipIdx(0xffffffff)
{} {}
//! File name of the texture //! File name of the texture
@ -425,9 +425,9 @@ typedef std::vector < Clip > ClipList;
struct Layer struct Layer
{ {
Layer() Layer()
: mParent (0xffff) : mFaceIDXOfs(0)
, mFaceIDXOfs(0)
, mPointIDXOfs(0) , mPointIDXOfs(0)
, mParent (0xffff)
{} {}
/** Temporary point list from the file */ /** Temporary point list from the file */

View File

@ -321,7 +321,7 @@ void LWOImporter::InternReadFile( const std::string& pFile,
pf->mIndices = face.mIndices; pf->mIndices = face.mIndices;
pf->mNumIndices = face.mNumIndices; pf->mNumIndices = face.mNumIndices;
const_cast<unsigned int*>(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++; pf++;
} }
++p; ++p;
@ -365,7 +365,7 @@ void LWOImporter::GenerateNodeGraph(std::vector<aiNode*>& apcNodes)
for (unsigned int i = 0; i < apcNodes.size();++i) for (unsigned int i = 0; i < apcNodes.size();++i)
{ {
if (i == iCurParent)continue; if (i == iCurParent)continue;
if ( reinterpret_cast<uint16_t>(apcNodes[i]->mParent) == iCurParent)++numChilds; if ( (uint16_t)(uintptr_t)apcNodes[i]->mParent == iCurParent)++numChilds;
} }
if (numChilds) if (numChilds)
{ {
@ -377,7 +377,7 @@ void LWOImporter::GenerateNodeGraph(std::vector<aiNode*>& apcNodes)
for (unsigned int i = 0, p = 0; i < apcNodes.size();++i) for (unsigned int i = 0, p = 0; i < apcNodes.size();++i)
{ {
if (i == iCurParent)continue; if (i == iCurParent)continue;
uint16_t parent = reinterpret_cast<uint16_t>(apcNodes[i]->mParent); uint16_t parent = (uint16_t)(uintptr_t)(apcNodes[i]->mParent);
if (parent == iCurParent) if (parent == iCurParent)
{ {
node->mChildren[p++] = apcNodes[i]; node->mChildren[p++] = apcNodes[i];

View File

@ -129,7 +129,7 @@ void LWOImporter::FindVCChannels(const LWO::Surface& surf, const LWO::Layer& lay
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void LWOImporter::LoadLWO2ImageMap(unsigned int size, LWO::Texture& tex ) 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 ) 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 ) 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::Surface& surf = mSurfaces->back();
LWO::Texture tex; //LWO::Texture tex;
// now get the exact type of the texture // now get the exact type of the texture
} }

View File

@ -57,13 +57,16 @@ File format specification:
#include "../include/aiMesh.h" #include "../include/aiMesh.h"
#include "../include/aiAnim.h" #include "../include/aiAnim.h"
#include "./Compiler/pushpack1.h" #include "./../include/Compiler/pushpack1.h"
namespace Assimp { namespace Assimp {
namespace MD2 { namespace MD2 {
#define AI_MD2_MAGIC_NUMBER_BE 'IDP2' // to make it easier for ourselfes, we test the magic word against both "endianesses"
#define AI_MD2_MAGIC_NUMBER_LE '2PDI' #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 // common limitations
#define AI_MD2_VERSION 15 #define AI_MD2_VERSION 15
@ -153,7 +156,7 @@ struct Skin
char name[AI_MD2_MAXQPATH]; /* texture file name */ char name[AI_MD2_MAXQPATH]; /* texture file name */
} PACK_STRUCT; } 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 #endif // !! include guard

View File

@ -151,7 +151,7 @@ void MD2Importer::ValidateHeader( )
if (0 == this->m_pcHeader->numFrames) if (0 == this->m_pcHeader->numFrames)
throw new ImportErrorException( "Invalid md2 file: NUM_FRAMES is 0"); 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"); throw new ImportErrorException( "Invalid md2 file: File is too small");
if (this->m_pcHeader->offsetSkins + this->m_pcHeader->numSkins * sizeof (MD2::Skin) >= this->fileSize || if (this->m_pcHeader->offsetSkins + this->m_pcHeader->numSkins * sizeof (MD2::Skin) >= this->fileSize ||

View File

@ -52,13 +52,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/aiMesh.h" #include "../include/aiMesh.h"
#include "../include/aiAnim.h" #include "../include/aiAnim.h"
#include "./Compiler/pushpack1.h" #include "./../include/Compiler/pushpack1.h"
namespace Assimp { namespace Assimp {
namespace MD3 { namespace MD3 {
#define AI_MD3_MAGIC_NUMBER_BE 'IDP3' // to make it easier for ourselfes, we test the magic word against both "endianesses"
#define AI_MD3_MAGIC_NUMBER_LE '3PDI' #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 // common limitations
#define AI_MD3_VERSION 15 #define AI_MD3_VERSION 15
@ -230,7 +233,7 @@ struct Vertex
uint16_t NORMAL; uint16_t NORMAL;
} PACK_STRUCT; } PACK_STRUCT;
#include "./Compiler/poppack1.h" #include "./../include/Compiler/poppack1.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** \brief Unpack a Q3 16 bit vector to its full float3 representation /** \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 #endif // !! AI_MD3FILEHELPER_H_INC

View File

@ -195,7 +195,7 @@ void MakeDataUnique (MD5::MeshDesc& meshSrc)
void AttachChilds(int iParentID,aiNode* piParent,BoneList& bones) void AttachChilds(int iParentID,aiNode* piParent,BoneList& bones)
{ {
ai_assert(NULL != piParent && !piParent->mNumChildren); 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) // (avoid infinite recursion)
if (iParentID != i && bones[i].mParentIndex == iParentID) if (iParentID != i && bones[i].mParentIndex == iParentID)
@ -207,7 +207,7 @@ void AttachChilds(int iParentID,aiNode* piParent,BoneList& bones)
if (piParent->mNumChildren) if (piParent->mNumChildren)
{ {
piParent->mChildren = new aiNode*[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) // (avoid infinite recursion)
if (iParentID != i && bones[i].mParentIndex == iParentID) if (iParentID != i && bones[i].mParentIndex == iParentID)
@ -372,7 +372,7 @@ void MD5Importer::LoadMD5MeshFile ()
meshParser.mJoints[q].mMap = h++; meshParser.mJoints[q].mMap = h++;
} }
unsigned int g = 0; //unsigned int g = 0;
pv = mesh->mVertices; pv = mesh->mVertices;
for (MD5::VertexList::const_iterator for (MD5::VertexList::const_iterator
iter = meshSrc.mVertices.begin(); iter = meshSrc.mVertices.begin();
@ -410,7 +410,7 @@ void MD5Importer::LoadMD5MeshFile ()
*bone->mWeights++ = aiVertexWeight((unsigned int)(pv-mesh->mVertices),fNewWeight); *bone->mWeights++ = aiVertexWeight((unsigned int)(pv-mesh->mVertices),fNewWeight);
} }
// convert from DOOM coordinate system to OGL // 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 ... // undo our nice offset tricks ...

View File

@ -205,11 +205,11 @@ bool MD5Parser::ParseSection(Section& out)
if ('(' != *sz++) \ if ('(' != *sz++) \
MD5Parser::ReportWarning("Unexpected token: ( was expected",(*eit).iLineNumber); \ MD5Parser::ReportWarning("Unexpected token: ( was expected",(*eit).iLineNumber); \
AI_MD5_SKIP_SPACES(); \ AI_MD5_SKIP_SPACES(); \
sz = fast_atof_move(sz,vec.x); \ sz = fast_atof_move(sz,(float&)vec.x); \
AI_MD5_SKIP_SPACES(); \ AI_MD5_SKIP_SPACES(); \
sz = fast_atof_move(sz,vec.y); \ sz = fast_atof_move(sz,(float&)vec.y); \
AI_MD5_SKIP_SPACES(); \ AI_MD5_SKIP_SPACES(); \
sz = fast_atof_move(sz,vec.z); \ sz = fast_atof_move(sz,(float&)vec.z); \
AI_MD5_SKIP_SPACES(); \ AI_MD5_SKIP_SPACES(); \
if (')' != *sz++) \ if (')' != *sz++) \
MD5Parser::ReportWarning("Unexpected token: ) was expected",(*eit).iLineNumber); MD5Parser::ReportWarning("Unexpected token: ) was expected",(*eit).iLineNumber);
@ -354,9 +354,9 @@ MD5MeshParser::MD5MeshParser(SectionList& mSections)
if ('(' != *sz++) if ('(' != *sz++)
MD5Parser::ReportWarning("Unexpected token: ( was expected",(*eit).iLineNumber); MD5Parser::ReportWarning("Unexpected token: ( was expected",(*eit).iLineNumber);
AI_MD5_SKIP_SPACES(); 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(); 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(); AI_MD5_SKIP_SPACES();
if (')' != *sz++) if (')' != *sz++)
MD5Parser::ReportWarning("Unexpected token: ) was expected",(*eit).iLineNumber); MD5Parser::ReportWarning("Unexpected token: ) was expected",(*eit).iLineNumber);

View File

@ -53,14 +53,18 @@ http://themdcfile.planetwolfenstein.gamespy.com/MDC_File_Format.pdf
#include "../include/aiMesh.h" #include "../include/aiMesh.h"
#include "../include/aiAnim.h" #include "../include/aiAnim.h"
#include "./Compiler/pushpack1.h" #include "./../include/Compiler/pushpack1.h"
namespace Assimp { namespace Assimp {
namespace MDC { 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 // common limitations
#define AI_MDC_VERSION 2 #define AI_MDC_VERSION 2
@ -181,7 +185,7 @@ struct Shader
} PACK_STRUCT; } PACK_STRUCT;
#include "./Compiler/poppack1.h" #include "./../include/Compiler/poppack1.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@ -130,3 +130,4 @@ protected:
} // end of namespace Assimp } // end of namespace Assimp
#endif // AI_3DSIMPORTER_H_INC #endif // AI_3DSIMPORTER_H_INC

View File

@ -58,36 +58,35 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/aiAnim.h" #include "../include/aiAnim.h"
#include "../include/aiMaterial.h" #include "../include/aiMaterial.h"
#include "./Compiler/pushpack1.h" #include "./../include/Compiler/pushpack1.h"
namespace Assimp { namespace Assimp {
namespace MDL { 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 // magic bytes used in Quake 1 MDL meshes
#define AI_MDL_MAGIC_NUMBER_BE 'IDPO' #define AI_MDL_MAGIC_NUMBER_BE MDL_MAKE("IDPO")
#define AI_MDL_MAGIC_NUMBER_LE 'OPDI' #define AI_MDL_MAGIC_NUMBER_LE MDL_MAKE("OPDI")
// magic bytes used in GameStudio A<very low> MDL meshes // magic bytes used in GameStudio A<very low> MDL meshes
#define AI_MDL_MAGIC_NUMBER_BE_GS3 'MDL2' #define AI_MDL_MAGIC_NUMBER_BE_GS3 MDL_MAKE("MDL2")
#define AI_MDL_MAGIC_NUMBER_LE_GS3 '2LDM' #define AI_MDL_MAGIC_NUMBER_LE_GS3 MDL_MAKE("2LDM")
// magic bytes used in GameStudio A4 MDL meshes // magic bytes used in GameStudio A4 MDL meshes
#define AI_MDL_MAGIC_NUMBER_BE_GS4 'MDL3' #define AI_MDL_MAGIC_NUMBER_BE_GS4 MDL_MAKE("MDL3")
#define AI_MDL_MAGIC_NUMBER_LE_GS4 '3LDM' #define AI_MDL_MAGIC_NUMBER_LE_GS4 MDL_MAKE("3LDM")
// magic bytes used in GameStudio A5+ MDL meshes // magic bytes used in GameStudio A5+ MDL meshes
#define AI_MDL_MAGIC_NUMBER_BE_GS5a 'MDL4' #define AI_MDL_MAGIC_NUMBER_BE_GS5a MDL_MAKE("MDL4")
#define AI_MDL_MAGIC_NUMBER_LE_GS5a '4LDM' #define AI_MDL_MAGIC_NUMBER_LE_GS5a MDL_MAKE("4LDM")
#define AI_MDL_MAGIC_NUMBER_BE_GS5b 'MDL5' #define AI_MDL_MAGIC_NUMBER_BE_GS5b MDL_MAKE("MDL5")
#define AI_MDL_MAGIC_NUMBER_LE_GS5b '5LDM' #define AI_MDL_MAGIC_NUMBER_LE_GS5b MDL_MAKE("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'
// magic bytes used in GameStudio A7+ MDL meshes // magic bytes used in GameStudio A7+ MDL meshes
#define AI_MDL_MAGIC_NUMBER_BE_GS7 'MDL7' #define AI_MDL_MAGIC_NUMBER_BE_GS7 MDL_MAKE("MDL7")
#define AI_MDL_MAGIC_NUMBER_LE_GS7 '7LDM' #define AI_MDL_MAGIC_NUMBER_LE_GS7 MDL_MAKE("7LDM")
// common limitations for Quake1 meshes. The loader does not check them, // common limitations for Quake1 meshes. The loader does not check them,
@ -121,7 +120,7 @@ namespace MDL {
struct Header struct Header
{ {
//! magic number: "IDPO" //! magic number: "IDPO"
int32_t ident; uint32_t ident;
//! version number: 6 //! version number: 6
int32_t version; int32_t version;
@ -730,7 +729,7 @@ struct GroupFrame
SimpleFrame *frames; SimpleFrame *frames;
} PACK_STRUCT; } PACK_STRUCT;
#include "./Compiler/poppack1.h" #include "./../include/Compiler/poppack1.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -815,7 +814,8 @@ struct IntFrameInfo_MDL7
{ {
//! Construction from an existing frame header //! Construction from an existing frame header
IntFrameInfo_MDL7(const MDL::Frame_MDL7* _pcFrame,unsigned int _iIndex) IntFrameInfo_MDL7(const MDL::Frame_MDL7* _pcFrame,unsigned int _iIndex)
: pcFrame(_pcFrame), iIndex(_iIndex) : iIndex(_iIndex)
, pcFrame(_pcFrame)
{} {}
//! Index of the frame //! Index of the frame
@ -830,16 +830,18 @@ struct IntFrameInfo_MDL7
struct IntGroupInfo_MDL7 struct IntGroupInfo_MDL7
{ {
//! Default constructor //! Default constructor
IntGroupInfo_MDL7() : IntGroupInfo_MDL7()
iIndex(0), : iIndex(0)
pcGroup(NULL), pcGroupUVs(NULL), , pcGroup(NULL)
pcGroupTris(NULL), pcGroupVerts(NULL) , pcGroupUVs(NULL)
, pcGroupTris(NULL)
, pcGroupVerts(NULL)
{} {}
//! Construction from an existing group header //! Construction from an existing group header
IntGroupInfo_MDL7(const MDL::Group_MDL7* _pcGroup,unsigned int _iIndex) IntGroupInfo_MDL7(const MDL::Group_MDL7* _pcGroup,unsigned int _iIndex)
: : iIndex(_iIndex)
pcGroup(_pcGroup),iIndex(_iIndex) , pcGroup(_pcGroup)
{} {}
//! Index of the group //! Index of the group

View File

@ -198,14 +198,6 @@ void MDLImporter::InternReadFile( const std::string& pFile,
this->iGSFileVersion = 5; this->iGSFileVersion = 5;
this->InternReadFile_3DGS_MDL345(); 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 // GameStudio A7 MDL7 format
else if (AI_MDL_MAGIC_NUMBER_BE_GS7 == iMagicWord || else if (AI_MDL_MAGIC_NUMBER_BE_GS7 == iMagicWord ||
AI_MDL_MAGIC_NUMBER_LE_GS7 == iMagicWord) AI_MDL_MAGIC_NUMBER_LE_GS7 == iMagicWord)
@ -1990,5 +1982,5 @@ void MDLImporter::JoinSkins_3DGS_MDL7(
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void MDLImporter::InternReadFile_HL2( ) void MDLImporter::InternReadFile_HL2( )
{ {
const MDL::Header_HL2* pcHeader = (const MDL::Header_HL2*)this->mBuffer; //const MDL::Header_HL2* pcHeader = (const MDL::Header_HL2*)this->mBuffer;
} }

View File

@ -46,21 +46,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/aiMesh.h" #include "../include/aiMesh.h"
#include "../include/aiAnim.h" #include "../include/aiAnim.h"
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) #include "./../include/Compiler/pushpack1.h"
# pragma pack(push,1)
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error Compiler not supported
#endif
namespace Assimp { namespace Assimp {
namespace MDR { namespace MDR {
#define AI_MDR_MAGIC_NUMBER_BE 'RDM5' // to make it easier for ourselfes, we test the magic word against both "endianesses"
#define AI_MDR_MAGIC_NUMBER_LE '5MDR' #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 // common limitations
#define AI_MDR_VERSION 2 #define AI_MDR_VERSION 2
@ -224,12 +219,7 @@ struct Header
} PACK_STRUCT; } PACK_STRUCT;
// reset packing to the original value #include "./../include/Compiler/poppack1.h"
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop )
#endif
#undef PACK_STRUCT
}; };
}; };

View File

@ -106,7 +106,7 @@ bool GetNextLine(const char*& buffer, char out[4096])
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
#define AI_NFF_PARSE_FLOAT(f) \ #define AI_NFF_PARSE_FLOAT(f) \
SkipSpaces(&sz); \ 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) \ #define AI_NFF_PARSE_TRIPLE(v) \
@ -160,7 +160,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
char line[4096]; char line[4096];
const char* sz; const char* sz;
unsigned int sphere = 0,cylinder = 0,cone = 0,numNamed = 0, 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)) while (GetNextLine(buffer,line))
{ {
@ -223,11 +223,11 @@ void NFFImporter::InternReadFile( const std::string& pFile,
SkipSpaces(&line[1],&sz); SkipSpaces(&line[1],&sz);
// read just the RGB colors, the rest is ignored for the moment // 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); SkipSpaces(&sz);
sz = fast_atof_move(sz, s.color.g); sz = fast_atof_move(sz, (float&)s.color.g);
SkipSpaces(&sz); 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 - // check whether we have this material already -
// although we have the RRM-Step, this is necessary here. // 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(); AI_NFF_PARSE_SHAPE_INFORMATION();
// we don't need scaling or translation here - we do it in the node's transform // 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); currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
// generate a name for the mesh // generate a name for the mesh
@ -287,7 +287,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
AI_NFF_PARSE_SHAPE_INFORMATION(); AI_NFF_PARSE_SHAPE_INFORMATION();
// we don't need scaling or translation here - we do it in the node's transform // 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); currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
// generate a name for the mesh // generate a name for the mesh
@ -305,11 +305,11 @@ void NFFImporter::InternReadFile( const std::string& pFile,
AI_NFF_PARSE_SHAPE_INFORMATION(); AI_NFF_PARSE_SHAPE_INFORMATION();
// we don't need scaling or translation here - we do it in the node's transform // 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); currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
// generate a name for the mesh // generate a name for the mesh
::sprintf(currentMesh.name,"octecahedron_%i",octecahedron++); ::sprintf(currentMesh.name,"octahedron_%i",octahedron++);
} }
// 'tet' - tetrahedron // 'tet' - tetrahedron
@ -323,7 +323,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
AI_NFF_PARSE_SHAPE_INFORMATION(); AI_NFF_PARSE_SHAPE_INFORMATION();
// we don't need scaling or translation here - we do it in the node's transform // 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); currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
// generate a name for the mesh // generate a name for the mesh
@ -341,7 +341,7 @@ void NFFImporter::InternReadFile( const std::string& pFile,
AI_NFF_PARSE_SHAPE_INFORMATION(); AI_NFF_PARSE_SHAPE_INFORMATION();
// we don't need scaling or translation here - we do it in the node's transform // 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); currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
// generate a name for the mesh // generate a name for the mesh

View File

@ -56,8 +56,8 @@ ObjFileMtlImporter::ObjFileMtlImporter( std::vector<char> &buffer,
ObjFile::Model *pModel ) : ObjFile::Model *pModel ) :
m_DataIt( buffer.begin() ), m_DataIt( buffer.begin() ),
m_DataItEnd( buffer.end() ), m_DataItEnd( buffer.end() ),
m_uiLine( 0 ), m_pModel( pModel ),
m_pModel( pModel ) m_uiLine( 0 )
{ {
ai_assert ( NULL != m_pModel ); ai_assert ( NULL != m_pModel );
if ( NULL == m_pModel->m_pDefaultMaterial ) if ( NULL == m_pModel->m_pDefaultMaterial )

View File

@ -411,7 +411,7 @@ void ObjFileParser::getMaterialLib()
size_t size = pFile->FileSize(); size_t size = pFile->FileSize();
std::vector<char> buffer; std::vector<char> buffer;
buffer.resize( size ); buffer.resize( size );
size_t read_size = pFile->Read( &buffer[ 0 ], sizeof( char ), size ); pFile->Read( &buffer[ 0 ], sizeof( char ), size );
FileSystem.Close( pFile ); FileSystem.Close( pFile );
// Importing the material library // Importing the material library
@ -494,7 +494,7 @@ void ObjFileParser::getGroupName()
ObjFile::Model::ConstGroupMapIt it = m_pModel->m_Groups.find(&strGroupName); ObjFile::Model::ConstGroupMapIt it = m_pModel->m_Groups.find(&strGroupName);
// New group name, creating a new entry // 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()) if (it == m_pModel->m_Groups.end())
{ {
std::vector<unsigned int> *pFaceIDArray = new std::vector<unsigned int>; std::vector<unsigned int> *pFaceIDArray = new std::vector<unsigned int>;

View File

@ -417,10 +417,11 @@ void OptimizeGraphProcess::JoinBones(
wmit = (*it).pSrcBones.begin(); wmit != wend; ++wmit) wmit = (*it).pSrcBones.begin(); wmit != wend; ++wmit)
{ {
aiBone* pip = (*wmit).first; 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]); const aiVertexWeight& vfi = pip->mWeights[mp];
vf.mVertexId += (*wmit).second; 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) 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; aiMatrix4x4 mMatTransform = pNode->mTransformation;
// transformation: first back to the parent's local space, // transformation: first back to the parent's local space,

View File

@ -593,6 +593,7 @@ float PLYImporter::NormalizeColorValue (PLY::PropertyInstance::ValueUnion val,
return (float)val.iUInt / (float)0xFFFF; return (float)val.iUInt / (float)0xFFFF;
case EDT_Int: case EDT_Int:
return ((float)val.iInt / (float)0xFF) + 0.5f; return ((float)val.iInt / (float)0xFF) + 0.5f;
default: ;
}; };
return 0.0f; return 0.0f;
} }

View File

@ -60,10 +60,7 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
PLY::EDataType PLY::Property::ParseDataType(const char* p_szIn,const char** p_szOut) PLY::EDataType PLY::Property::ParseDataType(const char* p_szIn,const char** p_szOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut);
ai_assert(NULL != p_szOut);
PLY::EDataType eOut = PLY::EDT_INVALID; PLY::EDataType eOut = PLY::EDT_INVALID;
if (0 == ASSIMP_strincmp(p_szIn,"char",4) || 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) PLY::ESemantic PLY::Property::ParseSemantic(const char* p_szIn,const char** p_szOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut);
ai_assert(NULL != p_szOut);
PLY::ESemantic eOut = PLY::EST_INVALID; PLY::ESemantic eOut = PLY::EST_INVALID;
if (0 == ASSIMP_strincmp(p_szIn,"red",3)) if (0 == ASSIMP_strincmp(p_szIn,"red",3))
@ -330,8 +326,7 @@ bool PLY::Property::ParseProperty (const char* p_szIn,
const char** p_szOut, const char** p_szOut,
PLY::Property* pOut) PLY::Property* pOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut);
ai_assert(NULL != p_szOut);
// Forms supported: // Forms supported:
// "property float x" // "property float x"
@ -405,9 +400,7 @@ bool PLY::Property::ParseProperty (const char* p_szIn,
PLY::EElementSemantic PLY::Element::ParseSemantic(const char* p_szIn, PLY::EElementSemantic PLY::Element::ParseSemantic(const char* p_szIn,
const char** p_szOut) const char** p_szOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut);
ai_assert(NULL != p_szOut);
PLY::EElementSemantic eOut = PLY::EEST_INVALID; PLY::EElementSemantic eOut = PLY::EEST_INVALID;
if (0 == ASSIMP_strincmp(p_szIn,"vertex",6)) if (0 == ASSIMP_strincmp(p_szIn,"vertex",6))
{ {
@ -455,9 +448,7 @@ bool PLY::Element::ParseElement (const char* p_szIn,
const char** p_szOut, const char** p_szOut,
PLY::Element* pOut) PLY::Element* pOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != pOut);
ai_assert(NULL != p_szOut);
ai_assert(NULL != pOut);
// Example format: "element vertex 8" // Example format: "element vertex 8"
*p_szOut = p_szIn; *p_szOut = p_szIn;
@ -514,9 +505,7 @@ bool PLY::Element::ParseElement (const char* p_szIn,
bool PLY::DOM::SkipComments (const char* p_szIn, bool PLY::DOM::SkipComments (const char* p_szIn,
const char** p_szOut) const char** p_szOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut);
ai_assert(NULL != p_szOut);
*p_szOut = p_szIn; *p_szOut = p_szIn;
// skip spaces // 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) bool PLY::DOM::ParseHeader (const char* p_szIn,const char** p_szOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut);
ai_assert(NULL != p_szOut);
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin"); DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin");
// after ply and format line // after ply and format line
const char* szMax = *p_szOut;
*p_szOut = p_szIn; *p_szOut = p_szIn;
// parse all elements // parse all elements
@ -578,12 +564,9 @@ bool PLY::DOM::ParseElementInstanceLists (
const char* p_szIn, const char* p_szIn,
const char** p_szOut) const char** p_szOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut);
ai_assert(NULL != p_szOut);
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceLists() begin"); DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceLists() begin");
const char* szMax = *p_szOut;
*p_szOut = p_szIn; *p_szOut = p_szIn;
this->alElementData.resize(this->alElements.size()); this->alElementData.resize(this->alElements.size());
@ -608,8 +591,7 @@ bool PLY::DOM::ParseElementInstanceListsBinary (
const char** p_szOut, const char** p_szOut,
bool p_bBE) bool p_bBE)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut);
ai_assert(NULL != p_szOut);
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceListsBinary() begin"); DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceListsBinary() begin");
*p_szOut = p_szIn; *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) bool PLY::DOM::ParseInstanceBinary (const char* p_szIn,DOM* p_pcOut,bool p_bBE)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_pcOut);
ai_assert(NULL != p_pcOut);
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin"); DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin");
@ -680,12 +661,7 @@ bool PLY::ElementInstanceList::ParseInstanceList (
const PLY::Element* pcElement, const PLY::Element* pcElement,
PLY::ElementInstanceList* p_pcOut) PLY::ElementInstanceList* p_pcOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != pcElement && NULL != p_pcOut);
ai_assert(NULL != p_szOut);
ai_assert(NULL != pcElement);
ai_assert(NULL != p_pcOut);
const char* szMax = *p_szOut;
if (EEST_INVALID == pcElement->eSemantic) if (EEST_INVALID == pcElement->eSemantic)
{ {
@ -722,10 +698,7 @@ bool PLY::ElementInstanceList::ParseInstanceListBinary (
PLY::ElementInstanceList* p_pcOut, PLY::ElementInstanceList* p_pcOut,
bool p_bBE /* = false */) bool p_bBE /* = false */)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != pcElement && NULL != p_pcOut);
ai_assert(NULL != p_szOut);
ai_assert(NULL != pcElement);
ai_assert(NULL != p_pcOut);
// we can add special handling code for unknown element semantics since // 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 // 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, const PLY::Element* pcElement,
PLY::ElementInstance* p_pcOut) PLY::ElementInstance* p_pcOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != pcElement && NULL != p_pcOut);
ai_assert(NULL != p_szOut);
ai_assert(NULL != pcElement);
ai_assert(NULL != p_pcOut);
if (!SkipSpaces(p_szIn, &p_szIn))return false; if (!SkipSpaces(p_szIn, &p_szIn))return false;
@ -785,10 +755,7 @@ bool PLY::ElementInstance::ParseInstanceBinary (
PLY::ElementInstance* p_pcOut, PLY::ElementInstance* p_pcOut,
bool p_bBE /* = false */) bool p_bBE /* = false */)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != pcElement && NULL != p_pcOut);
ai_assert(NULL != p_szOut);
ai_assert(NULL != pcElement);
ai_assert(NULL != p_pcOut);
// allocate enough storage // allocate enough storage
p_pcOut->alProperties.resize(pcElement->alProperties.size()); 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, bool PLY::PropertyInstance::ParseInstance (const char* p_szIn,const char** p_szOut,
const PLY::Property* prop, PLY::PropertyInstance* p_pcOut) const PLY::Property* prop, PLY::PropertyInstance* p_pcOut)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != prop && NULL != p_pcOut);
ai_assert(NULL != p_szOut);
ai_assert(NULL != prop);
ai_assert(NULL != p_pcOut);
*p_szOut = p_szIn; *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, bool PLY::PropertyInstance::ParseInstanceBinary (const char* p_szIn,const char** p_szOut,
const PLY::Property* prop, PLY::PropertyInstance* p_pcOut,bool p_bBE) const PLY::Property* prop, PLY::PropertyInstance* p_pcOut,bool p_bBE)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != prop && NULL != p_pcOut);
ai_assert(NULL != p_szOut);
ai_assert(NULL != prop);
ai_assert(NULL != p_pcOut);
if (prop->bIsList) if (prop->bIsList)
{ {
@ -902,6 +863,8 @@ PLY::PropertyInstance::ValueUnion PLY::PropertyInstance::DefaultValue(
case EDT_Double: case EDT_Double:
out.fDouble = 0.0; out.fDouble = 0.0;
return out; return out;
default: ;
}; };
out.iUInt = 0; out.iUInt = 0;
return out; return out;
@ -910,9 +873,7 @@ PLY::PropertyInstance::ValueUnion PLY::PropertyInstance::DefaultValue(
bool PLY::PropertyInstance::ParseValue(const char* p_szIn,const char** p_szOut, bool PLY::PropertyInstance::ParseValue(const char* p_szIn,const char** p_szOut,
PLY::EDataType eType,PLY::PropertyInstance::ValueUnion* out) PLY::EDataType eType,PLY::PropertyInstance::ValueUnion* out)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != out);
ai_assert(NULL != p_szOut);
ai_assert(NULL != out);
switch (eType) switch (eType)
{ {
@ -956,6 +917,7 @@ bool PLY::PropertyInstance::ParseValue(const char* p_szIn,const char** p_szOut,
float f; float f;
p_szIn = fast_atof_move(p_szIn,f); p_szIn = fast_atof_move(p_szIn,f);
out->fDouble = (double)f; out->fDouble = (double)f;
break;
default: default:
*p_szOut = p_szIn; *p_szOut = p_szIn;
@ -972,9 +934,7 @@ bool PLY::PropertyInstance::ParseValueBinary(
PLY::PropertyInstance::ValueUnion* out, PLY::PropertyInstance::ValueUnion* out,
bool p_bBE) bool p_bBE)
{ {
ai_assert(NULL != p_szIn); ai_assert(NULL != p_szIn && NULL != p_szOut && NULL != out);
ai_assert(NULL != p_szOut);
ai_assert(NULL != out);
switch (eType) switch (eType)
{ {

View File

@ -264,7 +264,8 @@ public:
//! Default constructor //! Default constructor
Element() Element()
: NumOccur(0), eSemantic (EEST_INVALID) : eSemantic (EEST_INVALID)
, NumOccur(0)
{} {}
//! Destructor. Dallocates all storage //! Destructor. Dallocates all storage
@ -548,6 +549,7 @@ TYPE PLY::PropertyInstance::ConvertTo(
case EDT_Short: case EDT_Short:
case EDT_Char: case EDT_Char:
return (TYPE)v.iInt; return (TYPE)v.iInt;
default: ;
}; };
return (TYPE)0; return (TYPE)0;
} }

View File

@ -101,6 +101,7 @@ void CommentRemover::RemoveMultiLineComments(const char* szCommentStart,
++szBuffer; ++szBuffer;
__continue_outer: __continue_outer:
int i = 4; // NOP dummy int i = 4; // NOP dummy
++i;
} }
} }

View File

@ -140,3 +140,4 @@ void SGSpatialSort::FindPositions( const aiVector3D& pPosition,
} }
} }

View File

@ -712,7 +712,7 @@ void SMDImporter::ParseFile()
DefaultLogger::get()->warn("SMD.version is not 1. This " DefaultLogger::get()->warn("SMD.version is not 1. This "
"file format is not known. Continuing happily ..."); "file format is not known. Continuing happily ...");
} }
//continue; continue;
} }
// "nodes\n" - Starts the node section // "nodes\n" - Starts the node section
if (0 == ASSIMP_strincmp(szCurrent,"nodes",5) && if (0 == ASSIMP_strincmp(szCurrent,"nodes",5) &&
@ -720,7 +720,7 @@ void SMDImporter::ParseFile()
{ {
szCurrent += 6; szCurrent += 6;
this->ParseNodesSection(szCurrent,&szCurrent); this->ParseNodesSection(szCurrent,&szCurrent);
//continue; continue;
} }
// "triangles\n" - Starts the triangle section // "triangles\n" - Starts the triangle section
if (0 == ASSIMP_strincmp(szCurrent,"triangles",9) && if (0 == ASSIMP_strincmp(szCurrent,"triangles",9) &&
@ -728,7 +728,7 @@ void SMDImporter::ParseFile()
{ {
szCurrent += 10; szCurrent += 10;
this->ParseTrianglesSection(szCurrent,&szCurrent); this->ParseTrianglesSection(szCurrent,&szCurrent);
//continue; continue;
} }
// "vertexanimation\n" - Starts the vertex animation section // "vertexanimation\n" - Starts the vertex animation section
if (0 == ASSIMP_strincmp(szCurrent,"vertexanimation",15) && if (0 == ASSIMP_strincmp(szCurrent,"vertexanimation",15) &&
@ -737,7 +737,7 @@ void SMDImporter::ParseFile()
this->bHasUVs = false; this->bHasUVs = false;
szCurrent += 16; szCurrent += 16;
this->ParseVASection(szCurrent,&szCurrent); this->ParseVASection(szCurrent,&szCurrent);
//continue; continue;
} }
// "skeleton\n" - Starts the skeleton section // "skeleton\n" - Starts the skeleton section
if (0 == ASSIMP_strincmp(szCurrent,"skeleton",8) && if (0 == ASSIMP_strincmp(szCurrent,"skeleton",8) &&
@ -745,9 +745,9 @@ void SMDImporter::ParseFile()
{ {
szCurrent += 9; szCurrent += 9;
this->ParseSkeletonSection(szCurrent,&szCurrent); this->ParseSkeletonSection(szCurrent,&szCurrent);
//continue; continue;
} }
else SkipLine(szCurrent,&szCurrent); SkipLine(szCurrent,&szCurrent);
} }
return; return;
} }
@ -782,8 +782,8 @@ void SMDImporter::ParseNodesSection(const char* szCurrent,
} }
this->ParseNodeInfo(szCurrent,&szCurrent); this->ParseNodeInfo(szCurrent,&szCurrent);
} }
*szCurrentOut = szCurrent;
SkipSpacesAndLineEnd(szCurrent,&szCurrent); SkipSpacesAndLineEnd(szCurrent,&szCurrent);
*szCurrentOut = szCurrent;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Parse the triangles section of the file // Parse the triangles section of the file
@ -805,8 +805,8 @@ void SMDImporter::ParseTrianglesSection(const char* szCurrent,
} }
this->ParseTriangle(szCurrent,&szCurrent); this->ParseTriangle(szCurrent,&szCurrent);
} }
*szCurrentOut = szCurrent;
SkipSpacesAndLineEnd(szCurrent,&szCurrent); SkipSpacesAndLineEnd(szCurrent,&szCurrent);
*szCurrentOut = szCurrent;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Parse the vertex animation section of the file // Parse the vertex animation section of the file
@ -823,7 +823,7 @@ void SMDImporter::ParseVASection(const char* szCurrent,
IsSpaceOrNewLine(*(szCurrent+3))) IsSpaceOrNewLine(*(szCurrent+3)))
{ {
szCurrent += 4; szCurrent += 4;
SkipLine(szCurrent,&szCurrent); //SkipLine(szCurrent,&szCurrent);
break; break;
} }
// "time <n>\n" // "time <n>\n"
@ -834,7 +834,7 @@ void SMDImporter::ParseVASection(const char* szCurrent,
// NOTE: The doc says that time values COULD be negative ... // NOTE: The doc says that time values COULD be negative ...
// note2: this is the shape key -> valve docs // note2: this is the shape key -> valve docs
int iTime = 0; 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); SkipLine(szCurrent,&szCurrent);
} }
else else
@ -854,8 +854,8 @@ void SMDImporter::ParseVASection(const char* szCurrent,
this->aszTextures.pop_back(); this->aszTextures.pop_back();
} }
*szCurrentOut = szCurrent;
SkipSpacesAndLineEnd(szCurrent,&szCurrent); SkipSpacesAndLineEnd(szCurrent,&szCurrent);
*szCurrentOut = szCurrent;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Parse the skeleton section of the file // Parse the skeleton section of the file
@ -872,7 +872,7 @@ void SMDImporter::ParseSkeletonSection(const char* szCurrent,
IsSpaceOrNewLine(*(szCurrent+3))) IsSpaceOrNewLine(*(szCurrent+3)))
{ {
szCurrent += 4; szCurrent += 4;
SkipLine(szCurrent,&szCurrent); //SkipLine(szCurrent,&szCurrent);
break; break;
} }
// "time <n>\n" - Specifies the current animation frame // "time <n>\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(); SMD::Bone::Animation::MatrixKey& key = bone.sAnim.asKeys.back();
key.dTime = (double)iTime; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.pos.x");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.pos.y");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.pos.z");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.rot.x");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.rot.y");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing bone.rot.z");
SMDI_PARSE_RETURN; SMDI_PARSE_RETURN;
@ -1099,32 +1099,32 @@ void SMDImporter::ParseVertex(const char* szCurrent,
this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.parent"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.parent");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.pos.x");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.pos.y");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.pos.z");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.nor.x");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.nor.y");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.nor.z");
SMDI_PARSE_RETURN; SMDI_PARSE_RETURN;
@ -1132,12 +1132,12 @@ void SMDImporter::ParseVertex(const char* szCurrent,
if (bVASection)SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.uv.x");
SMDI_PARSE_RETURN; 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"); this->LogErrorNoThrow("Unexpected EOF/EOL while parsing vertex.uv.y");
SMDI_PARSE_RETURN; 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 // all elements from now are fully optional, we don't need them
unsigned int iSize = 0; unsigned int iSize = 0;
if(!this->ParseUnsignedInt(szCurrent,&szCurrent,iSize))SMDI_PARSE_RETURN; if(!this->ParseUnsignedInt(szCurrent,&szCurrent,iSize))SMDI_PARSE_RETURN;
vertex.aiBoneLinks.resize(iSize,std::pair<unsigned int, float>(-1,0.0f)); vertex.aiBoneLinks.resize(iSize,std::pair<unsigned int, float>(0,0.0f));
for (std::vector<std::pair<unsigned int, float> >::iterator for (std::vector<std::pair<unsigned int, float> >::iterator
i = vertex.aiBoneLinks.begin(); i = vertex.aiBoneLinks.begin();

View File

@ -240,11 +240,11 @@ void STLImporter::LoadASCIIFile()
{ {
sz += 7; sz += 7;
SkipSpaces(&sz); SkipSpaces(&sz);
sz = fast_atof_move(sz, vn->x ); sz = fast_atof_move(sz, (float&)vn->x );
SkipSpaces(&sz); SkipSpaces(&sz);
sz = fast_atof_move(sz, vn->y ); sz = fast_atof_move(sz, (float&)vn->y );
SkipSpaces(&sz); SkipSpaces(&sz);
sz = fast_atof_move(sz, vn->z ); sz = fast_atof_move(sz, (float&)vn->z );
*(vn+1) = *vn; *(vn+1) = *vn;
*(vn+2) = *vn; *(vn+2) = *vn;
} }
@ -261,11 +261,11 @@ void STLImporter::LoadASCIIFile()
sz += 7; sz += 7;
SkipSpaces(&sz); SkipSpaces(&sz);
aiVector3D* vn = &pMesh->mVertices[(curFace-1)*3 + curVertex++]; 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); SkipSpaces(&sz);
sz = fast_atof_move(sz, vn->y ); sz = fast_atof_move(sz, (float&)vn->y );
SkipSpaces(&sz); SkipSpaces(&sz);
sz = fast_atof_move(sz, vn->z ); sz = fast_atof_move(sz, (float&)vn->z );
} }
} }
else if (!::strncmp(sz,"endsolid",8)) else if (!::strncmp(sz,"endsolid",8))

View File

@ -95,7 +95,7 @@ void ComputeNormalsWithSmoothingsGroups(MeshWithSmoothingGroups<T>& sMesh)
// now generate the spatial sort tree // now generate the spatial sort tree
SGSpatialSort sSort; SGSpatialSort sSort;
for( std::vector<T>::iterator i = sMesh.mFaces.begin(); for( typename std::vector<T>::iterator i = sMesh.mFaces.begin();
i != sMesh.mFaces.end();++i) i != sMesh.mFaces.end();++i)
{ {
sSort.Add(sMesh.mPositions[(*i).mIndices[0]],(*i).mIndices[0],(*i).iSmoothGroup); sSort.Add(sMesh.mPositions[(*i).mIndices[0]],(*i).mIndices[0],(*i).iSmoothGroup);
@ -104,7 +104,7 @@ void ComputeNormalsWithSmoothingsGroups(MeshWithSmoothingGroups<T>& sMesh)
} }
sSort.Prepare(); sSort.Prepare();
for( std::vector<T>::iterator i = sMesh.mFaces.begin(); for( typename std::vector<T>::iterator i = sMesh.mFaces.begin();
i != sMesh.mFaces.end();++i) i != sMesh.mFaces.end();++i)
{ {
std::vector<unsigned int> poResult; std::vector<unsigned int> poResult;

View File

@ -132,3 +132,4 @@ void SpatialSort::FindPositions( const aiVector3D& pPosition, float pRadius, std
// that's it // that's it
} }

View File

@ -274,15 +274,14 @@ void SplitLargeMeshesProcess_Triangle::SplitMesh(
// setup face type and number of indices // setup face type and number of indices
pcMesh->mFaces[p].mNumIndices = iNumIndices; pcMesh->mFaces[p].mNumIndices = iNumIndices;
unsigned int* pi = pMesh->mFaces[iTemp].mIndices; unsigned int* pi = pMesh->mFaces[iTemp].mIndices;
unsigned int* piOut = pcMesh->mFaces[p].mIndices = new unsigned int[iNumIndices];
pcMesh->mFaces[p].mIndices = new unsigned int[iNumIndices];
// and copy the contents of the old array, offset by current base // and copy the contents of the old array, offset by current base
for (unsigned int v = 0; v < iNumIndices;++v) 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++; unsigned int iIndexOut = iCurrent++;
pcMesh->mFaces[p].mIndices[v] = iIndexOut; piOut[v] = iIndexOut;
// copy positions // copy positions
if (pMesh->mVertices != NULL) if (pMesh->mVertices != NULL)
@ -407,7 +406,7 @@ void SplitLargeMeshesProcess_Vertex::SplitMesh(
// determine the estimated size of a submesh // determine the estimated size of a submesh
// (this could be too large. Max waste is a single digit percentage) // (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 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<unsigned int> to indicate which vertices // create a std::vector<unsigned int> to indicate which vertices
// have already been copied // have already been copied

Binary file not shown.

View File

@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <vector> #include <vector>
namespace Assimp { namespace Assimp {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -65,6 +66,9 @@ public:
* @param center Center point of the hexahedron * @param center Center point of the hexahedron
* @param length Radius of the hexahedron * @param length Radius of the hexahedron
* @param positions Receives output triangles. * @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, static void MakeHexahedron(aiVector3D& center,const aiVector3D& length,
std::vector<aiVector3D>& positions); std::vector<aiVector3D>& positions);
@ -85,6 +89,8 @@ public:
* @param center Center point of the dodecahedron * @param center Center point of the dodecahedron
* @param length Radius of the dodecahedron * @param length Radius of the dodecahedron
* @param positions Receives output triangles * @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, static void MakeDodecahedron(aiVector3D& center,const aiVector3D& length,
std::vector<aiVector3D>& positions); std::vector<aiVector3D>& positions);
@ -165,6 +171,7 @@ public:
// simplified versions - the radius is a single float and applies // simplified versions - the radius is a single float and applies
// to all axes. These version of the functions must be used if ou // to all axes. These version of the functions must be used if ou
// REALLY want a platonic primitive :-) // REALLY want a platonic primitive :-)
// ---------------------------------------------------------------------
static void MakeHexahedron(aiVector3D& center,float length, static void MakeHexahedron(aiVector3D& center,float length,
std::vector<aiVector3D>& positions) std::vector<aiVector3D>& positions)
{ {
@ -177,7 +184,7 @@ public:
MakeDodecahedron(center,aiVector3D(length),positions); MakeDodecahedron(center,aiVector3D(length),positions);
} }
static void MakeOcathedron(aiVector3D& center,float length, static void MakeOctahedron(aiVector3D& center,float length,
std::vector<aiVector3D>& positions) std::vector<aiVector3D>& positions)
{ {
MakeOctahedron(center,aiVector3D(length),positions); MakeOctahedron(center,aiVector3D(length),positions);
@ -195,6 +202,47 @@ public:
MakeIcosahedron(center,aiVector3D(length),positions); MakeIcosahedron(center,aiVector3D(length),positions);
} }
// simplified versions - radius is 1, position is 0|0|0
// ---------------------------------------------------------------------
static void MakeHexahedron(std::vector<aiVector3D>& positions)
{
aiVector3D v;
MakeHexahedron(v,1.0f,positions);
}
static void MakeDodecahedron(std::vector<aiVector3D>& positions)
{
aiVector3D v;
MakeDodecahedron(v,1.0f,positions);
}
static void MakeOctahedron(std::vector<aiVector3D>& positions)
{
aiVector3D v;
MakeOctahedron(v,1.0f,positions);
}
static void MakeTetrahedron(std::vector<aiVector3D>& positions)
{
aiVector3D v;
MakeTetrahedron(v,1.0f,positions);
}
static void MakeIcosahedron(std::vector<aiVector3D>& positions)
{
aiVector3D v;
MakeIcosahedron(v,1.0f,positions);
}
static void MakeSphere(unsigned int tess,
std::vector<aiVector3D>& positions)
{
aiVector3D v;
MakeSphere(v,1.0f,tess,positions);
}
}; };
} // ! Assimp } // ! Assimp

View File

@ -158,7 +158,7 @@ void TextureTransform::AddToList(std::vector<STransformVecInfo>& rasVec,
(*i).fScaleU == pcTex->mScaleU && (*i).fScaleU == pcTex->mScaleU &&
(*i).fScaleV == pcTex->mScaleV && (*i).fScaleV == pcTex->mScaleV &&
(*i).fRotation == pcTex->mRotation && (*i).fRotation == pcTex->mRotation &&
(*i).iUVIndex == pcTex->iUVSrc) (*i).iUVIndex == (unsigned int)pcTex->iUVSrc)
{ {
(*i).pcTextures.push_back(pcTex); (*i).pcTextures.push_back(pcTex);
return; return;

View File

@ -472,7 +472,7 @@ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial* pMaterial,
} }
if (aiPTI_String != prop->mType) 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) if (iIndex +1 != iNumIndices)
@ -491,7 +491,7 @@ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial* pMaterial,
if (0 == ASSIMP_strincmp( prop->mKey.data, szBaseBuf, iLen )) if (0 == ASSIMP_strincmp( prop->mKey.data, szBaseBuf, iLen ))
{ {
if (aiPTI_Integer != prop->mType || sizeof(int) > prop->mDataLength) 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]; const char* sz = &prop->mKey.data[iLen];
if (*sz) if (*sz)
@ -510,14 +510,14 @@ void ValidateDSProcess::SearchForInvalidTextures(const aiMaterial* pMaterial,
for (unsigned int a = 0; a < this->mScene->mNumMeshes;++a) for (unsigned int a = 0; a < this->mScene->mNumMeshes;++a)
{ {
aiMesh* mesh = this->mScene->mMeshes[a]; aiMesh* mesh = this->mScene->mMeshes[a];
if(mesh->mMaterialIndex == iIndex) if(mesh->mMaterialIndex == (unsigned int)iIndex)
{ {
int iChannels = 0; int iChannels = 0;
while (mesh->HasTextureCoords(iChannels++)); while (mesh->HasTextureCoords(iChannels++));
if (iIndex >= iChannels) if (iIndex >= iChannels)
{ {
this->ReportError("Invalid UV index: %i (key %s). Mesh %i has only %i UV channels", 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"); "AI_MATKEY_SHININESS_STRENGTH key is 0.0");
} }
break; break;
default: ;
}; };
} }

View File

@ -54,6 +54,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp; using namespace Assimp;
#if _MSC_VER >= 1400
# define sprintf sprintf_s
#endif
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
XFileImporter::XFileImporter() XFileImporter::XFileImporter()
@ -153,9 +157,13 @@ void XFileImporter::CreateDataRepresentationFromImport( aiScene* pScene, const X
mat->AddProperty<int>( &shadeMode, 1, AI_MATKEY_SHADING_MODEL); mat->AddProperty<int>( &shadeMode, 1, AI_MATKEY_SHADING_MODEL);
// material colours // material colours
int specExp = 1; 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); aiColor3D clr = aiColor3D( 0, 0, 0);
mat->AddProperty( &aiColor3D( 0, 0, 0), 1, AI_MATKEY_COLOR_SPECULAR); 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); mat->AddProperty( &specExp, 1, AI_MATKEY_SHININESS);
pScene->mMaterials = new aiMaterial*[1]; pScene->mMaterials = new aiMaterial*[1];
@ -628,51 +636,27 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, const std::vector<XFile::
// bump map // bump map
if (std::string::npos != sz.find("bump", s) || std::string::npos != sz.find("height", s)) if (std::string::npos != sz.find("bump", s) || std::string::npos != sz.find("height", s))
{ {
#if _MSC_VER >= 1400
::sprintf_s(key,AI_MATKEY_TEXTURE_HEIGHT_ "[%i]",iHM++);
#else
::sprintf(key,AI_MATKEY_TEXTURE_HEIGHT_ "[%i]",iHM++); ::sprintf(key,AI_MATKEY_TEXTURE_HEIGHT_ "[%i]",iHM++);
#endif
} else } else
if (otex.mIsNormalMap || std::string::npos != sz.find( "normal", s) || std::string::npos != sz.find("nm", s)) 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++); ::sprintf(key,AI_MATKEY_TEXTURE_NORMALS_ "[%i]",iNM++);
#endif
} else } else
if (std::string::npos != sz.find( "spec", s) || std::string::npos != sz.find( "glanz", s)) 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++); ::sprintf(key,AI_MATKEY_TEXTURE_SPECULAR_ "[%i]",iSM++);
#endif
} else } else
if (std::string::npos != sz.find( "ambi", s) || std::string::npos != sz.find( "env", s)) 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++); ::sprintf(key,AI_MATKEY_TEXTURE_AMBIENT_ "[%i]",iAM++);
#endif
} else } else
if (std::string::npos != sz.find( "emissive", s) || std::string::npos != sz.find( "self", s)) 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++); ::sprintf(key,AI_MATKEY_TEXTURE_EMISSIVE_ "[%i]",iEM++);
#endif
} else } else
{ {
// assume it is a diffuse texture // 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++); ::sprintf(key,AI_MATKEY_TEXTURE_DIFFUSE_ "[%i]",iDM++);
#endif
} }
// place texture filename property under the corresponding name // place texture filename property under the corresponding name
@ -686,3 +670,4 @@ void XFileImporter::ConvertMaterials( aiScene* pScene, const std::vector<XFile::
pScene->mNumMaterials++; pScene->mNumMaterials++;
} }
} }

View File

@ -391,9 +391,9 @@ void XFileParser::ParseDataObjectSkinMeshHeader( Mesh* pMesh)
{ {
readHeadOfDataObject(); readHeadOfDataObject();
unsigned int maxSkinWeightsPerVertex = ReadInt(); /*unsigned int maxSkinWeightsPerVertex =*/ ReadInt();
unsigned int maxSkinWeightsPerFace = ReadInt(); /*unsigned int maxSkinWeightsPerFace =*/ ReadInt();
unsigned int numBonesInMesh = ReadInt(); /*unsigned int numBonesInMesh = */ReadInt();
CheckForClosingBrace(); CheckForClosingBrace();
} }
@ -478,7 +478,7 @@ void XFileParser::ParseDataObjectMeshMaterialList( Mesh* pMesh)
readHeadOfDataObject(); readHeadOfDataObject();
// read material count // read material count
unsigned int numMaterials = ReadInt(); /*unsigned int numMaterials =*/ ReadInt();
// read non triangulated face material index count // read non triangulated face material index count
unsigned int numMatIndices = ReadInt(); unsigned int numMatIndices = ReadInt();

View File

@ -1,23 +1,19 @@
#rough makefile for linux/gnu systems. requires that boost libs are installed #rough makefile for linux/gnu systems. requires that boost libs are installed
#produces shared library output in bin/libassimp.so #produces shared library output in bin/libassimp.so
SOURCES = \
3DSConverter.cpp \ SOURCES = 3DSConverter.cpp \
3DSGenNormals.cpp \
3DSLoader.cpp \ 3DSLoader.cpp \
3DSSpatialSort.cpp \
aiAssert.cpp \ aiAssert.cpp \
ASELoader.cpp \ ASELoader.cpp \
ASEParser.cpp \ ASEParser.cpp \
Assimp.cpp \ Assimp.cpp BaseImporter.cpp BaseProcess.cpp \
BaseImporter.cpp \
BaseProcess.cpp \
CalcTangentsProcess.cpp \ CalcTangentsProcess.cpp \
ConvertToLHProcess.cpp \ ConvertToLHProcess.cpp \
DefaultIOStream.cpp \ DefaultIOStream.cpp \
DefaultIOSystem.cpp \ DefaultIOSystem.cpp \
DefaultLogger.cpp \ DefaultLogger.cpp \
extra/MakeVerboseFormat.cpp \ DXFLoader.cpp \
FixNormalsStep.cpp \ FixNormalsStep.cpp \
GenFaceNormalsProcess.cpp \ GenFaceNormalsProcess.cpp \
GenVertexNormalsProcess.cpp \ GenVertexNormalsProcess.cpp \
@ -27,8 +23,9 @@ SOURCES = \
JoinVerticesProcess.cpp \ JoinVerticesProcess.cpp \
KillNormalsProcess.cpp \ KillNormalsProcess.cpp \
LimitBoneWeightsProcess.cpp \ LimitBoneWeightsProcess.cpp \
LWOMaterial.cpp \ LWOBLoader.cpp \
LWOLoader.cpp \ LWOLoader.cpp \
LWOMaterial.cpp \
MaterialSystem.cpp \ MaterialSystem.cpp \
MD2Loader.cpp \ MD2Loader.cpp \
MD3Loader.cpp \ MD3Loader.cpp \
@ -37,17 +34,21 @@ SOURCES = \
MDCLoader.cpp \ MDCLoader.cpp \
MDLLoader.cpp \ MDLLoader.cpp \
MDLMaterialLoader.cpp \ MDLMaterialLoader.cpp \
NFFLoader.cpp \
ObjFileImporter.cpp \ ObjFileImporter.cpp \
ObjFileMtlImporter.cpp \ ObjFileMtlImporter.cpp \
ObjFileParser.cpp \ ObjFileParser.cpp \
OptimizeGraphProcess.cpp \
PlyLoader.cpp \ PlyLoader.cpp \
PlyParser.cpp \ PlyParser.cpp \
PretransformVertices.cpp \ PretransformVertices.cpp \
RemoveComments.cpp \ RemoveComments.cpp \
RemoveRedundantMaterials.cpp \ RemoveRedundantMaterials.cpp \
SGSpatialSort.cpp \
SMDLoader.cpp \ SMDLoader.cpp \
SpatialSort.cpp \ SpatialSort.cpp \
SplitLargeMeshes.cpp \ SplitLargeMeshes.cpp \
StandardShapes.cpp \
STLLoader.cpp \ STLLoader.cpp \
TextureTransform.cpp \ TextureTransform.cpp \
TriangulateProcess.cpp \ TriangulateProcess.cpp \
@ -58,15 +59,13 @@ SOURCES = \
OBJECTS = $(SOURCES:.cpp=.o) OBJECTS = $(SOURCES:.cpp=.o)
TARGET = ../bin/libassimp.so TARGET = ./../bin/libassimp.so
all: $(TARGET) all: $(TARGET)
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
gcc -o $@ $(OBJECTS) -shared -lstdc++ -lboost_thread-mt -lboost_date_time-mt gcc -o $@ $(OBJECTS) -shared -lstdc++
%.o:%.cpp %.o:%.cpp
$(CXX) -g -Wall -c $? -o $@ -I../include -fPIC $(CXX) -g -Wall -c $? -o $@ -I../include -fPIC
clean: clean:
rm -f $(OBJECTS) $(TARGET) rm -f $(OBJECTS) $(TARGET)

View File

@ -67,6 +67,8 @@ const size_t MAXLEN = 1024;
# define MAXLEN 1024 # define MAXLEN 1024
#endif #endif
#include "./Compiler/pushpack1.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** Represents a two-dimensional vector. /** Represents a two-dimensional vector.
*/ */
@ -82,7 +84,7 @@ struct aiVector2D
//! X and y coordinates //! X and y coordinates
float x, y; float x, y;
} ; } PACK_STRUCT;
// aiVector3D type moved to separate header due to size of operators // aiVector3D type moved to separate header due to size of operators
// aiQuaternion 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 //! Red, green and blue color values
float r, g, b; float r, g, b;
}; } PACK_STRUCT;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -136,7 +138,9 @@ struct aiColor4D
//! Red, green, blue and alpha color values //! Red, green, blue and alpha color values
float r, g, b, a; float r, g, b, a;
}; } PACK_STRUCT;
#include "./Compiler/poppack1.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@ -48,6 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
extern "C" { extern "C" {
#endif #endif
#include "./Compiler/pushpack1.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** Represents a three-dimensional vector. */ /** Represents a three-dimensional vector. */
struct aiVector3D struct aiVector3D
@ -85,7 +87,9 @@ struct aiVector3D
#endif // __cplusplus #endif // __cplusplus
float x, y, z; float x, y, z;
}; } PACK_STRUCT;
#include "./Compiler/poppack1.h"
#ifdef __cplusplus #ifdef __cplusplus
} // end extern "C" } // end extern "C"