Ocular Engine
|
Public Member Functions | |
Camera (std::string const &name, SceneObject *parent=nullptr) | |
void | setRenderTexture (Graphics::RenderTexture *renderTexture) |
Graphics::RenderTexture * | getRenderTexture () |
void | setDepthTexture (Graphics::DepthTexture *depthTexture) |
Graphics::DepthTexture * | getDepthTexture () |
ProjectionType | getProjectionType () const |
PerspectiveProjection | getPerspectiveProjection () const |
OrthographicProjection | getOrthographicProjection () const |
void | setProjectionOrthographic (float xMin, float xMax, float yMin, float yMax, float nearClip, float farClip) |
void | setProjectionOrthographic (OrthographicProjection const &projection) |
void | setProjectionPerspective (float fov, float aspectRatio, float nearClip, float farClip) |
void | setProjectionPerspective (PerspectiveProjection const &projection) |
void | setProjectionMatrix (Math::Matrix4x4 const &matrix) |
Math::Matrix4x4 const & | getViewMatrix () |
Math::Matrix4x4 const & | getProjectionMatrix () const |
Math::Frustum const & | getFrustum (bool updateFrustum=true) |
void | setPriority (Priority priority) |
Priority | getPriority () const |
void | setViewport (float x, float y, float width, float height, float minDepth=0.0f, float maxDepth=1.0f, bool updateMatrix=true) |
Graphics::Viewport * | getViewport () const |
void | setFixedViewport (bool fixed) |
bool | getIsFixedViewport () const |
void | setFixedProjection (bool fixed) |
bool | getIsFixedProjection () const |
void | setClearColor (Core::Color const &color) |
Color const & | getClearColor () const |
Math::Vector3f | screenToWorld (Math::Vector2i const &screenPos) |
Math::Vector2i | worldToScreen (Math::Vector3f const &worldPos) |
Math::Ray | getPickRay (Math::Vector2i const &screenPos) |
virtual bool | onEvent (std::shared_ptr< AEvent > event) override |
Public Member Functions inherited from Ocular::Core::SceneObject | |
SceneObject (std::string const &name, SceneObject *parent=nullptr, std::string const &type="SceneObject") | |
SceneObject () | |
virtual | ~SceneObject () |
virtual void | onVariableModified (std::string const &varName) override |
Math::Transform & | getTransform () |
void | setActive (bool active) |
bool | isActive () const |
void | setVisible (bool visible) |
bool | isVisible () const |
void | setForcedVisible (bool forced) |
bool | isForcedVisible () const |
void | setStatic (bool isStatic) |
bool | isStatic () const |
void | setPersistent (bool persists) |
bool | isPersistent () const |
Graphics::UniformPerObject const & | getUniformData (Math::Matrix4x4 const &viewMatrix, Math::Matrix4x4 const &projMatrix) |
void | setPosition (float x, float y, float z) |
void | setPosition (Math::Vector3f const &position) |
Math::Vector3f | getPosition (bool local=true) const |
void | translate (Math::Vector3f const &translation, bool local=true) |
void | rotate (float angle, Math::Vector3f const &axis) |
void | rotate (Math::Quaternion const &rotation) |
void | setRotation (Math::Quaternion const &rotation) |
void | resetRotation () |
Math::Quaternion const & | getRotation () const |
void | setScale (Math::Vector3f const &scale) |
void | setScale (float xScale, float yScale, float zScale) |
Math::Vector3f | getScale (bool local=true) const |
void | setTransform (Math::Transform const &transform) |
void | lookAt (Math::Vector3f const &point) |
Math::Transform const & | getTransform () const |
virtual Math::Matrix4x4 | getModelMatrix (bool local=true) const |
void | setParent (SceneObject *parent, bool maintainWorldPos=true) |
SceneObject * | getParent () const |
SceneObject * | createChild (std::string const &name) |
void | addChild (SceneObject *child, bool maintainWorldPos=true) |
SceneObject * | findChild (std::string const &name) |
SceneObject * | findChild (UUID const &uuid) |
SceneObject * | removeChild (std::string const &name) |
SceneObject * | removeChild (UUID const &uuid) |
SceneObject * | removeChild (SceneObject const *object) |
uint32_t | getNumChildren () const |
std::vector< SceneObject * > const & | getAllChildren () const |
ARoutine * | addRoutine (std::string const &name) |
void | addRoutine (ARoutine *routine) |
template<class T > | |
T * | addRoutine () |
bool | removeRoutine (std::string const &name) |
bool | removeRoutine (ARoutine *routine, bool transferring=false) |
void | removeAllRoutines () |
ARoutine * | getRoutine (std::string const &name) |
std::vector< ARoutine * > const & | getAllRoutines () const |
uint32_t | getNumRoutines () const |
ARenderable * | setRenderable (std::string const &name) |
void | setRenderable (ARenderable *renderable) |
template<class T > | |
T * | setRenderable () |
void | removeRenderable (bool transferring=false) |
ARenderable * | getRenderable () const |
virtual void | onLoad (BuilderNode const *node) override |
virtual void | onSave (BuilderNode *node) const override |
void | forceBoundsRebuild () |
Math::BoundsSphere | getBoundsSphere (bool local) |
Math::BoundsAABB | getBoundsAABB (bool local) |
Math::BoundsOBB | getBoundsOBB (bool local) |
Public Member Functions inherited from Ocular::Core::Object | |
Object (std::string name, std::string className) | |
Creates a new Object with the specified name and class. More... | |
Object (std::string name) | |
Creates a new Object with the specified name. More... | |
Object () | |
Creates a new Object with the default name ('Name'). | |
std::string const & | getName () const |
void | setName (std::string name) |
Sets the name of the Object. More... | |
std::string const & | getClass () const |
void | setUUID (std::string const &uuid) |
UUID const & | getUUID () const |
int64_t | getCreationTime () const |
virtual std::string | toString () const |
template<class T > | |
bool | isType () |
Public Member Functions inherited from Ocular::Core::Exposable | |
void | getAllExposedNames (std::vector< std::string > &names) const |
bool | getVariable (std::string const &name, ExposedVariable &var) |
template<typename T > | |
bool | getVariableValue (std::string const &name, T &var) |
template<typename T > | |
bool | setVariableValue (std::string const &name, T const &value) |
Protected Member Functions | |
void | onCreation () |
void | exposeVariables () |
void | updateViewport (float width, float height) |
Protected Member Functions inherited from Ocular::Core::SceneObject | |
void | getModelMatrix (Math::Matrix4x4 &matrix) |
virtual void | updateBounds (uint32_t dirtyFlags) |
Protected Member Functions inherited from Ocular::Core::Exposable | |
void | exposeVariable (std::string const &name, std::string const &type, bool isPointer, bool isExposed, void *data) |
Protected Attributes | |
ProjectionType | m_ProjType |
PerspectiveProjection | m_PerspectiveProj |
OrthographicProjection | m_OrthographicProj |
Math::Matrix4x4 | m_ViewMatrix |
Math::Matrix4x4 | m_ProjMatrix |
Math::Frustum | m_Frustum |
Graphics::RenderTexture * | m_RenderTexture |
Graphics::DepthTexture * | m_DepthTexture |
Graphics::Viewport * | m_Viewport |
Core::Color | m_ClearColor |
Priority | m_Priority |
bool | m_IsFixedViewport |
bool | m_IsFixedProjection |
bool | m_IsFrustumDirty |
Protected Attributes inherited from Ocular::Core::SceneObject | |
SceneObject * | m_Parent |
uint32_t | m_Layer |
The render layer this object is part of. | |
Graphics::UniformPerObject | m_UniformData |
Math::Transform | m_Transform |
Math::BoundsSphere | m_BoundsSphereLocal |
Math::BoundsAABB | m_BoundsAABBLocal |
Math::BoundsOBB | m_BoundsOBBLocal |
Math::BoundsSphere | m_BoundsSphereWorld |
Math::BoundsAABB | m_BoundsAABBWorld |
Math::BoundsOBB | m_BoundsOBBWorld |
Protected Attributes inherited from Ocular::Core::Object | |
std::string | m_Name |
std::string | m_Class |
UUID | m_UUID |
const int64_t | m_CreationTime |
Protected Attributes inherited from Ocular::Core::Exposable | |
std::unordered_map< std::string, ExposedVariable > | m_ExposedVariables |
Ocular::Core::Camera::Camera | ( | std::string const & | name, |
SceneObject * | parent = nullptr |
||
) |
[in] | name | |
[in] | parent |
Graphics::DepthTexture * Ocular::Core::Camera::getDepthTexture | ( | ) |
Math::Frustum const & Ocular::Core::Camera::getFrustum | ( | bool | updateFrustum = true | ) |
[in] | updateFrustum | If true, updates the frustum with the latest view/proj matrices. |
bool Ocular::Core::Camera::getIsFixedProjection | ( | ) | const |
bool Ocular::Core::Camera::getIsFixedViewport | ( | ) | const |
OrthographicProjection Ocular::Core::Camera::getOrthographicProjection | ( | ) | const |
PerspectiveProjection Ocular::Core::Camera::getPerspectiveProjection | ( | ) | const |
Math::Ray Ocular::Core::Camera::getPickRay | ( | Math::Vector2i const & | screenPos | ) |
Returns a ray projected from the camera at the given screen coordinates.
[in] | x | |
[in] | y |
Priority Ocular::Core::Camera::getPriority | ( | ) | const |
Math::Matrix4x4 const & Ocular::Core::Camera::getProjectionMatrix | ( | ) | const |
ProjectionType Ocular::Core::Camera::getProjectionType | ( | ) | const |
Graphics::RenderTexture * Ocular::Core::Camera::getRenderTexture | ( | ) |
Math::Matrix4x4 const & Ocular::Core::Camera::getViewMatrix | ( | ) |
Graphics::Viewport * Ocular::Core::Camera::getViewport | ( | ) | const |
|
overridevirtual |
Handles WindowResizeEvent instances.
Upon a WindowResizeEvent, the viewport and projection (if perspective) will be updated according to the new window size.
The viewport and projection updating will not occur if they are set to fixed (setFixedProjection and setFixedViewport).
Implements Ocular::Core::AEventListener.
Math::Vector3f Ocular::Core::Camera::screenToWorld | ( | Math::Vector2i const & | screenPos | ) |
Converts a given screen coordinate to a world-space position.
[in] | x | |
[in] | y |
void Ocular::Core::Camera::setDepthTexture | ( | Graphics::DepthTexture * | depthTexture | ) |
[in] | depthTexture |
void Ocular::Core::Camera::setFixedProjection | ( | bool | fixed | ) |
Sets if the projection is fixed.
If the projection is fixed, it will not update and resize automatically with the window. By default, the projection is not fixed.
[in] | fixed |
void Ocular::Core::Camera::setFixedViewport | ( | bool | fixed | ) |
Sets if the viewport is fixed.
If the viewport is fixed, it will not update and resize automatically with the window. By default, the viewport is not fixed.
[in] | fixed |
void Ocular::Core::Camera::setPriority | ( | Priority | priority | ) |
Sets the camera's priority level
[in] | priority |
void Ocular::Core::Camera::setProjectionMatrix | ( | Math::Matrix4x4 const & | matrix | ) |
Sets a custom projection matrix.
[in] | matrix |
void Ocular::Core::Camera::setProjectionOrthographic | ( | float | xMin, |
float | xMax, | ||
float | yMin, | ||
float | yMax, | ||
float | nearClip, | ||
float | farClip | ||
) |
Creates a new orthographic projection matrix and sets it as the projection matrix.
[in] | xMin | |
[in] | xMax | |
[in] | yMin | |
[in] | yMax | |
[in] | nearClip | |
[in] | farClip |
void Ocular::Core::Camera::setProjectionPerspective | ( | float | fov, |
float | aspectRatio, | ||
float | nearClip, | ||
float | farClip | ||
) |
Creates a new perspective projection matrix and sets it as the projection matrix.
[in] | fov | |
[in] | aspectRatio | |
[in] | nearClip | |
[in] | farClip |
void Ocular::Core::Camera::setRenderTexture | ( | Graphics::RenderTexture * | renderTexture | ) |
[in] | renderTexture |
void Ocular::Core::Camera::setViewport | ( | float | x, |
float | y, | ||
float | width, | ||
float | height, | ||
float | minDepth = 0.0f , |
||
float | maxDepth = 1.0f , |
||
bool | updateMatrix = true |
||
) |
Sets the camera's viewport.
[in] | x | |
[in] | y | |
[in] | width | |
[in] | height | |
[in] | minDepth | |
[in] | maxDepth | |
[in] | updateMatrix |
Math::Vector2i Ocular::Core::Camera::worldToScreen | ( | Math::Vector3f const & | worldPos | ) |
Converts a given world space position to a screen-space coordinate.
[in] | pos |