Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshLoader.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshLoader.cpp	(revision 1098)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshLoader.cpp	(revision 1136)
@@ -49,9 +49,9 @@
 	unsigned	short		source;
 	GeometryElement		aux;
-	int								i;
+	size_t						i;
 	bool							found;
 	VertexElementType	vType;
 
-	i						=	0;
+	i			=	0;
 	found	=	false;
 
@@ -162,7 +162,7 @@
 	unsigned	short	vertexSize;
 	unsigned	short	headerID;
-	int							i;
-	float						aux;
-	int							k;
+	size_t					i;
+	//float						aux;
+	size_t					k;
 	bool						found;
 	float						x,y,z;
@@ -170,6 +170,6 @@
 	VertexBuffer		*vertex_buffer;
 
-	i						=	0;
-	k						=	0;
+	i			=	0;
+	k			=	0;
 	found	=	false;
 	
@@ -228,5 +228,5 @@
 		{
 			//	For each element in this source.
-			for(int j	=	0;	j < list[i].list.size();	j++)
+			for(size_t j	=	0;	j < list[i].list.size();	j++)
 			{
 				//	Positions.
@@ -466,5 +466,5 @@
 		unsigned int aux;
 
-		for (int i = 0; i < numIndices; i++)
+		for (size_t	i = 0; i < numIndices; i++)
 		{
 			fread(&aux,sizeof(unsigned int),1,f);
@@ -472,5 +472,5 @@
 			if (option == GEOMESH_BUILD)
 			{
-					geoSubMesh->mIndex[i]	=	aux;
+				geoSubMesh->mIndex[i]	=	aux;
 			}
 		}
@@ -480,5 +480,5 @@
 		unsigned short aux;
 
-		for (int i = 0; i < numIndices; i++)
+		for (size_t	i = 0; i < numIndices; i++)
 		{
 			fread(&aux,sizeof(unsigned short),1,f);
@@ -866,8 +866,7 @@
 	bool		head_found;
 	bool		tail_found;
-	int			strip_count;
-	int			tailIndex;
-	size_t	tail;
-
+	size_t	strip_count;
+	size_t	tailIndex;
+	//size_t	tail;
 
 	head_found							=	false;
@@ -877,5 +876,5 @@
 	//	Foreachone of the indices.
 	//	Obtains the number of triangle strips.
-	for (int i = 0; i < (geoSubMesh->mIndexCount - 1); i++)
+	for (size_t	i = 0; i < (geoSubMesh->mIndexCount - 1); i++)
 	{
 		if (geoSubMesh->mIndex[i] == geoSubMesh->mIndex[i+1])
@@ -906,13 +905,12 @@
 	}
 
-	geoSubMesh->mStrip		=	(Index**) malloc(	sizeof(Index*)
-			*
-			geoSubMesh->mStripCount);
+	geoSubMesh->mStrip	=	(Index**) malloc(	sizeof(Index*)
+												*
+												geoSubMesh->mStripCount);
 
 	//	Number of strips. Initially there is one triangle strip.
 	strip_count	=	1;
-
-	head_found						=	false;
-	tail_found						=	false;
+	head_found	=	false;
+	tail_found	=	false;
 
 	//	Initialize the fist triangle strip.
@@ -921,5 +919,5 @@
 	//	Foreachone of the indices.
 	//	Assigns the beginning of the triangle strips.
-	for(int i = 0;i < (geoSubMesh->mIndexCount - 1); i++)
+	for(size_t	i = 0;i < (geoSubMesh->mIndexCount - 1); i++)
 	{
 		if(geoSubMesh->mIndex[i] == geoSubMesh->mIndex[i+1])
@@ -991,8 +989,8 @@
 	
 	//	For each one of the strips.
-	for (int strip = 0; strip < geoSubMesh->mStripCount; strip++)
+	for (size_t	strip = 0; strip < geoSubMesh->mStripCount; strip++)
 	{
 		//	Stars of strip without degenerate triangles.
-		new_strip_starts[strip]	=	current_index;
+		new_strip_starts[strip]	=	(Index)current_index;
 		
 		//	First index of the strip.
@@ -1055,5 +1053,5 @@
 
 	//	Update start of the strip.
-	for (int	strip	=	0; strip < geoSubMesh->mStripCount; strip++)
+	for (size_t	strip	=	0; strip < geoSubMesh->mStripCount; strip++)
 	{
 		geoSubMesh->mStrip[strip]	=	&geoSubMesh->mIndex[new_strip_starts[strip]];
@@ -1074,5 +1072,4 @@
 	unsigned	short	chunkID;
 	char		version[255];
-	char		kk;
 	FILE		*pFile;
 	SubMesh		*geosubmesh;
@@ -1196,5 +1193,5 @@
 		if (!mError)
 		{
-			for (int submesh = 0;	submesh < geoMesh->mSubMeshCount; submesh++)
+			for (size_t	submesh = 0;	submesh < geoMesh->mSubMeshCount; submesh++)
 			{
 				//	Gets the actual submesh.
@@ -1238,5 +1235,4 @@
 void	GeoMeshLoader::normalizeModel(Mesh	*geoMesh)
 {
-	unsigned	int	i;
 	float					maxx, minx, maxy, miny, maxz, minz;
 	float					cx, cy, cz, w, h, d, max;
@@ -1253,5 +1249,5 @@
 	
 	//	For each submesh.
-	for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
+	for (size_t	submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
 	{
 		//	Gets the actual submesh.
@@ -1259,5 +1255,5 @@
 
 		//	For each index of the strip.
-		for (int i = 0; i < vertex_buffer->mVertexCount; i++)
+		for (size_t	i = 0; i < vertex_buffer->mVertexCount; i++)
 		{
 			if (maxx < vertex_buffer->mPosition[i].x)
@@ -1305,7 +1301,7 @@
 
 	//	Calculate center of the model.
-	cx = (maxx + minx) / 2.0;
-	cy = (maxy + miny) / 2.0;
-	cz = (maxz + minz) / 2.0;
+	cx = (maxx + minx) / 2.0f;
+	cy = (maxy + miny) / 2.0f;
+	cz = (maxz + minz) / 2.0f;
 
 
@@ -1326,32 +1322,42 @@
 	
 	//	Calculate unitizing scale factor.
-	scale = 1.0 / max;
+	scale = 1.0f / max;
 
 	geoMesh->mMeshBounds.scaleFactor		=	scale;
 
 
-	bool *sharedmesh;
-	sharedmesh= new bool[geoMesh->mSubMeshCount];
-	bool firstsharedmesh= true;
-	for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
+	bool	*sharedmesh;
+
+	sharedmesh	=	new bool[geoMesh->mSubMeshCount];
+
+	bool	firstsharedmesh	=	true;
+
+	for (size_t	submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
 	{
 		if (geoMesh->mSubMesh[submesh].mSharedVertexBuffer)
-			sharedmesh[submesh]= true;
+		{
+			sharedmesh[submesh]	=	true;
+		}
 		else
-			sharedmesh[submesh]= false;
+		{
+			sharedmesh[submesh]	=	false;
+		}
 	}
 
 	//	Translate around center then scale.
 	//	For each submesh.
-	for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
-	{
-
+	for (size_t	submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++)
+	{
 		//	If is a shared vertex Buffer.
 		if (geoMesh->mSubMesh[submesh].mSharedVertexBuffer)
 		{
 			if (!firstsharedmesh)
+			{
 				continue;
+			}
 			else
-				firstsharedmesh= false;
+			{
+				firstsharedmesh	=	false;
+			}
 		}
 
@@ -1360,5 +1366,5 @@
 
 		//	For each index of the strip.
-		for (int i = 0; i < vertex_buffer->mVertexCount; i++)
+		for (size_t	i	=	0;	i < vertex_buffer->mVertexCount;	i++)
 		{
 			vertex_buffer->mPosition[i].x -= cx;
@@ -1369,5 +1375,4 @@
 			vertex_buffer->mPosition[i].z *= scale;
 		}
-
 	}
 
@@ -1388,6 +1393,6 @@
 GeoMeshLoader::GeoMeshLoader()
 {
-	geoMesh			=	NULL;
-	mFileSize		=	0;
+	geoMesh				=	NULL;
+	mFileSize			=	0;
 	lodstripsdata	=	NULL;
 	treesimpseq		=	NULL;
@@ -1400,9 +1405,17 @@
 {
 	if (geoMesh)
+	{
 		delete	geoMesh;
+	}
+
 	if (lodstripsdata)
+	{
 		delete lodstripsdata;
+	}
+
 	if (treesimpseq)
+	{
 		delete treesimpseq;
+	}
 }
 
@@ -1410,5 +1423,7 @@
 //	Read bones of the submesh.
 //---------------------------------------------------------------------------
-void GeoMeshLoader::readSubMeshBoneAssignment(FILE* f, SubMesh* geoSubMesh,int option)
+void GeoMeshLoader::readSubMeshBoneAssignment(FILE* f,
+																							SubMesh* geoSubMesh,
+																							int option)
 {
 	if (option == GEOMESH_BUILD)
@@ -1442,5 +1457,4 @@
 		// float weight
 		fread(&(assign.weight),sizeof(float),1,f);
-
 
 		geoMesh->mBones.push_back(assign);
@@ -1493,12 +1507,19 @@
 {
 public:
-	VertexArranger(Geometry::Mesh *m){
-		mesh=m;
-		current_submesh=0;
-		current_tris=new int[m->mSubMeshCount];
-		for (int i=0; i<m->mSubMeshCount; i++)
-			current_tris[i] = 0;
-	}
-	~VertexArranger(void){
+
+	VertexArranger(Geometry::Mesh *m)
+	{
+		mesh						=	m;
+		current_submesh	=	0;
+		current_tris		=	new int[m->mSubMeshCount];
+
+		for (size_t	i	=	0;	i < m->mSubMeshCount;	i++)
+		{
+			current_tris[i]	=	0;
+		}
+	}
+
+	~VertexArranger(void)
+	{
 		delete[] current_tris;
 	}
@@ -1517,5 +1538,5 @@
 		if (res==vertex_map.end())
 		{
-			int val = vertex_map.size();
+			int val = (int)vertex_map.size();
 			vertex_map[vertex1] = val;
 			submesh->mIndex[j*3+0] = val;
@@ -1527,5 +1548,5 @@
 		if (res==vertex_map.end())
 		{
-			int val = vertex_map.size();
+			int val = (int)vertex_map.size();
 			vertex_map[vertex2] = val;
 			submesh->mIndex[j*3+1] = val;
@@ -1537,17 +1558,25 @@
 		if (res==vertex_map.end())
 		{
-			int val = vertex_map.size();
+			int val = (int)vertex_map.size();
 			vertex_map[vertex3] = val;
 			submesh->mIndex[j*3+2] = val;
 		}
 		else
+		{
 			submesh->mIndex[j*3+2] = res->second;
+		}
 
 		current_tris[current_submesh] ++;
 	}
 
-	int GetVertexCount(void) const { return vertex_map.size(); }
-
-	void SetCurrentSubMesh(int i){ current_submesh = i; }
+	int GetVertexCount(void) const
+	{
+		return (int)vertex_map.size();
+	}
+
+	void SetCurrentSubMesh(int i)
+	{
+		current_submesh = i;
+	}
 	
 	class vertex_arranger_node
@@ -1605,8 +1634,10 @@
 			vertex_list[it->second] = it->first;
 
-		for (int i=0; i<mesh->mSubMeshCount; i++)
+		for (	size_t	i	=	0;	i < mesh->mSubMeshCount;	i++)
+		{
 			mesh->mSubMesh[i].mVertexBuffer = mesh->mVertexBuffer;
+		}
 		
-		for (int j=0; j<mesh->mVertexBuffer->mVertexCount; j++)
+		for (size_t	j	=	0;	j < mesh->mVertexBuffer->mVertexCount;	j++)
 		{		
 			int vi = vertex_list[j].v;
@@ -1615,15 +1646,42 @@
 
 			Geometry::Vector3 auxpos(vertices[vi]);
-			if (auxpos.x < mesh->mMeshBounds.minX) mesh->mMeshBounds.minX = auxpos.x;
-			if (auxpos.y < mesh->mMeshBounds.minY) mesh->mMeshBounds.minY = auxpos.y;
-			if (auxpos.z < mesh->mMeshBounds.minZ) mesh->mMeshBounds.minZ = auxpos.z;
-			if (auxpos.x > mesh->mMeshBounds.maxX) mesh->mMeshBounds.maxX = auxpos.x;
-			if (auxpos.y > mesh->mMeshBounds.maxY) mesh->mMeshBounds.maxY = auxpos.y;
-			if (auxpos.z > mesh->mMeshBounds.maxZ) mesh->mMeshBounds.maxZ = auxpos.z;
-
-			mesh->mVertexBuffer->mPosition[j] = auxpos;
-			mesh->mVertexBuffer->mNormal[j] = normals[ni];
-			if (texcoords.empty()==false)
-				mesh->mVertexBuffer->mTexCoords[j] = texcoords[ti];		
+
+			if (auxpos.x < mesh->mMeshBounds.minX)
+			{
+				mesh->mMeshBounds.minX = auxpos.x;
+			}
+
+			if (auxpos.y < mesh->mMeshBounds.minY)
+			{
+				mesh->mMeshBounds.minY = auxpos.y;
+			}
+
+			if (auxpos.z < mesh->mMeshBounds.minZ)
+			{
+				mesh->mMeshBounds.minZ = auxpos.z;
+			}
+
+			if (auxpos.x > mesh->mMeshBounds.maxX)
+			{
+				mesh->mMeshBounds.maxX = auxpos.x;
+			}
+
+			if (auxpos.y > mesh->mMeshBounds.maxY)
+			{
+				mesh->mMeshBounds.maxY = auxpos.y;
+			}
+
+			if (auxpos.z > mesh->mMeshBounds.maxZ)
+			{
+				mesh->mMeshBounds.maxZ = auxpos.z;
+			}
+
+			mesh->mVertexBuffer->mPosition[j]	=	auxpos;
+			mesh->mVertexBuffer->mNormal[j]		=	normals[ni];
+
+			if (texcoords.empty() == false)
+			{
+				mesh->mVertexBuffer->mTexCoords[j] = texcoords[ti];
+			}
 		}
 
@@ -1632,8 +1690,8 @@
 
 //private:
-	std::map<vertex_arranger_node,int> vertex_map;
-	Geometry::Mesh *mesh;
-	int current_submesh;
-	int *current_tris;
+	std::map<vertex_arranger_node,int>	vertex_map;
+	Geometry::Mesh											*mesh;
+	int																	current_submesh;
+	int																	*current_tris;
 };
 
@@ -1734,5 +1792,5 @@
 	{
 		// calculate face normals
-		for (int i=0, inormal=0; i<mesh->mSubMeshCount; i++)
+		for (size_t i=0, inormal=0; i<mesh->mSubMeshCount; i++)
 		{
 			Geometry::SubMesh *submesh = mesh->mSubMesh+i;
@@ -1742,7 +1800,9 @@
 			{
 				face_t & auxface = *it;
-				auxface.n1 = inormal;
-				auxface.n2 = inormal;
-				auxface.n3 = inormal;
+
+				auxface.n1 = (int)inormal;
+				auxface.n2 = (int)inormal;
+				auxface.n3 = (int)inormal;
+
 				Geometry::Vector3 v1,v2,v3,v31,v21,nor;
 				v1 = vertices[auxface.v1];
@@ -1763,5 +1823,5 @@
 		 
 	mesh->mSubMesh=new Geometry::SubMesh[mesh->mSubMeshCount];
-	for (int i=0; i<mesh->mSubMeshCount; i++)
+	for (size_t	i	=	0;	i < mesh->mSubMeshCount;	i++)
 	{
 		Geometry::SubMesh *submesh = mesh->mSubMesh+i;
@@ -1773,5 +1833,5 @@
 		submesh->mIndex=new Geometry::Index[submesh->mIndexCount];
 
-		vertex_arranger.SetCurrentSubMesh(i);
+		vertex_arranger.SetCurrentSubMesh((int)i);
 		
 		for (std::vector<face_t>::const_iterator it=vecfaces.begin(); it!=vecfaces.end(); it++,j++)
