1 | #ifndef _VisibilityQueryManager_H__
|
---|
2 | #define _VisibilityQueryManager_H__
|
---|
3 |
|
---|
4 | #include <vector>
|
---|
5 |
|
---|
6 | #include "VisibilityInfo.h"
|
---|
7 | #include "VisibilityVector3.h"
|
---|
8 | #include "VisibilityCamera.h"
|
---|
9 | #include "VisibilityRay.h"
|
---|
10 |
|
---|
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.
|
---|
20 | */
|
---|
21 | class QueryManager
|
---|
22 | {
|
---|
23 | public:
|
---|
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 | */
|
---|
27 | QueryManager(HierarchyInterface *hierarchyInterface);
|
---|
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
|
---|
33 |
|
---|
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 |
|
---|
65 | /**
|
---|
66 | Ray shooting interface: finds an intersection with objects in the scene.
|
---|
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.
|
---|
76 | */
|
---|
77 | virtual bool
|
---|
78 | ShootRay(const Ray &ray,
|
---|
79 | std::vector<Mesh *> *visibleMeshes,
|
---|
80 | bool isGlobalLine = false
|
---|
81 | );
|
---|
82 |
|
---|
83 | /** Sets the scene traverser.
|
---|
84 | @remark the scene traverser depends on the type of hierarchyInterface the scene consists of.
|
---|
85 | */
|
---|
86 | void SetSceneTraverser(HierarchyInterface *hierarchyInterface);
|
---|
87 |
|
---|
88 | protected:
|
---|
89 | HierarchyInterface *mHierarchyInterface;
|
---|
90 |
|
---|
91 | };
|
---|
92 |
|
---|
93 | };
|
---|
94 |
|
---|
95 | #endif // VisibilityQueryManager
|
---|