Triton
Visual simulation library for ocean rendering.
|
Triton's public interface for specifying the camera properties. More...
#include <Camera.h>
Public Member Functions | |
void TRITONAPI | SetCameraMatrix (const double *m, const double *explicitCameraPosition=0) |
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. | |
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(). | |
const double *TRITONAPI | GetCameraMatrix () const |
Retrieves an array of 16 doubles representing the modelview matrix passed in via SetCameraMatrix(). | |
const double *TRITONAPI | GetProjectionMatrix () const |
Retrieves an array of 16 doubles representing the projection matrix passed in via SetProjectionMatrix(). | |
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(). | |
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(). | |
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(). | |
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. | |
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(). | |
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. | |
void TRITONAPI | SetName (const char *name) |
Associated a name with a camera. | |
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. | |
bool TRITONAPI | GetViewport (int &x, int &y, int &width, int &height) const |
Retrieves any viewport information previously set via SetViewport(). | |
void TRITONAPI | SetRenderTarget (void *target) |
Abstractly set/get the render target. | |
Public Attributes | |
CameraSignal * | signal_CameraDestroyed |
Called just before the camera is deleted. | |
Triton's public interface for specifying the camera properties.
Do not instantiate this directly
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().
position | The center of the sphere in world coordinates. |
radius | The radius of the sphere in world coordinates. |
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.
\param x The x position of the current viewport origin. \param y The y position of the current viewport origin. \param width The width of the current viewport. \param height The height of the current viewport. \return true if SetViewport was previously called, and valid information is returned.
void TRITONAPI Triton::Camera::SetCameraMatrix | ( | const double * | m, |
const double * | explicitCameraPosition = 0 |
||
) |
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.
m | A pointer to 16 doubles representing a 4x4 modelview matrix. |
explicitCameraPosition | In flat coordinate systems, this parameter can be used to "fool" Triton into using a camera position that is different from the one embedded in the view matrix provided in the "m" parameter. This can be useful if you need to center the high-resolution ocean geometry someplace other than the camera position, for example in very tight zooms on very distant locations. In normal situations, you'll want to just leave this set to NULL. This trick doesn't work in WGS84 systems as its projected grid LOD scheme is independent of the camera position. When used, this parameter should point to 3 doubles representing the camera position's XYZ coordinates. |
void TRITONAPI Triton::Camera::SetName | ( | const char * | name | ) |
Associated a name with a camera.
(Useful for debugging, etc)
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().
p | A pointer to 16 doubles representing a 4x4 projection matrix. |
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.
\param x The x position of the current viewport origin. \param y The y position of the current viewport origin. \param width The width of the current viewport. \param height The height of the current viewport.
CameraSignal* Triton::Camera::signal_CameraDestroyed |
Called just before the camera is deleted.
Used internally to track cameras. Do not use directly