Commit graph

575 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
cb39ed464a use double precision for positions of entities and players
Transform::pos, Hitbox::position and Player::position were floats. At
65k blocks the float step is 8 mm, at 1M it is 6-12 cm, at 30M it is
2 m. The physics moves a body by 3 cm or less per substep and pushes it
out of a wall by 10 cm or less: steps got rounded to the grid (the body
changed its speed, then stopped), the AABB of a body was off by a float
step and gave false collisions with the blocks around.

Positions of bodies, entity transforms, players, spawn points and the
skeleton position interpolation are worldvec3 now. Collisions are still
calculated in floats, but in the coordinates relative to the block the
body is in: the solver takes the origin, block lookups and hitboxes of
other bodies are shifted by it, the result is added back in doubles.
So the precision of the physics is the same anywhere in the world.

A calculated sensor is stored relative to the position of its entity.
Entities::getAllInside takes the corners in doubles,
Entities::hasBlockingInside takes the origin of the AABB.

The save format does not change: positions are written as numbers
(float64) as before, saves are compatible in both directions. Lua
functions keep their signatures, they only stop rounding to float.
2026-11-12 10:05:07 +03:00
ostermine
ad69663b2e use double precision for camera position and ray casts
A float position has a step of 6 cm at 1M blocks and of 2 m at 30M:
the camera moved by jumps and rays started not where the camera is.

worldvec3 (glm::dvec3) is the type of a position in the world.
Camera::position, the start and the end of block and entity ray casts
and the hit position of the player selection use it. Lua numbers are
doubles already, so cameras.set_pos/get_pos, block.raycast,
entities.raycast and world.raycast only stop rounding to float.
Entities::rayCast intersects a hitbox in the coordinates relative to
its position instead of a float AABB in the world space.
2026-11-12 10:05:06 +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
f4d4209e48 fix reverb room rolloff factor minimum value 2026-11-04 15:58:55 +03:00
MihailRis
c641a18d32 fix lighting settings based chunk meshes rebuilding 2026-11-04 12:43:42 +03:00
MihailRis
463a439089 add 'uv-lock' block property 2026-11-02 00:03:25 +03:00
MihailRis
1da6ef9747 extract render-related code from Entities to EntitiesRenderer 2026-11-01 03:34:16 +03:00
MihailRis
c21871c3c9 upgrade entities frustum culling 2026-10-31 23:41:40 +03:00
MihailRis
b8b2e4f451 feat: variant-based hitboxes 2026-10-31 17:15:16 +03:00
Andrey Tazetdinov
5d6446b06a gpu instanced entities renderer 2026-10-18 12:44:37 +02:00
MihailRis
7522016e84 feat: entity translucent pass & test layered transparency pipeline 2026-10-16 22:20:59 +03:00
MihailRis
35e3d80f35 Merge branch 'main' into dev 2026-10-16 01:30:13 +03:00
MihailRis
c64659e06d
Merge pull request #848 from Astazium/main
ObjParser and GBuffer refactor + fixes
2026-10-15 23:18:29 +03:00
Astazium
bf59e520a7
Merge branch 'main' into main 2026-10-15 16:19:06 +03:00
Andrey Tazetdinov
fd17ce32ab optimize animator 2026-10-14 16:35:21 +02:00
MihailRis
674ae220c6 cleanup 2026-10-14 00:39:30 +03:00
MihailRis
7e41439e1a fix: model-primitives texture regions are broken 2026-10-14 00:38:38 +03:00
MihailRis
3fc5a4322d Merge branch 'dev' into lights-fixes 2026-10-11 15:25:10 +03:00
MihailRis
25cee0284f update advanced render lighting model 2026-10-05 23:15:20 +03:00
MihailRis
ef85592e21 fix chunks render limits 2026-10-05 21:21:33 +03:00
MihailRis
e467c85adc add 'enable-fog' setting 2026-09-26 19:13:08 +03:00
Astazium
2c3c217fef
Merge branch 'MihailRis:main' into main 2026-09-20 12:36:56 +03:00
MihailRis
56d2ab9f14 fix custom model blocks with disabled ambient-occlusion 2026-09-19 20:04:30 +03:00
MihailRis
e306624260 fix hand items lighting 2026-09-19 19:41:11 +03:00
MihailRis
8911cded07 add 'lighting-mode' entity property 2026-09-19 18:13:15 +03:00
MihailRis
dbeeef90a8 cleanup a bit 2026-09-16 23:31:37 +03:00
MihailRis
ae082abaa2 feat: allow passing rgba color to entity skeletons and block wraps 2026-09-16 23:28:03 +03:00
Astazium
469edd1e9d
Merge branch 'MihailRis:main' into main 2026-09-09 21:50:10 +03:00
MihailRis
eca7eeadee Merge branch 'main' into animation 2026-09-06 20:11:24 +03:00
MihailRis
9989f81196 fix weather effects render 2026-09-06 19:36:35 +03:00
MihailRis
8c1d8bd794 Merge branch 'main' into animation 2026-08-30 20:13:38 +03:00
Astazium
533a27c04b
Merge branch 'MihailRis:main' into main 2026-08-29 14:40:20 +03:00
MihailRis
8214f1bd09 fix blocks render at the top of the world 2026-08-26 18:06:05 +03:00
Astazium
3e20166401
Merge branch 'MihailRis:main' into main 2026-08-16 16:35:30 +03:00
MihailRis
49e7f2c631 Merge branch 'main' into animation 2026-08-14 19:46:37 +03:00
MihailRis
717d41e7a5 fix 3d text render 2026-08-11 23:10:44 +03:00
MihailRis
83e7f1d5f5 Merge branch 'main' into animation 2026-08-09 16:50:42 +03:00
Astazium
bd56be04dd
Merge branch 'MihailRis:main' into main 2026-08-05 23:11:12 +03:00
MihailRis
8b683e322e Merge branch 'main' into refactor-world-renderer 2026-08-05 21:07:38 +03:00
MihailRis
103bcb3751 remove trash 2026-08-05 20:24:32 +03:00
MihailRis
f082d7608d fix black screen in water 2026-08-05 20:23:46 +03:00
MihailRis
282c9b3de2 Merge branch 'main' into animation 2026-08-04 23:39:49 +03:00
Astazium
7536ac2736
Merge branch 'MihailRis:main' into main 2026-08-04 17:15:26 +03:00
MihailRis
7525e31942 cleanup ChunksRenderer 2026-08-03 00:06:19 +03:00
MihailRis
2a2169cff0 refactor: meshes build queue instead of retrieveChunk 2026-08-02 22:35:03 +03:00
MihailRis
4ae3dcf1ae remove it again 2026-08-02 20:07:10 +03:00
MihailRis
61b601f95a Merge branch 'main' into refactor-world-renderer 2026-08-02 20:05:42 +03:00
MihailRis
8b520a3787
Merge pull request #840 from MihailRis/environments
environments (part 1)
2026-08-02 19:11:03 +03:00
MihailRis
a5b1259c5b Merge branch 'main' into animation 2026-07-27 23:09:14 +03:00