#ifndef _Preprocessor_H__ #define _Preprocessor_H__ #include using namespace std; #include "Containers.h" #include "Mesh.h" #include "KdTree.h" class RenderSimulator; class SceneGraph; class Exporter; class ViewCellsManager; class BspTree; class VspKdTree; class VspBspTree; /** Namespace for the external visibility preprocessor This namespace includes all classes which are created by the VUT (Vienna University of Technology) for the External Visibility Preprocessor of the GTP (GameTools Project) (www.gametools.org). */ /** Main class of the visibility preprocessor. Responsible for loading and saving of the input and output files. Initiates construction of the kD-tree, viewcell loading/generation and the visibility computation itself. */ class Preprocessor { public: /** Default constructor initialising e.g., KD tree and BSP tree. */ Preprocessor(); virtual ~Preprocessor(); /** Load the input scene. @param filename file to load @return true on success */ virtual bool LoadScene(const string filename); /** Export all preprocessed data in a XML format understandable by the PreprocessingInterface of the GtpVisibilityPreprocessor Module. The file can be compressed depending on the environement settings. @return true on successful export */ virtual bool ExportPreprocessedData(const string filename); /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction is driven by the environment settings, which also sais which of the three types of entities should be used to drive the heuristical construction (only occluders by default) */ virtual bool BuildKdTree(); /** Compute visibility method. This method has to be reimplemented by the actual Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor, GlobalSamplingpreprocessor) */ virtual bool ComputeVisibility() = 0; /** View cells are either loaded or prepared for generation, according to the chosen environment object. Important evironment options are, e.g, the view cell type. Should be done after scene loading (i.e., some options are based on scene type). */ bool PrepareViewCells(); bool Export( const string filename, const bool scene, const bool kdtree, const bool bsptree ); virtual void KdTreeStatistics(ostream &s); virtual void BspTreeStatistics(ostream &s); /// scene graph loaded from file SceneGraph *mSceneGraph; /// kD-tree organizing the scene graph (occluders + occludees) + viewcells KdTree *mKdTree; /// View space partition bsp tree VspBspTree *mVspBspTree; /// list of all loaded occluders ObjectContainer mOccluders; /// list of all loaded occludees ObjectContainer mOccludees; /// BSP tree representing the viewcells BspTree *mBspTree; ViewCellsManager *mViewCellsManager; /** Kd tree inducing a coarse partition of view space that are the building blocks for view cells. */ VspKdTree *mVspKdTree; protected: ///////////////////////// /// samples used for construction of the BSP view cells tree. int mBspConstructionSamples; /// samples used for construction of the VSP KD tree. int mVspKdConstructionSamples; }; #endif