Commit graph

13 commits

Author SHA1 Message Date
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
ae082abaa2 feat: allow passing rgba color to entity skeletons and block wraps 2026-09-16 23:28:03 +03:00
clasher113
818a6bd6ae bring back multimap 2026-03-16 18:34:50 +02:00
clasher113
21951770ea fix block wraps high draw call count 2026-03-16 16:27:40 +02:00
MihailRis
c47432c979 add gfx.blockwraps.set_tints 2025-12-21 16:44:12 +03:00
MihailRis
4d950c974e add 'emission' argument to gfx.blockwraps.wrap 2025-12-21 00:28:41 +03:00
MihailRis
dfdc7ebf6b add 'emission' block wrap property 2025-12-20 23:51:22 +03:00
MihailRis
6d6d38c218 fix block model change wrapper reaction 2025-12-20 22:33:47 +03:00
MihailRis
b0ecfd5add feat: different textures/atlases support 2025-12-20 22:21:00 +03:00
MihailRis
561fb0fb58 feat: naive texture-faces support for blockwraps implementation 2025-12-19 22:08:07 +03:00
MihailRis
1c18c02092 move Chunks from Level to Player 2024-12-17 19:40:00 +03:00
MihailRis
61b1aa8e3d add gfx.blockwraps library & add on_player_tick world event 2024-11-21 06:48:23 +03:00
MihailRis
9e02f1122f add BlockWrapsRenderer (WIP) 2024-11-20 14:42:53 +03:00