[153] | 1 | #ifndef _ItemBufferQueryManager_H__ |
---|
| 2 | #define _ItemBufferQueryManager_H__ |
---|
| 3 | |
---|
| 4 | #include "OgrePlatformQueryManager.h" |
---|
| 5 | |
---|
| 6 | namespace Ogre {
|
---|
| 7 |
|
---|
| 8 | /**
|
---|
[159] | 9 | Class which implements the QueryManager for Ogre scene queries using an item buffer,
|
---|
| 10 | i.e., the objects are rendered with their id used as unique color code. After reading
|
---|
| 11 | back the frame buffer, the visibility information can be established for each object.
|
---|
[153] | 12 | */
|
---|
| 13 | class __declspec(dllexport) ItemBufferQueryManager: public PlatformQueryManager
|
---|
| 14 | {
|
---|
| 15 | public:
|
---|
| 16 | /** Constructor taking a hierarchy interface as an argument. This allows to operate
|
---|
[159] | 17 | on different hierarchy types, while reusing the implementation of the query methods.
|
---|
| 18 | @param renderPatches determines if the visibility of either patches or meshes is computed.
|
---|
[153] | 19 | */
|
---|
[159] | 20 | ItemBufferQueryManager(PlatformHierarchyInterface *hierarchyInterface, Viewport *vp,
|
---|
| 21 | const bool renderPatches);
|
---|
[153] | 22 |
|
---|
| 23 | void ComputeCameraVisibility(const Camera &camera,
|
---|
| 24 | InfoContainer<GtpVisibility::NodeInfo> *visibleNodes,
|
---|
| 25 | InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
|
---|
[159] | 26 | InfoContainer<GtpVisibility::PatchInfo> *visiblePatches,
|
---|
[153] | 27 | bool relativeVisibility = false);
|
---|
| 28 |
|
---|
| 29 | bool ShootRay(const Ray &ray, std::vector<Mesh *> *visibleMeshes, bool isGlobalLine = false);
|
---|
| 30 |
|
---|
| 31 | protected:
|
---|
[159] | 32 | /** Helper function used to initialise item buffer.
|
---|
| 33 | */
|
---|
| 34 | void InitItemBuffer( |
---|
| 35 | InfoContainer<GtpVisibility::NodeInfo> *visibleNodes, |
---|
| 36 | InfoContainer<GtpVisibility::MeshInfo> *visibleGeometry,
|
---|
| 37 | InfoContainer<GtpVisibility::PatchInfo> *visiblePatches);
|
---|
[154] | 38 |
|
---|
[159] | 39 | /// if patches are used instead of meshes (only one at a time)
|
---|
| 40 | bool mRenderPatchesForItemBuffer;
|
---|
[153] | 41 | };
|
---|
| 42 |
|
---|
| 43 | } // namespace Ogre
|
---|
| 44 |
|
---|
| 45 | #endif // ItemBufferQueryManager
|
---|