[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;
|
---|
[462] | 23 | class VspKdViewCell;
|
---|
[162] | 24 |
|
---|
[462] | 25 |
|
---|
[162] | 26 | class X3dExporter : public Exporter
|
---|
| 27 | {
|
---|
| 28 | std::ofstream stream;
|
---|
| 29 |
|
---|
| 30 | public:
|
---|
| 31 |
|
---|
| 32 | X3dExporter(const string filename);
|
---|
| 33 |
|
---|
| 34 | ~X3dExporter();
|
---|
| 35 |
|
---|
| 36 |
|
---|
[386] | 37 | // bool
|
---|
| 38 | // ExportRays(const vector<Ray> &rays,
|
---|
| 39 | // const float length=1000,
|
---|
| 40 | // const RgbColor &color = RgbColor(1,1,1));
|
---|
[162] | 41 |
|
---|
[446] | 42 |
|
---|
[162] | 43 | bool
|
---|
| 44 | ExportKdTree(const KdTree &tree);
|
---|
[434] | 45 |
|
---|
[438] | 46 | bool
|
---|
[434] | 47 | ExportVssTree(const VssTree &tree);
|
---|
| 48 |
|
---|
[438] | 49 | bool
|
---|
| 50 | ExportVssTree2(const VssTree &tree,
|
---|
| 51 | const Vector3 direction
|
---|
| 52 | );
|
---|
[446] | 53 |
|
---|
| 54 | virtual bool
|
---|
| 55 | ExportRssTree2(const RssTree &tree,
|
---|
| 56 | const Vector3 direction
|
---|
| 57 | );
|
---|
| 58 |
|
---|
[462] | 59 | bool
|
---|
[425] | 60 | ExportVspKdTree(const VspKdTree &tree, const int maxPvs);
|
---|
[418] | 61 |
|
---|
[242] | 62 | bool ExportBspTree(const BspTree &tree);
|
---|
| 63 |
|
---|
[162] | 64 | bool
|
---|
[462] | 65 | ExportScene(SceneGraphNode *root)
|
---|
[162] | 66 | {
|
---|
| 67 | ExportSceneNode(root);
|
---|
| 68 | return true;
|
---|
| 69 | }
|
---|
[462] | 70 |
|
---|
| 71 | virtual void
|
---|
[260] | 72 | ExportPolygon(Polygon3 *poly);
|
---|
[242] | 73 |
|
---|
[462] | 74 | virtual void
|
---|
[362] | 75 | ExportPolygons(const PolygonContainer &polys);
|
---|
[263] | 76 |
|
---|
[176] | 77 | virtual bool
|
---|
[162] | 78 | ExportBox(const AxisAlignedBox3 &box);
|
---|
| 79 |
|
---|
| 80 | virtual void
|
---|
| 81 | ExportMeshInstance(MeshInstance *mi);
|
---|
| 82 |
|
---|
[176] | 83 | virtual void
|
---|
| 84 | ExportIntersectable(Intersectable *object);
|
---|
| 85 |
|
---|
| 86 | virtual void
|
---|
[162] | 87 | ExportMesh(Mesh *mesh);
|
---|
| 88 |
|
---|
[462] | 89 | virtual void
|
---|
[260] | 90 | ExportViewCell(ViewCell *viewCell);
|
---|
[176] | 91 |
|
---|
[462] | 92 | virtual void
|
---|
[313] | 93 | ExportViewCells(const ViewCellContainer &viewCells);
|
---|
[312] | 94 |
|
---|
[462] | 95 | virtual void
|
---|
[440] | 96 | ExportGeometry(const ObjectContainer &objects);
|
---|
| 97 |
|
---|
[448] | 98 | bool
|
---|
| 99 | ExportRays(const RayContainer &rays,
|
---|
| 100 | const float length=1000,
|
---|
| 101 | const RgbColor &color = RgbColor(1,1,1));
|
---|
| 102 | bool
|
---|
| 103 | ExportRays(const VssRayContainer &rays,
|
---|
| 104 | const RgbColor &color = RgbColor(1,1,1));
|
---|
| 105 |
|
---|
[462] | 106 | virtual void
|
---|
[313] | 107 | ExportBspSplitPlanes(const BspTree &tree);
|
---|
[462] | 108 |
|
---|
| 109 | virtual void
|
---|
[383] | 110 | ExportBspSplits(const BspTree &tree, const bool exportDepth);
|
---|
[312] | 111 |
|
---|
[360] | 112 | virtual void
|
---|
| 113 | ExportLeavesGeometry(const BspTree &tree, const vector<BspLeaf *> &leaves);
|
---|
| 114 |
|
---|
[373] | 115 | virtual void
|
---|
[379] | 116 | ExportBspViewCellPartition(const BspTree &tree, const int maxPvs = 0);
|
---|
[373] | 117 |
|
---|
[462] | 118 | virtual void
|
---|
[396] | 119 | ExportBspLeaves(const BspTree &tree, const int maxPvs = 0);
|
---|
[373] | 120 |
|
---|
[448] | 121 |
|
---|
[462] | 122 | virtual void
|
---|
[448] | 123 | ExportBspSplits(const VspBspTree &tree, const bool exportDepth);
|
---|
| 124 |
|
---|
| 125 | virtual void
|
---|
| 126 | ExportBspViewCellPartition(const VspBspTree &tree, const int maxPvs = 0);
|
---|
| 127 |
|
---|
[462] | 128 | virtual bool
|
---|
| 129 | ExportVspKdTreeViewCells(const VspKdTree &tree, const int maxPvs = 0);
|
---|
| 130 |
|
---|
[162] | 131 | protected:
|
---|
[329] | 132 |
|
---|
[448] | 133 |
|
---|
[176] | 134 | virtual void
|
---|
[162] | 135 | ExportSceneNode(SceneGraphNode *node);
|
---|
| 136 |
|
---|
[191] | 137 | bool
|
---|
| 138 | ExportKdTreeRayDensity(const KdTree &tree);
|
---|
| 139 |
|
---|
[263] | 140 | bool
|
---|
[434] | 141 | ExportBspTreeRayDensity(const BspTree &tree);
|
---|
[462] | 142 |
|
---|
[448] | 143 | void
|
---|
| 144 | AddBoxToMesh(const AxisAlignedBox3 &box,
|
---|
| 145 | Mesh *mesh);
|
---|
[434] | 146 |
|
---|
[448] | 147 | void ExportBspNodeSplits(BspNode *root,
|
---|
[462] | 148 | const AxisAlignedBox3 &box,
|
---|
[448] | 149 | const bool exportDepth,
|
---|
[462] | 150 | const bool epsilon);
|
---|
[459] | 151 |
|
---|
[462] | 152 | bool ExportVspKdTreeViewCell(const VspKdTree &tree, const VspKdViewCell &vc);
|
---|
[459] | 153 |
|
---|
| 154 |
|
---|
| 155 | void ExportViewpoint(const Vector3 &point, const Vector3 &direction);
|
---|
| 156 |
|
---|
[162] | 157 | };
|
---|
| 158 |
|
---|
| 159 |
|
---|
[462] | 160 |
|
---|
[162] | 161 | #endif
|
---|