[162] | 1 | #ifndef __X3DPARSER_H
|
---|
| 2 | #define __X3DPARSER_H
|
---|
| 3 |
|
---|
| 4 | #include "parser.h"
|
---|
| 5 | #include "mesh.h"
|
---|
| 6 |
|
---|
| 7 | #include <X3DTK/MESH/scenegraph.h>
|
---|
| 8 | #include <X3DTK/kernel.h>
|
---|
| 9 | #include <X3DTK/MESH/scenegraph.h>
|
---|
| 10 |
|
---|
| 11 | class X3dParser : public Parser
|
---|
| 12 | {
|
---|
| 13 | public:
|
---|
| 14 | X3dParser():Parser() {}
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 | bool ParseFile(const string filename, SceneGraphNode **root);
|
---|
| 18 |
|
---|
| 19 | };
|
---|
| 20 |
|
---|
| 21 | };
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | namespace X3DTK {
|
---|
| 25 | namespace MESH {
|
---|
| 26 |
|
---|
| 27 | class MyStructureComputerStateVariables : public StateVariables
|
---|
| 28 | {
|
---|
| 29 | public:
|
---|
| 30 | MyStructureComputerStateVariables();
|
---|
| 31 |
|
---|
| 32 | void init();
|
---|
| 33 | void finish();
|
---|
| 34 |
|
---|
| 35 | void beginNewMesh();
|
---|
| 36 | inline void addVertex(float x, float y, float z) {
|
---|
| 37 | //_mesh->addVertex(x, y, z);
|
---|
| 38 | };
|
---|
| 39 |
|
---|
| 40 | void addFace(const Face &face);
|
---|
| 41 |
|
---|
| 42 | void pushMatrix(const SFMatrix34f &transformation);
|
---|
| 43 | void popMatrix();
|
---|
| 44 |
|
---|
| 45 | inline Mesh *getMesh() const {return _mesh;};
|
---|
| 46 | SFMatrix34f getMatrix() const {return _matrixStack.front();};
|
---|
| 47 |
|
---|
| 48 | private:
|
---|
| 49 | Mesh *_mesh;
|
---|
| 50 | unsigned int _decal;
|
---|
| 51 | std::list<SFMatrix34f> _matrixStack;
|
---|
| 52 | };
|
---|
| 53 |
|
---|
| 54 | // MyStructureComputer processor.
|
---|
| 55 |
|
---|
| 56 | class MyStructureComputer : public X3DOnePassProcessor
|
---|
| 57 | {
|
---|
| 58 | public:
|
---|
| 59 | MyStructureComputer();
|
---|
| 60 | virtual ~MyStructureComputer();
|
---|
| 61 |
|
---|
| 62 | virtual Mesh *compute(SFNode N);
|
---|
| 63 | };
|
---|
| 64 |
|
---|
| 65 | class X3DGroupingNode;
|
---|
| 66 | class Transform;
|
---|
| 67 |
|
---|
| 68 | /// Visitor for the Core component of the MyStructureComputer module.
|
---|
| 69 |
|
---|
| 70 | class MyStructureComputerCoreVisitor : public CoreVisitor
|
---|
| 71 | {
|
---|
| 72 | public:
|
---|
| 73 | MyStructureComputerCoreVisitor();
|
---|
| 74 |
|
---|
| 75 | static void enterMesh(Mesh *M);
|
---|
| 76 | static void enterTransform(Transform *T);
|
---|
| 77 | static void leaveX3DGroupingNode(X3DGroupingNode *N);
|
---|
| 78 | };
|
---|
| 79 |
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | #endif
|
---|