i6engine  1.0
i6e::api::CameraComponent Class Reference

Attaches a camera to an object. The Camera will follow the object For creating a CameraComponent, these keys are possible:

Name Required Type Description Public
pos yes Vec3 relative position of camera to SceneNode yes
lookAt yes Vec3 absolute look at position in the world yes
nearclip yes double near clipping distance yes
aspect no double aspect ration of the camera yes
viewport no bool defines whether this camera has a viewport or not yes
zOrder *) int relative position on the screen depending on other viewports (has to be unique), *) required when viewport true yes
vp_left *) double left startpoint of the viewport, value between 0 and 1, *) required when viewport true yes
vp_top *) double uppper startpoint of the viewport, value between 0 and 1, *) required when viewport true yes
vp_width *) double width of the viewport, value between 0 and 1, *) required when viewport true yes
vp_height *) double height of the viewport, value between 0 and 1, *) required when viewport true yes
vp_red *) double red part of the viewports background colour, *) required when viewport true yes
vp_green *) double green part of the viewports background colour, *) required when viewport true yes
vp_blue *) double blue part of the viewports background colour, *) required when viewport true yes
vp_alpha *) double alpha part of the viewports background colour, *) required when viewport true yes
More...

#include <D:/Projekte/i6engine/libs/i6engine-modules/include/i6engine/api/components/CameraComponent.h>

Public Member Functions

 CameraComponent (const int64_t id, const attributeMap &params)
 Constructor with attribute map. More...
 
virtual ~CameraComponent ()
 Destructor. More...
 
void setPosition (const Vec3 &relativePosition)
 Sets position of the camera Sets position of the component relative to its parent GameObject. More...
 
void setLookAt (const Vec3 &lookAt)
 Sets lookAt position of the camera Sets position of the component. Just like in the Init() function, this point should be in absolute world coordinates, but the viewing vector will update itself on moving the GameObject. More...
 
void setNearClip (const int32_t n)
 Sets nearClipDistance of the camera Sets nearClipDistance of the camera. Objects closer to the camera than this distance will not be rendered. More...
 
void setAspectRatio (const double ratio)
 Sets aspect Ratio Sets aspect Ratio. This ratio specifies the ratio between width and height of the camera. More...
 
void setFOVy (const double fov)
 Sets the vertical Field of View This parameter specifies the opening angle of the viewing frustrum along the y-axis. More...
 
void setFrustumExtends (const double left, const double right, const double top, const double bottom)
 Sets the extends of the Frustum. More...
 
void setViewportDimension (const double left, const double top, const double width, const double height)
 sets the dimensions for the viewport used to display this camera all values are relative and between 0 and 1 e.g. to use only the upper right quarter of the render window, use values (0.5, 0, 0.5, 0.5) More...
 
void setViewportBackground (const double red, const double green, const double blue, const double alpha)
 sets the backgroundcolor of the viewport More...
 
Vec3 getPosition () const
 returns the relative position of the camera on the GameObject More...
 
Vec3 getLookAt () const
 returns the position of the lookAt in world space! More...
 
attributeMap synchronize () const override
 synchronizes the Components state More...
 
std::string getTemplateName () const override
 returns the name this template was registered with More...
 
std::vector< componentOptionsgetComponentOptions () override
 returns a vector containing all options of the Component being readable and writeable in the editor More...
 
void enableCompositor (const std::string &compositor, bool enabled)
 enables or disables a compositor More...
 
virtual std::pair< AddStrategy, int64_t > howToAdd (const ComPtr &comp) const override
 asks, how to handle a new component with the same type More...
 
- Public Member Functions inherited from i6e::api::Component
 Component ()
 Constructor for Component. More...
 
 Component (const int64_t id, const attributeMap &params)
 Constructor for Component. More...
 
virtual ~Component ()
 Destructor of Component. Must be implemented in derived class. More...
 
void setOwnerGO (const WeakGOPtr &objGo)
 Sets the GameObject that owns this Component. More...
 
GOPtr getOwnerGO ()
 Get the GameObject that owns this Component. More...
 
uint32_t getComponentID () const
 Returns the component identification string. More...
 
uint32_t getFamilyID () const
 Returns the family identification string. More...
 
std::string getIdentifier () const
 Returns the family identification string. More...
 
virtual void Tick ()
 Components can have Tick method like normal Subsystems this method is called by the ObjectController during every Tick if the component registered itself at the ObjectFacade. More...
 
void setDie () const
 component will be deleted soon More...
 
int64_t getID () const
 returns the id of the component More...
 
virtual void News (const GameMessage::Ptr &msg)
 Receives messages for this component override this function, if you expect messages. More...
 
virtual void Finalize ()
 finalizes the component More...
 
void setSync (bool b)
 sets whether this object has to be synchronized or not More...
 
