mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 05:51:51 +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
|
|
@ -14,11 +14,15 @@ out vec4 a_torchLight;
|
|||
|
||||
uniform float u_dayTime;
|
||||
|
||||
#include <__materials_vertex__>
|
||||
|
||||
void main() {
|
||||
a_material = unpack_material(v_normal.w);
|
||||
a_realnormal = v_normal.xyz * 2.0 - 1.0;
|
||||
a_modelpos = u_model * vec4(v_position, 1.0f);
|
||||
a_modelpos.xyz = apply_material_vertex(a_material, a_modelpos.xyz);
|
||||
vec3 pos3d = a_modelpos.xyz - u_cameraPos;
|
||||
|
||||
a_realnormal = v_normal.xyz * 2.0 - 1.0;
|
||||
a_normal = calc_screen_normal(a_realnormal);
|
||||
|
||||
a_torchLight = vec4(calc_torch_light(
|
||||
|
|
@ -33,7 +37,7 @@ void main() {
|
|||
mat4 viewmodel = u_view * u_model;
|
||||
a_distance = length(viewmodel * vec4(pos3d, 0.0));
|
||||
a_fog = calc_fog(length(viewmodel * vec4(pos3d * FOG_POS_SCALE, 0.0)) / 256.0);
|
||||
a_emission = v_normal.w;
|
||||
a_emission = unpack_emission(v_normal.w);
|
||||
|
||||
vec4 viewmodelpos = u_view * a_modelpos;
|
||||
a_position = viewmodelpos.xyz;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue