Use to select objects in the scene. More...
#include <selection_query.hpp>
Public Member Functions | |
SelectionQuery (const Scene::Ptr &scene) | |
std::vector< QueryResult > | CastRay (const int64_t selection_mask, const QVector3D &start, const QVector3D &dir) |
Perform a ray cast selection query. More... | |
Static Public Member Functions | |
static bool | Intersection (const AxisAlignedBox &box, const QVector3D &ray_start, const QVector3D &ray_dir, double *result) |
Use to select objects in the scene.
During a selection query, only the axis-aligned bounding boxes for a node are considered. This may result in false positives, and it is up to the user to perform more detailed selection test.
Each node in the scene is assigned a selection mask, which can be used by the user to determine what nodes are candidates for selection during a query. During a query, the query selection mask is bitwise-ANDed with each node's mask, and only nodes with a nonzero match are considered. You can use this to implement different selection categories.
By default, a node's selection mask is 0, which means that no nodes are selectable by default.
std::vector<QueryResult> sv::SelectionQuery::CastRay | ( | const int64_t | selection_mask, |
const QVector3D & | start, | ||
const QVector3D & | dir | ||
) |
Perform a ray cast selection query.
selection_mask | the selection mask to use when considering nodes. |
start | the ray starting point, in world coordinates. |
dir | the ray direction, in world coordinates. Does not need to be normalized. |