Commit graph

1232 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
9be7cfa724 fix fatal errors caused by incorrect interval event callbacks timing
Some checks failed
x86-64 AppImage / build-appimage (ubuntu-22.04) (push) Has been cancelled
Build / Build (push) Has been cancelled
Macos Build / build-dmg (push) Has been cancelled
Windows Build (CLang) / build-windows (clang, windows-latest) (push) Has been cancelled
MSVC Build / build-windows (windows-2022) (push) Has been cancelled
2026-11-05 03:35:32 +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
3de0187a87 feat: removing world missing content from UI 2026-11-03 21:29: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
0ae335599a add MeshStats vertices count to Mesh::drawInstanced 2026-11-01 02:05:27 +03:00
MihailRis
5011a654be Merge branch 'main' into dev 2026-11-01 02:03:50 +03:00
MihailRis
d857e7326d add vertices count to debug panel 2026-11-01 01:30:39 +03:00
MihailRis
c21871c3c9 upgrade entities frustum culling 2026-10-31 23:41:40 +03:00
MihailRis
c444e266ba add container:clearInterval 2026-10-31 17:57:17 +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
b14fa9bde8 Merge branch 'main' into dev 2026-10-12 02:26:38 +03:00
ostermine
50a02d251b remove obvious comment 2026-10-11 22:15:10 +03:00
ostermine
e57e6a5cbe fix modelviewer background is not transparent 2026-10-11 21:37:50 +03:00
MihailRis
3fc5a4322d Merge branch 'dev' into lights-fixes 2026-10-11 15:25:10 +03:00
MihailRis
28e85a336f oh 2026-10-10 16:50:44 +03:00
MihailRis
bf98174e15 fix shader info log is truncated 2026-10-10 16:48:04 +03:00
MihailRis
521ebf43ab remove incorrect fix 2026-10-10 11:36:31 +03:00
MihailRis
f036979dc0
Merge pull request #1007 from Astazium/ui-fixes
ui fixes
2026-10-10 11:34:34 +03:00
MihailRis
2f87bbf608 optimize ssao pass 2026-10-06 18:41:26 +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
Astazium
5a0a1cf326 ui fixes 2026-09-30 20:43:43 +03:00
boolean-false
7211e99bc8 fix text width and caret positioning in text boxes 2026-09-29 20:31:14 +07:00
boolean-false
64ba1dad4e fix glyph positions 2026-09-27 17:33:55 +07:00
MihailRis
4946a25ca5
Merge pull request #990 from MihailRis/recursion-related-fixes
fix recursion-related bugs
2026-09-26 21:06:57 +03:00
MihailRis
c3b50b5ab2 fix recursive iframe 2026-09-26 20:28:20 +03:00
MihailRis
4f1411b005 fix infinite recursion on moveInto used to move to descendant node 2026-09-26 19:51:08 +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
Astazium
68ced64a11
Update PostProcessing.cpp 2026-09-19 00:39:08 +03:00
MihailRis
69edfc8c8a add 'frame' argument to gui.screenshot 2026-09-17 22:07:18 +03:00
Astazium
ff77912f33
revert create_noise_texture 2026-09-17 02:09:42 +03:00
Astazium
229dadd9e0
fix missing include 2026-09-17 01:34:08 +03:00