[774] | 1 | #ifndef __GEO_MESH_SIMP_SEQUENCE__
|
---|
| 2 | #define __GEO_MESH_SIMP_SEQUENCE__
|
---|
| 3 |
|
---|
| 4 | #include <string>
|
---|
| 5 | #include <vector>
|
---|
| 6 | #include "GeoBase.h"
|
---|
| 7 | #include "GeoSerializable.h"
|
---|
| 8 | #include <iostream>
|
---|
| 9 | #include <fstream>
|
---|
| 10 |
|
---|
| 11 | namespace Geometry
|
---|
| 12 | {
|
---|
| 13 | /// Represents the simplification sequence applied to a given mesh.
|
---|
| 14 | /** This class stores information about the simplification process, giving for each step the vertex that collapses,
|
---|
| 15 | the vertex that remains unchanged, the two triangles that disappear and the new triangles that come out.
|
---|
| 16 | It also offers a method to generate a mesh simplification sequence format file.
|
---|
| 17 | \n
|
---|
| 18 | This file begins with a line stating the name of the mesh file it refers to.
|
---|
| 19 |
|
---|
| 20 | Every line gives the following information: \n
|
---|
| 21 | \n
|
---|
| 22 | -# Vertex that collapses. -> asumo mV0\n
|
---|
| 23 | -# Vertex that remains unchanged. -> asumo mV1\n
|
---|
| 24 | -# The two triangles that disappear.\n -> no tiene por qué ser 2 ??????
|
---|
| 25 | -# & as a separator.\n
|
---|
| 26 | -# The list of new triangles.\n
|
---|
| 27 | .
|
---|
| 28 | \n
|
---|
| 29 | */
|
---|
| 30 |
|
---|
[1526] | 31 | // Vertex info.
|
---|
| 32 | struct GeoVertex
|
---|
| 33 | {
|
---|
[2090] | 34 | Index id;
|
---|
| 35 | Index bonefrom;
|
---|
[1526] | 36 | Vector3 position;
|
---|
| 37 | Vector2 texcoord;
|
---|
| 38 | Vector3 normal;
|
---|
| 39 | };
|
---|
| 40 |
|
---|
[774] | 41 | class MeshSimplificationSequence: public Serializable
|
---|
| 42 | {
|
---|
| 43 | public:
|
---|
| 44 |
|
---|
| 45 | /// Class constructor.
|
---|
| 46 | MeshSimplificationSequence(void);
|
---|
| 47 |
|
---|
| 48 | /// Class destructor.
|
---|
| 49 | ~MeshSimplificationSequence(void);
|
---|
| 50 |
|
---|
| 51 | /// Copy constructor
|
---|
| 52 | //MeshSimplificationSequence(const MeshSimplificationSequence&);
|
---|
| 53 |
|
---|
| 54 | /// Assignment operator
|
---|
| 55 | //MeshSimplificationSequence& operator =(const MeshSimplificationSequence&);
|
---|
| 56 |
|
---|
| 57 | /// Represents a simplification step in the sequence.
|
---|
| 58 | struct Step
|
---|
| 59 | {
|
---|
[1007] | 60 | Index mV0;
|
---|
| 61 | Index mV1;
|
---|
[2194] | 62 | int mT0;
|
---|
| 63 | int mT1;
|
---|
[1007] | 64 | float x;
|
---|
| 65 | float y;
|
---|
| 66 | float z;
|
---|
| 67 |
|
---|
| 68 | std::vector<Index> mModfaces;
|
---|
[774] | 69 |
|
---|
| 70 | // Indicates the the step is obligatory to execute
|
---|
| 71 | // joined width the following step.
|
---|
[1526] | 72 | unsigned int obligatory;
|
---|
[774] | 73 | };
|
---|
| 74 |
|
---|
[1526] | 75 | // Vertices added in simplification.
|
---|
| 76 | std::vector<GeoVertex> mNewVertices;
|
---|
| 77 |
|
---|
[986] | 78 | // Name of mesh.
|
---|
| 79 | char* meshName;
|
---|
[774] | 80 |
|
---|
| 81 | /// Stores all the simplification steps.
|
---|
| 82 | std::vector<Step> mSteps;
|
---|
| 83 |
|
---|
| 84 | /// Loads a simplification sequence from a Serializer.
|
---|
| 85 | void Load(Serializer &s);
|
---|
| 86 |
|
---|
| 87 | /// Saves the contents of the data structures.
|
---|
| 88 | void Save(Serializer &s);
|
---|
| 89 |
|
---|
[2090] | 90 | // Inserts the mesh name into the meshsimplificationsequence.
|
---|
[774] | 91 | void putMeshName(char *);
|
---|
| 92 |
|
---|
| 93 | char *getMeshName(void);
|
---|
| 94 | };
|
---|
| 95 | }
|
---|
| 96 |
|
---|
| 97 | #endif
|
---|
[1007] | 98 |
|
---|