#ifndef _Preprocessor_H__ #define _Preprocessor_H__ #include using namespace std; #include "Containers.h" #include "Mesh.h" #include "KdTree.h" #include "ViewCellBsp.h" //#include "SceneGraph.h" class SceneGraph; /** 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: /** Load the input scene. @param filename file to load @return true on success */ virtual bool LoadScene(const string filename); /** Load the input viewcells. The input viewcells should be given as a collection of meshes. Each mesh is assume to form a bounded polyhedron defining the interior of the viewcell. The method then builds a BSP tree of these view cells. @param filename file to load @return true on success */ virtual bool LoadViewcells(const string filename); /** Generate the viewCells automatically. The particular algorithm to be used depends on the environment setting. Initially the generated viewcells will cover the whole bounding volume of the scene. They can be pruned later depending on the results of visibility computations. @return true on successful viewcell generation. */ virtual bool GenerateViewcells(); /** 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(); /** Build the BSP tree 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 BuildBspTree(); /** Compute visibility method. This method has to be reimplemented by the actual Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor, GlobalSamplingpreprocessor) */ virtual bool ComputeVisibility() = 0; bool Export( const string filename, const bool scene, const bool kdtree ); virtual void KdTreeStatistics(ostream &s); virtual void BspTreeStatistics(ostream &s); /// scene graph loaded from file SceneGraph *mSceneGraph; /// BSP tree representing the viewcells BspTree *mViewCellBspTree; /// kD-tree organizing the scene graph (occluders + occludees) + viewcells KdTree *mKdTree; /// list of all loaded occluders ObjectContainer mOccluders; /// list of all loaded occludees ObjectContainer mOccludees; /// list of all loaded/generated viewcells ViewCellContainer mViewcells; BspTree * mBspTree; }; #endif