[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 |
|
---|
[409] | 10 | class RenderSimulator;
|
---|
[372] | 11 | class SceneGraph;
|
---|
[429] | 12 | class Exporter;
|
---|
[439] | 13 | class ViewCellsManager;
|
---|
[445] | 14 | class BspTree;
|
---|
| 15 | class VspKdTree;
|
---|
| 16 | class VspBspTree;
|
---|
[468] | 17 | class RenderSimulator;
|
---|
[372] | 18 |
|
---|
| 19 | /** Namespace for the external visibility preprocessor
|
---|
| 20 |
|
---|
| 21 | This namespace includes all classes which are created by the VUT (Vienna University
|
---|
| 22 | of Technology) for the External Visibility Preprocessor of the GTP (GameTools Project)
|
---|
| 23 | (www.gametools.org).
|
---|
| 24 | */
|
---|
| 25 |
|
---|
| 26 | /** Main class of the visibility preprocessor. Responsible for loading and
|
---|
| 27 | saving of the input and output files. Initiates construction of the kD-tree,
|
---|
| 28 | viewcell loading/generation and the visibility computation itself.
|
---|
| 29 | */
|
---|
| 30 | class Preprocessor {
|
---|
| 31 | public:
|
---|
| 32 | /** Default constructor initialising e.g., KD tree and BSP tree.
|
---|
| 33 | */
|
---|
| 34 | Preprocessor();
|
---|
| 35 |
|
---|
| 36 | virtual ~Preprocessor();
|
---|
| 37 |
|
---|
| 38 | /** Load the input scene.
|
---|
| 39 | @param filename file to load
|
---|
| 40 | @return true on success
|
---|
| 41 | */
|
---|
| 42 | virtual bool LoadScene(const string filename);
|
---|
| 43 |
|
---|
| 44 | /** Export all preprocessed data in a XML format understandable by the
|
---|
| 45 | PreprocessingInterface of the GtpVisibilityPreprocessor Module. The file can be compressed depending
|
---|
| 46 | on the environement settings.
|
---|
| 47 | @return true on successful export
|
---|
| 48 | */
|
---|
| 49 | virtual bool ExportPreprocessedData(const string filename);
|
---|
| 50 |
|
---|
| 51 | /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction
|
---|
| 52 | is driven by the environment settings, which also sais which of the three types of
|
---|
| 53 | entities should be used to drive the heuristical construction (only occluders by default)
|
---|
| 54 | */
|
---|
| 55 | virtual bool BuildKdTree();
|
---|
| 56 |
|
---|
| 57 | /** Compute visibility method. This method has to be reimplemented by the actual
|
---|
| 58 | Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor,
|
---|
| 59 | GlobalSamplingpreprocessor)
|
---|
| 60 | */
|
---|
| 61 | virtual bool ComputeVisibility() = 0;
|
---|
| 62 |
|
---|
[439] | 63 | /** View cells are either loaded or prepared for generation, according to the chosen environment
|
---|
| 64 | object. Important evironment options are, e.g, the view cell type.
|
---|
| 65 | Should be done after scene loading (i.e., some options are based on scene type).
|
---|
| 66 | */
|
---|
| 67 | bool PrepareViewCells();
|
---|
[372] | 68 |
|
---|
| 69 | bool
|
---|
| 70 | Export( const string filename,
|
---|
| 71 | const bool scene,
|
---|
| 72 | const bool kdtree,
|
---|
| 73 | const bool bsptree
|
---|
| 74 | );
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | virtual void KdTreeStatistics(ostream &s);
|
---|
| 78 | virtual void BspTreeStatistics(ostream &s);
|
---|
| 79 |
|
---|
| 80 | /// scene graph loaded from file
|
---|
| 81 | SceneGraph *mSceneGraph;
|
---|
| 82 |
|
---|
| 83 | /// kD-tree organizing the scene graph (occluders + occludees) + viewcells
|
---|
| 84 | KdTree *mKdTree;
|
---|
| 85 |
|
---|
[445] | 86 | /// View space partition bsp tree
|
---|
| 87 | VspBspTree *mVspBspTree;
|
---|
[372] | 88 | /// list of all loaded occluders
|
---|
| 89 | ObjectContainer mOccluders;
|
---|
| 90 | /// list of all loaded occludees
|
---|
| 91 | ObjectContainer mOccludees;
|
---|
[439] | 92 |
|
---|
[372] | 93 | /// BSP tree representing the viewcells
|
---|
| 94 | BspTree *mBspTree;
|
---|
| 95 |
|
---|
[439] | 96 | ViewCellsManager *mViewCellsManager;
|
---|
[409] | 97 |
|
---|
[411] | 98 | /** Kd tree inducing a coarse partition of view space that are the building
|
---|
| 99 | blocks for view cells.
|
---|
| 100 | */
|
---|
| 101 | VspKdTree *mVspKdTree;
|
---|
[429] | 102 |
|
---|
[468] | 103 | /** Simulates rendering of the scene.
|
---|
| 104 | */
|
---|
| 105 | RenderSimulator *mRenderSimulator;
|
---|
| 106 |
|
---|
[429] | 107 | protected:
|
---|
[463] | 108 |
|
---|
[440] | 109 | /////////////////////////
|
---|
[429] | 110 |
|
---|
[440] | 111 | /// samples used for construction of the BSP view cells tree.
|
---|
[429] | 112 | int mBspConstructionSamples;
|
---|
[440] | 113 | /// samples used for construction of the VSP KD tree.
|
---|
| 114 | int mVspKdConstructionSamples;
|
---|
[372] | 115 | };
|
---|
| 116 |
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 |
|
---|
| 120 |
|
---|
| 121 | #endif
|
---|