scene manages scene objects - handles selection and movement More...
#include <LeapScene.h>
Public Types | |
enum | { kMaxObjects = 512, kMaxRayHits = 32, kInteractionQueueLength = 32 } |
enum | eFlag { kF_UpdateRayCast = 1 << 0, kF_UpdateContact = 1 << 1 } |
Public Member Functions | |
template<class ObjectClass > | |
ObjectClass * | AddObject () |
LEAP_EXPORT void | DeselectAll () |
does not queue interactions, sets all objects to deselected state immediately. More... | |
float | GetDeltaTime () const |
the last value of the fDeltatTimeSeconds argument passed to Update() More... | |
uint32_t | GetFlags () const |
float | GetFrameScale () const |
const Matrix & | GetFrameTransform () const |
uint32_t | GetNumObjects () const |
uint32_t | GetNumQueuedInteractions () const |
number of potential interactions that were queued up during the last update More... | |
uint32_t | GetNumRayHits () const |
the number of ray tests that resulted in hits from the last update More... | |
const SceneObjectPtr & | GetObjectByIndex (int idx) const |
float | GetPointableRadius () const |
const SceneInteraction * | GetQueuedInteraction (uint32_t idx) const |
access to a potential interaction queued up during the last update More... | |
const SceneRayHit * | GetRayHit (uint32_t idx) const |
access to a ray test hit that happened during the last update More... | |
float | GetSelectHitTime () const |
bool | GetUpdateContact () const |
bool | GetUpdateRayCast () const |
void * | GetUserData () const |
LEAP_EXPORT void | RemoveObject (SceneObject *pObject) |
LEAP_EXPORT void | Reset () |
LEAP_EXPORT | Scene () |
void | SetFrameScale (float fFrameScale) |
void | SetFrameTransform (const Matrix &mtxFrameTransform) |
void | SetPointableRadius (float fRadius) |
void | SetSelectHitTime (float fSelectHitTime) |
the amount of time an object must be pointed at or touched before it is selected More... | |
void | SetUpdateContact (bool bUpdateContact) |
void | SetUpdateRayCast (bool bUpdateRayCast) |
void | SetUserData (void *pUserData) |
const SceneObjectPtr & | TestRayHit (const SceneRay &ray) const |
allows for casting an arbitrary ray and finding out what it hits (if anything) More... | |
Vector | TransformFrameDirection (const Vector &vFrameDirection) |
transform a direction from the LeapAPI (e.g. Pointable::direction()) into scene space More... | |
Vector | TransformFramePoint (const Vector &vFramePoint) |
transforms a point from the Leap API (e.g. Pointable::tipPosition()) into scene space More... | |
LEAP_EXPORT void | Update (const Frame &frame, float fDeltaTimeSeconds) |
virtual LEAP_EXPORT | ~Scene () |
Private Member Functions | |
template<class T > | |
T * | allocateObject () |
void | clearInteractionQueue () |
void | clearRayHits () |
void | deallocateObject (uint32_t idxToRemove) |
void | processPendingRemovals () |
void | queueDeselectAll () |
bool | queueInteraction (const SceneInteraction &interaction) |
bool | testRayHitClosest (SceneRayHit &hitResult) |
void | updateContact (const SceneContactPoint &testPoint) |
void | updateInteraction (const Frame &frame) |
void | updateSelectionAndContact (const Frame &frame) |
Private Attributes | |
SceneInteraction | m_aInteractionQueue [kInteractionQueueLength] |
SceneObjectPtr | m_apObjects [kMaxObjects] |
SceneRayHit | m_aRayHits [kMaxRayHits] |
float | m_fDeltaTimeSeconds |
float | m_fFrameScale |
float | m_fPointableRadius |
float | m_fSelectHitTime |
Matrix | m_mtxFrameTransform |
void * | m_pUserData |
uint32_t | m_uiFlags |
uint32_t | m_uiNextSerial |
uint32_t | m_uiNumObjects |
uint32_t | m_uiNumPendingRemovals |
uint32_t | m_uiNumQueuedInteractions |
uint32_t | m_uiNumRayHits |
scene manages scene objects - handles selection and movement
Definition at line 171 of file LeapScene.h.
anonymous enum |
Enumerator | |
---|---|
kMaxObjects | |
kMaxRayHits | |
kInteractionQueueLength |
Definition at line 180 of file LeapScene.h.
enum Leap::Scene::eFlag |
Enumerator | |
---|---|
kF_UpdateRayCast | |
kF_UpdateContact |
Definition at line 174 of file LeapScene.h.
Leap::Scene::Scene | ( | ) |
Definition at line 26 of file LeapScene.cpp.
|
inlinevirtual |
Definition at line 189 of file LeapScene.h.
|
inline |
AddObject allocates new objects and add them to the list of scene children to manage. raw pointers are returned for convenience. use SceneObjectPtr type when storing scene object references for later use. you can not add an existing instance of an externally allocated object for management. the scene always creates the managed instance. this restriction allows the object management to stay simple and concise.
Definition at line 201 of file LeapScene.h.
|
inlineprivate |
Definition at line 364 of file LeapScene.h.
|
inlineprivate |
Definition at line 341 of file LeapScene.h.
|
inlineprivate |
Definition at line 348 of file LeapScene.h.
|
private |
Definition at line 143 of file LeapScene.cpp.
void Leap::Scene::DeselectAll | ( | ) |
does not queue interactions, sets all objects to deselected state immediately.
Definition at line 85 of file LeapScene.cpp.
|
inline |
the last value of the fDeltatTimeSeconds argument passed to Update()
Definition at line 277 of file LeapScene.h.
|
inline |
Definition at line 309 of file LeapScene.h.
|
inline |
Definition at line 257 of file LeapScene.h.
|
inline |
Definition at line 253 of file LeapScene.h.
|
inline |
Definition at line 227 of file LeapScene.h.
|
inline |
number of potential interactions that were queued up during the last update
Definition at line 289 of file LeapScene.h.
|
inline |
the number of ray tests that resulted in hits from the last update
Definition at line 280 of file LeapScene.h.
|
inline |
Definition at line 222 of file LeapScene.h.
|
inline |
Definition at line 263 of file LeapScene.h.
|
inline |
access to a potential interaction queued up during the last update
Definition at line 292 of file LeapScene.h.
|
inline |
access to a ray test hit that happened during the last update
Definition at line 283 of file LeapScene.h.
|
inline |
Definition at line 268 of file LeapScene.h.
|
inline |
Definition at line 311 of file LeapScene.h.
|
inline |
Definition at line 318 of file LeapScene.h.
|
inline |
Definition at line 274 of file LeapScene.h.
|
private |
Definition at line 392 of file LeapScene.cpp.
|
private |
Definition at line 407 of file LeapScene.cpp.
|
inlineprivate |
Definition at line 331 of file LeapScene.h.
void Leap::Scene::RemoveObject | ( | SceneObject * | pObject | ) |
RemoveObject() marks an object for removal. It is not actually removed until the next call to Update(). Removal does not delete the object, it orphans the object (unsets the scene member) and releases the scene's reference. When the last smart pointer reference to the object is released it will be deleted. objects already marked for removal or not belonging to this scene are ignored.
Definition at line 41 of file LeapScene.cpp.
void Leap::Scene::Reset | ( | ) |
Reset() removes all objects directly. does not queue for later processing. as with RemoveObject() the objects are not deleted, only orphaned and released. When the last smart pointer reference to the objects are released they are deleted.
Definition at line 50 of file LeapScene.cpp.
|
inline |
Definition at line 255 of file LeapScene.h.
|
inline |
the frame transform and scale are used to modify positions and directions gathered from leap frame method calls (e.g. frame.fingers()[0].position()). this allows for mapping spatial data from the leap device to your scene space. for example if your scene world is entirely within the cube (-1, -1, -1) (1, 1, 1) you'll want to set the scale factor to something like 1/400. if the you want to offset or rotate the interaction of the hand with the scene you'll use the frame transform.
Definition at line 251 of file LeapScene.h.
|
inline |
a radius to use for spheres placed at finger/tool tip locations when checking for contact with objects in the scene. analogous to size of a finger tip.
Definition at line 261 of file LeapScene.h.
|
inline |
the amount of time an object must be pointed at or touched before it is selected
Definition at line 266 of file LeapScene.h.
|
inline |
Definition at line 313 of file LeapScene.h.
|
inline |
Definition at line 320 of file LeapScene.h.
|
inline |
generic user data that can be associated with the scene. no management of any kind is done with it.
Definition at line 272 of file LeapScene.h.
const SceneObjectPtr & Leap::Scene::TestRayHit | ( | const SceneRay & | ray | ) | const |
allows for casting an arbitrary ray and finding out what it hits (if anything)
Definition at line 96 of file LeapScene.cpp.
|
private |
Definition at line 177 of file LeapScene.cpp.
transform a direction from the LeapAPI (e.g. Pointable::direction()) into scene space
Definition at line 304 of file LeapScene.h.
transforms a point from the Leap API (e.g. Pointable::tipPosition()) into scene space
Definition at line 298 of file LeapScene.h.
void Leap::Scene::Update | ( | const Frame & | frame, |
float | fDeltaTimeSeconds | ||
) |
processes pending removals clears ray hit results and queued interactions from previous frame caches ray hits from finger/tool (pointable) pointing. queues new set of interactions for polling/processing. the queued interactions will need to be polled/processed following Update(). See utility function DefaultProcessSceneInteractions() below for an example.
Definition at line 70 of file LeapScene.cpp.
|
private |
Definition at line 208 of file LeapScene.cpp.
|
private |
selection state change from not selected to selected
possible manipulation
multi touch
scale by change in pinch distance
rotate by tilt of fingers
translate by average movement
Definition at line 255 of file LeapScene.cpp.
|
private |
Definition at line 220 of file LeapScene.cpp.
|
private |
Definition at line 395 of file LeapScene.h.
|
private |
Definition at line 393 of file LeapScene.h.
|
private |
Definition at line 394 of file LeapScene.h.
|
private |
Definition at line 386 of file LeapScene.h.
|
private |
Definition at line 391 of file LeapScene.h.
|
private |
Definition at line 387 of file LeapScene.h.
|
private |
Definition at line 388 of file LeapScene.h.
|
private |
Definition at line 390 of file LeapScene.h.
|
private |
Definition at line 385 of file LeapScene.h.
|
private |
Definition at line 402 of file LeapScene.h.
|
private |
Definition at line 401 of file LeapScene.h.
|
private |
Definition at line 397 of file LeapScene.h.
|
private |
Definition at line 400 of file LeapScene.h.
|
private |
Definition at line 399 of file LeapScene.h.
|
private |
Definition at line 398 of file LeapScene.h.