Kigs Framework  Doc version 0.8
Open source multi purpose Rapid Application Development framework
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Camera Class Referenceabstract

#include <Camera.h>

Inheritance diagram for Camera:
Node3D SceneNode CoreModifiable GenericRefCountedBaseClass DX11Camera DX11CameraOrtho OpenGLCamera OpenGLCameraOrtho

Public Member Functions

bool SetActive (TravState *state)
 return true if camera was activated else do not render camera More...
 
void Release (TravState *state)
 release the camera
 
void SetViewport (kfloat vpminx, kfloat vpminy, kfloat vpsx, kfloat vpsy)
 set the viewport More...
 
void SetPosition (kfloat x, kfloat y, kfloat z)
 set the position of the camera More...
 
void GetPosition (kfloat &x, kfloat &y, kfloat &z)
 get the position of the camera More...
 
void SetViewVector (kfloat x, kfloat y, kfloat z)
 set the view factor More...
 
void GetViewVector (kfloat &x, kfloat &y, kfloat &z)
 get the view factor More...
 
void SetUpVector (kfloat x, kfloat y, kfloat z)
 set the position of the up vector More...
 
void GetUpVector (kfloat &x, kfloat &y, kfloat &z)
 get the up vector More...
 
void GetNodeBoundingBox (Point3D &pmin, Point3D &pmax) const override
 special case for camera has we want it to be init even if have no bounding box

 
void SetNearAndFar (kfloat znear, kfloat zfar)
 set the zNear and zFar values More...
 
void SetClearColor (kfloat r, kfloat g, kfloat b, kfloat a=1.0f)
 set the clear color More...
 
bool IsActive ()
 check if the camera is active More...
 
bool AllVisible ()
 check if the camera is in All Visible mode More...
 
virtual void InitCullingObject (CullingObject *obj)
 initialize the culling on an object More...
 
virtual void getRay (const kfloat &ScreenX, const kfloat &ScreenY, Point3D &RayOrigin, Vector3D &RayDirection)
 get the ray from a pixel More...
 
virtual bool Project (kfloat &, kfloat &, Point3D)
 project given point 3D using camera projection
 
RenderingScreengetRenderingScreen ()
 link to the rendering screen
 
- Public Member Functions inherited from Node3D
 DECLARE_DECORABLE_2_PARAMS (bool, Cull, Node3D, TravState *, unsigned int)
 
virtual void TravDraw (TravState *state)
 
virtual void TravCull (TravState *state)
 
bool addItem (const CMSP &item, ItemPosition pos=Last DECLARE_DEFAULT_LINK_NAME) override
 add item at first or last position
 
bool removeItem (const CMSP &item DECLARE_DEFAULT_LINK_NAME) override
 
void localMove (const v3f &move)
 move local node position ( pos = move + pos )
 
void globalMove (const v3f &move)
 move global node position ( gpos = gmove + gpos )
 
- Public Member Functions inherited from SceneNode
bool addItem (const CMSP &item, ItemPosition pos=Last DECLARE_DEFAULT_LINK_NAME) override
 add item at first or last position
 
- Public Member Functions inherited from CoreModifiable
void Init ()
 Modifiable managmenent.
 
void EmptyItemList ()
 remove all items (sons)
 
CMSP GetInstanceByPath (const std::string &path)
 return the instance corresponding to the given path in sons tree
 
std::string GetRuntimeID () const
 ID.
 
CoreModifiableAttributegetAttribute (KigsID labelid) const
 Attribute management.
 
u32 getNbArrayElements (KigsID attributeLabel) const
 return element count for an array type attribute
 
template<typename attribute_type , typename value_type >
attribute_type * AddDynamicAttribute (KigsID ID, const value_type &value)
 Dynamic attribute management.
 
const kigs::unordered_map< KigsID, ModifiableMethodStruct > * GetMethods ()
 Method management.
 
