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

Revision 490, 3.7 KB checked in by mattausch, 19 years ago (diff)

added loading and storing rays capability

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