mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
refactor: reduce Window references
This commit is contained in:
parent
896ab3597a
commit
74a94f869c
19 changed files with 151 additions and 155 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue