gramods
Loading...
Searching...
No Matches
Public Member Functions | List of all members
gramods::gmTouch::OSGCameraAdaptor Class Reference

Camera adaptor for OSG, providing means to set the projection matrix of TouchState by providing an OSG camera. More...

#include <OSGCameraAdaptor.hh>

Inheritance diagram for gramods::gmTouch::OSGCameraAdaptor:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmTouch::OSGCameraAdaptor:
Collaboration graph
[legend]

Public Member Functions

bool setCurrentProjection (osg::Camera *camera)
 Calculates and sets the current projection matrix to use when back-projecting the 2D touch points into 3D, and set the previously current to be used when back-projecting "previous" touch points.
 
- Public Member Functions inherited from gramods::gmTouch::TouchState::CameraAdaptor
virtual void init (int width, int height)
 Called by the owner (TouchState) when eventsInit is called.
 
virtual void done ()
 Called by the owner (TouchState) when eventsDone is called.
 

Additional Inherited Members

- Protected Member Functions inherited from gramods::gmTouch::TouchState::CameraAdaptor
void setCurrentProjection (Eigen::Matrix4f WPV_inv)
 Sets the current (inverted) projection matrix to use when back-projecting the 2D touch points into 3D.
 

Detailed Description

Camera adaptor for OSG, providing means to set the projection matrix of TouchState by providing an OSG camera.

Typical use:

int width, height;
SDL_GetWindowSize(sdl_window, &width, &height);
touchState.eventsInit(width, height);
touchState.getCameraAdaptor<gmTouch::OSGCameraAdaptor>().setCurrentProjection(camera);
...
touchState.eventsDone();
Camera adaptor for OSG, providing means to set the projection matrix of TouchState by providing an OS...
Definition OSGCameraAdaptor.hh:31
bool setCurrentProjection(osg::Camera *camera)
Calculates and sets the current projection matrix to use when back-projecting the 2D touch points int...
Definition OSGCameraAdaptor.cpp:8

Member Function Documentation

◆ setCurrentProjection()

bool gramods::gmTouch::OSGCameraAdaptor::setCurrentProjection ( osg::Camera *  camera)

Calculates and sets the current projection matrix to use when back-projecting the 2D touch points into 3D, and set the previously current to be used when back-projecting "previous" touch points.

If the view changes over time, one of these methods needs to be called every frame, between calling eventsInit and eventsDone and before extrating 3D lines. If the view is static, it needs to be called at least twice, to make the current matrix be copied to previous state. The frame copying is performed even when the valid project cannot be extracted.

Returns
True if a valid projection could be extracted from the specified camera, false otherwise.
See also
TouchState::getCurrent3DTouchLine

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