Changeset 1058 for GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves
- Timestamp:
- 06/26/06 17:36:46 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves
- Files:
-
- 4 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.cpp
r1057 r1058 6 6 7 7 8 /****************************************** PANTALLA **************************************************/9 8 //-------------------------------------------------------------------------------------------------------------------------------- 10 9 // Void constructor … … 17 16 vertexdata(NULL), Leaves(NULL), MinDet(NULL) 18 17 { 19 cx = cy= cz= 0; 20 ppio= final = -1; 18 begin = final = -1; 21 19 22 20 ReadVertices(leavesSubMesh); 23 21 ReadLeafs(leavesSubMesh); 24 22 if (!ReadSimpSeq(simpSeq)) exit(1); 25 RellenoRaiz(); 26 CalculaTexCoordsYNorms(); 27 28 29 // esto no sé si devería haber akí 23 FillRoot(); 24 CalculateTexCoordsAndNorms(); 25 30 26 indexdata->SetNumValidIndices(0); 31 27 32 28 int h=0; 33 29 34 35 Acth = new ActiveLeafNode[nHojas*8]; 36 37 for ( h=0; h < nHojas; h++) { 30 Acth = new ActiveLeafNode[leafCount*8]; 31 32 for (h=0; h < leafCount; h++) { 38 33 39 34 Acth[h].index = h; … … 46 41 } 47 42 48 ppio = 0; 49 final = nHojas-1; 50 nhactivas = nHojas; 51 52 } 53 54 /* 55 //-------------------------------------------------------------------------------------------------------------------------------- 56 // Constructor with the name of a file cotaining the data 57 //-------------------------------------------------------------------------------------------------------------------------------- 58 Foliage::Foliage ( Arbol *Arbol1) 59 { 60 int h=0; 61 62 63 MiArbol = Arbol1; 64 65 Acth = new Activas[(MiArbol->nHojas)*8]; 66 67 for ( h=0; h < MiArbol->nHojas; h++) { 68 69 Acth[h].indice = h; 70 if ( h != 0) 71 { 72 Acth[h].prev = (h-1); 73 Acth[h-1].next = h; 74 } 75 76 } 77 78 ppio = 0; 79 final = (MiArbol->nHojas)-1; 80 nhactivas = MiArbol->nHojas; 81 82 83 84 }*/ 43 begin = 0; 44 final = leafCount-1; 45 active_leaf_count = leafCount; 46 } 85 47 86 48 //-------------------------------------------------------------------------------------------------------------------------------- … … 95 57 delete Acth; 96 58 } 97 //98 99 //--------------------------------------------------------------------------------------------------------------------------------100 // Dibuja una hoja101 //--------------------------------------------------------------------------------------------------------------------------------102 /*103 void Foliage::Dibuja_Hoja ( Hoja &aHoja)104 {105 106 float a,b,c;107 108 glBegin (GL_TRIANGLE_STRIP);109 glNormal3fv (aHoja.Normal);110 MiArbol->Vertices[aHoja.vertsLeaf[0]].GetCoordinates (a,b,c);111 glTexCoord2f ( 0.0, 0.0);112 113 glVertex3f (a,b,c);114 115 MiArbol->Vertices[aHoja.vertsLeaf[1]].GetCoordinates (a,b,c);116 glTexCoord2f ( 0.0, 1.0);117 glVertex3f (a,b,c);118 119 MiArbol->Vertices[aHoja.vertsLeaf[2]].GetCoordinates (a,b,c);120 glTexCoord2f ( 1.0, 0.0);121 glVertex3f (a,b,c);122 123 MiArbol->Vertices[aHoja.vertsLeaf[3]].GetCoordinates (a,b,c);124 glTexCoord2f ( 1.0, 1.0);125 glVertex3f (a,b,c);126 127 glEnd ();128 129 }130 131 132 //--------------------------------------------------------------------------------------------------------------------------------133 // Dibujar todas las hojas activas134 //--------------------------------------------------------------------------------------------------------------------------------135 136 int Foliage::DibujarHojas (float frustum[6][4], float zoom)137 {138 int hojactiva, i;139 140 141 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);142 143 hojactiva = 0;144 glBindTexture (GL_TEXTURE_2D,texName[0]);145 glEnable(GL_ALPHA_TEST);146 147 if ( zoom <75.0)148 //if ( false)149 {150 //calculo el culling de las hojas de minimo detalle151 Culling (frustum);152 //printf ( "--------------------------->Entro en culling\n");153 154 i= ppio;155 while ( i != -1)156 {157 if (MiArbol->Hojas[MiArbol->Hojas[i].raiz].visible == 1)158 {159 hojactiva ++;160 Dibuja_Hoja (MiArbol->Hojas[i]);161 }162 i = Acth[i].next;163 }164 }165 else166 {167 i= ppio;168 while ( i != -1)169 {170 hojactiva ++;171 Dibuja_Hoja (MiArbol->Hojas[i]);172 i=Acth[i].next;173 }174 175 }176 177 178 179 glDisable(GL_ALPHA_TEST);180 181 return ( hojactiva);182 183 }184 185 //--------------------------------------------------------------------------------------------------------------------------------186 // Dibujar media copa del arbol187 // si el char c es 'f' dibuja la parte delantera188 // si es 'b' la parte trasera189 //--------------------------------------------------------------------------------------------------------------------------------190 191 int Foliage::DibujaMediaCopa ( char c, float rva, float rvb,float rvc, float rvd, float radio)192 {193 int hojactiva, i;194 // int count, count2;195 196 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);197 198 hojactiva = 0;199 glBindTexture (GL_TEXTURE_2D,texName[0]);200 glEnable(GL_ALPHA_TEST);201 202 i= ppio;203 if ( c == 'b')204 {//count = 0;205 while ( i != -1)206 { //count ++;207 if ( Criterio (MiArbol->Hojas[i],'p', rva,rvb,rvc,rvd, radio) == false) //esta detras del plano208 {209 hojactiva ++;210 Dibuja_Hoja (MiArbol->Hojas[i]);211 }212 i = Acth[i].next;213 214 }215 // printf ( " EN LA TRASERA chequeo %i hojas \n", count);216 }217 else218 {// count2 = 0;219 220 while ( i != -1)221 { //count2++;222 if ( Criterio (MiArbol->Hojas[i],'p', rva,rvb,rvc,rvd, radio) == true) //esta detras del plano223 {224 hojactiva ++;225 Dibuja_Hoja (MiArbol->Hojas[i]);226 }227 i = Acth[i].next;228 }229 // printf ( " EN LA DELANTERA chequeo %i hojas \n", count2);230 231 }232 glDisable(GL_ALPHA_TEST);233 234 // nhactivas = hojactiva;235 236 237 return ( hojactiva);238 239 240 241 }242 243 244 245 //-------------------------------------------------------------------------------------------------------------------------246 // dibuja la esfera247 //-------------------------------------------------------------------------------------------------------------------------248 249 void Foliage::DibujaEsfera(float r)250 {251 252 glPushMatrix();253 glTranslated (0.0,MiArbol->cy, 0.0);254 glColor3f(1.0, 0.0, 0.0);255 glDisable(GL_LIGHTING);256 glLineWidth(1.2);257 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);258 glutSolidSphere ( r,20, 20);259 glEnable(GL_LIGHTING);260 glColor3f ( 1.0, 1.0, 1.0);261 glPopMatrix();262 263 }264 265 /****************************************** CULLING **************************************************/266 //-------------------------------------------------------------------------------------------------------------------------267 // culling de las hojas de menor detalle268 //-------------------------------------------------------------------------------------------------------------------------269 270 void Foliage::Culling (float frustum[6][4])271 {272 int i, j;273 274 i = 0;275 while ( MinDet[i].index != -1)276 {277 j = MinDet[i].index;278 if (LeafinFrustum ( j, frustum) == true) {279 // printf("dentro %i y el padre es %i\n", j, MiArbol->Hojas[MiArbol->MinDet[i].indice].parent);280 Leaves[j].visible = 1;281 }282 else283 {284 // printf("fuera %i\n", j);285 Leaves[j].visible = 0;286 }287 288 i++;289 }290 291 }292 293 294 //-------295 // si está en el frustrum --> true296 // sino --> false297 //------------298 299 300 bool Foliage::LeafinFrustum ( int i, float frustum[6][4])301 {302 float a,b,c, tmp;303 int j,p;304 Vector v;305 306 for (j =0; j<4; j++)307 {308 // MiArbol->Vertices[MiArbol->Hojas[i].vertsLeaf[j]].GetCoordinates (a,b,c);309 vertexdata->GetVertexCoord(Leaves[i].vertsLeaf[j],a,b,c);310 v[0]=a; v[1]=b; v[2]=c; v[3]=1;311 312 // el punto resultante será313 v = mat_aux*v;314 315 for( p = 0; p < 5; p++ )316 { tmp = float(frustum[p][0] * v[0] + frustum[p][1] * v[1] + frustum[p][2] * v[2] + frustum[p][3]);317 if ( tmp <= -2.0 ) return false;318 }319 }320 321 322 return true;323 324 }325 326 59 327 60 /****************************************** CRITERIO **************************************************/ … … 339 72 340 73 341 //-------------------------------------------------------------------------------------------------------------------------------- 342 // Colapsa dos hojas 343 //-------------------------------------------------------------------------------------------------------------------------------- 344 345 void Foliage::ColapsaHoja ( int h, int& post) 346 { 347 348 //actualizo los punteros del ppio y del final, y post 349 while (( ppio == Leaves[h].childLeft) || ( ppio == Leaves[h].childRight)) 350 ppio = Acth[ppio].next; 351 while (( final == Leaves[h].childLeft) || ( final == Leaves[h].childRight)) 352 final = Acth[final].prev; 353 354 while (( post == Leaves[h].childLeft) || ( post == Leaves[h].childRight)) 355 post = Acth[post].next; 356 357 358 359 //COLAPSAR = QUITO DOS DE ACTIVOS PONGO UNO A ACTIVO 360 361 if (Acth[Leaves[h].childLeft].next != -1) 362 Acth[Acth[Leaves[h].childLeft].next].prev = Acth[Leaves[h].childLeft].prev; 363 if (Acth[Leaves[h].childLeft].prev != -1) 364 Acth[Acth[Leaves[h].childLeft].prev].next = Acth[Leaves[h].childLeft].next; 365 366 if (Acth[Leaves[h].childRight].next != -1) 367 Acth[Acth[Leaves[h].childRight].next].prev = Acth[Leaves[h].childRight].prev; 368 if (Acth[Leaves[h].childRight].prev != -1) 369 Acth[Acth[Leaves[h].childRight].prev].next = Acth[Leaves[h].childRight].next; 370 371 372 // desconecto a los hijos 373 Acth[Leaves[h].childLeft].prev = -1; 374 Acth[Leaves[h].childLeft].next = -1; 375 Acth[Leaves[h].childRight].prev = -1; 376 Acth[Leaves[h].childRight].next = -1; 377 378 //añado al final 379 Acth[h].prev = final; 380 Acth[h].next = -1; 381 Acth[final].next = h; 382 final = h; 383 384 385 } 386 387 //-------------------------------------------------------------------------------------------------------------------------------- 388 // Splitea una hoja 389 //-------------------------------------------------------------------------------------------------------------------------------- 390 391 void Foliage::SplitHoja (int h, int &post) 392 { 393 394 // SPLITEAR: QUITO UNO, PONGO DOS 395 396 if ( ppio == h) ppio = Acth[h].next; 397 if ( final == h) final = Acth[h].prev; 398 399 // 1 enlazo los hijos 400 Acth[Leaves[h].childLeft].next = Leaves[h].childRight; 401 Acth[Leaves[h].childRight].prev = Leaves[h].childLeft; 402 Acth[Leaves[h].childRight].next = -1; 403 404 //y desconecto al padre 405 if ( Acth[h].prev != -1) 406 Acth[Acth[h].prev].next = Acth[h].next; 407 if ( Acth[h].next != -1) 408 Acth[Acth[h].next].prev = Acth[h].prev; 409 Acth[h].prev = -1; 410 Acth[h].next = -1; 411 412 //añado al final los hijos 413 Acth[Leaves[h].childLeft].prev = final; 414 Acth[final].next = Leaves[h].childLeft; 415 final = Leaves[h].childRight; 416 417 } 418 419 420 421 422 423 //------------------------------------------------------------------------------------------- 424 // fuerzo a splitear 425 // hoja -> es el nodo que cumple la condicion 426 // padre -> es el nodo que chequeaba de la lista de activos 427 // hpost -> es el nodo siguiente en la lista de activos 428 //------------------------------------------------------------------------------------------- 429 430 bool Foliage::Forzar_Split(int hoja, int padre, int &hpost) 431 { 432 433 int h; 434 lista <int> listah; 435 bool bien; 436 437 bien = false; 438 h = Leaves[hoja].parent; 439 listah.Inserta (h); // Inserta un dato en la lista 440 441 while ( h != padre) 442 { 443 h = Leaves[h].parent; 444 listah.Inserta (h); // Inserta un dato en la lista 445 } 446 447 448 while (listah.NDatos () != 0) 449 { 450 h = listah.GetCola ();//coger el padre más alto 451 SplitHoja(h, hpost); 452 listah.Borra(h); 453 454 } 455 456 if ( listah.NDatos() == 0) 457 bien = true; 458 return (bien); 459 460 } 461 462 463 464 465 /****************************************** RESOLUCIÓN CONSTANTE **************************************************/ 466 467 468 int Foliage::ResolucionC (float dist, float dmax, float dmin) 469 { 470 471 float difdist, d; 472 int difhojas, nhojas; 473 474 if (( dist > dmin) && (dist <dmax)) 475 { 476 difdist = dmax - dmin; 477 difhojas = nHojas - minHojas; 478 479 d = dist - dmin; 480 481 //regla de 3 482 483 nhojas = int(abs(d*difhojas /difdist)); 484 485 AjusteHojas ((nHojas)-nhojas); 486 487 } 488 else if (dist > dmax) { 489 AjusteHojas (minHojas); 490 } 491 else if (dist < dmin) { 492 AjusteHojas (nHojas); 493 } 494 495 return (nhactivas); 496 } 497 498 499 500 void Foliage::AjusteHojas( int nhojas) 501 { 502 if ((nhojas <= nHojas) && (nhojas >= minHojas)) 503 { 504 if ( nhojas < nhactivas) { 505 RCecol ( nhactivas - nhojas); 74 75 void Foliage::CalculateLOD(int nleaves) 76 { 77 if ((nleaves <= leafCount) && (nleaves > minLeaves)) 78 { 79 if ( nleaves < active_leaf_count) { 80 RCecol (active_leaf_count - nleaves); 506 81 } 507 82 else { 508 RCsplit (nhojas-nhactivas ); 509 } 510 511 nhactivas = nhojas; 512 // printf ( "ajusto a %i\n", nhactivas ); 513 83 RCsplit (nleaves-active_leaf_count); 84 } 85 86 active_leaf_count = nleaves; 514 87 } 515 88 … … 524 97 j = num; 525 98 h = final+1; 526 while ((h<= TotHojas) && (j>0))99 while ((h<=leafTotal) && (j>0)) 527 100 { 528 while (( ppio == Leaves[h].childLeft) || ( ppio== Leaves[h].childRight))529 ppio = Acth[ppio].next;101 while (( begin == Leaves[h].childLeft) || ( begin == Leaves[h].childRight)) 102 begin = Acth[begin].next; 530 103 531 104 while (( final == Leaves[h].childLeft) || ( final == Leaves[h].childRight)) 532 105 final = Acth[final].prev; 533 534 535 //COLAPSAR = QUITO DOS DE ACTIVOS PONGO UNO A ACTIVO536 106 537 107 if (Acth[Leaves[h].childLeft].next != -1) … … 563 133 //incremento el posible siguiente colapso 564 134 h++; 565 566 567 } 568 569 } 570 571 /* 572 void Foliage::RCsplit ( int nhojas) 573 { 574 int i, hpost; 575 576 i = ppio; 577 578 while (( i != -1) && (nhojas>0)){ 579 hpost = Acth[i].next; 580 581 if (MiArbol->Leaves[i].childLeft != -1){ 582 SplitHoja(i, hpost); 583 nhojas --; 584 585 } 586 587 i = hpost; 588 589 } 590 } 591 */ 592 593 int Foliage::AnteriorActivo (int h) 135 } 136 } 137 138 int Foliage::PrevActive(int h) 594 139 { 595 140 int i; 596 141 597 142 598 if ( ppio> h) i = -1;143 if (begin > h) i = -1; 599 144 else 600 145 { … … 608 153 } 609 154 610 int Foliage:: PosteriorActivo(int h)155 int Foliage::NextActive(int h) 611 156 { int i; 612 157 613 158 i = h++; 614 159 615 while ((IsActive(i) == false) || (i> TotHojas))160 while ((IsActive(i) == false) || (i> leafTotal)) 616 161 i++; 617 162 618 if (i > TotHojas) i=-1;163 if (i > leafTotal) i=-1; 619 164 620 165 … … 629 174 j = num; 630 175 h = final; 631 while ((h > nHojas) && (j>0)) 632 { 633 176 while (h>leafCount && j>0) 177 { 634 178 ///////////// insertar a los hijos en orden segun su indice 635 179 //hijo izquierdo 636 ant = AnteriorActivo(Leaves[h].childLeft);637 post = PosteriorActivo(Leaves[h].childLeft);180 ant = PrevActive(Leaves[h].childLeft); 181 post = NextActive(Leaves[h].childLeft); 638 182 639 183 … … 641 185 Acth[Leaves[h].childLeft].prev = ant; 642 186 if (ant != -1) Acth[ant].next = Leaves[h].childLeft; 643 else ppio= Leaves[h].childLeft;187 else begin = Leaves[h].childLeft; 644 188 if (post != -1) Acth[post].prev = Leaves[h].childLeft; 645 189 646 190 647 191 //hijo derecho 648 ant = AnteriorActivo(Leaves[h].childRight);649 post = PosteriorActivo(Leaves[h].childRight);192 ant = PrevActive(Leaves[h].childRight); 193 post = NextActive(Leaves[h].childRight); 650 194 651 195 … … 653 197 Acth[Leaves[h].childRight].prev = ant; 654 198 if (ant != -1) Acth[ant].next = Leaves[h].childRight; 655 else ppio= Leaves[h].childRight;199 else begin = Leaves[h].childRight; 656 200 if (post != -1) Acth[post].prev = Leaves[h].childRight; 657 201 … … 695 239 vertexdata->End(); 696 240 697 Tot Verts = countv;241 TotalVerts = countv; 698 242 } 699 243 … … 746 290 { 747 291 int numtris = int(submesh->mIndexCount / 3); 748 nHojas= numtris / 2;749 for (int h=0; h< nHojas; h++)292 leafCount = numtris / 2; 293 for (int h=0; h<leafCount; h++) 750 294 { 751 295 Leaves[h].vertsLeaf[0] = submesh->mIndex[h*6+0]; … … 773 317 else 774 318 { 775 tn = nHojas;319 tn = leafCount; 776 320 while (fgets (linea, 255, fp_simpli) != NULL) 777 321 { … … 779 323 continue; 780 324 781 //N 446 Ver 10176 10178 10169 10171 Tv 156 154 E 2782 783 // sscanf(linea, "%s %lu %s %lu %lu %lu %lu %s %lu %lu %s %i",784 // &str, &tn, &str, &v0, &v1, &v2, &v3, &str, &tv1, &tv2, &str, &e );785 325 long int triviej00=-1, triviej01=-1; 786 326 long int triviej10=-1, triviej11=-1; … … 812 352 fclose(fp_simpli); 813 353 814 TotHojas=tn;354 leafTotal=tn; 815 355 816 356 return true; 817 357 } 818 358 819 void Foliage:: RellenoRaiz(void)359 void Foliage::FillRoot(void) 820 360 { 821 361 int i,j, k, t, cont; … … 826 366 cont =-1; 827 367 828 MinDet = new ActiveLeafNode[ nHojas*2];829 830 while (i< TotHojas)368 MinDet = new ActiveLeafNode[leafCount*2]; 369 370 while (i<leafTotal) 831 371 { 832 372 j=i; 833 while (Leaves[j].parent > -1) j=Leaves[j].parent;373 while (Leaves[j].parent>-1) j=Leaves[j].parent; 834 374 Leaves[i].root = j; 835 375 … … 853 393 } 854 394 855 if ( esta == false) //añado al final395 if ( esta == false) 856 396 { 857 397 cont++; … … 860 400 } 861 401 862 i++;402 i++; 863 403 } 864 404 865 min Hojas = cont;866 867 } 868 869 void Foliage::Calcula TexCoordsYNorms(void)405 minLeaves = cont; 406 407 } 408 409 void Foliage::CalculateTexCoordsAndNorms(void) 870 410 { 871 411 vertexdata->Begin(); 872 for (int i=0; i< nHojas; i++)412 for (int i=0; i<leafCount; i++) 873 413 { 874 414 const float* lanormal = Leaves[i].normal; … … 884 424 vertexdata->SetVertexNormal(Leaves[i].vertsLeaf[3], lanormal[0], lanormal[1], lanormal[2]); 885 425 vertexdata->SetVertexTexCoord(Leaves[i].vertsLeaf[3], 1.0f, 0.0f); 886 887 888 /* MiArbol->Vertices[aHoja.vertsLeaf[1]].GetCoordinates (a,b,c);889 glTexCoord2f ( 0.0, 1.0);890 glVertex3f (a,b,c);891 892 MiArbol->Vertices[aHoja.vertsLeaf[2]].GetCoordinates (a,b,c);893 glTexCoord2f ( 1.0, 0.0);894 glVertex3f (a,b,c);895 896 MiArbol->Vertices[aHoja.vertsLeaf[3]].GetCoordinates (a,b,c);897 glTexCoord2f ( 1.0, 1.0);898 glVertex3f (a,b,c);*/899 426 } 900 427 vertexdata->End(); … … 903 430 Foliage::Foliage(const Foliage *ar) 904 431 { 905 nHojas=ar->nHojas;906 MinDet = new ActiveLeafNode[nHojas*2];432 leafCount = ar->leafCount; 433 MinDet = new ActiveLeafNode[leafCount*2]; 907 434 // for (unsigned int i=0; i<nHojas*2; i++) 908 435 // MinDet[i]=ar->MinDet[i]; 909 memcpy(MinDet,ar->MinDet,sizeof(ActiveLeafNode)*nHojas*2); 910 TotHojas=ar->TotHojas; 911 cx=ar->cx; 912 cy=ar->cy; 913 cz=ar->cz; 914 rad=ar->rad; 915 minHojas=ar->minHojas; 916 TotVerts=ar->TotVerts; 436 memcpy(MinDet,ar->MinDet,sizeof(ActiveLeafNode)*leafCount*2); 437 leafTotal=ar->leafTotal; 438 minLeaves=ar->minLeaves; 439 TotalVerts=ar->TotalVerts; 917 440 918 441 create_vertex_data_func=ar->create_vertex_data_func; … … 945 468 int h=0; 946 469 947 Acth = new ActiveLeafNode[ nHojas*8];948 949 for ( h=0; h < nHojas; h++) {470 Acth = new ActiveLeafNode[leafCount*8]; 471 472 for ( h=0; h < leafCount; h++) { 950 473 951 474 Acth[h].index = h; … … 958 481 } 959 482 960 ppio= 0;961 final = nHojas-1;962 nhactivas = nHojas;963 964 } 483 begin = 0; 484 final = leafCount-1; 485 active_leaf_count = leafCount; 486 487 } -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/leaves/foliage.h
r1057 r1058 4 4 #include "GeoSubMesh.h" 5 5 #include "tlista.h" 6 #include "TMatrix.h"7 6 #include "VertexData.h" 8 7 #include "Leaf.h" … … 24 23 25 24 ActiveLeafNode *Acth; // first active leaf 26 int ppio, final; 27 int nhactivas; 28 TMatrix mat_aux; 25 int begin, final; 26 int active_leaf_count; 29 27 30 28 Foliage (const Geometry::SubMesh *, const char *simpSeq, Geometry::CREATEVERTEXDATAFUNC vdfun=NULL, Geometry::CREATEINDEXDATAFUNC idfun=NULL); … … 32 30 virtual ~Foliage (void); // Destructor 33 31 34 //culling 35 void Culling (float frustum[6][4]); 36 bool LeafinFrustum ( int i, float frustum[6][4]); 37 38 bool IsActive( int num) const; 39 int ResolucionV ( char c, float rva, float rvb,float rvc, float rvd, float radio); 40 void ColapsaHoja (int, int&); 41 void SplitHoja (int, int&); 42 bool Forzar_Split(int, int, int&); 43 int AnteriorActivo (int h); 44 int PosteriorActivo (int h); 45 46 47 // resolucion constante 48 int ResolucionC (float dist, float dmax, float dmin); 49 void AjusteHojas( int nhojas); 50 void RCecol ( int nhojas); 51 void RCsplit ( int nhojas); 32 void CalculateLOD(int nhojas); 52 33 53 34 Geometry::VertexData *vertexdata; … … 55 36 56 37 Leaf *Leaves; 57 ActiveLeafNode *MinDet; // primera hoja activa58 int nHojas;59 int TotHojas;38 ActiveLeafNode *MinDet; // first active leaf 39 int leafCount; 40 int leafTotal; 60 41 61 float cx,cy,cz; //centro de la copa// para los impostores y resolucion variable 62 float rad; //radio de la esfera envolvente 63 int minHojas; 64 int TotVerts; 42 int minLeaves; 43 int TotalVerts; 65 44 66 45 private: … … 68 47 Geometry::CREATEINDEXDATAFUNC create_index_data_func; 69 48 49 bool IsActive( int num) const; 50 int PrevActive (int h); 51 int NextActive (int h); 52 53 void RCecol(int nhojas); 54 void RCsplit(int nhojas); 55 70 56 void ReadLeafs(const Geometry::SubMesh *); 71 57 void ReadVertices(const Geometry::SubMesh *); 72 58 bool ReadSimpSeq(const char*); /// returns true when successful 73 void RellenoRaiz(void);59 void FillRoot(void); 74 60 75 61 void GetNormalH (Leaf&); 76 // void GetNormalT(Tronco&);77 62 78 63 void CrossProduct(const float *v1, const float *v2, float *res); 79 64 void Normalize(const float *v, float *res); 80 65 // void CalculaNormalesVertice(void); 81 void Calcula TexCoordsYNorms(void);66 void CalculateTexCoordsAndNorms(void); 82 67 83 68 };
Note: See TracChangeset
for help on using the changeset viewer.