Explorar o código

Fixes for 64 bit builds

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@51 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
aramis_acg %!s(int64=17) %!d(string=hai) anos
pai
achega
66e69ef6b2

+ 14 - 301
code/3DSConverter.cpp

@@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file Implementation of the 3ds importer class */
 #include "3DSLoader.h"
 #include "MaterialSystem.h"
-#include "../include/DefaultLogger.h"
+#include "TextureTransform.h"
 
+#include "../include/DefaultLogger.h"
 #include "../include/IOStream.h"
 #include "../include/IOSystem.h"
 #include "../include/aiMesh.h"
@@ -84,7 +85,7 @@ void Dot3DSImporter::ReplaceDefaultMaterial()
 
 	iIndex = i;
 	}
-	if (0xcdcdcdcd == iIndex)iIndex = this->mScene->mMaterials.size();
+	if (0xcdcdcdcd == iIndex)iIndex = (unsigned int)this->mScene->mMaterials.size();
 
 	// now iterate through all meshes and through all faces and
 	// find all faces that are using the default material
@@ -134,17 +135,17 @@ void Dot3DSImporter::CheckIndices(Dot3DS::Mesh* sMesh)
 		if ((*i).mIndices[0] >= sMesh->mPositions.size())
 		{
 			DefaultLogger::get()->warn("Face index overflow in 3DS file (#1)");
-			(*i).mIndices[0] = sMesh->mPositions.size()-1;
+			(*i).mIndices[0] = (uint32_t)sMesh->mPositions.size()-1;
 		}
 		if ((*i).mIndices[1] >= sMesh->mPositions.size())
 		{
 			DefaultLogger::get()->warn("Face index overflow in 3DS file (#2)");
-			(*i).mIndices[1] = sMesh->mPositions.size()-1;
+			(*i).mIndices[1] = (uint32_t)sMesh->mPositions.size()-1;
 		}
 		if ((*i).mIndices[2] >= sMesh->mPositions.size())
 		{
 			DefaultLogger::get()->warn("Face index overflow in 3DS file (#3)");
-			(*i).mIndices[2] = sMesh->mPositions.size()-1;
+			(*i).mIndices[2] = (uint32_t)sMesh->mPositions.size()-1;
 		}
 	}
 	return;
@@ -364,17 +365,6 @@ void Dot3DSImporter::ConvertMaterial(Dot3DS::Material& oldMat,
 	return;
 }
 // ------------------------------------------------------------------------------------------------
-void SetupMatUVSrc (aiMaterial* pcMat, const Dot3DS::Material* pcMatIn)
-	{
-	MaterialHelper* pcHelper = (MaterialHelper*)pcMat;
-	pcHelper->AddProperty<int>(&pcMatIn->sTexDiffuse.iUVSrc,1,AI_MATKEY_UVWSRC_DIFFUSE(0));
-	pcHelper->AddProperty<int>(&pcMatIn->sTexSpecular.iUVSrc,1,AI_MATKEY_UVWSRC_SPECULAR(0));
-	pcHelper->AddProperty<int>(&pcMatIn->sTexEmissive.iUVSrc,1,AI_MATKEY_UVWSRC_EMISSIVE(0));
-	pcHelper->AddProperty<int>(&pcMatIn->sTexBump.iUVSrc,1,AI_MATKEY_UVWSRC_HEIGHT(0));
-	pcHelper->AddProperty<int>(&pcMatIn->sTexShininess.iUVSrc,1,AI_MATKEY_UVWSRC_SHININESS(0));
-	pcHelper->AddProperty<int>(&pcMatIn->sTexOpacity.iUVSrc,1,AI_MATKEY_UVWSRC_OPACITY(0));
-	}
-// ------------------------------------------------------------------------------------------------
 void Dot3DSImporter::ConvertMeshes(aiScene* pcOut)
 {
 	std::vector<aiMesh*> avOutMeshes;
@@ -430,8 +420,8 @@ void Dot3DSImporter::ConvertMeshes(aiScene* pcOut)
 
 
 				// convert vertices
-				p_pcOut->mNumVertices = aiSplit[p].size()*3;
-				p_pcOut->mNumFaces = aiSplit[p].size();
+				p_pcOut->mNumVertices = (unsigned int)aiSplit[p].size()*3;
+				p_pcOut->mNumFaces = (unsigned int)aiSplit[p].size();
 
 				// allocate enough storage for faces
 				p_pcOut->mFaces = new aiFace[p_pcOut->mNumFaces];
@@ -486,7 +476,7 @@ void Dot3DSImporter::ConvertMeshes(aiScene* pcOut)
 						p_pcOut->mTextureCoords[0][iBase++] = aiVector3D(pc.x,pc.y,0.0f);
 					}
 					// apply texture coordinate scalings
-					this->BakeScaleNOffset ( p_pcOut, &this->mScene->mMaterials[
+					TextureTransform::BakeScaleNOffset ( p_pcOut, &this->mScene->mMaterials[
 						p_pcOut->mMaterialIndex] );
 					
 					// setup bitflags to indicate which texture coordinate
@@ -503,7 +493,7 @@ void Dot3DSImporter::ConvertMeshes(aiScene* pcOut)
 		}
 		delete[] aiSplit;
 	}
-	pcOut->mNumMeshes = avOutMeshes.size();
+	pcOut->mNumMeshes = (unsigned int)avOutMeshes.size();
 	pcOut->mMeshes = new aiMesh*[pcOut->mNumMeshes]();
 	for (unsigned int a = 0; a < pcOut->mNumMeshes;++a)
 	{
@@ -519,7 +509,7 @@ void Dot3DSImporter::ConvertMeshes(aiScene* pcOut)
 	// set for each texture
 	for (unsigned int a = 0; a < pcOut->mNumMaterials;++a)
 	{
-		SetupMatUVSrc( pcOut->mMaterials[a], &this->mScene->mMaterials[a] );
+		TextureTransform::SetupMatUVSrc( pcOut->mMaterials[a], &this->mScene->mMaterials[a] );
 	}
 	return;
 }
@@ -541,7 +531,7 @@ void Dot3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,Dot3DS::Node*
 		}
 	}
 	pcOut->mName.Set(pcIn->mName);
-	pcOut->mNumMeshes = iArray.size();
+	pcOut->mNumMeshes = (unsigned int)iArray.size();
 	pcOut->mMeshes = new unsigned int[iArray.size()];
 	
 	for (unsigned int i = 0;i < iArray.size();++i)
@@ -605,7 +595,7 @@ void Dot3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,Dot3DS::Node*
 	}
 #endif
 
-	pcOut->mNumChildren = pcIn->mChildren.size();
+	pcOut->mNumChildren = (unsigned int)pcIn->mChildren.size();
 	pcOut->mChildren = new aiNode*[pcIn->mChildren.size()];
 	for (unsigned int i = 0; i < pcIn->mChildren.size();++i)
 	{
@@ -617,254 +607,6 @@ void Dot3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,Dot3DS::Node*
 	return;
 }
 // ------------------------------------------------------------------------------------------------
