Changeset 841 for GTP/trunk/Lib
- Timestamp:
- 04/27/06 12:01:26 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsConstructor.h
r774 r841 76 76 uint32 TOTALINDICES; 77 77 78 // Index of the submesh leaves. 79 size_t mSubMeshLeaves; 80 78 81 Mesh *geoMesh; 79 82 const Geometry::Mesh *meshoriginal; … … 121 124 LodStripsConstructor( const Mesh *, 122 125 const MeshSimplificationSequence *, 123 Geometry::TIPOFUNC upb); 126 size_t submesh=-1, 127 Geometry::TIPOFUNC upb=NULL); 124 128 125 129 // Destructor … … 141 145 /// GetMesh: Return de current Mesh. 142 146 Mesh * GetMesh(); 147 148 // Sets what is the submesh that stores the leaves 149 void SetSubMeshLeaves(size_t submesh); 150 143 151 }; 144 152 -
GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMeshStripifier.h
r826 r841 54 54 55 55 // Sets what is the mesh that stores the leaves 56 void setSubMeshLeaves( Geometry::Index);56 void setSubMeshLeaves(size_t); 57 57 58 58 protected: … … 65 65 66 66 // Index of the submesh leaves. 67 Geometry::IndexmSubMeshLeaves;67 size_t mSubMeshLeaves; 68 68 69 69 }; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
r774 r841 484 484 LodStripsConstructor::LodStripsConstructor(const Mesh *m, 485 485 const MeshSimplificationSequence *ms, 486 size_t submesh, 486 487 TIPOFUNC upb) 487 488 { … … 493 494 this->geoMeshSQ = ms; 494 495 496 // Set the leaves submesh. 497 mSubMeshLeaves = submesh; 498 499 495 500 this->GenerarModeloCompleto(upb); 496 501 } … … 784 789 } 785 790 } 786 787 791 } 788 792 … … 1012 1016 { 1013 1017 for ( j = 0; 1014 1015 1018 j < this->geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; 1019 j++) 1016 1020 { 1017 1021 // Si hay mas de un submesh ListaIndices 1018 1022 // no se rellena correctamente. 1019 1023 vAux.Vertex[0] = this->geoMesh->mSubMesh[i]. 1020 1024 mVertexBuffer->mPosition[j].x; 1021 1025 vAux.Vertex[1] = this->geoMesh->mSubMesh[i]. 1022 1026 mVertexBuffer->mPosition[j].y; 1023 1027 vAux.Vertex[2] = this->geoMesh->mSubMesh[i]. 1024 1028 mVertexBuffer->mPosition[j].z; 1025 1029 // Añadimos las normales en cVerts. 1026 1030 vAux.Normal[0] = this->geoMesh->mSubMesh[i]. 1027 1031 mVertexBuffer->mNormal[j].x; 1028 1032 vAux.Normal[1] = this->geoMesh->mSubMesh[i]. 1029 1033 mVertexBuffer->mNormal[j].y; 1030 1034 vAux.Normal[2] = this->geoMesh->mSubMesh[i]. 1031 1035 mVertexBuffer->mNormal[j].z; 1032 1036 1033 1037 // Añadimos las coordenadas de textura a cVerts. 1034 1038 vAux.TexCoords[0] = this->geoMesh->mSubMesh[i]. 1035 1039 mVertexBuffer->mTexCoords[j].x; 1036 1040 vAux.TexCoords[1] = this->geoMesh->mSubMesh[i]. 1037 1041 mVertexBuffer->mTexCoords[j].y; 1038 1042 1039 1043 vAux.Next = -10; 1040 1044 vAux.numMesh = i; 1041 1045 1042 1046 this->cVerts.push_back(vAux); 1043 1047 } … … 1052 1056 for (i = 0; i < this->geoMesh->mSubMeshCount; i++) 1053 1057 { 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 1077 1072 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; 1091 1098 k < this->geoMesh->mSubMesh[i].mIndexCount; 1092 1099 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 } 1103 1111 } 1104 1112 … … 1123 1131 } 1124 1132 1133 // Sets what is the submesh that stores the leaves. 1134 void LodStripsConstructor::SetSubMeshLeaves(size_t submesh) 1135 { 1136 mSubMeshLeaves = submesh; 1137 } 1138 -
GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h
r829 r841 104 104 GeometryBounds mMeshBounds; 105 105 106 MeshSimplifier *m s;107 TreeSimplifier *m ts;106 MeshSimplifier *mMeshSimplifier; 107 TreeSimplifier *mTreeSimplifier; 108 108 char *nombremesh; 109 109 SimplificationType simplificacionState; … … 246 246 void createQslimSequence(); 247 247 248 // Create a siplification sequence of the leaves. 249 void createLeavesSequence(); 250 248 251 // Stripify the mesh object. 249 252 void stripify(); -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp
r829 r841 586 586 drawLodStrip(); 587 587 } 588 else if (mLodTree)589 {590 drawLodTree();591 }588 //else if (mLodTree) 589 //{ 590 // drawLodTree(); 591 //} 592 592 else 593 593 { -
GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
r834 r841 881 881 else 882 882 { 883 884 883 // Simplify the mesh object. 885 884 simplifyEdgeCollapse(); … … 893 892 simplifyLeavesCollapse(); 894 893 894 // Create the leaves simplification sequence. 895 createLeavesSequence(); 896 895 897 break; 896 898 … … 905 907 else 906 908 { 907 908 909 // Transform NoSV Mesh to a SV Mesh. 909 910 mesh_aux = mGeoMesh->toSharedVertex(); … … 992 993 993 994 // Builder 994 995 995 // Open file chooser dialog. 996 996 file_name = fltk::file_chooser( "Build LOD", … … 1022 1022 oLodStrip = new LodStripsConstructor( mGeoMesh, 1023 1023 oMeshSimpSequence, 1024 idMeshLeaves, 1024 1025 progress_function); 1025 1026 … … 1027 1028 Serializer::Mode::WRITE); 1028 1029 1029 oLodStrip-> LodStripsConstructor::Save(*oSerializer);1030 oLodStrip->Save(*oSerializer); 1030 1031 1031 1032 // Close file. … … 1695 1696 simplificacionState = QSLIM; 1696 1697 1697 m s= new ImageBasedSimplifier(mGeoMesh, progress_function);1698 1699 m s->setMeshLeaves(idMeshLeaves);1698 mMeshSimplifier = new ImageBasedSimplifier(mGeoMesh, progress_function); 1699 1700 mMeshSimplifier->setMeshLeaves(idMeshLeaves); 1700 1701 1701 1702 if (mPercent->value() == true) … … 1708 1709 1709 1710 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 1710 m s->Simplify(percent);1711 mMeshSimplifier->Simplify(percent); 1711 1712 1712 1713 // Deletes the previous mesh. … … 1720 1721 delete mGeoMesh; 1721 1722 1722 mGeoMesh = m s->GetMesh();1723 mGeoMesh = mMeshSimplifier->GetMesh(); 1723 1724 1724 1725 // Visualize mesh. … … 1737 1738 1738 1739 // Simplifica el geomesh -> Parámetro es un factor LOD [0,1]. 1739 m s->Simplify(v);1740 mMeshSimplifier->Simplify(v); 1740 1741 1741 1742 // Deletes the previous mesh. … … 1749 1750 delete mGeoMesh; 1750 1751 1751 mGeoMesh = m s->GetMesh();1752 mGeoMesh = mMeshSimplifier->GetMesh(); 1752 1753 1753 1754 // Visualize the mesh. … … 1773 1774 simplificacionState = HOJAS; 1774 1775 1775 m ts= new TreeSimplifier(mGeoMesh, progress_function);1776 mTreeSimplifier = new TreeSimplifier(mGeoMesh, progress_function); 1776 1777 vi = (uint32)mMeshReduction->fvalue(); 1777 1778 … … 1780 1781 { 1781 1782 // Simplify 1782 m ts->Simplify(vi, idMeshLeaves);1783 mTreeSimplifier->Simplify(vi, idMeshLeaves); 1783 1784 1784 1785 // Deletes the previous mesh. … … 1792 1793 delete mGeoMesh; 1793 1794 1794 mGeoMesh = m ts->GetMesh();1795 mGeoMesh = mTreeSimplifier->GetMesh(); 1795 1796 1796 1797 geoMeshView->setMesh(mGeoMesh); … … 1810 1811 MeshSimplificationSequence *secsimpl; 1811 1812 1812 secsimpl = m s->GetSimplificationSequence();1813 secsimpl = mMeshSimplifier->GetSimplificationSequence(); 1813 1814 1814 1815 secsimpl->putMeshName(nombremesh); // Nombre del mesh para guardar la secuencia de simplificación … … 1816 1817 1817 1818 delete secsimpl; 1819 } 1820 1821 //--------------------------------------------------------------------------- 1822 // Create a simplification sequence of the leaves. 1823 //--------------------------------------------------------------------------- 1824 void 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; 1818 1834 } 1819 1835
Note: See TracChangeset
for help on using the changeset viewer.