source: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoLodStripsConstructor.h @ 1070

Revision 1070, 4.3 KB checked in by gumbau, 18 years ago (diff)
Line 
1#ifndef __GEO_LODSTRIPS_CONSTRUCTOR__
2#define __GEO_LODSTRIPS_CONSTRUCTOR__
3
4#include <windows.h>
5#include "GeoMeshSimpSequence.h"
6#include "GeoMesh.h"
7#include "auxiliar.h"
8#include "Container.h"
9
10namespace Geometry
11{
12        /// Construction module for general multiresolution models.
13        /** This module stores general mesh multiresolution
14         *      representations using our own specific file format.
15         It takes as inputs the strips provided by the
16         stripification module and the edge collapse
17         sequence computed by the simplification module.
18         It builds a multiresolution representation and generates
19         a LODStrips file.\n
20
21         The LodStrips file begins with a line stating the name
22         of the mesh file it refers to.
23         This filetype has three different kinds of records
24         storing the information required for the multiresolution
25         model. All the records of the same kind are output following
26         the right order.
27
28         Those lines starting with a 'd' include:\n
29
30         -# Strip to modify.\n
31         -# Number of collapses.\n
32         -# Number of vertex repetitions.\n
33         -# Number of edge repetitions.\n
34         .
35         \n
36         Those beginning with a 'p' include the number of
37         strips affected by a LOD change.\n\n
38
39         And finally, the ones starting with a 'b' include
40         all the information needed for collapses and repetitions.
41         \n\n
42
43Inputs:\n
44- A strip set provided by the stripification module
45(Geometry::Mesh class).\n
46- An edge collapse sequence computed by
47the simplification module
48(Geometry::MeshSimplificationSequence class).
49
50Outputs:\n
51- The module writes a file with the LODStrips information.
52- It also writes the LODStrips mesh into a file.
53*/
54        class LodStripsConstructor : public Serializable
55        {
56                protected:
57
58                        int igual(Geometry::Vector3,Geometry::Vector3);
59                        int igual(Geometry::Vector2,Geometry::Vector2);
60
61                private:
62
63                        //      Lista de flyVectors, un flyVector tiene 4 componentes:
64                        //  x,y,z: coordenadas 3D del vertice
65                        //  w: se guarda el nº del vertice que simplifica a éste,
66                        //  el siguiente
67                        //      Lista que contiene el modelo en varias tiras y cada tira
68                        //      contiene la secuencia
69                        //      de vertices que la forma
70
71                        uint32 MARCA; //Para delimitar el final de tira.
72                        uint32 TOTALTIRAS;
73                        uint32 TOTALVERTS;
74                        uint32 TOTALCAMBIOS;
75                        uint32 TOTALCARAS;
76                        uint32 MARCAVACIO;
77                        uint32 TOTALINDICES;
78
79                        //      Index of the submesh leaves.
80                        size_t  mSubMeshLeaves;
81
82                        Mesh    *mGeoMesh;
83                        Mesh    *mInitialMesh;
84
85                        const   Geometry::Mesh *meshoriginal;
86                        /*const */MeshSimplificationSequence *mGeoMeshSQ;
87                        int             NumVertsRepetidos;
88
89                        std::vector<tipoVertice>        cVerts;
90                        std::vector<std::vector<int> > cStrips;
91
92                        VECTORINT *lStripsV;
93                        uint32 **vStrips;
94                        tipoVertice *vVerts;
95
96                        std::vector<tipoOrden> Ordenacion;
97
98                        uint32 *pCurrentData;
99                        uint32 *pCambios;
100                        LODData *vCambios;
101                        //vector <LODData> cCambios;
102                        std::vector<LODData> cCambios;
103                        //VECTORUNINT cDatos;
104                        std::vector<int32> cDatos;
105                        uint32 *vDatos;
106
107                        //0: No test 1: plano  2: esfera
108                        //-------------------------------
109                        //Lods disponibles
110                        uint32 LodsDisp;
111
112                        void GenerarModeloCompleto(Geometry::TIPOFUNC   upb);
113
114                        void CalcularCambiosLODsVNuevaED(Geometry::TIPOFUNC     upb);
115
116                        void OrdenarModeloVQSLIM(Geometry::TIPOFUNC     upb);
117
118                        void GenerarModeloV(Geometry::TIPOFUNC  upb);
119
120                        void CopiarVectors2ArraysNUEVAED();
121
122                        void leeVerticesyTirasDeMesh();
123
124                        //      Sort submesh bones.
125                        void    sortBones();
126                       
127                public:
128
129                        /// Constructor, gets a stripified mesh
130                        //      and a simplification sequence,
131                        //      and generates the multiresolution model.
132                        LodStripsConstructor(   const Mesh                      *,
133                                        const MeshSimplificationSequence        *,
134                                        size_t                                                                                                          submesh=-1,
135                                        Geometry::TIPOFUNC                                                              upb=NULL);
136
137                        // Destructor
138                        ~LodStripsConstructor();
139
140                        /// Copy constructor
141                        //LodStripsConstructor(const LodStripsConstructor&);
142
143                        /// Assignment operator
144                        //LodStripsConstructor& operator =(const LodStripsConstructor&);
145
146                        /// Load
147                        void Load(Serializer &s);
148
149                        /// Saves the multiresolution model into a LODStrip file and the
150                        //      LODStrips mesh using the serializer given as a parameter.
151                        void Save (Serializer &s);
152
153                        ///     GetMesh: Return de current Mesh.
154                        Mesh    *       GetMesh();
155
156                        ///     Sets what is the submesh that stores the leaves.
157                        void SetSubMeshLeaves(size_t    submesh);
158        };
159
160}
161
162#endif
163
Note: See TracBrowser for help on using the repository browser.