Commit graph

25 commits

Author SHA1 Message Date
ostermine
d012f0530b 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.
2026-11-12 10:05:07 +03:00
ostermine
89bdadd6aa render the world relative to an origin near the camera
World coordinates were passed to GPU as floats: u_model of a chunk and
of a model had the world translation, vertices of translucent blocks,
particles, precipitation, block wrappers, lines and 3D texts were built
in the world space, and the camera position was subtracted in shaders.
The float step grows with the distance from the world origin (6 cm at
1M blocks, 2 m at 30M): blocks got skewed, then stuck together.

Camera::getOrigin() is an integer point near the camera (X and Z are
rounded to 1024 blocks, Y is 0). Camera::getView() is relative to it,
and every position passed to GPU is "world - origin" calculated on CPU,
so the shaders keep working with small numbers and do not change:
u_cameraPos, a_modelpos, u_inverseView and the shadows matrices are in
the same space as before, shifted by the origin. Matrices of a shadow
map are converted from the origin of its camera to the origin of the
player camera. The clouds shader gets the origin wrapped by the period
of its waves, the waves stay bound to the world.

Vertices of translucent blocks are local to the chunk now, as vertices
of opaque ones, and drawn with u_model of the chunk.
2026-11-12 10:05:06 +03:00
MihailRis
4837e1de02 fix projected 3d text for non-monospace fonts 2026-07-26 17:46:48 +03:00
MihailRis
3de2a41092 add 3d text 'font' property 2026-07-26 16:39:54 +03:00
MihailRis
dc29f65fa8 add entity to TextNote 2026-04-15 23:26:08 +03:00
MihailRis
736cdb0980 fix 3d text scaling in projected display mode 2026-04-09 19:42:21 +03:00
MihailRis
47809b4024 feat: rendering pages on demand 2026-02-16 01:42:48 +03:00
MihailRis
2e17c74f91 fix text 3d position and culling 2025-08-12 20:35:46 +03:00
MihailRis
9843a1fc27 remove Viewport class 2025-04-02 17:35:17 +03:00
MihailRis
74a94f869c refactor: reduce Window references 2025-04-02 14:55:53 +03:00
MihailRis
5af6b91b22 add debug GUI render mode (F8) 2025-03-11 00:39:59 +03:00
MihailRis
ed3865964b add syntax highlighting (WIP) 2024-12-04 22:13:17 +03:00
MihailRis
ce1e9f76cf add FontStylesScheme 2024-12-04 18:04:19 +03:00
MihailRis
00cf6e39ef fix projected text frustum culling 2024-11-30 17:34:07 +03:00
MihailRis
bcf920a251 add xray_opacity support to projected 3d text 2024-11-23 14:16:58 +03:00
MihailRis
65e5063326 add player names display 2024-11-23 07:41:44 +03:00
MihailRis
a8388a6243 add text3d.get_axis_x, .set_axis_x, .get_axis_y, .set_axis_y 2024-11-15 03:09:05 +03:00
MihailRis
525cf1ed4b add 'perspective' NotePreset property 2024-11-15 02:21:05 +03:00
MihailRis
2147f507a6 add 'projected' display mode support 2024-11-15 01:08:46 +03:00
MihailRis
ef644ca56d add 'xray_opacity' NotePreset property 2024-11-15 00:38:41 +03:00
MihailRis
501f1b568d add get_text, set_text, get_pos, set_pos 2024-11-14 10:57:55 +03:00
MihailRis
d74b530a83 rename spawn to show & add gfx.text3d.hide(...) 2024-11-14 10:45:37 +03:00
MihailRis
eb5715eba9 add gfx.text3d.spawn(...) 2024-11-14 10:32:50 +03:00
MihailRis
f0b6521c76 refactor 2024-11-14 08:09:10 +03:00
MihailRis
42b26707cb move 3d texts rendering code to TextsRenderer 2024-11-14 05:43:01 +03:00