Changeset 1541


Ignore:
Timestamp:
09/29/06 11:19:25 (18 years ago)
Author:
gumbau
Message:
 
Location:
GTP/trunk/Lib/Geom/shared/GTGeometry/src
Files:
2 edited

Legend:

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

    r1526 r1541  
    326326 
    327327                Orden.vQslimNext        =       theStep.mV0; 
    328                 Orden.vQslim            =       theStep.mV1; 
     328                Orden.vQslim                    =       theStep.mV1; 
    329329                Orden.obligatory        =       theStep.obligatory; 
    330                 Orden.vLS                       =       i; 
    331  
    332                 Orden.x                         =       theStep.x; 
     330                Orden.vLS                                       =       i; 
     331 
     332                Orden.x                                 =       theStep.x; 
    333333                Orden.vLSNext           =       -1; 
    334334                Orden.cambio            =       "n"; 
     
    337337        } 
    338338         
    339  
    340339        update          =       -1; 
    341340        increment       =       (float)(10.0) / (float)(Ordenacion.size()); 
     
    362361 
    363362                cVerts[OrdvQslim].Next  =       -1; 
    364  
    365363        } 
    366364 
     
    569567        int vertexCount         =       (int)this->cVerts.size(); 
    570568        int changesCount        =       (int)this->cCambios.size(); 
    571         int dataCount           =       (int)this->cDatos.size(); 
     569        int dataCount                   =       (int)this->cDatos.size(); 
    572570        int cambiosCount        =       this->TOTALCAMBIOS; 
    573         int size                        =       changesCount*sizeof(LODData) +  
    574                                 (vertexCount + dataCount + cambiosCount + 4)*sizeof(int) + 
    575                                 CHUNK_OVERHEAD_SIZE; 
    576  
    577         FILE *f = fopen(filename.c_str(),"ab"); 
    578  
    579         unsigned short chunkid = 0xabcd; 
    580         fwrite(&chunkid,sizeof(unsigned short),1,f);     
     571        int size                                        =       changesCount*sizeof(LODData) 
     572                                                                                        + 
     573                                                                                        (vertexCount + dataCount + cambiosCount + 4) 
     574                                                                                        * 
     575                                                                                        sizeof(int) 
     576                                                                                        + 
     577                                                                                        CHUNK_OVERHEAD_SIZE; 
     578 
     579        FILE *f =       fopen(filename.c_str(),"ab"); 
     580 
     581        unsigned short chunkid  =       0xabcd; 
     582 
     583        fwrite(&chunkid,sizeof(unsigned short),1,f); 
    581584        fwrite(&size,sizeof(unsigned long),1,f); 
    582585 
    583         // VERTICES 
     586        // VERTICES. 
    584587        fwrite(&vertexCount, sizeof(int), 1, f); 
    585         for(size_t      i = 0; i < this->cVerts.size(); i++) 
    586         { 
    587                 int auxv = cVerts[i].Next; 
     588 
     589        for (size_t     i = 0; i < this->cVerts.size(); i++) 
     590        { 
     591                int auxv        =       cVerts[i].Next; 
    588592                fwrite(&auxv, sizeof(int), 1, f); 
    589593        } 
    590          
     594 
    591595        //      CSTRIPS. 
    592596        this->TOTALINDICES      =       0; 
    593597         
    594598        for(size_t      i = 0; i < this->cStrips.size(); i++) 
     599        { 
    595600                this->TOTALINDICES += int(this->cStrips[i].size()); 
     601        } 
    596602 
    597603        //      lines starting with a d. 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp

    r1530 r1541  
    1313 
    1414using namespace Geometry; 
     15using   namespace       std; 
    1516 
    1617//----------------------------------------------------------------------------- 
     
    8283void LodStripsLibrary::GoToLod(float lodfactor) 
    8384{ 
    84         register        int                             j; 
    85         register        int                             offset; 
     85        register        int                     j; 
     86        register        int                     offset; 
    8687        long                    int                     i; 
    8788        long                    int                     k; 
    8889        long                    int                     b_change_ok     =       1; 
    89         unsigned long   int                     lod; 
     90        unsigned long   int     lod; 
    9091        long                    int                     t; 
    9192        long                    int                     r; 
     
    9596        long                    int                     total_changes; 
    9697        long                    int                     totalR; 
    97         SmallIntVector                          *strip; 
     98        SmallIntVector                                          *strip; 
    9899        SmallIntVector::iterator        start; 
    99100 
     
    104105 
    105106        lodFactor=lodfactor; 
    106 //      LODRegisterType * lastLOD = mCurrentRegLOD; 
    107107     
    108108        if (newLOD != mCurrentLod) 
     
    112112                        //      Forwards. 
    113113                        //      Increments LOD (decreases level of detail) 
    114                         for (lod = mCurrentLod; lod < newLOD || (mCurrentRegLOD->obligatory==1 && mCurrentLod<mLods-1); lod++) 
    115                         { 
    116                                 next                    =       mVertex[lod]; 
     114                        for (   lod     =       mCurrentLod; 
     115                                                (lod < newLOD) 
     116                                                || 
     117                                                ((mCurrentRegLOD->obligatory == 1) && (lod < (mLods - 1))); 
     118                                                lod++) 
     119                        { 
     120                                next                                    =       mVertex[lod]; 
    117121                                total_changes   =       mPChanges[lod]; 
    118122 
     
    120124                                { 
    121125                                        //      Strip change. 
    122                                         t               =       mCurrentRegLOD->strip;  
     126                                        t                       =       mCurrentRegLOD->strip; 
    123127                                        strip   =       &(mStrips[t]); 
    124                                         start   =       strip->begin();                          
     128                                        start   =       strip->begin(); 
     129 
    125130                                        int stripsize_ini = strip->size(); 
    126131                                 
     
    188193                        mCurrentRegLOD--; 
    189194                        mCurrentData--; 
    190                          
     195 
     196 
    191197                        //      Decrements LOD. 
    192                         for (lod = mCurrentLod; lod > newLOD || (mCurrentRegLOD->obligatory==1 && mCurrentLod>0); lod--) 
    193                         { 
     198                        for (   lod     =       mCurrentLod; 
     199                                                (lod > newLOD) 
     200                                                || 
     201                                                ((mCurrentRegLOD->obligatory == 1) && (lod > 0)) 
     202                                                || 
     203                                                ((mCurrentRegLOD[1].obligatory == 1) && (lod > 0)); 
     204                                                lod--) 
     205                        { 
     206 
    194207                                total_changes   =       mPChanges[lod - 1]; 
    195208                                 
     
    252265                                        int stripsize_end = strip->size(); 
    253266                                        indices_x_submesh[submesh_x_strip[t]] += (stripsize_end - stripsize_ini); 
    254  
    255267                                }                        
    256268                                 
    257                                 //      Update LOD.                              
     269                                //      Update LOD. 
    258270                                mCurrentLod     =       lod - 1; 
     271 
     272                                //      Debug. 
     273                                cout    <<      "Obligatory: " 
     274                                                        <<      (int)mCurrentRegLOD->obligatory 
     275                                                        <<      endl; 
    259276                        } 
    260277                         
Note: See TracChangeset for help on using the changeset viewer.