[59] | 1 | #ifndef _VisibilityQueryManager_H__
|
---|
| 2 | #define _VisibilityQueryManager_H__
|
---|
| 3 |
|
---|
[65] | 4 | #include <vector>
|
---|
| 5 |
|
---|
[59] | 6 | #include "VisibilityInfo.h"
|
---|
[65] | 7 | #include "VisibilityVector3.h"
|
---|
| 8 | #include "VisibilityCamera.h"
|
---|
| 9 | #include "VisibilityRay.h"
|
---|
[59] | 10 |
|
---|
[65] | 11 | namespace GtpVisibility {
|
---|
| 12 |
|
---|
| 13 | /** This abstract class defines interface for a specific visibility query
|
---|
| 14 | algorithm. The interface supports two from point visibility queries and
|
---|
| 15 | the ray shooting query. The output of the queries consists of list of
|
---|
| 16 | visible meshes and hierarchy nodes. The from point queries will be implemented
|
---|
| 17 | either with item bufferring or based purelly on occlusion queries. Note that
|
---|
| 18 | the actuall implementation can also exploit the
|
---|
| 19 | output of the visibility preprocessor.
|
---|
[59] | 20 | */
|
---|
[71] | 21 | class QueryManager
|
---|
| 22 | {
|
---|
| 23 | public:
|
---|
[65] | 24 | /** Constructor taking a hierarchy interface as an argument. This allows to operate
|
---|
| 25 | onm different hierarchy types, while reusing the implementation of the query methods.
|
---|
| 26 | */
|
---|
[113] | 27 | QueryManager(HierarchyInterface *hierarchyInterface);
|
---|
[65] | 28 |
|
---|
| 29 | /**
|
---|
| 30 | Computes restricted visibility from point by using an explicit camera to execute
|
---|
| 31 | the visibility query.
|
---|
| 32 | @param camera The camera to be used
|
---|
[59] | 33 |
|
---|
[65] | 34 | @param visibleNodes Pointer to the container where visible nodes should be added.
|
---|
| 35 | This set is formed of visible leafs or fully visible interior nodes.
|
---|
| 36 | If NULL no visible nodes are not evaluated.
|
---|
| 37 |
|
---|
| 38 | @param visibleGeometry Pointer to the container where visible meshes should be added.
|
---|
| 39 | If NULL no visible meshes are not evaluated.
|
---|
| 40 |
|
---|
| 41 | @param relativeVisibility If true the visibility member for
|
---|
| 42 | NodeInfo and MeshInfo represent relative visibility; i.e. the number of visible
|
---|
| 43 | pixels divided by the the number of projected pixels.
|
---|
| 44 |
|
---|
| 45 | @return true if the corresponding PVS exists.
|
---|
| 46 | */
|
---|
| 47 | virtual void
|
---|
| 48 | ComputeCameraVisibility(const Camera &camera,
|
---|
| 49 | InfoContainer<NodeInfo> *visibleNodes,
|
---|
| 50 | InfoContainer<MeshInfo> *visibleGeometry,
|
---|
| 51 | bool relativeVisibility = false
|
---|
| 52 | ) = 0;
|
---|
| 53 |
|
---|
| 54 | /**
|
---|
| 55 | Uses the specified point to execute the visibility query in all directions.
|
---|
| 56 | @sa ComputeCameraVisibility()
|
---|
| 57 | */
|
---|
| 58 | virtual void
|
---|
| 59 | ComputeFromPointVisibility(const Vector3 &point,
|
---|
| 60 | InfoContainer<NodeInfo> *visibleNodes,
|
---|
| 61 | InfoContainer<MeshInfo> *visibleGeometry,
|
---|
| 62 | bool relativeVisibility = false
|
---|
| 63 | ) = 0;
|
---|
| 64 |
|
---|
[59] | 65 | /**
|
---|
[113] | 66 | Ray shooting interface: finds an intersection with objects in the scene.
|
---|
[65] | 67 |
|
---|
| 68 | @param ray The given input ray (assuming the ray direction is normalized)
|
---|
| 69 |
|
---|
| 70 | @param visibleMeshes List of meshes intersecting the ray
|
---|
| 71 |
|
---|
| 72 | @param isGlobalLine If false only first intersection with opaque object is returned.
|
---|
| 73 | Otherwise all intersections of the ray with the scene are found.
|
---|
| 74 |
|
---|
| 75 | @return true if there is any intersection.
|
---|
[71] | 76 | */
|
---|
[65] | 77 | virtual bool
|
---|
| 78 | ShootRay(const Ray &ray,
|
---|
| 79 | std::vector<Mesh *> *visibleMeshes,
|
---|
| 80 | bool isGlobalLine = false
|
---|
| 81 | );
|
---|
[59] | 82 |
|
---|
[71] | 83 | /** Sets the scene traverser.
|
---|
[65] | 84 | @remark the scene traverser depends on the type of hierarchyInterface the scene consists of.
|
---|
[71] | 85 | */
|
---|
[113] | 86 | void SetSceneTraverser(HierarchyInterface *hierarchyInterface);
|
---|
[59] | 87 |
|
---|
| 88 | protected:
|
---|
[65] | 89 | HierarchyInterface *mHierarchyInterface;
|
---|
[59] | 90 |
|
---|
| 91 | };
|
---|
| 92 |
|
---|
[65] | 93 | };
|
---|
| 94 |
|
---|
[59] | 95 | #endif // VisibilityQueryManager
|
---|