bool getSync () const
 
void enableTicking (bool allowTicking) const
 triggers doEnableTicking threadsafe More...
 
void setSelf (const WeakComPtr &self)
 sets weak_ptr on self for registration of ticker More...
 
std::vector< ComPtrgetSubComponents () const
 returns all SubComponents attached to this Component More...
 

Protected Member Functions

void Init () override
 initializes the component More...
 
void sendCameraUpdateMessage ()
 Sends message to MessagingController. More...
 
void sendViewportUpdateMessage ()
 sends an update message containing the new viewport values More...
 
void sendFrustumUpdateMessage ()
 Sends a message to update the frustum extends. More...
 
- Protected Member Functions inherited from i6e::api::Component
void addTicker ()
 adds this component to ticklist More...
 
void removeTicker ()
 removes this component from ticklist More...
 
void doEnableTicking (bool allowTicking)
 sets ticking status for this Component per default all Components are allowed to tick and calling addTicker will start ticking, but in some cases, e.g. for level editor, ticking has to be disabled and just a few components are allowed to tick More...
 

Protected Attributes

Vec3 _position
 Position of the camera. More...
 
Vec3 _lookAt
 Point the Camera looks at. More...
 
int32_t _nearClip
 nearClippingDistance More...
 
double _aspect
 
int _zOrder
 
bool _viewport
 
double _left
 
double _top
 
double _width
 
double _height
 
double _red
 
double _green
 
double _blue
 
double _alpha
 
double _fov
 
double _frustumLeft
 
double _frustumRight
 
double _frustumTop
 
double _frustumBottom
 
- Protected Attributes inherited from i6e::api::Component
int64_t _objOwnerID
 ID of the GameObject that owns this Component. More...
 
WeakGOPtr _objOwnerGO
 Owning GameObject. More...
 
uint32_t _objComponentID
 Component ID of the Component. More...
 
uint32_t _objFamilyID
 Family ID of the Component. More...
 
std::vector< ComPtr_subComps
 vector containing the other componetns of the same type if this is the dispatcher component More...
 
std::string _identifier
 identifies the subcomponent More...
 
int64_t _id
 id of this component More...
 
bool _sync
 
WeakComPtr _self
 a weak_ptr on the own shared_ptr More...
 
bool _tickingAllowed
 status if this object is allowed to tick or not More...
 
bool _wantsToTick
 stores if a Component which isn't allowed to tick want to tick, so it can start ticking when ticking will be allowed More...
 
bool _isTicking
 stores whether this Component is actually ticking More...
 

Additional Inherited Members

- Static Public Member Functions inherited from i6e::api::Component
template<typename T >
static ComPtr createC (const int64_t id, const attributeMap &params)
 

Detailed Description

Attaches a camera to an object. The Camera will follow the object For creating a CameraComponent, these keys are possible:

Name Required Type Description Public
pos yes Vec3 relative position of camera to SceneNode yes
lookAt yes Vec3 absolute look at position in the world yes
nearclip yes double near clipping distance yes
aspect no double aspect ration of the camera yes
viewport no bool defines whether this camera has a viewport or not yes
zOrder *) int relative position on the screen depending on other viewports (has to be unique), *) required when viewport true yes
vp_left *) double left startpoint of the viewport, value between 0 and 1, *) required when viewport true yes
vp_top *) double uppper startpoint of the viewport, value between 0 and 1, *) required when viewport true yes
vp_width *) double width of the viewport, value between 0 and 1, *) required when viewport true yes
vp_height *) double height of the viewport, value between 0 and 1, *) required when viewport true yes
vp_red *) double red part of the viewports background colour, *) required when viewport true yes
vp_green *) double green part of the viewports background colour, *) required when viewport true yes
vp_blue *) double blue part of the viewports background colour, *) required when viewport true yes
vp_alpha *) double alpha part of the viewports background colour, *) required when viewport true yes

Definition at line 55 of file api/components/CameraComponent.h.

Constructor & Destructor Documentation

i6e::api::CameraComponent::CameraComponent ( const int64_t  id,
const attributeMap params 
)

Constructor with attribute map.

virtual i6e::api::CameraComponent::~CameraComponent ( )
virtual

Destructor.

Member Function Documentation

void i6e::api::CameraComponent::enableCompositor ( const std::string &  compositor,
bool  enabled 
)

enables or disables a compositor

std::vector<componentOptions> i6e::api::CameraComponent::getComponentOptions ( )
overridevirtual

returns a vector containing all options of the Component being readable and writeable in the editor

Implements i6e::api::Component.

Vec3 i6e::api::CameraComponent::getLookAt ( ) const
inline

returns the position of the lookAt in world space!

Definition at line 131 of file api/components/CameraComponent.h.

Vec3 i6e::api::CameraComponent::getPosition ( ) const
inline

