9 XMStoreFloat4x4(&
m_view, XMMatrixIdentity());
10 XMStoreFloat4x4(&
m_proj, XMMatrixIdentity());
24 XMStoreFloat4x4(&
m_proj, proj);
43 XMVECTOR T = XMVectorSet(target.
x, target.
y, target.
z, 1.0f);
44 XMVECTOR U = XMVectorSet(up.
x, up.
y, up.
z, 0.0f);
46 XMVECTOR F = XMVector3Normalize(XMVectorSubtract(T, P));
47 XMVECTOR R = XMVector3Normalize(XMVector3Cross(U, F));
48 XMVECTOR Up = XMVector3Cross(F, R);
78 XMMATRIX rot = XMMatrixRotationY(radians);
84 R = XMVector3TransformNormal(R, rot);
85 U = XMVector3TransformNormal(U, rot);
86 F = XMVector3TransformNormal(F, rot);
99 XMMATRIX rot = XMMatrixRotationAxis(R, radians);
104 U = XMVector3TransformNormal(U, rot);
105 F = XMVector3TransformNormal(F, rot);
122 F = XMVector3Normalize(F);
123 R = XMVector3Normalize(XMVector3Cross(U, F));
124 U = XMVector3Cross(F, R);
131 XMMATRIX view = XMMatrixLookToLH(P, F, U);
132 XMStoreFloat4x4(&
m_view, view);
Declara la API de Camera dentro del subsistema Utilities.
bool m_viewDirty
Flag indicating whether the view matrix needs to be recalculated.
void pitch(float radians)
Rotación sobre el eje Right local (pitch).
float m_fovY
The field of view (FOV) angle in radians.
float m_farPlane
The distance to the far clipping plane.
EU::Vector3 m_forward
The forward vector of the camera's orthonormal basis.
EU::Vector3 FromXM(FXMVECTOR v)
void setPosition(float x, float y, float z)
Define posición en mundo.
EU::Vector3 m_up
The up vector of the camera's orthonormal basis.
void strafe(float d)
Movimiento relativo a la cámara (izquierda/derecha).
float m_nearPlane
The distance to the near clipping plane.
void lookAt(const EU::Vector3 &pos, const EU::Vector3 &target, const EU::Vector3 &up=EU::Vector3(0, 1, 0))
Fuerza la cámara a mirar a un objetivo (LH).
void updateViewMatrix()
Recalcula la matriz View si es necesario.
float m_aspectRatio
The aspect ratio of the camera's view (width divided by height).
EU::Vector3 m_position
The position of the camera in world space.
void yaw(float radians)
Rotación sobre el eje Y global (yaw).
void walk(float d)
Movimiento relativo a la cámara (adelante/atrás).
void setLens(float fovYRadians, float aspectRatio, float nearPlane, float farPlane)
Configura la proyección en perspectiva (LH).
EU::Vector3 m_right
The right vector of the camera's orthonormal basis.
float x
The x-coordinate of the vector.
float z
The z-coordinate of the vector.
float y
The y-coordinate of the vector.