[59] | 1 | #ifndef _VisibilityPreprocessingManager_H__
|
---|
| 2 | #define _VisibilityPreprocessingManager_H__
|
---|
| 3 |
|
---|
[65] | 4 | #include <string>
|
---|
| 5 | using namespace std;
|
---|
[59] | 6 |
|
---|
[65] | 7 | #include "HierarchyInterface.h"
|
---|
| 8 | #include "VisibilityInfo.h"
|
---|
[2280] | 9 | //#include "VisibilityVector3.h"
|
---|
[59] | 10 |
|
---|
[65] | 11 | namespace GtpVisibility {
|
---|
| 12 |
|
---|
[71] | 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.
|
---|
[59] | 19 |
|
---|
[71] | 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 | */
|
---|
[59] | 25 |
|
---|
[71] | 26 | class PreprocessingManager
|
---|
| 27 | {
|
---|
| 28 | public:
|
---|
[65] | 29 |
|
---|
[71] | 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);
|
---|
[65] | 35 |
|
---|
[59] | 36 |
|
---|
[65] | 37 | /**
|
---|
[71] | 38 | Destructor which deletes all data describing static scene visibility.
|
---|
[65] | 39 | */
|
---|
| 40 | virtual ~PreprocessingManager();
|
---|
[59] | 41 |
|
---|
[71] | 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.
|
---|
[59] | 46 |
|
---|
[71] | 47 | @param filename name of the file to export.
|
---|
| 48 | @return true if the export was succesful.
|
---|
[65] | 49 | */
|
---|
[71] | 50 | virtual bool ExportScene(const string filename) = 0;
|
---|
[65] | 51 |
|
---|
[71] | 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!
|
---|
[59] | 58 |
|
---|
[71] | 59 | @param filename name of the file to load.
|
---|
| 60 | @return true if the loading was succesful.
|
---|
[65] | 61 | */
|
---|
[71] | 62 | virtual bool LoadPreprocessedData(const string filename) = 0;
|
---|
[65] | 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.
|
---|
[59] | 69 |
|
---|
[65] | 70 | @param point the center point of the spherical neighborhood
|
---|
[59] | 71 |
|
---|
[65] | 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.
|
---|
[59] | 74 |
|
---|
[67] | 75 | @param visibleNodes of not NULL
|
---|
| 76 | a set of visible hierarchy nodes is added to the visibleNodes container.
|
---|
[65] | 77 | This set is formed of visible leafs or fully visible interior nodes.
|
---|
[67] | 78 |
|
---|
| 79 | @param visibleMeshes if not NULL the set of visible meshes is
|
---|
[65] | 80 | added to the container. Returns true if the corresponding PVS exists.
|
---|
| 81 | */
|
---|
[2280] | 82 | /* virtual bool GetPVS(const Vector3 &point,
|
---|
[65] | 83 | const float radius,
|
---|
[316] | 84 | NodeInfoContainer *visibleNodes,
|
---|
| 85 | MeshInfoContainer *visibleMeshes);
|
---|
[2280] | 86 | */
|
---|
[65] | 87 |
|
---|
| 88 |
|
---|
| 89 | /** Sets the scene traverser.
|
---|
| 90 | @remark the scene traverser is dependent on the type of hierarchyInterface the scene consists of.
|
---|
| 91 | */
|
---|
[113] | 92 | virtual void SetSceneTraverser(HierarchyInterface *hierarchyInterface) {
|
---|
[65] | 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 | */
|
---|
[2280] | 117 | /* virtual bool LocateViewCellIds(const Vector3 ¢er,
|
---|
[65] | 118 | const float radius,
|
---|
| 119 | vector<int> *viewCellIds
|
---|
| 120 | ) = 0;
|
---|
[2280] | 121 | */
|
---|
[65] | 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 | */
|
---|
[2280] | 126 | /* virtual int AddViewCellPVS(const int cellID,
|
---|
[316] | 127 | NodeInfoContainer *visibleNodes,
|
---|
| 128 | MeshInfoContainer *visibleMeshes ) = 0;
|
---|
[2280] | 129 | */
|
---|
[65] | 130 | HierarchyInterface *mSceneTraverser;
|
---|
| 131 | };
|
---|
| 132 |
|
---|
[59] | 133 | };
|
---|
| 134 |
|
---|
[65] | 135 | #endif // VisibilityPreprocessingInterafce
|
---|