bool aggregateWith (CMSP &item, ItemPosition pos=Last)
 Aggregate management.
 
void flagAsNotificationCenterRegistered ()
 Flags.
 
void InitParametersFromList (const std::vector< CoreModifiableAttribute * > *params)
 Utility. More...
 
virtual bool removeItem (const CMSP &item)
 remove item (son)
 

Protected Member Functions

virtual bool ProtectedSetActive (TravState *state)=0
 enable the camera protection More...
 
virtual void ProtectedRelease (TravState *state)=0
 disable the camera protection
 
void InitModifiable () override
 initialize modifiable More...
 
void ProtectedDestroy () override
 Destroy method decrement refcounter and delete instance if no more used. More...
 
virtual ~Camera ()
 destructor
 
void RecomputeMatrix ()
 recompute matrix
 
virtual void UninitModifiable () override
 called when InitModifiable has failled : reset read/write flag on all init params More...
 
- Protected Member Functions inherited from Node3D
void removeUser (CoreModifiable *user) override
 remove user (parent)
 
void addUser (CoreModifiable *user) override
 add the given parent to list
 
void InitModifiable () override
 default modifiable init : set all initparams to readonly and set initflag to true More...
 
void PreDrawDrawable (TravState *state)
 call predraw for drawable sons of this node return true if at least one drawable son was found More...
 
void DrawDrawable (TravState *state)
 call draw for drawable sons of this node More...
 
void PostDrawDrawable (TravState *state)
 call postdraw for drawable sons of this node More...
 
void RecomputeGlobalToLocal ()
 
void RecomputeGlobalBoundingBox ()
 
virtual void RecomputeBoundingBox ()
 
- Protected Member Functions inherited from CoreModifiable
void UpdateAggregates (const Timer &timer, void *addParam)
 Internals.
 
void Export (std::vector< CoreModifiable * > &savedList, XMLNode *currentNode, bool recursive, ExportSettings *settings)
 Export. More...
 
CoreModifiableAttributeGenericCreateDynamicAttribute (CoreModifiable::ATTRIBUTE_TYPE type, KigsID ID)
 create and add dynamic attribute except arrays
 

Protected Attributes

maFloat mViewportMinX
 coordinate on x axis of the min point of the viewport
 
maFloat mViewportMinY
 coordinate on y axis of the min point of the viewport
 
maFloat mViewportSizeX
 width of the viewport
 
maFloat mViewportSizeY
 height of the viewport
 
maFloat mNearPlane
 zNear value
 
maFloat mFarPlane
 zFar value
 
maVect3DF mPosition
 position of the camera
 
maVect3DF mUpVector
 up vector of the camera
 
maVect3DF mViewVector
 direction of the camera
 
maVect4DF mClearColor
 clear color of the camera
 
maReference mRenderingScreen
 reference on the rendering screen
 
maFloat mVerticalFOV
 vertical FOV of the camera
 
maFloat mAspectRatio
 aspect ration of the camera
 
maBool mClearZBuffer
 should clear zBuffer
 
maBool mClearColorBuffer
 should clear color buffer
 
maBool mClearStencilBuffer
 should clear stencil buffer
 
maBool mCameraIsEnabled
 Disable or Enable camera.
 
maUInt mPriority
 Camera priority.
 
maFloat mBrightness
 Camera brightness, change rendering screen brightness.
 
maBool mAllVisible
 Camera all visible(no cull)
 
bool mIsActive
 TRUE when the camera is active.
 
- Protected Attributes inherited from Node3D
unsigned int mIsVisible
 valid after scene TravCull : mIsVisible store current frame index if object is visible
 
unsigned short mFirstVisibleNodeIndex
 first visible Node in ModuleSceneGraph::mVisiblesNodeList
 
unsigned short mVisibleNodeCount
 number of visible node
 
Matrix3x4 mTransform
 Local transformation matrix (father => this local coordinate system)
 
