Changeset 1090


Ignore:
Timestamp:
07/06/06 20:20:06 (18 years ago)
Author:
gumbau
Message:

LodTreeLibrary? constructor now has 3 parameters.
The leaves submesh is calculated inside the constructor.

Location:
GTP/trunk/Lib/Geom/shared
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GTGeometry/GTGeometry.vcproj

    r1083 r1090  
    7777                        <Tool 
    7878                                Name="VCLibrarianTool" 
    79                                 OutputFile="$(OutDir)/GTGeometry.lib"/> 
     79                                OutputFile="$(OutDir)/GTGeometry.lib" 
     80                                IgnoreAllDefaultLibraries="TRUE" 
     81                                IgnoreDefaultLibraryNames="LIBC"/> 
    8082                        <Tool 
    8183                                Name="VCMIDLTool"/> 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h

    r1083 r1090  
    144144                        void UpdateDataRetrievalInterface(void);                         
    145145 
     146                        //Number of strips in each submesh 
     147                        int* mStripsSubmesh; 
     148 
    146149                public: 
    147150 
     
    177180                        uint32 GetValidIndexCount(int submeshid) const { return indices_x_submesh[submeshid]; } 
    178181                        uint32 GetValidOffset(int submeshid) const { return offsets_x_submesh[submeshid]; } 
     182                        uint32 GetTotalStripCount(void) const { return mTotalStrips; } 
     183                        uint32 GetSubMeshtripCount(int submeshid) const { return mStripsSubmesh[submeshid]; } 
    179184        }; 
    180185} 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodTreeLibrary.h

    r1083 r1090  
    2424                LodTreeLibrary( const LodStripsLibraryData *, 
    2525                                                const TreeSimplificationSequence *, 
    26                                                 Geometry::Mesh *treeGeoMesh, 
     26                                                Geometry::Mesh *treeGeoMesh/*, 
    2727                                                uint32 leafSubMeshID 
    2828                                                /*std::string foliage_verts, 
     
    6565                const IndexData* CurrentLOD_Foliage_Indices(void) const; 
    6666                const VertexData* Get_Foliage_VertexData(void) const; 
     67                uint32 GetLeavesSubMesh(void) const { return mLeavesSubMesh; } 
    6768 
    6869        private: 
    6970                Foliage *foliage; 
    7071                Geometry::LodStripsLibrary *trunk; 
     72                uint32 mLeavesSubMesh; 
    7173        }; 
    7274} 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsConstructor.cpp

    r1078 r1090  
    33#include <time.h> 
    44#include "GeoLodStripsConstructor.h" 
     5#include "GeoMeshLoader.h" 
    56 
    67using namespace Geometry; 
     
    619620        int dataCount = this->cDatos.size(); 
    620621        int cambiosCount = this->TOTALCAMBIOS; 
    621         int size= dataCount*sizeof(LODData) + (vertexCount + changesCount + cambiosCount + 4)*sizeof(int); 
     622        int size =      changesCount*sizeof(LODData) +  
     623                                (vertexCount + dataCount + cambiosCount + 4)*sizeof(int) + 
     624                                CHUNK_OVERHEAD_SIZE; 
    622625 
    623626        FILE *f = fopen(filename.c_str(),"ab"); 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodStripsLibrary.cpp

    r1088 r1090  
    3434        indices_x_submesh = NULL; 
    3535        offsets_x_submesh = NULL; 
     36        mStripsSubmesh = NULL; 
    3637         
    3738        //      Loads the Level Of Detail file. 
     
    6162        if (offsets_x_submesh) 
    6263                delete[] offsets_x_submesh; 
     64        if (mStripsSubmesh) 
     65                delete[] mStripsSubmesh; 
    6366} 
    6467 
     
    573576        mData = lodstripsdata->mData; 
    574577        p_changes = lodstripsdata->p_changes; 
    575                  
    576                  
    577                 //      Max / Min values for LOD. 
    578                 mLods                                                                                   =       int(p_changes.size()); 
    579                 mMaxLod                                                                         =       0; 
    580                 mMinLod                                                                         =       mLods; 
    581  
    582                 mPChanges                       =       new SmallInt[mLods]; 
    583                  
    584                 for (unsigned int i = 0; i < mLods; i++) 
    585                 { 
    586                         mPChanges[i] = p_changes[i]; 
    587                 } 
    588  
    589                 mTotalVertices          =       int(mFileVertices.size()); 
    590                 mMaxVerticesLOD         =       mTotalVertices; 
    591                 mTotalStrips                    =       int(mFileStrips.size()); 
    592                 mTotalChanges                   =       int(mFileChangesLOD.size()); 
    593  
    594                 //Copy the data to the structure we will use 
    595                 CopyVectors2Arrays(); 
     578 
     579        mStripsSubmesh = new int [geomesh->mSubMeshCount]; 
     580        for (int submesh = 0; submesh < geomesh->mSubMeshCount; submesh++) 
     581        {        
     582                mStripsSubmesh[submesh]=0; 
     583        } 
     584 
     585                         
     586        //      Max / Min values for LOD. 
     587        mLods                                                                                   =       int(p_changes.size()); 
     588        mMaxLod                                                                         =       0; 
     589        mMinLod                                                                         =       mLods; 
     590 
     591        mPChanges                       =       new SmallInt[mLods]; 
     592         
     593        for (unsigned int i = 0; i < mLods; i++) 
     594        { 
     595                mPChanges[i] = p_changes[i]; 
     596        } 
     597 
     598        mTotalVertices          =       int(mFileVertices.size()); 
     599        mMaxVerticesLOD         =       mTotalVertices; 
     600        mTotalStrips                    =       int(mFileStrips.size()); 
     601        mTotalChanges                   =       int(mFileChangesLOD.size()); 
     602 
     603        //Copy the data to the structure we will use 
     604        CopyVectors2Arrays(); 
    596605//      } 
    597606} 
     
    618627 
    619628                        counter = 0; 
     629                        mStripsSubmesh[target_submesh] = strip_count; 
    620630                        strip_count = 0; 
    621631                        target_submesh++; 
     
    655665 
    656666                counter = 0; 
     667                mStripsSubmesh[target_submesh] = strip_count; 
    657668                strip_count = 0; 
    658669                target_submesh++; 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoLodTreeLibrary.cpp

    r1083 r1090  
    77Geometry::LodTreeLibrary::LodTreeLibrary(const LodStripsLibraryData *lodstripsdata, 
    88                                                                                 const TreeSimplificationSequence *simpseq, 
    9                                                                                  Geometry::Mesh *treeGeoMesh, 
    10                                                                                  uint32 leafSubMeshID/* 
     9                                                                                 Geometry::Mesh *treeGeoMesh/*, 
     10                                                                                 uint32 leafSubMeshID, 
    1111                                                           CREATEVERTEXDATAFUNC vdfun, 
    1212                                                           CREATEINDEXDATAFUNC idfun, 
     
    1616        trunk = new LodStripsLibrary(lodstripsdata,treeGeoMesh); 
    1717 
     18        // select the first triangle-list submesh as leaves submesh 
     19        mLeavesSubMesh = -1; 
     20        for (int i=0; i<treeGeoMesh->mSubMeshCount; i++) 
     21        { 
     22                if (treeGeoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST) 
     23                { 
     24                        mLeavesSubMesh=i; 
     25                        break; 
     26                } 
     27        }        
     28 
    1829        // Cargar la copa del árbol 
    19         Geometry::SubMesh * leafsSubMesh = &(treeGeoMesh->mSubMesh[leafSubMeshID]); 
     30        Geometry::SubMesh * leafsSubMesh = &(treeGeoMesh->mSubMesh[mLeavesSubMesh]); 
    2031        foliage = new Foliage(leafsSubMesh,simpseq); 
    2132        GoToFoliageLod(1.0f); 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoTreeSimpSequence.cpp

    r1078 r1090  
    22#include <iostream> 
    33#include <fstream> 
     4#include "GeoMeshLoader.h" 
    45 
    56using namespace Geometry; 
     
    6869        unsigned short chunkid = 0xdcba; 
    6970        s.WriteData(&chunkid,sizeof(unsigned short),1); 
    70         unsigned long size = mSteps.size()*8*sizeof(int); 
     71        unsigned long size = mSteps.size()*8*sizeof(int) + CHUNK_OVERHEAD_SIZE; 
    7172        s.WriteData(&size,sizeof(unsigned long),1); 
    7273 
  • GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h

    r1083 r1090  
    374374        void    setLodStripsLibrary(const Geometry::LodStripsLibraryData *, Mesh        *geomesh); 
    375375        //      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*/); 
    377377 
    378378        // Indentify the mesh of leaves. 
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshView.cpp

    r1083 r1090  
    10321032        for (int submesh = 0; submesh < geoMesh->mSubMeshCount; submesh++) 
    10331033        { 
    1034                 if (submesh==leavesSubMesh) 
     1034                //if (submesh==leavesSubMesh) 
     1035                if (submesh == lodTreeLib->GetLeavesSubMesh()) 
    10351036                        continue; 
    10361037 
  • GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp

    r1083 r1090  
    852852                if (geoMeshLoader->GetTreeSimpSeq() && geoMeshLoader->GetLodStripsData()) 
    853853                { 
    854                         // select the first triangle-list submesh as leaves submesh 
     854/*                      // select the first triangle-list submesh as leaves submesh 
    855855                        int leafsSubMeshID = -1; 
    856856 
     
    862862                                        break; 
    863863                                } 
    864                         } 
    865  
    866                         setLodTreesLibrary(geoMeshLoader->GetLodStripsData(), geoMeshLoader->GetTreeSimpSeq(), mGeoMesh, leafsSubMeshID); 
     864                        }*/ 
     865 
     866                        setLodTreesLibrary(geoMeshLoader->GetLodStripsData(), geoMeshLoader->GetTreeSimpSeq(), mGeoMesh/*, leafsSubMeshID*/); 
    867867 
    868868                        //      Sets the aplication mode. 
     
    23422342//      Initialize the lodTreelibrary for visualization. 
    23432343//--------------------------------------------------------------------------- 
    2344 void    GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData *lodstripsdata, const TreeSimplificationSequence *treesimpseq, Mesh *geomesh, uint32 ileafSubMesh) 
     2344void    GeoMeshViewUI::setLodTreesLibrary(const LodStripsLibraryData *lodstripsdata, const TreeSimplificationSequence *treesimpseq, Mesh *geomesh/*, uint32 ileafSubMesh*/) 
    23452345{ 
    23462346        //      If there is no lod strips object. 
     
    23502350        //      New lod strips object. 
    23512351 
    2352         lodTreeLib = new Geometry::LodTreeLibrary(lodstripsdata,treesimpseq,geomesh,ileafSubMesh); 
     2352        lodTreeLib = new Geometry::LodTreeLibrary(lodstripsdata,treesimpseq,geomesh/*,ileafSubMesh*/); 
    23532353 
    23542354        //      Sets the slider range. 
Note: See TracChangeset for help on using the changeset viewer.