xoreos  0.0.5
Public Member Functions | Private Attributes | List of all members
Graphics::CameraManager Class Reference

#include <camera.h>

Inheritance diagram for Graphics::CameraManager:
Inheritance graph
[legend]
Collaboration diagram for Graphics::CameraManager:
Collaboration graph
[legend]

Public Member Functions

 CameraManager ()
 
const float * getPosition () const
 Get the current camera position cache. More...
 
const float * getOrientation () const
 Get the current camera orientation cache. More...
 
void reset ()
 Reset the current position and orientation. More...
 
void limit (float minX=-FLT_MAX, float minY=-FLT_MAX, float minZ=-FLT_MAX, float maxX=FLT_MAX, float maxY=FLT_MAX, float maxZ=FLT_MAX)
 Set limits on the camera position. More...
 
void setPosition (float x, float y, float z)
 Set the camera position. More...
 
void setOrientation (float x, float y, float z)
 Set the camera orientation. More...
 
void turn (float x, float y, float z)
 Turn along axes. More...
 
void move (float x, float y, float z)
 Move along axes. More...
 
void moveRelative (float x, float y, float z)
 Move relative to the current view axis. More...
 
uint32 lastChanged () const
 The timestamp the camera was changed last. More...
 
void update ()
 Update the caches with the current position and orientation. More...
 

Private Attributes

uint32 _lastChanged
 
float _minPosition [3]
 
float _maxPosition [3]
 
float _position [3]
 Current position. More...
 
float _orientation [3]
 Current orientation. More...
 
float _positionCache [3]
 Current position, cached. More...
 
float _orientationCache [3]
 Current orientation, cached. More...
 
bool _needUpdate
 

Additional Inherited Members

- Static Public Member Functions inherited from Common::Singleton< CameraManager >
static CameraManager & instance ()
 
static void destroy ()
 
- Protected Types inherited from Common::Singleton< CameraManager >
typedef CameraManager SingletonBaseType
 
- Protected Member Functions inherited from Common::Singleton< CameraManager >
 Singleton ()
 
virtual ~Singleton ()
 

Detailed Description

Definition at line 34 of file camera.h.

Constructor & Destructor Documentation

◆ CameraManager()

Graphics::CameraManager::CameraManager ( )

Member Function Documentation

◆ getOrientation()

const float * Graphics::CameraManager::getOrientation ( ) const

Get the current camera orientation cache.

Definition at line 91 of file camera.cpp.

References _orientationCache.

◆ getPosition()

const float * Graphics::CameraManager::getPosition ( ) const

Get the current camera position cache.

Definition at line 87 of file camera.cpp.

References _positionCache.

◆ lastChanged()

uint32 Graphics::CameraManager::lastChanged ( ) const

The timestamp the camera was changed last.

Definition at line 164 of file camera.cpp.

References _lastChanged.

◆ limit()

void Graphics::CameraManager::limit ( float  minX = -FLT_MAX,
float  minY = -FLT_MAX,
float  minZ = -FLT_MAX,
float  maxX = FLT_MAX,
float  maxY = FLT_MAX,
float  maxZ = FLT_MAX 
)

Set limits on the camera position.

Definition at line 115 of file camera.cpp.

References _maxPosition, and _minPosition.

◆ move()

void Graphics::CameraManager::move ( float  x,
float  y,
float  z 
)

Move along axes.

Definition at line 148 of file camera.cpp.

References _position, and setPosition().

Referenced by moveRelative().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ moveRelative()

void Graphics::CameraManager::moveRelative ( float  x,
float  y,
float  z 
)

Move relative to the current view axis.

Definition at line 152 of file camera.cpp.

References _orientation, Common::deg2rad(), and move().

Here is the call graph for this function:

◆ reset()

void Graphics::CameraManager::reset ( )

Reset the current position and orientation.

Definition at line 95 of file camera.cpp.

References _lastChanged, _maxPosition, _minPosition, _needUpdate, _orientation, _position, EventMan, and FLT_MAX.

◆ setOrientation()

void Graphics::CameraManager::setOrientation ( float  x,
float  y,
float  z 
)

Set the camera orientation.

Definition at line 134 of file camera.cpp.

References _lastChanged, _needUpdate, _orientation, and EventMan.

Referenced by turn().

Here is the caller graph for this function:

◆ setPosition()

void Graphics::CameraManager::setPosition ( float  x,
float  y,
float  z 
)

Set the camera position.

Definition at line 124 of file camera.cpp.

References _lastChanged, _maxPosition, _minPosition, _needUpdate, _position, CLIP(), and EventMan.

Referenced by move().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ turn()

void Graphics::CameraManager::turn ( float  x,
float  y,
float  z 
)

Turn along axes.

Definition at line 144 of file camera.cpp.

References _orientation, and setOrientation().

Here is the call graph for this function:

◆ update()

void Graphics::CameraManager::update ( )

Update the caches with the current position and orientation.

All changes to the camera are delayed until this method is called. This stops camera lagging due to too frequent changes.

Definition at line 68 of file camera.cpp.

References _needUpdate, _orientation, _orientationCache, _position, _positionCache, GfxMan, and NotificationMan.

Member Data Documentation

◆ _lastChanged

uint32 Graphics::CameraManager::_lastChanged
private

Definition at line 66 of file camera.h.

Referenced by lastChanged(), reset(), setOrientation(), and setPosition().

◆ _maxPosition

float Graphics::CameraManager::_maxPosition[3]
private

Definition at line 69 of file camera.h.

Referenced by CameraManager(), limit(), reset(), and setPosition().

◆ _minPosition

float Graphics::CameraManager::_minPosition[3]
private

Definition at line 68 of file camera.h.

Referenced by CameraManager(), limit(), reset(), and setPosition().

◆ _needUpdate

bool Graphics::CameraManager::_needUpdate
private

Definition at line 77 of file camera.h.

Referenced by reset(), setOrientation(), setPosition(), and update().

◆ _orientation

float Graphics::CameraManager::_orientation[3]
private

Current orientation.

Definition at line 72 of file camera.h.

Referenced by CameraManager(), moveRelative(), reset(), setOrientation(), turn(), and update().

◆ _orientationCache

float Graphics::CameraManager::_orientationCache[3]
private

Current orientation, cached.

Definition at line 75 of file camera.h.

Referenced by CameraManager(), getOrientation(), and update().

◆ _position

float Graphics::CameraManager::_position[3]
private

Current position.

Definition at line 71 of file camera.h.

Referenced by CameraManager(), move(), reset(), setPosition(), and update().

◆ _positionCache

float Graphics::CameraManager::_positionCache[3]
private

Current position, cached.

Definition at line 74 of file camera.h.

Referenced by CameraManager(), getPosition(), and update().


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