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