Public Types | Public Member Functions | Private Member Functions | Private Attributes
Leap::Scene Class Reference

scene manages scene objects - handles selection and movement More...

#include <LeapScene.h>

List of all members.

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.
float GetDeltaTime () const
 the last value of the fDeltatTimeSeconds argument passed to Update()
uint32_t GetFlags () const
float GetFrameScale () const
const MatrixGetFrameTransform () const
uint32_t GetNumObjects () const
uint32_t GetNumQueuedInteractions () const
 number of potential interactions that were queued up during the last update
uint32_t GetNumRayHits () const
 the number of ray tests that resulted in hits from the last update
const SceneObjectPtrGetObjectByIndex (int idx) const
float GetPointableRadius () const
const SceneInteractionGetQueuedInteraction (uint32_t idx) const
 access to a potential interaction queued up during the last update
const SceneRayHitGetRayHit (uint32_t idx) const
 access to a ray test hit that happened during the last update
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
void SetUpdateContact (bool bUpdateContact)
void SetUpdateRayCast (bool bUpdateRayCast)
void SetUserData (void *pUserData)
const SceneObjectPtrTestRayHit (const SceneRay &ray) const
 allows for casting an arbitrary ray and finding out what it hits (if anything)
Vector TransformFrameDirection (const Vector &vFrameDirection)
 transform a direction from the LeapAPI (e.g. Pointable::direction()) into scene space
Vector TransformFramePoint (const Vector &vFramePoint)
 transforms a point from the Leap API (e.g. Pointable::tipPosition()) into scene space
LEAP_EXPORT void Update (const Frame &frame, float fDeltaTimeSeconds)
virtual LEAP_EXPORT ~Scene ()

Private Member Functions

template<class T >
TallocateObject ()
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

Detailed Description

scene manages scene objects - handles selection and movement

Definition at line 171 of file LeapScene.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
kMaxObjects 
kMaxRayHits 
kInteractionQueueLength 

Definition at line 180 of file LeapScene.h.

Enumerator:
kF_UpdateRayCast 
kF_UpdateContact 

Definition at line 174 of file LeapScene.h.


Constructor & Destructor Documentation

Definition at line 26 of file LeapScene.cpp.

virtual LEAP_EXPORT Leap::Scene::~Scene ( ) [inline, virtual]

Definition at line 189 of file LeapScene.h.


Member Function Documentation

