Untitled diff

Created Diff never expires
17 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
156 lines
17 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
156 lines
#version 120
#version 120
//go to line 96 for changing sunlight/ambient color balance
//go to line 96 for changing sunlight/ambient color balance
varying vec4 texcoord;
varying vec4 texcoord;
varying vec3 lightVector;
varying vec3 lightVector;
varying vec3 sunlight_color;
varying vec3 sunlight_color;
varying vec3 ambient_color;
varying vec3 ambient_color;
varying float handItemLight;
varying float handItemLight;
uniform vec3 sunPosition;
uniform vec3 sunPosition;
uniform vec3 moonPosition;
uniform vec3 moonPosition;
uniform int worldTime;
uniform int worldTime;
uniform int heldItemId;
uniform int heldItemId;
uniform int heldBlockLightValue;
uniform int heldBlockLightValue;
uniform float rainStrength;
uniform float rainStrength;
uniform float wetness;
uniform float wetness;
////////////////////sunlight color////////////////////
////////////////////sunlight color////////////////////
////////////////////sunlight color////////////////////
////////////////////sunlight color////////////////////
////////////////////sunlight color////////////////////
////////////////////sunlight color////////////////////
const ivec4 ToD[25] = ivec4[25]
const ivec4 ToD[25] = ivec4[25]
(ivec4(0,5,8,15), //hour,r,g,b
(ivec4(0,2,3,8), //hour,r,g,b
ivec4(1,5,8,15),
ivec4(1,3,5,8),
ivec4(2,5,8,15),
ivec4(2,4,7,10),
ivec4(3,5,8,15),
ivec4(3,5,8,12),
ivec4(4,5,8,15),
ivec4(4,5,8,15),
ivec4(5,5,8,15),
ivec4(5,5,8,15),
ivec4(6,120,80,35),
ivec4(6,120,80,35),
ivec4(7,255,195,80),
ivec4(7,255,195,80),
ivec4(8,255,200,97),
ivec4(8,255,200,97),
ivec4(9,255,200,110),
ivec4(9,255,200,110),
ivec4(10,255,205,135),
ivec4(10,255,205,135),
ivec4(11,255,215,160),
ivec4(11,255,215,160),
ivec4(12,255,215,160),
ivec4(12,255,215,160),
ivec4(13,255,215,160),
ivec4(13,255,215,160),
ivec4(14,255,205,125),
ivec4(14,255,205,125),
ivec4(15,255,200,110),
ivec4(15,255,200,110),
ivec4(16,255,200,97),
ivec4(16,255,200,97),
ivec4(17,255,195,80),
ivec4(17,255,195,80),
ivec4(18,255,190,70),
ivec4(18,200,130,50),
ivec4(19,77,67,194),
ivec4(19,12,10,24),
ivec4(20,5,8,15),
ivec4(20,5,8,15),
ivec4(21,5,8,15),
ivec4(21,5,8,15),
ivec4(22,5,8,15),
ivec4(22,5,8,12),
ivec4(23,5,8,15),
ivec4(23,4,7,10),
ivec4(24,5,8,15));
ivec4(24,3,5,8));
////////////////////ambient color////////////////////
////////////////////ambient color////////////////////
////////////////////ambient color////////////////////
////////////////////ambient color////////////////////
////////////////////ambient color////////////////////
////////////////////ambient color////////////////////
const ivec4 ToD2[25] = ivec4[25]
const ivec4 ToD2[25] = ivec4[25]
(ivec4(0,10,20,45), //hour,r,g,b
(ivec4(0,3,10,20), //hour,r,g,b
ivec4(1,10,20,45),
ivec4(1,5,13,25),
ivec4(2,10,20,45),
ivec4(2,8,17,35),
ivec4(3,10,20,45),
ivec4(3,10,20,45),
ivec4(4,10,20,45),
ivec4(4,10,20,45),
ivec4(5,60,120,180),
ivec4(5,60,120,180),
ivec4(6,160,200,255),
ivec4(6,160,200,255),
ivec4(7,160,205,255),
ivec4(7,160,205,255),
ivec4(8,160,210,260),
ivec4(8,160,210,260),
ivec4(9,165,220,270),
ivec4(9,165,220,270),
ivec4(10,190,235,280),
ivec4(10,190,235,280),
ivec4(11,205,250,290),
ivec4(11,205,250,290),
ivec4(12,220,250,300),
ivec4(12,220,250,300),
ivec4(13,205,250,290),
ivec4(13,205,250,290),
ivec4(14,190,235,280),
ivec4(14,190,235,280),
ivec4(15,165,220,270),
ivec4(15,165,220,270),
ivec4(16,150,210,260),
ivec4(16,150,210,260),
ivec4(17,140,200,255),
ivec4(17,140,200,255),
ivec4(18,120,140,220),
ivec4(18,120,140,220),
ivec4(19,50,55,110),
ivec4(19,50,55,110),
ivec4(20,10,20,450),
ivec4(20,10,20,45),
ivec4(21,10,20,450),
ivec4(21,10,20,45),
ivec4(22,10,20,450),
ivec4(22,8,17,35),
ivec4(23,10,20,450),
ivec4(23,5,13,25),
ivec4(24,10,20,450));
ivec4(24,3,10,20));
//////////////////////////////main//////////////////////////////
//////////////////////////////main//////////////////////////////
//////////////////////////////main//////////////////////////////
//////////////////////////////main//////////////////////////////
//////////////////////////////main//////////////////////////////
//////////////////////////////main//////////////////////////////
//////////////////////////////main//////////////////////////////
//////////////////////////////main//////////////////////////////
//////////////////////////////main//////////////////////////////
//////////////////////////////main//////////////////////////////
void main() {
void main() {
gl_Position = ftransform();
gl_Position = ftransform();
texcoord = gl_MultiTexCoord0;
texcoord = gl_MultiTexCoord0;
if (worldTime < 12700 || worldTime > 23250) {
if (worldTime < 12700 || worldTime > 23250) {
lightVector = normalize(sunPosition);
lightVector = normalize(sunPosition);
}
}
else {
else {
lightVector = normalize(moonPosition);
lightVector = normalize(moonPosition);
}
}
handItemLight = 0.0;
handItemLight = 0.0;
if (heldItemId == 50) {
if (heldItemId == 50) {
// torch
// torch
handItemLight = 1.5;
handItemLight = 1.5;
}
}
else if (heldItemId == 76 || heldItemId == 94) {
else if (heldItemId == 76 || heldItemId == 94) {
// active redstone torch / redstone repeater
// active redstone torch / redstone repeater
handItemLight = 0.1;
handItemLight = 0.1;
}
}
else if (heldItemId == 89) {
else if (heldItemId == 89) {
// lightstone
// lightstone
handItemLight = 2.0;
handItemLight = 2.0;
}
}
else if (heldItemId == 10 || heldItemId == 11 || heldItemId == 51) {
else if (heldItemId == 10 || heldItemId == 11 || heldItemId == 51) {
// lava / lava / fire
// lava / lava / fire
handItemLight = 0.5;
handItemLight = 0.5;
}
}
else if (heldItemId == 91) {
else if (heldItemId == 91) {
// jack-o-lantern
// jack-o-lantern
handItemLight = 0.6;
handItemLight = 0.6;
}
}
else if (heldItemId == 327) {
else if (heldItemId == 327) {
handItemLight = 0.2;
handItemLight = 0.2;
}
}
float hour = worldTime/1000.0+6.0;
float hour = worldTime/1000.0+6.0;
if (hour > 24.0) hour = hour - 24.0;
if (hour > 24.0) hour = hour - 24.0;
ivec4 temp = ToD[int(floor(hour))];
ivec4 temp = ToD[int(floor(hour))];
ivec4 temp2 = ToD[int(floor(hour)) + 1];
ivec4 temp2 = ToD[int(floor(hour)) + 1];
sunlight_color = mix(vec3(temp.yzw),vec3(temp2.yzw),(hour-float(temp.x))/float(temp2.x-temp.x))/255.0f;
sunlight_color = mix(vec3(temp.yzw),vec3(temp2.yzw),(hour-float(temp.x))/float(temp2.x-temp.x))/255.0f;
ivec4 tempa = ToD2[int(floor(hour))];
ivec4 tempa = ToD2[int(floor(hour))];
ivec4 tempa2 = ToD2[int(floor(hour)) + 1];
ivec4 tempa2 = ToD2[int(floor(hour)) + 1];
ambient_color = mix(vec3(tempa.yzw),vec3(tempa2.yzw),(hour-float(tempa.x))/float(tempa2.x-tempa.x))/255.0f;
ambient_color = mix(vec3(tempa.yzw),vec3(tempa2.yzw),(hour-float(tempa.x))/float(tempa2.x-tempa.x))/255.0f;
vec3 ambient_color_rain = vec3(0.2, 0.2, 0.2); //rain
vec3 ambient_color_rain = vec3(0.2, 0.2, 0.2); //rain
//ambient_color.g *= 1.2;
//ambient_color.g *= 1.2;
ambient_color = sqrt(pow(mix(ambient_color, ambient_color_rain, rainStrength*0.75),vec3(2.0))*2.0*ambient_color); //rain
ambient_color = sqrt(pow(mix(ambient_color, ambient_color_rain, rainStrength*0.75),vec3(2.0))*2.0*ambient_color); //rain
}
}