1 | #ifndef _PlatformQueryManager_H__ |
---|
2 | #define _PlatformQueryManager_H__ |
---|
3 | |
---|
4 | #include "VisibilityInfo.h" |
---|
5 | #include "QueryManager.h" |
---|
6 | #include "OgrePlatformHierarchyInterface.h" |
---|
7 | |
---|
8 | namespace Ogre {
|
---|
9 |
|
---|
10 | /**
|
---|
11 | Class which implements the QueryManager for Ogre scene queries.
|
---|
12 | */
|
---|
13 | class __declspec(dllexport) PlatformQueryManager: public GtpVisibility::QueryManager
|
---|
14 | {
|
---|
15 | public:
|
---|
16 | /** Constructor taking a hierarchy interface as an argument. This allows to operate
|
---|
17 | onm different hierarchy types, while reusing the implementation of the query methods.
|
---|
18 | */
|
---|
19 | PlatformQueryManager(PlatformHierarchyInterface *hierarchyInterface, Viewport *vp);
|
---|
20 |
|
---|
21 | /**
|
---|
22 | Computes restricted visibility from point by using an explicit camera to execute
|
---|
23 | the visibility query.
|
---|
24 | @param camera The camera to be used
|
---|
25 |
|
---|
26 | @param visibleNodes Pointer to the container where visible nodes should be added.
|
---|
27 | This set is formed of visible leafs or fully visible interior nodes.
|
---|
28 | If NULL no visible nodes are not evaluated.
|
---|
29 |
|
---|
30 | @param visibleGeometry Pointer to the container where visible meshes should be added.
|
---|
31 | If NULL no visible meshes are not evaluated.
|
---|
32 |
|
---|
33 | @param relativeVisibility If true the visibility member for
|
---|
34 | NodeInfo and MeshInfo represent relative visibility; i.e. the number of visible
|
---|
35 | pixels divided by the the number of projected pixels.
|
---|
36 |
|
---|
37 | @return true if the corresponding PVS exists.
|
---|
38 | */
|
---|
39 | virtual void
|
---|
40 | ComputeCameraVisibility(const Camera &camera,
|
---|
41 | InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
|
---|
42 | InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
|
---|
43 | bool relativeVisibility = false
|
---|
44 | );
|
---|
45 |
|
---|
46 | /**
|
---|
47 | Uses the specified point to execute the visibility query in all directions.
|
---|
48 | @sa ComputeCameraVisibility()
|
---|
49 | */
|
---|
50 | virtual void
|
---|
51 | ComputeFromPointVisibility(const Vector3 &point,
|
---|
52 | InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
|
---|
53 | InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
|
---|
54 | bool relativeVisibility = false
|
---|
55 | );
|
---|
56 |
|
---|
57 | /**
|
---|
58 | Ray shooting interface: finds an intersection with objects in the scene.
|
---|
59 |
|
---|
60 | @param ray The given input ray (assuming the ray direction is normalized)
|
---|
61 |
|
---|
62 | @param visibleMeshes List of meshes intersecting the ray
|
---|
63 |
|
---|
64 | @param isGlobalLine If false only first intersection with opaque object is returned.
|
---|
65 | Otherwise all intersections of the ray with the scene are found.
|
---|
66 |
|
---|
67 | @return true if there is any intersection.
|
---|
68 | */
|
---|
69 | virtual bool
|
---|
70 | ShootRay(const Ray &ray,
|
---|
71 | std::vector<Mesh *> *visibleMeshes,
|
---|
72 | bool isGlobalLine = false
|
---|
73 | );
|
---|
74 |
|
---|
75 | /** Sets a viewport to render into.
|
---|
76 | */
|
---|
77 | void SetViewport(Viewport *vp);
|
---|
78 |
|
---|
79 | protected:
|
---|
80 | SceneManager *mSceneManager;
|
---|
81 | Viewport *mViewport;
|
---|
82 | };
|
---|
83 |
|
---|
84 | } // namespace Ogre
|
---|
85 |
|
---|
86 | #endif // PlatformQueryManager
|
---|