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

Revision 297, 3.6 KB checked in by mattausch, 19 years ago (diff)

added bsp split plane criteria

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 "SceneGraph.h"
11
12class 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  */
25class Preprocessor {
26public:
27        /** Default constructor initialising e.g., KD tree and BSP tree.
28        */
29        Preprocessor();
30
31   ~Preprocessor();
32
33  /** Load the input scene.
34      @param filename file to load
35        @return true on success
36  */
37  virtual bool LoadScene(const string filename);
38 
39  /** Load the input viewcells. The input viewcells should be given as a collection
40      of meshes. Each mesh is assume to form a bounded polyhedron defining the interior of
41      the viewcell. The method then builds a BSP tree of these view cells.
42        @param filename file to load
43        @return true on success
44  */
45  virtual bool LoadViewCells(const string filename);
46 
47  /** Generate the viewCells automatically. The particular algorithm to be used depends
48      on the environment setting. Initially the generated viewcells will cover the whole
49      bounding volume of the scene. They can be pruned later depending on the results
50      of visibility computations.
51      @return true on successful viewcell generation.
52  */
53  virtual bool GenerateViewCells();
54 
55  /** Export all preprocessed data in a XML format understandable by the
56      PreprocessingInterface of the GtpVisibilityPreprocessor Module. The file can be compressed depending
57      on the environement settings.
58      @return true on successful export
59  */
60  virtual bool ExportPreprocessedData(const string filename);
61 
62  /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction
63      is driven by the environment settings, which also sais which of the three types of
64      entities should be used to drive the heuristical construction (only occluders by default)
65  */
66  virtual bool BuildKdTree();
67 
68   /** Build the BSP tree of currently loaded occluders/occludees/viewcells. The construction
69      is driven by the environment settings, which also says which of the three types of
70      entities should be used to drive the heuristical construction (only occluders by default)
71  */
72  virtual bool BuildBspTree();
73
74  /** Compute visibility method. This method has to be reimplemented by the actual
75      Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor,
76      GlobalSamplingpreprocessor)
77    */
78  virtual bool ComputeVisibility() = 0;
79 
80 
81  bool
82  Export( const string filename,
83          const bool scene,
84          const bool kdtree,
85          const bool bsptree
86          );
87 
88 
89  virtual void KdTreeStatistics(ostream &s);
90  virtual void BspTreeStatistics(ostream &s);
91
92  /// scene graph loaded from file
93  SceneGraph *mSceneGraph;
94 
95  /// kD-tree organizing the scene graph (occluders + occludees) + viewcells
96  KdTree *mKdTree;
97 
98  /// list of all loaded occluders
99  ObjectContainer mOccluders;
100  /// list of all loaded occludees
101  ObjectContainer mOccludees;
102  /// list of all loaded/generated viewcells
103  ViewCellContainer mViewCells;
104 
105  /// BSP tree representing the viewcells
106  BspTree *mBspTree;
107
108  /// the root view cell of the bsp tree
109  ViewCell *mRootViewCell;
110};
111
112
113
114
115
116#endif
Note: See TracBrowser for help on using the repository browser.