Saga3D API Documentation  1.0-RC4
saga::scene::ICameraSceneNode Class Referenceabstract

Scene Node which is a (controllable) camera. More...

#include <ICameraSceneNode.h>

Inheritance diagram for saga::scene::ICameraSceneNode:
saga::scene::ISceneNode saga::IEventReceiver

Public Member Functions

 ICameraSceneNode (const std::shared_ptr< ISceneNode > &parent, const std::shared_ptr< ISceneManager > &mgr, const glm::vec3 &position=glm::vec3(0, 0, 0), const glm::vec3 &rotation=glm::vec3(0, 0, 0), const glm::vec3 &scale=glm::vec3(1.0f, 1.0f, 1.0f))
 Constructor. More...
 
virtual void setProjectionMatrix (const glm::mat4 &projection, bool isOrthogonal=false)=0
 Sets the projection matrix of the camera. More...
 
virtual const glm::mat4 & getProjectionMatrix () const =0
 Gets the current projection matrix of the camera. More...
 
virtual void setViewMatrix (const glm::mat4 &view)=0
 
virtual const glm::mat4 & getViewMatrix () const =0
 Gets the current view matrix of the camera. More...
 
virtual void setTarget (const glm::vec3 &newTarget)=0
 Sets the look at target of the camera. More...
 
virtual void setRotation (const glm::vec3 &rotation)=0
 Sets the rotation of the node. More...
 
virtual const glm::vec3 & getTarget () const =0
 Gets the current look at target of the camera. More...
 
virtual void setUpVector (const glm::vec3 &pos)=0
 Sets the up vector of the camera. More...
 
virtual const glm::vec3 & getUpVector () const =0
 Gets the up vector of the camera. More...
 
virtual float getNearValue () const =0
 Gets the value of the near plane of the camera. More...
 
virtual float getFarValue () const =0
 Gets the value of the far plane of the camera. More...
 
virtual float getAspectRatio () const =0
 Gets the aspect ratio of the camera. More...
 
virtual float getFOV () const =0
 Gets the field of view of the camera. More...
 
virtual void setNearValue (float zn)=0
 Sets the value of the near clipping plane. (default: 1.0f) More...
 
virtual void setFarValue (float zf)=0
 Sets the value of the far clipping plane (default: 2000.0f) More...
 
virtual void setAspectRatio (float aspect)=0
 Sets the aspect ratio (default: 4.0f / 3.0f) More...
 
virtual void setFOV (float fovy)=0
 Sets the field of view (Default: PI / 2.5f) More...
 
virtual bool isOrthogonal () const
 Checks if a camera is orthogonal. More...
 
virtual void updateViewMatrix ()=0
 Updates view matrix. More...
 
virtual void updateProjectionMatrix ()=0
 Updates projection matrix. More...
 
- Public Member Functions inherited from saga::scene::ISceneNode
 ISceneNode (const std::shared_ptr< ISceneNode > &parent, const std::shared_ptr< ISceneManager > &mgr, const glm::vec3 &position=glm::vec3(0, 0, 0), const glm::vec3 &rotation=glm::vec3(0, 0, 0), const glm::vec3 &scale=glm::vec3(1.0f, 1.0f, 1.0f))
 Constructor. More...
 
virtual void onEvent (const SDL_Event &event) override
 Called when an SDL event is fired. More...
 
virtual ~ISceneNode ()
 Destructor. More...
 
void setID (const ID id)
 
const auto getID () const
 
virtual void onRegisterSceneNode (video::RenderPassHandle pass)
 This method is called just before the rendering process of the whole scene. More...
 
virtual void onUnregisterSceneNode (video::RenderPassHandle pass)
 
void setOnRender (std::function< void()> func)
 
void onRender ()
 
bool hasDrawCommands () const
 
void setDrawCommands (video::DrawCommandList &&list)
 
const auto & getDrawCommands () const
 
auto getTexture (int slot) const
 
auto & getTextures ()
 
void setTexture (int slot, video::TextureHandle texture)
 
virtual void setPipeline (video::PipelineHandle pipeline)
 
auto getPipeline () const
 
virtual void onAnimate (const float time)
 onAnimate() is called just before rendering the whole scene. More...
 
virtual const std::string & getName () const
 Returns the name of the node. More...
 
virtual void setName (const std::string &name)
 Sets the name of the node. More...
 
virtual const core::aabbox3d< float > & getBoundingBox () const =0
 Get the axis aligned, not transformed bounding box of this node. More...
 
virtual const core::aabbox3d< float > getTransformedBoundingBox () const
 Get the axis aligned, transformed and animated absolute bounding box of this node. More...
 
virtual void getTransformedBoundingBoxEdges (std::vector< glm::vec3 > &edges) const
 
virtual const glm::mat4 & getAbsoluteTransformation () const
 Get the absolute transformation of the node. Is recalculated every onAnimate()-call. More...
 
virtual glm::mat4 getRelativeTransformation () const
 Returns the relative transformation of the scene node. More...
 
virtual bool isVisible () const
 Returns whether the node should be visible (if all of its parents are visible). More...
 
