source: trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h @ 429

Revision 429, 4.1 KB checked in by mattausch, 19 years ago (diff)
Line 
1#ifndef _Preprocessor_H__
2#define _Preprocessor_H__
3
4#include <string>
5using namespace std;
6#include "Containers.h"
7#include "Mesh.h"
8#include "KdTree.h"
9#include "ViewCellBsp.h"
10#include "ViewCell.h"
11#include "VspKdTree.h"
12
13class RenderSimulator;
14class SceneGraph;
15class Exporter;
16
17/** Namespace for the external visibility preprocessor
18
19    This namespace includes all classes which are created by the VUT (Vienna University
20    of Technology) for the External Visibility Preprocessor of the GTP (GameTools Project)
21    (www.gametools.org).
22*/
23 
24  /** Main class of the visibility preprocessor. Responsible for loading and
25      saving of the input and output files. Initiates construction of the kD-tree,
26      viewcell loading/generation and the visibility computation itself.
27  */
28class Preprocessor {
29public:
30        /** Default constructor initialising e.g., KD tree and BSP tree.
31        */
32        Preprocessor();
33
34   virtual ~Preprocessor();
35
36  /** Load the input scene.
37      @param filename file to load
38        @return true on success
39  */
40  virtual bool LoadScene(const string filename);
41 
42  /** Load the input viewcells. The input viewcells should be given as a collection
43      of meshes. Each mesh is assume to form a bounded polyhedron defining the interior of
44      the viewcell. The method then builds a BSP tree of these view cells.
45        @param filename file to load
46        @return true on success
47  */
48  virtual bool LoadViewCells(const string filename);
49 
50  /** Export all preprocessed data in a XML format understandable by the
51      PreprocessingInterface of the GtpVisibilityPreprocessor Module. The file can be compressed depending
52      on the environement settings.
53      @return true on successful export
54  */
55  virtual bool ExportPreprocessedData(const string filename);
56 
57  /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction
58      is driven by the environment settings, which also sais which of the three types of
59      entities should be used to drive the heuristical construction (only occluders by default)
60  */
61  virtual bool BuildKdTree();
62 
63   /** Build the BSP tree of currently loaded occluders/occludees/viewcells. The construction
64      is driven by the environment settings, which also says which of the three types of
65      entities should be used to drive the heuristical construction (only occluders by default)
66  */
67  virtual bool BuildBspTree() = 0;
68
69  /** Compute visibility method. This method has to be reimplemented by the actual
70      Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor,
71      GlobalSamplingpreprocessor)
72    */
73  virtual bool ComputeVisibility() = 0;
74 
75 
76  bool
77  Export( const string filename,
78          const bool scene,
79          const bool kdtree,
80          const bool bsptree
81          );
82 
83 
84  virtual void KdTreeStatistics(ostream &s);
85  virtual void BspTreeStatistics(ostream &s);
86
87  void DeleteViewCells();
88
89  RenderSimulator *GetRenderSimulator();
90
91  /** Parses the view cell options
92  */
93  bool ParseViewCellsOptions();
94
95
96  /// scene graph loaded from file
97  SceneGraph *mSceneGraph;
98 
99  /// kD-tree organizing the scene graph (occluders + occludees) + viewcells
100  KdTree *mKdTree;
101 
102  /// list of all loaded occluders
103  ObjectContainer mOccluders;
104  /// list of all loaded occludees
105  ObjectContainer mOccludees;
106  /// list of all loaded/generated viewcells
107  ViewCellContainer mViewCells;
108 
109  /// BSP tree representing the viewcells
110  BspTree *mBspTree;
111
112  /// the view cell corresponding to unbounded space
113  BspViewCell mUnbounded;
114
115  RenderSimulator *mRenderSimulator;
116
117  /** Kd tree inducing a coarse partition of view space that are the building
118          blocks for view cells.
119  */
120  VspKdTree *mVspKdTree;
121
122protected:
123  void ExportBspPvs(const ObjectContainer &objects,
124                                        const RayContainer &sampleRays,
125                                        const int visSamples);
126
127  void ExportSplits(const ObjectContainer &objects,
128                                        const RayContainer &sampleRays,
129                                        const int visSamples);
130
131  /** Export scene geometry.
132  */
133  void ExportSceneGeometry(Exporter *exporter, const ObjectContainer &objects);
134
135  int mBspConstructionSamples;
136};
137
138
139
140
141
142#endif
Note: See TracBrowser for help on using the repository browser.