Changeset 2078


Ignore:
Timestamp:
02/05/07 13:11:33 (17 years ago)
Author:
gumbau
Message:

modified GeoLodStripsConstructor?.cpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp

    r1600 r2078  
    283283} 
    284284 
    285 //--------------------------------------------------------------------------- 
     285//------------------------------------------------------------------------- 
    286286//Put in order vertex of Mesh from simplification sequence 
    287 //--------------------------------------------------------------------------- 
     287//------------------------------------------------------------------------- 
    288288void LodStripsConstructor::OrdenarModeloVQSLIM(TIPOFUNC upb) 
    289289{ 
     
    292292        unsigned long int t; 
    293293        unsigned long int v; 
    294         long int vSig; 
    295         long int k; 
     294        long int                                        vSig; 
     295        long int                                        k; 
    296296        VECTORVERTEX                    Vertices; 
    297         std::vector<tipoVertice>                NuevosVerts; 
     297         
     298        std::vector<tipoVertice>                                NuevosVerts; 
    298299        std::vector<std::vector<int> >  NuevasTiras; 
    299         std::vector<int>                tira; 
    300         tipoOrden                               Orden; 
    301         tipoOrden                               *Ord; 
     300        std::vector<int>                                                                tira; 
     301 
     302        tipoOrden                       Orden; 
     303        tipoOrden                       *Ord; 
    302304        bool                                    bEncontrado; 
    303  
    304305 
    305306        //      Progress bar 
     
    308309        long    int     update; 
    309310 
     311        VertexBoneAssignment    bone; 
     312 
    310313        bEncontrado = false; 
    311314 
     
    348351        //      3 seg. 
    349352        //Ordenacion de los vertices 
    350         for(i = 0; i < Ordenacion.size(); i++) 
     353        for (i = 0; i < Ordenacion.size(); i++) 
    351354        { 
    352355                if (update      !=      (int)(i * increment)) 
     
    357360 
    358361                int OrdvQslim = Ordenacion[i].vQslim; 
    359                 int OrdvQslimNext = Ordenacion[i].vQslimNext; 
     362                //int OrdvQslimNext = Ordenacion[i].vQslimNext; 
    360363 
    361364                NuevosVerts.push_back(this->cVerts[OrdvQslim]); 
     
    421424                        Ordenacion[i].vLSNext   =       vSig; 
    422425                } 
     426         
     427                //      Bone reassignment. 
     428                for (size_t assig = 0; assig < mInitialMesh->mBones.size(); assig++) 
     429                { 
     430                        if (mInitialMesh->mBones[assig].vertexIndex == Ordenacion[i].vQslim) 
     431                        { 
     432                                bone.vertexIndex        =       i; 
     433                                bone.boneIndex          =       mInitialMesh->mBones[assig].boneIndex; 
     434                                bone.weight                             =       mInitialMesh->mBones[assig].weight; 
     435 
     436                                mGeoMesh->mBones.push_back(bone); 
     437                        } 
     438                } 
    423439        } 
    424440 
     
    494510} 
    495511 
    496 //--------------------------------------------------------------------------- 
     512//------------------------------------------------------------------------- 
    497513//      Constructor of LodStripsConstructor object from 
    498514//      a Mesh and MeshSimplificationSequence. 
    499 //--------------------------------------------------------------------------- 
     515//------------------------------------------------------------------------- 
    500516LodStripsConstructor::LodStripsConstructor(const Mesh                                           *m, 
    501517                                                                                                                const MeshSimplificationSequence        *ms, 
     
    509525        mGeoMesh                        =       new Mesh(); 
    510526        *mGeoMesh                       =       *m; 
    511          
     527 
     528        //      Initialize bones assignments. 
     529        mGeoMesh->mBones.clear(); 
     530 
    512531        mInitialMesh    =       new Mesh(); 
    513532        *mInitialMesh   =       *m; 
     
    524543} 
    525544 
    526 //--------------------------------------------------------------------------- 
     545//------------------------------------------------------------------------- 
    527546//      Destructor LodStripsConstructor object 
    528 //--------------------------------------------------------------------------- 
     547//------------------------------------------------------------------------- 
    529548LodStripsConstructor::~LodStripsConstructor() 
    530549{ 
     
    540559 
    541560        delete [] vStrips; 
    542  
    543561        delete [] vVerts; 
    544562 
     
    552570 
    553571        delete [] pCambios; 
    554  
    555572        delete  mInitialMesh; 
    556573        delete  mGeoMesh; 
    557574} 
    558575 
    559 //--------------------------------------------------------------------------- 
     576//------------------------------------------------------------------------- 
    560577//      Build lod file with necessary information and save all changes at 
    561578//      lodStripConstructor object. 
    562 //--------------------------------------------------------------------------- 
     579//------------------------------------------------------------------------- 
    563580void LodStripsConstructor::Save(std::string filename) 
    564581{ 
     
    594611        this->TOTALINDICES      =       0; 
    595612         
    596         for(size_t      i = 0; i < this->cStrips.size(); i++) 
     613        for (size_t     i = 0; i < this->cStrips.size(); i++) 
    597614        { 
    598615                this->TOTALINDICES += int(this->cStrips[i].size()); 
     
    602619        //      Changes 
    603620        fwrite(&changesCount, sizeof(int), 1, f); 
     621 
    604622        for(size_t      i = 0; i < this->cCambios.size(); i++) 
    605623        { 
     
    610628        //      Data. 
    611629        fwrite(&dataCount, sizeof(int), 1, f); 
     630 
    612631        for(size_t      i = 0; i < this->cDatos.size(); i++) 
    613632        { 
     
    967986 
    968987//--------------------------------------------------------------------------- 
    969 //      Sort submesh bones. 
    970 //--------------------------------------------------------------------------- 
     988//      Update mesh. 
     989//--------------------------------------------------------------------------- 
     990<<<<<<< .mine 
     991======= 
    971992void LodStripsConstructor::sortBones() 
    972993{ 
     
    10211042} 
    10221043 
     1044>>>>>>> .r2077 
    10231045void LodStripsConstructor::UpdateMesh(void) 
    10241046{ 
     
    12161238} 
    12171239 
    1218 //--------------------------------------------------------------------------- 
     1240//------------------------------------------------------------------------- 
    12191241//      Add new vertices to mesh. 
    1220 //--------------------------------------------------------------------------- 
     1242//------------------------------------------------------------------------- 
    12211243void LodStripsConstructor::AddNewVertices() 
    12221244{ 
    1223         int                             num_vertices; 
    1224         SubMesh                 *geosubmesh; 
     1245        size_t                          num_vertices; 
     1246        size_t                          bones_count; 
     1247        SubMesh                         *geosubmesh; 
    12251248        VertexBuffer    *vertex_buffer; 
    12261249        VertexBuffer    *new_vertex_buffer; 
     1250 
     1251        vector<VertexBoneAssignment>::iterator  it; 
    12271252 
    12281253        //      Gets old vertex buffer. 
     
    12551280        } 
    12561281 
    1257  
    12581282        //      Copy new vertices. 
    12591283        std::vector<VertexBoneAssignment> newbones; 
    12601284        for (unsigned   int     i       =       0;      i < mGeoMeshSQ->mNewVertices.size();    i++) 
    12611285        { 
    1262                 new_vertex_buffer->mPosition[num_vertices + i] = mGeoMeshSQ->mNewVertices[i].position; 
    1263                 new_vertex_buffer->mTexCoords[num_vertices + i] = mGeoMeshSQ->mNewVertices[i].texcoord; 
    1264                 new_vertex_buffer->mNormal[num_vertices + i] = mGeoMeshSQ->mNewVertices[i].normal; 
    1265  
    1266                 // check if my twin-vertex-bone has a bone assignment 
    1267                 // we check only the GeoMesh bones because the lodstrips only works for sharedvertex bones 
    1268                 for (std::vector<VertexBoneAssignment>::iterator it = mGeoMesh->mBones.begin(); it != mGeoMesh->mBones.end(); it ++) 
    1269                 { 
     1286                new_vertex_buffer->mPosition[num_vertices + i] = 
     1287                                                                                                                                                mGeoMeshSQ->mNewVertices[i].position; 
     1288 
     1289                new_vertex_buffer->mTexCoords[num_vertices + i] = 
     1290                                                                                                                                                mGeoMeshSQ->mNewVertices[i].texcoord; 
     1291 
     1292                new_vertex_buffer->mNormal[num_vertices + i] = 
     1293                                                                                                                                                mGeoMeshSQ->mNewVertices[i].normal; 
     1294 
     1295                //      Initialize number of bones. 
     1296                bones_count     =       mInitialMesh->mBones.size(); 
     1297 
     1298                // Check if my twin-vertex-bone has a bone assignment 
     1299                // we check only the GeoMesh bones because the lodstrips 
     1300                // only works for sharedvertex bones 
     1301                for (int bone = 0; bone < bones_count; bone++) 
     1302                { 
     1303                        it      =       mInitialMesh->mBones.begin() + bone; 
     1304 
    12701305                        if (it->vertexIndex == mGeoMeshSQ->mNewVertices[i].bonefrom) 
    12711306                        { 
    12721307                                VertexBoneAssignment vba; 
     1308<<<<<<< .mine 
     1309 
     1310                                vba.boneIndex           =       it->boneIndex; 
     1311                                vba.vertexIndex =       mGeoMeshSQ->mNewVertices[i].id; 
     1312                                vba.weight                      =       it->weight; 
     1313 
     1314                                mInitialMesh->mBones.push_back(vba); 
     1315                                bones_count++; 
     1316======= 
    12731317                                vba.boneIndex = it->boneIndex; 
    12741318                                vba.vertexIndex = mGeoMeshSQ->mNewVertices[i].id; 
    12751319                                vba.weight = it->weight; 
    12761320                                newbones.push_back(vba); 
     1321>>>>>>> .r2077 
    12771322                        } 
    12781323                } 
Note: See TracChangeset for help on using the changeset viewer.