Wildvine Engine
Referencia Doxygen del codigo propio de Wildvine Engine.
Cargando...
Buscando...
Nada coincide
Referencia de la clase Camera

#include <Camera.h>

+ Diagrama de colaboración de Camera:

Métodos públicos

 Camera ()
 
EU::Vector3 FromXM (FXMVECTOR v)
 
float getAspect () const
 
float getFarZ () const
 
EU::Vector3 GetForward () const
 
float getFovY () const
 Devuelve parámetros de proyección (útil para UI/debug).
 
float getNearZ () const
 
EU::Vector3getPosition ()
 
EU::Vector3 getPosition () const
 Obtiene la posición en mundo.
 
XMMATRIX getProj () const
 Matriz Projection (vista->clip).
 
EU::Vector3 GetRight () const
 Vectores base (mundo) de la cámara.
 
EU::Vector3 GetUp () const
 
XMMATRIX getView () const
 Matriz View (mundo->vista).
 
XMMATRIX GetViewNoTranslation () const
 View sin traslación (solo rotación).
 
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 pitch (float radians)
 Rotación sobre el eje Right local (pitch).
 
void setLens (float fovYRadians, float aspectRatio, float nearPlane, float farPlane)
 Configura la proyección en perspectiva (LH).
 
void setPosition (const EU::Vector3 &pos)
 Define posición en mundo.
 
void setPosition (float x, float y, float z)
 Define posición en mundo.
 
void strafe (float d)
 Movimiento relativo a la cámara (izquierda/derecha).
 
void updateViewMatrix ()
 Recalcula la matriz View si es necesario.
 
void walk (float d)
 Movimiento relativo a la cámara (adelante/atrás).
 
void yaw (float radians)
 Rotación sobre el eje Y global (yaw).
 
 ~Camera ()=default
 

Atributos privados

float m_aspectRatio = 1.0f
 The aspect ratio of the camera's view (width divided by height).
 
float m_farPlane = 1000.0f
 The distance to the far clipping plane.
 
EU::Vector3 m_forward { 0.0f, 0.0f, 1.0f }
 The forward vector of the camera's orthonormal basis.
 
float m_fovY { XM_PIDIV4 }
 The field of view (FOV) angle in radians.
 
float m_nearPlane = 0.01f
 The distance to the near clipping plane.
 
EU::Vector3 m_position
 The position of the camera in world space.
 
XMFLOAT4X4 m_proj {}
 
EU::Vector3 m_right { 1.0f, 0.0f, 0.0f }
 The right vector of the camera's orthonormal basis.
 
EU::Vector3 m_up { 0.0f, 1.0f, 0.0f }
 The up vector of the camera's orthonormal basis.
 
XMFLOAT4X4 m_view {}
 
bool m_viewDirty = true
 Flag indicating whether the view matrix needs to be recalculated.
 

Descripción detallada

Definición en la línea 10 del archivo Camera.h.

Documentación de constructores y destructores

◆ Camera()

Camera::Camera ( )

Definición en la línea 8 del archivo Camera.cpp.

Hace referencia a m_proj y m_view.

◆ ~Camera()

Camera::~Camera ( )
default

Documentación de funciones miembro

◆ FromXM()

EU::Vector3 Camera::FromXM ( FXMVECTOR  v)
inline

Definición en la línea 151 del archivo Camera.h.

Referenciado por lookAt(), pitch(), strafe(), updateViewMatrix(), walk() y yaw().

◆ getAspect()

float Camera::getAspect ( ) const
inline

Definición en la línea 139 del archivo Camera.h.

Hace referencia a m_aspectRatio.

◆ getFarZ()

float Camera::getFarZ ( ) const
inline

Definición en la línea 141 del archivo Camera.h.

Hace referencia a m_farPlane.

◆ GetForward()

EU::Vector3 Camera::GetForward ( ) const
inline

Definición en la línea 148 del archivo Camera.h.

