#include <orthocameracomponent.h>
Public Member Functions | |
OrthoCameraComponentInstance (EntityInstance &entity, Component &resource) | |
virtual bool | init (utility::ErrorState &errorState) override |
virtual void | setRenderTargetSize (const glm::ivec2 &size) override |
virtual const glm::mat4 & | getProjectionMatrix () const override |
virtual const glm::mat4 | getViewMatrix () const override |
const OrthoCameraProperties & | getProperties () |
void | setProperties (const OrthoCameraProperties &properties) |
void | setMode (EOrthoCameraMode mode) |
void | setClipRect (const math::Rect &clipRect) |
void | restoreClipRect () |
virtual const glm::mat4 & | getRenderProjectionMatrix () const override |
![]() | |
CameraComponentInstance (EntityInstance &entity, Component &resource) | |
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 |
![]() | |
ComponentInstance (EntityInstance &entity, Component &resource) | |
virtual void | update (double deltaTime) |
nap::EntityInstance * | getEntityInstance () const |
nap::Component * | getComponent () const |
template<typename T > | |
T * | getComponent () const |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Static Public Member Functions | |
static glm::mat4 | createRenderProjectionMatrix (float left, float right, float bottom, float top, float zNear, float zFar) |
static glm::mat4 | createRenderProjectionMatrix (float left, float right, float bottom, float top) |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Additional Inherited Members | |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
An orthographic camera. The space that the camera is operating depends on the mode that is set. By default this camera operates in pixel space. Use setMode to change the space that the camera is operating in. The transform to calculate the view matrix is retrieved from the transform component.
OrthoCameraComponentInstance | ( | EntityInstance & | entity, |
Component & | resource | ||
) |
|
static |
Creates a Vulkan compatible orthographic projection matrix without having to specify near and far coordinates. Use this matrix, instead of glm::ortho(), when drawing geometry and an ortographic projection matrix is required as shader input. For all regular (CPU) related orthographic calculations, use glm::ortho().
|
static |
Creates a Vulkan compatible orthographic projection matrix, use this matrix instead of glm::ortho when interfacing with the renderer. Use this matrix, instead of glm::ortho(), when drawing geometry and an ortographic projection matrix is required as shader input. For all regular (CPU) related orthographic calculations, use glm::ortho().
|
overridevirtual |
Returns the matrix that is used to transform a 3d scene into a 2d projection. Use this matrix for all regular CPU side projection calculations. Use the matrix returned by getRenderProjectionMatrix() as shader input only.
Implements CameraComponentInstance.
const OrthoCameraProperties& getProperties | ( | ) |
|
overridevirtual |
Returns the matrix that is used to transform a 3d scene in to a 2d projection by the renderer. Vulkan uses a coordinate system where (-1, -1) is in the top left quadrant, instead of the bottom left quadrant. Use this matrix, instead of the one returned by getProjectionMatrix(), when an ortographic projection matrix is required as shader input. For all regular (CPU) related orthographic calculations, use getProjectionMatrix().
Implements CameraComponentInstance.
|
overridevirtual |
Implements CameraComponentInstance.
|
overridevirtual |
Initialize this component from its resource
errorState | contains the error if initialization fails. |
Reimplemented from ComponentInstance.
void restoreClipRect | ( | ) |
Restores the clip rectangle to a unit rectangle, disabling clipping
void setClipRect | ( | const math::Rect & | clipRect | ) |
Sets the normalized clip rectangle used to clip/crop the camera view
clipRect | The clip rectangle. |
void setMode | ( | EOrthoCameraMode | mode | ) |
Sets the mode (the physical space) in which the orthographic camera is operating.
mode | The view mode to operate in. |
void setProperties | ( | const OrthoCameraProperties & | properties | ) |
Sets the orthographic camera properties.
properties | The new camera properties |
|
overridevirtual |
This implementation extracts the size in pixels of the render target to make sure that the orthographic camera acts in pixel coordinates.
size | The size of the render target in pixel coordinates. |
Reimplemented from CameraComponentInstance.