SilverLining
Public Member Functions | List of all members
SilverLining::Camera Class Reference

A Camera describes a given view, along with its associated view, projection, and viewport. More...

#include <Camera.h>

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

Public Member Functions

 Camera (bool rightHanded)
 Constructor; pass in whether this camera is within a right-handed or left-handed coordinate system.
 
 Camera (const Camera *camera, bool copyXForms, bool needsFrustum)
 Copy this Camera from another one.
 
virtual ~Camera ()
 Virtual destructor.
 
void SetModelViewMatrix (const Matrix4 &modelViewMatrix)
 Associate a 4x4 view matrix with this camera.
 
void SetProjectionMatrix (const Matrix4 &projectionMatrix)
 Associate a 4x4 projection matrix with this camera.
 
void SetViewport (int x, int y, int w, int h)
 Set the viewport origin and size for this camera.
 
const Matrix4GetModelViewMatrix () const
 Retrieve the camera's view matrix.
 
const Matrix4GetProjectionMatrix () const
 Retrieve the camera's projection matrix.
 
const Matrix4GetModelViewProjectionMatrix () const
 Retrieve the camera's combined view X projection matrix.
 
bool GetViewport (int &x, int &y, int &w, int &h) const
 Retrieve the viewport origin and size.
 
bool GetViewport (int viewport[4]) const
 Retrieve the viewport in a format useful for OpenGL.
 
bool HasCameraMatrix (void) const
 Returns if this Camera has a view matrix associated with it yet.
 
bool HasProjectionMatrix (void) const
 Returns if this Camera has a projection matrix associated with it yet.
 
bool HasViewPort (void) const
 Returns if this Camera has a viewport associated with it yet.
 
void SetUpVector (const Vector3 &upVector)
 Sets the assumption of what direction is "up".
 
void SetUpVector (double x, double y, double z)
 This is same as the SetUpVector() above, but normalizes the incoming values.
 
void SetRightVector (const Vector3 &rightVector)
 Sets the assumption of what direction is "right".
 
void SetRightVector (double x, double y, double z)
 This is same as the SetRightVector() above, but normalizes the incoming values.
 
const Vector3GetUpVector (void) const
 Retrieve the "up" direction for this camera.
 
const Vector3GetRightVector (void) const
 Retrieve the "right" direction for this camera.
 
const FrustumGetFrustumWorldSpace (void) const
 Retrieve the camera's frustum, in world space.
 
const Vector3GetPosition (void) const
 Retrieve the camera's position in world space.
 
double GetAltitude (void) const
 Retrieve the camera's altitude in world space.
 
const Matrix4GetBasis4x4 () const
 Returns a matrix4 defining the basis based on the current "up vector.".
 
const Matrix4GetInverseBasis4x4 () const
 Returns a matrix4 defining the inverse basis based on the current "up vector.".
 
const Matrix3GetBasis3x3 () const
 Returns a matrix4 defining the basis based on the current "up vector.".
 
const Matrix3GetInverseBasis3x3 () const
 Returns a matrix4 defining the inverse basis based on the current "up vector.".
 
void SILVERLINING_API SetName (const char *name)
 Set the name of the camera.
 
const char *SILVERLINING_API GetName (void) const
 Get the name of the camera.
 
bool operator== (const Camera &rhs) const
 Equality operator.
 
bool operator!= (const Camera &rhs) const
 In-Equality operator.
 
void SetRenderTarget (int _target)
 Set the renderer specific render target.
 
int GetRenderTarget (void) const
 Get the renderer specific render target.
 
void GetViewPortFast (int &x, int &y, int &w, int &h) const
 Get viewport without any checks as to whether viewport has been set or not.
 
bool GetDepthRange (float &zmin, float &zmax) const
 Retrieves the depth range for rendering.
 
bool SetDepthRange (float zmin, float zmax)
 Sets the depth range for rendering.
 
bool HasDepthRange (void) const
 Whether the camera has a depth range set on it.
 
double GetFieldOfView (void) const
 Get the field of view given the set projection matrix.
 

Detailed Description

A Camera describes a given view, along with its associated view, projection, and viewport.

Constructor & Destructor Documentation

◆ Camera() [1/2]

SilverLining::Camera::Camera ( bool  rightHanded)

Constructor; pass in whether this camera is within a right-handed or left-handed coordinate system.

◆ Camera() [2/2]

SilverLining::Camera::Camera ( const Camera camera,
bool  copyXForms,
bool  needsFrustum 
)

Copy this Camera from another one.

If the resulting copy does not require transformation matrices or the camera's frustum to be computed, these may be disabled to gain speed.

◆ ~Camera()

virtual SilverLining::Camera::~Camera ( )
virtual

Virtual destructor.

Member Function Documentation

◆ GetAltitude()

double SilverLining::Camera::GetAltitude ( void  ) const

Retrieve the camera's altitude in world space.

◆ GetDepthRange()

bool SilverLining::Camera::GetDepthRange ( float &  zmin,
float &  zmax 
) const

Retrieves the depth range for rendering.

Parameters
zminThe depth buffer range min value, float [0.0 .. 1.0].
zmaxThe depth buffer range max value, float [0.0 .. 1.0].
See also
GetViewport() SetViewport() SetDepthRange()

