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 | |
---|
62 | /** Compute visibility method. This method has to be reimplemented by the actual |
---|
63 | Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor, |
---|
64 | GlobalSamplingpreprocessor) |
---|
65 | */ |
---|
66 | virtual bool ComputeVisibility() = 0; |
---|
67 | |
---|
68 | |
---|
69 | bool |
---|
70 | Export( const string filename, |
---|
71 | const bool scene, |
---|
72 | const bool kdtree |
---|
73 | ); |
---|
74 | |
---|
75 | |
---|
76 | virtual void KdTreeStatistics(ostream &s); |
---|
77 | |
---|
78 | /// scene graph loaded from file |
---|
79 | SceneGraph *mSceneGraph; |
---|
80 | /// BSP tree representing the viewcells |
---|
81 | BSPTree *mViewCellBSPTree; |
---|
82 | /// kD-tree organizing the scene graph (occluders + occludees) + viewcells |
---|
83 | KdTree *mKdTree; |
---|
84 | |
---|
85 | /// list of all loaded occluders |
---|
86 | MeshContainer mOccluders; |
---|
87 | /// list of all loaded occludees |
---|
88 | MeshContainer mOccludees; |
---|
89 | /// list of all loaded/generated viewcells |
---|
90 | ViewCellContainer mViewcells; |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | }; |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | #endif |
---|