feat(gameui): add CGCamera and workaround to control it

This commit is contained in:
VDm 2025-07-27 19:09:15 +04:00
parent 5be5ba35b9
commit 45ceb6354b
8 changed files with 84 additions and 20 deletions

View file

@ -0,0 +1 @@
#include "gameui/camera/CGCamera.hpp"

View file

@ -0,0 +1,10 @@
#ifndef GAME_UI_CAMERA_CGCAMERA_HPP
#define GAME_UI_CAMERA_CGCAMERA_HPP
#include "gameui/camera/CSimpleCamera.hpp"
class CGCamera : public CSimpleCamera {
};
#endif // GAME_UI_CAMERA_CGCAMERA_HPP

View file

@ -149,9 +149,9 @@ void CSimpleCamera::SetGxProjectionAndView(const CRect& projectionRect) {
GxXformProjection(mProj);
GxuXformCreateProjection_SG(this->m_fov, this->m_aspect, this->m_nearZ, this->m_farZ, mProj);
//GxXformSetProjection(mProj);
GxXformSetProjection(mProj);
C44Matrix mView;
GxuXformCreateLookAtSgCompat(C3Vector(), Forward(), Up(), mView);
GxuXformCreateLookAtSgCompat(this->m_position, this->m_position + Forward(), Up(), mView);
GxXformSetView(mView);
}

View file

@ -12,27 +12,27 @@ class CSimpleCamera {
CSimpleCamera(float nearZ, float farZ, float fov);
virtual ~CSimpleCamera();
C3Vector& Position() { this->m_position; };
C33Matrix& Facing() { this->m_facing; };
float NearZ() { this->m_nearZ; };
float FarZ() { this->m_farZ; };
float FOV() { this->m_fov; };
float Aspect() { this->m_aspect; };
C3Vector& Position() { this->m_position; }
C33Matrix& Facing() { this->m_facing; }
float NearZ() { this->m_nearZ; }
float FarZ() { this->m_farZ; }
float FOV() { this->m_fov; }
float Aspect() { this->m_aspect; }
virtual C3Vector Forward();
virtual C3Vector Right();
virtual C3Vector Up();
void SetPosition(const C3Vector& position) { this->m_position = position; };
void SetPosition(float x, float y, float z) { this->m_position = C3Vector(x, y, z); };
void SetPosition(const C3Vector& position) { this->m_position = position; }
void SetPosition(float x, float y, float z) { this->m_position = C3Vector(x, y, z); }
void SetFacing(float yaw, float pitch, float roll);
void SetFacing(const C3Vector& forward, const C3Vector& up);
void SetFacing(const C3Vector& forward);
void SetFieldOfView(float value) { this->m_fov = value; };
void SetNearZ(float value) { this->m_nearZ = value; };
void SetFarZ(float value) { this->m_farZ = value; };
void SetFieldOfView(float value) { this->m_fov = value; }
void SetNearZ(float value) { this->m_nearZ = value; }
void SetFarZ(float value) { this->m_farZ = value; }
void SetGxProjectionAndView(const CRect& projectionRect);