-inline bool HasUVTransform(const Dot3DS::Texture& rcIn)
-	{
-	return (0.0f != rcIn.mOffsetU ||
-			0.0f != rcIn.mOffsetV ||
-			1.0f != rcIn.mScaleU  ||
-			1.0f != rcIn.mScaleV  ||
-			0.0f != rcIn.mRotation);
-	}
-// ------------------------------------------------------------------------------------------------
-void Dot3DSImporter::ApplyScaleNOffset()
-	{
-	unsigned int iNum = 0;
-	for (std::vector<Dot3DS::Material>::iterator
-		i =  this->mScene->mMaterials.begin();
-		i != this->mScene->mMaterials.end();++i,++iNum)
-		{
-		unsigned int iCnt = 0;
-		Dot3DS::Texture* pcTexture = NULL;
-		if (HasUVTransform((*i).sTexDiffuse))
-			{
-			(*i).sTexDiffuse.bPrivate = true;
-			pcTexture = &(*i).sTexDiffuse;
-			++iCnt;
-			}
-		if (HasUVTransform((*i).sTexSpecular))
-			{
-			(*i).sTexSpecular.bPrivate = true;
-			pcTexture = &(*i).sTexSpecular;
-			++iCnt;
-			}
-		if (HasUVTransform((*i).sTexOpacity))
-			{
-			(*i).sTexOpacity.bPrivate = true;
-			pcTexture = &(*i).sTexOpacity;
-			++iCnt;
-			}
-		if (HasUVTransform((*i).sTexEmissive))
-			{
-			(*i).sTexEmissive.bPrivate = true;
-			pcTexture = &(*i).sTexEmissive;
-			++iCnt;
-			}
-		if (HasUVTransform((*i).sTexBump))
-			{
-			(*i).sTexBump.bPrivate = true;
-			pcTexture = &(*i).sTexBump;
-			++iCnt;
-			}
-		if (HasUVTransform((*i).sTexShininess))
-			{
-			(*i).sTexShininess.bPrivate = true;
-			pcTexture = &(*i).sTexShininess;
-			++iCnt;
-			}
-		if (0 != iCnt)
-			{
-			// if only one texture needs scaling/offset operations
-			// we can apply them directly to the first texture
-			// coordinate sets of all meshes referencing *this* material
-			// However, we can't do it  now. We need to wait until
-			// everything is sorted by materials.
-			if (1 == iCnt)
-				{
-				(*i).iBakeUVTransform = 1;
-				(*i).pcSingleTexture = pcTexture;
-				}
-			// we will need to generate a separate new texture channel
-			// for each texture. 
-			// However, we can't do it  now. We need to wait until
-			// everything is sorted by materials.
-			else (*i).iBakeUVTransform = 2;
-			}
-		}
-	}
-// ------------------------------------------------------------------------------------------------
-struct STransformVecInfo 
-	{
-	float fScaleU;
-	float fScaleV;
-	float fOffsetU;
-	float fOffsetV;
-	float fRotation;
-
-	std::vector<Dot3DS::Texture*> pcTextures; 
-	};
-// ------------------------------------------------------------------------------------------------
-void AddToList(std::vector<STransformVecInfo>& rasVec,Dot3DS::Texture* pcTex)
-	{
-	if (0 == pcTex->mMapName.length())return;
-
-	for (std::vector<STransformVecInfo>::iterator
-		i =  rasVec.begin();
-		i != rasVec.end();++i)
-		{
-		if ((*i).fOffsetU == pcTex->mOffsetU &&
-			(*i).fOffsetV == pcTex->mOffsetV && 
-			(*i).fScaleU  == pcTex->mScaleU  &&
-			(*i).fScaleV  == pcTex->mScaleV  &&
-			(*i).fRotation == pcTex->mRotation)
-			{
-			(*i).pcTextures.push_back(pcTex);
-			return;
-			}
-		}
-	STransformVecInfo sInfo;
-	sInfo.fScaleU = pcTex->mScaleU;
-	sInfo.fScaleV = pcTex->mScaleV;
-	sInfo.fOffsetU = pcTex->mOffsetU;
-	sInfo.fOffsetV = pcTex->mOffsetV;
-	sInfo.fRotation = pcTex->mRotation;
-	sInfo.pcTextures.push_back(pcTex);
-
-	rasVec.push_back(sInfo);
-	}
-// ------------------------------------------------------------------------------------------------
-void Dot3DSImporter::BakeScaleNOffset(
-	aiMesh* pcMesh, Dot3DS::Material* pcSrc)
-	{
-	if (!pcMesh->mTextureCoords[0])return;
-	if (1 == pcSrc->iBakeUVTransform)
-		{
-		if (0.0f == pcSrc->pcSingleTexture->mRotation)
-			{
-			for (unsigned int i = 0; i < pcMesh->mNumVertices;++i)
-				{
-				pcMesh->mTextureCoords[0][i].x /= pcSrc->pcSingleTexture->mScaleU;
-				pcMesh->mTextureCoords[0][i].y /= pcSrc->pcSingleTexture->mScaleV;
-
-				pcMesh->mTextureCoords[0][i].x += pcSrc->pcSingleTexture->mOffsetU;
-				pcMesh->mTextureCoords[0][i].y += pcSrc->pcSingleTexture->mOffsetV;
-				}
-			}
-		else
-			{
-			const float fSin = sinf(pcSrc->pcSingleTexture->mRotation);
-			const float fCos = cosf(pcSrc->pcSingleTexture->mRotation);
-			for (unsigned int i = 0; i < pcMesh->mNumVertices;++i)
-				{
-				pcMesh->mTextureCoords[0][i].x /= pcSrc->pcSingleTexture->mScaleU;
-				pcMesh->mTextureCoords[0][i].y /= pcSrc->pcSingleTexture->mScaleV;
-
-				pcMesh->mTextureCoords[0][i].x *= fCos;
-				pcMesh->mTextureCoords[0][i].y *= fSin;
-
-				pcMesh->mTextureCoords[0][i].x += pcSrc->pcSingleTexture->mOffsetU;
-				pcMesh->mTextureCoords[0][i].y += pcSrc->pcSingleTexture->mOffsetV;
-				}
-			}
-		}
-	else if (2 == pcSrc->iBakeUVTransform)
-		{
-		// now we need to find all textures in the material
-		// which require scaling/offset operations
-		std::vector<STransformVecInfo> sOps;
-		AddToList(sOps,&pcSrc->sTexDiffuse);
-		AddToList(sOps,&pcSrc->sTexSpecular);
-		AddToList(sOps,&pcSrc->sTexEmissive);
-		AddToList(sOps,&pcSrc->sTexOpacity);
-		AddToList(sOps,&pcSrc->sTexBump);
-		AddToList(sOps,&pcSrc->sTexShininess);
-
-		const aiVector3D* _pvBase;
-		if (0.0f == sOps[0].fOffsetU && 0.0f == sOps[0].fOffsetV &&
-			1.0f == sOps[0].fScaleU  && 1.0f == sOps[0].fScaleV &&
-			0.0f == sOps[0].fRotation)
-			{
-			// we'll have an unmodified set, so we can use *this* one
-			_pvBase = pcMesh->mTextureCoords[0];
-			}
-		else
-			{
-			_pvBase = new aiVector3D[pcMesh->mNumVertices];
-			memcpy(const_cast<aiVector3D*>(_pvBase),pcMesh->mTextureCoords[0],
-				pcMesh->mNumVertices * sizeof(aiVector3D));
-			}
-
-		unsigned int iCnt = 0;
-		for (std::vector<STransformVecInfo>::iterator
-			i =  sOps.begin();
-			i != sOps.end();++i,++iCnt)
-			{
-			if (!pcMesh->mTextureCoords[iCnt])
-				{
-				pcMesh->mTextureCoords[iCnt] = new aiVector3D[pcMesh->mNumVertices];
-				}
-			// more than 4 UV texture channels are not available
-			if (iCnt > 3)
-				{
-				for (std::vector<Dot3DS::Texture*>::iterator
-					a =  (*i).pcTextures.begin();
-					a != (*i).pcTextures.end();++a)
-					{
-					(*a)->iUVSrc = 0;
-					}
-				DefaultLogger::get()->error("There are too many "
-					"combinations of different UV scaling/offset/rotation operations "
-					"to generate an UV channel for each (maximum is 4). Using the "
-					"first UV channel ...");
-				continue;
-				}
-			const aiVector3D* pvBase = _pvBase;
-
-			if (0.0f == (*i).fRotation)
-				{
-				for (unsigned int n = 0; n < pcMesh->mNumVertices;++n)
-					{
-					pcMesh->mTextureCoords[iCnt][n].x = pvBase->x / (*i).fScaleU;
-					pcMesh->mTextureCoords[iCnt][n].y = pvBase->y / (*i).fScaleV;
-
-					pcMesh->mTextureCoords[iCnt][n].x += (*i).fOffsetU;
-					pcMesh->mTextureCoords[iCnt][n].y += (*i).fOffsetV;
-
-					pvBase++;
-					}
-				}
-			else
-				{
-				const float fSin = sinf((*i).fRotation);
-				const float fCos = cosf((*i).fRotation);
-				for (unsigned int n = 0; n < pcMesh->mNumVertices;++n)
-					{
-					pcMesh->mTextureCoords[iCnt][n].x = pvBase->x / (*i).fScaleU;
-					pcMesh->mTextureCoords[iCnt][n].y = pvBase->y / (*i).fScaleV;
-
-					pcMesh->mTextureCoords[iCnt][n].x *= fCos;
-					pcMesh->mTextureCoords[iCnt][n].y *= fSin;
-
-					pcMesh->mTextureCoords[iCnt][n].x += (*i).fOffsetU;
-					pcMesh->mTextureCoords[iCnt][n].y += (*i).fOffsetV;
-
-					pvBase++;
-					}
-				}
-			// setup UV source
-			for (std::vector<Dot3DS::Texture*>::iterator
-				a =  (*i).pcTextures.begin();
-				a != (*i).pcTextures.end();++a)
-				{
-				(*a)->iUVSrc = iCnt;
-				}
-			}
-
-		// release temporary storage
-		if (_pvBase != pcMesh->mTextureCoords[0])
-			delete[] _pvBase;
-		}
-	}
-// ------------------------------------------------------------------------------------------------
 void Dot3DSImporter::GenerateNodeGraph(aiScene* pcOut)
 {
 	pcOut->mRootNode = new aiNode();
@@ -923,7 +665,7 @@ void Dot3DSImporter::GenerateNodeGraph(aiScene* pcOut)
 // ------------------------------------------------------------------------------------------------
 void Dot3DSImporter::ConvertScene(aiScene* pcOut)
 {
-	pcOut->mNumMaterials = this->mScene->mMaterials.size();
+	pcOut->mNumMaterials = (unsigned int)this->mScene->mMaterials.size();
 	pcOut->mMaterials = new aiMaterial*[pcOut->mNumMaterials];
 
 	for (unsigned int i = 0; i < pcOut->mNumMaterials;++i)
@@ -935,32 +677,3 @@ void Dot3DSImporter::ConvertScene(aiScene* pcOut)
 	this->ConvertMeshes(pcOut);
 	return;
 }
-#if 0
-// ------------------------------------------------------------------------------------------------
-void Dot3DSImporter::GenTexCoord (Dot3DS::Texture* pcTexture,
-	const std::vector<aiVector2D>& p_vIn,
-	std::vector<aiVector2D>& p_vOut)
-{
-	p_vOut.resize(p_vIn.size());
-
-	std::vector<aiVector2D>::const_iterator i =  p_vIn.begin();
-	std::vector<aiVector2D>::iterator		a =  p_vOut.begin();
-	for(;i != p_vOut.end();++i,++a)
-	{
-		// TODO: Find out in which order 3ds max is performing
-		// scaling and translation. However it seems reasonable to
-		// scale first.
-		//
-		// TODO: http://www.jalix.org/ressources/graphics/3DS/_specifications/3ds-0.1.htm
-		// says it is not u and v scale but 1/u and 1/v scale. Other sources
-		// tell different things. Believe this one, the author seems to be funny
-		// or drunken or both ;-)
-		(*a) = (*i);
-		(*a).x /= pcTexture->mScaleU;
-		(*a).y /= pcTexture->mScaleV;
-		(*a).x += pcTexture->mOffsetU;
-		(*a).y += pcTexture->mOffsetV;
-	}
-	return;
-}
-#endif

+ 6 - 4
code/3DSHelper.h

@@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "../include/aiQuaternion.h"
 #include "../include/aiMesh.h"
 #include "../include/aiAnim.h"
+
 #include "SpatialSort.h"
 
 namespace Assimp
@@ -408,15 +409,16 @@ struct Material
 	//! Shininess texture channel
 	Texture sTexShininess;
 	
-	/*
-	float mReflectionTextureBlend;
-	std::string mReflectionTexture;
-	*/
+	//! Scaling factor for the bump values
 	float mBumpHeight;
 
 	//! Emissive color
 	aiColor3D mEmissive;
 
+	//! Ambient texture channel
+	//! (used by the ASE format)
+	Texture sTexAmbient;
+
 	//! Used internally
 	unsigned int iBakeUVTransform;
 	Texture* pcSingleTexture;

+ 39 - 33
code/3DSLoader.cpp

@@ -42,8 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /** @file Implementation of the 3ds importer class */
 #include "3DSLoader.h"
 #include "MaterialSystem.h"
-#include "../include/DefaultLogger.h"
+#include "TextureTransform.h"
 
+#include "../include/DefaultLogger.h"
 #include "../include/IOStream.h"
 #include "../include/IOSystem.h"
 #include "../include/aiMesh.h"
@@ -59,7 +60,6 @@ using namespace Assimp;
 	"subordinate chunks is larger than the size "	\
 	"specified in the higher-level chunk header."	\
 
-
 // ------------------------------------------------------------------------------------------------
 // Constructor to be privately used by Importer
 Dot3DSImporter::Dot3DSImporter()
@@ -145,7 +145,6 @@ void Dot3DSImporter::InternReadFile(
 	this->mMasterScale = 1.0f;
 	this->mBackgroundImage = "";
 	this->bHasBG = false;
-	this->mErrorText = "";
 
 	int iRemaining = (unsigned int)fileSize;
 	this->ParseMainChunk(&iRemaining);
@@ -165,7 +164,7 @@ void Dot3DSImporter::InternReadFile(
 	}
 
 	// Apply scaling and offsets to all texture coordinates
-	this->ApplyScaleNOffset();
+	TextureTransform::ApplyScaleNOffset(this->mScene->mMaterials);
 
 	// Replace all occurences of the default material with a valid material.
 	// Generate it if no material containing DEFAULT in its name has been
@@ -174,7 +173,6 @@ void Dot3DSImporter::InternReadFile(
 	
 	// Convert the scene from our internal representation to an aiScene object
 	this->ConvertScene(pScene);
-	
 
 	// Generate the node graph for the scene. This is a little bit
 	// tricky since we'll need to split some meshes into submeshes
@@ -185,12 +183,6 @@ void Dot3DSImporter::InternReadFile(
 
 	delete[] this->mBuffer;
 	delete this->mScene;
-
-	// check whether an error occured during reading ... set it as warning
-	if ("" != this->mErrorText) 
-	{
-		DefaultLogger::get()->warn(this->mErrorText);
-	}
 	return;
 }
 // ------------------------------------------------------------------------------------------------
@@ -216,12 +208,12 @@ void Dot3DSImporter::ReadChunk(const Dot3DSFile::Chunk** p_ppcOut)
 	ai_assert(p_ppcOut != NULL);
 
 	// read chunk
-	if ((unsigned int)this->mCurrent >= (unsigned int)this->mLast)
+	if (this->mCurrent >= this->mLast)
 	{
 		*p_ppcOut = NULL;
 		return;
 	}
-	const unsigned int iDiff = (unsigned int)this->mLast - (unsigned int)this->mCurrent;
+	const uintptr_t iDiff = this->mLast - this->mCurrent;
 	if (iDiff < sizeof(Dot3DSFile::Chunk)) 
 	{
 		*p_ppcOut = NULL;
@@ -254,11 +246,11 @@ void Dot3DSImporter::ParseMainChunk(int* piRemaining)
 		this->ParseEditorChunk(&iRemaining);
 		break;
 	};
-	if ((unsigned int)pcCurNext < (unsigned int)this->mCurrent)
+	if (pcCurNext < this->mCurrent)
 	{
 		// place an error message. If we crash the programmer
 		// will be able to find it
-		this->mErrorText = ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG;
+		DefaultLogger::get()->warn(ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG);
 		pcCurNext = this->mCurrent;
 	}
 	// Go to the starting position of the next top-level chunk
@@ -295,11 +287,11 @@ void Dot3DSImporter::ParseEditorChunk(int* piRemaining)
 		this->ParseKeyframeChunk(&iRemaining);
 		break;
 	};
-	if ((unsigned int)pcCurNext < (unsigned int)this->mCurrent)
+	if (pcCurNext < this->mCurrent)
 	{
 		// place an error message. If we crash the programmer
 		// will be able to find it
-		this->mErrorText = ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG;
+		DefaultLogger::get()->warn(ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG);
 		pcCurNext = this->mCurrent;
 	}
 	// Go to the starting position of the next top-level chunk
@@ -393,11 +385,11 @@ void Dot3DSImporter::ParseObjectChunk(int* piRemaining)
 		break;
 
 	};
-	if ((unsigned int)pcCurNext < (unsigned int)this->mCurrent)
+	if (pcCurNext < this->mCurrent)
 	{
 		// place an error message. If we crash the programmer
 		// will be able to find it
-		this->mErrorText = ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG;
+		DefaultLogger::get()->warn(ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG);
 		pcCurNext = this->mCurrent;
 	}
 	// Go to the starting position of the next top-level chunk
@@ -436,11 +428,11 @@ void Dot3DSImporter::ParseChunk(int* piRemaining)
 		this->ParseMeshChunk(&iRemaining);
 		break;
 	};
-	if ((unsigned int)pcCurNext < (unsigned int)this->mCurrent)
+	if (pcCurNext < this->mCurrent)
 	{
 		// place an error message. If we crash the programmer
 		// will be able to find it
-		this->mErrorText = ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG;
+		DefaultLogger::get()->warn(ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG);
 		pcCurNext = this->mCurrent;
 	}
 	// Go to the starting position of the next top-level chunk
@@ -471,11 +463,11 @@ void Dot3DSImporter::ParseKeyframeChunk(int* piRemaining)
 		this->ParseHierarchyChunk(&iRemaining);
 		break;
 	};
-	if ((unsigned int)pcCurNext < (unsigned int)this->mCurrent)
+	if (pcCurNext < this->mCurrent)
 	{
 		// place an error message. If we crash the programmer
 		// will be able to find it
-		this->mErrorText = ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG;
+		DefaultLogger::get()->warn(ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG);
 		pcCurNext = this->mCurrent;
 	}
 	// Go to the starting position of the next top-level chunk
@@ -738,11 +730,11 @@ void Dot3DSImporter::ParseHierarchyChunk(int* piRemaining)
 #endif // end keyframe animation code
 
 	};
-	if ((unsigned int)pcCurNext < (unsigned int)this->mCurrent)
+	if (pcCurNext < this->mCurrent)
 	{
 		// place an error message. If we crash the programmer
 		// will be able to find it
-		this->mErrorText = ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG;
+		DefaultLogger::get()->warn(ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG);
 		pcCurNext = this->mCurrent;
 	}
 	// Go to the starting position of the next top-level chunk
@@ -837,11 +829,11 @@ void Dot3DSImporter::ParseFaceChunk(int* piRemaining)
 
 		break;
 	};
-	if ((unsigned int)pcCurNext < (unsigned int)this->mCurrent)
+	if (pcCurNext < this->mCurrent)
 	{
 		// place an error message. If we crash the programmer
 		// will be able to find it
-		this->mErrorText = ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG;
+		DefaultLogger::get()->warn(ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG);
 		pcCurNext = this->mCurrent;
 	}
 	// Go to the starting position of the next chunk on this level
@@ -997,16 +989,16 @@ void Dot3DSImporter::ParseMeshChunk(int* piRemaining)
 		// by a material $$DEFAULT will be assigned to it)
 		mMesh.mFaceMaterials.resize(mMesh.mFaces.size(),0xcdcdcdcd);
 
