[162] | 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 "SceneGraph.h" |
---|
| 11 | |
---|
| 12 | class SceneGraph; |
---|
| 13 | |
---|
| 14 | /** Namespace for the external visibility preprocessor |
---|
| 15 | |
---|
| 16 | This namespace includes all classes which are created by the VUT (Vienna University |
---|
| 17 | of Technology) for the External Visibility Preprocessor of the GTP (GameTools Project) |
---|
| 18 | (www.gametools.org). |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | /** Main class of the visibility preprocessor. Responsible for loading and |
---|
| 22 | saving of the input and output files. Initiates construction of the kD-tree, |
---|
| 23 | viewcell loading/generation and the visibility computation itself. |
---|
| 24 | */ |
---|
| 25 | class Preprocessor { |
---|
| 26 | public: |
---|
| 27 | /** Load the input scene. |
---|
| 28 | @param filename file to load |
---|
| 29 | @return true on success |
---|
| 30 | */ |
---|
| 31 | virtual bool LoadScene(const string filename); |
---|
| 32 | |
---|
| 33 | /** Load the input viewcells. The input viewcells should be given as a collection |
---|
| 34 | of meshes. Each mesh is assume to form a bounded polyhedron defining the interior of |
---|
| 35 | the viewcell. The method then builds a BSP tree of these view cells. |
---|
| 36 | @param filename file to load |
---|
| 37 | @return true on success |
---|
| 38 | */ |
---|
| 39 | virtual bool LoadViewcells(const string filename); |
---|
| 40 | |
---|
| 41 | /** Generate the viewCells automatically. The particular algorithm to be used depends |
---|
| 42 | on the environment setting. Initially the generated viewcells will cover the whole |
---|
| 43 | bounding volume of the scene. They can be pruned later depending on the results |
---|
| 44 | of visibility computations. |
---|
| 45 | @return true on successful viewcell generation. |
---|
| 46 | */ |
---|
| 47 | virtual bool GenerateViewcells(); |
---|
| 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 | |
---|
[234] | 62 | /** Build the BSP tree of currently loaded occluders/occludees/viewcells. The construction |
---|
| 63 | is driven by the environment settings, which also sais 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(); |
---|
| 67 | |
---|
[162] | 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 | ); |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | virtual void KdTreeStatistics(ostream &s); |
---|
[234] | 83 | virtual void BspTreeStatistics(ostream &s); |
---|
| 84 | |
---|
[162] | 85 | /// scene graph loaded from file |
---|
| 86 | SceneGraph *mSceneGraph; |
---|
| 87 | /// BSP tree representing the viewcells |
---|
[221] | 88 | BspTree *mViewCellBspTree; |
---|
[162] | 89 | /// kD-tree organizing the scene graph (occluders + occludees) + viewcells |
---|
| 90 | KdTree *mKdTree; |
---|
| 91 | |
---|
| 92 | /// list of all loaded occluders |
---|
[176] | 93 | ObjectContainer mOccluders; |
---|
[162] | 94 | /// list of all loaded occludees |
---|
[176] | 95 | ObjectContainer mOccludees; |
---|
[162] | 96 | /// list of all loaded/generated viewcells |
---|
| 97 | ViewCellContainer mViewcells; |
---|
| 98 | |
---|
[234] | 99 | BspTree * mBspTree; |
---|
[162] | 100 | |
---|
| 101 | }; |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | #endif |
---|