mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add entity to TextNote
This commit is contained in:
parent
767fa7c7a9
commit
dc29f65fa8
5 changed files with 39 additions and 5 deletions
|
|
@ -10,12 +10,18 @@
|
|||
#include "graphics/core/Shader.hpp"
|
||||
#include "graphics/core/DrawContext.hpp"
|
||||
#include "presets/NotePreset.hpp"
|
||||
#include "world/Level.hpp"
|
||||
#include "objects/Entities.hpp"
|
||||
#include "objects/Entity.hpp"
|
||||
#include "constants.hpp"
|
||||
|
||||
TextsRenderer::TextsRenderer(
|
||||
Batch3D& batch, const Assets& assets, const Frustum& frustum
|
||||
const Level& level,
|
||||
Batch3D& batch,
|
||||
const Assets& assets,
|
||||
const Frustum& frustum
|
||||
)
|
||||
: batch(batch), assets(assets), frustum(frustum) {
|
||||
: level(level), batch(batch), assets(assets), frustum(frustum) {
|
||||
}
|
||||
|
||||
void TextsRenderer::renderNote(
|
||||
|
|
@ -31,6 +37,13 @@ void TextsRenderer::renderNote(
|
|||
const auto& preset = note.getPreset();
|
||||
auto pos = note.getPosition();
|
||||
|
||||
entityid_t eid = note.getEntity();
|
||||
if (eid != ENTITY_NONE) {
|
||||
if (auto entity = level.entities->get(eid)) {
|
||||
pos += entity->getTransform().displayPos;
|
||||
}
|
||||
}
|
||||
|
||||
if (util::distance2(pos, camera.position) >
|
||||
util::sqr(preset.renderDistance / camera.zoom)) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue