source: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsLibrary.h @ 1056

Revision 1056, 4.8 KB checked in by gumbau, 18 years ago (diff)

GeoLodObject? added as a parent class for GeoLodStripsLibrary? and GeoLodTreeLibrary?

Line 
1/*==========================================================================
2 *      (C) 2005 Universidad Jaime I de Castellón
3 *==========================================================================
4 *      PROYECT:        GAME TOOLS
5 *==========================================================================*/
6/*      CONTENT:
7 *
8 *
9 *      @file   GeoLodStripsLibrary.h
10 *==========================================================================*/
11
12#ifndef _GEOLODSTRIPSLIBRARY
13#define _GEOLODSTRIPSLIBRARY
14
15#include        "GeoMesh.h"
16#include        <vector>
17#include        <time.h>
18#include        "VertexData.h"
19#include "GeoLodObject.h"
20
21namespace Geometry
22{
23        //typedef unsigned long int SmallInt;
24        typedef unsigned long SmallInt;
25        typedef unsigned long   ULong;
26        typedef long                                    Long;
27       
28        typedef struct
29        {
30                SmallInt strip;
31                SmallInt position;
32                SmallInt rep; //For the vertex repetition
33        } PositionType;
34
35        typedef struct
36        {
37                unsigned        long    strip;
38                char                                            position;
39                char                                            vertexRepetition;
40                char                                            edgeRepetition;
41        }       LODRegisterType;
42
43        typedef struct
44        {
45                float Vertex[3];
46                SmallInt Next;
47        } VertexType;
48
49        typedef std::vector     <SmallInt>                              SmallIntVector;
50        typedef std::vector     <LODRegisterType>       LODRegisterVector;
51        typedef std::vector     <Long>                                          LongVector;
52
53        /// LodStripsLibrary interface class.
54        /** This module contains functions that handle the levels of detail
55         *      of the input multiresolution objects made of polygonal meshes.
56         *      For any given resolution and object, this module returns a set
57         *      of triangle strips representing the object at that resolution,
58         *      that is, at the level of detail requested. These models use
59         *      triangle strips to reduce storage usage and to speed up realistic
60         *      rendering.
61        \n\n
62
63Inputs:\n
64        - The module receives a file describing a multiresolution object.
65        .
66
67Outputs:\n
68        - The module returns a strip set that represents the level of
69                detail requested.
70        .
71
72        */
73        class LodStripsLibrary : public Geometry::LodObject
74        {
75                private:
76                       
77                        // The name of the object.
78                        String  mName;
79
80                        //      Structures with the data read from the file
81                        //      We won't work with these structures
82                        SmallIntVector                                                                  mFileVertices;
83                        std::vector     <LODRegisterType>               mFileChangesLOD;
84                        std::vector     <SmallIntVector>                mFileStrips;
85                        LongVector                                                                                      mData;
86
87                        //      Structures with the data to work with
88
89                        //      Total strips of the multiresolution object.
90                        SmallInt        mTotalStrips;
91                       
92                        //      Total vertices of the multiresolution object.
93                        SmallInt        mTotalVertices;
94                       
95                        //      Number of vertices of the max LOD.
96                        SmallInt        mMaxVerticesLOD;
97                       
98                        //      Total changes of the multiresolution object.
99                        SmallInt        mTotalChanges;
100                       
101                        SmallInt        mLods;                          //      Available Lods.
102                        SmallInt        mMaxLod;                        //      Max level of detail.
103                        SmallInt        mMinLod;                        //      Min level of detail.
104                        SmallInt        mCurrentLod;    //      Current Lod.
105
106                        //      For the efficient version.
107                        SmallInt                                mTotalFaces;
108                        SmallInt                                *mCurrentData;
109                        SmallInt                                *mStripsChanges;
110                        LODRegisterType *mCurrentRegLOD;
111                        SmallInt                                *mVertex;
112               
113                        //      Changes of Strips in LOD file (p).
114                        SmallInt        *mPChanges;
115
116                        ///Total of vertices shown at the moment.
117                        long    int     mTotal;
118
119                        //      Global mesh object.
120                        Mesh    *mGeoMesh;
121
122                        //      Copa STL vectors to C arrays.
123                        void    CopyVectors2Arrays();
124
125                        //      Loads Mesh.
126                        void    LoadStripMesh(char *name, Mesh *geomesh);
127
128                        Geometry::CREATEMULTIINDEXDATAFUNC create_multi_index_data_func;
129
130                        //      Strips vector.
131                        SmallIntVector  *mStrips;
132
133                        void UpdateDataRetrievalInterface(void);
134
135                public:
136
137                        MultiIndexData *dataRetrievalInterface;
138                       
139                        /**     Constructor, receives as a parameter the name of the file
140                         *      including the multiresolution object.
141                        */
142                        LodStripsLibrary(std::string, Mesh *geomesh, CREATEMULTIINDEXDATAFUNC midfun=NULL);
143
144                        /// Destructor.
145                        ~LodStripsLibrary(void);
146
147                        /// Copy constructor
148                        //LodStripsLibrary(const LodStripsLibrary&);
149
150                        /// Assignment operator
151                        //LodStripsLibrary& operator =(const LodStripsLibrary&);
152
153                        /// Returns the highest LOD.
154                        uint32  MaxLod();
155
156                        /// Returns the lowest LOD.
157                        uint32  MinLod();
158
159                        /// Returns de current LOD and changes to the specified LOD.
160                        virtual uint32  GoToLod(uint32);
161
162                        /// Establishes the new LOD range.
163                        /// Only the LODs in that range are stored and used.
164                        void    TrimByLod(uint32, uint32);
165
166                        /// Returns the number of triangles of the highest LOD.
167                        uint32  MaxFaces();
168
169                        /// Returns the number of triangles of the lowest LOD.
170                        uint32  MinFaces();
171
172                        /// Returns the number of vertices of the highest LOD.
173                        uint32  MaxVertices();
174
175                        /// Returns the number of vertices of the lowest LOD.
176                        uint32  MinVertices();
177
178/*                      //      (New)   Get the number of strips.
179                        uint32  GetStripCount() const;
180                        uint32  GetIndexCountByStrip(uint32) const;*/
181        };
182}
183
184#endif
185
Note: See TracBrowser for help on using the repository browser.