Revision 3247,
1.5 KB
checked in by mattausch, 16 years ago
(diff) |
worked on obj loader
played around with ssao sampling
|
Line | |
---|
1 | #ifndef _OBJCONVERTER_H
|
---|
2 | #define _OBJCONVERTER_H
|
---|
3 |
|
---|
4 | #include "SimpleVec.h"
|
---|
5 | #include <string>
|
---|
6 | #include <vector>
|
---|
7 | #include <map>
|
---|
8 |
|
---|
9 |
|
---|
10 | struct Material
|
---|
11 | {
|
---|
12 | float rgb[3];
|
---|
13 | int texture;
|
---|
14 | };
|
---|
15 |
|
---|
16 | class Geometry;
|
---|
17 |
|
---|
18 | typedef std::vector<SimpleVec> VertexArray;
|
---|
19 | typedef std::pair<float, float> Texcoord;
|
---|
20 | typedef std::map<std::string, Material *> MaterialTable;
|
---|
21 | typedef std::map<std::string, int> TextureTable;
|
---|
22 |
|
---|
23 | typedef std::vector<std::string> TextureArray;
|
---|
24 |
|
---|
25 | class ogzstream;
|
---|
26 |
|
---|
27 | /** Converts obj format into objects readable by our format
|
---|
28 | */
|
---|
29 | class ObjConverter
|
---|
30 | {
|
---|
31 | public:
|
---|
32 |
|
---|
33 | ObjConverter();
|
---|
34 |
|
---|
35 | bool Convert(const std::string &inputFilename,
|
---|
36 | const std::string &outputFilename);
|
---|
37 | // const std::string textureFilename) const;
|
---|
38 |
|
---|
39 | bool LoadMaterials(const std::string &matFileName);
|
---|
40 |
|
---|
41 | ~ObjConverter();
|
---|
42 |
|
---|
43 | protected:
|
---|
44 |
|
---|
45 | struct Geometry
|
---|
46 | {
|
---|
47 | SimpleVec *mVertices;
|
---|
48 | SimpleVec *mNormals;
|
---|
49 | Texcoord *mTexcoords;
|
---|
50 | Material *mMaterial;
|
---|
51 |
|
---|
52 | int mVertexCount;
|
---|
53 | int mTexcoordCount;
|
---|
54 | };
|
---|
55 |
|
---|
56 | typedef std::vector<Geometry *> GeometryArray;
|
---|
57 |
|
---|
58 | void LoadShape(const VertexArray &faceVertices,
|
---|
59 | const VertexArray &faceNormals,
|
---|
60 | const std::vector<Texcoord> &faceTexcoords,
|
---|
61 | Material *mat);
|
---|
62 |
|
---|
63 | void WriteGeometry(ogzstream &str, Geometry *geom);
|
---|
64 |
|
---|
65 | bool ReadFile(const std::string &inputFilename);
|
---|
66 | bool WriteFile(const std::string &outputFilename);
|
---|
67 |
|
---|
68 |
|
---|
69 | MaterialTable mMaterialTable;
|
---|
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.