#include <cameracomponent.h>
Public Member Functions | |
CameraComponentInstance (EntityInstance &entity, Component &resource) | |
virtual const glm::mat4 & | getProjectionMatrix () const =0 |
virtual const glm::mat4 | getViewMatrix () const =0 |
virtual void | setRenderTargetSize (const glm::ivec2 &size) |
glm::vec3 | screenToWorld (const glm::vec3 &screenPos, const math::Rect &viewport) |
glm::vec3 | worldToScreen (const glm::vec3 &worldPos, const math::Rect &viewport) |
glm::vec3 | rayFromScreen (const glm::vec2 &screenPos, const math::Rect &viewport) |
const glm::ivec2 & | getRenderTargetSize () const |
virtual const glm::mat4 & | getRenderProjectionMatrix () const =0 |
![]() | |
ComponentInstance (EntityInstance &entity, Component &resource) | |
virtual void | update (double deltaTime) |
nap::EntityInstance * | getEntityInstance () const |
nap::Component * | getComponent () const |
template<typename T > | |
T * | getComponent () const |
virtual bool | init (utility::ErrorState &errorState) |
virtual bool | init (utility::ErrorState &errorState) |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Base class for perspective and orthographic cameras.
CameraComponentInstance | ( | EntityInstance & | entity, |
Component & | resource | ||
) |
|
pure virtual |
Returns the matrix that is used to transform a 3d scene in to a 2d projection.
Implemented in OrthoCameraComponentInstance, and PerspCameraComponentInstance.
|
pure virtual |
Returns the matrix that is used to transform a 3d scene in to a 2d projection by the renderer. This can be different from the default if the renderer uses a different coordinate system. Use this matrix to transform a 3d scene in to a 2d projection.
Implemented in OrthoCameraComponentInstance, and PerspCameraComponentInstance.
const glm::ivec2& getRenderTargetSize | ( | ) | const |
|
pure virtual |
Returns the world space position and rotation of the camera in 3D space.
Implemented in OrthoCameraComponentInstance, and PerspCameraComponentInstance.
glm::vec3 rayFromScreen | ( | const glm::vec2 & | screenPos, |
const math::Rect & | viewport | ||
) |
Computes a ray directed outwards from the camera based on a screen space position. The ray is normalized.
screenPos | horizontal and vertical screen coordinates: where 0, 0 is the lower left corner |
viewport | rectangle that defines the viewport |
glm::vec3 screenToWorld | ( | const glm::vec3 & | screenPos, |
const math::Rect & | viewport | ||
) |
Maps a pixel coordinate to a world space coordinate using the camera project and view matrix The z component is generally acquired by sampling the window depth buffer. When screenPos.z has a value of 0 the result is relative to this camera, ie: the return value is the location of this camera in the world.
screenPos | window coordinates, where 0,0 is the lower left corner |
viewport | rectangle that defines the viewport |
|
virtual |
This is used by derived classes for extracting information like aspect ratio or the the size of the screen, in case of orthographic camera's (where pixels coordinates can be used).
size | size of the render target in pixels. |
Reimplemented in OrthoCameraComponentInstance, and PerspCameraComponentInstance.
glm::vec3 worldToScreen | ( | const glm::vec3 & | worldPos, |
const math::Rect & | viewport | ||
) |
Maps a world space coordinate to a screen space coordinate using the camera projection and view matrix
worldPos | the point position in world space |
viewport | rectangle that defines the viewport |