PixelLightAPI  .
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions
PLScene::SNCamera Class Reference

PixelLight standard camera scene node. More...

#include <SNCamera.h>

Inheritance diagram for PLScene::SNCamera:
Inheritance graph
[legend]

List of all members.

Public Types

enum  EFlags { FlipY = 1<<10, InvCullMode = 1<<11, NoZFar = 1<<12 }
 Scene node flags (SceneNode flags extension) More...

Public Member Functions

 pl_enum (EFlags) pl_enum_base(SceneNode
 Scene node debug flags (SceneNode debug flags extension)
PLS_API float GetAspect () const
PLS_API void SetAspect (float fValue)
PLS_API float GetZNear () const
PLS_API void SetZNear (float fValue)
PLS_API float GetZFar () const
PLS_API void SetZFar (float fValue)
PLS_API PLCore::String GetSceneRendererFilename () const
PLS_API void SetSceneRendererFilename (const PLCore::String &sValue)
virtual PLS_API void SetFlags (PLCore::uint32 nValue)
PLS_API SNCamera ()
 Default constructor.
virtual PLS_API ~SNCamera ()
 Destructor.
PLS_API SceneRendererGetSceneRenderer () const
 Returns the used scene renderer.
PLS_API bool SetCamera (PLRenderer::Renderer &cRenderer, bool bSetProjection=true, bool bSetView=true)
 Sets the camera.
PLS_API bool GetAutoUpdate () const
 Returns whether the camera projection and view matrix and the frustum are updated automatically.
PLS_API void SetAutoUpdate (bool bAutoUpdate=true)
 Sets whether the camera projection and view matrix and the frustum are updated automatically.
PLS_API PLMath::Matrix4x4GetProjectionMatrix (const PLMath::Rectangle &cViewport)
 Returns the projection matrix.
PLS_API const PLMath::QuaternionGetViewRotationOffset () const
 Returns the view rotation offset.
PLS_API void SetViewRotationOffset (const PLMath::Quaternion &qViewRotationOffset)
 Sets the view rotation offset.
PLS_API PLMath::Matrix3x4GetViewMatrix ()
 Returns the view matrix.
PLS_API PLMath::FrustumGetFrustum (const PLMath::Rectangle &cViewport)
 Returns the camera frustum.
PLS_API const PLCore::Array
< PLMath::Vector3 > & 
GetFrustumVertices (const PLMath::Rectangle &cViewport)
 Returns the 8 camera frustum vertices.
PLS_API bool GetViewportCorners (PLMath::Vector3 &vUpperRight, PLMath::Vector3 &vLowerRight, PLMath::Vector3 &vLowerLeft, PLMath::Vector3 &vUpperLeft, bool bContainerSpace, float fDistance)
 Gets the current camera viewport corners.
virtual PLS_API void DrawDebug (PLRenderer::Renderer &cRenderer, const VisNode *pVisNode=nullptr) override
 This function is called when the debug parts of the scene are drawn.

Static Public Member Functions

static PLS_API SNCameraGetCamera ()
 Returns the current set camera.
static PLS_API void SetCamera (SNCamera *pCamera, PLRenderer::Renderer *pRenderer)
 Sets the current set camera.

Protected Types

enum  EInternalCameraFlags { RecalculateProjectionMatrix = 1<<0, RecalculateViewMatrix = 1<<1, RecalculateFrustum = 1<<2, RecalculateFrustumVertices = 1<<3 }
 Flags which hold internal camera information. More...

Protected Member Functions

virtual PLS_API void UpdateAABoundingBox () override
 Updates the axis align bounding box in 'scene node space'.

Detailed Description

PixelLight standard camera scene node.

Remarks:
PixelLight is using a right-handed coordinate system like OpenGL does, therefore the camera usually looks along the negative z-axis. While this fact may be ok in 'low level' functionality, it makes cameras less comfortable within the scene graph because this 'look along negative z' doesn't go along with universal features like 'look at this point'. So, we decided to 'break' the right-handed coordinate system convention within the camera scene node when it's coming to 'look along negative z'. Instead we 'look along positive z' and we profit from an universal behavior and don't need to care about flipping axis - although it's still possible to flip axis.
Note:
  • Scene node scale is ignored

Member Enumeration Documentation

Scene node flags (SceneNode flags extension)

Enumerator:
FlipY 

Flip y axis

InvCullMode 

Invert cull mode

NoZFar 

Do not use the far clipping plane

Reimplemented from PLScene::SceneNode.

Flags which hold internal camera information.

Enumerator:
RecalculateProjectionMatrix 

Recalculation of projection matrix required

RecalculateViewMatrix 

Recalculation of view matrix required

RecalculateFrustum 

Recalculation of frustum required

RecalculateFrustumVertices 

Recalculation of frustum vertices required


Constructor & Destructor Documentation

Default constructor.

virtual PLS_API PLScene::SNCamera::~SNCamera ( ) [virtual]

Destructor.


Member Function Documentation

Scene node debug flags (SceneNode debug flags extension)

< Do not draw the (green) frustum

< Draw the (green) frustum vertices

Reimplemented from PLScene::SceneNode.

PLS_API float PLScene::SNCamera::GetAspect ( ) const
PLS_API void PLScene::SNCamera::SetAspect ( float  fValue)
PLS_API float PLScene::SNCamera::GetZNear ( ) const
PLS_API void PLScene::SNCamera::SetZNear ( float  fValue)
PLS_API float PLScene::SNCamera::GetZFar ( ) const
PLS_API void PLScene::SNCamera::SetZFar ( float  fValue)
virtual PLS_API void PLScene::SNCamera::SetFlags ( PLCore::uint32  nValue) [virtual]

Reimplemented from PLScene::SceneNode.

static PLS_API SNCamera* PLScene::SNCamera::GetCamera ( ) [static]

Returns the current set camera.

Returns:
The current set camera, a null pointer if no camera is currently set
static PLS_API void PLScene::SNCamera::SetCamera ( SNCamera pCamera,
PLRenderer::Renderer pRenderer 
) [static]

Sets the current set camera.

Parameters:
[in]pCameraThe current set camera, a null pointer if no camera is currently set
[in]pRendererRenderer to use, if a null pointer nothing happens

Returns the used scene renderer.

Returns:
The used scene renderer, can be a null pointer
PLS_API bool PLScene::SNCamera::SetCamera ( PLRenderer::Renderer cRenderer,
bool  bSetProjection = true,
bool  bSetView = true 
)

Sets the camera.

Parameters:
[in]cRendererRenderer to use
[in]bSetProjectionSet projection matrix?
[in]bSetViewSet view matrix?
Returns:
'true' if all went fine, else 'false'
Note:
  • The projection and view matrix will be set using the camera settings
PLS_API bool PLScene::SNCamera::GetAutoUpdate ( ) const

Returns whether the camera projection and view matrix and the frustum are updated automatically.

Returns:
'true' if the camera projection and view matrix and the frustum are updated automatically, else 'false'
Note:
  • If this is 'true', the mentioned things will be updated within 'SetCamera()'
PLS_API void PLScene::SNCamera::SetAutoUpdate ( bool  bAutoUpdate = true)

Sets whether the camera projection and view matrix and the frustum are updated automatically.

Parameters:
[in]bAutoUpdate'true' if the camera projection and view matrix and the frustum are updated automatically, else 'false'
See also:

Returns the projection matrix.

Parameters:
[in]cViewportViewport to use
Returns:
Projection matrix
See also:

Returns the view rotation offset.

Returns:
View rotation offset
Remarks:
By using the view rotation offset, a camera can be rotated towards one direction while viewing towards another one. This view rotation offset can for example be controlled by a head tracker system.
PLS_API void PLScene::SNCamera::SetViewRotationOffset ( const PLMath::Quaternion qViewRotationOffset)

Sets the view rotation offset.

Parameters:
[in]qViewRotationOffsetNew view rotation offset to set
See also:

Returns the view matrix.

Returns:
View matrix
Remarks:
PixelLight is using a right-handed coordinate system like OpenGL does, therefore the view matrix 'looks' along the negative z-axis. (unlike the camera scene node itself, have a look into the class documentation)
See also:

Returns the camera frustum.

Parameters:
[in]cViewportViewport to use
Returns:
Camera frustum in 'scene container space'
See also:

Returns the 8 camera frustum vertices.

Parameters:
[in]cViewportViewport to use
Returns:
8 camera vertices in 'scene container space'
Note:
  • This vertices can for instance be used to check the camera frustum visibility
PLS_API bool PLScene::SNCamera::GetViewportCorners ( PLMath::Vector3 vUpperRight,
PLMath::Vector3 vLowerRight,
PLMath::Vector3 vLowerLeft,
PLMath::Vector3 vUpperLeft,
bool  bContainerSpace,
float  fDistance 
)

Gets the current camera viewport corners.

Parameters:
[out]vUpperRightWill receive the upper/right corner
[out]vLowerRightWill receive the lower/right corner
[out]vLowerLeftWill receive the lower/left corner
[out]vUpperLeftWill receive the upper/left corner
[in]bContainerSpaceTransform corners into container space? (else they are within local scene node space)
[in]fDistanceDistance from 0, use for example GetNearPlane() to get the viewport corners on the near plane
Returns:
'true' if all went fine, else 'false' (maybe no camera is set?)
virtual PLS_API void PLScene::SNCamera::DrawDebug ( PLRenderer::Renderer cRenderer,
const VisNode pVisNode = nullptr 
) [override, virtual]

This function is called when the debug parts of the scene are drawn.

Parameters:
[in]cRendererThe used renderer
[in]pVisNodeThe current visibility node of this scene node, can be a null pointer
Note:
  • Should only be called if the 'UseDrawDebug' draw flag and the 'DebugEnabled' debug flag is set
  • Beside drawing scene node stuff, the default implementation emits the SignalDrawDebug signal
See also:

Reimplemented from PLScene::SceneNode.

virtual PLS_API void PLScene::SNCamera::UpdateAABoundingBox ( ) [override, protected, virtual]

Updates the axis align bounding box in 'scene node space'.

Remarks:
This function is called when the axis align bounding box needs to be calculated. One can overwrite the default implementation to calculate the axis align bounding box in another way. The default implementation is empty. (current set axis align bounding box is still used)
Note:
  • We recommend to use 'SetAABoundingBox()' inside your own implementation to set the new axis align bounding box, this function will take care of all other required updates

Reimplemented from PLScene::SceneNode.


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:42
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported