mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix text 3d position and culling
This commit is contained in:
parent
303346f5e5
commit
2e17c74f91
2 changed files with 15 additions and 3 deletions
|
|
@ -51,6 +51,7 @@ void TextsRenderer::renderNote(
|
|||
glm::vec3 yvec = note.getAxisY();
|
||||
|
||||
int width = font.calcWidth(text, text.length());
|
||||
int height = font.getLineHeight();
|
||||
if (preset.displayMode == NoteDisplayMode::Y_FREE_BILLBOARD ||
|
||||
preset.displayMode == NoteDisplayMode::XY_FREE_BILLBOARD) {
|
||||
xvec = camera.position - pos;
|
||||
|
|
@ -96,8 +97,11 @@ void TextsRenderer::renderNote(
|
|||
|
||||
pos = screenPos / screenPos.w;
|
||||
}
|
||||
} else if (!frustum.isBoxVisible(pos - xvec * (width * 0.5f * preset.scale),
|
||||
pos + xvec * (width * 0.5f * preset.scale))) {
|
||||
} else if (!frustum.isBoxVisible(
|
||||
pos - xvec * (width * 0.5f) * preset.scale,
|
||||
pos + xvec * (width * 0.5f) * preset.scale +
|
||||
yvec * static_cast<float>(height) * preset.scale
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
auto color = preset.color;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue