Generates a selection buffer object for a given camera. The selection buffer is used of entity selection. On setup, a unique color is assigned to each entity. Whenever a selection request is made, the selection buffer camera renders to a 1x1 sized offscreen buffer. The color value of that pixel gives the identity of the entity. More...
#include <Ogre2SelectionBuffer.hh>
Public Member Functions | |
Ogre2SelectionBuffer (const std::string &_cameraName, Ogre2ScenePtr _scene, unsigned int _width, unsigned int _height) | |
Constructor. | |
~Ogre2SelectionBuffer () | |
Destructor. | |
bool | ExecuteQuery (const int _x, const int _y, Ogre::Item *&_item, math::Vector3d &_point) |
Perform selection operation and get ogre item and point of intersection. | |
bool | ExecuteQuery (int _x, int _y, Ogre::MovableObject *&_obj, math::Vector3d &_point) |
Perform selection operation and get ogre item and point of intersection. | |
Ogre::MovableObject * | OnSelectionClick (int _x, int _y) |
Handle on mouse click. | |
void | SetDimensions (unsigned int _width, unsigned int _height) |
Set dimension of the selection buffer. | |
void | Update () |
Call this to update the selection buffer contents. | |
Detailed Description
Generates a selection buffer object for a given camera. The selection buffer is used of entity selection. On setup, a unique color is assigned to each entity. Whenever a selection request is made, the selection buffer camera renders to a 1x1 sized offscreen buffer. The color value of that pixel gives the identity of the entity.
Constructor & Destructor Documentation
◆ Ogre2SelectionBuffer()
Ogre2SelectionBuffer | ( | const std::string & | _cameraName, |
Ogre2ScenePtr | _scene, | ||
unsigned int | _width, | ||
unsigned int | _height | ||
) |
Constructor.
- Parameters
-
[in] _cameraName Name of the camera to generate a selection buffer for. [in] _scene Pointer to the scene [in] _width width of the camera [in] _height height of the camera
◆ ~Ogre2SelectionBuffer()
~Ogre2SelectionBuffer | ( | ) |
Destructor.
Member Function Documentation
◆ ExecuteQuery() [1/2]
bool ExecuteQuery | ( | const int | _x, |
const int | _y, | ||
Ogre::Item *& | _item, | ||
math::Vector3d & | _point | ||
) |
Perform selection operation and get ogre item and point of intersection.
- Parameters
-
[in] _x X coordinate in pixels. [in] _y Y coordinate in pixels. [out] _item Ogre item at the coordinate. [out] _point 3D point of intersection with the ogre item's mesh.
- Returns
- True if an ogre item is found, false otherwise
◆ ExecuteQuery() [2/2]
bool ExecuteQuery | ( | int | _x, |
int | _y, | ||
Ogre::MovableObject *& | _obj, | ||
math::Vector3d & | _point | ||
) |
Perform selection operation and get ogre item and point of intersection.
- Parameters
-
[in] _x X coordinate in pixels. [in] _y Y coordinate in pixels. [out] _obj Ogre movable object at the coordinate. [out] _point 3D point of intersection with the ogre object.
- Returns
- True if an ogre object is found, false otherwise
◆ OnSelectionClick()
Ogre::MovableObject * OnSelectionClick | ( | int | _x, |
int | _y | ||
) |
Handle on mouse click.
- Parameters
-
[in] _x X coordinate in pixels. [in] _y Y coordinate in pixels.
- Returns
- Returns the Ogre movable object at the coordinate.
◆ SetDimensions()
void SetDimensions | ( | unsigned int | _width, |
unsigned int | _height | ||
) |
Set dimension of the selection buffer.
- Parameters
-
[in] _width X dimension in pixels. [in] _height Y dimension in pixels.
◆ Update()
void Update | ( | ) |
Call this to update the selection buffer contents.
The documentation for this class was generated from the following file: