Changeset 1552


Ignore:
Timestamp:
10/02/06 19:09:48 (18 years ago)
Author:
gumbau
Message:

Fixed degenerates in LodStripsFixed?

Location:
GTP/trunk/Lib/Geom/shared/GTGeometry
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h

    r1526 r1552  
    185185 
    186186                        uint32 GetValidIndexCount(int submeshid) const { return indices_x_submesh[submeshid]; } 
    187                         uint32 GetValidOffset(int submeshid) const { return offsets_x_submesh[submeshid]; } 
     187//                      uint32 GetValidOffset(int submeshid) const { return offsets_x_submesh[submeshid]; } 
    188188                        uint32 GetTotalStripCount(void) const { return mTotalStrips; } 
    189189                        uint32 GetSubMeshtripCount(int submeshid) const { return mStripsSubmesh[submeshid]; } 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h

    r1526 r1552  
    5151                const IndexData* CurrentLOD_Trunk_Indices(void) const; 
    5252                uint32 GetValidTrunkIndexCount(int isubmesh) const { return trunk->GetValidIndexCount(isubmesh); } 
    53                 uint32 GetValidTrunkOffset(int isubmesh) const { return trunk->GetValidOffset(isubmesh); } 
     53//              uint32 GetValidTrunkOffset(int isubmesh) const { return trunk->GetValidOffset(isubmesh); } 
    5454 
    5555//              uint32 Get_Foliage_VertexCount(void) const; 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp

    r1541 r1552  
    6060        } 
    6161 
     62 
    6263        update          =       -1; 
    6364        increment       =       (float)30.0     /       increment; 
     
    148149                                         
    149150 
    150                                         /* 
    151                                         cDatos.push_back(p0); 
    152                                         cDatos.push_back(r); 
    153  
    154                                         r       =       0; 
    155                                         k       =       long(cStripsT.size()-r-3); 
    156                                         */ 
     151                                         
     152                                        //cDatos.push_back(p0); 
     153                                        //cDatos.push_back(r); 
     154 
     155                                        //r     =       0; 
     156                                        //k     =       long(cStripsT.size()-r-3); 
     157                                         
    157158                                        long auxp0, auxr; 
    158159                                        //regLOD.strip= t; 
     
    669670        upb(percent); 
    670671 
    671         //      6 min.   
    672672        this->OrdenarModeloVQSLIM(upb); 
    673673 
     
    677677        for(i = 0; i < this->TOTALTIRAS; i++) 
    678678        { 
    679                 t = long(this->cStrips[i].size()); 
    680                  
     679                t = long(this->cStrips[i].size());               
    681680                if (t > max) 
    682681                        max     = t; 
     
    879878 
    880879                num_vert        =       0; 
    881                  
     880 
     881                // load the strips list          
    882882                for     (i = 0; i < this->mGeoMesh->mSubMeshCount; i++) 
    883883                { 
     
    891891                                        Index   *aux    =       this->mGeoMesh->mSubMesh[i].mStrip[j]; 
    892892 
    893                                         /* 
     893                                        // remove strip degenerates (first indices) except for the first (DEG!) 
    894894                                        if (j != 0) 
    895895                                        { 
    896896                                                // La primera tira no empieza por índices repetidos. 
    897                                                 aux     =       aux+1; 
    898  
     897                                                aux     = aux+1; 
    899898                                                indice_acum++; 
    900899                                        } 
    901                                         */ 
    902  
     900                                         
    903901                                        if (j+1 < this->mGeoMesh->mSubMesh[i].mStripCount) 
    904902                                        { 
     
    915913                                                } 
    916914 
    917                                                 //tira.pop_back(); 
     915                                                // DEG!: remove strip degenerates (last indices) except for the last strip 
     916                                                tira.pop_back(); 
    918917 
    919918                                                this->cStrips.push_back(tira); 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp

    r1541 r1552  
    281281        } 
    282282 
     283/*      // debug! 
     284        FILE *f = fopen("lodstrips_lodinfo.txt","wt"); 
     285        fprintf(f,"mCurrentLOD: %d",mCurrentLod); 
     286        fprintf(f,"mLods: %d",mLods); 
     287        for (int i=0; i<mTotalStrips; i++) 
     288        { 
     289                fprintf(f,"\nstrip: %d - ",i); 
     290                for (int j=0; j<mStrips[i].size(); j++) 
     291                { 
     292                        int ind = mStrips[i][j]; 
     293                        fprintf(f,"%d ",ind); 
     294                } 
     295        } 
     296        fclose(f);*/ 
     297 
    283298        UpdateDataRetrievalInterface(); 
    284299//      return  return_value; 
     
    456471                mStripsChanges[i]       =       0; 
    457472        } 
     473 
    458474//      dataRetrievalInterface->End(); 
    459475 
     
    525541                        indexBegin      =       geoSubMesh->mStrip[strip]; 
    526542 
    527                         //      If the strips is not the first. 
    528                          
    529 /*                      if (strip != 0) 
    530                         { 
     543                        //      If the strips is not the first. (DEG!) 
     544                        if (strip != 0) 
    531545                                indexBegin++; 
    532                         } 
    533 */                       
    534546 
    535547                        //      If is the final strip 
     
    544556                                indexEnd        = geoSubMesh->mStrip[strip + 1]; 
    545557 
    546                                 //      Remove degenerated 
    547 //                              indexEnd--; 
     558                                //      Remove degenerated (DEG!) 
     559                                indexEnd--; 
    548560                        } 
    549561                         
     
    656668void LodStripsLibrary::UpdateDataRetrievalInterface(void) 
    657669{ 
    658         unsigned        int     ii      =       0; 
    659          
    660         int     counter = 0; 
    661670        int     target_submesh  = 0; 
    662671        size_t  strip_count     = 0; 
    663         unsigned int ii_submesh = 0; 
    664  
    665         dataRetrievalInterface->Begin(target_submesh, indices_x_submesh[target_submesh]); 
    666  
    667 //      dataRetrievalInterface->SetCurrentSubmesh(target_submesh); 
    668  
    669         for (unsigned   int     i       =       0;      i < mTotalStrips;       i++,    strip_count++) 
     672        unsigned int ii_submesh = 0;     
     673        current_triangle_count = 0; 
     674 
     675        // indices_x_submesh is calculated without degenerates,  
     676        // we must add the degenerate indices added here 
     677        uint32 numdeg = mGeoMesh->mSubMesh[target_submesh].mStripCount*2 - 2; 
     678 
     679        dataRetrievalInterface->Begin(target_submesh, indices_x_submesh[target_submesh] + numdeg); 
     680        current_triangle_count += indices_x_submesh[target_submesh] + numdeg; 
     681 
     682        for (unsigned int i = 0; i < mTotalStrips; i++, strip_count++) 
    670683        { 
    671684                if (strip_count >= mGeoMesh->mSubMesh[target_submesh].mStripCount) 
    672685                { 
    673 //                      indices_x_submesh[target_submesh] = counter; 
    674  
    675686                        if (target_submesh==0) 
    676687                                offsets_x_submesh[target_submesh] = 0; 
     
    678689                                offsets_x_submesh[target_submesh] = indices_x_submesh[target_submesh-1] + offsets_x_submesh[target_submesh-1]; 
    679690 
    680                         counter =       0; 
    681691                        mStripsSubmesh[target_submesh]  =       (int)strip_count; 
    682692                        strip_count     =       0; 
     
    684694                        target_submesh++; 
    685695                        ii_submesh = 0; 
    686 //                      dataRetrievalInterface->SetCurrentSubmesh(target_submesh); 
    687696                        dataRetrievalInterface->End(); 
    688                         dataRetrievalInterface->Begin(target_submesh, indices_x_submesh[target_submesh]); 
     697                         
     698                        numdeg = mGeoMesh->mSubMesh[target_submesh].mStripCount*2 - 2; 
     699                        dataRetrievalInterface->Begin(target_submesh, indices_x_submesh[target_submesh] + numdeg); 
     700                        current_triangle_count += indices_x_submesh[target_submesh] + numdeg; 
    689701                } 
    690702                 
    691703                int lastindex = -1; 
    692                 for (SmallIntVector::iterator it=mStrips[i].begin(); it!=mStrips[i].end(); it++, ii++, ii_submesh++) 
     704                for (SmallIntVector::iterator it=mStrips[i].begin(); it!=mStrips[i].end(); it++, ii_submesh++) 
    693705                { 
    694 /*                      // repeat the first index of the strip: degenerate 
    695                         if (lastindex==-1) 
     706                        // repeat the first index of the strip: degenerate (DEG!) 
     707                        // except for the first strip in a mesh 
     708                        if (lastindex==-1 && strip_count>0) 
    696709                        { 
    697710                                lastindex=*it; 
    698                                 dataRetrievalInterface->SetIndex(ii,*it);                                
    699                                 counter++; 
    700                                 ii++; 
    701                         }*/ 
     711                                dataRetrievalInterface->SetIndex(ii_submesh,*it);                                
     712                                ii_submesh++; 
     713                        } 
    702714                        lastindex=*it; 
    703715                        dataRetrievalInterface->SetIndex(ii_submesh,*it); 
    704                         counter++; 
    705716                } 
    706717 
    707 /*              // last repeat last vertex of the strip: degenerate 
    708                 dataRetrievalInterface->SetIndex(ii,lastindex); 
    709                 counter++; 
    710                 ii++;*/ 
    711  
    712 //              dataRetrievalInterface->SetNumValidIndices(ii); 
     718                // repeat last vertex of the strip: degenerate (DEG!) 
     719                // except for the last strip in a mesh 
     720                if (strip_count<mGeoMesh->mSubMesh[target_submesh].mStripCount-1) 
     721                { 
     722                        dataRetrievalInterface->SetIndex(ii_submesh,lastindex); 
     723                        ii_submesh++; 
     724                } 
    713725        } 
    714726 
    715727        if (strip_count >= mGeoMesh->mSubMesh[target_submesh].mStripCount) 
    716728        { 
    717 //              indices_x_submesh[target_submesh] = counter; 
    718729                if (target_submesh==0) 
    719730                        offsets_x_submesh[target_submesh] = 0; 
     
    721732                        offsets_x_submesh[target_submesh] = indices_x_submesh[target_submesh-1] + offsets_x_submesh[target_submesh-1]; 
    722733 
    723                 counter = 0; 
    724734                mStripsSubmesh[target_submesh] = (int)strip_count; 
    725735                strip_count = 0; 
    726736                target_submesh++; 
    727 //              dataRetrievalInterface->SetCurrentSubmesh(target_submesh); 
    728737        } 
    729738 
Note: See TracChangeset for help on using the changeset viewer.