refactor: reduce Window references

This commit is contained in:
MihailRis
2025-04-02 14:55:53 +03:00
parent 896ab3597a
commit 74a94f869c
19 changed files with 151 additions and 155 deletions
@@ -11,7 +11,6 @@
#include "objects/Player.hpp"
#include "voxels/Block.hpp"
#include "voxels/Chunks.hpp"
#include "window/Window.hpp"
#include "world/Level.hpp"
BlockWrapsRenderer::BlockWrapsRenderer(
-1
View File
@@ -6,7 +6,6 @@
#include "graphics/core/Atlas.hpp"
#include "graphics/core/Texture.hpp"
#include "assets/Assets.hpp"
#include "window/Window.hpp"
#include "voxels/Chunks.hpp"
#include "lighting/Lightmap.hpp"
#include "settings.hpp"
+7 -6
View File
@@ -4,11 +4,11 @@
#include "maths/util.hpp"
#include "assets/Assets.hpp"
#include "window/Camera.hpp"
#include "window/Window.hpp"
#include "maths/FrustumCulling.hpp"
#include "graphics/core/Font.hpp"
#include "graphics/core/Batch3D.hpp"
#include "graphics/core/Shader.hpp"
#include "graphics/core/DrawContext.hpp"
#include "presets/NotePreset.hpp"
#include "constants.hpp"
@@ -66,6 +66,7 @@ void TextsRenderer::renderNote(
xvec *= 1.0f + scale;
yvec *= 1.0f + scale;
}
const auto& viewport = context.getViewport();
if (preset.displayMode == NoteDisplayMode::PROJECTED) {
float scale = 1.0f;
if (glm::abs(preset.perspective) > 0.0001f) {
@@ -84,14 +85,14 @@ void TextsRenderer::renderNote(
}
pos /= projpos.w;
pos.z = 0;
xvec = {2.0f/Window::width*scale, 0, 0};
yvec = {0, 2.0f/Window::height*scale, 0};
xvec = {2.0f / viewport.getWidth() * scale, 0, 0};
yvec = {0, 2.0f / viewport.getHeight() * scale, 0};
} else {
auto matrix = camera.getProjView();
auto screenPos = matrix * glm::vec4(pos, 1.0f);
xvec = glm::vec3(2.0f/Window::width*scale, 0, 0);
yvec = glm::vec3(0, 2.0f/Window::height*scale, 0);
xvec = glm::vec3(2.0f / viewport.getWidth() * scale, 0, 0);
yvec = glm::vec3(0, 2.0f / viewport.getHeight() * scale, 0);
pos = screenPos / screenPos.w;
}
+2 -2
View File
@@ -338,8 +338,8 @@ void WorldRenderer::draw(
auto world = level.getWorld();
const Viewport& vp = pctx.getViewport();
camera.aspect = vp.getWidth() / static_cast<float>(vp.getHeight());
const auto& vp = pctx.getViewport();
camera.setAspectRatio(vp.getRatio());
const auto& settings = engine.getSettings();
const auto& worldInfo = world->getInfo();