mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 06:21:50 +00:00
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:
parent
f90750c066
commit
81489a13cf
33 changed files with 761 additions and 53 deletions
|
|
@ -8,4 +8,13 @@ vec3 apply_planet_curvature(vec3 modelPos, vec3 pos3d) {
|
|||
return modelPos;
|
||||
}
|
||||
|
||||
// chunk vertex flags (normal.w): bit 7 - emission flag, bits 0-6 - material
|
||||
float unpack_emission(float w) {
|
||||
return float(int(w * 255.0 + 0.5) >> 7);
|
||||
}
|
||||
|
||||
int unpack_material(float w) {
|
||||
return int(w * 255.0 + 0.5) & 127;
|
||||
}
|
||||
|
||||
#endif // COMMONS_GLSL_
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ in vec3 a_realnormal;
|
|||
in vec3 a_skyLight;
|
||||
in vec4 a_modelpos;
|
||||
in float a_emission;
|
||||
flat in int a_material;
|
||||
|
||||
#include <world_uniforms>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ out vec3 a_realnormal;
|
|||
out vec3 a_skyLight;
|
||||
out vec4 a_modelpos;
|
||||
out float a_emission;
|
||||
flat out int a_material;
|
||||
|
||||
#include <world_uniforms>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue