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 |
|
---|
10 | class RenderSimulator;
|
---|
11 | class SceneGraph;
|
---|
12 | class Exporter;
|
---|
13 | class ViewCellsManager;
|
---|
14 | class BspTree;
|
---|
15 | class VspKdTree;
|
---|
16 | class VspBspTree;
|
---|
17 | class RenderSimulator;
|
---|
18 |
|
---|
19 | /** Namespace for the external visibility preprocessor
|
---|
20 |
|
---|
21 | This namespace includes all classes which are created by the VUT (Vienna University
|
---|
22 | of Technology) for the External Visibility Preprocessor of the GTP (GameTools Project)
|
---|
23 | (www.gametools.org).
|
---|
24 | */
|
---|
25 |
|
---|
26 | /** Main class of the visibility preprocessor. Responsible for loading and
|
---|
27 | saving of the input and output files. Initiates construction of the kD-tree,
|
---|
28 | viewcell loading/generation and the visibility computation itself.
|
---|
29 | */
|
---|
30 | class Preprocessor {
|
---|
31 | public:
|
---|
32 | /** Default constructor initialising e.g., KD tree and BSP tree.
|
---|
33 | */
|
---|
34 | Preprocessor();
|
---|
35 |
|
---|
36 | virtual ~Preprocessor();
|
---|
37 |
|
---|
38 | /** Load the input scene.
|
---|
39 | @param filename file to load
|
---|
40 | @return true on success
|
---|
41 | */
|
---|
42 | virtual bool LoadScene(const string filename);
|
---|
43 |
|
---|
44 | /** Export all preprocessed data in a XML format understandable by the
|
---|
45 | PreprocessingInterface of the GtpVisibilityPreprocessor Module. The file can be compressed depending
|
---|
46 | on the environement settings.
|
---|
47 | @return true on successful export
|
---|
48 | */
|
---|
49 | virtual bool ExportPreprocessedData(const string filename);
|
---|
50 |
|
---|
51 | /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction
|
---|
52 | is driven by the environment settings, which also sais which of the three types of
|
---|
53 | entities should be used to drive the heuristical construction (only occluders by default)
|
---|
54 | */
|
---|
55 | virtual bool BuildKdTree();
|
---|
56 |
|
---|
57 | /** Compute visibility method. This method has to be reimplemented by the actual
|
---|
58 | Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor,
|
---|
59 | GlobalSamplingpreprocessor)
|
---|
60 | */
|
---|
61 | virtual bool ComputeVisibility() = 0;
|
---|
62 |
|
---|
63 | /** View cells are either loaded or prepared for generation, according to the chosen environment
|
---|
64 | object. Important evironment options are, e.g, the view cell type.
|
---|
65 | Should be done after scene loading (i.e., some options are based on scene type).
|
---|
66 | */
|
---|
67 | bool PrepareViewCells();
|
---|
68 |
|
---|
69 | bool
|
---|
70 | Export( const string filename,
|
---|
71 | const bool scene,
|
---|
72 | const bool kdtree,
|
---|
73 | const bool bsptree
|
---|
74 | );
|
---|
75 |
|
---|
76 |
|
---|
77 | virtual void KdTreeStatistics(ostream &s);
|
---|
78 | virtual void BspTreeStatistics(ostream &s);
|
---|
79 |
|
---|
80 | /// scene graph loaded from file
|
---|
81 | SceneGraph *mSceneGraph;
|
---|
82 |
|
---|
83 | /// kD-tree organizing the scene graph (occluders + occludees) + viewcells
|
---|
84 | KdTree *mKdTree;
|
---|
85 |
|
---|
86 | /// View space partition bsp tree
|
---|
87 | VspBspTree *mVspBspTree;
|
---|
88 | /// list of all loaded occluders
|
---|
89 | ObjectContainer mOccluders;
|
---|
90 | /// list of all loaded occludees
|
---|
91 | ObjectContainer mOccludees;
|
---|
92 |
|
---|
93 | /// BSP tree representing the viewcells
|
---|
94 | BspTree *mBspTree;
|
---|
95 |
|
---|
96 | ViewCellsManager *mViewCellsManager;
|
---|
97 |
|
---|
98 | /** Kd tree inducing a coarse partition of view space that are the building
|
---|
99 | blocks for view cells.
|
---|
100 | */
|
---|
101 | VspKdTree *mVspKdTree;
|
---|
102 |
|
---|
103 | /** Simulates rendering of the scene.
|
---|
104 | */
|
---|
105 | RenderSimulator *mRenderSimulator;
|
---|
106 |
|
---|
107 | protected:
|
---|
108 |
|
---|
109 | /////////////////////////
|
---|
110 |
|
---|
111 | /// samples used for construction of the BSP view cells tree.
|
---|
112 | int mBspConstructionSamples;
|
---|
113 | /// samples used for construction of the VSP KD tree.
|
---|
114 | int mVspKdConstructionSamples;
|
---|
115 | };
|
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 | #endif
|
---|