add block material shaders

- 'shader' property of block materials: shaders/materials/<name>.glslv, .glslf with material_vertex / material_fragment hooks and #param uniforms
- material shaders code is included into main, translucent and shadows programs through generated headers, no extra draw calls
- chunk vertex normal.w byte replaced with 'flags': bit 7 - emission flag, bits 0-6 - material shader index (vertex format size is not changed)
- doc/*/block-materials.md
This commit is contained in:
lookibed 2026-10-02 06:33:01 +03:00
parent f90750c066
commit 81489a13cf
33 changed files with 761 additions and 53 deletions

View file

@ -14,8 +14,12 @@ uniform bool u_debugNormals;
#include <shadows>
#include <__materials_fragment__>
void main() {
vec4 texColor = texture(u_texture0, a_texCoord);
vec4 texColor = apply_material_fragment(
a_material, texture(u_texture0, a_texCoord)
);
float alpha = texColor.a;
if (u_alphaClip) {
if (alpha < 0.2f)