forked from XorDev/XorDevs-Default-Shaderpack
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't apply lighting for damagedblock
This seems weird but seems to be correct?
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#version 120 | ||
|
||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
//Diffuse (color) texture. | ||
uniform sampler2D texture; | ||
//Lighting from day/night + shadows + light sources. | ||
uniform sampler2D lightmap; | ||
|
||
//0-1 amount of blindness. | ||
uniform float blindness; | ||
//0 = default, 1 = water, 2 = lava. | ||
uniform int isEyeInWater; | ||
|
||
//Diffuse and lightmap texture coordinates. | ||
varying vec2 coord0; | ||
varying vec2 coord1; | ||
|
||
void main() | ||
{ | ||
//Sample texture | ||
vec4 col = texture2D(texture,coord0); | ||
|
||
//Calculate fog intensity in or out of water. | ||
float fog = (isEyeInWater>0) ? 1.-exp(-gl_FogFragCoord * gl_Fog.density): | ||
clamp((gl_FogFragCoord-gl_Fog.start) * gl_Fog.scale, 0., 1.); | ||
|
||
//Apply the fog. | ||
col.rgb = mix(col.rgb, gl_Fog.color.rgb, fog); | ||
|
||
//Output the result. | ||
/*DRAWBUFFERS:0*/ | ||
gl_FragData[0] = col; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#version 120 | ||
|
||
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#ifdef GLSLANG | ||
#extension GL_GOOGLE_include_directive : enable | ||
#endif | ||
|
||
//Get Entity id. | ||
attribute float mc_Entity; | ||
|
||
//Model * view matrix and it's inverse. | ||
uniform mat4 gbufferModelView; | ||
uniform mat4 gbufferModelViewInverse; | ||
|
||
//Pass vertex information to fragment shader. | ||
varying vec2 coord0; | ||
varying vec2 coord1; | ||
|
||
uniform int frameCounter; | ||
|
||
uniform float viewWidth, viewHeight; | ||
|
||
#include "/bsl_lib/util/jitter.glsl" | ||
|
||
void main() | ||
{ | ||
//Calculate world space position. | ||
vec3 pos = (gl_ModelViewMatrix * gl_Vertex).xyz; | ||
pos = (gbufferModelViewInverse * vec4(pos,1)).xyz; | ||
|
||
//Output position and fog to fragment shader. | ||
gl_Position = gl_ProjectionMatrix * gbufferModelView * vec4(pos,1); | ||
gl_FogFragCoord = length(pos); | ||
|
||
//Output diffuse and lightmap texture coordinates to fragment shader. | ||
coord0 = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy; | ||
coord1 = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; | ||
|
||
gl_Position.xy = TAAJitter(gl_Position.xy, gl_Position.w); | ||
} |