Changeset 1014


Ignore:
Timestamp:
06/13/06 10:45:56 (18 years ago)
Author:
gumbau
Message:
 
Location:
GTP/trunk/Lib/Geom/shared
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj

    r1007 r1014  
    6262                        <Tool 
    6363                                Name="VCCLCompilerTool" 
    64                                 Optimization="0" 
     64                                Optimization="2" 
    6565                                AdditionalIncludeDirectories=".\src\libs;.\include;.\src\libs\vmi\include" 
    6666                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GLEW_STATIC" 
    6767                                MinimalRebuild="TRUE" 
    68                                 BasicRuntimeChecks="3" 
     68                                BasicRuntimeChecks="0" 
    6969                                RuntimeLibrary="4" 
    7070                                UsePrecompiledHeader="0" 
    71                                 WarningLevel="3" 
     71                                WarningLevel="0" 
    7272                                Detect64BitPortabilityProblems="TRUE" 
    73                                 DebugInformationFormat="4" 
     73                                DebugInformationFormat="0" 
    7474                                CompileAs="2"/> 
    7575                        <Tool 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoBase.h

    r980 r1014  
    1414namespace Geometry { 
    1515 
    16         //Basic types 
     16        //      Basic types. 
    1717        typedef float                                   Real; 
    1818        typedef unsigned int            Index; 
     
    2222        typedef std::string                     String; 
    2323 
    24         //Vertex Info 
     24        //      Vertex Info. 
    2525        static const unsigned short VERTEX_EMPTY     = 0x00; 
    2626        static const unsigned short VERTEX_POSITION  = 0x01; 
     
    2929        static const unsigned short VERTEX_ALL = VERTEX_POSITION | VERTEX_NORMAL | VERTEX_TEXCOORDS; 
    3030 
    31         //Mmesh primitives 
     31        //      Mesh primitives. 
    3232        typedef enum  
    3333        { 
     
    3636        } MeshType; 
    3737 
    38                 //OSCAR 
    3938        struct VertexBoneAssignment 
    4039        { 
     
    5756        }; 
    5857         
    59         //      2006-02-14 
    60         //      Gustavo Puche. 
    6158        //      Needed to update the progress bar. 
    6259        typedef float updateProgressBar(float); 
     
    7875 
    7976#endif 
     77 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h

    r1009 r1014  
    5050 
    5151        /// LodStripsLibrary interface class. 
    52         /** This module contains functions that handle the levels of detail of the input multiresolution objects made of polygonal meshes. For any given resolution and object, this module returns a set of triangle strips representing the object at that resolution, that is, at the level of detail requested. These models use triangle strips to reduce storage usage and to speed up realistic rendering. 
     52        /** This module contains functions that handle the levels of detail  
     53         *      of the input multiresolution objects made of polygonal meshes. 
     54         *      For any given resolution and object, this module returns a set 
     55         *      of triangle strips representing the object at that resolution,  
     56         *      that is, at the level of detail requested. These models use  
     57         *      triangle strips to reduce storage usage and to speed up realistic  
     58         *      rendering. 
    5359        \n\n 
    5460 
     
    5864 
    5965Outputs:\n 
    60         - The module returns a strip set that represents the level of detail requested. 
     66        - The module returns a strip set that represents the level of  
     67                detail requested. 
    6168        . 
    6269 
     
    6572        { 
    6673                private: 
     74                         
     75                        // The name of the object. 
     76                        String  mName;  
    6777 
    68                         String  mName; /// The name of the object. 
    69  
    70                         ///Structures with the data read from the file 
    71                         ///We won't work with these structures 
     78                        //      Structures with the data read from the file 
     79                        //      We won't work with these structures 
    7280                        SmallIntVector                                                                  mFileVertices; 
    7381                        std::vector     <LODRegisterType>               mFileChangesLOD; 
     
    7583                        LongVector                                                                                      mData; 
    7684 
    77                         ///Structures with the data to work with 
    78                         SmallInt        mTotalStrips;           ///Total strips of the multiresolution object. 
    79                         SmallInt        mTotalVertices; ///Total vertices of the multiresolution object. 
    80                         SmallInt        mMaxVerticesLOD;///Number of vertices of the max LOD. 
    81                         SmallInt        mTotalChanges;  ///Total changes of the multiresolution object. 
    82                         SmallInt        mLods;                                  ///Available Lods. 
    83                         SmallInt        mMaxLod;                                ///Max level of detail. 
    84                         SmallInt        mMinLod;                                ///Min level of detail. 
    85                         SmallInt        mCurrentLod;            ///Current Lod. 
     85                        //      Structures with the data to work with 
     86 
     87                        //      Total strips of the multiresolution object. 
     88                        SmallInt        mTotalStrips; 
     89                         
     90                        //      Total vertices of the multiresolution object. 
     91                        SmallInt        mTotalVertices; 
     92                         
     93                        //      Number of vertices of the max LOD. 
     94                        SmallInt        mMaxVerticesLOD; 
     95                         
     96                        //      Total changes of the multiresolution object. 
     97                        SmallInt        mTotalChanges; 
     98                         
     99                        SmallInt        mLods;                          //      Available Lods. 
     100                        SmallInt        mMaxLod;                        //      Max level of detail. 
     101                        SmallInt        mMinLod;                        //      Min level of detail. 
     102                        SmallInt        mCurrentLod;    //      Current Lod. 
    86103 
    87104                        //      For the efficient version. 
     
    112129                        SmallIntVector  *mStrips; 
    113130                         
    114                         /// Constructor, receives as a parameter the name of the file including the multiresolution object. 
     131                        /**     Constructor, receives as a parameter the name of the file 
     132                         *      including the multiresolution object. 
     133                        */ 
    115134                        LodStripsLibrary(std::string, Mesh *geomesh); 
    116135 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp

    r996 r1014  
    2323} 
    2424 
    25 //----------------------------------------------------------------------------------- 
    26 //It makes Lods changes and count them 
    27 //----------------------------------------------------------------------------------- 
     25//---------------------------------------------------------------------------- 
     26//      It makes Lods changes and count them. 
     27//---------------------------------------------------------------------------- 
    2828void LodStripsConstructor::CalcularCambiosLODsVNuevaED(TIPOFUNC upb) 
    2929{ 
    30 //      LODPosition                                             pos; 
    31 //      vector  <LODPosition>   listaPos; 
    3230        long            int                                                     k; 
    3331        long            int                                                     i; 
     
    3634        unsigned long           int             v; 
    3735        long            int                                                     p0; 
    38         long            int                                                     lod     =       0; 
    3936        long            int                                                     sigue; 
    40         long            int                                                     ac[3]   =       {0,0,0}; 
     37        unsigned long           int             lod                             =       0; 
     38        long            int                                                     ac[3]                   =       {0,0,0}; 
    4139        long            int                                                     totalRegs       =       0; 
    4240        long            int                                                     RegsCambios; 
     
    4442        LODData                                                                 regLOD; 
    4543        LODChanges                                                      listaCambios; 
     44 
     45        //      Progress bar. 
    4646        float                                                                           percent; 
    4747        float                                                                           increment; 
    4848        long            int                                                     update; 
    4949 
     50        VECTORINT::iterator                                     it; 
     51        VECTORINT::iterator                                     itFin; 
     52        vector <VECTORINT>::iterator    itTiras; 
     53        vector <VECTORINT>::iterator    itTirasFin; 
     54        VECTORVERTEX::iterator                          itVertex; 
     55        VECTORVERTEX::iterator                          itVertexFin; 
     56 
    5057        //      Saves original copy. 
    5158        TiraOriginal                    =       this->cStrips; 
     
    5562        listaCambios.clear(); 
    5663 
     64        //      Progress bar. 
    5765        //      Initialize increment. 
    5866        increment       =       0.0; 
     
    6775        percent         =       1.0; 
    6876         
    69         this->LodsDisp  =       this->TOTALCAMBIOS      =       lod; 
     77        this->LodsDisp  =       this->TOTALCAMBIOS;//   =       lod; 
    7078        pCambios                                =       new uint32[this->TOTALCAMBIOS]; 
    7179        pCambios[0]                     =       0; 
    7280         
    73         for     (lod = 0; ((this->cVerts[lod].Next) != -1); lod++) 
    74         { 
     81        listaCambios.reserve(this->TOTALCAMBIOS * 2); 
     82        cDatos.reserve(this->TOTALCAMBIOS * 2 * 2); 
     83 
     84        printf("\nEmpiezan los cambios...%d",this->TOTALCAMBIOS); 
     85 
     86        for     (       lod     =       0,      itVertex        =       this->cVerts.begin(); 
     87                                lod < this->TOTALCAMBIOS; 
     88                                lod++,  itVertex++) 
     89        { 
     90                //      Progress bar. 
    7591                if (update      != (int)(increment * lod)) 
    7692                { 
    7793                        update  =       (int)(increment * lod); 
    7894                        upb(percent); 
    79                 }                        
    80                  
    81                 RegsCambios                             =       0; 
    82                 regLOD.obligatory       =       this->Ordenacion[lod].obligatorio; 
    83                  
    84                 for(t = 0; t < this->cStrips.size(); t++) 
     95                } 
     96                 
     97                /* 
     98                if ((lod % 100)==0) 
     99                { 
     100                        printf("*%d*",lod); 
     101                } 
     102                */ 
     103                 
     104                RegsCambios     =       0; 
     105                 
     106                //      Last strip. 
     107                itTirasFin      =       this->cStrips.end(); 
     108                 
     109                for(t   =       0,      itTiras =       this->cStrips.begin(); 
     110                                itTiras != itTirasFin; 
     111                                itTiras++,      t++) 
    85112                { 
    86113                        //      Initialize. 
     
    90117                        totalRegs               =       0; 
    91118                         
    92                         for (v = 0; v < this->cStrips[t].size(); v++) 
    93                         { 
    94                                 if (this->cStrips[t][v] == lod)  
    95                                 {  
     119                        //      Last index of the current strip. 
     120                        itFin                           =       itTiras->end(); 
     121                         
     122                        for (   it      =       itTiras->begin(),       v       =       0; 
     123                                                it != itFin; 
     124                                                it++,   v++) 
     125                        { 
     126                                if ((*it) == lod) 
     127                                { 
    96128                                        //      Strips. 
    97129                                        if (regLOD.strip == this->MARCAVACIO) 
     
    104136                                        cDatos.push_back(v); 
    105137 
    106                                         this->cStrips[t][v]     =       this->cVerts[lod].Next; 
     138                                        *it     =       itVertex->Next; 
    107139                                } 
    108140                        } 
     
    116148                        r                                       =       0; 
    117149                        sigue                   =       0; 
    118                         k                                       =       long(this->cStrips[t].size()-3); 
    119                          
     150                        k                                       =       long(itTiras->size() - 3); 
     151                        it                              =       itTiras->begin(); 
     152 
    120153                        while (i < k) 
    121154                        { 
    122                                 if (    (this->cStrips[t][i] == this->cStrips[t][i+1]) 
    123                                                         && 
    124                                                         (this->cStrips[t][i+1] == this->cStrips[t][i+2]) 
    125                                                 ) 
    126                                 {  
     155                                if (    ((*it) == (*(it + 1))) && ((*(it + 1)) == (*(it + 2)))) 
     156                                { 
    127157                                        //      Saves beginning of repetition. 
    128158                                        if (!r) 
     
    131161                                        } 
    132162                                         
    133                                         this->cStrips[t].erase(this->cStrips[t].begin()+i); 
     163                                        itTiras->erase(itTiras->begin() + i); 
    134164                                        i--; 
     165                                        it--; 
    135166                                        r++; 
    136167                                         
    137                                         if ((i+1) != this->cStrips[t].size()-1) 
     168                                        if ((i + 1) != (itTiras->size() - 1)) 
    138169                                        { 
    139170                                                sigue   =       1; 
     
    163194 
    164195                                        r       =       0; 
    165                                         k       =       long(this->cStrips[t].size()-r-3); 
     196                                        k       =       long(itTiras->size() - r - 3); 
    166197                                } 
    167198 
    168199                                i++; 
     200                                it++; 
    169201                        } 
    170202                         
     
    176208                        r                                       =       0; 
    177209                        sigue                   =       0; 
    178                         k                                       =       long(this->cStrips[t].size() - 4); 
     210                        k                                       =       long(itTiras->size() - 4); 
    179211                         
     212                        it = itTiras->begin(); 
     213 
    180214                        while   (i < k) 
    181215                        { 
    182                                 if (    (this->cStrips[t][i] == this->cStrips[t][i+2]) 
    183                                                         && 
    184                                                         (this->cStrips[t][i+1] == this->cStrips[t][i+3]) 
    185                                                 ) 
     216                                if (((*it) == (*(it + 2))) && ((*(it + 1)) == (*(it + 3)))) 
    186217                                { 
    187218                                        if (!r) 
     
    190221                                        } 
    191222                                         
    192                                         this->cStrips[t].erase(this->cStrips[t].begin()+i); 
    193                                         this->cStrips[t].erase(this->cStrips[t].begin()+i); 
     223                                        itTiras->erase(itTiras->begin() + i); 
     224                                        itTiras->erase(itTiras->begin() + i); 
     225 
    194226                                        r++; 
    195227                                         
    196228                                        i       -=      2; 
    197229                                         
    198                                         if ((i+1) != this->cStrips[t].size()-3) 
     230                                        it--; 
     231                                        it--; 
     232                                         
     233                                        if ((i + 1) != itTiras->size() - 3) 
    199234                                        { 
    200235                                                sigue   =       1; 
     
    204239                                                sigue   =       0; 
    205240                                        } 
    206                                          
    207241                                } 
    208242                                else 
     
    224258                                         
    225259                                        r       =       0; 
    226                                         k       =       long((this->cStrips[t].size()-4-2*r)); 
     260                                        k       =       long(itTiras->size() - 4 - 2 * r); 
    227261                                } 
    228262 
    229263                                i++; 
     264                                it++; 
    230265                        } 
    231266                         
     
    242277        }//     End for lod. 
    243278 
     279        printf("\nFin de los cambios..."); 
     280 
    244281        this->cCambios  =       listaCambios; 
    245282 
    246283        //      Guardar el numero de LODS disponibles. 
    247         this->TOTALCAMBIOS      =       this->LodsDisp=lod; 
     284        //this->TOTALCAMBIOS    =       this->LodsDisp=lod; 
    248285 
    249286        //Retornar a la lista original 
     
    261298        unsigned long int v; 
    262299        long int vSig; 
    263         long int k; 
     300        //long int k; 
    264301        VECTORVERTEX                            Vertices; 
    265302        VECTORVERTEX                            NuevosVerts; 
    266303        vector  <VECTORINT>     NuevasTiras; 
    267304        VECTORINT                                               tira; 
     305        VECTORINT::iterator it; 
     306        VECTORINT::iterator itFin; 
    268307        vector  <Index>                 mV1Aux; 
    269308        tipoOrden                                               Orden; 
    270309        tipoOrden                                               *Ord; 
     310        tipoOrden                                               *Ord2; 
    271311        bool                                                            bEncontrado; 
    272312        long    int                                             c1; 
    273313        long    int                                             c2; 
    274         //      Progress bar 
     314         
     315        //      Progress bar. 
    275316        float                   percent; 
    276317        float                   increment; 
    277318        long    int     update; 
    278319 
     320        unsigned long int       totalSize; 
     321 
    279322        bEncontrado = false; 
     323 
     324        printf("\n---->Lectura de Ordenacion"); 
     325         
     326        totalSize       =       (long int)this->geoMeshSQ->mSteps.size(); 
    280327 
    281328        c1                                      =       0; 
    282329        c2                                      =       0; 
    283330         
     331        //      Progress bar. 
    284332        update                  =       -1; 
    285333        percent                 =       1.0; 
    286         increment               =       (float)(10.0) / (float)(geoMeshSQ->mSteps.size()); 
    287          
    288         for     (i = 0; i < this->geoMeshSQ->mSteps.size(); i++) 
     334        increment               =       (float)(10.0) / (float)(totalSize); 
     335 
     336        for     (i = 0; i < totalSize; i++) 
    289337        { 
    290338                if (update      != (int)(i * increment)) 
     
    310358        this->NumVertsRepetidos = c2; 
    311359 
     360        printf("\n---->Cambiar vertices con x!0, Verts: %d",Ordenacion.size()); 
     361 
     362        //      Change all vertices that have x != 0. 
     363        totalSize       =       (long int)Ordenacion.size(); 
     364        Ord                             =       &(Ordenacion[0]); 
     365 
     366        //      Progress bar. 
    312367        update          =       -1; 
    313         increment       =       (float)(10.0) / (float)(Ordenacion.size()); 
     368        increment       =       (float)(10.0) / (float)(totalSize); 
    314369        percent         =       1.0; 
    315370 
    316371        //      Change all vertices that have x != 0. 
    317         for(i   =       0;      i < Ordenacion.size();  i++) 
    318         { 
     372        for(i   =       0;      i < totalSize;  i++) 
     373        { 
     374                //      Progress bar. 
    319375                if (update      != (int)(i * increment)) 
    320376                { 
     
    323379                } 
    324380                 
    325                 Ord     =       &(Ordenacion[i]); 
    326  
    327                 if (Ord->x!=0) 
     381                if (Ord->x != 0) 
    328382                { 
    329383                        //      Change the simplification order. 
     
    331385                        Ord->vQslim                     =       Ord->vQslimNext; 
    332386                        Ord->vQslimNext =       v; 
    333  
    334                         for (j = i+1; j < Ordenacion.size(); j++) 
    335                         { 
    336                                 if (Ordenacion[j].vQslim == Ord->vQslim) 
    337                                 { 
    338                                         Ordenacion[j].vQslim    =       Ord->vQslimNext; 
    339                                         Ordenacion[j].cambio    =       "y"; 
    340                                 } 
    341                                 else if (Ordenacion[j].vQslimNext == Ord->vQslim) 
    342                                 { 
    343                                         Ordenacion[j].vQslimNext        =       Ord->vQslimNext;         
    344                                         Ordenacion[j].cambio                    =       "y"; 
    345                                 } 
    346                         } 
    347                 } 
    348         } 
    349  
     387                        Ord2                                            =       &(Ordenacion[i + 1]); 
     388                         
     389                        for (j = i + 1; j < totalSize; j++,Ord2++) 
     390                        { 
     391                                if (Ord2->vQslim == Ord->vQslim) 
     392                                { 
     393                                        Ord2->vQslim    =       Ord->vQslimNext; 
     394                                        Ord2->cambio    =       "y"; 
     395                                } 
     396                                else if (Ord2->vQslimNext == Ord->vQslim) 
     397                                { 
     398                                        Ord2->vQslimNext        =       Ord->vQslimNext;         
     399                                        Ord2->cambio                    =       "y"; 
     400                                } 
     401                        } 
     402                } 
     403 
     404                Ord++; 
     405        } 
     406 
     407        printf("\n---->Nuevos vertices"); 
     408 
     409        totalSize       =       (long int)Ordenacion.size(); 
     410        Ord                             =       &(Ordenacion[0]); 
     411 
     412        //      Progress bar. 
    350413        update          =       -1; 
    351         increment       =       (float)(10.0) / (float)(Ordenacion.size()); 
     414        increment       =       (float)(10.0) / (float)(totalSize); 
    352415        percent         =       1.0; 
    353416 
    354         //      3 seg. 
    355         //Ordenacion de los vertices 
    356         for(i = 0; i < Ordenacion.size(); i++) 
    357         { 
     417        //      Vertex sort. 
     418        for(i = 0; i < totalSize; i++) 
     419        { 
     420                //      Progress bar. 
    358421                if (update      !=      (int)(i * increment)) 
    359422                { 
     
    363426 
    364427                c1++; 
    365                 NuevosVerts.push_back(this->cVerts[Ordenacion[i].vQslim]); 
    366  
    367                 cVerts[Ordenacion[i].vQslim].Next       =       -1; 
    368  
    369         } 
    370  
    371         //      Añadir aquellos vertices que no estaban en NuevosVerts  
    372         //      y no se simplificaban. 
     428                NuevosVerts.push_back(this->cVerts[Ord->vQslim]); 
     429 
     430                cVerts[Ord->vQslim].Next        =       -1; 
     431 
     432                //-------- 
     433                Ord++; 
     434                //-------- 
     435        } 
     436 
     437        printf( "\n---->Meter los que no se simplifican -> Ahora Hay: %d", 
     438                                        Ordenacion.size()); 
     439 
     440        //      Adds new vertices not in NuevosVerts. 
    373441        int cont                                =       0; 
    374442        int contestaban =       0; 
     
    394462        } 
    395463 
     464        totalSize       =       (long int)Ordenacion.size(); 
     465 
     466        printf("\n---->Siguientes QSLIM: %d",totalSize); 
     467 
     468        //      Progress bar. 
    396469        update          =       -1; 
    397         increment       =       (float)(10.0)   /       (float)(Ordenacion.size()); 
     470        increment       =       (float)(10.0)   /       (float)(totalSize); 
    398471        percent         =       1.0; 
    399472         
    400         //      2 min. 
    401         //      Calcular los siguiente teniendo en cuenta el QSLIM. 
    402         for (i = 0; i < Ordenacion.size(); i++) 
    403         { 
     473        //      Obtain nexts. 
     474        if (totalSize > 0) 
     475        { 
     476                Ord     =       &(Ordenacion[0]); 
     477        } 
     478 
     479        for (i = 0; i < totalSize; i++) 
     480        { 
     481                //      Progress bar. 
    404482                if (update      !=      (int)(i * increment)) 
    405483                { 
     
    408486                } 
    409487                 
    410                 v       =       Ordenacion[i].vQslimNext; 
    411  
    412                 //Buscar ese vertice v cual es ahora 
     488                v                       =       Ord->vQslimNext; 
    413489                vSig    =       0; 
    414  
    415                 for (t = 0; t < Ordenacion.size() && !vSig;t++) 
    416                 { 
    417                         if (Ordenacion[t].vQslim==v) 
    418                         { 
    419                                 vSig=Ordenacion[t].vLS; 
    420                         } 
    421                 } 
    422  
    423                 if (vSig!=0) 
    424                 { 
    425                         Ordenacion[i].vLSNext   =       vSig; 
    426                 } 
    427         } 
    428  
     490                Ord2    =       &(Ordenacion[0]); 
     491                 
     492                for (t  =       0;      (t < totalSize) && !vSig;       t++) 
     493                { 
     494                        if (Ord2->vQslim == v) 
     495                        { 
     496                                vSig    =       Ord2->vLS; 
     497                        } 
     498                         
     499                        Ord2++; 
     500                } 
     501                 
     502                if (vSig != 0) 
     503                { 
     504                        Ord->vLSNext    =       vSig; 
     505                } 
     506                 
     507                Ord++; 
     508        } 
     509 
     510        printf("\n---->Crear nuevas de tiras"); 
     511 
     512        /* 
     513        //      Create new strips with same dimensions. 
     514        for(t = 0; t < this->cStrips.size(); t++) 
     515        { 
     516                tira.clear(); 
     517 
     518                itFin   =       this->cStrips[t].end(); 
     519 
     520                for(it = cStrips[t].begin(); it != itFin; it++) 
     521                { 
     522                        //      For each new vertex. 
     523                        for     (v = 0; v < NuevosVerts.size(); v++) 
     524                        { 
     525                                Ord     =       &(Ordenacion[v]); 
     526 
     527                                if ((*it) == Ord->vQslim) 
     528                                { 
     529                                        tira.push_back(v); 
     530 
     531                                        //      Delete vertex inserted. 
     532                                        //NuevosVerts.erase(v); 
     533                                } 
     534                        } 
     535                } 
     536 
     537                NuevasTiras.push_back(tira); 
     538        } 
     539        */ 
     540         
    429541        //Creacion de nuevas tiras con las mismas dimensiones 
    430542        for(t = 0; t < this->cStrips.size(); t++) 
     
    439551                NuevasTiras.push_back(tira); 
    440552        } 
    441  
    442         update          =       -1; 
    443         increment       =       (float)(20.0) / (float)(NuevosVerts.size()); 
    444         percent         =       1.0; 
    445  
    446         k       =       0; 
     553         
     554        update  =       long(NuevosVerts.size() / 40); 
     555        percent =       0.5; 
    447556 
    448557        //      2 min. 
     
    450559        for(v = 0; v < NuevosVerts.size(); v++) 
    451560        { 
    452                 if (update != (int)(v * increment)) 
    453                 { 
    454                         update  =       (int)(v * increment); 
     561                if ((v % update) == 0) 
     562                { 
    455563                        upb(percent); 
    456564                } 
    457                  
     565 
    458566                for(t = 0; t < this->cStrips.size(); t++) 
    459567                { 
     
    462570                                if (this->cStrips[t][i] == Ordenacion[v].vQslim) 
    463571                                { 
    464                                         k++; 
    465572                                        NuevasTiras[t][i]       =       v; 
    466573                                } 
     
    469576        } 
    470577 
    471         //Cambiar a Tiras Nuevas 
     578        printf("\n---->Copiar los datos"); 
     579 
     580        //      Change to new strips. 
    472581        this->cStrips   =       NuevasTiras; 
    473582 
    474         //NuevosVerts y Ordenacion = tamaño. 
    475         for(i = 0; i < NuevosVerts.size(); i++) 
     583        //      Same size for NuevosVerts and Ordenacion. 
     584        this->TOTALCAMBIOS      =       0; 
     585         
     586        totalSize       =       (long int)NuevosVerts.size(); 
     587         
     588        //      For each new vertex. 
     589        for(i = 0; i < totalSize; i++) 
    476590        { 
    477591                NuevosVerts[i].Next     =       Ordenacion[i].vLSNext; 
     592                 
     593                if ((this->TOTALCAMBIOS == 0) && (NuevosVerts[i].Next == -1)) 
     594                { 
     595                        this->TOTALCAMBIOS      =       i; 
     596                } 
    478597        } 
    479598 
    480599        //Cambiar cVerts por nuevosVerts. 
    481600        this->cVerts    =       NuevosVerts; 
     601 
     602        printf( "--->Vertices: %d  * Cambios: %d", 
     603                                        NuevosVerts.size(), 
     604                                        this->TOTALCAMBIOS); 
    482605 
    483606        //percent       =       100.0; 
     
    11241247                //      Error. 
    11251248        } 
     1249 
     1250        //--------------------------------------------- 
     1251        //      Debug. 
     1252        //--------------------------------------------- 
     1253        FILE    *file_aux; 
     1254        file_aux        =       fopen("StripsModel.txt","w"); 
     1255        for (unsigned   int i = 0; i < cStrips.size(); i++) 
     1256        { 
     1257                for (unsigned   int j = 0; j < cStrips[i].size();       j++) 
     1258                { 
     1259                        fprintf(file_aux,"%d ",cStrips[i][j]); 
     1260                } 
     1261                fprintf(file_aux,"\n"); 
     1262        } 
     1263        //--------------------------------------------- 
     1264 
    11261265} 
    11271266 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp

    r1009 r1014  
    4040LodStripsLibrary::~LodStripsLibrary() 
    4141{ 
    42                 delete[] mStrips; 
     42        delete  [] mStrips; 
    4343} 
    4444 
     
    5757        long                    int                                                     k; 
    5858        long                    int                                                     b_change_ok     =       1; 
    59         unsigned long   int                                                     lod; 
     59        unsigned long   int                                     lod; 
    6060        long                    int                                                     t; 
    6161        long                    int                                                     r; 
    62         long                    int                                                     sig; 
     62        long                    int                                                     next; 
    6363        long                    int                                                     el1; 
    6464        long                    int                                                     el2; 
     
    7676                if (newLOD > mCurrentLod) 
    7777                { 
    78                         //HACIA ADELANTE 
    79                         //CurrentRegLOD 
    80                         //Incrementamos el LOD -> Calcular siguientes 
     78                        //      Forwards. 
     79                        //      Increments LOD. 
    8180                        for (lod = mCurrentLod; lod < newLOD; lod++) 
    8281                        { 
    83                                 sig                             =       mVertex[lod]; 
     82                                next                                            =       mVertex[lod]; 
    8483                                total_changes   =       mPChanges[lod]; 
    8584 
    8685                                for (i = 0; i < total_changes; i++) 
    8786                                { 
    88                                         //      Strip q Cambia. 
     87                                        //      Strip change. 
    8988                                        t                       =       mCurrentRegLOD->strip;  
    9089                                        strip   =       &(mStrips[t]); 
     
    9695                                        for (j = totalR - 1; j >= 0; j--) 
    9796                                        { 
    98                                                 start[*mCurrentData]    =       sig; 
     97                                                start[*mCurrentData]    =       next; 
    9998                                                 
    10099                                                ++mCurrentData; 
     
    132131                                                                                                        2*(*(mCurrentData + 1))); 
    133132 
    134                                                 ++mCurrentData; 
    135                                                 ++mCurrentData; 
     133                                                mCurrentData++; 
     134                                                mCurrentData++; 
    136135                                        } 
    137136 
    138                                         ++mCurrentRegLOD; 
     137                                        mCurrentRegLOD++; 
    139138                                         
    140139                                        mStripsChanges[t]       =       1; 
     
    146145 
    147146                } 
    148                 //      Si el nuevo LOD es menos que el actual. 
     147                //      If LOD is less than actual. 
    149148                else 
    150149                {  
    151                         --mCurrentRegLOD; 
    152                         --mCurrentData; 
     150                        mCurrentRegLOD--; 
     151                        mCurrentData--; 
    153152                         
    154                         //      Decrementamos el LOD -> Calcular anteriores. 
     153                        //      Decrements LOD. 
    155154                        for (lod = mCurrentLod; lod > newLOD; lod--) 
    156155                        { 
     
    178177                                                } 
    179178                                                 
    180                                                 --mCurrentData; 
    181                                                 --mCurrentData; 
     179                                                mCurrentData--; 
     180                                                mCurrentData--; 
    182181                                        } 
    183182 
     
    195194                                                } 
    196195 
    197                                                 --mCurrentData; 
    198                                                 --mCurrentData; 
     196                                                mCurrentData--; 
     197                                                mCurrentData--; 
    199198                                        } 
    200199                                         
     
    205204                                        { 
    206205                                                (*strip)[*mCurrentData] =       lod - 1; 
    207                                                 --mCurrentData; 
     206                                                mCurrentData--; 
    208207                                        } 
    209208                                         
    210                                         --mCurrentRegLOD; 
     209                                        mCurrentRegLOD--; 
    211210                                        mStripsChanges[t]       =       1; 
    212211                                }                        
    213212                                 
    214                                 //      Actualizar LOD. 
     213                                //      Update LOD. 
    215214                                mCurrentLod     =       lod - 1; 
    216215                        } 
    217216                         
    218                         ++mCurrentData; 
    219                         ++mCurrentRegLOD; 
     217                        mCurrentData++; 
     218                        mCurrentRegLOD++; 
    220219                }  
    221  
    222         }        
    223  
    224         /* 
    225         // Visualizar. 
    226         k               =       0; 
    227  
    228         for (uint32 i   =       0; i < mTotalStrips; i++) 
    229         { 
    230                 l                       =       mStrips[i].size(); 
    231                  
    232                 //      Los dos degenerados. 
    233                 k                       =       k + l + 2; 
    234                  
    235                 //      If is not the first strip. 
    236                 if (i != 0) 
    237                 { 
    238                         start   =       mStrips[i].begin(); 
    239  
    240                         //      Degenerado. 
    241                         mStrips[i].insert(start,mStrips[i][0]); 
    242                 } 
    243  
    244                 //      If is not the last strip. 
    245                 if (i != (mTotalStrips - 1)) 
    246                 { 
    247                         //      Degenerado. 
    248                         mStrips[i].push_back(mStrips[i][mStrips[i].size() - 1]); 
    249                 } 
    250  
    251         } 
    252         */ 
    253          
    254         /* 
    255          * Write in the hardware buffer. 
    256          * 
    257         int contTira    = 0; 
    258          
    259         //      Vuelca los datos en el buffer de pantalla. 
    260         //Ogre::HardwareIndexBufferSharedPtr    ibuf; 
    261         for(unsigned int j = 0; j < mGeoMesh->mSubMeshCount; j++) 
    262         { 
    263                 k       =       0; 
    264                 for(unsigned int s = 0; s < mGeoMesh->mSubMesh[j].mStripCount; s++) 
    265                 { 
    266                         l       =       mStrips[contTira].size(); 
    267  
    268                         mIndexBuffer[j]->writeData(k*sizeof(unsigned long), 
    269                                         l*sizeof(unsigned long), 
    270                                         &mStrips[contTira][0]); 
    271  
    272                         k       =       k + l; 
    273  
    274                         contTira++; 
    275                 } 
    276  
    277                 indexes[j]->indexCount  =       k; 
    278         } 
    279         */ 
    280          
    281         /* 
    282         //      Para el bunny. 
    283         start   =       mStrips[0].begin(); 
    284         mStrips[0].erase(start); 
    285         */ 
    286         /* 
    287         for (uint32 i   =       0; i < mTotalStrips; i++) 
    288         { 
    289                 start   =       mStrips[i].begin(); 
    290                  
    291                 //      If is not the first strip. 
    292                 if (i != 0) 
    293                 { 
    294                         mStrips[i].erase(start); 
    295                 } 
    296  
    297                 //      If is not the last strip. 
    298                 if (i != (mTotalStrips - 1)) 
    299                 { 
    300                         mStrips[i].pop_back(); 
    301                 } 
    302  
    303         } 
    304         */ 
    305          
     220        } 
     221 
    306222        return  return_value; 
    307223} 
    308224 
    309  
    310225//----------------------------------------------------------------------------- 
    311226//      Gets the maximum level of detail. 
     
    339254        uint32  number_of_vertices; 
    340255 
    341         //      Total vertices less total lod. 
     256        //      Total vertices of minimum lod. 
    342257        number_of_vertices      =       mMaxVerticesLOD - (mMinLod + 1); 
    343258 
     
    432347void LodStripsLibrary::CopyVectors2Arrays() 
    433348{ 
    434         unsigned int                                    i; 
    435         unsigned int                                    j; 
     349        unsigned int                    i; 
     350        unsigned int                    j; 
    436351        SmallInt                                        max; 
    437352        SmallInt                                        t; 
     
    447362        data_array                      =       new SmallInt[mData.size()]; 
    448363         
    449         //Calcular el tamaño maximo de tira y el numero de caras total 
    450364        max                                     =       0; 
    451365        mTotalFaces     =       0; 
     
    463377        } 
    464378 
    465         //Nueva version de ALLOCATE. 
    466379        changes_array   =       new LODRegisterType[mFileChangesLOD.size()]; 
    467380         
    468         //Rellenar vChanges 
     381        //      Fill up changes array. 
    469382        for (i = 0; i < mFileChangesLOD.size(); ++i) 
    470383        { 
     
    474387        mCurrentRegLOD  =       changes_array; 
    475388         
    476         //COPY---------------------------------- 
    477         //Copiar las tiras 
     389        //      Copy strips. 
    478390        for (i = 0; i < mFileStrips.size(); i++) 
    479391        { 
    480392                for (j = 0; j < mFileStrips[i].size(); j++) 
    481393                { 
    482                         //Rellenar el vVector 
    483394                        mStrips[i].push_back(mFileStrips[i][j]); 
    484395                } 
    485396                 
    486                 //Poner a 0 los flags de modificados. 
     397                //      Reset flags of strips changed. 
    487398                mStripsChanges[i]       =       0; 
    488399        } 
     
    495406        mCurrentData    =       data_array; 
    496407 
    497         //Meter los vertices en mVertex  
     408        //      Fill up mVertex. 
    498409        for(i = 0; i < mFileVertices.size(); i++) 
    499410        { 
     
    513424        std::vector                     <unsigned int>          p_changes; 
    514425        int                                                                                                                             value; 
    515         int                                                                                                                             v               =       0; 
    516         int                                                                                                                             t               =       -1; 
    517         int                                                                                                                             s               =       0; 
    518         int                                                                                                                             sig     =       0; 
    519         int                                                                                                                             c               =       -1; 
     426        int                                                                                                                             v                       =       0; 
     427        int                                                                                                                             t                       =       -1; 
     428        int                                                                                                                             s                       =       0; 
     429        int                                                                                                                             next    =       0; 
     430        int                                                                                                                             c                       =       -1; 
    520431        char                                                                                                                    buff[80]; 
    521432        Index                                                                                                                   *index; 
     
    583494                mTotalChanges   =       0; 
    584495                 
    585  
    586496                while (!feof (fp)) 
    587497                { 
     
    590500                        if (*buff == 'v') 
    591501                        { 
    592                                 //VERTICES 
    593502                                sscanf (buff+2,"%d",&value); 
    594503                                 
     
    600509                                if (*buff == 'c') 
    601510                                { 
    602                                         // c indica que empieza un nuevo cambio 
    603511                                        c++; 
    604512                                } 
     
    628536                                sscanf (buff+2,"%u",&value); 
    629537                                p_changes.push_back(value); 
    630                         }//Fin ElseIf 
    631  
    632                 } // End WhileEOF 
     538                        } 
     539                } 
    633540                 
    634541                fclose(fp); 
     
    639546                mMinLod                                                                         =       mLods; 
    640547 
    641                 //// CHAPUZA PROVISIONAL: EL ULTIMO ELEMENTO SE REPITE 2 VECES V.v 
    642548                mPChanges                       =       new SmallInt[mLods]; 
    643549                 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp

    r1009 r1014  
    6868 
    6969//--------------------------------------------------------------------------- 
     70//      Constructor. 
    7071//--------------------------------------------------------------------------- 
    7172GeometryBasedSimplifier::GeometryBasedSimplifier(       const Mesh      *m, 
     
    7677 
    7778//--------------------------------------------------------------------------- 
     79//      Destroyer. 
    7880//--------------------------------------------------------------------------- 
    7981GeometryBasedSimplifier::~GeometryBasedSimplifier() 
     
    126128                                                                                                                                                                                                                :MeshSimplifier(m,upb) 
    127129{ 
    128         //char s[MAX_CHAR]; 
    129  
    130130        //      Set progress update function 
    131131        VMI::mUPB       =       upb; 
     
    162162        VMI::mesh = initMeshStructure(mGeoMesh); 
    163163         
    164         //VMI::printMesh(mesh); 
    165         //getchar(); 
    166  
    167         // Get a filename without extension 
    168         //strncpy(VMI::filename, argv[argc - 1], strlen(argv[argc - 1]) - 4); 
    169  
    170         //glutInit(&argc, argv); 
    171164        // RGB and Alpha. 
    172165        glutInitDisplayMode(GLUT_DEPTH | GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA);  
     
    174167        glutInitWindowPosition(100, 100); 
    175168 
    176         //#ifdef KL // Kullback-Leibler 
    177         //    sprintf(s, "VKL - [%s]", argv[argc-1]);  
    178         //#endif 
    179         //#ifdef MI // Mutual Information 
    180         //    sprintf(s, "VMI - [%s]", argv[argc-1]);  
    181         //#endif 
    182         //#ifdef HE // Hellinger 
    183         //    sprintf(s, "VHE - [%s]", argv[argc-1]);  
    184         //#endif 
    185         //#ifdef CS // Chi-Square 
    186         //    sprintf(s, "VCS - [%s]", argv[argc-1]);  
    187         //#endif 
    188  
    189         VMI::vmiWin     =       glutCreateWindow("VMI"/*s*/); 
     169        VMI::vmiWin     =       glutCreateWindow("VMI"); 
    190170 
    191171        glewInit(); 
     
    213193                } 
    214194        } 
    215         else  
    216         { 
    217                 // Loads a cameras file 
    218                 //sprintf(s,"%s.cam", VMI::filename); 
    219  
    220                 //VMI::cameras = VMI::loadCameras(VMI::radius, s, &VMI::numCameras); 
    221                 //getchar(); 
    222         } 
    223195 
    224196        VMI::histogram  =       VMI::initHistogram(     VMI::mesh->currentNumTriangles, 
     
    247219void ViewPointDrivenSimplifier::Simplify(Real percent) 
    248220{ 
    249         // TODO: parametros libreria globales 
    250  
    251  
    252221        VMI::numDemandedTriangles = (int)(VMI::mesh->numTriangles * percent); 
    253222 
     
    440409                        for (j = 0; j < 3; j++) 
    441410                        { 
    442                                 // Adding triangle index adjacent to 3 vertices 
     411                                // Adding triangle index adjacent to 3 vertices. 
    443412                                v1 = vmi_mesh->triangles[index].indices[j]; 
    444413 
    445                                 // Reallocate memory for the new adjacent triangle 
     414                                // Reallocate memory for the new adjacent triangle. 
    446415                                vmi_mesh->vertices[v1].triangles = (GLuint *)realloc(vmi_mesh->vertices[v1].triangles, (vmi_mesh->vertices[v1].numTriangles + 1) * sizeof(GLuint)); 
    447416                                VMI::addItem((int *)vmi_mesh->vertices[v1].triangles, (int *)&vmi_mesh->vertices[v1].numTriangles, index); 
     
    453422        } 
    454423         
    455         //printf("\n"); 
    456424        printf("Ok\n"); 
    457425 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimplifier.cpp

    r1007 r1014  
    141141        long int triangleID=0; 
    142142 
    143         countv += vertex_count = (int)mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount;    
     143        countv += vertex_count = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount;         
    144144        Vertex  = new float[2*countv][3]; 
    145145                 
    146         int update_each = (int)(mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount / 5); 
     146        int update_each = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount/5; 
    147147         
    148148        for (unsigned int j=0; j<mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount; j++) 
     
    174174        pos=0; 
    175175 
    176         update_each = (int)(mesh->mSubMesh[meshLeaves].mIndexCount / 5); 
     176        update_each = mesh->mSubMesh[meshLeaves].mIndexCount / 5; 
    177177         
    178178        // Each leaf is composed of 6 vertices 
  • GTP/trunk/Lib/Geom/shared/GeoTool/GeoTool.vcproj

    r998 r1014  
    8282                        <Tool 
    8383                                Name="VCCLCompilerTool" 
    84                                 Optimization="0" 
    85                                 AdditionalIncludeDirectories=".\include;..\include;..\..\..\..\..\..\NonGTP\FLTK\include;..\..\..\..\..\..\NonGTP\glut;..\GTGeometry\include;..\GTGeometry\src\libs\vmi\include" 
     84                                Optimization="2" 
     85                                AdditionalIncludeDirectories=".\include;..\include;..\..\..\..\..\..\NonGTP\FLTK\include;..\..\..\..\..\..\NonGTP\glut;..\GTGeometry\include;..\GTGeometry\src\libs\vmi\include;..\..\..\..\..\..\nongtp\Devil\include" 
    8686                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WIN32_LEAN_AND_MEAN;VC_EXTRA_LEAN;WIN32_EXTRA_LEAN" 
    8787                                RuntimeLibrary="4" 
     88                                BufferSecurityCheck="FALSE" 
    8889                                UsePrecompiledHeader="0" 
    8990                                WarningLevel="0" 
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp

    r1007 r1014  
    12311231                { 
    12321232                        //      Build the LOD file. 
    1233                         case    LODTREES_AUTO:                   
     1233                        case    LODTREES_AUTO: 
    12341234 
    12351235                                //      Open file chooser dialog. 
    12361236                                file_name       =       fltk::file_chooser("Build LOD","*",""); 
     1237                                 
    12371238                                if (!file_name) 
     1239                                { 
    12381240                                        break; 
     1241                                } 
    12391242 
    12401243                                std::cout << "Creando secuencia de simplificacion de hojas..."; 
     1244                                 
    12411245                                createLeavesSequence(file_name+std::string(".leafseq")); 
     1246                                 
    12421247                                std::cout << "OK!" << std::endl; 
    12431248 
     
    12591264                                                                        delete auxTreeSimpSequence;*/ 
    12601265 
    1261  
    12621266                        case    LODSTRIPS_AUTO: 
    12631267 
    1264                                 // Builder                                       
     1268                                //      Builder 
    12651269                                if (!file_name) 
     1270                                { 
    12661271                                        file_name       =       fltk::file_chooser("Build LOD","*",""); 
     1272                                } 
     1273                                 
    12671274                                //      If a file was selected. 
    12681275                                if (file_name) 
     
    12811288 
    12821289                                        //      Loads a simplification sequence file. 
    1283                                         oMeshSimpSequence->Load(Serializer("SimplifSequence.txt",Serializer::READ)); 
     1290                                        oMeshSimpSequence->Load(Serializer(     "SimplifSequence.txt", 
     1291                                                                                                                                                                                        Serializer::READ)); 
    12841292 
    12851293                                        //      If the simplification sequence and the mesh exist. 
     
    12911299                                                                progress_function); 
    12921300 
    1293                                                 oSerializer     =       new Serializer(strcat(file_name,".lod"),Serializer::Mode::WRITE); 
     1301                                                oSerializer     =       new Serializer( strcat(file_name,".lod"), 
     1302                                                                                                                                                                        Serializer::Mode::WRITE); 
    12941303 
    12951304                                                oLodStrip->Save(*oSerializer); 
     
    13141323                                                mesh_saver      =       new     GeoMeshSaver(); 
    13151324                                                file_name[strlen(file_name) - 4]        =       '\0'; 
    1316                                                 mesh_saver->save(mGeoMesh, strcat(file_name,".mesh")); 
     1325                                                 
     1326                                                mesh_saver->save(       mGeoMesh, 
     1327                                                                                                                        strcat(file_name,".mesh")); 
     1328                                                 
    13171329                                                delete  mesh_saver; 
    1318  
    13191330                                        } 
    13201331                                        else 
     
    13621373} 
    13631374 
    1364  
    13651375//--------------------------------------------------------------------------- 
    13661376//      Lod Slider Callback for the foliage 
     
    13841394} 
    13851395 
    1386  
    1387  
    13881396//--------------------------------------------------------------------------- 
    13891397//      Mesh Info Callback 
     
    14021410 
    14031411//--------------------------------------------------------------------------- 
    1404 //      Logo Callback 
     1412//      Logo Callback. 
    14051413//--------------------------------------------------------------------------- 
    14061414inline void GeoMeshViewUI::cb_mLogo_i(fltk::InvisibleBox*, void*) 
     
    14281436 
    14291437//--------------------------------------------------------------------------- 
    1430 //      Show the stripify panel 
     1438//      Show the stripify panel. 
    14311439//--------------------------------------------------------------------------- 
    14321440void    GeoMeshViewUI::showStripify() 
     
    14511459 
    14521460//--------------------------------------------------------------------------- 
    1453 //      Hide the stripify panel 
     1461//      Hide the stripify panel. 
    14541462//--------------------------------------------------------------------------- 
    14551463void    GeoMeshViewUI::hideStripify() 
     
    14741482 
    14751483//--------------------------------------------------------------------------- 
    1476 //      Show the Simplify Edge Collapse panel 
     1484//      Show the Simplify Edge Collapse panel. 
    14771485//--------------------------------------------------------------------------- 
    14781486void    GeoMeshViewUI::showEdgeCollapse() 
     
    15621570 
    15631571//--------------------------------------------------------------------------- 
    1564 //      Show the Simlify Leaves Collapse 
     1572//      Show the Simlify Leaves Collapse. 
    15651573//--------------------------------------------------------------------------- 
    15661574void    GeoMeshViewUI::showLeavesCollapse() 
     
    16061614 
    16071615//--------------------------------------------------------------------------- 
    1608 //      Hide the Simplify Leaves Collapse 
     1616//      Hide the Simplify Leaves Collapse. 
    16091617//--------------------------------------------------------------------------- 
    16101618void    GeoMeshViewUI::hideLeavesCollapse() 
     
    16471655 
    16481656//--------------------------------------------------------------------------- 
    1649 //      Show the LodStrips Panel 
     1657//      Show the LodStrips Panel. 
    16501658//--------------------------------------------------------------------------- 
    16511659void    GeoMeshViewUI::showOpenMeshSimplification() 
     
    16651673 
    16661674//--------------------------------------------------------------------------- 
    1667 //      Hide the LodStrips Panel 
     1675//      Hide the LodStrips Panel. 
    16681676//--------------------------------------------------------------------------- 
    16691677void    GeoMeshViewUI::hideOpenMeshSimplification() 
     
    16831691 
    16841692//--------------------------------------------------------------------------- 
    1685 //      Shows the auto generate LodStrips panel 
     1693//      Shows the auto generate LodStrips panel. 
    16861694//--------------------------------------------------------------------------- 
    16871695void    GeoMeshViewUI::showAutoGenerateLodStrips() 
     
    16961704        //mBuildBar->activate(); 
    16971705} 
    1698 //--------------------------------------------------------------------------- 
    1699 //      Shows the auto generate LodStrips panel 
     1706 
     1707//--------------------------------------------------------------------------- 
     1708//      Shows the auto generate LodStrips panel. 
    17001709//--------------------------------------------------------------------------- 
    17011710void    GeoMeshViewUI::showAutoGenerateLodTrees() 
     
    17121721 
    17131722//--------------------------------------------------------------------------- 
    1714 //      Show the LodStrips visulization panel 
     1723//      Show the LodStrips visulization panel. 
    17151724//--------------------------------------------------------------------------- 
    17161725void    GeoMeshViewUI::showLodStripSlider() 
     
    17211730 
    17221731//--------------------------------------------------------------------------- 
    1723 //      Hide the LodStrips visualization panel 
     1732//      Hide the LodStrips visualization panel. 
    17241733//--------------------------------------------------------------------------- 
    17251734void    GeoMeshViewUI::hideLodStripSlider() 
     
    17301739 
    17311740//--------------------------------------------------------------------------- 
    1732 //      Show the LodTree visulization panel 
     1741//      Show the LodTree visulization panel. 
    17331742//--------------------------------------------------------------------------- 
    17341743void    GeoMeshViewUI::showLodTreeSlider() 
     
    17391748 
    17401749//--------------------------------------------------------------------------- 
    1741 //      Hide the LodTree visualization panel 
     1750//      Hide the LodTree visualization panel. 
    17421751//--------------------------------------------------------------------------- 
    17431752void    GeoMeshViewUI::hideLodTreeSlider() 
     
    17471756} 
    17481757 
    1749  
    1750 //--------------------------------------------------------------------------- 
    1751 //      Show the LodTrees Panel 
     1758//--------------------------------------------------------------------------- 
     1759//      Show the LodTrees Panel. 
    17521760//--------------------------------------------------------------------------- 
    17531761void    GeoMeshViewUI::showOpenLeavesSimplification() 
     
    17611769 
    17621770//--------------------------------------------------------------------------- 
    1763 //      Hide the LodTrees Panel 
     1771//      Hide the LodTrees Panel. 
    17641772//--------------------------------------------------------------------------- 
    17651773void    GeoMeshViewUI::hideOpenLeavesSimplification() 
     
    17731781 
    17741782//--------------------------------------------------------------------------- 
    1775 //      Show the mesh info browser 
     1783//      Show the mesh info browser. 
    17761784//--------------------------------------------------------------------------- 
    17771785void    GeoMeshViewUI::showMeshInfo() 
     
    18791887 
    18801888//--------------------------------------------------------------------------- 
    1881 //      Hide the mesh info browser 
     1889//      Hide the mesh info browser. 
    18821890//--------------------------------------------------------------------------- 
    18831891void    GeoMeshViewUI::hideMeshInfo() 
     
    18881896 
    18891897//--------------------------------------------------------------------------- 
    1890 //      Hide the right panel 
     1898//      Hide the right panel. 
    18911899//--------------------------------------------------------------------------- 
    18921900void    GeoMeshViewUI::hideRightPanel() 
     
    19031911 
    19041912//--------------------------------------------------------------------------- 
    1905 //      Get the number of vertices 
     1913//      Get the number of vertices. 
    19061914//--------------------------------------------------------------------------- 
    19071915size_t  GeoMeshViewUI::getVertexCount(Mesh      *geoMesh) 
     
    19301938 
    19311939//--------------------------------------------------------------------------- 
    1932 //      Get the number of triangles 
     1940//      Get the number of triangles. 
    19331941//--------------------------------------------------------------------------- 
    19341942size_t  GeoMeshViewUI::getTriangleCount(Geometry::Mesh  *geoMesh) 
     
    19691977 
    19701978//--------------------------------------------------------------------------- 
    1971 //      Get the number of strips 
     1979//      Get the number of strips. 
    19721980//--------------------------------------------------------------------------- 
    19731981size_t  GeoMeshViewUI::getStripCount(Geometry::Mesh     *geoMesh) 
     
    19952003 
    19962004//--------------------------------------------------------------------------- 
    1997 //      It paints the submesh selected by the mMeshInfo tree 
    1998 //      Trate the mMeshInfo event        
     2005//      It paints the submesh selected by the mMeshInfo tree. 
     2006//      Trate the mMeshInfo event. 
    19992007//--------------------------------------------------------------------------- 
    20002008int GeoMeshViewUI::paintMesh(void) 
     
    20082016        meshNumber      =       -1; 
    20092017 
    2010         // Shows the selected object label 
     2018        // Shows the selected object label. 
    20112019        strcpy(selectedTag,mMeshInfo->goto_focus()->label()); 
    20122020         
    20132021        p=strstr(selectedTag,"SubMesh "); 
    20142022 
    2015         // If the item begins with string "SubMesh" 
     2023        // If the item begins with string "SubMesh". 
    20162024        if (p!=NULL) 
    20172025        { 
     
    20322040bool GeoMeshViewUI::simplifyEdgeCollapse() 
    20332041{ 
    2034     Real    percent; 
    2035  
    2036     //    If input field empty. 
    2037     if (mMeshReduction->fvalue() <= 0.0) 
    2038     { 
    2039         return false; 
    2040     } 
    2041  
    2042     geoMeshView->saveContext(); 
    2043  
    2044     //    Debug. 
    2045     cout    <<    "Mesh Reduction: " 
    2046                 <<    mMeshReduction->fvalue() 
    2047                 <<    endl; 
    2048      
    2049     //    Gets simplify option. 
    2050     if (mGeometryBased->value()) 
    2051     { 
    2052         simplificationState    =    MESHSIMP; 
    2053         mMeshSimplifier         = new GeometryBasedSimplifier(mGeoMesh, 
    2054                                                                         
    2055                                      progress_function); 
    2056     } 
    2057     else 
    2058     { 
    2059         simplificationState    =    VIEWPOINTDRIVEN; 
    2060         mMeshSimplifier         = new ViewPointDrivenSimplifier(mGeoMesh, 
    2061                                                                         
    2062                                          progress_function); 
    2063     } 
    2064  
    2065     mMeshSimplifier->setMeshLeaves(idMeshLeaves); 
    2066  
    2067     if (mPercent->value()) 
    2068     { 
    2069         // Simplificación por porcentaje 
    2070         if (mMeshReduction->fvalue() <= 100.0 &&  
    2071 mMeshReduction->fvalue() > 0.0) 
    2072         { 
    2073             percent    = mMeshReduction->fvalue(); 
    2074             percent    =    percent    / 100.0; 
    2075  
    2076             // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 
    2077             mMeshSimplifier->Simplify(percent); 
    2078  
    2079             //    Deletes the previous mesh. 
    2080             delete mUndoMesh; 
    2081  
    2082             mUndoMesh    =    new Mesh(); 
    2083  
    2084             //    Sets the undo mesh. 
    2085             *mUndoMesh    =    *mGeoMesh; 
    2086  
    2087             delete    mGeoMesh; 
    2088  
    2089             mGeoMesh    =    mMeshSimplifier->GetMesh(); 
    2090  
    2091             //    Visualize mesh. 
    2092             geoMeshView->setMesh(mGeoMesh); 
    2093  
    2094         } 
    2095         else 
    2096         { 
    2097             fltk::alert("Wrong value for simplification.\n" 
    2098                     "Valid values [0..100]"); 
    2099              
    2100             return    false; 
    2101         } 
    2102     } 
    2103     else 
    2104     { 
    2105         //      Simplificar hasta un número de vértices. 
    2106         uint32 v    =    (uint32)mMeshReduction->fvalue(); 
    2107  
    2108         //      Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 
    2109         mMeshSimplifier->Simplify(v); 
    2110  
    2111         //      Deletes the previous mesh. 
    2112         delete mUndoMesh; 
    2113  
    2114         mUndoMesh    =    new Mesh(); 
    2115  
    2116         //      Sets the undo mesh. 
    2117         *mUndoMesh    =    *mGeoMesh; 
    2118  
    2119         delete    mGeoMesh; 
    2120  
    2121         mGeoMesh    =    mMeshSimplifier->GetMesh(); 
    2122  
    2123         //      Visualize the mesh. 
    2124         geoMeshView->setMesh(mGeoMesh); 
    2125     } 
    2126  
    2127     return    true; 
     2042        Real    percent; 
     2043 
     2044        //    If input field empty. 
     2045        if (mMeshReduction->fvalue() <= 0.0) 
     2046        { 
     2047                return false; 
     2048        } 
     2049 
     2050        geoMeshView->saveContext(); 
     2051 
     2052        //    Debug. 
     2053        cout    <<    "Mesh Reduction: " 
     2054                <<    mMeshReduction->fvalue() 
     2055                <<    endl; 
     2056 
     2057        //    Gets simplify option. 
     2058        if (mGeometryBased->value()) 
     2059        { 
     2060                simplificationState     =       MESHSIMP; 
     2061                mMeshSimplifier                 =       new GeometryBasedSimplifier(mGeoMesh, 
     2062                                                                                                                                                                                                                        progress_function); 
     2063        } 
     2064        else 
     2065        { 
     2066                simplificationState     =       VIEWPOINTDRIVEN; 
     2067                mMeshSimplifier                 =       new ViewPointDrivenSimplifier(mGeoMesh, 
     2068                                                                                                                                                                                                                                progress_function); 
     2069        } 
     2070 
     2071        mMeshSimplifier->setMeshLeaves(idMeshLeaves); 
     2072 
     2073        if (mPercent->value()) 
     2074        { 
     2075                // Simplificación por porcentaje 
     2076                if (mMeshReduction->fvalue() <= 100.0 &&  
     2077                                mMeshReduction->fvalue() > 0.0) 
     2078                { 
     2079                        percent =       mMeshReduction->fvalue(); 
     2080                        percent =       percent / 100.0; 
     2081 
     2082                        //      Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 
     2083                        mMeshSimplifier->Simplify(percent); 
     2084 
     2085                        //      Deletes the previous mesh. 
     2086                        delete mUndoMesh; 
     2087 
     2088                        mUndoMesh       =       new Mesh(); 
     2089 
     2090                        //      Sets the undo mesh. 
     2091                        *mUndoMesh      =       *mGeoMesh; 
     2092 
     2093                        delete    mGeoMesh; 
     2094 
     2095                        mGeoMesh        =       mMeshSimplifier->GetMesh(); 
     2096 
     2097                        //      Visualize mesh. 
     2098                        geoMeshView->setMesh(mGeoMesh); 
     2099                } 
     2100                else 
     2101                { 
     2102                        fltk::alert("Wrong value for simplification.\n" 
     2103                                                                        "Valid values [0..100]"); 
     2104 
     2105                        return  false; 
     2106                } 
     2107        } 
     2108        else 
     2109        { 
     2110                //      Simplificar hasta un número de vértices. 
     2111                uint32 v        =       (uint32)mMeshReduction->fvalue(); 
     2112 
     2113                //      Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 
     2114                mMeshSimplifier->Simplify(v); 
     2115 
     2116                //      Deletes the previous mesh. 
     2117                delete mUndoMesh; 
     2118 
     2119                mUndoMesh       =       new Mesh(); 
     2120 
     2121                //      Sets the undo mesh. 
     2122                *mUndoMesh      =       *mGeoMesh; 
     2123 
     2124                delete  mGeoMesh; 
     2125 
     2126                mGeoMesh        =       mMeshSimplifier->GetMesh(); 
     2127 
     2128                //      Visualize the mesh. 
     2129                geoMeshView->setMesh(mGeoMesh); 
     2130        } 
     2131 
     2132        return  true; 
    21282133} 
    21292134 
Note: See TracChangeset for help on using the changeset viewer.