[68] | 1 | #ifndef _Preprocessor_H__ |
---|
| 2 | #define _Preprocessor_H__ |
---|
| 3 | |
---|
| 4 | #include "Containers.h" |
---|
| 5 | #include "Mesh.h" |
---|
| 6 | #include "KdTree.h" |
---|
| 7 | #include "ViewCellBsp.h" |
---|
| 8 | #include "SceneGraph.h" |
---|
[74] | 9 | #include <string> |
---|
[68] | 10 | |
---|
| 11 | /** Namespace for the external visibility preprocessor |
---|
| 12 | |
---|
| 13 | This namespace includes all classes which are created by the VUT (Vienna University |
---|
| 14 | of Technology) for the External Visibility Preprocessor of the GTP (GameTools Project) |
---|
| 15 | (www.gametools.org). |
---|
| 16 | */ |
---|
| 17 | namespace GtpVisibilityPreprocessor { |
---|
| 18 | /** Main class of the visibility preprocessor. Responsible for loading and |
---|
| 19 | saving of the input and output files. Initiates construction of the kD-tree, |
---|
| 20 | viewcell loading/generation and the visibility computation itself. |
---|
| 21 | */ |
---|
| 22 | class Preprocessor { |
---|
| 23 | public: |
---|
| 24 | /** Load the input scene. |
---|
| 25 | @param filename file to load |
---|
| 26 | @return true on success |
---|
| 27 | */ |
---|
| 28 | virtual bool LoadScene(const string filename); |
---|
| 29 | |
---|
| 30 | /** Generate the viewCells automatically. The particular algorithm to be used depends |
---|
| 31 | on the environment setting. Initially the generated viewcells will cover the whole |
---|
| 32 | bounding volume of the scene. They can be pruned later depending on the results |
---|
| 33 | of visibility computations. |
---|
| 34 | @return true on successful viewcell generation. |
---|
| 35 | */ |
---|
[261] | 36 | virtual bool GenerateViewCells(); |
---|
[68] | 37 | |
---|
| 38 | /** Export all preprocessed data in a XML format understandable by the |
---|
| 39 | PreprocessingInterface of the GtpVisibilityPreprocessor Module. The file can be compressed depending |
---|
| 40 | on the environement settings. |
---|
| 41 | @return true on successful export |
---|
| 42 | */ |
---|
| 43 | virtual bool ExportPreprocessedData(const string filename); |
---|
| 44 | |
---|
| 45 | /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction |
---|
| 46 | is driven by the environment settings, which also sais which of the three types of |
---|
| 47 | entities should be used to drive the heuristical construction (only occluders by default) |
---|
| 48 | */ |
---|
| 49 | virtual bool BuildKdTree(); |
---|
| 50 | |
---|
| 51 | /** Compute visibility method. This method has to be reimplemented by the actual |
---|
| 52 | Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor, |
---|
| 53 | GlobalSamplingpreprocessor) |
---|
| 54 | */ |
---|
| 55 | virtual bool ComputeVisibility() = 0; |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | protected: |
---|
| 59 | /// scene graph loaded from file |
---|
| 60 | SceneGraph *mSceneGraph; |
---|
| 61 | /// BSP tree representing the viewcells |
---|
[221] | 62 | BspTree *mViewCellBspTree; |
---|
[68] | 63 | /// kD-tree organizing the scene graph (occluders + occludees) + viewcells |
---|
| 64 | KdTree *mKdTree; |
---|
| 65 | |
---|
| 66 | /// list of all loaded occluders |
---|
| 67 | MeshContainer mOccluders; |
---|
| 68 | /// list of all loaded occludees |
---|
| 69 | MeshContainer mOccludees; |
---|
| 70 | /// list of all loaded/generated viewcells |
---|
| 71 | ViewCellContainer mViewcells; |
---|
| 72 | |
---|
| 73 | }; |
---|
| 74 | |
---|
| 75 | }; |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | #endif |
---|