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