feat(ui): add CSimpleCamera::GetScene
Some checks failed
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Has been cancelled
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Has been cancelled
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Has been cancelled

This commit is contained in:
fallenoak 2026-02-15 21:02:06 -06:00
parent 2711c752ba
commit 7d491570e4
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,5 @@
#include "ui/simple/CSimpleCamera.hpp" #include "ui/simple/CSimpleCamera.hpp"
#include "model/Model2.hpp"
#include <tempest/Math.hpp> #include <tempest/Math.hpp>
namespace { namespace {
@ -52,7 +53,7 @@ void BuildBillboardMatrix(const C3Vector& direction, C33Matrix& rotation) {
} }
CSimpleCamera::CSimpleCamera(float nearZ, float farZ, float fov) { CSimpleCamera::CSimpleCamera(float nearZ, float farZ, float fov) {
this->float10 = 0.0f; this->m_scene = nullptr;
this->m_nearZ = nearZ; this->m_nearZ = nearZ;
this->m_farZ = farZ; this->m_farZ = farZ;
@ -70,6 +71,14 @@ C3Vector CSimpleCamera::Forward() const {
return { this->m_facing.a0, this->m_facing.a1, this->m_facing.a2 }; return { this->m_facing.a0, this->m_facing.a1, this->m_facing.a2 };
} }
CM2Scene* CSimpleCamera::GetScene() {
if (!this->m_scene) {
this->m_scene = M2CreateScene();
}
return this->m_scene;
}
C3Vector CSimpleCamera::Right() const { C3Vector CSimpleCamera::Right() const {
return { this->m_facing.b0, this->m_facing.b1, this->m_facing.b2 }; return { this->m_facing.b0, this->m_facing.b1, this->m_facing.b2 };
} }

View File

@ -4,6 +4,8 @@
#include <tempest/Matrix.hpp> #include <tempest/Matrix.hpp>
#include <tempest/Vector.hpp> #include <tempest/Vector.hpp>
class CM2Scene;
class CSimpleCamera { class CSimpleCamera {
public: public:
// Virtual public member functions // Virtual public member functions
@ -14,6 +16,7 @@ class CSimpleCamera {
// Public member functions // Public member functions
CSimpleCamera(float nearZ, float farZ, float fov); CSimpleCamera(float nearZ, float farZ, float fov);
CM2Scene* GetScene();
void SetFacing(const C3Vector& forward); void SetFacing(const C3Vector& forward);
void SetFacing(const C3Vector& forward, const C3Vector& up); void SetFacing(const C3Vector& forward, const C3Vector& up);
void SetFacing(float yaw, float pitch, float roll); void SetFacing(float yaw, float pitch, float roll);
@ -23,8 +26,8 @@ class CSimpleCamera {
protected: protected:
// Protected member variables // Protected member variables
CM2Scene* m_scene;
C3Vector m_position; C3Vector m_position;
float float10;
C33Matrix m_facing; C33Matrix m_facing;
float m_nearZ; float m_nearZ;
float m_farZ; float m_farZ;