source: GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.h @ 2961

Revision 2961, 1.1 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef _OBJCONVERTER_H
2#define _OBJCONVERTER_H
3
4#include <string>
5#include <vector>
6
7struct Vector3
8{
9        Vector3() {}
10        Vector3(float _x, float _y, float _z): x(_x), y(_y), z(_z) {}
11
12        float x, y, z;
13};
14
15typedef std::vector<Vector3> VertexArray;
16typedef std::pair<float, float> Texcoord;
17
18class ogzstream;
19
20/** Converts obj format into objects readable by our format
21*/
22class ObjConverter
23{
24public:
25
26        ObjConverter();
27
28        bool Convert(const std::string &inputFilename,
29                         const std::string &outputFilename);
30        // const std::string textureFilename) const;
31
32        ~ObjConverter();
33
34protected:
35
36        struct Geometry
37        {
38                Vector3 *mVertices;
39                Vector3 *mNormals;
40                Texcoord *mTexcoords;
41
42                int mVertexCount;
43                int mTexcoordCount;
44        };
45
46        void LoadShape(const VertexArray &faceVertices,
47                           const VertexArray &faceNormals,
48                                   const std::vector<Texcoord> &faceTexcoords);
49
50        void WriteGeometry(ogzstream &str, Geometry *geom);
51
52        bool ReadFile(const std::string &inputFilename);
53        bool WriteFile(const std::string &outputFilename);
54
55
56        std::vector<Geometry *> mGeometry;
57
58        int mNumShapes;
59};
60
61
62
63#endif
Note: See TracBrowser for help on using the repository browser.