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 |
|
---|
10 | static std::string model_path("data/city/model/");
|
---|
11 |
|
---|
12 |
|
---|
13 | typedef std::vector<SimpleVec> VertexArray;
|
---|
14 | typedef std::pair<float, float> Texcoord;
|
---|
15 | typedef std::vector<Texcoord> TexcoordArray;
|
---|
16 | typedef std::map<std::string, int> TextureTable;
|
---|
17 | typedef std::vector<std::string> TextureArray;
|
---|
18 |
|
---|
19 |
|
---|
20 | struct Face
|
---|
21 | {
|
---|
22 | std::vector<int> indices;
|
---|
23 | };
|
---|
24 |
|
---|
25 |
|
---|
26 | typedef std::vector<Face> FaceArray;
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 | class ogzstream;
|
---|
31 |
|
---|
32 |
|
---|
33 |
|
---|
34 | /** Converts obj format into objects readable by our format
|
---|
35 | */
|
---|
36 | class PlyConverter
|
---|
37 | {
|
---|
38 | public:
|
---|
39 |
|
---|
40 | ~PlyConverter();
|
---|
41 |
|
---|
42 | bool Convert(const std::string &inputFilename,
|
---|
43 | const std::string &outputFilename);
|
---|
44 | // const std::string textureFilename) const;
|
---|
45 |
|
---|
46 |
|
---|
47 | protected:
|
---|
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.