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