[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"
|
---|
[1017] | 8 | #include "Container.h"
|
---|
[774] | 9 |
|
---|
| 10 | namespace 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 |
|
---|
| 43 | Inputs:\n
|
---|
| 44 | - A strip set provided by the stripification module
|
---|
| 45 | (Geometry::Mesh class).\n
|
---|
| 46 | - An edge collapse sequence computed by
|
---|
| 47 | the simplification module
|
---|
| 48 | (Geometry::MeshSimplificationSequence class).
|
---|
| 49 |
|
---|
| 50 | Outputs:\n
|
---|
| 51 | - The module writes a file with the LODStrips information.
|
---|
| 52 | - It also writes the LODStrips mesh into a file.
|
---|
| 53 | */
|
---|
[1078] | 54 | class LodStripsConstructor/* : public Serializable*/
|
---|
[774] | 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
|
---|
[1070] | 69 | // de vertices que la forma
|
---|
[774] | 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 |
|
---|
[841] | 79 | // Index of the submesh leaves.
|
---|
| 80 | size_t mSubMeshLeaves;
|
---|
| 81 |
|
---|
[1070] | 82 | Mesh *mGeoMesh;
|
---|
| 83 | Mesh *mInitialMesh;
|
---|
| 84 |
|
---|
[774] | 85 | const Geometry::Mesh *meshoriginal;
|
---|
[1070] | 86 | /*const */MeshSimplificationSequence *mGeoMeshSQ;
|
---|
[774] | 87 | int NumVertsRepetidos;
|
---|
| 88 |
|
---|
[1018] | 89 | std::vector<tipoVertice> cVerts;
|
---|
| 90 | std::vector<std::vector<int> > cStrips;
|
---|
[774] | 91 |
|
---|
| 92 | VECTORINT *lStripsV;
|
---|
| 93 | uint32 **vStrips;
|
---|
| 94 | tipoVertice *vVerts;
|
---|
| 95 |
|
---|
[1018] | 96 | std::vector<tipoOrden> Ordenacion;
|
---|
[774] | 97 |
|
---|
| 98 | uint32 *pCurrentData;
|
---|
| 99 | uint32 *pCambios;
|
---|
| 100 | LODData *vCambios;
|
---|
[1017] | 101 | //vector <LODData> cCambios;
|
---|
[1018] | 102 | std::vector<LODData> cCambios;
|
---|
[1017] | 103 | //VECTORUNINT cDatos;
|
---|
[1018] | 104 | std::vector<int32> cDatos;
|
---|
[774] | 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 |
|
---|
[1070] | 124 | // Sort submesh bones.
|
---|
| 125 | void sortBones();
|
---|
[1526] | 126 |
|
---|
| 127 | // Add new vertices to mesh.
|
---|
| 128 | void AddNewVertices();
|
---|
| 129 |
|
---|
[774] | 130 | public:
|
---|
| 131 |
|
---|
| 132 | /// Constructor, gets a stripified mesh
|
---|
| 133 | // and a simplification sequence,
|
---|
| 134 | // and generates the multiresolution model.
|
---|
| 135 | LodStripsConstructor( const Mesh *,
|
---|
| 136 | const MeshSimplificationSequence *,
|
---|
[841] | 137 | size_t submesh=-1,
|
---|
| 138 | Geometry::TIPOFUNC upb=NULL);
|
---|
[774] | 139 |
|
---|
| 140 | // Destructor
|
---|
| 141 | ~LodStripsConstructor();
|
---|
| 142 |
|
---|
| 143 | /// Copy constructor
|
---|
| 144 | //LodStripsConstructor(const LodStripsConstructor&);
|
---|
| 145 |
|
---|
| 146 | /// Assignment operator
|
---|
| 147 | //LodStripsConstructor& operator =(const LodStripsConstructor&);
|
---|
| 148 |
|
---|
| 149 | /// Load
|
---|
[1078] | 150 | /* void Load(Serializer &s);*/
|
---|
[774] | 151 |
|
---|
| 152 | /// Saves the multiresolution model into a LODStrip file and the
|
---|
| 153 | // LODStrips mesh using the serializer given as a parameter.
|
---|
[1078] | 154 | //void Save (Serializer &s);
|
---|
| 155 | void Save (std::string);
|
---|
[774] | 156 |
|
---|
[1078] | 157 | void UpdateMesh(void);
|
---|
| 158 |
|
---|
[774] | 159 | /// GetMesh: Return de current Mesh.
|
---|
| 160 | Mesh * GetMesh();
|
---|
[841] | 161 |
|
---|
[1070] | 162 | /// Sets what is the submesh that stores the leaves.
|
---|
[841] | 163 | void SetSubMeshLeaves(size_t submesh);
|
---|
[774] | 164 | };
|
---|
| 165 |
|
---|
| 166 | }
|
---|
| 167 |
|
---|
| 168 | #endif
|
---|
| 169 |
|
---|