Changeset 1070 for GTP/trunk/Lib/Geom/shared/GTGeometry/src
- Timestamp:
- 06/30/06 14:22:34 (19 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared/GTGeometry/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp
r1048 r1070 1 1 #include <iostream> 2 2 #include <fstream> 3 3 #include <time.h> 4 4 #include "GeoLodStripsConstructor.h" 5 5 6 6 using namespace Geometry; 7 7 8 9 //-------------------------------------------------------------------------- 10 //Call GenerarModeloV and CopiarVectorsArraysNUEVAED to make changes 11 //--------------------------------------------------------------------------- 12 // Se utiliza en el constructor sobrecargado. 8 //--------------------------------------------------------------------------- 9 // Call GenerarModeloV and CopiarVectorsArraysNUEVAED to make changes. 10 //--------------------------------------------------------------------------- 13 11 void LodStripsConstructor::GenerarModeloCompleto(TIPOFUNC upb) 14 12 { 15 13 float percent; 16 14 17 18 15 this->GenerarModeloV(upb); 19 16 this->CopiarVectors2ArraysNUEVAED(); … … 24 21 } 25 22 26 //--------------------------------------------------------------------------- --------27 // It makes Lods changes and count them28 //--------------------------------------------------------------------------- --------23 //--------------------------------------------------------------------------- 24 // It makes Lods changes and count them. 25 //--------------------------------------------------------------------------- 29 26 void LodStripsConstructor::CalcularCambiosLODsVNuevaED(TIPOFUNC upb) 30 27 { … … 203 200 204 201 205 r= 0; 206 k=cStripsT.size()-3; 202 r = 0; 203 204 k = (long)(cStripsT.size() - 3); 207 205 208 206 } … … 295 293 } 296 294 297 //----------------------------------------------------------------------- 295 //--------------------------------------------------------------------------- 298 296 //Put in order vertex of Mesh from simplification sequence 299 //----------------------------------------------------------------------- 300 #include <time.h> 297 //--------------------------------------------------------------------------- 301 298 void LodStripsConstructor::OrdenarModeloVQSLIM(TIPOFUNC upb) 302 299 { … … 326 323 bEncontrado = false; 327 324 328 int mStepsSize = geoMeshSQ->mSteps.size();325 size_t mStepsSize = mGeoMeshSQ->mSteps.size(); 329 326 330 327 c1 = 0; … … 343 340 } 344 341 345 const Geometry::MeshSimplificationSequence::Step & theStep = this-> geoMeshSQ->mSteps[i];342 const Geometry::MeshSimplificationSequence::Step & theStep = this->mGeoMeshSQ->mSteps[i]; 346 343 347 344 mV1Aux.push_back(theStep.mV1); … … 426 423 int contestaban = 0; 427 424 428 intcVertsSize = this->cVerts.size();425 size_t cVertsSize = this->cVerts.size(); 429 426 for(i = 0; i < cVertsSize; i++) 430 427 { … … 481 478 482 479 //Creacion de nuevas tiras con las mismas dimensiones 483 intcStripsSize = this->cStrips.size();480 size_t cStripsSize = this->cStrips.size(); 484 481 for(t = 0; t < cStripsSize; t++) 485 482 { 486 483 tira.clear(); 487 484 488 intcStripsSizeT = this->cStrips[t].size();485 size_t cStripsSizeT = this->cStrips[t].size(); 489 486 for(i = 0; i < cStripsSizeT; i++) 490 487 tira.push_back(0); … … 501 498 // 2 min. 502 499 //Cambiar los vertices de las tiras 503 intNuevosVertsSize = NuevosVerts.size();500 size_t NuevosVertsSize = NuevosVerts.size(); 504 501 for(v = 0; v < NuevosVertsSize; v++) 505 502 { … … 516 513 std::vector<int> & thisStrip = cStrips[t]; 517 514 std::vector<int> & NuevasTirasT = NuevasTiras[t]; 518 intcStripsSizeT = thisStrip.size();515 size_t cStripsSizeT = thisStrip.size(); 519 516 for(i = 0; i < cStripsSizeT; i++) 520 517 { … … 545 542 } 546 543 547 //--------------------------------------------------------------------------- --544 //--------------------------------------------------------------------------- 548 545 // Constructor of LodStripsConstructor object from 549 // a Mesh and MeshSimplificationSequence 550 // Constructor del objeto LodStripsConstructor. 551 // Tomamos el Mesh y la secuencia de simplificacion que se pasan 552 // como parametros y llamamos a la funcion GenerarModeloCompleto para 553 // que se realicen las modificaciones a efectuar 554 //----------------------------------------------------------------------------- 546 // a Mesh and MeshSimplificationSequence. 547 //--------------------------------------------------------------------------- 555 548 LodStripsConstructor::LodStripsConstructor(const Mesh *m, 556 549 const MeshSimplificationSequence *ms, … … 560 553 MARCA = TOTALTIRAS = TOTALVERTS = TOTALCAMBIOS = 0; 561 554 562 meshoriginal = m; 563 this->geoMesh = new Geometry::Mesh(); 564 *this->geoMesh = *m; 565 this->geoMeshSQ = const_cast<MeshSimplificationSequence*>(ms); 555 meshoriginal = m; 556 557 mGeoMesh = new Mesh(); 558 *mGeoMesh = *m; 559 560 mInitialMesh = new Mesh(); 561 *mInitialMesh = *m; 562 563 this->mGeoMeshSQ = const_cast<MeshSimplificationSequence*>(ms); 566 564 567 565 // Set the leaves submesh. 568 566 mSubMeshLeaves = submesh; 567 569 568 this->GenerarModeloCompleto(upb); 570 } 571 572 //--------------------------------------------- 569 570 // Sort submesh bones. 571 this->sortBones(); 572 } 573 574 //--------------------------------------------------------------------------- 573 575 // Destructor LodStripsConstructor object 574 // Destructor de la clase LodStripsConstructor 575 //--------------------------------------------- 576 //--------------------------------------------------------------------------- 576 577 LodStripsConstructor::~LodStripsConstructor() 577 578 { … … 600 601 delete [] pCambios; 601 602 602 delete this->geoMesh; 603 } 604 605 //------------------------------------------------------------------------------ 606 // build lod file with necessary information and save all changes at 607 // lodStripConstructor object 608 // Construimos el archivo Lod donde se guarda la informacion sobre los 609 // cambios realizados en el mesh 610 // y copiamos todos los cambios realizados sobre las estructuras que 611 // contienen los vertices y los indices 612 // modificados sobre el objeto Mesh de la clase 613 //------------------------------------------------------------------------------ 603 delete mInitialMesh; 604 delete mGeoMesh; 605 } 606 607 //--------------------------------------------------------------------------- 608 // Build lod file with necessary information and save all changes at 609 // lodStripConstructor object. 610 //--------------------------------------------------------------------------- 614 611 void LodStripsConstructor::Save(Serializer &oSerializer) 615 612 { … … 678 675 int num_no = 0; 679 676 680 if(this-> geoMesh->mSubMesh[0].mSharedVertexBuffer == true)677 if(this->mGeoMesh->mSubMesh[0].mSharedVertexBuffer == true) 681 678 { 682 679 //mPosition 683 delete[] this-> geoMesh->mVertexBuffer->mPosition;684 this-> geoMesh->mVertexBuffer->mPosition = new Vector3[this->cVerts.size()];680 delete[] this->mGeoMesh->mVertexBuffer->mPosition; 681 this->mGeoMesh->mVertexBuffer->mPosition = new Vector3[this->cVerts.size()]; 685 682 686 683 //mNormal 687 684 if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL) 688 685 { 689 delete[] this-> geoMesh->mVertexBuffer->mNormal;690 this-> geoMesh->mVertexBuffer->mNormal = new Vector3[this->cVerts.size()];686 delete[] this->mGeoMesh->mVertexBuffer->mNormal; 687 this->mGeoMesh->mVertexBuffer->mNormal = new Vector3[this->cVerts.size()]; 691 688 } 692 689 … … 694 691 if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS) 695 692 { 696 delete[] this-> geoMesh->mVertexBuffer->mTexCoords;697 this-> geoMesh->mVertexBuffer->mTexCoords = new Vector2[this->cVerts.size()];698 } 699 700 this-> geoMesh->mVertexBuffer->mVertexCount = this->cVerts.size();701 this-> geoMesh->mVertexBuffer->mVertexInfo = this->meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo;702 703 for(i = 0; i < this-> geoMesh->mSubMeshCount; i++)704 { 705 this-> geoMesh->mSubMesh[i].mVertexBuffer = this->geoMesh->mVertexBuffer;706 this-> geoMesh->mSubMesh[i].mSharedVertexBuffer = true;693 delete[] this->mGeoMesh->mVertexBuffer->mTexCoords; 694 this->mGeoMesh->mVertexBuffer->mTexCoords = new Vector2[this->cVerts.size()]; 695 } 696 697 this->mGeoMesh->mVertexBuffer->mVertexCount = this->cVerts.size(); 698 this->mGeoMesh->mVertexBuffer->mVertexInfo = this->meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo; 699 700 for(i = 0; i < this->mGeoMesh->mSubMeshCount; i++) 701 { 702 this->mGeoMesh->mSubMesh[i].mVertexBuffer = this->mGeoMesh->mVertexBuffer; 703 this->mGeoMesh->mSubMesh[i].mSharedVertexBuffer = true; 707 704 } 708 705 … … 712 709 { 713 710 //Copiamos las coordeandas de posicion 714 this-> geoMesh->mVertexBuffer->mPosition[indice].x = this->cVerts[j].Vertex[0];715 this-> geoMesh->mVertexBuffer->mPosition[indice].y = this->cVerts[j].Vertex[1];716 this-> geoMesh->mVertexBuffer->mPosition[indice].z = this->cVerts[j].Vertex[2];711 this->mGeoMesh->mVertexBuffer->mPosition[indice].x = this->cVerts[j].Vertex[0]; 712 this->mGeoMesh->mVertexBuffer->mPosition[indice].y = this->cVerts[j].Vertex[1]; 713 this->mGeoMesh->mVertexBuffer->mPosition[indice].z = this->cVerts[j].Vertex[2]; 717 714 718 715 //Copiamos las normales 719 716 if (meshoriginal->mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL) 720 717 { 721 this-> geoMesh->mVertexBuffer->mNormal[indice].x = this->cVerts[j].Normal[0];722 this-> geoMesh->mVertexBuffer->mNormal[indice].y = this->cVerts[j].Normal[1];723 this-> geoMesh->mVertexBuffer->mNormal[indice].z = this->cVerts[j].Normal[2];718 this->mGeoMesh->mVertexBuffer->mNormal[indice].x = this->cVerts[j].Normal[0]; 719 this->mGeoMesh->mVertexBuffer->mNormal[indice].y = this->cVerts[j].Normal[1]; 720 this->mGeoMesh->mVertexBuffer->mNormal[indice].z = this->cVerts[j].Normal[2]; 724 721 } 725 722 … … 727 724 if (meshoriginal->mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS) 728 725 { 729 this-> geoMesh->mVertexBuffer->mTexCoords[indice].x = this->cVerts[j].TexCoords[0];730 this-> geoMesh->mVertexBuffer->mTexCoords[indice].y = this->cVerts[j].TexCoords[1];726 this->mGeoMesh->mVertexBuffer->mTexCoords[indice].x = this->cVerts[j].TexCoords[0]; 727 this->mGeoMesh->mVertexBuffer->mTexCoords[indice].y = this->cVerts[j].TexCoords[1]; 731 728 } 732 729 … … 735 732 } 736 733 737 this-> geoMesh->mVertexBuffer->mVertexCount = indice;734 this->mGeoMesh->mVertexBuffer->mVertexCount = indice; 738 735 } 739 736 else //OSCAR … … 741 738 //Supondre que solo tengo un submesh con vertices no compartidos 742 739 //mPosition 743 delete[] this-> geoMesh->mSubMesh[0].mVertexBuffer->mPosition;740 delete[] this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition; 744 741 745 this-> geoMesh->mSubMesh[0].mVertexBuffer->mPosition = new Vector3[this->cVerts.size()];742 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition = new Vector3[this->cVerts.size()]; 746 743 747 744 //mNormal 748 745 if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL) 749 746 { 750 delete[] this-> geoMesh->mSubMesh[0].mVertexBuffer->mNormal;751 this-> geoMesh->mSubMesh[0].mVertexBuffer->mNormal = new Vector3[this->cVerts.size()];747 delete[] this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal; 748 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal = new Vector3[this->cVerts.size()]; 752 749 } 753 750 … … 755 752 if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS) 756 753 { 757 delete[] this-> geoMesh->mSubMesh[0].mVertexBuffer->mTexCoords;758 this-> geoMesh->mSubMesh[0].mVertexBuffer->mTexCoords = new Vector2[this->cVerts.size()];759 } 760 761 this-> geoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =this->cVerts.size();762 this-> geoMesh->mSubMesh[0].mVertexBuffer->mVertexInfo = this->meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo;763 764 this-> geoMesh->mSubMesh[0].mSharedVertexBuffer=false;754 delete[] this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords; 755 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords = new Vector2[this->cVerts.size()]; 756 } 757 758 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =this->cVerts.size(); 759 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexInfo = this->meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo; 760 761 this->mGeoMesh->mSubMesh[0].mSharedVertexBuffer=false; 765 762 766 763 int indice=0; … … 768 765 { 769 766 //Copiamos las coordeandas de posicion 770 this-> geoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].x=this->cVerts[j].Vertex[0];771 this-> geoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].y=this->cVerts[j].Vertex[1];772 this-> geoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].z=this->cVerts[j].Vertex[2];767 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].x=this->cVerts[j].Vertex[0]; 768 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].y=this->cVerts[j].Vertex[1]; 769 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mPosition[indice].z=this->cVerts[j].Vertex[2]; 773 770 774 771 //Copiamos las normales 775 772 if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL) 776 773 { 777 this-> geoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].x=this->cVerts[j].Normal[0];778 this-> geoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].y=this->cVerts[j].Normal[1];779 this-> geoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].z=this->cVerts[j].Normal[2];774 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].x=this->cVerts[j].Normal[0]; 775 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].y=this->cVerts[j].Normal[1]; 776 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mNormal[indice].z=this->cVerts[j].Normal[2]; 780 777 } 781 778 … … 783 780 if (meshoriginal->mSubMesh[0].mVertexBuffer->mVertexInfo & Geometry::VERTEX_TEXCOORDS) 784 781 { 785 this-> geoMesh->mSubMesh[0].mVertexBuffer->mTexCoords[indice].x=this->cVerts[j].TexCoords[0];786 this-> geoMesh->mSubMesh[0].mVertexBuffer->mTexCoords[indice].y=this->cVerts[j].TexCoords[1];782 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords[indice].x=this->cVerts[j].TexCoords[0]; 783 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mTexCoords[indice].y=this->cVerts[j].TexCoords[1]; 787 784 } 788 785 indice++; 789 786 } 790 this-> geoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =indice;787 this->mGeoMesh->mSubMesh[0].mVertexBuffer->mVertexCount =indice; 791 788 } 792 789 … … 794 791 795 792 int indice_acum = 0; 796 for(i=0;i<this-> geoMesh->mSubMeshCount;i++)793 for(i=0;i<this->mGeoMesh->mSubMeshCount;i++) 797 794 { 798 795 Geometry::SubMesh & subMesh = meshoriginal->mSubMesh[i]; 799 Geometry::SubMesh & geoMeshSubMesh = this->geoMesh->mSubMesh[i];796 Geometry::SubMesh & mGeoMeshSubMesh = this->mGeoMesh->mSubMesh[i]; 800 797 801 798 for (size_t ind=0; ind < subMesh.mIndexCount; ind++) … … 807 804 if(subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL) 808 805 { 809 for (size_t indvo=0; indvo< geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)810 { 811 if (igual(subMesh.mVertexBuffer->mPosition[indIndex], geoMeshSubMesh.mVertexBuffer->mPosition[indvo]))806 for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++) 807 { 808 if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo])) 812 809 { 813 if (igual(subMesh.mVertexBuffer->mNormal[indIndex], geoMeshSubMesh.mVertexBuffer->mNormal[indvo]))810 if (igual(subMesh.mVertexBuffer->mNormal[indIndex],mGeoMeshSubMesh.mVertexBuffer->mNormal[indvo])) 814 811 { 815 if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex], geoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))812 if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],mGeoMeshSubMesh.mVertexBuffer->mTexCoords[indvo])) 816 813 { 817 geoMeshSubMesh.mIndex[ind]= int(indvo);//+indice_acum;814 mGeoMeshSubMesh.mIndex[ind]= int(indvo);//+indice_acum; 818 815 } 819 816 } … … 823 820 else //Hay coordenadas de textura pero no hay normales 824 821 { 825 for (size_t indvo=0; indvo< geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)826 { 827 if (igual(subMesh.mVertexBuffer->mPosition[indIndex], geoMeshSubMesh.mVertexBuffer->mPosition[indvo]))822 for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++) 823 { 824 if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo])) 828 825 { 829 if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex], geoMeshSubMesh.mVertexBuffer->mTexCoords[indvo]))826 if (igual(subMesh.mVertexBuffer->mTexCoords[indIndex],mGeoMeshSubMesh.mVertexBuffer->mTexCoords[indvo])) 830 827 { 831 geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;828 mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum; 832 829 } 833 830 } … … 840 837 if(subMesh.mVertexBuffer->mVertexInfo & Geometry::VERTEX_NORMAL) 841 838 { 842 for (size_t indvo=0; indvo< geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)843 { 844 if (igual(subMesh.mVertexBuffer->mPosition[indIndex], geoMeshSubMesh.mVertexBuffer->mPosition[indvo]))839 for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++) 840 { 841 if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo])) 845 842 { 846 if (igual(subMesh.mVertexBuffer->mNormal[indIndex], geoMeshSubMesh.mVertexBuffer->mNormal[indvo]))843 if (igual(subMesh.mVertexBuffer->mNormal[indIndex],mGeoMeshSubMesh.mVertexBuffer->mNormal[indvo])) 847 844 { 848 geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;845 mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum; 849 846 } 850 847 } … … 853 850 else //No hay coordenadas de texturas ni normales 854 851 { 855 for (size_t indvo=0; indvo< geoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++)856 { 857 if (igual(subMesh.mVertexBuffer->mPosition[indIndex], geoMeshSubMesh.mVertexBuffer->mPosition[indvo]))852 for (size_t indvo=0; indvo<mGeoMeshSubMesh.mVertexBuffer->mVertexCount; indvo++) 853 { 854 if (igual(subMesh.mVertexBuffer->mPosition[indIndex],mGeoMeshSubMesh.mVertexBuffer->mPosition[indvo])) 858 855 { 859 geoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum;856 mGeoMeshSubMesh.mIndex[ind]=int(indvo);//+indice_acum; 860 857 } 861 858 } … … 887 884 } 888 885 889 //----------------------------------------------------------------------------------------------- 890 //Call leeVerticesyTirasDeMesh, OrdenarModeloVQSLIM and CalcularCambiosLODsVNuevaED to make changes 891 //at vertex and index strutures 892 //Llama a los metodos que realizan los cambios sobre las estructuras que contienen la informacion 893 //de los vertices y los indices 894 //----------------------------------------------------------------------------------------------- 895 886 //--------------------------------------------------------------------------- 887 // Call leeVerticesyTirasDeMesh, OrdenarModeloVQSLIM 888 // and CalcularCambiosLODsVNuevaED to make changes at vertex 889 // and index strutures. 890 //--------------------------------------------------------------------------- 896 891 void LodStripsConstructor::GenerarModeloV(TIPOFUNC upb) 897 892 { … … 927 922 } 928 923 929 //----------------------------------------------------------------------------------------- 930 //It fills structs with vertex and index information 931 //Rellena estructuras de datos que contienen la informacion de vertices y tiras modificadas 932 //----------------------------------------------------------------------------------------- 924 //--------------------------------------------------------------------------- 925 // It fills structs with vertex and index information. 926 //--------------------------------------------------------------------------- 933 927 void LodStripsConstructor::CopiarVectors2ArraysNUEVAED() 934 928 { … … 1002 996 } 1003 997 1004 //--------------------------------------------------------------------------- ------------------------1005 // It fills cVerts and cStrips with original Mesh vertex and strips information1006 // Rellena las estructuras cVerts Y cStrips a partir de de los vertices y las tiras del mesh original1007 //--------------------------------------------------------------------------- ------------------------998 //--------------------------------------------------------------------------- 999 // It fills cVerts and cStrips with original Mesh vertex and strips 1000 // information. 1001 //--------------------------------------------------------------------------- 1008 1002 void LodStripsConstructor::leeVerticesyTirasDeMesh() 1009 1003 { … … 1016 1010 error = false; 1017 1011 1018 if(this-> geoMesh->mSubMeshCount == 1)1012 if(this->mGeoMesh->mSubMeshCount == 1) 1019 1013 { 1020 1014 error = false; … … 1022 1016 else 1023 1017 { 1024 for (i = 0; i < this-> geoMesh->mSubMeshCount;i++)1025 { 1026 if (this-> geoMesh->mSubMesh[i].mSharedVertexBuffer == true)1018 for (i = 0; i < this->mGeoMesh->mSubMeshCount;i++) 1019 { 1020 if (this->mGeoMesh->mSubMesh[i].mSharedVertexBuffer == true) 1027 1021 { 1028 1022 error = false; … … 1038 1032 if(!error) 1039 1033 { 1040 if ( (this-> geoMesh->mSubMesh[0].mSharedVertexBuffer == true)1034 if ( (this->mGeoMesh->mSubMesh[0].mSharedVertexBuffer == true) 1041 1035 && 1042 (this-> geoMesh->mSubMeshCount > 1)1036 (this->mGeoMesh->mSubMeshCount > 1) 1043 1037 ) 1044 1038 { 1045 for (j = 0; j < this-> geoMesh->mVertexBuffer->mVertexCount; j++)1039 for (j = 0; j < this->mGeoMesh->mVertexBuffer->mVertexCount; j++) 1046 1040 { 1047 1041 // Si hay mas de un submesh ListaIndices no se rellena correctamente 1048 vAux.Vertex[0] = this-> geoMesh->mVertexBuffer->mPosition[j].x;1049 vAux.Vertex[1] = this-> geoMesh->mVertexBuffer->mPosition[j].y;1050 vAux.Vertex[2] = this-> geoMesh->mVertexBuffer->mPosition[j].z;1042 vAux.Vertex[0] = this->mGeoMesh->mVertexBuffer->mPosition[j].x; 1043 vAux.Vertex[1] = this->mGeoMesh->mVertexBuffer->mPosition[j].y; 1044 vAux.Vertex[2] = this->mGeoMesh->mVertexBuffer->mPosition[j].z; 1051 1045 1052 1046 // Añadimos las normales en cVerts. 1053 if ( this-> geoMesh->mVertexBuffer->mVertexInfo1047 if ( this->mGeoMesh->mVertexBuffer->mVertexInfo 1054 1048 & 1055 1049 Geometry::VERTEX_NORMAL 1056 1050 ) 1057 1051 { 1058 vAux.Normal[0] = this-> geoMesh->mVertexBuffer->mNormal[j].x;1059 vAux.Normal[1] = this-> geoMesh->mVertexBuffer->mNormal[j].y;1060 vAux.Normal[2] = this-> geoMesh->mVertexBuffer->mNormal[j].z;1052 vAux.Normal[0] = this->mGeoMesh->mVertexBuffer->mNormal[j].x; 1053 vAux.Normal[1] = this->mGeoMesh->mVertexBuffer->mNormal[j].y; 1054 vAux.Normal[2] = this->mGeoMesh->mVertexBuffer->mNormal[j].z; 1061 1055 } 1062 1056 1063 1057 // Añadimos las coordenadas de textura a cVerts. 1064 if ( this-> geoMesh->mVertexBuffer->mVertexInfo1058 if ( this->mGeoMesh->mVertexBuffer->mVertexInfo 1065 1059 & 1066 1060 Geometry::VERTEX_TEXCOORDS 1067 1061 ) 1068 1062 { 1069 vAux.TexCoords[0] = this-> geoMesh->mVertexBuffer->mTexCoords[j].x;1070 vAux.TexCoords[1] = this-> geoMesh->mVertexBuffer->mTexCoords[j].y;1063 vAux.TexCoords[0] = this->mGeoMesh->mVertexBuffer->mTexCoords[j].x; 1064 vAux.TexCoords[1] = this->mGeoMesh->mVertexBuffer->mTexCoords[j].y; 1071 1065 } 1072 1066 … … 1081 1075 else 1082 1076 { 1083 for (i = 0; i < this-> geoMesh->mSubMeshCount; i++)1077 for (i = 0; i < this->mGeoMesh->mSubMeshCount; i++) 1084 1078 { 1085 1079 for ( j = 0; 1086 j < this-> geoMesh->mSubMesh[i].mVertexBuffer->mVertexCount;1080 j < this->mGeoMesh->mSubMesh[i].mVertexBuffer->mVertexCount; 1087 1081 j++) 1088 1082 { 1089 1083 // Si hay mas de un submesh ListaIndices 1090 1084 // no se rellena correctamente. 1091 vAux.Vertex[0] = this-> geoMesh->mSubMesh[i].1085 vAux.Vertex[0] = this->mGeoMesh->mSubMesh[i]. 1092 1086 mVertexBuffer->mPosition[j].x; 1093 vAux.Vertex[1] = this-> geoMesh->mSubMesh[i].1087 vAux.Vertex[1] = this->mGeoMesh->mSubMesh[i]. 1094 1088 mVertexBuffer->mPosition[j].y; 1095 vAux.Vertex[2] = this-> geoMesh->mSubMesh[i].1089 vAux.Vertex[2] = this->mGeoMesh->mSubMesh[i]. 1096 1090 mVertexBuffer->mPosition[j].z; 1097 1091 // Añadimos las normales en cVerts. 1098 vAux.Normal[0] = this-> geoMesh->mSubMesh[i].1092 vAux.Normal[0] = this->mGeoMesh->mSubMesh[i]. 1099 1093 mVertexBuffer->mNormal[j].x; 1100 vAux.Normal[1] = this-> geoMesh->mSubMesh[i].1094 vAux.Normal[1] = this->mGeoMesh->mSubMesh[i]. 1101 1095 mVertexBuffer->mNormal[j].y; 1102 vAux.Normal[2] = this-> geoMesh->mSubMesh[i].1096 vAux.Normal[2] = this->mGeoMesh->mSubMesh[i]. 1103 1097 mVertexBuffer->mNormal[j].z; 1104 1098 1105 1099 // Añadimos las coordenadas de textura a cVerts. 1106 vAux.TexCoords[0] = this-> geoMesh->mSubMesh[i].1100 vAux.TexCoords[0] = this->mGeoMesh->mSubMesh[i]. 1107 1101 mVertexBuffer->mTexCoords[j].x; 1108 vAux.TexCoords[1] = this-> geoMesh->mSubMesh[i].1102 vAux.TexCoords[1] = this->mGeoMesh->mSubMesh[i]. 1109 1103 mVertexBuffer->mTexCoords[j].y; 1110 1104 … … 1122 1116 num_vert = 0; 1123 1117 1124 for (i = 0; i < this-> geoMesh->mSubMeshCount; i++)1118 for (i = 0; i < this->mGeoMesh->mSubMeshCount; i++) 1125 1119 { 1126 1120 // If is not the leaves submesh. … … 1129 1123 indice_acum = 0; 1130 1124 1131 for (j = 0; j < this-> geoMesh->mSubMesh[i].mStripCount; j++)1132 { 1133 Index *aux = this-> geoMesh->mSubMesh[i].mStrip[j];1125 for (j = 0; j < this->mGeoMesh->mSubMesh[i].mStripCount; j++) 1126 { 1127 Index *aux = this->mGeoMesh->mSubMesh[i].mStrip[j]; 1134 1128 1135 1129 /* … … 1143 1137 */ 1144 1138 1145 if (j+1 < this-> geoMesh->mSubMesh[i].mStripCount)1146 { 1147 Index *siguiente = this-> geoMesh->mSubMesh[i].mStrip[j+1];1139 if (j+1 < this->mGeoMesh->mSubMesh[i].mStripCount) 1140 { 1141 Index *siguiente = this->mGeoMesh->mSubMesh[i].mStrip[j+1]; 1148 1142 1149 1143 tira.clear(); … … 1167 1161 1168 1162 for ( unsigned int k = indice_acum; 1169 k < this-> geoMesh->mSubMesh[i].mIndexCount;1163 k < this->mGeoMesh->mSubMesh[i].mIndexCount; 1170 1164 k++) 1171 1165 { 1172 tira.push_back(this-> geoMesh->mSubMesh[i].mIndex[k]);1166 tira.push_back(this->mGeoMesh->mSubMesh[i].mIndex[k]); 1173 1167 } 1174 1168 … … 1177 1171 } 1178 1172 1179 num_vert += int(this-> geoMesh->mSubMesh[i].1173 num_vert += int(this->mGeoMesh->mSubMesh[i]. 1180 1174 mVertexBuffer->mVertexCount); 1181 1175 } … … 1191 1185 } 1192 1186 1187 //--------------------------------------------------------------------------- 1193 1188 // GetMesh: Return de current Mesh. 1189 //--------------------------------------------------------------------------- 1194 1190 Mesh * LodStripsConstructor::GetMesh() 1195 1191 { … … 1197 1193 1198 1194 mesh_built = new Mesh(); 1199 *mesh_built = * geoMesh;1195 *mesh_built = *mGeoMesh; 1200 1196 1201 1197 return mesh_built; 1202 1198 } 1203 1199 1200 //--------------------------------------------------------------------------- 1204 1201 // Sets what is the submesh that stores the leaves. 1202 //--------------------------------------------------------------------------- 1205 1203 void LodStripsConstructor::SetSubMeshLeaves(size_t submesh) 1206 1204 { … … 1208 1206 } 1209 1207 1208 //--------------------------------------------------------------------------- 1209 // Sort submesh bones. 1210 //--------------------------------------------------------------------------- 1211 void LodStripsConstructor::sortBones() 1212 { 1213 bool shared_found; 1214 int n; 1215 int o; 1216 int p; 1217 VertexBoneAssignment assign; 1218 SubMesh *submesh; 1219 SubMesh *copysubmesh; 1220 VertexBuffer *mesh_vb; 1221 VertexBuffer *copy_vb; 1222 1223 std::vector<VertexBoneAssignment> *mesh_bones; 1224 std::vector<VertexBoneAssignment> *copy_bones; 1225 1226 // Initialize shared vertex flag. 1227 shared_found = false; 1228 1229 // For each submesh. 1230 for (size_t i = 0; i < mGeoMesh->mSubMeshCount; i++) 1231 { 1232 submesh = &mGeoMesh->mSubMesh[i]; 1233 copysubmesh = &mInitialMesh->mSubMesh[i]; 1234 1235 // If submesh has shared vertex. 1236 if (submesh->mSharedVertexBuffer) 1237 { 1238 if (shared_found) 1239 { 1240 continue; 1241 } 1242 1243 shared_found = true; 1244 1245 // Vertex buffers. 1246 mesh_vb = mGeoMesh->mVertexBuffer; 1247 copy_vb = mInitialMesh->mVertexBuffer; 1248 1249 // Bones. 1250 mesh_bones = &mGeoMesh->mBones; 1251 copy_bones = &mInitialMesh->mBones; 1252 } 1253 else 1254 { 1255 // Vertex buffers. 1256 mesh_vb = submesh->mVertexBuffer; 1257 copy_vb = copysubmesh->mVertexBuffer; 1258 1259 // Bones. 1260 mesh_bones = &submesh->mBones; 1261 copy_bones = ©submesh->mBones; 1262 } 1263 1264 if (!mesh_bones->empty()) 1265 { 1266 assign.boneIndex = 0; 1267 assign.weight = 1; 1268 1269 for ( size_t m = copy_vb->mVertexCount; 1270 m < mesh_vb->mVertexCount; 1271 m++) 1272 { 1273 assign.vertexIndex = (unsigned int)m; 1274 1275 mesh_bones->push_back(assign); 1276 } 1277 1278 // Change bones. 1279 for (size_t m = 0; m < mesh_bones->size(); m++) 1280 { 1281 n = (*mesh_bones)[m].vertexIndex; 1282 1283 o = 0; 1284 1285 while (!( (mesh_vb->mPosition[n].x == copy_vb->mPosition[o].x) 1286 && 1287 (mesh_vb->mPosition[n].y == copy_vb->mPosition[o].y) 1288 && 1289 (mesh_vb->mPosition[n].z == copy_vb->mPosition[o].z))) 1290 { 1291 o++; 1292 } 1293 1294 p = 0; 1295 1296 while ((*copy_bones)[p].vertexIndex != o) 1297 { 1298 p++; 1299 } 1300 1301 // Same bone for 'm' and 'p'. 1302 (*mesh_bones)[m].boneIndex = (*copy_bones)[p].boneIndex; 1303 } 1304 1305 // Look for repeated bones. 1306 for (size_t m = 0; m < mesh_vb->mVertexCount; m++) 1307 { 1308 for (size_t n = m + 1; n < mesh_vb->mVertexCount; n++) 1309 { 1310 if ((mesh_vb->mPosition[m].x == mesh_vb->mPosition[n].x) 1311 && 1312 (mesh_vb->mPosition[m].y == mesh_vb->mPosition[n].y) 1313 && 1314 (mesh_vb->mPosition[m].z == mesh_vb->mPosition[n].z)) 1315 { 1316 o = 0; 1317 1318 while ((*mesh_bones)[o].vertexIndex != m) 1319 { 1320 o++; 1321 } 1322 1323 p = 0; 1324 1325 while ((*mesh_bones)[p].vertexIndex != n) 1326 { 1327 p++; 1328 } 1329 1330 if ((*mesh_bones)[o].boneIndex != (*mesh_bones)[p].boneIndex) 1331 { 1332 printf("-->Error en los vertices %d y %d\n",m,n); 1333 } 1334 } 1335 } 1336 } 1337 } 1338 } 1339 } 1340 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp
r1069 r1070 83 83 uint32 return_value; 84 84 85 uint32 newLOD = ( 1.0f-lodfactor) * mLods;85 uint32 newLOD = (uint32)((1.0f - lodfactor) * mLods); 86 86 87 87 // Initialize the return value to the current LOD. … … 352 352 void LodStripsLibrary::CopyVectors2Arrays() 353 353 { 354 unsigned int i;355 unsigned int j;356 354 SmallInt max; 357 355 SmallInt t; … … 372 370 // unsigned int * strip_sizes = new unsigned int[mFileStrips.size()]; 373 371 unsigned int total_strip_size = 0; 374 for (i = 0; i < mFileStrips.size(); i++) 372 373 for (unsigned int i = 0; i < mFileStrips.size(); i++) 375 374 { 376 375 total_strip_size += t = int(mFileStrips[i].size()); … … 383 382 384 383 // Fill up changes array. 385 for ( i = 0; i < mFileChangesLOD.size(); ++i)384 for (unsigned int i = 0; i < mFileChangesLOD.size(); ++i) 386 385 { 387 386 changes_array[i] = mFileChangesLOD[i]; … … 392 391 // Copy strips. 393 392 dataRetrievalInterface=create_index_data_func(total_strip_size); 394 dataRetrievalInterface->Begin(); 395 for (int ii = 0, i = 0; i < mFileStrips.size(); i++) 396 { 397 for (j = 0; j < mFileStrips[i].size(); j++,ii++) 393 dataRetrievalInterface->Begin(); 394 395 unsigned int ii = 0; 396 397 for (unsigned int i = 0; i < mFileStrips.size(); i++) 398 { 399 for (unsigned int j = 0; j < mFileStrips[i].size(); j++,ii++) 398 400 { 399 401 mStrips[i].push_back(mFileStrips[i][j]); … … 406 408 dataRetrievalInterface->End(); 407 409 408 for ( i = 0; i < mData.size(); i++)410 for (unsigned int i = 0; i < mData.size(); i++) 409 411 { 410 412 data_array[i] = mData[i]; … … 414 416 415 417 // Fill up mVertex. 416 for( i = 0; i < mFileVertices.size(); i++)418 for(unsigned int i = 0; i < mFileVertices.size(); i++) 417 419 { 418 420 mVertex[i] = mFileVertices[i]; … … 444 446 SubMesh *geoSubMesh; 445 447 446 447 448 448 // For each one of the submeshes. 449 449 for (unsigned int submesh = 0; submesh < geomesh->mSubMeshCount; submesh++) … … 496 496 } 497 497 498 // TODO: LOD file loaded in load file mesh process. 498 499 // Open the LOD file. 499 500 if ((fp = fopen (name, "r")) == NULL) … … 574 575 } 575 576 576 577 577 void LodStripsLibrary::UpdateDataRetrievalInterface(void) 578 578 { 579 unsigned int ii = 0; 580 579 581 dataRetrievalInterface->Begin(); 580 for (int i=0, ii=0; i<mTotalStrips; i++) 582 583 for (unsigned int i=0; i<mTotalStrips; i++) 581 584 { 582 585 for (SmallIntVector::iterator it=mStrips[i].begin(); it!=mStrips[i].end(); it++, ii++) -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp
r1069 r1070 89 89 void LodTreeLibrary::GoToFoliageLod(float newlod) 90 90 { 91 uint32 targetLeaves = (1.0f-newlod)*foliage->minLeaves + newlod*foliage->leafCount; 91 uint32 targetLeaves = (uint32) 92 ( 93 (1.0f - newlod) 94 * 95 foliage->minLeaves 96 + 97 newlod 98 * 99 foliage->leafCount 100 ); 101 92 102 foliage->CalculateLOD(targetLeaves); 93 103 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMesh.cpp
r1009 r1070 514 514 } 515 515 516 // Shared bones. 517 if (!mSubMesh[i].mBones.empty()) 518 { 519 for (unsigned int j = 0; j < mSubMesh[i].mBones.size(); j++) 520 { 521 mesh->mBones.push_back(mSubMesh[i].mBones[j]); 522 523 mesh->mBones.back().vertexIndex += acumVerts; 524 } 525 } 526 516 527 acumVerts += long(mSubMesh[i].mVertexBuffer->mVertexCount); 517 518 // Copy submesh bones.519 if (!mSubMesh[i].mBones.empty())520 {521 for (unsigned int j = 0; j < mSubMesh[i].mBones.size(); j++)522 {523 mesh->mSubMesh[i].mBones.push_back(mSubMesh[i].mBones[j]);524 }525 }526 527 528 } 528 529 … … 535 536 } 536 537 538 /* 537 539 // Copy mesh bones. 538 540 if (!mBones.empty()) … … 543 545 } 544 546 } 547 */ 545 548 546 549 return mesh; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp
r1024 r1070 20 20 TIPOFUNC upb) 21 21 { 22 // Saves initial state of mesh. 23 mInitialMesh = new Mesh(); 24 *mInitialMesh = *m; 25 22 26 objmesh = m; 23 27 mGeoMesh = NULL; … … 34 38 MeshSimplifier::~MeshSimplifier() 35 39 { 36 delete msimpsequence; 40 delete mInitialMesh; 41 delete msimpsequence; 37 42 } 38 43 … … 66 71 void MeshSimplifier::sortBones() 67 72 { 68 Mesh *mesh_copy;73 bool shared_found; 69 74 int n; 70 75 int o; … … 72 77 VertexBoneAssignment assign; 73 78 VertexBuffer *mesh_vb; 74 VertexBuffer * undo_vb;79 VertexBuffer *copy_vb; 75 80 SubMesh *geosubmesh; 76 SubMesh *undosubmesh; 77 78 // Gets a copy of the mesh. 79 mesh_copy = new Mesh(); 80 *mesh_copy = *mGeoMesh; 81 81 SubMesh *copysubmesh; 82 83 std::vector<VertexBoneAssignment> *mesh_bones; 84 std::vector<VertexBoneAssignment> *copy_bones; 85 86 // Initialize shared flag. 87 shared_found = false; 88 82 89 // For each submesh. 83 90 for (size_t i = 0; i < mGeoMesh->mSubMeshCount; i++) 84 91 { 85 92 geosubmesh = &mGeoMesh->mSubMesh[i]; 86 undosubmesh = &mesh_copy->mSubMesh[i]; 93 copysubmesh = &mInitialMesh->mSubMesh[i]; 94 95 // If submesh has shared vertex. 96 if (geosubmesh->mSharedVertexBuffer) 97 { 98 if (shared_found) 99 { 100 continue; 101 } 102 103 shared_found = true; 104 105 // Vertex buffers. 106 mesh_vb = mGeoMesh->mVertexBuffer; 107 copy_vb = mInitialMesh->mVertexBuffer; 108 109 // Bones. 110 mesh_bones = &mGeoMesh->mBones; 111 copy_bones = &mInitialMesh->mBones; 112 } 113 else 114 { 115 // Vertex buffers. 116 mesh_vb = geosubmesh->mVertexBuffer; 117 copy_vb = copysubmesh->mVertexBuffer; 118 119 // Bones. 120 mesh_bones = &geosubmesh->mBones; 121 copy_bones = ©submesh->mBones; 122 } 87 123 88 124 // If there is submesh bones. 89 if (! geosubmesh->mBones.empty())125 if (!mesh_bones->empty()) 90 126 { 91 127 assign.boneIndex = 0; 92 128 assign.weight = 1; 93 129 94 geosubmesh->mBones.clear();95 96 for ( int m = 0; m < geosubmesh->mVertexBuffer->mVertexCount; m++)130 mesh_bones->clear(); 131 132 for (size_t m = 0; m < mesh_vb->mVertexCount; m++) 97 133 { 98 assign.vertexIndex = m;134 assign.vertexIndex = (int)m; 99 135 100 geosubmesh->mBones.push_back(assign);136 mesh_bones->push_back(assign); 101 137 } 102 138 103 139 // Change bones. 104 for ( int m = 0; m < geosubmesh->mBones.size(); m++)140 for (size_t m = 0; m < mesh_bones->size(); m++) 105 141 { 106 n = geosubmesh->mBones[m].vertexIndex;142 n = (*mesh_bones)[m].vertexIndex; 107 143 108 144 // Initialize o. 109 145 o = 0; 110 146 111 mesh_vb = geosubmesh->mVertexBuffer;112 undo_vb = undosubmesh->mVertexBuffer;113 114 147 while (!( 115 (mesh_vb->mPosition[n].x == undo_vb->mPosition[o].x)148 (mesh_vb->mPosition[n].x == copy_vb->mPosition[o].x) 116 149 && 117 (mesh_vb->mPosition[n].y == undo_vb->mPosition[o].y)150 (mesh_vb->mPosition[n].y == copy_vb->mPosition[o].y) 118 151 && 119 (mesh_vb->mPosition[n].z == undo_vb->mPosition[o].z)152 (mesh_vb->mPosition[n].z == copy_vb->mPosition[o].z) 120 153 )) 121 154 { … … 126 159 p = 0; 127 160 128 while ( undosubmesh->mBones[p].vertexIndex != o)161 while ((*copy_bones)[p].vertexIndex != o) 129 162 { 130 163 p++; … … 132 165 133 166 // Same bone for 'm' and 'p'. 134 geosubmesh->mBones[m].boneIndex = undosubmesh->mBones[p].boneIndex;167 (*mesh_bones)[m].boneIndex = (*copy_bones)[p].boneIndex; 135 168 } 136 169 } 137 170 } 138 171 139 // Delete copy of the mesh.140 delete mesh_copy;141 172 } 142 173 … … 176 207 mGeoMesh = m_qslim->GetMesh(); 177 208 209 // Sort bones. 210 sortBones(); 211 178 212 delete m_qslim; 179 213 } … … 191 225 192 226 mGeoMesh = m_qslim->GetMesh(); 227 228 // Sort bones. 229 sortBones(); 193 230 194 231 delete m_qslim; … … 278 315 279 316 VMI::initialIs = VMI::initIs(VMI::numCameras); 280 281 317 } 282 318 … … 313 349 loadMesh(); 314 350 351 // Sort bones. 352 sortBones(); 353 315 354 GetMeshSimpSequence(); 316 355 } … … 339 378 loadMesh(); 340 379 380 // Sort bones. 381 sortBones(); 382 341 383 GetMeshSimpSequence(); 342 384 } -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshStripifier.cpp
r1009 r1070 36 36 37 37 //----------------------------------------------------------------------------- 38 // /AddHead.38 // AddHead. 39 39 //----------------------------------------------------------------------------- 40 40 BOOL CustomStripifier::AddHead(PLISTHEAD LHead, PLISTINFO LInfo) … … 8452 8452 { 8453 8453 v_indices = mi_vector[i]; 8454 geoSubMesh->mIndexCount += v_indices.size() /*+ 2*/; 8455 8456 /* 8454 geoSubMesh->mIndexCount += v_indices.size() + 2; 8455 8457 8456 // Insert a new vertex if the strip es odd. 8458 8457 if(oddStrip) … … 8470 8469 oddStrip = FALSE; 8471 8470 } 8472 */8473 8471 } 8474 8472 … … 8483 8481 // Obtiene el total de indices de la primera strip. 8484 8482 //geoSubMesh->mIndexCount = v_indices.size(); 8485 8486 8487 8483 8488 8484 // Copia la primera tira en el array de indices. … … 8503 8499 //----------------------- 8504 8500 8505 /*8506 8501 // Number of vertices of a strip odd or even. 8507 8502 if(v_indices.size() % 2) … … 8513 8508 oddStrip = FALSE; 8514 8509 } 8515 */8516 8510 8517 8511 // Para todas las tiras menos la primera. 8518 8512 for(i = 2; i <= num_tiras; i++) 8519 8513 { 8520 8521 8514 /* copia en el inicio de la tira el final de la anterior. 8522 8515 triangulos degenerados. */ 8523 /*8524 8516 geoSubMesh->mIndex[totalStripIndices++] = geoSubMesh-> 8525 8517 mIndex[totalStripIndices-1]; 8526 */8527 8518 8528 8519 v_indices = mi_vector[i]; 8529 8530 //geoSubMesh->mIndexCount = geoSubMesh->mIndexCount + v_indices.size() + 2;8531 8520 8532 8521 /* copia el inicio de la tira 2 veces. 8533 8522 triangulos degenerados. 8534 8523 */ 8535 8536 8524 geoSubMesh->mIndex[totalStripIndices++] = v_indices[0]; 8537 8525 … … 8540 8528 8541 8529 // Triangulo Degenerado. 8542 //geoSubMesh->mIndex[totalStripIndices++] = v_indices[0]; 8543 8544 /* 8530 geoSubMesh->mIndex[totalStripIndices++] = v_indices[0]; 8531 8545 8532 // Insert a new vertex if the strip es odd. 8546 8533 if(oddStrip) 8547 8534 { 8548 // geoSubMesh->mIndexCount++;8549 8535 geoSubMesh->mIndex[totalStripIndices++] = v_indices[0]; 8550 8536 } … … 8559 8545 oddStrip = FALSE; 8560 8546 } 8561 */8562 8547 8563 8548 // Copia la tira en curso en el array de indices. 8564 for(j =1;j<v_indices.size();j++)8549 for(j = 1; j < v_indices.size(); j++) 8565 8550 { 8566 8551 geoSubMesh->mIndex[totalStripIndices++] = v_indices[j]; -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimplifier.cpp
r1019 r1070 136 136 void TreeSimplifier::Mesh2Structure(const Mesh *mesh, Index meshLeaves) 137 137 { 138 long intcountv=0;139 long int 140 long int 141 long int 138 size_t countv=0; 139 long int pos=0; 140 long int v1, v2, v3; 141 long int triangleID=0; 142 142 143 143 countv += vertex_count = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount; 144 144 Vertex = new float[2*countv][3]; 145 145 146 intupdate_each = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount/5;146 size_t update_each = mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount/5; 147 147 148 148 for (unsigned int j=0; j<mesh->mSubMesh[meshLeaves].mVertexBuffer->mVertexCount; j++) 149 149 { 150 static intticks_since_last_update = 0;150 static size_t ticks_since_last_update = 0; 151 151 if (mUPB && ticks_since_last_update>=update_each) 152 152 { … … 179 179 for (unsigned int j=0; j<mesh->mSubMesh[meshLeaves].mIndexCount; j=j+6) 180 180 { 181 static intticks_since_last_update = 0;181 static size_t ticks_since_last_update = 0; 182 182 if (mUPB && ticks_since_last_update>=update_each) 183 183 { … … 1193 1193 1194 1194 // calcualte the limits of the octree 1195 for ( int i=0; i<vertex_count; i++)1195 for (size_t i = 0; i < vertex_count; i++) 1196 1196 { 1197 1197 if (leafoctree->left>Vertex[i][0])
Note: See TracChangeset
for help on using the changeset viewer.