GUInity
Public Member Functions | List of all members
Camera Class Reference

#include <Camera.hpp>

Inheritance diagram for Camera:
Component Subject< Camera >

Public Member Functions

 Camera ()
 
 Camera (float nearClipPlane, float farClipPlane, float fov, float ratio)
 
virtual ~Camera ()
 
void computeModelViewMatrix ()
 
glm::mat4 getModelMatrix ()
 
glm::mat4 getMVPMatrix ()
 
glm::mat4 getProjectionMatrix ()
 
glm::mat4 getViewMatrix ()
 
float getNearClip ()
 
float getFarClip ()
 
float getFOV ()
 
float getScreenRatio ()
 
glm::vec3 screenPointToWorld (glm::vec2 pos)
 
Ray screenPointToRay (glm::vec2 pos)
 
Ray screenPointToRay2 (glm::vec2 pos)
 
virtual void init () override
 
virtual void destroy () override
 
virtual void awake () override
 
virtual void tick (float deltaSecods) override
 
virtual shared_ptr< Componentclone () override
 
virtual shared_ptr< ComponentDescriptiongetComponentDescription () override
 
virtual void deserialize (shared_ptr< ComponentDescription > desc) override
 
- Public Member Functions inherited from Component
 Component ()
 
virtual ~Component ()
 
virtual void setActive (bool isActive)
 
shared_ptr< ActorgetActor ()
 
void setActor (weak_ptr< Actor > actor)
 

Additional Inherited Members

- Static Public Member Functions inherited from Subject< Camera >
static void addObserver (shared_ptr< Observer > observer)
 
static void removeObserver (shared_ptr< Observer > observer)
 
- Protected Member Functions inherited from Component
void setCopyMode (bool initWithData)
 
- Static Protected Member Functions inherited from Subject< Camera >
static void notify (ComponentEventType type, shared_ptr< Component > component, bool isEditor)
 
static void notify (ActorEventType type, shared_ptr< Actor > actor, bool isEditor)
 
- Protected Attributes inherited from Component
bool initWithData
 
bool isActive
 

Detailed Description

Camera Component. This component simulates a camera in a 3D environment. It's the point of view used for rendering the Actors of the World

Constructor & Destructor Documentation

Camera::Camera ( )

Default Constructor

Camera::Camera ( float  nearClipPlane,
float  farClipPlane,
float  fov,
float  ratio 
)

Constructor with custom parameters near clip plane, far clip plane, field of vision and screen ratio.

Camera::~Camera ( )
virtual

Default Destructor. Virtual because inherits Component

Member Function Documentation

void Camera::awake ( )
overridevirtual

Component awake override. Computes MVPMatrix

Reimplemented from Component.

shared_ptr< Component > Camera::clone ( )
overridevirtual

Clones current component (Prototype Design Pattern)

Returns
shared_ptr to cloned Camera Component

Implements Component.

void Camera::computeModelViewMatrix ( )

Computes the current Model View Matrix and puts it into MVPMatrix

Computes the current Model View Matrix

void Camera::destroy ( )
overridevirtual

Component destroy override. Notifies that the camera has been destroyed

Reimplemented from Component.

float Camera::getFarClip ( )

far clip Getter

float Camera::getFOV ( )

fov Getter

glm::mat4 Camera::getModelMatrix ( )

Returns Model Matrix without the scale factor

glm::mat4 Camera::getMVPMatrix ( )

MVPMatrix Getter

float Camera::getNearClip ( )

near clip Getter

glm::mat4 Camera::getProjectionMatrix ( )

projection Matrix Getter

float Camera::getScreenRatio ( )

screen ratio Getter

glm::mat4 Camera::getViewMatrix ( )

view Matrix Getter

void Camera::init ( )
overridevirtual

Component init override. Notifies that a new camera has been created

Reimplemented from Component.

Ray Camera::screenPointToRay ( glm::vec2  pos)

Transforms a screen point to Ray. Commonly used for transforming mouse position into a Ray

Ray Camera::screenPointToRay2 ( glm::vec2  pos)

Transforms a screen point to Ray. Commonly used for transforming mouse position into a Ray

glm::vec3 Camera::screenPointToWorld ( glm::vec2  pos)

Transforms a screen point to a world point. Commonly used for transforming mouse position into world points

void Camera::tick ( float  deltaSecods)
overridevirtual

Component tick override. Computes MVPMatrix

Reimplemented from Component.


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