source: branches/VUT/v2.0/GtpVisibility/include/PreprocessingManager.h @ 113

Revision 113, 5.2 KB checked in by mattausch, 19 years ago (diff)

fixed problems with visualization

Line 
1#ifndef _VisibilityPreprocessingManager_H__
2#define _VisibilityPreprocessingManager_H__
3
4#include <string>
5using namespace std;
6
7#include "HierarchyInterface.h"
8#include "VisibilityInfo.h"
9#include "VisibilityVector3.h"
10
11namespace GtpVisibility {
12 
13/**
14        This class defines an interface to the external visibility preprocessor.
15    It allows to export the static part of the scene to a file in the XML format
16    understood by the preprocessor. By default all the exported meshes are considered
17    as scene occluders, whereas occludees are formed by their bounding boxes,
18    and bounding boxes of the scene hierarchy.
19
20    This class also allows to import the preprocessed data with PVS
21    information for the viewcells (note that the viewcells are either generated
22    automatically by the preprocessor or loaded from a polyhedral definition stored
23    in a file (see documentation for the Preprocessor class).
24*/
25 
26class PreprocessingManager
27{
28public:
29   
30        /** Constructor taking a HierarchyInterface as argument.
31        The HierarchyInterface makes the PreprocessingManager independent from the actual
32        scene representation as long as it supports a required set of methods.
33    */
34    PreprocessingManager(HierarchyInterface *hierarchyInterface);
35   
36
37    /**
38        Destructor which deletes all data describing static scene visibility.
39    */
40    virtual ~PreprocessingManager();
41
42    /** Export the scene for visibility preprocessing. Exports the hierarchyInterface including
43        its bounding boxes + mesh data. Note that the bounding boxes can be used as occludees
44        by the extrenal preprocessor. The viewcell data will either be supplied directly to the
45        visibility preprocessing standalone module.
46
47        @param filename name of the file to export.
48        @return true if the export was succesful.
49    */
50    virtual bool ExportScene(const string filename) = 0;
51   
52        /** Load preprocessed visibility information. The loaded data is matched with the current
53        scene graph. The topology of the current scene graph has to match with the loaded data.
54        There is also geometrical check of the bounding boxes. Once loading is succesful the
55        PreprocessingManager establishes links from its internal visibility representation
56        to the scene graph: no change of this part of the scene graph is allowed; this would
57        violate the static scene assumption!
58
59        @param filename name of the file to load.
60        @return true if the loading was succesful.
61    */
62    virtual bool LoadPreprocessedData(const string filename) = 0;
63   
64    /**
65        Retrieve a PVS corresponding to the given spherical neighborhood of the point.
66        Typically the implementation of this method will firs locate all viewcells
67        intersecting the sphere using efficient logarithmic search enhanced with caching
68        the last query. Then it computes a union of the PVS for the found viewcells.
69
70        @param point the center point of the spherical neighborhood
71
72        @param radius the radius of the spherical neighborhood. Note that if radius==0 a
73        more efficient implementation of the method for this special case can be used.
74
75        @param visibleNodes of not NULL
76        a set of visible hierarchy nodes is added to the visibleNodes container.
77        This set is formed of visible leafs or fully visible interior nodes.
78
79        @param visibleMeshes if not NULL the set of visible meshes is
80        added to the container. Returns true if the corresponding PVS exists.
81    */
82    virtual bool GetPVS(const Vector3 &point,
83                        const float radius,
84                        InfoContainer<NodeInfo> *visibleNodes,
85                        InfoContainer<MeshInfo> *visibleMeshes );
86   
87   
88 
89    /** Sets the scene traverser.
90        @remark the scene traverser is dependent on the type of hierarchyInterface the scene consists of.
91    */
92    virtual void SetSceneTraverser(HierarchyInterface *hierarchyInterface) {
93      mSceneTraverser = hierarchyInterface;
94    }
95   
96  protected:
97    /** Get checksum of the current occluder set in the scene graph. This method is used to check
98        if the preprocessed data matches the current scene graph
99        -> $$ could be moved to VisibilitySceneTraverser */
100    long GetOccluderChecksum() const {
101      return 0;
102    }
103     
104   
105    /** Get checksum of the current occludee set in the scene graph. This method is used to check
106        if the preprocessed data matches the current scene graph
107        -> $$ could be moved to VisibilitySceneTraverser */
108    long GetOccludeeChecksum() const {
109      return 0;
110    }
111   
112   
113    /**
114        Find viewcells intersecting a spherical neighborhood of a point.
115        Returns false if no viewcell was found.
116    */
117    virtual bool LocateViewCellIds(const Vector3 &center,
118                                   const float radius,
119                                   vector<int> *viewCellIds
120                                   ) = 0;
121   
122    /**
123       Add a PVS of the given viewcell to the already evaluated PVS by computing
124       a union with visibleNodes and visibleMeshes. Returns the number of added entries.
125    */
126    virtual int AddViewCellPVS(const int cellID,
127                               InfoContainer<NodeInfo> *visibleNodes,
128                               InfoContainer<MeshInfo> *visibleMeshes ) = 0;
129   
130    HierarchyInterface *mSceneTraverser;
131  };
132 
133};
134
135#endif // VisibilityPreprocessingInterafce
Note: See TracBrowser for help on using the repository browser.