Matrix3x4 mLocalToGlobal
 Local to global transformation matrix (Local coordinate system => global "world" coordinate system)
 
Matrix3x4 mGlobalToLocal
 Global to local transformation matrix (Global "world" coordinate system => local coordinate system)
 
BBox mLocalBBox
 AABounding box in local coordinate system.
 
BBox mBBox
 AABounding box in father coordinate system.
 
BBox mGlobalBBox
 AABounding box in global "world" coordinate system.
 

Friends

class Scene3D
 

Additional Inherited Members

- Static Public Member Functions inherited from CoreModifiable
static std::vector< CMSP > GetRootInstances (const KigsID &cid, bool exactTypeOnly=false)
 static method : return the set of all root instances of the given type
 
static void Append (std::string &XMLString, const std::list< CoreModifiable * > &toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the several CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static void Export (const std::string &filename, CoreModifiable *toexport, bool recursive=false, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static XMLNodeExportToXMLNode (CoreModifiable *toexport, XML *owner_xml_file, bool recursive, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML Node. if recursive flag is set to true, export also all sons tree More...
 
static std::string ExportToXMLString (CoreModifiable *toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static void Export (std::string &XMLString, const std::list< CoreModifiable * > &toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the several CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static CMSP Import (const std::string &filename, bool noInit=false, bool keepImportFileName=false, ImportState *state=nullptr, const std::string &override_name="")
 return an new CoreModifiable instance using the description found in XML file given by name
 
static CMSP GetInstanceByGlobalPath (const std::string &path)
 static method : return the instance corresponding to the given path, and given search start
 
static void debugPrintfFullTree (int maxindent=3)
 Editor. More...
 
- Static Protected Member Functions inherited from CoreModifiable
template<typename StringType >
static CMSP Import (XMLNodeTemplate< StringType > *currentNode, CoreModifiable *currentModifiable, ImportState &importState)
 recusrive method to add sons and attributes found in the XML file
 

Detailed Description

Abstract class, special Node3D to manage a camera ( viewpoint in the scene )

reference on the rendering screen

Attributes

Key : RenderingScreen (Init attribute)

Key : AllVisible

Camera all visible(no cull)

Key : AspectRatio

aspect ration of the camera

Key : Brightness

Camera brightness, change rendering screen brightness.

Key : CameraIsEnabled

Disable or Enable camera.

Key : ClearColor

clear color of the camera

Key : ClearColorBuffer

should clear color buffer

Key : ClearStencilBuffer

should clear stencil buffer

Key : ClearZBuffer

should clear zBuffer

Key : FarPlane

zFar value

Key : NearPlane

zNear value

Key : Position

position of the camera

Key : Priority

Camera priority.

Key : TouchControlled

Key : UpVector

up vector of the camera

Key : VerticalFOV

vertical FOV of the camera

Key : ViewVector

direction of the camera

Key : ViewportMinX

coordinate on x axis of the min point of the viewport

Key : ViewportMinY

coordinate on y axis of the min point of the viewport

Key : ViewportSizeX

width of the viewport

Key : ViewportSizeY

height of the viewport

Inherited Attributes

Inherited Methods

Member Function Documentation

◆ AllVisible()

bool Camera::AllVisible ( )
inline

check if the camera is in All Visible mode

Returns
TRUE if the camera is in All Visible mode, FALSE otherwise

◆ GetPosition()

void Camera::GetPosition ( kfloat &  x,
kfloat &  y,
kfloat &  z 
)
inline

get the position of the camera

Parameters
x: position in x axis of the camera (in/out param)
y: position in y axis of the camera (in/out param)
z: position in z axis of the camera (in/out param)

◆ getRay()

void Camera::getRay ( const kfloat &  ScreenX,
const kfloat &  ScreenY,
Point3D &  RayOrigin,
Vector3D &  RayDirection 
)
virtual

get the ray from a pixel

Parameters
ScreenX: position in x axis of the pixel
ScreenY: position in y axis of the pixel
RayOrigin: origin of the ray (in/out param)
RayDirection: direction of the ray (in/out param)

Reimplemented in DX11CameraOrtho, and OpenGLCameraOrtho.

◆ GetUpVector()

void Camera::GetUpVector ( kfloat &  x,
kfloat &  y,
kfloat &  z 
)
inline

get the up vector

Parameters
x: position in x axis of the up vector (in/out param)
y: position in y axis of the up vector (in/out param)
z: position in z axis of the up vector (in/out param)

◆ GetViewVector()

void Camera::GetViewVector ( kfloat &  x,
kfloat &  y,
kfloat &  z 
)
inline

get the view factor

Parameters
x: position in x axis of the view factor (in/out param)
y: position in y axis of the view factor (in/out param)
z: position in z axis of the view factor (in/out param)

◆ InitCullingObject()

void Camera::InitCullingObject ( CullingObject mObj)
virtual

initialize the culling on an object

Parameters
mObj: object to cull

Reimplemented in DX11CameraOrtho, and OpenGLCameraOrtho.

◆ InitModifiable()

void Camera::InitModifiable ( )
overrideprotectedvirtual

initialize modifiable

notification on matrix change

Reimplemented from CoreModifiable.

◆ IsActive()

bool Camera::IsActive ( )
inline

check if the camera is active

Returns
TRUE if the camera is active, FALSE otherwise

◆ ProtectedDestroy()

void Camera::ProtectedDestroy ( )
overrideprotectedvirtual

Destroy method decrement refcounter and delete instance if no more used.

remove all items

Reimplemented from CoreModifiable.

◆ ProtectedSetActive()

bool Camera::ProtectedSetActive ( TravState state)
protectedpure virtual

enable the camera protection

Returns
true

Implemented in DX11CameraOrtho, DX11Camera, OpenGLCamera, and OpenGLCameraOrtho.

◆ SetActive()

bool Camera::SetActive ( TravState state)

return true if camera was activated else do not render camera

Returns
TRUE if the camera is active, FALSE otherwise

◆ SetClearColor()

void Camera::SetClearColor ( kfloat  r,
kfloat  g,
kfloat  b,
kfloat  a = 1.0f 
)
inline

set the clear color

Parameters
r: red color
g: green color
b: blue color

◆ SetNearAndFar()

void Camera::SetNearAndFar ( kfloat  znear,
kfloat  zfar 
)
inline

set the zNear and zFar values

Parameters
znear: zNear value
zfar: zFar value

◆ SetPosition()

void Camera::SetPosition ( kfloat  x,
kfloat  y,
kfloat  z 
)
inline

set the position of the camera

Parameters
x: position in x axis of the camera
y: position in y axis of the camera
z: position in z axis of the camera

◆ SetUpVector()

void Camera::SetUpVector ( kfloat  x,
kfloat  y,
kfloat  z 
)
inline

set the position of the up vector

Parameters
x: position in x axis of the up vector
y: position in y axis of the up vector
z: position in z axis of the up vector

◆ SetViewport()

void Camera::SetViewport ( kfloat  vpminx,
kfloat  vpminy,
kfloat  vpsx,
kfloat  vpsy 
)
inline

set the viewport

Parameters
vpminx: position in x axis of the viewport
vpminy: position in y axis of the viewport
vpsx: width of the viewport
vpsy: height of the viewport

◆ SetViewVector()

void Camera::SetViewVector ( kfloat  x,
kfloat  y,
kfloat  z 
)
inline

set the view factor

Parameters
x: position in x axis of the view factor
y: position in y axis of the view factor
z: position in z axis of the view factor

◆ UninitModifiable()

void Camera::UninitModifiable ( )
overrideprotectedvirtual

called when InitModifiable has failled : reset read/write flag on all init params

not init ? return

Reimplemented from CoreModifiable.


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