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