◆ GetFrustumWorldSpace()

const Frustum & SilverLining::Camera::GetFrustumWorldSpace ( void  ) const

Retrieve the camera's frustum, in world space.

◆ GetModelViewMatrix()

const Matrix4 & SilverLining::Camera::GetModelViewMatrix ( ) const

Retrieve the camera's view matrix.

◆ GetModelViewProjectionMatrix()

const Matrix4 & SilverLining::Camera::GetModelViewProjectionMatrix ( ) const

Retrieve the camera's combined view X projection matrix.

◆ GetName()

const char *SILVERLINING_API SilverLining::Camera::GetName ( void  ) const

Get the name of the camera.

◆ GetPosition()

const Vector3 & SilverLining::Camera::GetPosition ( void  ) const

Retrieve the camera's position in world space.

◆ GetProjectionMatrix()

const Matrix4 & SilverLining::Camera::GetProjectionMatrix ( ) const

Retrieve the camera's projection matrix.

◆ GetRenderTarget()

int SilverLining::Camera::GetRenderTarget ( void  ) const
inline

Get the renderer specific render target.

This is the frame buffer object for OpenGL/OpenGL32 renderers.

◆ GetRightVector()

const Vector3 & SilverLining::Camera::GetRightVector ( void  ) const

Retrieve the "right" direction for this camera.

◆ GetUpVector()

const Vector3 & SilverLining::Camera::GetUpVector ( void  ) const

Retrieve the "up" direction for this camera.

◆ GetViewport() [1/2]

bool SilverLining::Camera::GetViewport ( int &  x,
int &  y,
int &  w,
int &  h 
) const

Retrieve the viewport origin and size.

◆ GetViewport() [2/2]

bool SilverLining::Camera::GetViewport ( int  viewport[4]) const

Retrieve the viewport in a format useful for OpenGL.

(x, y, w, h)

◆ HasCameraMatrix()

bool SilverLining::Camera::HasCameraMatrix ( void  ) const

Returns if this Camera has a view matrix associated with it yet.

◆ HasProjectionMatrix()

bool SilverLining::Camera::HasProjectionMatrix ( void  ) const

Returns if this Camera has a projection matrix associated with it yet.

◆ HasViewPort()

bool SilverLining::Camera::HasViewPort ( void  ) const

Returns if this Camera has a viewport associated with it yet.

◆ SetDepthRange()

bool SilverLining::Camera::SetDepthRange ( float  zmin,
float  zmax 
)

Sets the depth range for rendering.

Parameters
zminThe depth buffer range min value, float [0.0 .. 1.0].
zmaxThe depth buffer range max value, float [0.0 .. 1.0].
See also
SetViewport() GetViewport() GetDepthRange()

◆ SetModelViewMatrix()

void SilverLining::Camera::SetModelViewMatrix ( const Matrix4 modelViewMatrix)

Associate a 4x4 view matrix with this camera.

This should be updated as often as necessary.

◆ SetName()

void SILVERLINING_API SilverLining::Camera::SetName ( const char *  name)

Set the name of the camera.

◆ SetProjectionMatrix()

void SilverLining::Camera::SetProjectionMatrix ( const Matrix4 projectionMatrix)

Associate a 4x4 projection matrix with this camera.

◆ SetRenderTarget()

void SilverLining::Camera::SetRenderTarget ( int  _target)
inline

Set the renderer specific render target.

This is the frame buffer object for OpenGL/OpenGL32 renderers.

◆ SetRightVector() [1/2]

void SilverLining::Camera::SetRightVector ( const Vector3 rightVector)

Sets the assumption of what direction is "right".

If the vector (x, y, z) is not a unit vector, it is normalized before being stored. Cannot be called prior to Atmosphere::Initialize(). Must be called in conjunction with SetUpVector().

Be sure to call this prior to positioning any clouds. The incoming vector is used as is (without normalization).

◆ SetRightVector() [2/2]

void SilverLining::Camera::SetRightVector ( double  x,
double  y,
double  z 
)

This is same as the SetRightVector() above, but normalizes the incoming values.

That is, if the incoming vector (x, y, z) is not a unit vector, it is normalized before being stored.

◆ SetUpVector() [1/2]

void SilverLining::Camera::SetUpVector ( const Vector3 upVector)

Sets the assumption of what direction is "up".

Cannot be called prior to Atmosphere::Initialize(). Must be called in conjunction with SetRightVector().

Be sure to call this prior to positioning any clouds.

In a geocentric / ECEF coordinate system, this should be the normalized camera position vector pointing from the center of the Earth, not the local normal vector of the Earth's ellipsoid. There is a subtle difference between the two that can lead to cloud positions being a bit off. The incoming vector is used as is (without normalization).

◆ SetUpVector() [2/2]

void SilverLining::Camera::SetUpVector ( double  x,
double  y,
double  z 
)

This is same as the SetUpVector() above, but normalizes the incoming values.

That is, if the incoming vector (x, y, z) is not a unit vector, it is normalized before being stored.

◆ SetViewport()

void SilverLining::Camera::SetViewport ( int  x,
int  y,
int  w,
int  h 
)

Set the viewport origin and size for this camera.


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