Rev | Line | |
---|
[2961] | 1 | #ifndef _OBJCONVERTER_H
|
---|
| 2 | #define _OBJCONVERTER_H
|
---|
| 3 |
|
---|
[3012] | 4 | #include "SimpleVec.h"
|
---|
[2961] | 5 | #include <string>
|
---|
| 6 | #include <vector>
|
---|
| 7 |
|
---|
[3012] | 8 | /*struct SimpleVec
|
---|
[2961] | 9 | {
|
---|
[3012] | 10 | SimpleVec() {}
|
---|
| 11 | SimpleVec(float _x, float _y, float _z): x(_x), y(_y), z(_z) {}
|
---|
[2961] | 12 |
|
---|
| 13 | float x, y, z;
|
---|
[3012] | 14 | };*/
|
---|
[2961] | 15 |
|
---|
[3012] | 16 | typedef std::vector<SimpleVec> VertexArray;
|
---|
[2961] | 17 | typedef std::pair<float, float> Texcoord;
|
---|
| 18 |
|
---|
| 19 | class ogzstream;
|
---|
| 20 |
|
---|
| 21 | /** Converts obj format into objects readable by our format
|
---|
| 22 | */
|
---|
| 23 | class ObjConverter
|
---|
| 24 | {
|
---|
| 25 | public:
|
---|
| 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 |
|
---|
| 35 | protected:
|
---|
| 36 |
|
---|
| 37 | struct Geometry
|
---|
| 38 | {
|
---|
[3012] | 39 | SimpleVec *mVertices;
|
---|
| 40 | SimpleVec *mNormals;
|
---|
[2961] | 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.