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