virtual bool isTrulyVisible () const
 Check whether the node is truly visible, taking into accounts its parents' visibility. More...
 
virtual void setVisible (bool isVisible)
 Sets if the node should be visible or not. More...
 
virtual void addChild (const std::shared_ptr< ISceneNode > &child)
 Adds a child to this scene node. More...
 
virtual bool removeChild (const std::shared_ptr< ISceneNode > &child)
 
virtual void removeAll ()
 Removes all children of this scene node. More...
 
virtual void remove ()
 Removes this scene node from the scene. More...
 
virtual void addAnimator (const std::shared_ptr< ISceneNodeAnimator > &animator)
 Adds an animator which should animate this node. More...
 
const auto & getAnimators () const
 Get a list of all scene node animators. More...
 
virtual void removeAnimator (const std::shared_ptr< ISceneNodeAnimator > &animator)
 Removes an animator from this scene node. More...
 
virtual void removeAnimators ()
 Removes all animators from this scene node. More...
 
virtual const glm::vec3 & getScale () const
 Gets the scale of the scene node relative to its parent. More...
 
virtual void setScale (const glm::vec3 &scale)
 Sets the relative scale of the scene node. More...
 
virtual const glm::vec3 & getRotation () const
 Gets the rotation of the node relative to its parent. More...
 
virtual const glm::vec3 & getPosition () const
 Gets the position of the node relative to its parent. More...
 
virtual void setPosition (const glm::vec3 &newpos)
 Sets the position of the node relative to its parent. More...
 
virtual glm::vec3 getAbsolutePosition () const
 Gets the absolute position of the node in world coordinates. More...
 
const std::vector< std::shared_ptr< ISceneNode > > & getChildren () const
 Returns a const reference to the list of all children. More...
 
virtual void setParent (const std::shared_ptr< ISceneNode > &newParent)
 Changes the parent of the scene node. More...
 
virtual void updateAbsolutePosition ()
 Returns the triangle selector attached to this scene node. More...
 
const std::shared_ptr< ISceneNode > & getParent () const
 Returns the parent of this scene node. More...
 
virtual E_SCENE_NODE_TYPE getType () const
 Returns type of the scene node. More...
 
virtual std::shared_ptr< ISceneNodeclone (const std::shared_ptr< ISceneNode > &newParent=0)
 Creates a clone of this scene node and its children. More...
 
virtual const std::shared_ptr< ISceneManager > & getSceneManager () const
 Retrieve the scene manager for this node. More...
 
- Public Member Functions inherited from saga::IEventReceiver
virtual ~IEventReceiver ()
 Destructor. More...
 

Protected Attributes

bool IsOrthogonal
 
- Protected Attributes inherited from saga::scene::ISceneNode
ID NodeID = INVALID_ID
 A clone function for the ISceneNode members. More...
 
std::string Name
 Name of the scene node. More...
 
glm::mat4 AbsoluteTransformation
 Absolute transformation of the node. More...
 
glm::vec3 RelativeTranslation
 Relative translation of the scene node. More...
 
glm::vec3 RelativeRotation
 Relative rotation of the scene node. More...
 
glm::vec3 RelativeScale
 Relative scale of the scene node. More...
 
std::shared_ptr< ISceneNodeParent = nullptr
 Pointer to the parent. More...
 
std::vector< std::shared_ptr< ISceneNode > > Children
 List of all children of this node. More...
 
std::array< video::STexture::HandleType, video::MAX_NODE_TEXTURESTextures = { video::NULL_GPU_RESOURCE_HANDLE }
 Texture list. More...
 
std::vector< std::shared_ptr< ISceneNodeAnimator > > Animators
 List of all animator nodes. More...
 
std::shared_ptr< ISceneManagerSceneManager = nullptr
 Pointer to the scene manager. More...
 
std::function< void()> OnRenderCallback = nullptr
 Custom hook into rendering process of the scene node. More...
 
video::DrawCommandList DrawCommands
 
video::PipelineHandle Pipeline = video::NULL_GPU_RESOURCE_HANDLE
 
bool IsVisible = true
 Is the node visible? More...
 

Detailed Description

Scene Node which is a (controllable) camera.

The whole scene will be rendered from the cameras point of view. Because the ICameraSceneNode is a SceneNode, it can be attached to any other scene node, and will follow its parents movement, rotation and so on.

Definition at line 23 of file ICameraSceneNode.h.

Constructor & Destructor Documentation

◆ ICameraSceneNode()

saga::scene::ICameraSceneNode::ICameraSceneNode ( const std::shared_ptr< ISceneNode > &  parent,
const std::shared_ptr< ISceneManager > &  mgr,
const glm::vec3 &  position = glm::vec3(0,0,0),
const glm::vec3 &  rotation = glm::vec3(0,0,0),
const glm::vec3 &  scale = glm::vec3(1.0f,1.0f,1.0f) 
)
inline

Constructor.

Definition at line 28 of file ICameraSceneNode.h.

Member Function Documentation

◆ getAspectRatio()

virtual float saga::scene::ICameraSceneNode::getAspectRatio ( ) const
pure virtual

Gets the aspect ratio of the camera.

Returns
The aspect ratio of the camera.

