1 | #ifndef __EXPORTER_H
|
---|
2 | #define __EXPORTER_H
|
---|
3 |
|
---|
4 | #include <string>
|
---|
5 | #include <vector>
|
---|
6 |
|
---|
7 |
|
---|
8 | #include "Material.h"
|
---|
9 | #include "Containers.h"
|
---|
10 | #include "AxisAlignedBox3.h"
|
---|
11 |
|
---|
12 | namespace GtpVisibilityPreprocessor {
|
---|
13 |
|
---|
14 | class KdTree;
|
---|
15 | class BspTree;
|
---|
16 | class SceneGraphNode;
|
---|
17 | class Ray;
|
---|
18 | class Intersectable;
|
---|
19 | class BspLeaf;
|
---|
20 | class Polygon3;
|
---|
21 | class VssTree;
|
---|
22 | class VspBspTree;
|
---|
23 | class RssTree;
|
---|
24 | class Mesh;
|
---|
25 | class Beam;
|
---|
26 | class OspTree;
|
---|
27 | class KdIntersectable;
|
---|
28 | class BvHierarchy;
|
---|
29 | class TransformedMeshInstance;
|
---|
30 | class MeshInstance;
|
---|
31 | class VssRay;
|
---|
32 | class TraversalTree;
|
---|
33 |
|
---|
34 |
|
---|
35 | struct VssRayContainer;
|
---|
36 |
|
---|
37 | class Exporter
|
---|
38 | {
|
---|
39 | protected:
|
---|
40 | std::string mFilename;
|
---|
41 | bool mWireFrame;
|
---|
42 | bool mUseForcedMaterial;
|
---|
43 | Material mForcedMaterial;
|
---|
44 |
|
---|
45 | bool mExportRayDensity;
|
---|
46 |
|
---|
47 | public:
|
---|
48 |
|
---|
49 | Exporter(const std::string filename):
|
---|
50 | mFilename(filename),
|
---|
51 | mWireFrame(false),
|
---|
52 | mUseForcedMaterial(false),
|
---|
53 | mExportRayDensity(false),
|
---|
54 | mClampToBox(false)
|
---|
55 | {}
|
---|
56 |
|
---|
57 | virtual ~Exporter() {}
|
---|
58 |
|
---|
59 | virtual bool ExportScene(SceneGraphNode *node) = 0;
|
---|
60 |
|
---|
61 | virtual bool
|
---|
62 | ExportBox(const AxisAlignedBox3 &box) = 0;
|
---|
63 |
|
---|
64 | virtual bool
|
---|
65 | ExportKdTree(const KdTree &tree, const bool exportGeometry = false) = 0;
|
---|
66 |
|
---|
67 | virtual bool
|
---|
68 | ExportTraversalTree(const TraversalTree &tree, const bool exportViewCells);
|
---|
69 |
|
---|
70 | virtual bool
|
---|
71 | ExportVssTree(const VssTree &tree) = 0;
|
---|
72 |
|
---|
73 | virtual bool
|
---|
74 | ExportVssTree2(const VssTree &tree,
|
---|
75 | const Vector3 direction
|
---|
76 | ) = 0;
|
---|
77 |
|
---|
78 | virtual bool
|
---|
79 | ExportBspTree(const BspTree &tree) = 0;
|
---|
80 |
|
---|
81 | virtual bool
|
---|
82 | ExportOspTree(const OspTree &tree, const int maxPvs);
|
---|
83 |
|
---|
84 | virtual bool
|
---|
85 | ExportRays(const RayContainer &rays,
|
---|
86 | const float length=1000,
|
---|
87 | const RgbColor &color = RgbColor(1,1,1)
|
---|
88 | ) = 0;
|
---|
89 |
|
---|
90 | virtual bool
|
---|
91 | ExportRays(const VssRayContainer &rays,
|
---|
92 | const RgbColor &color = RgbColor(1,1,1)
|
---|
93 | ) = 0;
|
---|
94 |
|
---|
95 | virtual bool
|
---|
96 | ExportRaySets(const vector<VssRayContainer> &rays,
|
---|
97 | const RgbColor &color) = 0;
|
---|
98 |
|
---|
99 | virtual void
|
---|
100 | ExportViewCells(const ViewCellContainer &viewCells);
|
---|
101 |
|
---|
102 | virtual void
|
---|
103 | ExportViewCell(ViewCell *viewCell) = 0;
|
---|
104 |
|
---|
105 | virtual void
|
---|
106 | ExportIntersectable(Intersectable *object);
|
---|
107 |
|
---|
108 | virtual void
|
---|
109 | ExportBspSplitPlanes(const BspTree &tree) = 0;
|
---|
110 | virtual void
|
---|
111 | ExportBspSplits(const BspTree &tree, const bool exportDepth = false) = 0;
|
---|
112 |
|
---|
113 | virtual void
|
---|
114 | ExportLeavesGeometry(const BspTree &tree, const vector<BspLeaf *> &leaves) = 0;
|
---|
115 |
|
---|
116 | virtual void
|
---|
117 | ExportBspSplits(const VspBspTree &tree, const bool exportDepth = false) = 0;
|
---|
118 |
|
---|
119 | virtual void
|
---|
120 | ExportPolygons(const PolygonContainer &polys) = 0;
|
---|
121 |
|
---|
122 | virtual void
|
---|
123 | ExportBspLeaves(const BspTree &tree, const int maxPvs = 0) = 0;
|
---|
124 |
|
---|
125 | virtual void
|
---|
126 | ExportGeometry(const ObjectContainer &objects,
|
---|
127 | const bool exportSingleMesh = false,
|
---|
128 | AxisAlignedBox3 *bbox = NULL);
|
---|
129 |
|
---|
130 | virtual void
|
---|
131 | ExportMesh(Mesh *mesh) = 0;
|
---|
132 |
|
---|
133 | virtual bool
|
---|
134 | ExportRssTree2(const RssTree &tree,
|
---|
135 | const Vector3 direction) = 0;
|
---|
136 |
|
---|
137 | virtual void ExportBeam(const Beam &beam, const AxisAlignedBox3 &box) = 0;
|
---|
138 |
|
---|
139 | void SetExportRayDensity(const bool d) { mExportRayDensity = d; }
|
---|
140 |
|
---|
141 | void SetWireframe() { mWireFrame = true; }
|
---|
142 | void SetFilled() { mWireFrame = false; }
|
---|
143 |
|
---|
144 | void SetForcedMaterial(const Material &m)
|
---|
145 | {
|
---|
146 | mForcedMaterial = m;
|
---|
147 | mUseForcedMaterial = true;
|
---|
148 | }
|
---|
149 |
|
---|
150 | void ResetForcedMaterial()
|
---|
151 | {
|
---|
152 | mUseForcedMaterial = false;
|
---|
153 | }
|
---|
154 |
|
---|
155 | static Exporter *
|
---|
156 | GetExporter(const std::string filename);
|
---|
157 |
|
---|
158 | virtual void ExportViewpoint(const Vector3 &point, const Vector3 &direction) = 0;
|
---|
159 |
|
---|
160 | void ExportKdIntersectable(const KdIntersectable &kdObj);
|
---|
161 |
|
---|
162 | bool ExportBvHierarchy(const BvHierarchy &bvHierarchy,
|
---|
163 | const float maxPvs,
|
---|
164 | AxisAlignedBox3 *box = NULL,
|
---|
165 | const bool exportBoundingBoxes = true);
|
---|
166 |
|
---|
167 | virtual void ExportMeshInstance(MeshInstance *mi);
|
---|
168 |
|
---|
169 | virtual void ExportTransformedMeshInstance(TransformedMeshInstance *mi);
|
---|
170 |
|
---|
171 | virtual void
|
---|
172 | ExportPolygon(Polygon3 *poly) = 0;
|
---|
173 |
|
---|
174 |
|
---|
175 | ///////////////////////////
|
---|
176 |
|
---|
177 | bool mClampToBox;
|
---|
178 | AxisAlignedBox3 mBoundingBox;
|
---|
179 | };
|
---|
180 |
|
---|
181 | }
|
---|
182 |
|
---|
183 | #endif
|
---|