mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-07-29 03:38:18 +03:00
Compare commits
2 Commits
f67c8cfc04
...
a30b405251
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a30b405251 | ||
![]() |
a99dc295c4 |
@ -1,6 +1,8 @@
|
||||
#include "gameui/CGWorldFrame.hpp"
|
||||
|
||||
#include "gx/Transform.hpp"
|
||||
#include "gx/Draw.hpp"
|
||||
#include "gx/Shader.hpp"
|
||||
|
||||
#include <bc/Memory.hpp>
|
||||
#include <tempest/Matrix.hpp>
|
||||
@ -36,15 +38,27 @@ void CGWorldFrame::RenderWorld(void* param) {
|
||||
GxXformView(saved_view);
|
||||
|
||||
CGWorldFrame::OnWorldUpdate();
|
||||
|
||||
// TODO: PlayerNameUpdateWorldText();
|
||||
|
||||
CGWorldFrame::OnWorldRender();
|
||||
|
||||
//PlayerNameRenderWorldText();
|
||||
// TODO: PlayerNameRenderWorldText();
|
||||
|
||||
GxXformSetProjection(saved_proj);
|
||||
GxXformSetView(saved_view);
|
||||
|
||||
CShaderEffect::UpdateProjMatrix();
|
||||
}
|
||||
|
||||
void CGWorldFrame::OnWorldUpdate() {
|
||||
GxXformSetViewport(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f);
|
||||
CImVector clearColor = { 0x00, 0x00, 0x00, 0xFF };
|
||||
GxSceneClear(3, clearColor);
|
||||
C44Matrix matrix;
|
||||
GxuXformCreateOrtho(0.0, 1.0, -0.5, 0.5, 0.0, 500.0, matrix);
|
||||
GxXformSetView(C44Matrix());
|
||||
GxXformSetProjection(matrix);
|
||||
}
|
||||
|
||||
void CGWorldFrame::OnWorldRender() {
|
||||
|
@ -1,4 +1,7 @@
|
||||
file(GLOB PRIVATE_SOURCES "*.cpp")
|
||||
file(GLOB PRIVATE_SOURCES
|
||||
"*.cpp"
|
||||
"camera/*.cpp"
|
||||
)
|
||||
|
||||
add_library(gameui STATIC
|
||||
${PRIVATE_SOURCES}
|
||||
|
65
src/gameui/camera/CSimpleCamera.cpp
Normal file
65
src/gameui/camera/CSimpleCamera.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
#include "CSimpleCamera.hpp"
|
||||
|
||||
#include <tempest/rect/CRect.hpp>
|
||||
|
||||
CSimpleCamera::CSimpleCamera()
|
||||
: m_position()
|
||||
, m_facing()
|
||||
, m_nearZ(0.11111111f)
|
||||
, m_farZ(277.77777f)
|
||||
, m_fov(1.5707964f)
|
||||
, m_aspect(1.0f) {
|
||||
this->SetFacing(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
CSimpleCamera::CSimpleCamera(float nearZ, float farZ, float fov)
|
||||
: m_position()
|
||||
, m_facing()
|
||||
, m_nearZ(nearZ)
|
||||
, m_farZ(farZ)
|
||||
, m_fov(fov)
|
||||
, m_aspect(1.0f) {
|
||||
this->SetFacing(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
CSimpleCamera::~CSimpleCamera() {
|
||||
}
|
||||
|
||||
C3Vector CSimpleCamera::Forward() {
|
||||
return {
|
||||
this->m_facing.a0,
|
||||
this->m_facing.a1,
|
||||
this->m_facing.a2
|
||||
};
|
||||
}
|
||||
|
||||
C3Vector CSimpleCamera::Right() {
|
||||
return {
|
||||
this->m_facing.b0,
|
||||
this->m_facing.b1,
|
||||
this->m_facing.b2
|
||||
};
|
||||
}
|
||||
|
||||
C3Vector CSimpleCamera::Up() {
|
||||
return {
|
||||
this->m_facing.c0,
|
||||
this->m_facing.c1,
|
||||
this->m_facing.c2
|
||||
};
|
||||
}
|
||||
|
||||
void CSimpleCamera::SetFacing(float yaw, float pitch, float roll) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CSimpleCamera::SetFacing(const C3Vector& forward, const C3Vector& up) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CSimpleCamera::SetFacing(const C3Vector& forward) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CSimpleCamera::SetGxProjectionAndView(const CRect& projectionRect) {
|
||||
// TODO
|
||||
}
|
48
src/gameui/camera/CSimpleCamera.hpp
Normal file
48
src/gameui/camera/CSimpleCamera.hpp
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef GAME_UI_CAMERA_CSIMPLECAMERA_HPP
|
||||
#define GAME_UI_CAMERA_CSIMPLECAMERA_HPP
|
||||
|
||||
#include <tempest/vector/C3Vector.hpp>
|
||||
#include <tempest/matrix/C33Matrix.hpp>
|
||||
|
||||
class CRect;
|
||||
|
||||
class CSimpleCamera {
|
||||
public:
|
||||
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 Forward();
|
||||
C3Vector Right();
|
||||
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 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 SetGxProjectionAndView(const CRect& projectionRect);
|
||||
|
||||
// Member variables
|
||||
C3Vector m_position;
|
||||
C33Matrix m_facing;
|
||||
float m_nearZ;
|
||||
float m_farZ;
|
||||
float m_fov;
|
||||
float m_aspect;
|
||||
};
|
||||
|
||||
#endif // GAME_UI_CAMERA_CSIMPLECAMERA_HPP
|
@ -1315,7 +1315,7 @@ void CSimpleFrame::SetBeingScrolled(int32_t a2, int32_t a3) {
|
||||
this->m_batchDirty |= 0x1F;
|
||||
}
|
||||
|
||||
for (auto child = this->m_children.Head(); child; this->m_children.Link(child)->Next()) {
|
||||
for (auto child = this->m_children.Head(); child; child = this->m_children.Link(child)->Next()) {
|
||||
if (!(child->frame->m_flags & 0x4000)) {
|
||||
child->frame->SetBeingScrolled(a2, -1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user