source: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/PlyConverter.h @ 3358

Revision 3358, 1.4 KB checked in by mattausch, 15 years ago (diff)
Line 
1#ifndef _PLYCONVERTER_H
2#define _PLYCONVERTER_H
3
4#include "SimpleVec.h"
5#include <string>
6#include <vector>
7#include <map>
8
9
10static std::string model_path("data/city/model/");
11
12
13typedef std::vector<SimpleVec> VertexArray;
14typedef std::pair<float, float> Texcoord;
15typedef std::vector<Texcoord> TexcoordArray;
16typedef std::map<std::string, int> TextureTable;
17typedef std::vector<std::string> TextureArray;
18
19
20struct Face
21{
22        std::vector<int> indices;
23};
24
25
26typedef std::vector<Face> FaceArray;
27
28
29
30class ogzstream;
31
32
33
34/** Converts obj format into objects readable by our format
35*/
36class PlyConverter
37{
38public:
39
40        ~PlyConverter();
41
42        bool Convert(const std::string &inputFilename,
43                         const std::string &outputFilename);
44                     // const std::string textureFilename) const;
45
46
47protected:
48
49        void LoadShape(const VertexArray &vertices,
50                                   const VertexArray &normals,
51                                   const TexcoordArray &texcoords,
52                                   const FaceArray &faces
53                                   );
54
55        struct Geometry
56        {
57                VertexArray mVertices;
58                VertexArray mNormals;
59                TexcoordArray mTexcoords;
60        };
61
62        typedef std::vector<Geometry *> GeometryArray;
63
64        void WriteGeometry(ogzstream &str, Geometry *geom);
65
66        bool ReadFile(const std::string &inputFilename);
67        bool WriteFile(const std::string &outputFilename);
68
69
70        TextureTable mTextureTable;
71       
72        TextureArray mTextures;
73        GeometryArray mGeometry;
74
75        int mNumShapes;
76};
77
78
79
80#endif
Note: See TracBrowser for help on using the repository browser.