[372] | 1 | #ifndef _Preprocessor_H__
|
---|
| 2 | #define _Preprocessor_H__
|
---|
| 3 |
|
---|
| 4 | #include <string>
|
---|
| 5 | using namespace std;
|
---|
| 6 | #include "Containers.h"
|
---|
| 7 | #include "Mesh.h"
|
---|
| 8 | #include "KdTree.h"
|
---|
| 9 | #include "ViewCellBsp.h"
|
---|
| 10 | #include "ViewCell.h"
|
---|
[411] | 11 | #include "VspKdTree.h"
|
---|
[372] | 12 |
|
---|
[409] | 13 | class RenderSimulator;
|
---|
[372] | 14 | class SceneGraph;
|
---|
| 15 |
|
---|
| 16 | /** Namespace for the external visibility preprocessor
|
---|
| 17 |
|
---|
| 18 | This namespace includes all classes which are created by the VUT (Vienna University
|
---|
| 19 | of Technology) for the External Visibility Preprocessor of the GTP (GameTools Project)
|
---|
| 20 | (www.gametools.org).
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | /** Main class of the visibility preprocessor. Responsible for loading and
|
---|
| 24 | saving of the input and output files. Initiates construction of the kD-tree,
|
---|
| 25 | viewcell loading/generation and the visibility computation itself.
|
---|
| 26 | */
|
---|
| 27 | class Preprocessor {
|
---|
| 28 | public:
|
---|
| 29 | /** Default constructor initialising e.g., KD tree and BSP tree.
|
---|
| 30 | */
|
---|
| 31 | Preprocessor();
|
---|
| 32 |
|
---|
| 33 | virtual ~Preprocessor();
|
---|
| 34 |
|
---|
| 35 | /** Load the input scene.
|
---|
| 36 | @param filename file to load
|
---|
| 37 | @return true on success
|
---|
| 38 | */
|
---|
| 39 | virtual bool LoadScene(const string filename);
|
---|
| 40 |
|
---|
| 41 | /** Load the input viewcells. The input viewcells should be given as a collection
|
---|
| 42 | of meshes. Each mesh is assume to form a bounded polyhedron defining the interior of
|
---|
| 43 | the viewcell. The method then builds a BSP tree of these view cells.
|
---|
| 44 | @param filename file to load
|
---|
| 45 | @return true on success
|
---|
| 46 | */
|
---|
| 47 | virtual bool LoadViewCells(const string filename);
|
---|
| 48 |
|
---|
| 49 | /** Export all preprocessed data in a XML format understandable by the
|
---|
| 50 | PreprocessingInterface of the GtpVisibilityPreprocessor Module. The file can be compressed depending
|
---|
| 51 | on the environement settings.
|
---|
| 52 | @return true on successful export
|
---|
| 53 | */
|
---|
| 54 | virtual bool ExportPreprocessedData(const string filename);
|
---|
| 55 |
|
---|
| 56 | /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction
|
---|
| 57 | is driven by the environment settings, which also sais which of the three types of
|
---|
| 58 | entities should be used to drive the heuristical construction (only occluders by default)
|
---|
| 59 | */
|
---|
| 60 | virtual bool BuildKdTree();
|
---|
| 61 |
|
---|
| 62 | /** Build the BSP tree of currently loaded occluders/occludees/viewcells. The construction
|
---|
| 63 | is driven by the environment settings, which also says which of the three types of
|
---|
| 64 | entities should be used to drive the heuristical construction (only occluders by default)
|
---|
| 65 | */
|
---|
| 66 | virtual bool BuildBspTree() = 0;
|
---|
| 67 |
|
---|
| 68 | /** Compute visibility method. This method has to be reimplemented by the actual
|
---|
| 69 | Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor,
|
---|
| 70 | GlobalSamplingpreprocessor)
|
---|
| 71 | */
|
---|
| 72 | virtual bool ComputeVisibility() = 0;
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 | bool
|
---|
| 76 | Export( const string filename,
|
---|
| 77 | const bool scene,
|
---|
| 78 | const bool kdtree,
|
---|
| 79 | const bool bsptree
|
---|
| 80 | );
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | virtual void KdTreeStatistics(ostream &s);
|
---|
| 84 | virtual void BspTreeStatistics(ostream &s);
|
---|
| 85 |
|
---|
| 86 | void DeleteViewCells();
|
---|
| 87 |
|
---|
[409] | 88 | RenderSimulator *GetRenderSimulator();
|
---|
| 89 |
|
---|
[372] | 90 | /** Parses the view cell options
|
---|
| 91 | */
|
---|
| 92 | bool ParseViewCellsOptions();
|
---|
| 93 |
|
---|
| 94 | /// scene graph loaded from file
|
---|
| 95 | SceneGraph *mSceneGraph;
|
---|
| 96 |
|
---|
| 97 | /// kD-tree organizing the scene graph (occluders + occludees) + viewcells
|
---|
| 98 | KdTree *mKdTree;
|
---|
| 99 |
|
---|
| 100 | /// list of all loaded occluders
|
---|
| 101 | ObjectContainer mOccluders;
|
---|
| 102 | /// list of all loaded occludees
|
---|
| 103 | ObjectContainer mOccludees;
|
---|
| 104 | /// list of all loaded/generated viewcells
|
---|
| 105 | ViewCellContainer mViewCells;
|
---|
| 106 |
|
---|
| 107 | /// BSP tree representing the viewcells
|
---|
| 108 | BspTree *mBspTree;
|
---|
| 109 |
|
---|
| 110 | /// the view cell corresponding to unbounded space
|
---|
[392] | 111 | BspViewCell mUnbounded;
|
---|
[409] | 112 |
|
---|
| 113 | RenderSimulator *mRenderSimulator;
|
---|
[411] | 114 |
|
---|
| 115 | /** Kd tree inducing a coarse partition of view space that are the building
|
---|
| 116 | blocks for view cells.
|
---|
| 117 | */
|
---|
| 118 | VspKdTree *mVspKdTree;
|
---|
[372] | 119 | };
|
---|
| 120 |
|
---|
| 121 |
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 |
|
---|
| 125 | #endif
|
---|