Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::Camera Class Reference

#include <StkCamera.h>

Public Types

enum  ProjectionType { Orthographic , Perspective }
 
enum  FrustumPlanes {
  LeftPlane = 0 , RightPlane , TopPlane , BottomPlane ,
  NumPlanes
}
 
enum  FrustumTestResult { Outside = 0 , Inside = 1 , Straddle = 2 }
 

Public Member Functions

float getLeft () const
 
float getRight () const
 
float getTop () const
 
float getBottom () const
 
float getNear () const
 Get near clip plane distance.
 
float getFar () const
 Get far clip plane distance.
 
float getFovY () const
 
float getAspectRatio () const
 Get aspect ratio of the frustum (width/height)
 
ProjectionType getProjectionType () const
 
void setProjectionType (ProjectionType pj_type)
 
void setPerspective (float fovy, float aspect, float clip_near, float clip_far)
 
void setOrthographic (float left, float right, float bottom, float top, float z_near, float z_far)
 
void adjustNearFar (float z_near, float z_far)
 
const STK::Matrix4x4fgetProjectionMatrix () const
 Get the current projection matrix.
 
void setFrustum (float left, float right, float bottom, float top, float z_near, float z_far)
 
const STK::Matrix4x4fgetViewMatrix () const
 
void setViewMatrix (const STK::Matrix4x4f &vm)
 
const STK::Matrix4x4fgetInverseViewMatrix () const
 
float calcProjPixelSize (double dist, int resolution) const
 
void setLODPixelScale (float s)
 
float getLODPixelScale () const
 
int frustumSphereTestView (float x, float y, float z, float r) const
 
int frustumSphereTestView (const STK::Vector3f &c, float r) const
 
int frustumSphereTest (const STK::Vector3f &c, float r) const
 
int frustumBoxTestView (const STK::Vector3f &center, const STK::Vector3f &xAxis, const STK::Vector3f &yAxis, const STK::Vector3f &zAxis) const
 
int frustumBoxTest (const STK::Vector3f &center, const STK::Vector3f &xAxis, const STK::Vector3f &yAxis, const STK::Vector3f &zAxis) const
 
STK::Vector3f getPosition () const
 

Protected Member Functions

void calcFrustumPlanes () const
 
void calcOrthographicProjection () const
 
void calcPerspectiveProjection () const
 

Protected Attributes

float left_
 
float right_
 
float top_
 
float bottom_
 
float near_
 
float far_
 
ProjectionType pj_type_
 
STK::Vector3f plane_ [NumPlanes]
 
bool planes_dirty_
 
STK::Matrix4x4f pj_
 
bool pj_dirty_
 
STK::Matrix4x4f vm_
 
STK::Matrix4x4f inv_vm_
 
float lod_pixel_scale_
 

Detailed Description

Camera - Simple camera class.

Member Function Documentation

◆ adjustNearFar()

void Camera::adjustNearFar ( float  z_near,
float  z_far 
)

Adjust clipping planes. This method assumes that you already have a valid frustum.

◆ calcProjPixelSize()

float STK::Camera::calcProjPixelSize ( double  dist,
int  resolution 
) const
inline

Return pixel size in units/pixel at the given distance and screen resolution This value can be used for LOD calculations and is scaled by the LOD scale value.

See also
setPixelScale()

◆ frustumBoxTest()

int STK::Camera::frustumBoxTest ( const STK::Vector3f center,
const STK::Vector3f xAxis,
const STK::Vector3f yAxis,
const STK::Vector3f zAxis 
) const
inline

Check frustum against oriented bounding box in world coordinates. The OBB is defined by a center point and three half-axes

Parameters
centerCenter of the box
xAxisDirection and half the length of the box along the x axis.
xAxisDirection and half the length of the box along the y axis.
xAxisDirection and half the length of the box along the z axis.

◆ frustumBoxTestView()

int Camera::frustumBoxTestView ( const STK::Vector3f center,
const STK::Vector3f xAxis,
const STK::Vector3f yAxis,
const STK::Vector3f zAxis 
) const

Check frustum against oriented bounding box in view coordinates. The OBB is defined by a center point and three half-axes

Parameters
centerCenter of the box
xAxisDirection and half the length of the box along the x axis.
xAxisDirection and half the length of the box along the y axis.
xAxisDirection and half the length of the box along the z axis.

◆ frustumSphereTest()

int STK::Camera::frustumSphereTest ( const STK::Vector3f c,
float  r 
) const
inline

Check if a sphere intersects the frustum. This check assumes the sphere is given in world coordinates

See also
frustumSphereTestView

◆ frustumSphereTestView()

int Camera::frustumSphereTestView ( float  x,
float  y,
float  z,
float  r 
) const

Check if a sphere intersects the frustum in view coordinates. This method checks if the sphere centered at (x, y, z) with radius r intersects the frustum. This check requires the sphere to be given in view coordinates.

Returns
Inside if sphere is fully contained in the frustum
Outside if sphere is fully outsde the frustum
Straddle if sphere is partially inside the frustum

◆ getBottom()

float STK::Camera::getBottom ( ) const
inline

Get frustum bottom. For a perspective frustum this corresponds to the bottom of the near clipping plane.

◆ getFovY()

float STK::Camera::getFovY ( ) const
inline

Get vertical field of view in degrees. Only valid if frustum is symmetrical in y-direction

◆ getLeft()

float STK::Camera::getLeft ( ) const
inline

Get frustum left side For a perspective frustum this corresponds to the right side of the near clipping plane.

◆ getPosition()

STK::Vector3f Camera::getPosition ( ) const

Get the world position of the camera.

◆ getRight()

float STK::Camera::getRight ( ) const
inline

Get frustum right side. For a perspective frustum this corresponds to the left side of the near clipping plane.

◆ getTop()

float STK::Camera::getTop ( ) const
inline

Get frustum top. For a perspective frustum this corresponds to the top of the near clipping plane.

◆ setOrthographic()

void Camera::setOrthographic ( float  left,
float  right,
float  bottom,
float  top,
float  z_near,
float  z_far 
)

Set orthographic projection.

◆ setPerspective()

void Camera::setPerspective ( float  fovy,
float  aspect,
float  clip_near,
float  clip_far 
)

Set perspective projection.


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