Changeset 1083 for GTP/trunk/Lib/Geom
- Timestamp:
- 07/05/06 20:18:06 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared
- Files:
-
- 4 added
- 4 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj
r1071 r1083 130 130 </File> 131 131 <File 132 RelativePath=".\src\GeoMeshLoader.cpp"> 133 </File> 134 <File 135 RelativePath=".\src\GeoMeshSaver.cpp"> 136 </File> 137 <File 132 138 RelativePath=".\src\GeoMeshSimplifier.cpp"> 133 139 </File> … … 370 376 <File 371 377 RelativePath=".\include\GeoMesh.h"> 378 </File> 379 <File 380 RelativePath=".\include\GeoMeshLoader.h"> 381 </File> 382 <File 383 RelativePath=".\include\GeoMeshSaver.h"> 372 384 </File> 373 385 <File -
GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h
r1078 r1083 133 133 134 134 // Loads Mesh. 135 void LoadStripMesh(const LodStripsLibraryData &, Mesh *geomesh);135 void LoadStripMesh(const LodStripsLibraryData *, Mesh *geomesh); 136 136 137 137 Geometry::CREATEINDEXDATAFUNC create_index_data_func; … … 139 139 // Strips vector. 140 140 SmallIntVector *mStrips; 141 int *indices_x_submesh; 142 int *offsets_x_submesh; 141 143 142 144 void UpdateDataRetrievalInterface(void); … … 149 151 * including the multiresolution object. 150 152 */ 151 LodStripsLibrary(const LodStripsLibraryData &, Mesh *geomesh, CREATEINDEXDATAFUNC idfun=NULL);153 LodStripsLibrary(const LodStripsLibraryData *, Mesh *geomesh, CREATEINDEXDATAFUNC idfun=NULL); 152 154 153 155 /// Destructor. … … 173 175 uint32 MinVertices(); 174 176 175 int *indices_x_submesh; 177 uint32 GetValidIndexCount(int submeshid) const { return indices_x_submesh[submeshid]; } 178 uint32 GetValidOffset(int submeshid) const { return offsets_x_submesh[submeshid]; } 176 179 }; 177 180 } -
GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h
r1078 r1083 22 22 /* LodTreeLibrary( const LodTreeLibrary &); 23 23 LodTreeLibrary(LodTreeLibrary*);*/ 24 LodTreeLibrary( const LodStripsLibraryData &,25 const TreeSimplificationSequence &,24 LodTreeLibrary( const LodStripsLibraryData *, 25 const TreeSimplificationSequence *, 26 26 Geometry::Mesh *treeGeoMesh, 27 27 uint32 leafSubMeshID … … 57 57 /* const VertexData* Get_Trunk_VertexData(void) const;*/ 58 58 const IndexData* CurrentLOD_Trunk_Indices(void) const; 59 uint32 GetValidTrunkIndexCount(int isubmesh) const { return trunk->GetValidIndexCount(isubmesh); } 60 uint32 GetValidTrunkOffset(int isubmesh) const { return trunk->GetValidOffset(isubmesh); } 59 61 60 62 // uint32 Get_Foliage_VertexCount(void) const; … … 64 66 const VertexData* Get_Foliage_VertexData(void) const; 65 67 66 // Geometry::IndexData *trunk_all_indices;67 // unsigned int *indices_offsets;68 69 // const Geometry::SmallIntVector & GetStrip(uint32 istrip) const { return trunk->mStrips[istrip]; }70 Geometry::LodStripsLibrary *trunk;71 72 68 private: 73 69 Foliage *foliage; 74 70 Geometry::LodStripsLibrary *trunk; 75 71 }; 76 72 } -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
r1078 r1083 17 17 // Constructors. 18 18 //----------------------------------------------------------------------------- 19 LodStripsLibrary::LodStripsLibrary(const LodStripsLibraryData &lodstripsdata, Mesh *geomesh, CREATEINDEXDATAFUNC idfun)19 LodStripsLibrary::LodStripsLibrary(const LodStripsLibraryData *lodstripsdata, Mesh *geomesh, CREATEINDEXDATAFUNC idfun) 20 20 :create_index_data_func(idfun?idfun:DefaultIndexDataCreator) 21 21 { … … 33 33 dataRetrievalInterface=NULL; 34 34 indices_x_submesh = NULL; 35 offsets_x_submesh = NULL; 35 36 36 37 // Loads the Level Of Detail file. … … 58 59 if (indices_x_submesh) 59 60 delete[] indices_x_submesh; 61 if (offsets_x_submesh) 62 delete[] offsets_x_submesh; 60 63 } 61 64 … … 430 433 // LoadStripMesh 431 434 //----------------------------------------------------------------------------- 432 void LodStripsLibrary::LoadStripMesh(const LodStripsLibraryData &lodstripsdata, Mesh *geomesh)435 void LodStripsLibrary::LoadStripMesh(const LodStripsLibraryData *lodstripsdata, Mesh *geomesh) 433 436 { 434 437 FILE *fp; … … 451 454 // For each one of the submeshes. 452 455 indices_x_submesh = new int[geomesh->mSubMeshCount]; 456 offsets_x_submesh = new int[geomesh->mSubMeshCount]; 453 457 for (unsigned int submesh = 0; submesh < geomesh->mSubMeshCount; submesh++) 454 458 { … … 492 496 i = 0; 493 497 indices_x_submesh[submesh] = 0; 498 if (submesh==0) 499 offsets_x_submesh[submesh] = 0; 500 else 501 offsets_x_submesh[submesh] = indices_x_submesh[submesh-1]; 502 494 503 // For each index of the strip. 495 504 for (index = indexBegin; index < indexEnd; index++) … … 498 507 indices_x_submesh[submesh]++; 499 508 i++; 500 } 509 } 501 510 } 502 511 } … … 559 568 fclose(fp);*/ 560 569 561 mFileVertices = lodstripsdata .mFileVertices;562 mFileChangesLOD = lodstripsdata .mFileChangesLOD;563 mData = lodstripsdata .mData;564 p_changes = lodstripsdata .p_changes;570 mFileVertices = lodstripsdata->mFileVertices; 571 mFileChangesLOD = lodstripsdata->mFileChangesLOD; 572 mData = lodstripsdata->mData; 573 p_changes = lodstripsdata->p_changes; 565 574 566 575 … … 602 611 { 603 612 indices_x_submesh[target_submesh] = counter; 613 if (target_submesh==0) 614 offsets_x_submesh[target_submesh] = 0; 615 else 616 offsets_x_submesh[target_submesh] = indices_x_submesh[target_submesh-1] + offsets_x_submesh[target_submesh-1]; 617 604 618 counter = 0; 605 619 strip_count = 0; … … 617 631 { 618 632 indices_x_submesh[target_submesh] = counter; 633 if (target_submesh==0) 634 offsets_x_submesh[target_submesh] = 0; 635 else 636 offsets_x_submesh[target_submesh] = indices_x_submesh[target_submesh-1] + offsets_x_submesh[target_submesh-1]; 637 619 638 counter = 0; 620 639 strip_count = 0; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp
r1078 r1083 5 5 using namespace Geometry; 6 6 7 Geometry::LodTreeLibrary::LodTreeLibrary(const LodStripsLibraryData &lodstripsdata,8 const TreeSimplificationSequence &simpseq,7 Geometry::LodTreeLibrary::LodTreeLibrary(const LodStripsLibraryData *lodstripsdata, 8 const TreeSimplificationSequence *simpseq, 9 9 Geometry::Mesh *treeGeoMesh, 10 10 uint32 leafSubMeshID/* -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.cpp
r1078 r1083 10 10 // Parameters --> None 11 11 //-------------------------------------------------------------------------------------------------------------------------------- 12 Foliage::Foliage(const Geometry::SubMesh *leavesSubMesh, const Geometry::TreeSimplificationSequence &simpSeq, Geometry::CREATEVERTEXDATAFUNC vdfun, Geometry::CREATEINDEXDATAFUNC idfun):12 Foliage::Foliage(const Geometry::SubMesh *leavesSubMesh, const Geometry::TreeSimplificationSequence * simpSeq, Geometry::CREATEVERTEXDATAFUNC vdfun, Geometry::CREATEINDEXDATAFUNC idfun): 13 13 Acth(NULL), 14 14 create_vertex_data_func(vdfun==NULL?Geometry::DefaultVertexDataCreator:vdfun), … … 304 304 305 305 /// returns the number of total leafs 306 bool Foliage::ReadSimpSeq(const Geometry::TreeSimplificationSequence &simpSeq)306 bool Foliage::ReadSimpSeq(const Geometry::TreeSimplificationSequence * simpSeq) 307 307 { 308 308 int tn, tv1,tv2, e=0; 309 309 310 310 tn = leafCount; 311 for (std::vector<Geometry::TreeSimplificationSequence::Step>::const_iterator it = simpSeq .mSteps.begin(); it != simpSeq.mSteps.end(); it++)311 for (std::vector<Geometry::TreeSimplificationSequence::Step>::const_iterator it = simpSeq->mSteps.begin(); it != simpSeq->mSteps.end(); it++) 312 312 { 313 313 Leaves[tn].vertsLeaf[0] = it->mNewQuad[0]; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.h
r1078 r1083 27 27 int active_leaf_count; 28 28 29 Foliage (const Geometry::SubMesh *, const Geometry::TreeSimplificationSequence &, Geometry::CREATEVERTEXDATAFUNC vdfun=NULL, Geometry::CREATEINDEXDATAFUNC idfun=NULL);29 Foliage (const Geometry::SubMesh *, const Geometry::TreeSimplificationSequence *, Geometry::CREATEVERTEXDATAFUNC vdfun=NULL, Geometry::CREATEINDEXDATAFUNC idfun=NULL); 30 30 Foliage (const Foliage *); 31 31 virtual ~Foliage (void); // Destructor … … 57 57 void ReadLeafs(const Geometry::SubMesh *); 58 58 void ReadVertices(const Geometry::SubMesh *); 59 bool ReadSimpSeq(const Geometry::TreeSimplificationSequence &); /// returns true when successful59 bool ReadSimpSeq(const Geometry::TreeSimplificationSequence *); /// returns true when successful 60 60 void FillRoot(void); 61 61 -
GTP/trunk/Lib/Geom/shared/GeoTool/GeoTool.vcproj
r1024 r1083 141 141 </File> 142 142 <File 143 RelativePath=".\src\GeoMeshLoader.cpp">144 </File>145 <File146 RelativePath=".\src\GeoMeshSaver.cpp">147 </File>148 <File149 143 RelativePath=".\src\GeoMeshView.cpp"> 150 144 </File> … … 165 159 <File 166 160 RelativePath=".\include\GeoMaterialLoader.h"> 167 </File>168 <File169 RelativePath=".\include\GeoMeshLoader.h">170 </File>171 <File172 RelativePath=".\include\GeoMeshSaver.h">173 161 </File> 174 162 <File -
GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h
r1078 r1083 372 372 373 373 // Initialize the lodstripslibrary for visualization. 374 void setLodStripsLibrary(const Geometry::LodStripsLibraryData &, Mesh *geomesh);374 void setLodStripsLibrary(const Geometry::LodStripsLibraryData *, Mesh *geomesh); 375 375 // Initialize the lodtreelibrary for visualization. 376 void setLodTreesLibrary(const Geometry::LodStripsLibraryData &, const Geometry::TreeSimplificationSequence &, Mesh *geomesh, uint32 ileafSubMesh);376 void setLodTreesLibrary(const Geometry::LodStripsLibraryData *, const Geometry::TreeSimplificationSequence *, Mesh *geomesh, uint32 ileafSubMesh); 377 377 378 378 // Indentify the mesh of leaves. -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp
r1078 r1083 892 892 current_strip = 0; 893 893 894 int begin_index = 0;895 896 894 // For each submesh. 897 895 for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) … … 968 966 }*/ 969 967 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); 972 970 973 971 glBegin(GL_TRIANGLE_STRIP); 974 972 //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 ++) 976 974 { 977 975 position = lodStripsLib->dataRetrievalInterface->GetIndex(index); … … 1007 1005 } 1008 1006 glEnd(); 1009 begin_index += indices_to_render;1010 1007 1011 1008 } … … 1032 1029 1033 1030 // DRAW THE TRUNK AS A LODSTRIP OBJECT 1034 1035 int begin_index = 0;1036 1037 1031 // For each submesh. 1038 1032 for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) … … 1112 1106 }*/ 1113 1107 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); 1115 1111 1116 1112 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 ++) 1118 1114 { 1119 1115 position = lodTreeLib->CurrentLOD_Trunk_Indices()->GetIndex(index); … … 1149 1145 } 1150 1146 glEnd(); 1151 begin_index += indices_to_render;1152 1153 1147 } 1154 1148 -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
r1078 r1083 795 795 inline void GeoMeshViewUI::cb_menuLodStripsVisualize_i(fltk::Item*, void*) 796 796 { 797 fltk::FileChooser *fcho;798 const char *lod_file;799 800 797 // Sets menus application state to NONE. 801 798 mApplicationState = NONE; … … 811 808 if (mGeoMesh != NULL) 812 809 { 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 { 823 812 // Build lod strips library. 824 setLodStripsLibrary(geoMeshLoader-> lodstripsdata, mGeoMesh);813 setLodStripsLibrary(geoMeshLoader->GetLodStripsData(), mGeoMesh); 825 814 826 815 // Sets the aplication mode. 827 816 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 } 845 834 } 846 835 } … … 848 837 inline void GeoMeshViewUI::cb_menuLodTreesVisualize_i(fltk::Item*, void*) 849 838 { 850 fltk::FileChooser *fcho;851 const char *lod_file;852 853 839 // Sets menus application state to NONE. 854 840 mApplicationState = NONE; … … 861 847 openMeshFile(); 862 848 863 /*if (geoMeshView->getLeavesSubmesh()==-1)864 {865 fltk::alert("No se ha seleccionado el submesh de hojas!");866 return;867 }*/868 869 849 // If an object is loaded. 870 850 if (mGeoMesh != NULL) 871 851 { 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()) 876 853 { 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++) 878 858 { 879 leafsSubMeshID=i; 880 break; 859 if (mGeoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST) 860 { 861 leafsSubMeshID=i; 862 break; 863 } 881 864 } 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 923 871 // Hide the right panel. 924 872 hideRightPanel(); … … 933 881 // Repaint the window. 934 882 mMainWindow->redraw(); 935 /* }*/ 883 } 884 else 885 fltk::alert("The loaded mesh does not contain LOD information.\nNothing will be done."); 936 886 } 937 887 } … … 2367 2317 // Initialize the lodstripslibrary for visualization. 2368 2318 //--------------------------------------------------------------------------- 2369 void GeoMeshViewUI::setLodStripsLibrary(const Geometry::LodStripsLibraryData &loddata, Mesh *geomesh)2319 void GeoMeshViewUI::setLodStripsLibrary(const Geometry::LodStripsLibraryData *loddata, Mesh *geomesh) 2370 2320 { 2371 2321 // If there is no lod strips object. … … 2392 2342 // Initialize the lodTreelibrary for visualization. 2393 2343 //--------------------------------------------------------------------------- 2394 void GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData &lodstripsdata, const TreeSimplificationSequence &treesimpseq, Mesh *geomesh, uint32 ileafSubMesh)2344 void GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData *lodstripsdata, const TreeSimplificationSequence *treesimpseq, Mesh *geomesh, uint32 ileafSubMesh) 2395 2345 { 2396 2346 // If there is no lod strips object. 2397 2347 if (lodTreeLib) 2398 {2399 2348 delete lodTreeLib; 2400 }2401 2349 2402 2350 // New lod strips object.
Note: See TracChangeset
for help on using the changeset viewer.