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