use double precision for particles, emitters and 3D texts

Positions of particles, of static emitters and of text notes are
worldvec3. gfx.particles, gfx.text3d, gfx.blockwraps, pathfinding and
generation.create_fragment read positions from Lua as doubles: a float
can not hold an odd block coordinate above 16.7M, the object went to a
neighbour block.
This commit is contained in:
ostermine 2026-11-12 01:13:45 +03:00
parent cb39ed464a
commit d012f0530b
14 changed files with 44 additions and 43 deletions

View file

@ -35,16 +35,16 @@ void TextsRenderer::renderNote(
) {
const auto& text = note.getText();
const auto& preset = note.getPreset();
auto pos = note.getPosition();
auto worldPos = note.getPosition();
entityid_t eid = note.getEntity();
if (eid != ENTITY_NONE) {
if (auto entity = level.entities->get(eid)) {
pos += entity->getTransform().displayPos;
worldPos += entity->getTransform().displayPos;
}
}
pos = util::to_local(pos, camera.getOrigin());
glm::vec3 pos = util::to_local(worldPos, camera.getOrigin());
const glm::vec3 cameraPos = camera.getLocalPosition();
if (util::distance2(pos, cameraPos) >