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

Revision 3357, 1.3 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<SimpleVec> TexcoordArray;
16typedef std::map<std::string, int> TextureTable;
17typedef std::vector<std::string> TextureArray;
18
19
20class ogzstream;
21
22
23
24/** Converts obj format into objects readable by our format
25*/
26class PlyConverter
27{
28public:
29
30        ~PlyConverter();
31
32        bool Convert(const std::string &inputFilename,
33                         const std::string &outputFilename);
34                     // const std::string textureFilename) const;
35
36
37protected:
38
39        void LoadShape(const VertexArray &faceVertices,
40                           const VertexArray &faceNormals,
41                                   const std::vector<Texcoord> &faceTexcoords
42                                   );
43
44        struct Geometry
45        {
46                VertexArray mVertices;
47                VertexArray mNormals;
48                TexcoordArray mTexcoords;
49        };
50
51        typedef std::vector<Geometry *> GeometryArray;
52
53        void WriteGeometry(ogzstream &str, Geometry *geom);
54
55        bool ReadFile(const std::string &inputFilename);
56        bool WriteFile(const std::string &outputFilename);
57
58
59        TextureTable mTextureTable;
60       
61        TextureArray mTextures;
62        GeometryArray mGeometry;
63
64        int mNumShapes;
65};
66
67
68
69#endif
Note: See TracBrowser for help on using the repository browser.