returns the relative position of the camera on the GameObject

Definition at line 124 of file api/components/CameraComponent.h.

std::string i6e::api::CameraComponent::getTemplateName ( ) const
inlineoverridevirtual

returns the name this template was registered with

Implements i6e::api::Component.

Reimplemented in i6e::api::MovingCameraComponent.

Definition at line 140 of file api/components/CameraComponent.h.

virtual std::pair<AddStrategy, int64_t> i6e::api::CameraComponent::howToAdd ( const ComPtr comp) const
overridevirtual

asks, how to handle a new component with the same type

Parameters
[in]compcomponent that shall be added
Returns
pair containing the strategy to use as well as an additional value

Reimplemented from i6e::api::Component.

void i6e::api::CameraComponent::Init ( )
overrideprotectedvirtual

initializes the component

Implements i6e::api::Component.

void i6e::api::CameraComponent::sendCameraUpdateMessage ( )
protected

Sends message to MessagingController.

Sends message to MessagingController containing ObjectID, component and position

void i6e::api::CameraComponent::sendFrustumUpdateMessage ( )
protected

Sends a message to update the frustum extends.

void i6e::api::CameraComponent::sendViewportUpdateMessage ( )
protected

sends an update message containing the new viewport values

void i6e::api::CameraComponent::setAspectRatio ( const double  ratio)

Sets aspect Ratio Sets aspect Ratio. This ratio specifies the ratio between width and height of the camera.

Parameters
[in]newratio
void i6e::api::CameraComponent::setFOVy ( const double  fov)

Sets the vertical Field of View This parameter specifies the opening angle of the viewing frustrum along the y-axis.

Parameters
[in]fovnew Field of View in difference to all other angles, this is in degrees, not radians
void i6e::api::CameraComponent::setFrustumExtends ( const double  left,
const double  right,
const double  top,
const double  bottom 
)

Sets the extends of the Frustum.

void i6e::api::CameraComponent::setLookAt ( const Vec3 lookAt)

Sets lookAt position of the camera Sets position of the component. Just like in the Init() function, this point should be in absolute world coordinates, but the viewing vector will update itself on moving the GameObject.

Parameters
[in]lookAtPosition of the camera
void i6e::api::CameraComponent::setNearClip ( const int32_t  n)

Sets nearClipDistance of the camera Sets nearClipDistance of the camera. Objects closer to the camera than this distance will not be rendered.

Parameters
[in]newnearClipDistance
void i6e::api::CameraComponent::setPosition ( const Vec3 relativePosition)

Sets position of the camera Sets position of the component relative to its parent GameObject.

Parameters
[in]relativePositionNew Position of the camera
void i6e::api::CameraComponent::setViewportBackground ( const double  red,
const double  green,
const double  blue,
const double  alpha 
)

sets the backgroundcolor of the viewport

void i6e::api::CameraComponent::setViewportDimension ( const double  left,
const double  top,
const double  width,
const double  height 
)

sets the dimensions for the viewport used to display this camera all values are relative and between 0 and 1 e.g. to use only the upper right quarter of the render window, use values (0.5, 0, 0.5, 0.5)

attributeMap i6e::api::CameraComponent::synchronize ( ) const
overridevirtual

synchronizes the Components state

Implements i6e::api::Component.

Member Data Documentation

double i6e::api::CameraComponent::_alpha
protected

Definition at line 186 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_aspect
protected

aspect Ration, Ogre-default: 4 : 3 Width / Height

Definition at line 173 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_blue
protected

Definition at line 185 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_fov
protected

Definition at line 187 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_frustumBottom
protected

Definition at line 191 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_frustumLeft
protected

Definition at line 188 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_frustumRight
protected

Definition at line 189 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_frustumTop
protected

Definition at line 190 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_green
protected

Definition at line 184 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_height
protected

Definition at line 182 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_left
protected

Definition at line 179 of file api/components/CameraComponent.h.

Vec3 i6e::api::CameraComponent::_lookAt
protected

Point the Camera looks at.

Definition at line 162 of file api/components/CameraComponent.h.

int32_t i6e::api::CameraComponent::_nearClip
protected

nearClippingDistance

Definition at line 167 of file api/components/CameraComponent.h.

Vec3 i6e::api::CameraComponent::_position
protected

Position of the camera.

Definition at line 157 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_red
protected

Definition at line 183 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_top
protected

Definition at line 180 of file api/components/CameraComponent.h.

bool i6e::api::CameraComponent::_viewport
protected

Definition at line 177 of file api/components/CameraComponent.h.

double i6e::api::CameraComponent::_width
protected

Definition at line 181 of file api/components/CameraComponent.h.

int i6e::api::CameraComponent::_zOrder
protected

Definition at line 175 of file api/components/CameraComponent.h.


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