Skip to content

Commit

Permalink
switch light.glsl back to emissive_utils.glsl
Browse files Browse the repository at this point in the history
  • Loading branch information
ShockMicro committed Jul 20, 2021
1 parent 7039955 commit ff4f7d0
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 32 deletions.
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/particle.fsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/rendertype_cutout.fsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/rendertype_cutout_mipped.fsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/rendertype_entity_cutout.fsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/rendertype_entity_solid.fsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/rendertype_solid.fsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
2 changes: 1 addition & 1 deletion assets/minecraft/shaders/core/rendertype_translucent.fsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 150

#moj_import <fog.glsl>
#moj_import <light.glsl>
#moj_import <emissive_utils.glsl>

uniform sampler2D Sampler0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
#version 150

#define MINECRAFT_LIGHT_POWER (0.6)
#define MINECRAFT_AMBIENT_LIGHT (0.4)

vec4 minecraft_mix_light(vec3 lightDir0, vec3 lightDir1, vec3 normal, vec4 color) {
lightDir0 = normalize(lightDir0);
lightDir1 = normalize(lightDir1);
float light0 = max(0.0, dot(lightDir0, normal));
float light1 = max(0.0, dot(lightDir1, normal));
float lightAccum = min(1.0, (light0 + light1) * MINECRAFT_LIGHT_POWER + MINECRAFT_AMBIENT_LIGHT);
return vec4(color.rgb * lightAccum, color.a);
}

vec4 minecraft_sample_lightmap(sampler2D lightMap, ivec2 uv) {
float blockLight = uv.x / 16.0; // Doesn't do anything on its own but it's useful to have an easy reference for this
float skyLight = uv.y / 16.0;
return texture(lightMap, clamp(uv / 256.0, vec2(0.5 / 16.0), vec2(15.5 / 16.0)));
}

float check_alpha(float textureAlpha, float targetAlpha) {
float targetLess = targetAlpha - 0.01;
float targetMore = targetAlpha + 0.01;
Expand Down

0 comments on commit ff4f7d0

Please sign in to comment.