[372] | 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 |
|
---|
[409] | 10 | class RenderSimulator;
|
---|
[372] | 11 | class SceneGraph;
|
---|
[429] | 12 | class Exporter;
|
---|
[439] | 13 | class ViewCellsManager;
|
---|
[445] | 14 | class BspTree;
|
---|
| 15 | class VspKdTree;
|
---|
| 16 | class VspBspTree;
|
---|
[468] | 17 | class RenderSimulator;
|
---|
[490] | 18 | struct VssRayContainer;
|
---|
[372] | 19 |
|
---|
[490] | 20 |
|
---|
[372] | 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 | */
|
---|
| 32 | class Preprocessor {
|
---|
| 33 | public:
|
---|
| 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 |
|
---|
[439] | 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();
|
---|
[372] | 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 |
|
---|
[490] | 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;
|
---|
[372] | 94 | /// scene graph loaded from file
|
---|
| 95 | SceneGraph *mSceneGraph;
|
---|
| 96 |
|
---|
| 97 | /// kD-tree organizing the scene graph (occluders + occludees) + viewcells
|
---|
| 98 | KdTree *mKdTree;
|
---|
| 99 |
|
---|
[445] | 100 | /// View space partition bsp tree
|
---|
| 101 | VspBspTree *mVspBspTree;
|
---|
[372] | 102 | /// list of all loaded occluders
|
---|
| 103 | ObjectContainer mOccluders;
|
---|
| 104 | /// list of all loaded occludees
|
---|
| 105 | ObjectContainer mOccludees;
|
---|
[439] | 106 |
|
---|
[372] | 107 | /// BSP tree representing the viewcells
|
---|
| 108 | BspTree *mBspTree;
|
---|
| 109 |
|
---|
[439] | 110 | ViewCellsManager *mViewCellsManager;
|
---|
[409] | 111 |
|
---|
[411] | 112 | /** Kd tree inducing a coarse partition of view space that are the building
|
---|
| 113 | blocks for view cells.
|
---|
| 114 | */
|
---|
| 115 | VspKdTree *mVspKdTree;
|
---|
[429] | 116 |
|
---|
[468] | 117 | /** Simulates rendering of the scene.
|
---|
| 118 | */
|
---|
| 119 | RenderSimulator *mRenderSimulator;
|
---|
[372] | 120 | };
|
---|
| 121 |
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 |
|
---|
| 125 |
|
---|
| 126 | #endif
|
---|