Hace referencia a m_forward.

◆ getFovY()

float Camera::getFovY ( ) const
inline

Definición en la línea 138 del archivo Camera.h.

Hace referencia a m_fovY.

◆ getNearZ()

float Camera::getNearZ ( ) const
inline

Definición en la línea 140 del archivo Camera.h.

Hace referencia a m_nearPlane.

◆ getPosition() [1/2]

EU::Vector3 & Camera::getPosition ( )
inline

Definición en la línea 48 del archivo Camera.h.

Hace referencia a m_position.

◆ getPosition() [2/2]

EU::Vector3 Camera::getPosition ( ) const
inline

◆ getProj()

XMMATRIX Camera::getProj ( ) const
inline

Definición en la línea 119 del archivo Camera.h.

Hace referencia a m_proj.

Referenciado por GUI::editTransform(), Skybox::update(), BaseApp::update() y ForwardRenderer::updatePerFrame().

◆ GetRight()

EU::Vector3 Camera::GetRight ( ) const
inline

Definición en la línea 146 del archivo Camera.h.

Hace referencia a m_right.

◆ GetUp()

EU::Vector3 Camera::GetUp ( ) const
inline

Definición en la línea 147 del archivo Camera.h.

Hace referencia a m_up.

◆ getView()

XMMATRIX Camera::getView ( ) const
inline

Definición en la línea 113 del archivo Camera.h.

Hace referencia a m_view.

Referenciado por GUI::editTransform(), GetViewNoTranslation(), BaseApp::update() y ForwardRenderer::updatePerFrame().

◆ GetViewNoTranslation()

XMMATRIX Camera::GetViewNoTranslation ( ) const
inline

Ideal para Skybox.

Aplicación práctica

  • Skybox: ViewNoTranslation * Proj

Definición en la línea 128 del archivo Camera.h.

Hace referencia a getView().

Referenciado por Skybox::update().

◆ lookAt()

void Camera::lookAt ( const EU::Vector3 pos,
const EU::Vector3 target,
const EU::Vector3 up = EU::Vector3(0, 1, 0) 
)

Pasos

  • Calcula basis a partir de (target - pos).
  • Normaliza Forward, Right y Up.
  • Marca dirty para recalcular View.

Aplicación práctica

  • Cinemáticas simples o cámaras orbit.

Definición en la línea 40 del archivo Camera.cpp.

Hace referencia a FromXM(), m_forward, m_position, m_right, m_up, EU::Vector3::x, EU::Vector3::y y EU::Vector3::z.

◆ pitch()

void Camera::pitch ( float  radians)

Aplicación práctica

  • Mouse Y para FPS.

Definición en la línea 96 del archivo Camera.cpp.

Hace referencia a FromXM(), m_forward, m_right, m_up, m_viewDirty, EU::Vector3::x, EU::Vector3::y y EU::Vector3::z.

◆ setLens()

void Camera::setLens ( float  fovYRadians,
float  aspectRatio,
float  nearPlane,
float  farPlane 
)

Pasos

  • Calcula la matriz de proyección con XMMatrixPerspectiveFovLH.
  • Guarda FOV, aspect, near y far para debug/inspección.

Aplicación práctica

  • Llamar al inicializar ventana y al cambiar resolución.

Definición en la línea 14 del archivo Camera.cpp.

Hace referencia a m_aspectRatio, m_farPlane, m_fovY, m_nearPlane y m_proj.

Referenciado por BaseApp::init() y BaseApp::onResize().

◆ setPosition() [1/2]

void Camera::setPosition ( const EU::Vector3 pos)

Definición en la línea 34 del archivo Camera.cpp.

Hace referencia a m_position y m_viewDirty.

◆ setPosition() [2/2]

void Camera::setPosition ( float  x,
float  y,
float  z 
)

Definición en la línea 28 del archivo Camera.cpp.

Hace referencia a m_position y m_viewDirty.

Referenciado por BaseApp::init().

