Index: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 1600)
+++ GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp	(revision 2078)
@@ -283,7 +283,7 @@
 }
 
-//---------------------------------------------------------------------------
+//-------------------------------------------------------------------------
 //Put in order vertex of Mesh from simplification sequence
-//---------------------------------------------------------------------------
+//-------------------------------------------------------------------------
 void LodStripsConstructor::OrdenarModeloVQSLIM(TIPOFUNC	upb)
 {
@@ -292,14 +292,15 @@
 	unsigned long int t;
 	unsigned long int v;
-	long int vSig;
-	long int k;
+	long int 					vSig;
+	long int 					k;
 	VECTORVERTEX			Vertices;
-	std::vector<tipoVertice>		NuevosVerts;
+	
+	std::vector<tipoVertice>				NuevosVerts;
 	std::vector<std::vector<int> >	NuevasTiras;
-	std::vector<int> 		tira;
-	tipoOrden				Orden;
-	tipoOrden				*Ord;
+	std::vector<int> 								tira;
+
+	tipoOrden			Orden;
+	tipoOrden			*Ord;
 	bool					bEncontrado;
-
 
 	//	Progress bar
@@ -308,4 +309,6 @@
 	long	int	update;
 
+	VertexBoneAssignment	bone;
+
 	bEncontrado = false;
 
@@ -348,5 +351,5 @@
 	//	3 seg.
 	//Ordenacion de los vertices
-	for(i = 0; i < Ordenacion.size(); i++)
+	for (i = 0; i < Ordenacion.size(); i++)
 	{
 		if (update	!=	(int)(i * increment))
@@ -357,5 +360,5 @@
 
 		int OrdvQslim = Ordenacion[i].vQslim;
-		int OrdvQslimNext = Ordenacion[i].vQslimNext;
+		//int OrdvQslimNext = Ordenacion[i].vQslimNext;
 
 		NuevosVerts.push_back(this->cVerts[OrdvQslim]);
@@ -421,4 +424,17 @@
 			Ordenacion[i].vLSNext	=	vSig;
 		}
+	
+		//	Bone reassignment.
+		for (size_t assig = 0; assig < mInitialMesh->mBones.size(); assig++)
+		{
+			if (mInitialMesh->mBones[assig].vertexIndex == Ordenacion[i].vQslim)
+			{
+				bone.vertexIndex	=	i;
+				bone.boneIndex		=	mInitialMesh->mBones[assig].boneIndex;
+				bone.weight				=	mInitialMesh->mBones[assig].weight;
+
+				mGeoMesh->mBones.push_back(bone);
+			}
+		}
 	}
 
@@ -494,8 +510,8 @@
 }
 
-//---------------------------------------------------------------------------
+//-------------------------------------------------------------------------
 //	Constructor of LodStripsConstructor object from
 //	a Mesh and MeshSimplificationSequence.
-//---------------------------------------------------------------------------
+//-------------------------------------------------------------------------
 LodStripsConstructor::LodStripsConstructor(const Mesh						*m,
 										   				const MeshSimplificationSequence	*ms,
@@ -509,5 +525,8 @@
 	mGeoMesh			=	new Mesh();
 	*mGeoMesh			=	*m;
-	
+
+	//	Initialize bones assignments.
+	mGeoMesh->mBones.clear();
+
 	mInitialMesh	=	new Mesh();
 	*mInitialMesh	=	*m;
@@ -524,7 +543,7 @@
 }
 
-//---------------------------------------------------------------------------
+//-------------------------------------------------------------------------
 //	Destructor LodStripsConstructor object
-//---------------------------------------------------------------------------
+//-------------------------------------------------------------------------
 LodStripsConstructor::~LodStripsConstructor()
 {
@@ -540,5 +559,4 @@
 
 	delete [] vStrips;
-
 	delete [] vVerts;
 
@@ -552,13 +570,12 @@
 
 	delete [] pCambios;
-
 	delete	mInitialMesh;
 	delete	mGeoMesh;
 }
 
-//---------------------------------------------------------------------------
+//-------------------------------------------------------------------------
 //	Build lod file with necessary information and save all changes at
 //	lodStripConstructor object.
