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

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