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

Revision 1017, 4.2 KB checked in by gumbau, 18 years ago (diff)

LodStripsConstructor? optimized and fixed bug building a lodtree

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
70                        // de vertices que la forma
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    *geoMesh;
83                        const   Geometry::Mesh *meshoriginal;
84                        /*const */MeshSimplificationSequence *geoMeshSQ;
85                        int             NumVertsRepetidos;
86
87                        ObjList<tipoVertice>    cVerts;
88                        ObjList<ObjList<int> > cStrips;
89
90                        VECTORINT *lStripsV;
91                        uint32 **vStrips;
92                        tipoVertice *vVerts;
93
94                        ObjList<tipoOrden> Ordenacion;
95
96                        uint32 *pCurrentData;
97                        uint32 *pCambios;
98                        LODData *vCambios;
99                        //vector <LODData> cCambios;
100                        ObjList<LODData> cCambios;
101                        //VECTORUNINT cDatos;
102                        ObjList<int32> cDatos;
103                        uint32 *vDatos;
104
105                        //0: No test 1: plano  2: esfera
106                        //-------------------------------
107                        //Lods disponibles
108                        uint32 LodsDisp;
109
110                        void GenerarModeloCompleto(Geometry::TIPOFUNC   upb);
111
112                        void CalcularCambiosLODsVNuevaED(Geometry::TIPOFUNC     upb);
113
114                        void OrdenarModeloVQSLIM(Geometry::TIPOFUNC     upb);
115
116                        void GenerarModeloV(Geometry::TIPOFUNC  upb);
117
118                        void CopiarVectors2ArraysNUEVAED();
119
120                        void leeVerticesyTirasDeMesh();
121
122                public:
123
124                        /// Constructor, gets a stripified mesh
125                        //      and a simplification sequence,
126                        //      and generates the multiresolution model.
127                        LodStripsConstructor(   const Mesh                      *,
128                                        const MeshSimplificationSequence        *,
129                                        size_t                                                                                                          submesh=-1,
130                                        Geometry::TIPOFUNC                                                              upb=NULL);
131
132                        // Destructor
133                        ~LodStripsConstructor();
134
135                        /// Copy constructor
136                        //LodStripsConstructor(const LodStripsConstructor&);
137
138                        /// Assignment operator
139                        //LodStripsConstructor& operator =(const LodStripsConstructor&);
140
141                        /// Load
142                        void Load(Serializer &s);
143
144                        /// Saves the multiresolution model into a LODStrip file and the
145                        //      LODStrips mesh using the serializer given as a parameter.
146                        void Save (Serializer &s);
147
148                        ///     GetMesh: Return de current Mesh.
149                        Mesh    *       GetMesh();
150
151                        // Sets what is the submesh that stores the leaves
152                        void SetSubMeshLeaves(size_t    submesh);
153
154        };
155
156}
157
158#endif
159
Note: See TracBrowser for help on using the repository browser.