-//---------------------------------------------------------------------------
+//-------------------------------------------------------------------------
 void LodStripsConstructor::Save(std::string filename)
 {
@@ -594,5 +611,5 @@
 	this->TOTALINDICES	=	0;
 	
-	for(size_t	i = 0; i < this->cStrips.size(); i++)
+	for (size_t	i = 0; i < this->cStrips.size(); i++)
 	{
 		this->TOTALINDICES += int(this->cStrips[i].size());
@@ -602,4 +619,5 @@
 	//	Changes
 	fwrite(&changesCount, sizeof(int), 1, f);
+
 	for(size_t	i = 0; i < this->cCambios.size(); i++)
 	{
@@ -610,4 +628,5 @@
 	//	Data.
 	fwrite(&dataCount, sizeof(int), 1, f);
+
 	for(size_t	i = 0; i < this->cDatos.size(); i++)
 	{
@@ -967,6 +986,8 @@
 
 //---------------------------------------------------------------------------
-//	Sort submesh bones.
-//---------------------------------------------------------------------------
+//	Update mesh.
+//---------------------------------------------------------------------------
+<<<<<<< .mine
+=======
 void LodStripsConstructor::sortBones()
 {
@@ -1021,4 +1042,5 @@
 }
 
+>>>>>>> .r2077
 void LodStripsConstructor::UpdateMesh(void)
 {
@@ -1216,13 +1238,16 @@
 }
 
-//---------------------------------------------------------------------------
+//-------------------------------------------------------------------------
 //	Add new vertices to mesh.
-//---------------------------------------------------------------------------
+//-------------------------------------------------------------------------
 void LodStripsConstructor::AddNewVertices()
 {
-	int				num_vertices;
-	SubMesh			*geosubmesh;
+	size_t				num_vertices;
+	size_t				bones_count;
+	SubMesh				*geosubmesh;
 	VertexBuffer	*vertex_buffer;
 	VertexBuffer	*new_vertex_buffer;
+
+	vector<VertexBoneAssignment>::iterator	it;
 
 	//	Gets old vertex buffer.
@@ -1255,24 +1280,44 @@
 	}
 
-
 	//	Copy new vertices.
 	std::vector<VertexBoneAssignment> newbones;
 	for (unsigned	int	i	=	0;	i < mGeoMeshSQ->mNewVertices.size();	i++)
 	{
-		new_vertex_buffer->mPosition[num_vertices + i] = mGeoMeshSQ->mNewVertices[i].position;
-		new_vertex_buffer->mTexCoords[num_vertices + i]	= mGeoMeshSQ->mNewVertices[i].texcoord;
-		new_vertex_buffer->mNormal[num_vertices + i] = mGeoMeshSQ->mNewVertices[i].normal;
-
-		// check if my twin-vertex-bone has a bone assignment
-		// we check only the GeoMesh bones because the lodstrips only works for sharedvertex bones
-		for (std::vector<VertexBoneAssignment>::iterator it = mGeoMesh->mBones.begin(); it != mGeoMesh->mBones.end(); it ++)
-		{
+		new_vertex_buffer->mPosition[num_vertices + i] =
+																		mGeoMeshSQ->mNewVertices[i].position;
+
+		new_vertex_buffer->mTexCoords[num_vertices + i]	=
+																		mGeoMeshSQ->mNewVertices[i].texcoord;
+
+		new_vertex_buffer->mNormal[num_vertices + i] =
+																		mGeoMeshSQ->mNewVertices[i].normal;
+
+		//	Initialize number of bones.
+		bones_count	=	mInitialMesh->mBones.size();
+
+		// Check if my twin-vertex-bone has a bone assignment
+		// we check only the GeoMesh bones because the lodstrips
+		// only works for sharedvertex bones
+		for (int bone = 0; bone < bones_count; bone++)
+		{
+			it	=	mInitialMesh->mBones.begin() + bone;
+
 			if (it->vertexIndex == mGeoMeshSQ->mNewVertices[i].bonefrom)
 			{
 				VertexBoneAssignment vba;
+<<<<<<< .mine
+
+				vba.boneIndex		=	it->boneIndex;
+				vba.vertexIndex	=	mGeoMeshSQ->mNewVertices[i].id;
+				vba.weight			=	it->weight;
+
+				mInitialMesh->mBones.push_back(vba);
+				bones_count++;
+=======
 				vba.boneIndex = it->boneIndex;
 				vba.vertexIndex = mGeoMeshSQ->mNewVertices[i].id;
 				vba.weight = it->weight;
 				newbones.push_back(vba);
+>>>>>>> .r2077
 			}
 		}
