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