-		iRemaining = (int)pcCurNext - (int)this->mCurrent;
+		iRemaining = (int)(pcCurNext - this->mCurrent);
 		if (iRemaining > 0)this->ParseFaceChunk(&iRemaining);
 		break;
 
 	};
-	if ((unsigned int)pcCurNext < (unsigned int)this->mCurrent)
+	if (pcCurNext < this->mCurrent)
 	{
 		// place an error message. If we crash the programmer
 		// will be able to find it
-		this->mErrorText = ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG;
+		DefaultLogger::get()->warn(ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG);
 		pcCurNext = this->mCurrent;
 	}
 	// Go to the starting position of the next chunk on this level
@@ -1155,11 +1147,11 @@ void Dot3DSImporter::ParseMaterialChunk(int* piRemaining)
 		this->ParseTextureChunk(&iRemaining,&this->mScene->mMaterials.back().sTexEmissive);
 		break;
 	};
-	if ((unsigned int)pcCurNext < (unsigned int)this->mCurrent)
+	if (pcCurNext < this->mCurrent)
 	{
 		// place an error message. If we crash the programmer
 		// will be able to find it
-		this->mErrorText = ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG;
+		DefaultLogger::get()->warn(ASSIMP_3DS_WARN_CHUNK_OVERFLOW_MSG);
 		pcCurNext = this->mCurrent;
 	}
 	// Go to the starting position of the next chunk on this level
@@ -1204,14 +1196,28 @@ void Dot3DSImporter::ParseTextureChunk(int* piRemaining,Dot3DS::Texture* pcOut)
 		break;
 	// manually parse the blend factor
 	case Dot3DSFile::CHUNK_PERCENTW:
-		pcOut->mTextureBlend = (float)(*((short*)this->mCurrent)) / (float)100;
+		pcOut->mTextureBlend = (float)(*((short*)this->mCurrent)) / 100.0f;
 		break;
 
 	case Dot3DSFile::CHUNK_MAT_MAP_USCALE:
 		pcOut->mScaleU = *((float*)this->mCurrent);
+		if (0.0f == pcOut->mScaleU)
+		{
+			DefaultLogger::get()->warn("Inverse texture coordinate scaling in the "
+				"x direction is zero. This would be a division through zero. ");
+			pcOut->mScaleU = 1.0f;
+		}
+		pcOut->mScaleU = 1.0f / pcOut->mScaleU;
 		break;
 	case Dot3DSFile::CHUNK_MAT_MAP_VSCALE:
 		pcOut->mScaleV = *((float*)this->mCurrent);
+		if (0.0f == pcOut->mScaleV)
+		{
+			DefaultLogger::get()->warn("Inverse texture coordinate scaling in the "
+				"y direction is zero. This would be a division through zero. ");
+			pcOut->mScaleV = 1.0f;
+		}
+		pcOut->mScaleV = 1.0f / pcOut->mScaleV;
 		break;
 	case Dot3DSFile::CHUNK_MAT_MAP_UOFFSET:
 		pcOut->mOffsetU = *((float*)this->mCurrent);

+ 0 - 17
code/3DSLoader.h

@@ -160,12 +160,6 @@ protected:
 	*/
 	void ParseMaterialChunk(int* piRemaining);
 
-	// -------------------------------------------------------------------
-	/** Apply texture coordinate offsets
-	*/
-	void ApplyScaleNOffset();
-	void BakeScaleNOffset(aiMesh* pcMesh, Dot3DS::Material* pcSrc);
-
 	// -------------------------------------------------------------------
 	/** Parse a mesh chunk in the file
 	*/
@@ -206,25 +200,16 @@ protected:
 	*/
 	void ConvertScene(aiScene* pcOut);
 
-	// -------------------------------------------------------------------
-	/** U/V Scaling/Offset handling
-	*/
-	void GenTexCoord (Dot3DS::Texture* pcTexture,
-		const std::vector<aiVector2D>& p_vIn,
-		std::vector<aiVector2D>& p_vOut);
-
 	// -------------------------------------------------------------------
 	/** generate normal vectors for a given mesh
 	*/
 	void GenNormals(Dot3DS::Mesh* sMesh);
 
-
 	// -------------------------------------------------------------------
 	/** generate unique vertices for a mesh
 	*/
 	void MakeUnique(Dot3DS::Mesh* sMesh);
 
-
 	// -------------------------------------------------------------------
 	/** Add a node to the node graph
 	*/
@@ -236,13 +221,11 @@ protected:
 	*/
 	void InverseNodeSearch(Dot3DS::Node* pcNode,Dot3DS::Node* pcCurrent);
 
-
 	// -------------------------------------------------------------------
 	/** Apply the master scaling factor to the mesh
 	*/
 	void ApplyMasterScale(aiScene* pScene);
 
-
 	// -------------------------------------------------------------------
 	/** Clamp all indices in the file to a valid range
 	*/

+ 2 - 2
code/3DSSpatialSort.cpp

