useless cam functions

This commit is contained in:
2023-08-15 19:19:54 +02:00
parent 380ecf3a27
commit debf9e974c
5 changed files with 11 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ public:
void SetCamAngularMovement(const Vec2f& mov); void SetCamAngularMovement(const Vec2f& mov);
void SetCamMovement(const Vec2f& lastCursorPos, const Vec2f& currentCursorPos); void SetCamMovement(const Vec2f& lastCursorPos, const Vec2f& currentCursorPos);
void SetCamLook(const Vec2f& worldPos); void SetCamLook(const Vec2f& worldPos);
void ResetCamLook();
void SetBackgroundColor(const Vec3f& color) { m_BackgroundColor = color; } void SetBackgroundColor(const Vec3f& color) { m_BackgroundColor = color; }

View File

@@ -48,6 +48,7 @@ public:
void Update(); void Update();
void Render(); void Render();
void ResetCam();
void SetCamPos(float camX, float camY); void SetCamPos(float camX, float camY);
void MoveCam(float relativeX, float relativeY); void MoveCam(float relativeX, float relativeY);

View File

@@ -117,6 +117,7 @@ void ClientGame::HandlePacket(const protocol::WorldDataPacket* packet) {
m_WorldRenderer.LoadModels(); m_WorldRenderer.LoadModels();
// set cam pos to player spawn // set cam pos to player spawn
const game::Spawn& spawn = m_World->GetTeam(m_Player->GetTeamColor()).GetSpawn(); const game::Spawn& spawn = m_World->GetTeam(m_Player->GetTeamColor()).GetSpawn();
m_WorldRenderer.ResetCam();
m_WorldRenderer.SetCamPos(spawn.GetCenterX(), spawn.GetCenterY()); m_WorldRenderer.SetCamPos(spawn.GetCenterX(), spawn.GetCenterY());
} }

View File

@@ -107,6 +107,10 @@ void Renderer::SetCamMovement(const Vec2f& lastCursorPos, const Vec2f& currentCu
SetCamLook(m_Camera.CamLook - movement); SetCamLook(m_Camera.CamLook - movement);
} }
void Renderer::ResetCamLook() {
m_Camera = Camera();
}
void Renderer::SetCamPos(const Vec3f& newPos) { void Renderer::SetCamPos(const Vec3f& newPos) {
Vec3f front = { Vec3f front = {

View File

@@ -130,6 +130,10 @@ void WorldRenderer::RenderTooltips() const {
RenderCastleTooltip(); RenderCastleTooltip();
} }
void WorldRenderer::ResetCam() {
m_Renderer->ResetCamLook();
}
void WorldRenderer::MoveCam(float relativeX, float relativeY) { void WorldRenderer::MoveCam(float relativeX, float relativeY) {
if (m_WorldVao == nullptr) if (m_WorldVao == nullptr)
return; return;