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