Changeset 841


Ignore:
Timestamp:
04/27/06 12:01:26 (18 years ago)
Author:
gumbau
Message:
 
Location:
GTP/trunk/Lib/Geom/shared
Files:
6 edited

Legend:

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

    r774 r841  
    7676                        uint32 TOTALINDICES; 
    7777 
     78                        //      Index of the submesh leaves. 
     79                        size_t  mSubMeshLeaves; 
     80 
    7881                        Mesh    *geoMesh; 
    7982                        const   Geometry::Mesh *meshoriginal; 
     
    121124                        LodStripsConstructor(   const Mesh                      *, 
    122125                                        const MeshSimplificationSequence        *, 
    123                                         Geometry::TIPOFUNC                                                              upb); 
     126                                        size_t                                                                                                          submesh=-1, 
     127                                        Geometry::TIPOFUNC                                                              upb=NULL); 
    124128 
    125129                        // Destructor 
     
    141145                        ///     GetMesh: Return de current Mesh. 
    142146                        Mesh    *       GetMesh(); 
     147 
     148                        // Sets what is the submesh that stores the leaves 
     149                        void SetSubMeshLeaves(size_t    submesh); 
     150 
    143151        }; 
    144152 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMeshStripifier.h

    r826 r841  
    5454 
    5555                        // Sets what is the mesh that stores the leaves 
    56                         void setSubMeshLeaves(Geometry::Index); 
     56                        void setSubMeshLeaves(size_t); 
    5757 
    5858                protected: 
     
    6565 
    6666                        //      Index of the submesh leaves. 
    67                         Geometry::Index mSubMeshLeaves; 
     67                        size_t  mSubMeshLeaves; 
    6868 
    6969        }; 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp

    r774 r841  
    484484LodStripsConstructor::LodStripsConstructor(const Mesh                                           *m, 
    485485                                                                                                                const MeshSimplificationSequence        *ms, 
     486                                                                                                                        size_t                                                                                                          submesh, 
    486487                                                                                                                        TIPOFUNC                                                                                                        upb) 
    487488{ 
     
    493494        this->geoMeshSQ = ms; 
    494495 
     496        //      Set the leaves submesh. 
     497        mSubMeshLeaves  =       submesh; 
     498 
     499         
    495500        this->GenerarModeloCompleto(upb); 
    496501} 
     
    784789                        } 
    785790                } 
    786  
    787791        } 
    788792 
     
    10121016                        { 
    10131017                                for     (       j = 0; 
    1014                                                         j < this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; 
    1015                                                         j++) 
     1018                                                j < this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; 
     1019                                                j++) 
    10161020                                { 
    10171021                                        //      Si hay mas de un submesh ListaIndices  
    10181022                                        //      no se rellena correctamente. 
    10191023                                        vAux.Vertex[0] = this->geoMesh->mSubMesh[i]. 
    1020                                                                                                                                                                         mVertexBuffer->mPosition[j].x; 
     1024                                                mVertexBuffer->mPosition[j].x; 
    10211025                                        vAux.Vertex[1] = this->geoMesh->mSubMesh[i]. 
    1022                                                                                                                                                                         mVertexBuffer->mPosition[j].y; 
     1026                                                mVertexBuffer->mPosition[j].y; 
    10231027                                        vAux.Vertex[2] = this->geoMesh->mSubMesh[i]. 
    1024                                                                                                                                                                         mVertexBuffer->mPosition[j].z; 
     1028                                                mVertexBuffer->mPosition[j].z; 
    10251029                                        //      Añadimos las normales en cVerts. 
    10261030                                        vAux.Normal[0] = this->geoMesh->mSubMesh[i]. 
    1027                                                                                                                                                                         mVertexBuffer->mNormal[j].x; 
     1031                                                mVertexBuffer->mNormal[j].x; 
    10281032                                        vAux.Normal[1] = this->geoMesh->mSubMesh[i]. 
    1029                                                                                                                                                                         mVertexBuffer->mNormal[j].y; 
     1033                                                mVertexBuffer->mNormal[j].y; 
    10301034                                        vAux.Normal[2] = this->geoMesh->mSubMesh[i]. 
    1031                                                                                                                                                                         mVertexBuffer->mNormal[j].z; 
     1035                                                mVertexBuffer->mNormal[j].z; 
    10321036 
    10331037                                        //      Añadimos las coordenadas de textura a cVerts. 
    10341038                                        vAux.TexCoords[0]       =       this->geoMesh->mSubMesh[i]. 
    1035                                                                                                                                                                                         mVertexBuffer->mTexCoords[j].x; 
     1039                                                mVertexBuffer->mTexCoords[j].x; 
    10361040                                        vAux.TexCoords[1] = this->geoMesh->mSubMesh[i]. 
    1037                                                                                                                                                                                         mVertexBuffer->mTexCoords[j].y; 
     1041                                                mVertexBuffer->mTexCoords[j].y; 
    10381042 
    10391043                                        vAux.Next                       =       -10; 
    10401044                                        vAux.numMesh    =       i; 
    1041                                          
     1045 
    10421046                                        this->cVerts.push_back(vAux); 
    10431047                                } 
     
    10521056                for     (i = 0; i < this->geoMesh->mSubMeshCount; i++) 
    10531057                { 
    1054                         indice_acum     =       0; 
    1055                          
    1056                         for     (j = 0; j < this->geoMesh->mSubMesh[i].mStripCount; j++) 
    1057                         { 
    1058                                 Index   *aux    =       this->geoMesh->mSubMesh[i].mStrip[j]; 
    1059                                  
    1060                                 if (j != 0) 
    1061                                 { 
    1062                                         // La primera tira no empieza por índices repetidos. 
    1063                                         aux     =       aux+1; 
    1064                                          
    1065                                         indice_acum++; 
    1066                                 } 
    1067                                  
    1068                                 if (j+1 < this->geoMesh->mSubMesh[i].mStripCount) 
    1069                                 { 
    1070                                         Index   *siguiente      =       this->geoMesh->mSubMesh[i].mStrip[j+1]; 
    1071                                          
    1072                                         tira.clear(); 
    1073                                          
    1074                                         while (aux != siguiente) 
    1075                                         { 
    1076                                                 tira.push_back(*aux); 
     1058                        //      If is not the leaves submesh. 
     1059                        if (mSubMeshLeaves != i) 
     1060                        { 
     1061                                indice_acum     =       0; 
     1062 
     1063                                for     (j = 0; j < this->geoMesh->mSubMesh[i].mStripCount; j++) 
     1064                                { 
     1065                                        Index   *aux    =       this->geoMesh->mSubMesh[i].mStrip[j]; 
     1066 
     1067                                        if (j != 0) 
     1068                                        { 
     1069                                                // La primera tira no empieza por índices repetidos. 
     1070                                                aux     =       aux+1; 
     1071 
    10771072                                                indice_acum++; 
    1078                                                  
    1079                                                 aux     =       aux + 1; 
    1080                                         } 
    1081                                          
    1082                                         tira.pop_back(); 
    1083                                         this->cStrips.push_back(tira); 
    1084                                 } 
    1085                                 else 
    1086                                 { 
    1087                                         // Insertar los indices de la última tira en el cStrips 
    1088                                         tira.clear(); 
    1089                                          
    1090                                         for     (       unsigned int k = indice_acum; 
     1073                                        } 
     1074 
     1075                                        if (j+1 < this->geoMesh->mSubMesh[i].mStripCount) 
     1076                                        { 
     1077                                                Index   *siguiente      =       this->geoMesh->mSubMesh[i].mStrip[j+1]; 
     1078 
     1079                                                tira.clear(); 
     1080 
     1081                                                while (aux != siguiente) 
     1082                                                { 
     1083                                                        tira.push_back(*aux); 
     1084                                                        indice_acum++; 
     1085 
     1086                                                        aux     =       aux + 1; 
     1087                                                } 
     1088 
     1089                                                tira.pop_back(); 
     1090                                                this->cStrips.push_back(tira); 
     1091                                        } 
     1092                                        else 
     1093                                        { 
     1094                                                // Insertar los indices de la última tira en el cStrips 
     1095                                                tira.clear(); 
     1096 
     1097                                                for     (       unsigned int k = indice_acum; 
    10911098                                                                k < this->geoMesh->mSubMesh[i].mIndexCount; 
    10921099                                                                k++) 
    1093                                         { 
    1094                                                 tira.push_back(this->geoMesh->mSubMesh[i].mIndex[k]); 
    1095                                         } 
    1096                                          
    1097                                         this->cStrips.push_back(tira); 
    1098                                 } 
    1099                         } 
    1100                          
    1101                         num_vert        +=      this->geoMesh->mSubMesh[i]. 
    1102                                                                                                                                                 mVertexBuffer->mVertexCount; 
     1100                                                { 
     1101                                                        tira.push_back(this->geoMesh->mSubMesh[i].mIndex[k]); 
     1102                                                } 
     1103 
     1104                                                this->cStrips.push_back(tira); 
     1105                                        } 
     1106                                } 
     1107 
     1108                                num_vert        +=      this->geoMesh->mSubMesh[i]. 
     1109                                        mVertexBuffer->mVertexCount; 
     1110                        } 
    11031111                } 
    11041112 
     
    11231131} 
    11241132 
     1133// Sets what is the submesh that stores the leaves. 
     1134void LodStripsConstructor::SetSubMeshLeaves(size_t      submesh) 
     1135{ 
     1136        mSubMeshLeaves  =       submesh; 
     1137} 
     1138 
  • GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h

    r829 r841  
    104104        GeometryBounds                  mMeshBounds; 
    105105 
    106         MeshSimplifier                  *ms; 
    107         TreeSimplifier                  *mts; 
     106        MeshSimplifier                  *mMeshSimplifier; 
     107        TreeSimplifier                  *mTreeSimplifier; 
    108108        char                                                            *nombremesh; 
    109109        SimplificationType      simplificacionState; 
     
    246246        void    createQslimSequence(); 
    247247 
     248        //      Create a siplification sequence of the leaves. 
     249        void    createLeavesSequence(); 
     250 
    248251        //      Stripify the mesh object. 
    249252        void    stripify(); 
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp

    r829 r841  
    586586                        drawLodStrip(); 
    587587                } 
    588                 else if (mLodTree) 
    589                 { 
    590                         drawLodTree(); 
    591                 } 
     588                //else if (mLodTree) 
     589                //{ 
     590                //      drawLodTree(); 
     591                //} 
    592592                else 
    593593                { 
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp

    r834 r841  
    881881                                else 
    882882                                { 
    883  
    884883                                        //      Simplify the mesh object. 
    885884                                        simplifyEdgeCollapse(); 
     
    893892                                simplifyLeavesCollapse(); 
    894893 
     894                                //      Create the leaves simplification sequence. 
     895                                createLeavesSequence(); 
     896                                 
    895897                                break; 
    896898 
     
    905907                                else 
    906908                                { 
    907  
    908909                                        //      Transform NoSV Mesh to a SV Mesh. 
    909910                                        mesh_aux        =       mGeoMesh->toSharedVertex(); 
     
    992993 
    993994                                // Builder 
    994  
    995995                                //      Open file chooser dialog. 
    996996                                file_name       =       fltk::file_chooser(     "Build LOD", 
     
    10221022                                                oLodStrip               =       new LodStripsConstructor(       mGeoMesh, 
    10231023                                                                oMeshSimpSequence, 
     1024                                                                idMeshLeaves, 
    10241025                                                                progress_function); 
    10251026 
     
    10271028                                                                Serializer::Mode::WRITE); 
    10281029 
    1029                                                 oLodStrip->LodStripsConstructor::Save(*oSerializer); 
     1030                                                oLodStrip->Save(*oSerializer); 
    10301031 
    10311032                                                //      Close file. 
     
    16951696        simplificacionState     =       QSLIM; 
    16961697 
    1697         ms = new ImageBasedSimplifier(mGeoMesh, progress_function); 
    1698  
    1699         ms->setMeshLeaves(idMeshLeaves); 
     1698        mMeshSimplifier = new ImageBasedSimplifier(mGeoMesh,    progress_function); 
     1699 
     1700        mMeshSimplifier->setMeshLeaves(idMeshLeaves); 
    17001701 
    17011702        if (mPercent->value() == true) 
     
    17081709 
    17091710                        // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 
    1710                         ms->Simplify(percent); 
     1711                        mMeshSimplifier->Simplify(percent); 
    17111712 
    17121713                        //      Deletes the previous mesh. 
     
    17201721                        delete  mGeoMesh; 
    17211722 
    1722                         mGeoMesh        =       ms->GetMesh(); 
     1723                        mGeoMesh        =       mMeshSimplifier->GetMesh(); 
    17231724 
    17241725                        //      Visualize mesh. 
     
    17371738 
    17381739                // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 
    1739                 ms->Simplify(v); 
     1740                mMeshSimplifier->Simplify(v); 
    17401741 
    17411742                //      Deletes the previous mesh. 
     
    17491750                delete  mGeoMesh; 
    17501751 
    1751                 mGeoMesh        =       ms->GetMesh(); 
     1752                mGeoMesh        =       mMeshSimplifier->GetMesh(); 
    17521753 
    17531754                //      Visualize the mesh. 
     
    17731774                simplificacionState     =       HOJAS; 
    17741775                 
    1775                 mts     =       new TreeSimplifier(mGeoMesh, progress_function); 
     1776                mTreeSimplifier =       new TreeSimplifier(mGeoMesh, progress_function); 
    17761777                vi      =       (uint32)mMeshReduction->fvalue(); 
    17771778 
     
    17801781                { 
    17811782                        // Simplify 
    1782                         mts->Simplify(vi, idMeshLeaves); 
     1783                        mTreeSimplifier->Simplify(vi, idMeshLeaves); 
    17831784 
    17841785                        //      Deletes the previous mesh. 
     
    17921793                        delete  mGeoMesh; 
    17931794 
    1794                         mGeoMesh        =       mts->GetMesh(); 
     1795                        mGeoMesh        =       mTreeSimplifier->GetMesh(); 
    17951796                         
    17961797                        geoMeshView->setMesh(mGeoMesh); 
     
    18101811        MeshSimplificationSequence      *secsimpl; 
    18111812         
    1812         secsimpl        =       ms->GetSimplificationSequence(); 
     1813        secsimpl        =       mMeshSimplifier->GetSimplificationSequence(); 
    18131814         
    18141815        secsimpl->putMeshName(nombremesh); // Nombre del mesh para guardar la secuencia de simplificación 
     
    18161817 
    18171818        delete  secsimpl; 
     1819} 
     1820 
     1821//--------------------------------------------------------------------------- 
     1822//      Create a simplification sequence of the leaves. 
     1823//--------------------------------------------------------------------------- 
     1824void    GeoMeshViewUI::createLeavesSequence() 
     1825{ 
     1826        TreeSimplificationSequence      *tree_sequencer; 
     1827         
     1828        tree_sequencer  =       mTreeSimplifier->GetSimplificationSequence(); 
     1829         
     1830        tree_sequencer->putMeshName(nombremesh);  
     1831        tree_sequencer->Save(Serializer("leavesSequence.txt",Serializer::WRITE)); 
     1832 
     1833        delete  tree_sequencer; 
    18181834} 
    18191835 
Note: See TracChangeset for help on using the changeset viewer.