◆ strafe()

void Camera::strafe ( float  d)

Definición en la línea 66 del archivo Camera.cpp.

Hace referencia a FromXM(), m_position, m_right, m_viewDirty, EU::Vector3::x, EU::Vector3::y y EU::Vector3::z.

◆ updateViewMatrix()

void Camera::updateViewMatrix ( )

Pasos

  • Reconstruye basis ortonormal (Right/Up/Forward).
  • Calcula View con XMMatrixLookToLH.

Aplicación práctica

  • Llamar una vez por frame antes de render.

Definición en la línea 114 del archivo Camera.cpp.

Hace referencia a FromXM(), m_forward, m_position, m_right, m_up, m_view, m_viewDirty, EU::Vector3::x, EU::Vector3::y y EU::Vector3::z.

Referenciado por BaseApp::update().

◆ walk()

void Camera::walk ( float  d)

Definición en la línea 56 del archivo Camera.cpp.

Hace referencia a FromXM(), m_forward, m_position, m_viewDirty, EU::Vector3::x, EU::Vector3::y y EU::Vector3::z.

◆ yaw()

void Camera::yaw ( float  radians)

Aplicación práctica

  • Mouse X para FPS.

Definición en la línea 76 del archivo Camera.cpp.

Hace referencia a FromXM(), m_forward, m_right, m_up, m_viewDirty, EU::Vector3::x, EU::Vector3::y y EU::Vector3::z.

Documentación de datos miembro

◆ m_aspectRatio

float Camera::m_aspectRatio = 1.0f
private

Definición en la línea 173 del archivo Camera.h.

Referenciado por getAspect() y setLens().

◆ m_farPlane

float Camera::m_farPlane = 1000.0f
private

Definición en la línea 175 del archivo Camera.h.

Referenciado por getFarZ() y setLens().

◆ m_forward

EU::Vector3 Camera::m_forward { 0.0f, 0.0f, 1.0f }
private

Definición en la línea 165 del archivo Camera.h.

Referenciado por GetForward(), lookAt(), pitch(), updateViewMatrix(), walk() y yaw().

◆ m_fovY

float Camera::m_fovY { XM_PIDIV4 }
private

Definición en la línea 172 del archivo Camera.h.

Referenciado por getFovY() y setLens().

◆ m_nearPlane

float Camera::m_nearPlane = 0.01f
private

Definición en la línea 174 del archivo Camera.h.

Referenciado por getNearZ() y setLens().

◆ m_position

EU::Vector3 Camera::m_position
private

Definición en la línea 160 del archivo Camera.h.

Referenciado por getPosition(), getPosition(), lookAt(), setPosition(), setPosition(), strafe(), updateViewMatrix() y walk().

◆ m_proj

XMFLOAT4X4 Camera::m_proj {}
private

Definición en la línea 169 del archivo Camera.h.

Referenciado por Camera(), getProj() y setLens().

◆ m_right

EU::Vector3 Camera::m_right { 1.0f, 0.0f, 0.0f }
private

Definición en la línea 163 del archivo Camera.h.

Referenciado por GetRight(), lookAt(), pitch(), strafe(), updateViewMatrix() y yaw().

◆ m_up

EU::Vector3 Camera::m_up { 0.0f, 1.0f, 0.0f }
private

Definición en la línea 164 del archivo Camera.h.

Referenciado por GetUp(), lookAt(), pitch(), updateViewMatrix() y yaw().

◆ m_view

XMFLOAT4X4 Camera::m_view {}
private

Definición en la línea 168 del archivo Camera.h.

Referenciado por Camera(), getView() y updateViewMatrix().

◆ m_viewDirty

bool Camera::m_viewDirty = true
private

Definición en la línea 177 del archivo Camera.h.

Referenciado por pitch(), setPosition(), setPosition(), strafe(), updateViewMatrix(), walk() y yaw().


La documentación de esta clase está generada de los siguientes archivos: