Commit graph

24 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
b8b2e4f451 feat: variant-based hitboxes 2026-10-31 17:15:16 +03:00
MihailRis
7522016e84 feat: entity translucent pass & test layered transparency pipeline 2026-10-16 22:20:59 +03:00
MihailRis
ae082abaa2 feat: allow passing rgba color to entity skeletons and block wraps 2026-09-16 23:28:03 +03:00
MihailRis
9989f81196 fix weather effects render 2026-09-06 19:36:35 +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
908fbc895e update target texture detection 2025-12-19 22:14:03 +03:00
MihailRis
561fb0fb58 feat: naive texture-faces support for blockwraps implementation 2025-12-19 22:08:07 +03:00
MihailRis
5478d121f0 add variants (WIP) 2025-07-13 21:28:57 +03:00
MihailRis
20e3a961f9 add BlockModel struct 2025-04-27 18:21:56 +03:00
MihailRis
718f5d1089 rename BlockModel to BlockModelType 2025-04-27 15:18:14 +03:00
MihailRis
74a94f869c refactor: reduce Window references 2025-04-02 14:55:53 +03:00
MihailRis
1e851b05b4 fix uncaught exception: invalid vector subscript in BlockWrapsRenderer on invalid block state 2025-01-31 07:49:49 +03:00
MihailRis
c1b311f3c4 refactor: change pointer parameters to references for Level and Content in various classes 2024-12-25 18:53:53 +03:00
MihailRis
1c18c02092 move Chunks from Level to Player 2024-12-17 19:40:00 +03:00
MihailRis
af185a5a40 update cracks 2024-11-26 08:53:14 +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