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

Revision 411, 4.1 KB checked in by mattausch, 19 years ago (diff)

worked on view space partition kd tree

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