[162] | 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"
|
---|
[261] | 11 | #include "Containers.h"
|
---|
[386] | 12 | #include "VssRay.h"
|
---|
[162] | 13 |
|
---|
| 14 | class SceneGraphNode;
|
---|
| 15 | class Mesh;
|
---|
[176] | 16 | class Intersectable;
|
---|
| 17 | class MeshInstance;
|
---|
[242] | 18 | class Polygon3;
|
---|
| 19 | class ViewCell;
|
---|
| 20 | class BspTree;
|
---|
[448] | 21 | class VspBspTree;
|
---|
| 22 | class BspNode;
|
---|
[162] | 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 |
|
---|
[386] | 35 | // bool
|
---|
| 36 | // ExportRays(const vector<Ray> &rays,
|
---|
| 37 | // const float length=1000,
|
---|
| 38 | // const RgbColor &color = RgbColor(1,1,1));
|
---|
[162] | 39 |
|
---|
[446] | 40 |
|
---|
[162] | 41 | bool
|
---|
| 42 | ExportKdTree(const KdTree &tree);
|
---|
[434] | 43 |
|
---|
[438] | 44 | bool
|
---|
[434] | 45 | ExportVssTree(const VssTree &tree);
|
---|
| 46 |
|
---|
[438] | 47 | bool
|
---|
| 48 | ExportVssTree2(const VssTree &tree,
|
---|
| 49 | const Vector3 direction
|
---|
| 50 | );
|
---|
[446] | 51 |
|
---|
| 52 | virtual bool
|
---|
| 53 | ExportRssTree2(const RssTree &tree,
|
---|
| 54 | const Vector3 direction
|
---|
| 55 | );
|
---|
| 56 |
|
---|
[418] | 57 | bool
|
---|
[425] | 58 | ExportVspKdTree(const VspKdTree &tree, const int maxPvs);
|
---|
[418] | 59 |
|
---|
[242] | 60 | bool ExportBspTree(const BspTree &tree);
|
---|
| 61 |
|
---|
[162] | 62 | bool
|
---|
| 63 | ExportScene(SceneGraphNode *root)
|
---|
| 64 | {
|
---|
| 65 | ExportSceneNode(root);
|
---|
| 66 | return true;
|
---|
| 67 | }
|
---|
| 68 |
|
---|
[242] | 69 | virtual void
|
---|
[260] | 70 | ExportPolygon(Polygon3 *poly);
|
---|
[242] | 71 |
|
---|
[362] | 72 | virtual void
|
---|
| 73 | ExportPolygons(const PolygonContainer &polys);
|
---|
[263] | 74 |
|
---|
[176] | 75 | virtual bool
|
---|
[162] | 76 | ExportBox(const AxisAlignedBox3 &box);
|
---|
| 77 |
|
---|
| 78 | virtual void
|
---|
| 79 | ExportMeshInstance(MeshInstance *mi);
|
---|
| 80 |
|
---|
[176] | 81 | virtual void
|
---|
| 82 | ExportIntersectable(Intersectable *object);
|
---|
| 83 |
|
---|
| 84 | virtual void
|
---|
[162] | 85 | ExportMesh(Mesh *mesh);
|
---|
| 86 |
|
---|
[260] | 87 | virtual void
|
---|
| 88 | ExportViewCell(ViewCell *viewCell);
|
---|
[176] | 89 |
|
---|
[261] | 90 | virtual void
|
---|
[313] | 91 | ExportViewCells(const ViewCellContainer &viewCells);
|
---|
[312] | 92 |
|
---|
[313] | 93 | virtual void
|
---|
[440] | 94 | ExportGeometry(const ObjectContainer &objects);
|
---|
| 95 |
|
---|
[448] | 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 |
|
---|
[440] | 104 | virtual void
|
---|
[313] | 105 | ExportBspSplitPlanes(const BspTree &tree);
|
---|
| 106 |
|
---|
| 107 | virtual void
|
---|
[383] | 108 | ExportBspSplits(const BspTree &tree, const bool exportDepth);
|
---|
[312] | 109 |
|
---|
[360] | 110 | virtual void
|
---|
| 111 | ExportLeavesGeometry(const BspTree &tree, const vector<BspLeaf *> &leaves);
|
---|
| 112 |
|
---|
[373] | 113 | virtual void
|
---|
[379] | 114 | ExportBspViewCellPartition(const BspTree &tree, const int maxPvs = 0);
|
---|
[373] | 115 |
|
---|
| 116 | virtual void
|
---|
[396] | 117 | ExportBspLeaves(const BspTree &tree, const int maxPvs = 0);
|
---|
[373] | 118 |
|
---|
[448] | 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 |
|
---|
[162] | 126 | protected:
|
---|
[329] | 127 |
|
---|
[448] | 128 |
|
---|
[176] | 129 | virtual void
|
---|
[162] | 130 | ExportSceneNode(SceneGraphNode *node);
|
---|
| 131 |
|
---|
[191] | 132 | bool
|
---|
| 133 | ExportKdTreeRayDensity(const KdTree &tree);
|
---|
| 134 |
|
---|
[263] | 135 | bool
|
---|
[434] | 136 | ExportBspTreeRayDensity(const BspTree &tree);
|
---|
[448] | 137 |
|
---|
| 138 | void
|
---|
| 139 | AddBoxToMesh(const AxisAlignedBox3 &box,
|
---|
| 140 | Mesh *mesh);
|
---|
[434] | 141 |
|
---|
[448] | 142 | void ExportBspNodeSplits(BspNode *root,
|
---|
| 143 | const AxisAlignedBox3 &box,
|
---|
| 144 | const bool exportDepth,
|
---|
[459] | 145 |
|
---|
| 146 |
|
---|
[448] | 147 | const bool epsilon);
|
---|
[459] | 148 |
|
---|
| 149 | void ExportViewpoint(const Vector3 &point, const Vector3 &direction);
|
---|
| 150 |
|
---|
[162] | 151 | };
|
---|
| 152 |
|
---|
| 153 |
|
---|
| 154 |
|
---|
| 155 | #endif
|
---|