@@ -116,8 +116,8 @@ void D3DSSpatialSorter::FindPositions( const aiVector3D& pPosition,
 		return;
 
 	// do a binary search for the minimal distance to start the iteration there
-	unsigned int index = mPositions.size() / 2;
-	unsigned int binaryStepSize = mPositions.size() / 4;
+	unsigned int index = (unsigned int)mPositions.size() / 2;
+	unsigned int binaryStepSize = (unsigned int)mPositions.size() / 4;
 	while( binaryStepSize > 1)
 		{
 		if( mPositions[index].mDistance < minDist)

+ 103 - 50
code/ASELoader.cpp

@@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "ASELoader.h"
 #include "3DSSpatialSort.h"
 #include "MaterialSystem.h"
+#include "TextureTransform.h"
 #include "fast_atof.h"
 
 #include "../include/IOStream.h"
@@ -127,14 +128,6 @@ void ASEImporter::InternReadFile(
 	this->mParser = new ASE::Parser((const char*)this->mBuffer);
 	this->mParser->Parse();
 
-	// the .ask file format contains normally three LODs of
-	// a single object. Named <name>n, where n = 1 designates
-	// the highest level of detail.
-	if (this->mIsAsk)
-	{
-		this->AskFilterLOD(this->mParser->m_vMeshes);
-	}
-
 	// process all meshes
 	std::vector<aiMesh*> avOutMeshes;
 	avOutMeshes.reserve(this->mParser->m_vMeshes.size()*2);
@@ -161,7 +154,7 @@ void ASEImporter::InternReadFile(
 	}
 	
 	// now build the output mesh list
-	pScene->mNumMeshes = avOutMeshes.size();
+	pScene->mNumMeshes = (unsigned int)avOutMeshes.size();
 	pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
 	for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
 		pScene->mMeshes[i] = avOutMeshes[i];
@@ -181,6 +174,8 @@ void ASEImporter::InternReadFile(
 void ASEImporter::AddNodes(aiScene* pcScene,aiNode* pcParent,
 	const char* szName)
 {
+	const size_t len = szName ? strlen(szName) : 0;
+
 	ai_assert(4 <= AI_MAX_NUMBER_OF_COLOR_SETS);
 	std::vector<aiNode*> apcNodes;
 	for (unsigned int i = 0; i < pcScene->mNumMeshes;++i)
@@ -193,8 +188,11 @@ void ASEImporter::AddNodes(aiScene* pcScene,aiNode* pcParent,
 		}
 		if (szName)
 		{
-			if(0 != ASSIMP_stricmp ( szName, szMyName[1].c_str() ))
+			if( len != szMyName[1].length() ||
+				0 != ASSIMP_stricmp ( szName, szMyName[1].c_str() ))
+			{
 				continue;
+			}
 		} 
 		else if ('\0' != szMyName[1].c_str()[0])continue;
 
@@ -223,7 +221,7 @@ void ASEImporter::AddNodes(aiScene* pcScene,aiNode* pcParent,
 	}
 
 	// allocate enough space for the child nodes
-	pcParent->mNumChildren = apcNodes.size();
+	pcParent->mNumChildren = (unsigned int)apcNodes.size();
 	pcParent->mChildren = new aiNode*[apcNodes.size()];
 
 	// now build all nodes
@@ -247,12 +245,83 @@ void ASEImporter::BuildNodes(aiScene* pcScene)
 	// add all nodes
 	this->AddNodes(pcScene,pcScene->mRootNode,NULL);
 
+	// now iterate through al meshes and find those that have not yet
+	// been added to the nodegraph (= their parent could not be recognized)
+	std::vector<unsigned int> aiList;
+	for (unsigned int i = 0; i < pcScene->mNumMeshes;++i)
+	{
+		// get the name of the mesh ([0] = name, [1] = parent)
+		std::string* szMyName = (std::string*)pcScene->mMeshes[i]->mColors[1];
+		if (!szMyName)
+		{
+			continue;
+		}
+
+		// check whether our parent is known
+		bool bKnowParent = false;
+		for (unsigned int i2 = 0; i2 < pcScene->mNumMeshes;++i2)
+		{
+			if (i2 == i)continue;
+			// get the name of the mesh ([0] = name, [1] = parent)
+			std::string* szMyName2 = (std::string*)pcScene->mMeshes[i2]->mColors[1];
+			if (!szMyName2)
+			{
+				continue;
+			}
+			if (szMyName[0].length() == szMyName2[1].length() &&
+				0 == ASSIMP_stricmp ( szMyName[1].c_str(), szMyName2[0].c_str()))
+			{
+				bKnowParent = true;
+				break;
+			}
+		}
+		if (!bKnowParent)
+		{
+			aiList.push_back(i);
+		}
+	}
+	if (!aiList.empty())
+	{
+		std::vector<aiNode*> apcNodes;
+		apcNodes.reserve(aiList.size() + pcScene->mRootNode->mNumChildren);
+
+		for (unsigned int i = 0; i < pcScene->mRootNode->mNumChildren;++i)
+			apcNodes.push_back(pcScene->mRootNode->mChildren[i]);
+
+		delete[] pcScene->mRootNode->mChildren;
+		for (std::vector<unsigned int>::const_iterator
+			i =  aiList.begin();
+			i != aiList.end();++i)
+		{
+			std::string* szMyName = (std::string*)pcScene->mMeshes[*i]->mColors[1];
+			if (!szMyName)continue;
+
+			// the parent is not known, so we can assume that we must add 
+			// this node to the root node of the whole scene
+			aiNode* pcNode = new aiNode();
+			pcNode->mParent = pcScene->mRootNode;
+			pcNode->mName.Set(szMyName[1]);
+			this->AddNodes(pcScene,pcNode,szMyName[1].c_str());
+			apcNodes.push_back(pcNode);
+		}
+		pcScene->mRootNode->mChildren = new aiNode*[apcNodes.size()];
+		for (unsigned int i = 0; i < apcNodes.size();++i)
+			pcScene->mRootNode->mChildren[i] = apcNodes[i];
+
+		pcScene->mRootNode->mNumChildren = (unsigned int)apcNodes.size();
+	}
+
 	// if there is only one subnode, set it as root node
 	if (1 == pcScene->mRootNode->mNumChildren)
 	{
 		aiNode* pc = pcScene->mRootNode;
 		pcScene->mRootNode = pcScene->mRootNode->mChildren[0];
 		pcScene->mRootNode->mParent = NULL;
+
+		// make sure the destructor won't delete us ...
+		delete[] pc->mChildren;
+		pc->mChildren = NULL;
+		pc->mNumChildren = 0;
 		delete pc;
 	}
 	else if (0 == pcScene->mRootNode->mNumChildren)
@@ -278,7 +347,7 @@ void ASEImporter::BuildUniqueRepresentation(ASE::Mesh& mesh)
 	std::vector<aiVector3D> mNormals;
 	std::vector<BoneVertex> mBoneVertices;
 
-	unsigned int iSize = mesh.mFaces.size() * 3;
+	unsigned int iSize = (unsigned int)mesh.mFaces.size() * 3;
 	mPositions.resize(iSize);
 
 	// optional texture coordinates
@@ -527,7 +596,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
 	// validate the material index of the mesh
 	if (mesh.iMaterialIndex >= this->mParser->m_vMaterials.size())
 	{
-		mesh.iMaterialIndex = this->mParser->m_vMaterials.size()-1;
+		mesh.iMaterialIndex = (unsigned int)this->mParser->m_vMaterials.size()-1;
 		LOGOUT_WARN("Material index is out of range");
 	}
 
@@ -585,8 +654,8 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
 				avOutMeshes.push_back(p_pcOut);
 
 				// convert vertices
-				p_pcOut->mNumVertices = aiSplit[p].size()*3;
-				p_pcOut->mNumFaces = aiSplit[p].size();
+				p_pcOut->mNumVertices = (unsigned int)aiSplit[p].size()*3;
+				p_pcOut->mNumFaces = (unsigned int)aiSplit[p].size();
 
 				// receive output vertex weights
 				std::vector<std::pair<unsigned int, float> >* avOutputBones;
@@ -693,7 +762,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
 							aiBone* pc = *pcBone = new aiBone();
 							pc->mName.Set(mesh.mBones[mrspock].mName);
 
-							pc->mNumWeights = avOutputBones[mrspock].size();
+							pc->mNumWeights = (unsigned int)avOutputBones[mrspock].size();
 							pc->mWeights = new aiVertexWeight[pc->mNumWeights];
 
 							for (unsigned int captainkirk = 0; captainkirk < pc->mNumWeights;++captainkirk)
@@ -736,8 +805,8 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
 		((std::string*)p_pcOut->mColors[1])[1] = mesh.mParent;
 
 		// convert vertices
-		p_pcOut->mNumVertices = mesh.mPositions.size();
-		p_pcOut->mNumFaces = mesh.mFaces.size();
+		p_pcOut->mNumVertices = (unsigned int)mesh.mPositions.size();
+		p_pcOut->mNumFaces = (unsigned int)mesh.mFaces.size();
 
 		// allocate enough storage for faces
 		p_pcOut->mFaces = new aiFace[p_pcOut->mNumFaces];
@@ -822,7 +891,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
 				{
 					aiBone* pc = *pcBone = new aiBone();
 					pc->mName.Set(mesh.mBones[jfkennedy].mName);
-					pc->mNumWeights = avBonesOut[jfkennedy].size();
+					pc->mNumWeights = (unsigned int)avBonesOut[jfkennedy].size();
 					pc->mWeights = new aiVertexWeight[pc->mNumWeights];
 					memcpy(pc->mWeights,&avBonesOut[jfkennedy][0],
 						sizeof(aiVertexWeight) * pc->mNumWeights);
@@ -834,39 +903,23 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
 	return;
 }
 // ------------------------------------------------------------------------------------------------
-void ASEImporter::AskFilterLOD(std::vector<ASE::Mesh>& meshes)
+void ComputeBounds(ASE::Mesh& mesh,aiVector3D& minVec, aiVector3D& maxVec,
+				   aiMatrix4x4& matrix)
 {
-	for (std::vector<ASE::Mesh>::iterator
-		i =  meshes.begin();
-		i != meshes.end();++i)
+	minVec = aiVector3D( 1e10f, 1e10f, 1e10f);
+	maxVec = aiVector3D( -1e10f, -1e10f, -1e10f);
+	for( std::vector<aiVector3D>::const_iterator
+		i =  mesh.mPositions.begin();
+		i != mesh.mPositions.end();++i)
 	{
-		if ((*i).bSkip)continue;
-
-		// search for a number in the name of the node
-		const char* sz = (*i).mName.c_str();
-		while (*sz)
-		{
-			if (*sz >= '0' && *sz <= '9')
-			{
-				// check whether there is another mesh with exactly
-				// the same name, but a lower number out there ...
-				unsigned int iLen = (unsigned int)(sz - (*i).mName.c_str());
-				unsigned int iMyNum = strtol10(sz,NULL);
-				for (std::vector<ASE::Mesh>::iterator
-					f =  meshes.begin();
-					f != meshes.end();++f)
-				{
-					const char* sz = (*f).mName.c_str();
-					if (i != f && !(*f).bSkip && 
-						0 == memcmp(sz,(*i).mName.c_str(),iLen) &&
-						iMyNum > strtol10(sz))
-					{	
-						(*f).bSkip = true;
-					}
-				}
-				break;
-			}++sz;
-		}
+		aiVector3D v = matrix*(*i);
+
+		minVec.x = std::min( minVec.x, v.x);
+		minVec.y = std::min( minVec.y, v.y);
+		minVec.z = std::min( minVec.z, v.z);
+		maxVec.x = std::max( maxVec.x, v.x);
+		maxVec.y = std::max( maxVec.y, v.y);
+		maxVec.z = std::max( maxVec.z, v.z);
 	}
 	return;
 }

+ 0 - 7
code/ASELoader.h

@@ -115,13 +115,6 @@ protected:
 	 */
 	void TransformVertices(ASE::Mesh& mesh);
 
-	// -------------------------------------------------------------------
-	/** The ASK file format contains LOD nodes.
-	 *  We do only use the highest level of detail, all others
-	 *  are skipped.
-	 */
-	void AskFilterLOD(std::vector<ASE::Mesh>& meshes);
-
 	// -------------------------------------------------------------------
 	/** Create one-material-per-mesh meshes ;-)
 	 * \param mesh Mesh to work with

+ 43 - 5
code/ASEParser.cpp

@@ -41,8 +41,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /** @file Implementation of the ASE parser class */
 
+#include "TextureTransform.h"
 #include "ASELoader.h"
 #include "MaterialSystem.h"
+
 #include "../include/DefaultLogger.h"
 #include "fast_atof.h"
 
@@ -82,19 +84,31 @@ void Parser::LogWarning(const char* szWarn)
 	ai_assert(strlen(szWarn) < 950);
 
 	char szTemp[1024];
-	sprintf(szTemp,"Line %i: %s",this->iLineNumber,szWarn);
+	sprintf(szTemp,"Line %i: %s",this->iLineNumber/2 /* fixme */,szWarn);
 
 	// output the warning to the logger ...
 	DefaultLogger::get()->warn(szTemp);
 }
 // ------------------------------------------------------------------------------------------------
+void Parser::LogInfo(const char* szWarn)
+{
+	ai_assert(NULL != szWarn);
+	ai_assert(strlen(szWarn) < 950);
+
+	char szTemp[1024];
+	sprintf(szTemp,"Line %i: %s",this->iLineNumber/2 /* fixme */,szWarn);
+
+	// output the information to the logger ...
+	DefaultLogger::get()->info(szTemp);
+}
+// ------------------------------------------------------------------------------------------------
 void Parser::LogError(const char* szWarn)
 {
 	ai_assert(NULL != szWarn);
 	ai_assert(strlen(szWarn) < 950);
 
 	char szTemp[1024];
-	sprintf(szTemp,"Line %i: %s",this->iLineNumber,szWarn);
+	sprintf(szTemp,"Line %i: %s",this->iLineNumber/2 /* fixme */,szWarn);
 
 	// throw an exception
 	throw new ImportErrorException(szTemp);
@@ -203,6 +217,30 @@ void Parser::Parse()
 				continue;
 			}
 			// ignore comments, lights and cameras
+			// (display comments on the console)
+			if (0 == strncmp(this->m_szFile,"*LIGHTOBJECT",12) &&
+				IsSpaceOrNewLine(*(this->m_szFile+12)))
+			{
+				this->m_szFile+=13;
+				this->LogInfo("Found light source (*LIGHTOBJECT chunk). It will be ignored");
+				continue;
+			}
+			if (0 == strncmp(this->m_szFile,"*CAMERAOBJECT",13) &&
+				IsSpaceOrNewLine(*(this->m_szFile+13)))
+			{
+				this->m_szFile+=14;
+				this->LogInfo("Found virtual camera (*CAMERAOBJECT chunk). It will be ignored");
+				continue;
+			}
+			if (0 == strncmp(this->m_szFile,"*COMMENT",8) &&
+				IsSpaceOrNewLine(*(this->m_szFile+8)))
+			{
+				this->m_szFile+=9;
+				std::string out = "<unknown>";
+				this->ParseString(out,"*COMMENT");
+				this->LogInfo(("Comment: " + out).c_str());
+				continue;
+			}
 		}
 		else if ('{' == *this->m_szFile)iDepth++;
 		else if ('}' == *this->m_szFile)
@@ -266,7 +304,7 @@ void Parser::ParseLV1MaterialListBlock()
 {
 	int iDepth = 0;
 	unsigned int iMaterialCount = 0;
-	unsigned int iOldMaterialCount = this->m_vMaterials.size();
+	unsigned int iOldMaterialCount = (unsigned int)this->m_vMaterials.size();
 	while (true)
 	{
 		if ('*' == *this->m_szFile)
@@ -1076,7 +1114,7 @@ void Parser::ParseLV4MeshBonesVertices(unsigned int iNumVertices,ASE::Mesh& mesh
 				unsigned int iIndex = strtol10(this->m_szFile,&this->m_szFile);
 				if (iIndex >= mesh.mPositions.size())
 				{
-					iIndex = mesh.mPositions.size()-1;
+					iIndex = (unsigned int)mesh.mPositions.size()-1;
 					this->LogWarning("Bone vertex index is out of bounds. Using the largest valid "
 						"bone vertex index instead");
 				}
@@ -1482,7 +1520,7 @@ void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh& sMesh)
 				if (iIndex >= sMesh.mNormals.size())
 				{
 					this->LogWarning("Normal index is too large");
-					iIndex = sMesh.mNormals.size()-1;
+					iIndex = (unsigned int)sMesh.mNormals.size()-1;
 				}
 
 				// important: this->m_szFile might now point to '}' ...

+ 5 - 3
code/ASEParser.h

@@ -74,9 +74,6 @@ struct Material : public Dot3DS::Material
 	Material() : pcInstance(NULL), bNeed (false)
 	{}
 
-	//! Ambient texture channel
-	Texture sTexAmbient;
-
 	//! Contains all sub materials of this material
 	std::vector<Material> avSubMaterials;
 
@@ -417,6 +414,11 @@ private:
 	//! \param szWarn Warn message
 	void LogWarning(const char* szWarn);
 
+	// -------------------------------------------------------------------
+	//! Output a message to the logger
+	//! \param szWarn Message
+	void LogInfo(const char* szWarn);
+
 	// -------------------------------------------------------------------
 	//! Output an error to the logger
 	//! \param szWarn Error message

+ 1 - 1
code/DefaultIOStream.cpp

@@ -82,7 +82,7 @@ aiReturn DefaultIOStream::Seek(size_t pOffset,
 {
 	if (!this->mFile)return AI_FAILURE;
 
-	return (0 == fseek(this->mFile, pOffset,
+	return (0 == fseek(this->mFile, (long)pOffset,
 		(aiOrigin_CUR == pOrigin ? SEEK_CUR :
 		(aiOrigin_END == pOrigin ? SEEK_END : SEEK_SET))) 
 		? AI_SUCCESS : AI_FAILURE);

+ 3 - 3
code/JoinVerticesProcess.cpp

@@ -211,14 +211,14 @@ bool JoinVerticesProcess::ProcessMesh( aiMesh* pMesh)
 		} else
 		{
 			// no unique vertex matches it upto now -> so add it
-			replaceIndex[a] = uniqueVertices.size();
+			replaceIndex[a] = (unsigned int)uniqueVertices.size();
 			uniqueVertices.push_back( v);
 			isVertexUnique[a] = true;
 		}
 	}
 
 	// replace vertex data with the unique data sets
-	pMesh->mNumVertices = uniqueVertices.size();
+	pMesh->mNumVertices = (unsigned int)uniqueVertices.size();
 	// Position
 	delete [] pMesh->mVertices;
 	pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
@@ -307,7 +307,7 @@ bool JoinVerticesProcess::ProcessMesh( aiMesh* pMesh)
 
 		// kill the old and replace them with the translated weights
 		delete [] bone->mWeights;
-		bone->mNumWeights = newWeights.size();
+		bone->mNumWeights = (unsigned int)newWeights.size();
 		bone->mWeights = new aiVertexWeight[bone->mNumWeights];
 		memcpy( bone->mWeights, &newWeights[0], bone->mNumWeights * sizeof( aiVertexWeight));
 	}

+ 1 - 1
code/MD2Loader.cpp

@@ -352,7 +352,7 @@ void MD2Importer::InternReadFile(
 	}
 
 	// allocate output storage
-	pScene->mMeshes[0]->mNumVertices = vPositions.size();
+	pScene->mMeshes[0]->mNumVertices = (unsigned int)vPositions.size();
 	pScene->mMeshes[0]->mVertices = new aiVector3D[vPositions.size()];
 	pScene->mMeshes[0]->mNormals = new aiVector3D[vPositions.size()];
 	pScene->mMeshes[0]->mTextureCoords[0] = new aiVector3D[vPositions.size()];

+ 9 - 9
code/MDLLoader.cpp

@@ -1006,7 +1006,7 @@ void MDLImporter::InternReadFile_GameStudio( )
 	}
 
 	// allocate output storage
-	pScene->mMeshes[0]->mNumVertices = vPositions.size();
+	pScene->mMeshes[0]->mNumVertices = (unsigned int)vPositions.size();
 	pScene->mMeshes[0]->mVertices = new aiVector3D[vPositions.size()];
 	pScene->mMeshes[0]->mNormals = new aiVector3D[vPositions.size()];
 	pScene->mMeshes[0]->mTextureCoords[0] = new aiVector3D[vPositions.size()];
@@ -1498,7 +1498,7 @@ void MDLImporter::InternReadFile_GameStudioA7( )
 
 			// allocate the array
 			aiSplit = new std::vector<unsigned int>*[pcMats.size()];
-			iNumMaterials = pcMats.size();
+			iNumMaterials = (unsigned int)pcMats.size();
 
 			for (unsigned int m = 0; m < pcMats.size();++m)
 				aiSplit[m] = new std::vector<unsigned int>();
@@ -1581,7 +1581,7 @@ void MDLImporter::InternReadFile_GameStudioA7( )
 
 					// and add it to the list
 					avMats.push_back(sHelper);
-					iNum = avMats.size()-1;
+					iNum = (unsigned int)avMats.size()-1;
 				}
 				// adjust the size of the file array
 				if (iNum == aiTempSplit.size())
@@ -1601,12 +1601,12 @@ void MDLImporter::InternReadFile_GameStudioA7( )
 			else
 			{
 				// TODO: This might result in redundant materials ...
-				unsigned int iOld = pcMats.size();
+				unsigned int iOld = (unsigned int)pcMats.size();
 				pcMats.resize(pcMats.size() + avMats.size());
 				for (unsigned int o = iOld; o < avMats.size();++o)
 					pcMats[o] = avMats[o].pcMat;
 			}
-			iNumMaterials = pcMats.size();
+			iNumMaterials = (unsigned int)pcMats.size();
 
 			// and build the final face-to-material array
 			aiSplit = new std::vector<unsigned int>*[aiTempSplit.size()];
@@ -1617,7 +1617,7 @@ void MDLImporter::InternReadFile_GameStudioA7( )
 		}
 
 		// now generate output meshes
-		unsigned int iOldSize = avOutList.size();
+		unsigned int iOldSize = (unsigned int)avOutList.size();
 		this->GenerateOutputMeshes_GameStudioA7(
 			(const std::vector<unsigned int>**)aiSplit,pcMats,
 			avOutList,pcFaces,vPositions,vNormals, vTextureCoords1,vTextureCoords2);
@@ -1656,7 +1656,7 @@ void MDLImporter::InternReadFile_GameStudioA7( )
 __BREAK_OUT: // EVIL ;-)
 
 	// now we need to build a final mesh list
-	this->pScene->mNumMeshes = avOutList.size();
+	this->pScene->mNumMeshes = (unsigned int)avOutList.size();
 	this->pScene->mMeshes = new aiMesh*[avOutList.size()];
 
 	for (unsigned int i = 0; i < avOutList.size();++i)
@@ -1665,7 +1665,7 @@ __BREAK_OUT: // EVIL ;-)
 	}
 
 	// build a final material list. Offset all mesh material indices
-	this->pScene->mNumMaterials = pcMats.size();
+	this->pScene->mNumMaterials = (unsigned int)pcMats.size();
 	this->pScene->mMaterials = new aiMaterial*[this->pScene->mNumMaterials];
 	for (unsigned int i = 0; i < this->pScene->mNumMaterials;++i)
 		this->pScene->mMaterials[i] = pcMats[i];
@@ -1722,7 +1722,7 @@ void MDLImporter::GenerateOutputMeshes_GameStudioA7(
 			pcMesh->mMaterialIndex = i;
 
 			// allocate output storage
-			pcMesh->mNumFaces = aiSplit[i]->size();
+			pcMesh->mNumFaces = (unsigned int)aiSplit[i]->size();
 			pcMesh->mFaces = new aiFace[pcMesh->mNumFaces];
 
 			pcMesh->mNumVertices = pcMesh->mNumFaces*3;

+ 5 - 5
code/ObjFileImporter.cpp

@@ -166,7 +166,7 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model* pModel, const ObjFile
 	// Create all nodes from the subobjects stored in the current object
 	if (!pData->m_SubObjects.empty())
 	{
-		pNode->mNumChildren = pData->m_SubObjects.size();
+		pNode->mNumChildren = (unsigned int)pData->m_SubObjects.size();
 		pNode->mChildren = new aiNode*[pData->m_SubObjects.size()];
 		pNode->mNumMeshes = 1;
 		pNode->mMeshes = new unsigned int[1];
@@ -217,12 +217,12 @@ void ObjFileImporter::createTopology(const ObjFile::Model* pModel, const ObjFile
 	createVertexArray(pModel, pData, pMesh);
 
 	// Create faces
-	pMesh->mNumFaces = pData->m_Faces.size();
+	pMesh->mNumFaces = (unsigned int)pData->m_Faces.size();
 	pMesh->mFaces = new aiFace[pMesh->mNumFaces];
 	for (size_t index = 0; index < pMesh->mNumFaces; index++)
 	{
 		aiFace *pFace = &pMesh->mFaces[ index ];
-		pFace->mNumIndices = pData->m_Faces[index]->m_pVertices->size();
+		pFace->mNumIndices = (unsigned int)pData->m_Faces[index]->m_pVertices->size();
 		if (pFace->mNumIndices > 0)
 		{
 			pFace->mIndices = new unsigned int[pMesh->mFaces[index].mNumIndices];
@@ -255,7 +255,7 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
 		return;
 	
 	// Copy all stored vertices, normals and so on
-	pMesh->mNumVertices = pModel->m_Vertices.size();
+	pMesh->mNumVertices = (unsigned int)pModel->m_Vertices.size();
 	pMesh->mVertices = new aiVector3D[pMesh->mNumVertices];
 	for (size_t index=0; index < pModel->m_Vertices.size(); index++)
 	{
@@ -284,7 +284,7 @@ void ObjFileImporter::countObjects(const std::vector<ObjFile::Object*> &rObjects
 	if (rObjects.empty())	
 		return;
 
-	iNumMeshes += rObjects.size();
+	iNumMeshes += (unsigned int)rObjects.size();
 	for (std::vector<ObjFile::Object*>::const_iterator it = rObjects.begin();
 		it != rObjects.end(); 
 		++it)

+ 11 - 11
code/PlyLoader.cpp

@@ -133,7 +133,7 @@ void PLYImporter::InternReadFile(
 		{
 			szMe += 6;
 			SkipLine(szMe,(const char**)&szMe);
-			if(!PLY::DOM::ParseInstance(szMe,&sPlyDom, fileSize))
+			if(!PLY::DOM::ParseInstance(szMe,&sPlyDom, (unsigned int)fileSize))
 			{
 				throw new ImportErrorException( "Invalid .ply file: Unable to build DOM (#1)");
 			}
@@ -153,7 +153,7 @@ void PLYImporter::InternReadFile(
 
 			// skip the line, parse the rest of the header and build the DOM
 			SkipLine(szMe,(const char**)&szMe);
-			if(!PLY::DOM::ParseInstanceBinary(szMe,&sPlyDom,bIsBE, fileSize))
+			if(!PLY::DOM::ParseInstanceBinary(szMe,&sPlyDom,bIsBE, (unsigned int)fileSize))
 			{
 				throw new ImportErrorException( "Invalid .ply file: Unable to build DOM (#2)");
 			}
@@ -196,7 +196,7 @@ void PLYImporter::InternReadFile(
 				"a face list. ");
 		}
 
-		unsigned int iNum = avPositions.size() / 3;
+		unsigned int iNum = (unsigned int)avPositions.size() / 3;
 		for (unsigned int i = 0; i< iNum;++i)
 		{
 			PLY::Face sFace;
@@ -233,13 +233,13 @@ void PLYImporter::InternReadFile(
 	}
 
 	// now generate the output scene object. Fill the material list
-	pScene->mNumMaterials = avMaterials.size();
+	pScene->mNumMaterials = (unsigned int)avMaterials.size();
 	pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials];
 	for (unsigned int i = 0; i < pScene->mNumMaterials;++i)
 		pScene->mMaterials[i] = avMaterials[i];
 
 	// fill the mesh list
-	pScene->mNumMeshes = avMeshes.size();
+	pScene->mNumMeshes = (unsigned int)avMeshes.size();
 	pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
 	for (unsigned int i = 0; i < pScene->mNumMeshes;++i)
 		pScene->mMeshes[i] = avMeshes[i];
@@ -292,14 +292,14 @@ void PLYImporter::ConvertMeshes(std::vector<PLY::Face>* avFaces,
 			aiMesh* p_pcOut = new aiMesh();
 			p_pcOut->mMaterialIndex = p;
 
-			p_pcOut->mNumFaces = aiSplit[p].size();
+			p_pcOut->mNumFaces = (unsigned int)aiSplit[p].size();
 			p_pcOut->mFaces = new aiFace[aiSplit[p].size()];
 
 			// at first we need to determine the size of the output vector array
 			unsigned int iNum = 0;
 			for (unsigned int i = 0; i < aiSplit[p].size();++i)
 			{
-				iNum += (*avFaces)[aiSplit[p][i]].mIndices.size();
+				iNum += (unsigned int)(*avFaces)[aiSplit[p][i]].mIndices.size();
 			}
 			p_pcOut->mNumVertices = iNum;
 			p_pcOut->mVertices = new aiVector3D[iNum];
@@ -321,7 +321,7 @@ void PLYImporter::ConvertMeshes(std::vector<PLY::Face>* avFaces,
 				i =  aiSplit[p].begin();
 				i != aiSplit[p].end();++i,++iNum)
 			{
-				p_pcOut->mFaces[iNum].mNumIndices = (*avFaces)[*i].mIndices.size(); 
+				p_pcOut->mFaces[iNum].mNumIndices = (unsigned int)(*avFaces)[*i].mIndices.size(); 
 				p_pcOut->mFaces[iNum].mIndices = new unsigned int[p_pcOut->mFaces[iNum].mNumIndices];
 
 				// build an unique set of vertices/colors for this face
@@ -365,12 +365,12 @@ void PLYImporter::ReplaceDefaultMaterial(std::vector<PLY::Face>* avFaces,
 		if (0xFFFFFFFF == (*i).iMaterialIndex)
 		{
 			bNeedDefaultMat = true;
-			(*i).iMaterialIndex = avMaterials->size();
+			(*i).iMaterialIndex = (unsigned int)avMaterials->size();
 		}
 		else if ((*i).iMaterialIndex >= avMaterials->size() )
 		{
 			// clamp the index
-			(*i).iMaterialIndex = avMaterials->size()-1;
+			(*i).iMaterialIndex = (unsigned int)avMaterials->size()-1;
 		}
 	}
 
@@ -796,7 +796,7 @@ void PLYImporter::LoadFaces(std::vector<PLY::Face>* pvOut)
 				// parse the list of vertex indices
 				if (0xFFFFFFFF != iProperty)
 				{
-					const unsigned int iNum = (*i)->alProperties[iProperty].avList.size();
+					const unsigned int iNum = (unsigned int)(*i)->alProperties[iProperty].avList.size();
 					sFace.mIndices.resize(iNum);
 
 					if (3 > iNum)

+ 1 - 1
code/PretransformVertices.cpp

@@ -337,7 +337,7 @@ void PretransformVertices::Execute( aiScene* pScene)
 	if (apcOutMeshes.size() != pScene->mNumMeshes)
 	{
 		delete[] pScene->mMeshes;
-		pScene->mNumMeshes = apcOutMeshes.size();
+		pScene->mNumMeshes = (unsigned int)apcOutMeshes.size();
 		pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
 	}
 	for (unsigned int i = 0; i < pScene->mNumMeshes;++i)

+ 2 - 2
code/SpatialSort.cpp

@@ -97,8 +97,8 @@ void SpatialSort::FindPositions( const aiVector3D& pPosition, float pRadius, std
 		return;
 
 	// do a binary search for the minimal distance to start the iteration there
-	unsigned int index = mPositions.size() / 2;
-	unsigned int binaryStepSize = mPositions.size() / 4;
+	unsigned int index = (unsigned int)mPositions.size() / 2;
+	unsigned int binaryStepSize = (unsigned int)mPositions.size() / 4;
 	while( binaryStepSize > 1)
 	{
 		if( mPositions[index].mDistance < minDist)

+ 4 - 4
code/SplitLargeMeshes.cpp

@@ -112,7 +112,7 @@ void SplitLargeMeshesProcess_Triangle::Execute( aiScene* pScene)
 	{
 		// it seems something has been splitted. rebuild the mesh list
 		delete[] pScene->mMeshes;
-		pScene->mNumMeshes = avList.size();
+		pScene->mNumMeshes = (unsigned int)avList.size();
 		pScene->mMeshes = new aiMesh*[avList.size()];
 
 		for (unsigned int i = 0; i < avList.size();++i)
@@ -146,7 +146,7 @@ void SplitLargeMeshesProcess_Triangle::UpdateNode(aiNode* pcNode,
 
 	// now build the new list
 	delete pcNode->mMeshes;
-	pcNode->mNumMeshes = aiEntries.size();
+	pcNode->mNumMeshes = (unsigned int)aiEntries.size();
 	pcNode->mMeshes = new unsigned int[pcNode->mNumMeshes];
 
 	for (unsigned int b = 0; b < pcNode->mNumMeshes;++b)
@@ -334,7 +334,7 @@ void SplitLargeMeshesProcess_Vertex::Execute( aiScene* pScene)
 	{
 		// it seems something has been splitted. rebuild the mesh list
 		delete[] pScene->mMeshes;
-		pScene->mNumMeshes = avList.size();
+		pScene->mNumMeshes = (unsigned int)avList.size();
 		pScene->mMeshes = new aiMesh*[avList.size()];
 
 		for (unsigned int i = 0; i < avList.size();++i)
@@ -504,7 +504,7 @@ void SplitLargeMeshesProcess_Vertex::SplitMesh(
 			}
 			// copy the face list to the mesh
 			pcMesh->mFaces = new aiFace[vFaces.size()];
-			pcMesh->mNumFaces = vFaces.size();
+			pcMesh->mNumFaces = (unsigned int)vFaces.size();
 
 			for (unsigned int p = 0; p < pcMesh->mNumFaces;++p)
 				pcMesh->mFaces[p] = vFaces[p];

+ 432 - 0
code/TextureTransform.cpp

@@ -0,0 +1,432 @@
+/*
+Open Asset Import Library (ASSIMP)
+----------------------------------------------------------------------
+
+Copyright (c) 2006-2008, ASSIMP Development Team
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms, 
+with or without modification, are permitted provided that the 
+following conditions are met:
+
+* Redistributions of source code must retain the above
+  copyright notice, this list of conditions and the
+  following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+  copyright notice, this list of conditions and the
+  following disclaimer in the documentation and/or other
+  materials provided with the distribution.
+
+* Neither the name of the ASSIMP team, nor the names of its
+  contributors may be used to endorse or promote products
+  derived from this software without specific prior
+  written permission of the ASSIMP Development Team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----------------------------------------------------------------------
+*/
+
+/** @file A helper class that processes texture transformations */
+
+
+#include "../include/aiTypes.h"
+#include "../include/DefaultLogger.h"
+#include "../include/aiAssert.h"
+
+#include "MaterialSystem.h"
+#include "TextureTransform.h"
+
+namespace Assimp
+{
+
+// ------------------------------------------------------------------------------------------------
+void TextureTransform::PreProcessUVTransform(
+	Dot3DS::Texture& rcIn)
+{
+	if (rcIn.mOffsetU && 0.0f == fmodf(rcIn.mOffsetU, 1.0f ))
+	{
+		DefaultLogger::get()->warn("Texture coordinate offset in the x direction "
+			"is a multiple of 1. This is redundant ...");
+		rcIn.mOffsetU = 1.0f;
+	}
+	if (rcIn.mOffsetV && 0.0f == fmodf(rcIn.mOffsetV, 1.0f ))
+	{
+		DefaultLogger::get()->warn("Texture coordinate offset in the y direction "
+				"is a multiple of 1. This is redundant ...");
+		rcIn.mOffsetV = 1.0f;
+	}
+	if (rcIn.mRotation)
+	{
+		const float f =  fmodf(rcIn.mRotation,2.0f * 3.141592653f );
+		if (f <= 0.05f && f >= -0.05f)
+		{
+			DefaultLogger::get()->warn("Texture coordinate rotation is a multiple "
+				"of 2 * PI. This is redundant");
+			rcIn.mRotation = 0.0f;
+		}
+	}
+}
+// ------------------------------------------------------------------------------------------------
+void TextureTransform::AddToList(std::vector<STransformVecInfo>& rasVec,
+	Dot3DS::Texture* pcTex)
+{
+	// check whether the texture is existing
+	if (0 == pcTex->mMapName.length())return;
+
+	// search for an identical transformation in our list
+	for (std::vector<STransformVecInfo>::iterator
+		i =  rasVec.begin();
+		i != rasVec.end();++i)
+	{
+		if ((*i).fOffsetU == pcTex->mOffsetU &&
+			(*i).fOffsetV == pcTex->mOffsetV && 
+			(*i).fScaleU  == pcTex->mScaleU  &&
+			(*i).fScaleV  == pcTex->mScaleV  &&
+			(*i).fRotation == pcTex->mRotation)
+		{
+			(*i).pcTextures.push_back(pcTex);
+			return;
+		}
+	}
+	// this is a new transformation, so add it to the list
+	STransformVecInfo sInfo;
+	sInfo.fScaleU = pcTex->mScaleU;
+	sInfo.fScaleV = pcTex->mScaleV;
+	sInfo.fOffsetU = pcTex->mOffsetU;
+	sInfo.fOffsetV = pcTex->mOffsetV;
+	sInfo.fRotation = pcTex->mRotation;
+	sInfo.pcTextures.push_back(pcTex);
+
+	rasVec.push_back(sInfo);
+}
+// ------------------------------------------------------------------------------------------------
+void TextureTransform::ApplyScaleNOffset(Dot3DS::Material& material)
+{
+	unsigned int iCnt = 0;
+	Dot3DS::Texture* pcTexture = NULL;
+	// diffuse texture
+	if (material.sTexDiffuse.mMapName.length())
+	{
+		PreProcessUVTransform(material.sTexDiffuse);
+		if (HasUVTransform(material.sTexDiffuse))
+		{
+			material.sTexDiffuse.bPrivate = true;
+			pcTexture = &material.sTexDiffuse;
+			++iCnt;
+		}
+	}
+	// specular texture
+	if (material.sTexSpecular.mMapName.length())
+	{
+		PreProcessUVTransform(material.sTexSpecular);
+		if (HasUVTransform(material.sTexSpecular))
+		{
+			material.sTexSpecular.bPrivate = true;
+			pcTexture = &material.sTexSpecular;
+			++iCnt;
+		}
+	}
+	// ambient texture
+	if (material.sTexAmbient.mMapName.length())
+	{
+		PreProcessUVTransform(material.sTexAmbient);
+		if (HasUVTransform(material.sTexAmbient))
+		{
+			material.sTexAmbient.bPrivate = true;
+			pcTexture = &material.sTexAmbient;
+			++iCnt;
+		}
+	}
+	// emissive texture
+	if (material.sTexEmissive.mMapName.length())
+	{
+		PreProcessUVTransform(material.sTexEmissive);
+		if (HasUVTransform(material.sTexEmissive))
+		{
+			material.sTexEmissive.bPrivate = true;
+			pcTexture = &material.sTexEmissive;
+			++iCnt;
+		}
+	}
+	// opacity texture
+	if (material.sTexOpacity.mMapName.length())
+	{
+		PreProcessUVTransform(material.sTexOpacity);
+		if (HasUVTransform(material.sTexOpacity))
+		{
+			material.sTexOpacity.bPrivate = true;
+			pcTexture = &material.sTexOpacity;
+			++iCnt;
+		}
+	}
+	// bump texture
+	if (material.sTexBump.mMapName.length())
+	{
+		PreProcessUVTransform(material.sTexBump);
+		if (HasUVTransform(material.sTexBump))
+		{
+			material.sTexBump.bPrivate = true;
+			pcTexture = &material.sTexBump;
+			++iCnt;
+		}
+	}
+	// shininess texture
+	if (material.sTexShininess.mMapName.length())
+	{
+		PreProcessUVTransform(material.sTexShininess);
+		if (HasUVTransform(material.sTexShininess))
+		{
+			material.sTexBump.bPrivate = true;
+			pcTexture = &material.sTexShininess;
+			++iCnt;
+		}
+	}
+	if (0 != iCnt)
+	{
+		// if only one texture needs scaling/offset operations
+		// we can apply them directly to the first texture
+		// coordinate sets of all meshes referencing *this* material
+		// However, we can't do it  now. We need to wait until
+		// everything is sorted by materials.
+		if (1 == iCnt)
+		{
+			material.iBakeUVTransform = 1;
+			material.pcSingleTexture = pcTexture;
+		}
+		// we will need to generate a separate new texture channel
+		// for each texture. 
+		// However, we can't do it  now. We need to wait until
+		// everything is sorted by materials.
+		else material.iBakeUVTransform = 2;
+	}
+}
+// ------------------------------------------------------------------------------------------------
+void TextureTransform::ApplyScaleNOffset(std::vector<Dot3DS::Material> materials)
+{
+	unsigned int iNum = 0;
+	for (std::vector<Dot3DS::Material>::iterator
+		i =  materials.begin();
+		i != materials.end();++i,++iNum)
+	{
+		ApplyScaleNOffset(*i);
+	}
+	return;
+}
+// ------------------------------------------------------------------------------------------------
+void TextureTransform::BakeScaleNOffset(
+	aiMesh* pcMesh, Dot3DS::Material* pcSrc)
+{
+	// NOTE: we don't use a texture matrix to do the transformation
+	// it is more efficient this way ... 
+
+	if (!pcMesh->mTextureCoords[0])return;
+	if (1 == pcSrc->iBakeUVTransform)
+	{
+		std::string s;
+		std::stringstream ss(s);
+		ss << "Transforming existing UV channel. Source UV: " << 0 
+			<< " OffsetU: " << pcSrc->pcSingleTexture->mOffsetU
+			<< " OffsetV: " << pcSrc->pcSingleTexture->mOffsetV
+			<< " ScaleU: " << pcSrc->pcSingleTexture->mScaleU
+			<< " ScaleV: " << pcSrc->pcSingleTexture->mScaleV
+			<< " Rotation (rad): " << pcSrc->pcSingleTexture->mRotation;
+		DefaultLogger::get()->info(s);
+
+		if (!pcSrc->pcSingleTexture->mRotation)
+		{
+			for (unsigned int i = 0; i < pcMesh->mNumVertices;++i)
+			{
+				// scaling
+				pcMesh->mTextureCoords[0][i].x *= pcSrc->pcSingleTexture->mScaleU;
+				pcMesh->mTextureCoords[0][i].y *= pcSrc->pcSingleTexture->mScaleV;
+
+				// offset
+				pcMesh->mTextureCoords[0][i].x += pcSrc->pcSingleTexture->mOffsetU;
+				pcMesh->mTextureCoords[0][i].y += pcSrc->pcSingleTexture->mOffsetV;
+			}
+		}
+		else
+		{
+			const float fSin = sinf(pcSrc->pcSingleTexture->mRotation);
+			const float fCos = cosf(pcSrc->pcSingleTexture->mRotation);
+			for (unsigned int i = 0; i < pcMesh->mNumVertices;++i)
+			{
+				// scaling
+				pcMesh->mTextureCoords[0][i].x *= pcSrc->pcSingleTexture->mScaleU;
+				pcMesh->mTextureCoords[0][i].y *= pcSrc->pcSingleTexture->mScaleV;
+
+				// rotation
+				pcMesh->mTextureCoords[0][i].x *= fCos;
+				pcMesh->mTextureCoords[0][i].y *= fSin;
+
+				// offset
+				pcMesh->mTextureCoords[0][i].x += pcSrc->pcSingleTexture->mOffsetU;
+				pcMesh->mTextureCoords[0][i].y += pcSrc->pcSingleTexture->mOffsetV;
+			}
+		}
+	}
+	else if (2 == pcSrc->iBakeUVTransform)
+	{
+		// now we need to find all textures in the material
+		// which require scaling/offset operations
+		std::vector<STransformVecInfo> sOps;
+		AddToList(sOps,&pcSrc->sTexDiffuse);
+		AddToList(sOps,&pcSrc->sTexSpecular);
+		AddToList(sOps,&pcSrc->sTexEmissive);
+		AddToList(sOps,&pcSrc->sTexOpacity);
+		AddToList(sOps,&pcSrc->sTexBump);
+		AddToList(sOps,&pcSrc->sTexShininess);
+		AddToList(sOps,&pcSrc->sTexAmbient);
+
+		const aiVector3D* _pvBase;
+		if (0.0f == sOps[0].fOffsetU && 0.0f == sOps[0].fOffsetV &&
+			1.0f == sOps[0].fScaleU  && 1.0f == sOps[0].fScaleV &&
+			0.0f == sOps[0].fRotation)
+		{
+			// we'll have an unmodified set, so we can use *this* one
+			_pvBase = pcMesh->mTextureCoords[0];
+		}
+		else
+		{
+			_pvBase = new aiVector3D[pcMesh->mNumVertices];
+			memcpy(const_cast<aiVector3D*>(_pvBase),pcMesh->mTextureCoords[0],
+				pcMesh->mNumVertices * sizeof(aiVector3D));
+		}
+
+		unsigned int iCnt = 0;
+		for (std::vector<STransformVecInfo>::iterator
+			i =  sOps.begin();
+			i != sOps.end();++i,++iCnt)
+		{
+			if (!pcMesh->mTextureCoords[iCnt])
+			{
+				pcMesh->mTextureCoords[iCnt] = new aiVector3D[pcMesh->mNumVertices];
+			}
+
+			// more than 4 UV texture channels are not available
+			if (iCnt >= AI_MAX_NUMBER_OF_TEXTURECOORDS)
+			{
+				for (std::vector<Dot3DS::Texture*>::iterator
+					a =  (*i).pcTextures.begin();
+					a != (*i).pcTextures.end();++a)
+				{
+					(*a)->iUVSrc = 0;
+				}
+				DefaultLogger::get()->error("There are too many "
+					"combinations of different UV scaling/offset/rotation operations "
+					"to generate an UV channel for each (maximum is 4). Using the "
+					"first UV channel ...");
+				continue;
+			}
+
+			std::string s;
+			std::stringstream ss(s);
+			ss << "Generating additional UV channel. Source UV: " << 0 
+				<< " OffsetU: " << (*i).fOffsetU
+				<< " OffsetV: " << (*i).fOffsetV
+				<< " ScaleU: " << (*i).fScaleU
+				<< " ScaleV: " << (*i).fScaleV
+				<< " Rotation (rad): " << (*i).fRotation;
+			DefaultLogger::get()->info(s);
+
+			const aiVector3D* pvBase = _pvBase;
+
+			if (0.0f == (*i).fRotation)
+			{
+				for (unsigned int n = 0; n < pcMesh->mNumVertices;++n)
+				{
+					// scaling
+					pcMesh->mTextureCoords[iCnt][n].x = pvBase->x * (*i).fScaleU;
+					pcMesh->mTextureCoords[iCnt][n].y = pvBase->y * (*i).fScaleV;
+
+					// offset
+					pcMesh->mTextureCoords[iCnt][n].x += (*i).fOffsetU;
+					pcMesh->mTextureCoords[iCnt][n].y += (*i).fOffsetV;
+
+					pvBase++;
+				}
+			}
+			else
+			{
+				const float fSin = sinf((*i).fRotation);
+				const float fCos = cosf((*i).fRotation);
+				for (unsigned int n = 0; n < pcMesh->mNumVertices;++n)
+				{
+					// scaling
+					pcMesh->mTextureCoords[iCnt][n].x = pvBase->x * (*i).fScaleU;
+					pcMesh->mTextureCoords[iCnt][n].y = pvBase->y * (*i).fScaleV;
+
+					// rotation
+					pcMesh->mTextureCoords[iCnt][n].x *= fCos;
+					pcMesh->mTextureCoords[iCnt][n].y *= fSin;
+
+					// offset
+					pcMesh->mTextureCoords[iCnt][n].x += (*i).fOffsetU;
+					pcMesh->mTextureCoords[iCnt][n].y += (*i).fOffsetV;
+
+					pvBase++;
+				}
+			}
+			// setup the UV source index for each texture
+			for (std::vector<Dot3DS::Texture*>::iterator
+				a =  (*i).pcTextures.begin();
+				a != (*i).pcTextures.end();++a)
+			{
+				(*a)->iUVSrc = iCnt;
+			}
+		}
+
+		// release temporary storage
+		if (_pvBase != pcMesh->mTextureCoords[0])
+			delete[] _pvBase;
+	}
+}
+// ------------------------------------------------------------------------------------------------
+void TextureTransform::SetupMatUVSrc (aiMaterial* pcMat, const Dot3DS::Material* pcMatIn)
+{
+	ai_assert(NULL != pcMat);
+	ai_assert(NULL != pcMatIn);
+	
+	MaterialHelper* pcHelper = (MaterialHelper*)pcMat;
+
+	if(pcMatIn->sTexDiffuse.mMapName.length() > 0)
+		pcHelper->AddProperty<int>(&pcMatIn->sTexDiffuse.iUVSrc,1,
+			AI_MATKEY_UVWSRC_DIFFUSE(0));
+
+	if(pcMatIn->sTexSpecular.mMapName.length() > 0)
+		pcHelper->AddProperty<int>(&pcMatIn->sTexSpecular.iUVSrc,1,
+			AI_MATKEY_UVWSRC_SPECULAR(0));
+
+	if(pcMatIn->sTexEmissive.mMapName.length() > 0)
+		pcHelper->AddProperty<int>(&pcMatIn->sTexEmissive.iUVSrc,1,
+			AI_MATKEY_UVWSRC_EMISSIVE(0));
+
+	if(pcMatIn->sTexBump.mMapName.length() > 0)
+		pcHelper->AddProperty<int>(&pcMatIn->sTexBump.iUVSrc,1,
+			AI_MATKEY_UVWSRC_HEIGHT(0));
+
+	if(pcMatIn->sTexShininess.mMapName.length() > 0)
+		pcHelper->AddProperty<int>(&pcMatIn->sTexShininess.iUVSrc,1,
+			AI_MATKEY_UVWSRC_SHININESS(0));
+
+	if(pcMatIn->sTexOpacity.mMapName.length() > 0)
+		pcHelper->AddProperty<int>(&pcMatIn->sTexOpacity.iUVSrc,1,
+			AI_MATKEY_UVWSRC_OPACITY(0));
+
+	if(pcMatIn->sTexAmbient.mMapName.length() > 0)
+		pcHelper->AddProperty<int>(&pcMatIn->sTexAmbient.iUVSrc,1,
+			AI_MATKEY_UVWSRC_AMBIENT(0));
+}
+};

+ 185 - 0
code/TextureTransform.h

@@ -0,0 +1,185 @@
+/*
+Open Asset Import Library (ASSIMP)
+----------------------------------------------------------------------
+
+Copyright (c) 2006-2008, ASSIMP Development Team
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms, 
+with or without modification, are permitted provided that the 
+following conditions are met:
+
+* Redistributions of source code must retain the above
+  copyright notice, this list of conditions and the
+  following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+  copyright notice, this list of conditions and the
+  following disclaimer in the documentation and/or other
+  materials provided with the distribution.
+
+* Neither the name of the ASSIMP team, nor the names of its
+  contributors may be used to endorse or promote products
+  derived from this software without specific prior
+  written permission of the ASSIMP Development Team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----------------------------------------------------------------------
+*/
+
+/** @file Definition of a helper class that processes texture transformations */
+#ifndef AI_TEXTURE_TRANSFORM_H_INCLUDED
+#define AI_TEXTURE_TRANSFORM_H_INCLUDED
+
+#include "BaseImporter.h"
+#include "../include/aiTypes.h"
+#include "../include/aiMaterial.h"
+#include "../include/aiMesh.h"
+
+
+struct aiNode;
+#include "3DSHelper.h"
+
+namespace Assimp
+{
+
+using namespace Assimp::Dot3DS;
+
+// ---------------------------------------------------------------------------
+/** Helper class representing texture coordinate transformations
+*/
+struct STransformVecInfo 
+{
+	//! Texture coordinate scaling in the x-direction 
+	float fScaleU;
+	//! Texture coordinate scaling in the y-direction 
+	float fScaleV;
+	//! Texture coordinate offset in the x-direction
+	float fOffsetU;
+	//! Texture coordinate offset in the y-direction
+	float fOffsetV;
+	//! Texture coordinate rotation, clockwise, in radians
+	float fRotation;
+
+	//! List of all textures that use this texture
+	//! coordinate transformations
+	std::vector<Dot3DS::Texture*> pcTextures; 
+
+
+	// -------------------------------------------------------------------
+	/** Build a 3x3 matrix from the transformations
+	*/
+	inline void GetMatrix(aiMatrix3x3& mOut)
+	{
+		mOut = aiMatrix3x3();
+
+		if (1.0f != this->fScaleU || 1.0f != this->fScaleV)
+		{
+			aiMatrix3x3 mScale;
+			mScale.a1 = this->fScaleU;
+			mScale.b2 = this->fScaleV;
+			mOut = mScale;
+		}
+		if (this->fRotation)
+		{
+			aiMatrix3x3 mRot; 
+			mRot.a1 = mRot.b2 = cosf(this->fRotation);
+			mRot.a2 = mRot.b1 = sinf(this->fRotation);
+			mRot.a2 = -mRot.a2;
+			mOut *= mRot;
+		}
+		if (this->fOffsetU || this->fOffsetV)
+		{
+			aiMatrix3x3 mTrans; 
+			mTrans.a3 = this->fOffsetU;
+			mTrans.b3 = this->fOffsetV;
+			mOut *= mTrans;
+		}
+	}
+};
+
+
+// ---------------------------------------------------------------------------
+/** Helper class used by the ASE/ASK and 3DS loaders to handle texture
+ *  coordinate transformations correctly (such as offsets, scaling)
+*/
+class TextureTransform
+{
+	//! Constructor, it is not possible to create instances of this class
+	TextureTransform() {}
+public:
+
+
+	// -------------------------------------------------------------------
+	/** Returns true if a texture requires UV transformations
+	 * \param rcIn Input texture
+	*/
+	inline static bool TextureTransform::HasUVTransform(
+		const Dot3DS::Texture& rcIn)
+	{
+		return (rcIn.mOffsetU || rcIn.mOffsetV ||
+			1.0f != rcIn.mScaleU  ||  1.0f != rcIn.mScaleV || rcIn.mRotation);
+	}
+
+	// -------------------------------------------------------------------
+	/** Must be called before HasUVTransform(rcIn) is called 
+	 * \param rcIn Input texture
+	*/
+	static void PreProcessUVTransform(
+		Dot3DS::Texture& rcIn);
+
+	// -------------------------------------------------------------------
+	/** Check whether the texture coordinate transformation of
+	 *  a texture is already contained in a given list
+	 * \param rasVec List of transformations
+	 * \param pcTex Pointer to the texture
+	*/
+	static void AddToList(std::vector<STransformVecInfo>& rasVec,
+		Dot3DS::Texture* pcTex);
+
+	// -------------------------------------------------------------------
+	/** Get a full list of all texture coordinate offsets required
+	 *  for a material
+	 * \param materials List of materials to be processed
+	*/
+	static void ApplyScaleNOffset(std::vector<Dot3DS::Material> materials);
+
+	// -------------------------------------------------------------------
+	/** Get a full list of all texture coordinate offsets required
+	 *  for a material
+	 * \param material Material to be processed
+	*/
+	static void ApplyScaleNOffset(Dot3DS::Material& material);
+
+	// -------------------------------------------------------------------
+	/** Precompute as many texture coordinate transformations as possible
+	 * \param pcMesh Mesh containing the texture coordinate data
+	 * \param pcSrc Input material. Must have been passed to
+	 * ApplyScaleNOffset
+	*/
+	static void BakeScaleNOffset(aiMesh* pcMesh, Dot3DS::Material* pcSrc);
+
+	
+	// -------------------------------------------------------------------
+	/** Setup the correct UV source for a material
+	 * \param pcMat Final material to be changed
+	 * \param pcMatIn Input material, unconverted
+	*/
+	static void SetupMatUVSrc (aiMaterial* pcMat, 
+		const Dot3DS::Material* pcMatIn);
+};
+
+};
+
+#endif //! AI_TEXTURE_TRANSFORM_H_INCLUDED

+ 1 - 1
code/TriangulateProcess.cpp

@@ -138,7 +138,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
 	// kill the old faces
 	delete [] pMesh->mFaces;
 	// and insert our newly generated faces
-	pMesh->mNumFaces = newFaces.size();
+	pMesh->mNumFaces = (unsigned int)newFaces.size();
 	pMesh->mFaces = new aiFace[pMesh->mNumFaces];
 	for( unsigned int a = 0; a < newFaces.size(); a++)
 		pMesh->mFaces[a] = newFaces[a];

+ 17 - 17
code/XFileImporter.cpp

@@ -184,7 +184,7 @@ aiNode* XFileImporter::CreateNodes( aiScene* pScene, aiNode* pParent, const XFil
 	// handle childs
 	if( pNode->mChildren.size() > 0)
 	{
-		node->mNumChildren = pNode->mChildren.size();
+		node->mNumChildren = (unsigned int)pNode->mChildren.size();
 		node->mChildren = new aiNode* [node->mNumChildren];
 
 		for( unsigned int a = 0; a < pNode->mChildren.size(); a++)
@@ -209,7 +209,7 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec
 		// first convert its materials so that we can find them when searching by name afterwards
 		ConvertMaterials( pScene, sourceMesh->mMaterials);
 
-		unsigned int numMaterials = std::max( sourceMesh->mMaterials.size(), 1u);
+		unsigned int numMaterials = std::max( (unsigned int)sourceMesh->mMaterials.size(), 1u);
 		for( unsigned int b = 0; b < numMaterials; b++)
 		{
 			// collect the faces belonging to this material
@@ -223,7 +223,7 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec
 					if( sourceMesh->mFaceMaterials[c] == b)
 					{
 						faces.push_back( c);
-						numVertices += sourceMesh->mPosFaces[c].mIndices.size();
+						numVertices += (unsigned int)sourceMesh->mPosFaces[c].mIndices.size();
 					}
 				}
 			} else
@@ -232,7 +232,7 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec
 				for( unsigned int c = 0; c < sourceMesh->mPosFaces.size(); c++)
 				{
 					faces.push_back( c);
-					numVertices += sourceMesh->mPosFaces[c].mIndices.size();
+					numVertices += (unsigned int)sourceMesh->mPosFaces[c].mIndices.size();
 				}
 			}
 
@@ -262,7 +262,7 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec
 			// as specified 
 			mesh->mNumVertices = numVertices;
 			mesh->mVertices = new aiVector3D[numVertices];
-			mesh->mNumFaces = faces.size();
+			mesh->mNumFaces = (unsigned int)faces.size();
 			mesh->mFaces = new aiFace[mesh->mNumFaces];
 
 			// normals?
@@ -293,7 +293,7 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec
 
 				// create face. either triangle or triangle fan depending on the index count
 				aiFace& df = mesh->mFaces[c]; // destination face
-				df.mNumIndices = pf.mIndices.size();
+				df.mNumIndices = (unsigned int)pf.mIndices.size();
 				df.mIndices = new unsigned int[ df.mNumIndices];
 
 				// collect vertex data for indices of this face
@@ -360,14 +360,14 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec
 				// copy name and matrix
 				nbone->mName.Set( obone.mName);
 				nbone->mOffsetMatrix = obone.mOffsetMatrix;
-				nbone->mNumWeights = newWeights.size();
+				nbone->mNumWeights = (unsigned int)newWeights.size();
 				nbone->mWeights = new aiVertexWeight[nbone->mNumWeights];
 				for( unsigned int d = 0; d < newWeights.size(); d++)
 					nbone->mWeights[d] = newWeights[d];
 			}
 
 			// store the bones in the mesh
-			mesh->mNumBones = newBones.size();
+			mesh->mNumBones = (unsigned int)newBones.size();
 			mesh->mBones = new aiBone*[mesh->mNumBones];
 			for( unsigned int c = 0; c < newBones.size(); c++)
 				mesh->mBones[c] = newBones[c];
@@ -384,7 +384,7 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec
 	}
 
 	// allocate mesh index array in the node
-	pNode->mNumMeshes = meshes.size();
+	pNode->mNumMeshes = (unsigned int)meshes.size();
 	pNode->mMeshes = new unsigned int[pNode->mNumMeshes];
 
 	// store all meshes in the mesh library of the scene and store their indices in the node
@@ -412,7 +412,7 @@ void XFileImporter::CreateAnimations( aiScene* pScene, const XFile::Scene* pData
 		// duration will be determined by the maximum length
 		nanim->mDuration = 0;
 		nanim->mTicksPerSecond = pData->mAnimTicksPerSecond;
-		nanim->mNumBones = anim->mAnims.size();
+		nanim->mNumBones = (unsigned int)anim->mAnims.size();
 		nanim->mBones = new aiBoneAnim*[nanim->mNumBones];
 
 		for( unsigned int b = 0; b < anim->mAnims.size(); b++)
@@ -428,11 +428,11 @@ void XFileImporter::CreateAnimations( aiScene* pScene, const XFile::Scene* pData
 			// keyframes are given as combined transformation matrix keys
 			if( bone->mTrafoKeys.size() > 0)
 			{
-				nbone->mNumPositionKeys = bone->mTrafoKeys.size();
+				nbone->mNumPositionKeys = (unsigned int)bone->mTrafoKeys.size();
 				nbone->mPositionKeys = new aiVectorKey[nbone->mNumPositionKeys];
-				nbone->mNumRotationKeys = bone->mTrafoKeys.size();
+				nbone->mNumRotationKeys = (unsigned int)bone->mTrafoKeys.size();
 				nbone->mRotationKeys = new aiQuatKey[nbone->mNumRotationKeys];
-				nbone->mNumScalingKeys = bone->mTrafoKeys.size();
+				nbone->mNumScalingKeys = (unsigned int)bone->mTrafoKeys.size();
 				nbone->mScalingKeys = new aiVectorKey[nbone->mNumScalingKeys];
 
 				for( unsigned int c = 0; c < bone->mTrafoKeys.size(); c++)
@@ -476,7 +476,7 @@ void XFileImporter::CreateAnimations( aiScene* pScene, const XFile::Scene* pData
 			} else
 			{
 				// separate key sequences for position, rotation, scaling
-				nbone->mNumPositionKeys = bone->mPosKeys.size(); 
+				nbone->mNumPositionKeys = (unsigned int)bone->mPosKeys.size(); 
 				nbone->mPositionKeys = new aiVectorKey[nbone->mNumPositionKeys];
 				for( unsigned int c = 0; c < nbone->mNumPositionKeys; c++)
 				{
@@ -489,7 +489,7 @@ void XFileImporter::CreateAnimations( aiScene* pScene, const XFile::Scene* pData
 				}
 
 				// rotation
-				nbone->mNumRotationKeys = bone->mRotKeys.size(); 
+				nbone->mNumRotationKeys = (unsigned int)bone->mRotKeys.size(); 
 				nbone->mRotationKeys = new aiQuatKey[nbone->mNumRotationKeys];
 				for( unsigned int c = 0; c < nbone->mNumRotationKeys; c++)
 				{
@@ -502,7 +502,7 @@ void XFileImporter::CreateAnimations( aiScene* pScene, const XFile::Scene* pData
 				}
 
 				// scaling
-				nbone->mNumScalingKeys = bone->mScaleKeys.size(); 
+				nbone->mNumScalingKeys = (unsigned int)bone->mScaleKeys.size(); 
 				nbone->mScalingKeys = new aiVectorKey[nbone->mNumScalingKeys];
 				for( unsigned int c = 0; c < nbone->mNumScalingKeys; c++)
 					nbone->mScalingKeys[c] = bone->mScaleKeys[c];
@@ -521,7 +521,7 @@ void XFileImporter::CreateAnimations( aiScene* pScene, const XFile::Scene* pData
 	// store all converted animations in the scene
 	if( newAnims.size() > 0)
 	{
-		pScene->mNumAnimations = newAnims.size();
+		pScene->mNumAnimations = (unsigned int)newAnims.size();
 		pScene->mAnimations = new aiAnimation* [pScene->mNumAnimations];
 		for( unsigned int a = 0; a < newAnims.size(); a++)
 			pScene->mAnimations[a] = newAnims[a];

+ 30 - 0
workspaces/vc8/assimp.sln

@@ -19,37 +19,67 @@ EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug_DLL_Java|Win32 = Debug_DLL_Java|Win32
+		Debug_DLL_Java|x64 = Debug_DLL_Java|x64
 		Debug_DLL|Win32 = Debug_DLL|Win32
+		Debug_DLL|x64 = Debug_DLL|x64
 		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
 		Release_DLL_Java|Win32 = Release_DLL_Java|Win32
+		Release_DLL_Java|x64 = Release_DLL_Java|x64
 		Release_DLL|Win32 = Release_DLL|Win32
+		Release_DLL|x64 = Release_DLL|x64
 		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug_DLL_Java|Win32.ActiveCfg = Debug|Win32
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug_DLL_Java|Win32.Build.0 = Debug|Win32
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug_DLL_Java|x64.ActiveCfg = Debug|x64
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug_DLL_Java|x64.Build.0 = Debug|x64
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug_DLL|Win32.ActiveCfg = Debug|Win32
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug_DLL|Win32.Build.0 = Debug|Win32
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug_DLL|x64.ActiveCfg = Debug|x64
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug_DLL|x64.Build.0 = Debug|x64
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug|Win32.ActiveCfg = Debug|Win32
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug|Win32.Build.0 = Debug|Win32
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug|x64.ActiveCfg = Debug|x64
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Debug|x64.Build.0 = Debug|x64
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release_DLL_Java|Win32.ActiveCfg = Release|Win32
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release_DLL_Java|Win32.Build.0 = Release|Win32
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release_DLL_Java|x64.ActiveCfg = Release|x64
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release_DLL_Java|x64.Build.0 = Release|x64
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release_DLL|Win32.ActiveCfg = Release|Win32
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release_DLL|Win32.Build.0 = Release|Win32
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release_DLL|x64.ActiveCfg = Release|x64
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release_DLL|x64.Build.0 = Release|x64
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release|Win32.ActiveCfg = Release|Win32
 		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release|Win32.Build.0 = Release|Win32
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release|x64.ActiveCfg = Release|x64
+		{B17B959B-BB8A-4596-AF0F-A8C8DBBC3C5E}.Release|x64.Build.0 = Release|x64
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug_DLL_Java|Win32.ActiveCfg = Debug_DLL_Java|Win32
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug_DLL_Java|Win32.Build.0 = Debug_DLL_Java|Win32
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug_DLL_Java|x64.ActiveCfg = Debug_DLL_Java|x64
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug_DLL_Java|x64.Build.0 = Debug_DLL_Java|x64
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug_DLL|Win32.ActiveCfg = Debug_DLL|Win32
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug_DLL|Win32.Build.0 = Debug_DLL|Win32
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug_DLL|x64.ActiveCfg = Debug_DLL|x64
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug_DLL|x64.Build.0 = Debug_DLL|x64
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug|Win32.ActiveCfg = Debug|Win32
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug|Win32.Build.0 = Debug|Win32
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug|x64.ActiveCfg = Debug|x64
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Debug|x64.Build.0 = Debug|x64
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release_DLL_Java|Win32.ActiveCfg = Release_DLL_Java|Win32
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release_DLL_Java|Win32.Build.0 = Release_DLL_Java|Win32
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release_DLL_Java|x64.ActiveCfg = Release_DLL_Java|x64
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release_DLL_Java|x64.Build.0 = Release_DLL_Java|x64
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release_DLL|Win32.ActiveCfg = Release_DLL|Win32
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release_DLL|Win32.Build.0 = Release_DLL|Win32
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release_DLL|x64.ActiveCfg = Release_DLL|x64
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release_DLL|x64.Build.0 = Release_DLL|x64
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release|Win32.ActiveCfg = Release|Win32
 		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release|Win32.Build.0 = Release|Win32
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release|x64.ActiveCfg = Release|x64
+		{5691E159-2D9B-407F-971F-EA5C592DC524}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 444 - 12
workspaces/vc8/assimp.vcproj

@@ -10,14 +10,17 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="./../../lib/$(ProjectName)_$(ConfigurationName)"
-			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)"
+			OutputDirectory="./../../lib/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
 			ConfigurationType="4"
 			>
 			<Tool
@@ -77,8 +80,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="./../../lib/$(ProjectName)_$(ConfigurationName)"
-			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)"
+			OutputDirectory="./../../lib/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
 			ConfigurationType="4"
 			WholeProgramOptimization="0"
 			>
@@ -139,8 +142,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release_DLL|Win32"
-			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)"
-			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)"
+			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
 			ConfigurationType="2"
 			WholeProgramOptimization="0"
 			>
@@ -211,8 +214,8 @@
 		</Configuration>
 		<Configuration
 			Name="Debug_DLL|Win32"
-			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)"
-			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)"
+			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
 			ConfigurationType="2"
 			>
 			<Tool
@@ -282,8 +285,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release_DLL_Java|Win32"
-			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)"
-			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)"
+			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
 			ConfigurationType="2"
 			WholeProgramOptimization="0"
 			>
@@ -355,8 +358,8 @@
 		</Configuration>
 		<Configuration
 			Name="Debug_DLL_Java|Win32"
-			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)"
-			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)"
+			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
 			ConfigurationType="2"
 			>
 			<Tool
@@ -425,6 +428,427 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="./../../lib/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			ConfigurationType="4"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="DEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32"
+				BasicRuntimeChecks="3"
+				SmallerTypeCheck="true"
+				RuntimeLibrary="1"
+				EnableFunctionLevelLinking="true"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="./../../lib/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			ConfigurationType="4"
+			WholeProgramOptimization="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="NDEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32"
+				StringPooling="true"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="2"
+				WarningLevel="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_DLL|x64"
+			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			ConfigurationType="2"
+			WholeProgramOptimization="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="NDEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32"
+				StringPooling="true"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="2"
+				WarningLevel="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\assimp64.dll"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_DLL|x64"
+			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			ConfigurationType="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="DEBUG, _SCL_SECURE_NO_WARNINGS, _CRT_SECURE_NO_WARNINGS,WIN32"
+				BasicRuntimeChecks="3"
+				SmallerTypeCheck="true"
+				RuntimeLibrary="1"
+				EnableFunctionLevelLinking="true"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\assimp64d.dll"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release_DLL_Java|x64"
+			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			ConfigurationType="2"
+			WholeProgramOptimization="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="&quot;$(JAVA_HOME)\include&quot;;&quot;$(JAVA_HOME)\include\win32&quot;"
+				PreprocessorDefinitions="NDEBUG;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;ASSIMP_JNI_EXPORT"
+				StringPooling="true"
+				BufferSecurityCheck="false"
+				EnableEnhancedInstructionSet="2"
+				WarningLevel="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="ASSIMP_JNI_EXPORT"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\jAssimp64.dll"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug_DLL_Java|x64"
+			OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
+			ConfigurationType="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(JAVA_HOME)\include&quot;;&quot;$(JAVA_HOME)\include\win32&quot;"
+				PreprocessorDefinitions="DEBUG;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;ASSIMP_JNI_EXPORT"
+				BasicRuntimeChecks="3"
+				SmallerTypeCheck="true"
+				RuntimeLibrary="1"
+				EnableFunctionLevelLinking="true"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="ASSIMP_JNI_EXPORT"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)\jAssimp64d.dll"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -600,6 +1024,10 @@
 				RelativePath="..\..\code\SplitLargeMeshes.h"
 				>
 			</File>
+			<File
+				RelativePath="..\..\code\TextureTransform.h"
+				>
+			</File>
 			<File
 				RelativePath="..\..\code\TriangulateProcess.h"
 				>
@@ -884,6 +1312,10 @@
 				RelativePath="..\..\code\SplitLargeMeshes.cpp"
 				>
 			</File>
+			<File
+				RelativePath="..\..\code\TextureTransform.cpp"
+				>
+			</File>
 			<File
 				RelativePath="..\..\code\TriangulateProcess.cpp"
 				>

+ 189 - 6
workspaces/vc8/assimp_view.vcproj

@@ -11,14 +11,17 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
 	<Configurations>
 		<Configuration
 			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)"
-			IntermediateDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)\obj"
+			OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)\obj"
 			ConfigurationType="1"
 			CharacterSet="2"
 			>
@@ -66,7 +69,7 @@
 				AdditionalDependencies="d3d9.lib d3dx9.lib comdlg32.lib assimp.lib winmm.lib comctl32.lib user32.lib advapi32.lib shell32.lib Gdi32.lib"
 				OutputFile="$(OutDir)\assimpview32d.exe"
 				LinkIncremental="2"
-				AdditionalLibraryDirectories="..\..\lib\assimp_debug;&quot;$(DXSDK_DIR)lib\x86&quot;"
+				AdditionalLibraryDirectories="..\..\lib\assimp_debug_win32;&quot;$(DXSDK_DIR)lib\x86&quot;"
 				GenerateDebugInformation="true"
 				SubSystem="2"
 				TargetMachine="1"
@@ -98,8 +101,8 @@
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)"
-			IntermediateDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)\obj"
+			OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)\obj"
 			ConfigurationType="1"
 			CharacterSet="2"
 			WholeProgramOptimization="1"
@@ -143,7 +146,7 @@
 				AdditionalDependencies="d3d9.lib d3dx9.lib comdlg32.lib assimp.lib winmm.lib comctl32.lib user32.lib advapi32.lib shell32.lib Gdi32.lib"
 				OutputFile="$(OutDir)\assimpview32.exe"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="..\..\lib\assimp_release;&quot;$(DXSDK_DIR)lib\x86&quot;"
+				AdditionalLibraryDirectories="..\..\lib\assimp_release_win32;&quot;$(DXSDK_DIR)lib\x86&quot;"
 				IgnoreAllDefaultLibraries="false"
 				IgnoreDefaultLibraryNames=""
 				GenerateDebugInformation="true"
@@ -177,6 +180,170 @@
 				Name="VCPostBuildEventTool"
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)\obj"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;$(DXSDK_DIR)include&quot;;..\..\include;..\..\code"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				SmallerTypeCheck="true"
+				RuntimeLibrary="1"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="false"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="d3d9.lib d3dx9.lib comdlg32.lib assimp.lib winmm.lib comctl32.lib user32.lib advapi32.lib shell32.lib Gdi32.lib"
+				OutputFile="$(OutDir)\assimpview64d.exe"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="..\..\lib\assimp_debug_x64;&quot;$(DXSDK_DIR)lib\x64&quot;"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)"
+			IntermediateDirectory="$(SolutionDir)..\..\tools\build\$(ConfigurationName)_$(PlatformName)\obj"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(DXSDK_DIR)include&quot;;..\..\include;..\..\code"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
+				RuntimeLibrary="0"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="d3d9.lib d3dx9.lib comdlg32.lib assimp.lib winmm.lib comctl32.lib user32.lib advapi32.lib shell32.lib Gdi32.lib"
+				OutputFile="$(OutDir)\assimpview64.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\..\lib\assimp_release_x64;&quot;$(DXSDK_DIR)lib\x64&quot;"
+				IgnoreAllDefaultLibraries="false"
+				IgnoreDefaultLibraryNames=""
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -257,6 +424,22 @@
 						UsePrecompiledHeader="1"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter