Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::EmulatedGazeTracker Class Reference

Simulates the presence of a gaze tracker by assuming that the user is always looking straight forward, and making the eyes converge on the point hit by a ray cast. More...

Inherits G3D::GazeTracker.

Public Member Functions

virtual const StringclassName () const override
 Which subclass of GazeTracker is this? More...
 
virtual void getInstantaneousGaze (Gaze &left, Gaze &right) const override
 Raw data with minimal latency. More...
 
virtual void getTrackedGaze (Gaze &left, Gaze &right) const
 All values are in world space. More...
 
virtual Point3 headSpaceCalibrationPoint () const override
 When in calibration mode, the application should draw the calibration target at this location in head space. More...
 
virtual void setCalibrationMode (bool c) override
 The application should call with c = true to begin calibration, and then poll headSpaceCalibrationPoint() every frame to draw the target. More...
 

Static Public Member Functions

static shared_ptr< EmulatedGazeTrackercreate (GApp *app, bool monocular=false, const shared_ptr< GameController > &gameController=nullptr)
 The app is used for GApp::scene() ray casts and GApp::headFrame() More...
 

Protected Member Functions

 EmulatedGazeTracker (GApp *app, bool monocular, const shared_ptr< GameController > &gameController)
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

GAppm_app
 
int m_calibrationIndex = -1
 if -1, not calibrating More...
 
RealTime m_currentCalibrationPointStartTime = 0
 
shared_ptr< GameControllerm_gameController
 
const bool m_monocular
 

Detailed Description

Simulates the presence of a gaze tracker by assuming that the user is always looking straight forward, and making the eyes converge on the point hit by a ray cast.

Constructor & Destructor Documentation

◆ EmulatedGazeTracker()

G3D::EmulatedGazeTracker::EmulatedGazeTracker ( GApp app,
bool  monocular,
const shared_ptr< GameController > &  gameController 
)
inlineprotected

Member Function Documentation

◆ className()

virtual const String& G3D::EmulatedGazeTracker::className ( ) const
overridevirtual

Which subclass of GazeTracker is this?

Implements G3D::GazeTracker.

◆ create()

static shared_ptr<EmulatedGazeTracker> G3D::EmulatedGazeTracker::create ( GApp app,
bool  monocular = false,
const shared_ptr< GameController > &  gameController = nullptr 
)
static

The app is used for GApp::scene() ray casts and GApp::headFrame()

Parameters
monocularIf set, no ray casts are used but both eyes act as if they are in the center of the head
gameControllerIf set, use the right stick to control the eye direction relative to the head and the right shoulder button to blink.

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ getInstantaneousGaze()

virtual void G3D::EmulatedGazeTracker::getInstantaneousGaze ( Gaze left,
Gaze right 
) const
overridevirtual

Raw data with minimal latency.

Because this will likely be called at the frame rate of the display, we recommend that subclasses model the rate and phase of calls and only process gaze information on a separate thread right before the anticipated time of the next call. This avoids the typical behavior of gaze trackers, which is to run continuously at high rates and throw out most frames without spending resources processing them unless those intermediate frames are needed to reduce error.

See also
getTrackedGaze

Implements G3D::GazeTracker.

◆ getTrackedGaze()

virtual void G3D::GazeTracker::getTrackedGaze ( Gaze left,
Gaze right 
) const
inlinevirtualinherited

All values are in world space.

You can convert them to screen space by the usual method: transform to the camera's reference frame and intersect these rays with the image plane.

This may be a filtered version of getInstantaneousGaze().

The default implementation directly returns getInstantaneousGaze(), but will likely contain automatic filtering in a future release.

◆ headSpaceCalibrationPoint()

virtual Point3 G3D::EmulatedGazeTracker::headSpaceCalibrationPoint ( ) const
overridevirtual

When in calibration mode, the application should draw the calibration target at this location in head space.

When this returns Point3::nan(), calibration has ended.

Reimplemented from G3D::GazeTracker.

◆ setCalibrationMode()

virtual void G3D::EmulatedGazeTracker::setCalibrationMode ( bool  c)
overridevirtual

The application should call with c = true to begin calibration, and then poll headSpaceCalibrationPoint() every frame to draw the target.

Calibration will end on its own. To abort calibration early and return to the previous calibrated value, invoke setCalibrationMode(false).

Reimplemented from G3D::GazeTracker.

Member Data Documentation

◆ m_app

GApp* G3D::EmulatedGazeTracker::m_app
protected

◆ m_calibrationIndex

int G3D::EmulatedGazeTracker::m_calibrationIndex = -1
mutableprotected

if -1, not calibrating

◆ m_currentCalibrationPointStartTime

RealTime G3D::EmulatedGazeTracker::m_currentCalibrationPointStartTime = 0
mutableprotected

◆ m_gameController

shared_ptr<GameController> G3D::EmulatedGazeTracker::m_gameController
protected

◆ m_monocular

const bool G3D::EmulatedGazeTracker::m_monocular
protected

documentation generated on Wed Nov 24 2021 08:01:54 using doxygen 1.8.15