13 using std::make_unique;
14 using std::unique_ptr;
53 if (Math::abs(tmpForward.
getX()) < Math::EPSILON && Math::abs(tmpForward.
getZ()) < Math::EPSILON) {
58 tmpUpVector = Vector3::computeCrossProduct(tmpSide, tmpForward).
normalize();
72 auto nearPlane =
zNear;
75 2.0f / (rightPlane - leftPlane),
80 2.0f / (topPlane - bottomPlane),
85 -2.0f / (farPlane - nearPlane),
87 -(rightPlane + leftPlane) / (rightPlane - leftPlane),
88 -(topPlane + bottomPlane) / (topPlane - bottomPlane),
89 -(farPlane + nearPlane) / (farPlane - nearPlane),
96 auto aspect =
static_cast<float>(this->
height) /
static_cast<float>(this->
width);
97 auto rad =
fovX * 3.1415927f / 180.0f;
98 auto _height = Math::cos(0.5f * rad) / Math::sin(0.5 * rad);
99 auto _width = _height * aspect;
160 auto reshaped =
false;
163 if (this->width != _width || this->height != _height) {
168 this->width = _width;
169 this->height = _height;
184 0 + (_height / 2.0f),
Matrix4x4 projectionMatrix
static STATIC_DLL_IMPEXT Vector3 defaultUp
void update(int contextIdx, int32_t width, int32_t height)
Sets up camera while resizing the view port.
Matrix4x4 mvpInvertedMatrix
Matrix4x4 & computeModelViewMatrix()
Computes projection matrix for given look from, look at and up vector.
unique_ptr< Frustum > frustum
static Vector3 computeUpVector(const Vector3 &lookFrom, const Vector3 &lookAt)
Computes the up vector for given look from and look at vectors.
float orthographicFrustumScale
@ FRUSTUMMODE_PERSPECTIVE
@ FRUSTUMMODE_ORTHOGRAPHIC
Matrix4x4 & computeProjectionMatrix()
Computes the projection matrix.
virtual void onUpdateProjectionMatrix(int contextIdx)=0
Update projection matrix event.
virtual void setViewPort(int32_t width, int32_t height)=0
Set up viewport parameter.
virtual void onUpdateCameraMatrix(int contextIdx)=0
Update camera matrix event.
virtual void updateViewPort()=0
Update viewport.
Matrix4x4 & getProjectionMatrix()
Matrix4x4 & getViewportMatrix()
Matrix4x4 & getModelViewMatrix()
virtual void onUpdateModelViewMatrix(int contextIdx)=0
Update model view matrix event.
Matrix4x4 & getCameraMatrix()
Vector3 & getCameraPosition()
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Vector3 multiply(const Vector3 &vector3) const
Multiplies this matrix with vector3.
Matrix4x4 & set(float r0c0, float r0c1, float r0c2, float r0c3, float r1c0, float r1c1, float r1c2, float r1c3, float r2c0, float r2c1, float r2c2, float r2c3, float r3c0, float r3c1, float r3c2, float r3c3)
Sets this matrix by its components.
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Vector3 clone() const
Clones this vector3.
Vector3 & sub(float scalar)
Subtracts a scalar.
Vector3 & scale(float scalar)
Scales by scalar.
Vector3 & set(float x, float y, float z)
Sets this vector3 by its components.
Vector3 & normalize()
Normalizes this vector3.