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 |
|
---|
14 | namespace GtpVisibilityPreprocessor {
|
---|
15 |
|
---|
16 | class KdTree;
|
---|
17 | class BspTree;
|
---|
18 | class SceneGraphNode;
|
---|
19 | class Ray;
|
---|
20 | class AxisAlignedBox3;
|
---|
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 | {}
|
---|
52 |
|
---|
53 | virtual ~Exporter() {}
|
---|
54 |
|
---|
55 | virtual bool ExportScene(SceneGraphNode *node) = 0;
|
---|
56 |
|
---|
57 | virtual bool
|
---|
58 | ExportBox(const AxisAlignedBox3 &box) = 0;
|
---|
59 |
|
---|
60 | virtual bool
|
---|
61 | ExportKdTree(const KdTree &tree, const bool exportGeometry = false) = 0;
|
---|
62 |
|
---|
63 | virtual bool
|
---|
64 | ExportVssTree(const VssTree &tree) = 0;
|
---|
65 |
|
---|
66 | virtual bool
|
---|
67 | ExportVssTree2(const VssTree &tree,
|
---|
68 | const Vector3 direction
|
---|
69 | ) = 0;
|
---|
70 |
|
---|
71 | virtual bool
|
---|
72 | ExportBspTree(const BspTree &tree) = 0;
|
---|
73 |
|
---|
74 | virtual bool
|
---|
75 | ExportOspTree(const OspTree &tree, const int maxPvs);
|
---|
76 |
|
---|
77 | virtual bool
|
---|
78 | ExportRays(const RayContainer &rays,
|
---|
79 | const float length=1000,
|
---|
80 | const RgbColor &color = RgbColor(1,1,1)
|
---|
81 | ) = 0;
|
---|
82 |
|
---|
83 | virtual bool
|
---|
84 | ExportRays(const VssRayContainer &rays,
|
---|
85 | const RgbColor &color = RgbColor(1,1,1)
|
---|
86 | ) = 0;
|
---|
87 |
|
---|
88 | virtual bool
|
---|
89 | ExportRaySets(const vector<VssRayContainer> &rays,
|
---|
90 | const RgbColor &color) = 0;
|
---|
91 |
|
---|
92 | virtual void
|
---|
93 | ExportViewCells(const ViewCellContainer &viewCells);
|
---|
94 |
|
---|
95 | virtual void
|
---|
96 | ExportViewCell(ViewCell *viewCell) = 0;
|
---|
97 |
|
---|
98 | virtual void
|
---|
99 | ExportIntersectable(Intersectable *object);
|
---|
100 |
|
---|
101 | virtual void
|
---|
102 | ExportBspSplitPlanes(const BspTree &tree) = 0;
|
---|
103 | virtual void
|
---|
104 | ExportBspSplits(const BspTree &tree, const bool exportDepth = false) = 0;
|
---|
105 |
|
---|
106 | virtual void
|
---|
107 | ExportLeavesGeometry(const BspTree &tree, const vector<BspLeaf *> &leaves) = 0;
|
---|
108 |
|
---|
109 | virtual void
|
---|
110 | ExportBspSplits(const VspBspTree &tree, const bool exportDepth = false) = 0;
|
---|
111 |
|
---|
112 | virtual void
|
---|
113 | ExportPolygons(const PolygonContainer &polys) = 0;
|
---|
114 |
|
---|
115 | virtual void
|
---|
116 | ExportBspLeaves(const BspTree &tree, const int maxPvs = 0) = 0;
|
---|
117 |
|
---|
118 | virtual void
|
---|
119 | ExportGeometry(
|
---|
120 | const ObjectContainer &objects,
|
---|
121 | const bool exportSingleMesh = false,
|
---|
122 | AxisAlignedBox3 *bbox = NULL);
|
---|
123 |
|
---|
124 | virtual void
|
---|
125 | ExportMesh(Mesh *mesh) = 0;
|
---|
126 |
|
---|
127 | virtual bool
|
---|
128 | ExportRssTree2(const RssTree &tree,
|
---|
129 | const Vector3 direction) = 0;
|
---|
130 |
|
---|
131 | virtual void ExportBeam(const Beam &beam, const AxisAlignedBox3 &box) = 0;
|
---|
132 |
|
---|
133 | void SetExportRayDensity(const bool d) { mExportRayDensity = d; }
|
---|
134 |
|
---|
135 | void SetWireframe() { mWireframe = true; }
|
---|
136 | void SetFilled() { mWireframe = false; }
|
---|
137 |
|
---|
138 | void SetForcedMaterial(const Material &m) {
|
---|
139 | mForcedMaterial = m;
|
---|
140 | mUseForcedMaterial = true;
|
---|
141 | }
|
---|
142 | void ResetForcedMaterial() {
|
---|
143 | mUseForcedMaterial = false;
|
---|
144 | }
|
---|
145 |
|
---|
146 | static Exporter *
|
---|
147 | GetExporter(const string filename);
|
---|
148 |
|
---|
149 | virtual void ExportViewpoint(const Vector3 &point, const Vector3 &direction) = 0;
|
---|
150 |
|
---|
151 | void ExportKdIntersectable(const KdIntersectable &kdObj);
|
---|
152 |
|
---|
153 | bool ExportBvHierarchy(
|
---|
154 | const BvHierarchy &bvHierarchy,
|
---|
155 | const int maxPvs,
|
---|
156 | const AxisAlignedBox3 *box = NULL,
|
---|
157 | const bool exportBoundingBoxes = true);
|
---|
158 |
|
---|
159 | virtual void ExportMeshInstance(MeshInstance *mi);
|
---|
160 |
|
---|
161 | virtual void
|
---|
162 | ExportTransformedMeshInstance(TransformedMeshInstance *mi);
|
---|
163 |
|
---|
164 | virtual void ExportPolygon(Polygon3 *poly) = 0;
|
---|
165 | };
|
---|
166 |
|
---|
167 | }
|
---|
168 |
|
---|
169 | #endif
|
---|