Commit graph

224 commits

Author SHA1 Message Date
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
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
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
Astazium
bf59e520a7
Merge branch 'main' into main 2026-10-15 16:19:06 +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
2f87bbf608 optimize ssao pass 2026-10-06 18:41:26 +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
Astazium
2c3c217fef
Merge branch 'MihailRis:main' into main 2026-09-20 12:36:56 +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
Astazium
89bedf9595 fix noiseTexture deleting 2026-09-17 01:27:21 +03:00
Astazium
68a01e3648 fix comments 2026-09-16 23:45:47 +03:00
Astazium
9a942cf634
Merge branch 'MihailRis:main' into main 2026-08-23 20:44:45 +03:00
MihailRis
f2018334cb fix Texture::reload 2026-08-22 17:39:01 +03:00
Astazium
3e20166401
Merge branch 'MihailRis:main' into main 2026-08-16 16:35:30 +03:00
Astazium
7536ac2736
Merge branch 'MihailRis:main' into main 2026-08-04 17:15:26 +03:00
MihailRis
53a9d47905 Merge branch 'environments' into refactor-world-renderer 2026-07-26 23:56:40 +03:00
MihailRis
f9bc401236 Merge branch 'main' into environments 2026-07-26 23:56:00 +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
4295af15cc
Merge pull request #847 from MihailRis/client-side-tests
client-side `--script`, `--test` support (part 1)
2026-07-25 21:59:10 +03:00
Astazium
b7295da941
Merge branch 'MihailRis:main' into main 2026-07-24 11:10:21 +03:00
MihailRis
420d0daf28 fix: missing font usage produces fatal error 2026-07-22 22:48:16 +03:00
Astazium
8bf5a63a36
Merge branch 'MihailRis:main' into main 2026-07-19 11:47:43 +03:00
MihailRis
a5596ed5cd fix canvas:line lines clipping 2026-07-18 13:25:04 +03:00
MihailRis
5b868ae857 fix graphics settings & reduce extra GL calls 2026-07-14 19:03:32 +03:00
MihailRis
c73b036099 cleanup World references 2026-06-20 22:17:27 +03:00
MihailRis
22f09d3659 start splitting render pipelines & remove the obsolete world fog parameter 2026-06-19 00:01:14 +03:00
MihailRis
af71d5b674 simplify settings-based shaders recompilation 2026-06-18 22:12:22 +03:00
MihailRis
4cc6a83872 speed up monospace fonts 2026-06-10 01:28:23 +03:00
Astazium
80585c441e
Merge branch 'MihailRis:main' into main 2026-06-06 12:20:12 +03:00
MihailRis
a557068b90 Merge branch 'main' into environments 2026-06-06 00:33:56 +03:00
MihailRis
d69716ed11 fix this something 2026-06-03 19:00:40 +03:00
Astazium
77d9ca1d86 fix 2026-06-01 21:18:33 +03:00
Astazium
0104585e10 gbuffer refactor 2026-06-01 12:19:33 +03:00
MihailRis
28b7713648 move some code there and here 2026-05-12 18:41:14 +03:00
MihailRis
a7ad219261 test environment (sky) 2026-05-12 02:02:06 +03:00
MihailRis
47809b4024 feat: rendering pages on demand 2026-02-16 01:42:48 +03:00
MihailRis
ae54ac9975 feat: non-monospaced fonts support 2026-02-15 23:48:10 +03:00
MihailRis
11c3f1c5eb add vector fonts support 2026-02-15 20:27:34 +03:00