#include <perspcameracomponent.h>
Public Member Functions | |
PerspCameraComponentInstance (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 |
void | setGridDimensions (int numRows, int numColumns) |
void | setGridLocation (int row, int column) |
void | setFieldOfView (float fov) |
float | getFieldOfView () const |
float | getNearClippingPlane () const |
float | getFarClippingPlane () const |
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 |
Protected Attributes | |
glm::mat4x4 | mProjectionMatrix |
glm::mat4x4 | mRenderProjectionMatrix |
bool | mDirty = true |
PerpCameraProperties | mProperties |
TransformComponentInstance * | mTransformComponent |
bool | mPerpendicularRenderProjection = true |
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... | |
Implementation of the perspective camera. The view matrix is calculated using the transform attached to the entity.
PerspCameraComponentInstance | ( | EntityInstance & | entity, |
Component & | resource | ||
) |
float getFarClippingPlane | ( | ) | const |
float getFieldOfView | ( | ) | const |
float getNearClippingPlane | ( | ) | const |
|
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.
|
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 |
Checks whether a transform component is available.
errorState | contains the error if the camera can't be initialized properly. |
Reimplemented from ComponentInstance.
void setFieldOfView | ( | float | fov | ) |
Sets the fov parameter
fov | the new field of view |
void setGridDimensions | ( | int | numRows, |
int | numColumns | ||
) |
Use this function to split the projection into a regular grid. This can be used to render to multiple screens with a single camera. Use setGridLocation to set the horizontal and vertical index into this grid.
numRows | the number of cells in the horizontal |
numColumns | the number of cells in the vertical direction. |
void setGridLocation | ( | int | row, |
int | column | ||
) |
Sets the horizontal and vertical index into the projection grid as set by setGridDimensions.
|
overridevirtual |
Extracts the size in pixels of the render target. The dimensions are used to calculate the correct projection matrix.
size | The size of the render target in pixel coordinates. |
Reimplemented from CameraComponentInstance.
|
mutableprotected |
|
protected |
|
mutableprotected |
|
protected |
|
mutableprotected |
|
protected |