◆ getFarValue()

virtual float saga::scene::ICameraSceneNode::getFarValue ( ) const
pure virtual

Gets the value of the far plane of the camera.

Returns
The value of the far plane of the camera.

◆ getFOV()

virtual float saga::scene::ICameraSceneNode::getFOV ( ) const
pure virtual

Gets the field of view of the camera.

Returns
The field of view of the camera in radians.

◆ getNearValue()

virtual float saga::scene::ICameraSceneNode::getNearValue ( ) const
pure virtual

Gets the value of the near plane of the camera.

Returns
The value of the near plane of the camera.

◆ getProjectionMatrix()

virtual const glm::mat4& saga::scene::ICameraSceneNode::getProjectionMatrix ( ) const
pure virtual

Gets the current projection matrix of the camera.

Returns
The current projection matrix of the camera.

◆ getTarget()

virtual const glm::vec3& saga::scene::ICameraSceneNode::getTarget ( ) const
pure virtual

Gets the current look at target of the camera.

Returns
The current look at target of the camera, in world co-ordinates

◆ getUpVector()

virtual const glm::vec3& saga::scene::ICameraSceneNode::getUpVector ( ) const
pure virtual

Gets the up vector of the camera.

Returns
The up vector of the camera, in world space.

◆ getViewMatrix()

virtual const glm::mat4& saga::scene::ICameraSceneNode::getViewMatrix ( ) const
pure virtual

Gets the current view matrix of the camera.

Returns
The current view matrix of the camera.

◆ isOrthogonal()

virtual bool saga::scene::ICameraSceneNode::isOrthogonal ( ) const
inlinevirtual

Checks if a camera is orthogonal.

Definition at line 120 of file ICameraSceneNode.h.

◆ setAspectRatio()

virtual void saga::scene::ICameraSceneNode::setAspectRatio ( float  aspect)
pure virtual

Sets the aspect ratio (default: 4.0f / 3.0f)

Parameters
aspectNew aspect ratio.

◆ setFarValue()

virtual void saga::scene::ICameraSceneNode::setFarValue ( float  zf)
pure virtual

Sets the value of the far clipping plane (default: 2000.0f)

Parameters
zfNew z far value.

◆ setFOV()

virtual void saga::scene::ICameraSceneNode::setFOV ( float  fovy)
pure virtual

Sets the field of view (Default: PI / 2.5f)

Parameters
fovyNew field of view in radians.

◆ setNearValue()

virtual void saga::scene::ICameraSceneNode::setNearValue ( float  zn)
pure virtual

Sets the value of the near clipping plane. (default: 1.0f)

Parameters
znNew z near value.

◆ setProjectionMatrix()

virtual void saga::scene::ICameraSceneNode::setProjectionMatrix ( const glm::mat4 &  projection,
bool  isOrthogonal = false 
)
pure virtual

Sets the projection matrix of the camera.

The glm::mat4 class has some methods to build a projection matrix. e.g: glm::mat4::buildProjectionMatrixPerspectiveFovLH. Note that the matrix will only stay as set by this method until one of the following Methods are called: setNearValue, setFarValue, setAspectRatio, setFOV.

Parameters
projectionThe new projection matrix of the camera.
isOrthogonalSet this to true if the matrix is an orthogonal one (e.g. from matrix4::buildProjectionMatrixOrtho).

◆ setRotation()

virtual void saga::scene::ICameraSceneNode::setRotation ( const glm::vec3 &  rotation)
pure virtual

Sets the rotation of the node.

This only modifies the relative rotation of the node. If the camera's target and rotation are bound (

See also
bindTargetAndRotation()) then calling this will also change the camera's target to match the rotation.
Parameters
rotationNew rotation of the node in degrees.

Reimplemented from saga::scene::ISceneNode.

◆ setTarget()

virtual void saga::scene::ICameraSceneNode::setTarget ( const glm::vec3 &  newTarget)
pure virtual

Sets the look at target of the camera.

If the camera's target and rotation are bound (

See also
bindTargetAndRotation()) then calling this will also change the camera's scene node rotation to match the target. Note that setTarget uses the current absolute position internally, so if you changed setPosition since last rendering you must call updateAbsolutePosition before using this function.
Parameters
posLook at target of the camera, in world co-ordinates.

◆ setUpVector()

virtual void saga::scene::ICameraSceneNode::setUpVector ( const glm::vec3 &  pos)
pure virtual

Sets the up vector of the camera.

Parameters
posNew upvector of the camera.

◆ setViewMatrix()

virtual void saga::scene::ICameraSceneNode::setViewMatrix ( const glm::mat4 &  view)
pure virtual

◆ updateProjectionMatrix()

virtual void saga::scene::ICameraSceneNode::updateProjectionMatrix ( )
pure virtual

Updates projection matrix.

◆ updateViewMatrix()

virtual void saga::scene::ICameraSceneNode::updateViewMatrix ( )
pure virtual

Updates view matrix.

Member Data Documentation

◆ IsOrthogonal

bool saga::scene::ICameraSceneNode::IsOrthogonal
protected

Definition at line 132 of file ICameraSceneNode.h.


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