Changeset 829 for GTP/trunk/Lib/Geom/shared/GTGeometry/src
- Timestamp:
- 04/26/06 16:00:29 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared/GTGeometry/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
r774 r829 406 406 } 407 407 408 uint32 LodStripsLibrary::GetStripCount() 408 uint32 LodStripsLibrary::GetStripCount() const 409 409 { 410 410 return (uint32) mTotalStrips; 411 } 412 413 uint32 LodStripsLibrary::GetIndexCountByStrip(uint32 istrip) const 414 { 415 return (uint32) mStrips[istrip].size(); 411 416 } 412 417 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp
r774 r829 1 //#include "defs.h" 2 #include <assert.h> 1 3 #include "GeoLodTreeLibrary.h" 4 //#include "ArbolesInma/Arbol.h" 5 //#include "ArbolesInma/Foliage.h" 6 7 using namespace Geometry; 8 9 uint32 uniqueIDgen = 0; 10 11 Geometry::LodTreeLibrary::LodTreeLibrary(std::string trunkSimpSeqFile, 12 Geometry::Mesh *treeGeoMesh 13 /*, 14 std::string foliage_verts, 15 std::string foliage_leafs, 16 std::string foliage_simpl, 17 uint32 leafSubMeshID, 18 CREATEVERTEXDATAFUNC vdfun, 19 CREATEINDEXDATAFUNC idfun, 20 CREATEMULTIINDEXDATAFUNC midfun*/) 21 { 22 uniqueID = uniqueIDgen++; 23 24 // Cargar el tronco 25 /* trunk=new LodStrip(vdfun,midfun); 26 trunk->ED_NUEVA=1; 27 trunk->RESVARIABLE=0; 28 trunk->MODOTEST=0; //0: No test 1: plano 2: esfera 29 trunk->bTextures=0; 30 if (trunk->RecuperarModeloEFFICIENT((char*)trunkfile.c_str())==0) 31 throw FileNotFound(trunkfile); 32 33 // trunk->LodsDisp=(int) (trunk->cVerts.size()*0.99); 34 trunk->LodsDisp=(int) (trunk->TOTALCAMBIOS*0.95); 35 trunk->CopiarVectors2ArraysNUEVAED(); 36 trunk->LodActual=0; 37 trunk->CalculaNormalesVertice();*/ 38 39 trunk = new LodStripsLibrary(trunkSimpSeqFile,treeGeoMesh); 40 41 // Cargar la copa del árbol 42 /* arbol = new Arbol(foliage_verts.c_str(),foliage_leafs.c_str(),foliage_simpl.c_str(),vdfun,idfun); 43 foliage = new Foliage(arbol);*/ 44 45 } 46 /* 47 LodTreeLibrary::LodTreeLibrary(const LodTreeLibrary &t) 48 { 49 uniqueID = uniqueIDgen++; 50 assert( 51 // trunk=new LodStrip(t.trunk); 52 arbol=new Arbol(t.arbol); 53 foliage=new Foliage(arbol); 54 } 55 56 LodTreeLibrary::LodTreeLibrary(LodTreeLibrary *t) 57 { 58 uniqueID = uniqueIDgen++; 59 trunk=new LodStrip(t->trunk); 60 arbol=new Arbol(t->arbol); 61 foliage=new Foliage(arbol); 62 } 63 */ 64 65 LodTreeLibrary::~LodTreeLibrary(void) 66 { 67 if (trunk) delete trunk; 68 // if (arbol) delete arbol; 69 // if (foliage) delete foliage; 70 /* if (trunk_all_indices) delete trunk_all_indices; 71 if (indices_offsets) delete[] indices_offsets; 72 // if (current_foliage_indices) delete[] current_foliage_indices;*/ 73 } 74 75 uint32 LodTreeLibrary::CurrentLOD_Trunk_StripCount(void) const 76 { 77 assert(trunk); 78 // return trunk->TOTALTIRAS; 79 return trunk->GetStripCount(); 80 } 81 82 83 uint32 LodTreeLibrary::CurrentLOD_Trunk_IndexCountByStrip(uint32 istrip) const 84 { 85 assert(trunk); 86 // return trunk->lStripsV[istrip].size(); 87 return trunk->GetIndexCountByStrip(istrip); 88 } 89 /* 90 uint32 LodTreeLibrary::CurrentLOD_Trunk_IndexCount(void) const 91 { 92 assert(trunk); 93 return trunk->num_indices_current_lod; 94 } 95 */ 96 97 uint32 LodTreeLibrary::GoToTrunkLod(uint32 newlod) 98 { 99 return trunk->GoToLod(newlod); 100 /* uint32 previouslod = trunk->LodActual; 101 trunk->VerModeloVBO(newlod); 102 return previouslod;*/ 103 } 104 105 uint32 LodTreeLibrary::MinTrunkLod(void) const 106 { 107 // return 3; // un polígono: preguntar a francisco 108 // return (trunk->TOTALCAMBIOS*0.95f); 109 return trunk->MinLod(); 110 } 111 uint32 LodTreeLibrary::MaxTrunkLod(void) const 112 { 113 // return (trunk->cVerts.size()*0.99); 114 // return (trunk->TOTALCAMBIOS*0.95f); 115 // return 0; 116 return trunk->MaxLod(); 117 } 118 119 /* 120 uint32 LodTreeLibrary::GoToFoliageLod(uint32 newlod) 121 { 122 foliage->AjusteHojas(newlod); 123 124 arbol->indexdata->Begin(); 125 arbol->vertexdata->Begin(); 126 int i = foliage->ppio; 127 int auxnumhojas = 0; 128 while(i!=-1) 129 { 130 auxnumhojas++; 131 i=foliage->Acth[i].next; 132 } 133 134 assert(auxnumhojas*6<=arbol->indexdata->GetNumMaxIndices()); 135 arbol->indexdata->SetNumValidIndices(auxnumhojas*6); 136 i = foliage->ppio; 137 int kkkk=0; 138 while(i!=-1) 139 { 140 unsigned int v0,v1,v2,v3; 141 v0 = arbol->Hojas[i].Vert_Hoja[0]; 142 v1 = arbol->Hojas[i].Vert_Hoja[1]; 143 v2 = arbol->Hojas[i].Vert_Hoja[2]; 144 v3 = arbol->Hojas[i].Vert_Hoja[3]; 145 146 arbol->indexdata->SetIndex(kkkk+0,v0); 147 arbol->indexdata->SetIndex(kkkk+1,v1); 148 arbol->indexdata->SetIndex(kkkk+2,v2); 149 arbol->indexdata->SetIndex(kkkk+3,v2); 150 arbol->indexdata->SetIndex(kkkk+4,v1); 151 arbol->indexdata->SetIndex(kkkk+5,v3); 152 153 arbol->vertexdata->SetVertexTexCoord(v0,0,0); 154 arbol->vertexdata->SetVertexTexCoord(v1,0,1); 155 arbol->vertexdata->SetVertexTexCoord(v2,1,0); 156 arbol->vertexdata->SetVertexTexCoord(v3,1,1); 157 158 kkkk+=6; 159 i=foliage->Acth[i].next; 160 } 161 arbol->indexdata->End(); 162 arbol->vertexdata->End(); 163 164 return 0; 165 } 166 167 uint32 LodTreeLibrary::MinFoliageLod(void) const 168 { 169 return arbol->minHojas; // una hoja: preguntar a francisco 170 } 171 uint32 LodTreeLibrary::MaxFoliageLod(void) const 172 { 173 // return arbol->TotHojas; 174 return arbol->nHojas; 175 } 176 */ 177 /*const VertexData* LodTreeLibrary::Get_Trunk_VertexData(void) const 178 { 179 return trunk->vertices; 180 } 181 const MultiIndexData* LodTreeLibrary::CurrentLOD_Trunk_Indices(void) const 182 { 183 // return (uint32*)trunk->vStrips[istrip]; 184 // return trunk->indices_x_tira[istrip]; 185 return trunk->indices; 186 }*/ 187 188 /* 189 const VertexData* LodTreeLibrary::Get_Foliage_VertexData(void) const 190 { 191 return arbol->vertexdata; 192 } 193 194 const IndexData* LodTreeLibrary::CurrentLOD_Foliage_Indices(void) const 195 { 196 // return current_foliage_indices; 197 return arbol->indexdata; 198 }*/ 199 200 201 /*void ThrowFileNotFoundError(const char *text) 202 { 203 throw Geometry::FileNotFound(text); 204 }*/ 205 /* 206 uint32 LodTreeLibrary::CurrentLOD_Foliage_IndexCount(void) const 207 { 208 // return current_foliage_indexcount; 209 return arbol->indexdata->GetNumValidIndices(); 210 } 211 212 uint32 LodTreeLibrary::Get_Trunk_VertexCount(void) const 213 { 214 return trunk->TOTALVERTS; 215 } 216 217 uint32 LodTreeLibrary::Get_Trunk_MaxIndexCount(uint32 istrip) const 218 { 219 // return trunk->indices_x_tira[istrip]->GetNumMaxIndices(); 220 return trunk->indices->GetNumMaxIndices(istrip); 221 } 222 223 uint32 LodTreeLibrary::Get_Foliage_VertexCount(void) const 224 { 225 return arbol->vertexdata->GetNumVertices(); 226 } 227 uint32 LodTreeLibrary::Get_Foliage_MaxIndexCount(void) const 228 { 229 return arbol->indexdata->GetNumMaxIndices(); 230 } 231 */
Note: See TracChangeset
for help on using the changeset viewer.