Ignore:
Timestamp:
07/05/06 20:18:06 (18 years ago)
Author:
gumbau
Message:
 
Location:
GTP/trunk/Lib/Geom/shared/GeoTool/src
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp

    r1078 r1083  
    892892        current_strip = 0; 
    893893 
    894         int begin_index = 0; 
    895  
    896894        //      For each submesh. 
    897895        for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) 
     
    968966                }*/ 
    969967 
    970                 int indices_to_render = lodStripsLib->indices_x_submesh[submesh]; 
    971  
     968                int indices_to_render = lodStripsLib->GetValidIndexCount(submesh); 
     969                int offset = lodStripsLib->GetValidOffset(submesh); 
    972970 
    973971                glBegin(GL_TRIANGLE_STRIP); 
    974972                //for (int index = 0; index < lodStripsLib->dataRetrievalInterface->GetNumValidIndices(); index ++) 
    975                 for (int index = begin_index; index < indices_to_render+begin_index; index ++) 
     973                for (int index = offset; index < indices_to_render+offset; index ++) 
    976974                { 
    977975                        position = lodStripsLib->dataRetrievalInterface->GetIndex(index); 
     
    10071005                } 
    10081006                glEnd(); 
    1009                 begin_index += indices_to_render; 
    10101007 
    10111008        } 
     
    10321029 
    10331030        // DRAW THE TRUNK AS A LODSTRIP OBJECT 
    1034  
    1035         int begin_index = 0; 
    1036  
    10371031        //      For each submesh. 
    10381032        for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) 
     
    11121106                }*/ 
    11131107         
    1114                 int indices_to_render = lodTreeLib->trunk->indices_x_submesh[submesh]; 
     1108//              int indices_to_render = lodTreeLib->trunk->GetValidIndexCount(submesh); 
     1109                int indices_to_render = lodTreeLib->GetValidTrunkIndexCount(submesh); 
     1110                int begin_index = lodTreeLib->GetValidTrunkOffset(submesh); 
    11151111                         
    11161112                glBegin(GL_TRIANGLE_STRIP); 
    1117                 for (int index = begin_index; index < lodTreeLib->trunk->indices_x_submesh[submesh]; index ++) 
     1113                for (int index = begin_index; index < indices_to_render+begin_index; index ++) 
    11181114                { 
    11191115                        position = lodTreeLib->CurrentLOD_Trunk_Indices()->GetIndex(index); 
     
    11491145                } 
    11501146                glEnd(); 
    1151                 begin_index += indices_to_render; 
    1152  
    11531147        } 
    11541148 
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp

    r1078 r1083  
    795795inline void GeoMeshViewUI::cb_menuLodStripsVisualize_i(fltk::Item*, void*) 
    796796{ 
    797         fltk::FileChooser *fcho; 
    798         const   char                            *lod_file; 
    799          
    800797        //      Sets menus application state to NONE. 
    801798        mApplicationState       =       NONE; 
     
    811808        if (mGeoMesh != NULL) 
    812809        { 
    813 /*              fcho    =       new fltk::FileChooser("", 
    814                                 "*.lod", 
    815                                 fltk::FileChooser::CREATE, 
    816                                 "Open Lod file"); 
    817  
    818                 fcho->exec(); 
    819  
    820                 //      If a file was selected. 
    821                 if (fcho->value()) 
    822                 {*/ 
     810                if (geoMeshLoader->GetLodStripsData()) 
     811                { 
    823812                        //      Build lod strips library. 
    824                         setLodStripsLibrary(geoMeshLoader->lodstripsdata, mGeoMesh); 
     813                        setLodStripsLibrary(geoMeshLoader->GetLodStripsData(), mGeoMesh); 
    825814 
    826815                        //      Sets the aplication mode. 
    827816                        mApplicationState       =       VISUALIZE_LODSTRIPS; 
    828         /*      } 
    829  
    830                 //      Free memory. 
    831                 delete  fcho;*/ 
    832  
    833                 //      Hide the right panel. 
    834                 hideRightPanel(); 
    835  
    836                 //      Show title. 
    837                 mProcessTitle->label("Visualize LodStrips"); 
    838  
    839                 //      Show the Visulize LodStrips panel. 
    840                 showLodStripSlider(); 
    841  
    842                 //      Repaint the window. 
    843                 mMainWindow->redraw(); 
    844  
     817                 
     818                        //      Hide the right panel. 
     819                        hideRightPanel(); 
     820 
     821                        //      Show title. 
     822                        mProcessTitle->label("Visualize LodStrips"); 
     823 
     824                        //      Show the Visulize LodStrips panel. 
     825                        showLodStripSlider(); 
     826 
     827                        //      Repaint the window. 
     828                        mMainWindow->redraw(); 
     829                } 
     830                else 
     831                { 
     832                        fltk::alert("The loaded mesh does not contain LOD information.\nNothing will be done."); 
     833                } 
    845834        } 
    846835} 
     
    848837inline void GeoMeshViewUI::cb_menuLodTreesVisualize_i(fltk::Item*, void*) 
    849838{ 
    850         fltk::FileChooser *fcho; 
    851         const   char                            *lod_file; 
    852  
    853839        //      Sets menus application state to NONE. 
    854840        mApplicationState       =       NONE; 
     
    861847        openMeshFile(); 
    862848 
    863         /*if (geoMeshView->getLeavesSubmesh()==-1) 
    864                 { 
    865                 fltk::alert("No se ha seleccionado el submesh de hojas!"); 
    866                 return; 
    867                 }*/ 
    868  
    869849        //      If an object is loaded. 
    870850        if (mGeoMesh != NULL) 
    871851        { 
    872                 // POR AHORA SE SELECCIONA EL PRIMER SUBMESH QUE NO ES STRIPS COMO HOJAS 
    873                 int leafsSubMeshID = -1; 
    874  
    875                 for (int i=0; i<mGeoMesh->mSubMeshCount; i++) 
     852                if (geoMeshLoader->GetTreeSimpSeq() && geoMeshLoader->GetLodStripsData()) 
    876853                { 
    877                         if (mGeoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST) 
     854                        // select the first triangle-list submesh as leaves submesh 
     855                        int leafsSubMeshID = -1; 
     856 
     857                        for (int i=0; i<mGeoMesh->mSubMeshCount; i++) 
    878858                        { 
    879                                 leafsSubMeshID=i; 
    880                                 break; 
     859                                if (mGeoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST) 
     860                                { 
     861                                        leafsSubMeshID=i; 
     862                                        break; 
     863                                } 
    881864                        } 
    882                 } 
    883  
    884                 //      If an object is loaded. 
    885 /*              if (mGeoMesh != NULL) 
    886                 { 
    887                         fcho    =       new fltk::FileChooser("", 
    888                                         "*.mesh", 
    889                                         fltk::FileChooser::CREATE, 
    890                                         "Open Lod file"); 
    891  
    892                         fcho->exec(); 
    893  
    894                         //      If a file was selected. 
    895                         if (fcho->value()) 
    896                         { 
    897                                 //      Build lod strips library. 
    898  
    899                                 std::string lodstripFile(fcho->value()); 
    900                                 delete fcho; 
    901                                 fcho    =       new fltk::FileChooser("", 
    902                                                 "*.leafseq", 
    903                                                 fltk::FileChooser::CREATE, 
    904                                                 "Open LeafSeq file"); 
    905  
    906                                 fcho->exec(); 
    907  
    908                                 if (fcho->value()) 
    909                                 { 
    910                                         std::string leafseqFile(fcho->value());*/ 
    911  
    912                                         //setLodTreesLibrary(lodstripFile, leafseqFile, mGeoMesh, leafsSubMeshID); 
    913                                         setLodTreesLibrary(geoMeshLoader->lodstripsdata, geoMeshLoader->treesimpseq, mGeoMesh, leafsSubMeshID); 
    914  
    915                                         //      Sets the aplication mode. 
    916                                         mApplicationState       =       VISUALIZE_LODTREES; 
    917 /*                              } 
    918                         } 
    919  
    920                         //      Free memory. 
    921                         delete  fcho; 
    922 */ 
     865 
     866                        setLodTreesLibrary(geoMeshLoader->GetLodStripsData(), geoMeshLoader->GetTreeSimpSeq(), mGeoMesh, leafsSubMeshID); 
     867 
     868                        //      Sets the aplication mode. 
     869                        mApplicationState       =       VISUALIZE_LODTREES; 
     870 
    923871                        //      Hide the right panel. 
    924872                        hideRightPanel(); 
     
    933881                        //      Repaint the window. 
    934882                        mMainWindow->redraw(); 
    935 /*              }*/ 
     883                } 
     884                else 
     885                        fltk::alert("The loaded mesh does not contain LOD information.\nNothing will be done."); 
    936886        } 
    937887} 
     
    23672317//      Initialize the lodstripslibrary for visualization. 
    23682318//--------------------------------------------------------------------------- 
    2369 void    GeoMeshViewUI::setLodStripsLibrary(const Geometry::LodStripsLibraryData &loddata, Mesh  *geomesh) 
     2319void    GeoMeshViewUI::setLodStripsLibrary(const Geometry::LodStripsLibraryData *loddata, Mesh  *geomesh) 
    23702320{ 
    23712321        //      If there is no lod strips object. 
     
    23922342//      Initialize the lodTreelibrary for visualization. 
    23932343//--------------------------------------------------------------------------- 
    2394 void    GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData &lodstripsdata, const TreeSimplificationSequence &treesimpseq, Mesh *geomesh, uint32 ileafSubMesh) 
     2344void    GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData *lodstripsdata, const TreeSimplificationSequence *treesimpseq, Mesh *geomesh, uint32 ileafSubMesh) 
    23952345{ 
    23962346        //      If there is no lod strips object. 
    23972347        if (lodTreeLib) 
    2398         { 
    23992348                delete  lodTreeLib; 
    2400         } 
    24012349 
    24022350        //      New lod strips object. 
Note: See TracChangeset for help on using the changeset viewer.