source: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMeshSimpSequence.h @ 1526

Revision 1526, 2.4 KB checked in by gumbau, 18 years ago (diff)

Updated modules to the new interface and the new simplification algorithm improvements.

Line 
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
11namespace 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
31        //      Vertex info.
32        struct  GeoVertex
33        {
34                Index   id;
35                Index   bonefrom;
36                Vector3 position;
37                Vector2 texcoord;
38                Vector3 normal;
39        };
40
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                        {
60                                Index mV0;
61                                Index   mV1;
62                                Index mT0;
63                                Index   mT1;
64                                float x;
65                                float   y;
66                                float   z;
67                               
68                                std::vector<Index>      mModfaces;
69
70                                //      Indicates the the step is obligatory to execute
71                                //      joined width the following step.
72                                unsigned int obligatory;
73                        };
74
75                        //      Vertices added in simplification.
76                        std::vector<GeoVertex>  mNewVertices;
77
78                        // Name of mesh.
79                        char* meshName;
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
90                        // 'Inserts the mesh name into the meshsimplificationsequence
91                        void putMeshName(char *);
92
93                        char *getMeshName(void);
94        };
95}
96
97#endif
98
Note: See TracBrowser for help on using the repository browser.