1 | #ifndef __X3DEXPORTER_H
|
---|
2 | #define __X3DEXPORTER_H
|
---|
3 |
|
---|
4 | #include <string>
|
---|
5 | using std::string;
|
---|
6 |
|
---|
7 | #include <iostream>
|
---|
8 | #include <fstream>
|
---|
9 |
|
---|
10 | #include "Exporter.h"
|
---|
11 | #include "Containers.h"
|
---|
12 | #include "VssRay.h"
|
---|
13 |
|
---|
14 | class SceneGraphNode;
|
---|
15 | class Mesh;
|
---|
16 | class Intersectable;
|
---|
17 | class MeshInstance;
|
---|
18 | class Polygon3;
|
---|
19 | class ViewCell;
|
---|
20 | class BspTree;
|
---|
21 | class VspBspTree;
|
---|
22 | class BspNode;
|
---|
23 |
|
---|
24 | class X3dExporter : public Exporter
|
---|
25 | {
|
---|
26 | std::ofstream stream;
|
---|
27 |
|
---|
28 | public:
|
---|
29 |
|
---|
30 | X3dExporter(const string filename);
|
---|
31 |
|
---|
32 | ~X3dExporter();
|
---|
33 |
|
---|
34 |
|
---|
35 | // bool
|
---|
36 | // ExportRays(const vector<Ray> &rays,
|
---|
37 | // const float length=1000,
|
---|
38 | // const RgbColor &color = RgbColor(1,1,1));
|
---|
39 |
|
---|
40 |
|
---|
41 | bool
|
---|
42 | ExportKdTree(const KdTree &tree);
|
---|
43 |
|
---|
44 | bool
|
---|
45 | ExportVssTree(const VssTree &tree);
|
---|
46 |
|
---|
47 | bool
|
---|
48 | ExportVssTree2(const VssTree &tree,
|
---|
49 | const Vector3 direction
|
---|
50 | );
|
---|
51 |
|
---|
52 | virtual bool
|
---|
53 | ExportRssTree2(const RssTree &tree,
|
---|
54 | const Vector3 direction
|
---|
55 | );
|
---|
56 |
|
---|
57 | bool
|
---|
58 | ExportVspKdTree(const VspKdTree &tree, const int maxPvs);
|
---|
59 |
|
---|
60 | bool ExportBspTree(const BspTree &tree);
|
---|
61 |
|
---|
62 | bool
|
---|
63 | ExportScene(SceneGraphNode *root)
|
---|
64 | {
|
---|
65 | ExportSceneNode(root);
|
---|
66 | return true;
|
---|
67 | }
|
---|
68 |
|
---|
69 | virtual void
|
---|
70 | ExportPolygon(Polygon3 *poly);
|
---|
71 |
|
---|
72 | virtual void
|
---|
73 | ExportPolygons(const PolygonContainer &polys);
|
---|
74 |
|
---|
75 | virtual bool
|
---|
76 | ExportBox(const AxisAlignedBox3 &box);
|
---|
77 |
|
---|
78 | virtual void
|
---|
79 | ExportMeshInstance(MeshInstance *mi);
|
---|
80 |
|
---|
81 | virtual void
|
---|
82 | ExportIntersectable(Intersectable *object);
|
---|
83 |
|
---|
84 | virtual void
|
---|
85 | ExportMesh(Mesh *mesh);
|
---|
86 |
|
---|
87 | virtual void
|
---|
88 | ExportViewCell(ViewCell *viewCell);
|
---|
89 |
|
---|
90 | virtual void
|
---|
91 | ExportViewCells(const ViewCellContainer &viewCells);
|
---|
92 |
|
---|
93 | virtual void
|
---|
94 | ExportGeometry(const ObjectContainer &objects);
|
---|
95 |
|
---|
96 | bool
|
---|
97 | ExportRays(const RayContainer &rays,
|
---|
98 | const float length=1000,
|
---|
99 | const RgbColor &color = RgbColor(1,1,1));
|
---|
100 | bool
|
---|
101 | ExportRays(const VssRayContainer &rays,
|
---|
102 | const RgbColor &color = RgbColor(1,1,1));
|
---|
103 |
|
---|
104 | virtual void
|
---|
105 | ExportBspSplitPlanes(const BspTree &tree);
|
---|
106 |
|
---|
107 | virtual void
|
---|
108 | ExportBspSplits(const BspTree &tree, const bool exportDepth);
|
---|
109 |
|
---|
110 | virtual void
|
---|
111 | ExportLeavesGeometry(const BspTree &tree, const vector<BspLeaf *> &leaves);
|
---|
112 |
|
---|
113 | virtual void
|
---|
114 | ExportBspViewCellPartition(const BspTree &tree, const int maxPvs = 0);
|
---|
115 |
|
---|
116 | virtual void
|
---|
117 | ExportBspLeaves(const BspTree &tree, const int maxPvs = 0);
|
---|
118 |
|
---|
119 |
|
---|
120 | virtual void
|
---|
121 | ExportBspSplits(const VspBspTree &tree, const bool exportDepth);
|
---|
122 |
|
---|
123 | virtual void
|
---|
124 | ExportBspViewCellPartition(const VspBspTree &tree, const int maxPvs = 0);
|
---|
125 |
|
---|
126 | protected:
|
---|
127 |
|
---|
128 |
|
---|
129 | virtual void
|
---|
130 | ExportSceneNode(SceneGraphNode *node);
|
---|
131 |
|
---|
132 | bool
|
---|
133 | ExportKdTreeRayDensity(const KdTree &tree);
|
---|
134 |
|
---|
135 | bool
|
---|
136 | ExportBspTreeRayDensity(const BspTree &tree);
|
---|
137 |
|
---|
138 | void
|
---|
139 | AddBoxToMesh(const AxisAlignedBox3 &box,
|
---|
140 | Mesh *mesh);
|
---|
141 |
|
---|
142 | void ExportBspNodeSplits(BspNode *root,
|
---|
143 | const AxisAlignedBox3 &box,
|
---|
144 | const bool exportDepth,
|
---|
145 | const bool epsilon);
|
---|
146 | };
|
---|
147 |
|
---|
148 |
|
---|
149 |
|
---|
150 | #endif
|
---|