Triton
Visual simulation library for ocean rendering.
Public Member Functions | Public Attributes | List of all members
Triton::Camera Class Reference

Triton's public interface for specifying the camera properties. More...

#include <Camera.h>

Inheritance diagram for Triton::Camera:
Inheritance graph
[legend]
Collaboration diagram for Triton::Camera:
Collaboration graph
[legend]

Public Member Functions

void TRITONAPI SetCameraMatrix (const double *m)
 Sets the modelview matrix used for rendering the ocean; this must be called every frame prior to calling Ocean::Draw() if your camera orientation or position changes. More...
 
void TRITONAPI SetProjectionMatrix (const double *p)
 Sets the projection matrix used for rendering the ocean; this must be called every frame prior to calling Ocean::Draw(). More...
 
const double *TRITONAPI GetCameraMatrix () const
 Retrieves an array of 16 doubles representing the modelview matrix passed in via SetCameraMatrix(). More...
 
const double *TRITONAPI GetProjectionMatrix () const
 Retrieves an array of 16 doubles representing the projection matrix passed in via SetProjectionMatrix(). More...
 
const double *TRITONAPI GetCameraPosition () const
 Retrieves an array of 3 doubles representing the X, Y, and Z position of the camera, extracted from the modelview matrix passed in via SetCameraMatrix(). More...
 
Vector3 TRITONAPI GetUpVector () const
 Retrieves a normalized vector pointing "up", based on the coordinate system specified in Environment::Initialize() and the current position from the modelview matrix passed in through Environment::SetCameraMatrix(). More...
 
Vector3 TRITONAPI GetRightVector () const
 Retrieves a normalized vector pointing "right", based on the coordinate system specified in Environment::Initialize() and the current position from the modelview matrix passed in through Environment::SetCameraMatrix(). More...
 
CoordinateSystem TRITONAPI GetCoordinateSystem (void) const
 Returns the CoordinateSystem passed set on the camera, indicating the up vector and the presence of a geocentric or flat coordinate system. More...
 
bool TRITONAPI CullSphere (const Vector3 &position, double radius) const
 Returns true if the given sphere lies within the view frustum, as defined by the modelview - projection matrix passed in via SetCameraMatrix() and SetProjectionMatrix(). More...
 
bool TRITONAPI IsGeocentric () const
 Returns whether the CoordinateSystem passed set on the camera is geocentric, indicating an elliptical or spherical coordinate system where all points are relative to the center of the Earth. More...
 
void TRITONAPI SetName (const char *name)
 Associated a name with a camera. More...
 
const char *TRITONAPI GetName (void) const
 Get the name.
 
void TRITONAPI SetViewport (int x, int y, int width, int height)
 Informs Triton of the current viewport position and size. More...
 
bool TRITONAPI GetViewport (int &x, int &y, int &width, int &height) const
 Retrieves any viewport information previously set via SetViewport(). More...
 
void TRITONAPI SetRenderTarget (void *target)
 Abstractly set/get the render target.
 

Public Attributes

CameraSignal * signal_CameraDestroyed
 Called just before the camera is deleted. More...
 

Detailed Description

Triton's public interface for specifying the camera properties.

Do not instantiate this directly

Member Function Documentation

◆ CullSphere()

bool TRITONAPI Triton::Camera::CullSphere ( const Vector3 position,
double  radius 
) const

Returns true if the given sphere lies within the view frustum, as defined by the modelview - projection matrix passed in via SetCameraMatrix() and SetProjectionMatrix().

Parameters
positionThe center of the sphere in world coordinates.
radiusThe radius of the sphere in world coordinates.
Returns
True if the sphere is not visible and should be culled.

◆ GetCameraMatrix()

const double* TRITONAPI Triton::Camera::GetCameraMatrix ( ) const
inline

Retrieves an array of 16 doubles representing the modelview matrix passed in via SetCameraMatrix().

◆ GetCameraPosition()

const double* TRITONAPI Triton::Camera::GetCameraPosition ( ) const
inline

Retrieves an array of 3 doubles representing the X, Y, and Z position of the camera, extracted from the modelview matrix passed in via SetCameraMatrix().

◆ GetCoordinateSystem()

CoordinateSystem TRITONAPI Triton::Camera::GetCoordinateSystem ( void  ) const
inline

Returns the CoordinateSystem passed set on the camera, indicating the up vector and the presence of a geocentric or flat coordinate system.

◆ GetProjectionMatrix()

const double* TRITONAPI Triton::Camera::GetProjectionMatrix ( ) const
inline

Retrieves an array of 16 doubles representing the projection matrix passed in via SetProjectionMatrix().

◆ GetRightVector()

Vector3 TRITONAPI Triton::Camera::GetRightVector ( ) const

Retrieves a normalized vector pointing "right", based on the coordinate system specified in Environment::Initialize() and the current position from the modelview matrix passed in through Environment::SetCameraMatrix().

◆ GetUpVector()

Vector3 TRITONAPI Triton::Camera::GetUpVector ( ) const

Retrieves a normalized vector pointing "up", based on the coordinate system specified in Environment::Initialize() and the current position from the modelview matrix passed in through Environment::SetCameraMatrix().

◆ GetViewport()

bool TRITONAPI Triton::Camera::GetViewport ( int &  x,
int &  y,
int &  width,
int &  height 
) const

Retrieves any viewport information previously set via SetViewport().

If SetViewport() has not been called, this method will return false and return zeros for all parameters.

Parameters
xThe x position of the current viewport origin.
yThe y position of the current viewport origin.
widthThe width of the current viewport.
heightThe height of the current viewport.
\return true if SetViewport was previously called, and valid information is returned.

◆ IsGeocentric()

bool TRITONAPI Triton::Camera::IsGeocentric ( ) const
inline

Returns whether the CoordinateSystem passed set on the camera is geocentric, indicating an elliptical or spherical coordinate system where all points are relative to the center of the Earth.

◆ SetCameraMatrix()

void TRITONAPI Triton::Camera::SetCameraMatrix ( const double *  m)

Sets the modelview matrix used for rendering the ocean; this must be called every frame prior to calling Ocean::Draw() if your camera orientation or position changes.

Parameters
mA pointer to 16 doubles representing a 4x4 modelview matrix.

◆ SetName()

void TRITONAPI Triton::Camera::SetName ( const char *  name)

Associated a name with a camera.

(Useful for debugging, etc)

◆ SetProjectionMatrix()

void TRITONAPI Triton::Camera::SetProjectionMatrix ( const double *  p)

Sets the projection matrix used for rendering the ocean; this must be called every frame prior to calling Ocean::Draw().

Parameters
pA pointer to 16 doubles representing a 4x4 projection matrix.

◆ SetViewport()

void TRITONAPI Triton::Camera::SetViewport ( int  x,
int  y,
int  width,
int  height 
)

Informs Triton of the current viewport position and size.

Calling this is optional, but allows Triton to avoid querying OpenGL or DirectX for the current viewport parameters, which can cause a pipeline stall. If you call this method, you are responsible for calling it whenever the viewport changes.

Parameters
xThe x position of the current viewport origin.
yThe y position of the current viewport origin.
widthThe width of the current viewport.
heightThe height of the current viewport.

Member Data Documentation

◆ signal_CameraDestroyed

CameraSignal* Triton::Camera::signal_CameraDestroyed

Called just before the camera is deleted.

Used internally to track cameras. Do not use directly


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