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 | #include <string> |
---|
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 | /** Load the input viewcells. The input viewcells should be given as a collection |
---|
31 | of meshes. Each mesh is assume to form a bounded polyhedron defining the interior of |
---|
32 | the viewcell. The method then builds a BSP tree of these view cells. |
---|
33 | @param filename file to load |
---|
34 | @return true on success |
---|
35 | */ |
---|
36 | virtual bool LoadViewcells(const string filename); |
---|
37 | |
---|
38 | /** Generate the viewCells automatically. The particular algorithm to be used depends |
---|
39 | on the environment setting. Initially the generated viewcells will cover the whole |
---|
40 | bounding volume of the scene. They can be pruned later depending on the results |
---|
41 | of visibility computations. |
---|
42 | @return true on successful viewcell generation. |
---|
43 | */ |
---|
44 | virtual bool GenerateViewcells(); |
---|
45 | |
---|
46 | /** Export all preprocessed data in a XML format understandable by the |
---|
47 | PreprocessingInterface of the GtpVisibilityPreprocessor Module. The file can be compressed depending |
---|
48 | on the environement settings. |
---|
49 | @return true on successful export |
---|
50 | */ |
---|
51 | virtual bool ExportPreprocessedData(const string filename); |
---|
52 | |
---|
53 | /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction |
---|
54 | is driven by the environment settings, which also sais which of the three types of |
---|
55 | entities should be used to drive the heuristical construction (only occluders by default) |
---|
56 | */ |
---|
57 | virtual bool BuildKdTree(); |
---|
58 | |
---|
59 | /** Compute visibility method. This method has to be reimplemented by the actual |
---|
60 | Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor, |
---|
61 | GlobalSamplingpreprocessor) |
---|
62 | */ |
---|
63 | virtual bool ComputeVisibility() = 0; |
---|
64 | |
---|
65 | |
---|
66 | protected: |
---|
67 | /// scene graph loaded from file |
---|
68 | SceneGraph *mSceneGraph; |
---|
69 | /// BSP tree representing the viewcells |
---|
70 | BspTree *mViewCellBspTree; |
---|
71 | /// kD-tree organizing the scene graph (occluders + occludees) + viewcells |
---|
72 | KdTree *mKdTree; |
---|
73 | |
---|
74 | /// list of all loaded occluders |
---|
75 | MeshContainer mOccluders; |
---|
76 | /// list of all loaded occludees |
---|
77 | MeshContainer mOccludees; |
---|
78 | /// list of all loaded/generated viewcells |
---|
79 | ViewCellContainer mViewcells; |
---|
80 | |
---|
81 | }; |
---|
82 | |
---|
83 | }; |
---|
84 | |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | #endif |
---|