template<class ObjectClass >
ObjectClass* Leap::Scene::AddObject ( ) [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.

template<class T >
T* Leap::Scene::allocateObject ( ) [inline, private]

Definition at line 364 of file LeapScene.h.

void Leap::Scene::clearInteractionQueue ( ) [inline, private]

Definition at line 341 of file LeapScene.h.

void Leap::Scene::clearRayHits ( ) [inline, private]

Definition at line 348 of file LeapScene.h.

void Leap::Scene::deallocateObject ( uint32_t  idxToRemove) [private]

Definition at line 143 of file LeapScene.cpp.

does not queue interactions, sets all objects to deselected state immediately.

Definition at line 85 of file LeapScene.cpp.

float Leap::Scene::GetDeltaTime ( ) const [inline]

the last value of the fDeltatTimeSeconds argument passed to Update()

Definition at line 277 of file LeapScene.h.

uint32_t Leap::Scene::GetFlags ( ) const [inline]

Definition at line 309 of file LeapScene.h.

float Leap::Scene::GetFrameScale ( ) const [inline]

Definition at line 257 of file LeapScene.h.

const Matrix& Leap::Scene::GetFrameTransform ( ) const [inline]

Definition at line 253 of file LeapScene.h.

uint32_t Leap::Scene::GetNumObjects ( ) const [inline]

Definition at line 227 of file LeapScene.h.

uint32_t Leap::Scene::GetNumQueuedInteractions ( ) const [inline]

number of potential interactions that were queued up during the last update

Definition at line 289 of file LeapScene.h.

uint32_t Leap::Scene::GetNumRayHits ( ) const [inline]

the number of ray tests that resulted in hits from the last update

Definition at line 280 of file LeapScene.h.

const SceneObjectPtr& Leap::Scene::GetObjectByIndex ( int  idx) const [inline]

Definition at line 222 of file LeapScene.h.

float Leap::Scene::GetPointableRadius ( ) const [inline]

Definition at line 263 of file LeapScene.h.

const SceneInteraction* Leap::Scene::GetQueuedInteraction ( uint32_t  idx) const [inline]

access to a potential interaction queued up during the last update

Definition at line 292 of file LeapScene.h.

const SceneRayHit* Leap::Scene::GetRayHit ( uint32_t  idx) const [inline]

access to a ray test hit that happened during the last update

Definition at line 283 of file LeapScene.h.

float Leap::Scene::GetSelectHitTime ( ) const [inline]

Definition at line 268 of file LeapScene.h.

bool Leap::Scene::GetUpdateContact ( ) const [inline]

Definition at line 311 of file LeapScene.h.

bool Leap::Scene::GetUpdateRayCast ( ) const [inline]

Definition at line 318 of file LeapScene.h.

void* Leap::Scene::GetUserData ( ) const [inline]

Definition at line 274 of file LeapScene.h.

Definition at line 392 of file LeapScene.cpp.

void Leap::Scene::queueDeselectAll ( ) [private]

Definition at line 407 of file LeapScene.cpp.

bool Leap::Scene::queueInteraction ( const SceneInteraction interaction) [inline, private]

Definition at line 331 of file LeapScene.h.

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.

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.

void Leap::Scene::SetFrameScale ( float  fFrameScale) [inline]

Definition at line 255 of file LeapScene.h.

void Leap::Scene::SetFrameTransform ( const Matrix mtxFrameTransform) [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.

void Leap::Scene::SetPointableRadius ( float  fRadius) [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.

void Leap::Scene::SetSelectHitTime ( float  fSelectHitTime) [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.

void Leap::Scene::SetUpdateContact ( bool  bUpdateContact) [inline]

Definition at line 313 of file LeapScene.h.

void Leap::Scene::SetUpdateRayCast ( bool  bUpdateRayCast) [inline]

Definition at line 320 of file LeapScene.h.

void Leap::Scene::SetUserData ( void *  pUserData) [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.

bool Leap::Scene::testRayHitClosest ( SceneRayHit hitResult) [private]

Definition at line 177 of file LeapScene.cpp.

Vector Leap::Scene::TransformFrameDirection ( const Vector vFrameDirection) [inline]

transform a direction from the LeapAPI (e.g. Pointable::direction()) into scene space

Definition at line 304 of file LeapScene.h.

Vector Leap::Scene::TransformFramePoint ( const Vector vFramePoint) [inline]

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.

void Leap::Scene::updateContact ( const SceneContactPoint testPoint) [private]

Definition at line 208 of file LeapScene.cpp.

void Leap::Scene::updateInteraction ( const Frame frame) [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.

void Leap::Scene::updateSelectionAndContact ( const Frame frame) [private]

Definition at line 220 of file LeapScene.cpp.


Member Data Documentation

Definition at line 395 of file LeapScene.h.

Definition at line 393 of file LeapScene.h.

Definition at line 394 of file LeapScene.h.

Definition at line 386 of file LeapScene.h.

float Leap::Scene::m_fFrameScale [private]

Definition at line 391 of file LeapScene.h.

Definition at line 387 of file LeapScene.h.

Definition at line 388 of file LeapScene.h.

Definition at line 390 of file LeapScene.h.

void* Leap::Scene::m_pUserData [private]

Definition at line 385 of file LeapScene.h.

uint32_t Leap::Scene::m_uiFlags [private]

Definition at line 402 of file LeapScene.h.

uint32_t Leap::Scene::m_uiNextSerial [private]

Definition at line 401 of file LeapScene.h.

uint32_t Leap::Scene::m_uiNumObjects [private]

Definition at line 397 of file LeapScene.h.

Definition at line 400 of file LeapScene.h.

Definition at line 399 of file LeapScene.h.

uint32_t Leap::Scene::m_uiNumRayHits [private]

Definition at line 398 of file LeapScene.h.


The documentation for this class was generated from the following files:


leap_motion
Author(s): Florian Lier , Mirza Shah , Isaac IY Saito
autogenerated on Sat Jun 8 2019 18:47:25