few more tweaks/improvements to resourcepack skybox support

This commit is contained in:
Xonk
2025-03-22 00:07:30 -04:00
parent f453b02fbc
commit 04f9d47b25
4 changed files with 43 additions and 18 deletions

View File

@ -30,24 +30,32 @@ void main() {
#if RESOURCEPACK_SKY != 0
/* RENDERTARGETS:2 */
gl_FragData[0] = vec4(0.0,0.0,0.0,1.0);
vec4 COLOR = texture2D(texture, texcoord.xy);
COLOR.rgb = toLinear(COLOR.rgb);
COLOR *= color;
vec4 COLOR = texture2D(texture, texcoord.xy) * color;
#if RESOURCEPACK_SKY == 3
if(renderStage == 1 || renderStage == 3) { discard; return; }
#endif
bool isSun = renderStage == MC_RENDER_STAGE_SUN || renderStage == 4;
bool isMoon = renderStage == MC_RENDER_STAGE_MOON || renderStage == 5;
bool isSkyBox = (renderStage == MC_RENDER_STAGE_SKY || renderStage == MC_RENDER_STAGE_CUSTOM_SKY) || (renderStage == 1 || renderStage == 3);
#if RESOURCEPACK_SKY == 1
if(renderStage == 4 || renderStage == 5) { discard; return; }
#else
if(renderStage == 4 || renderStage == MC_RENDER_STAGE_SUN) COLOR.rgb *= 5.0;
if(isMoon || isSun) { discard; return; }
#endif
COLOR.rgb = max(COLOR.rgb - COLOR.rgb * interleaved_gradientNoise()*0.05, 0.0);
#if RESOURCEPACK_SKY == 3
if(isSkyBox) { discard; return; }
#endif
vec3 NEWCOLOR = COLOR.rgb;
if(isSun) NEWCOLOR.rgb = COLOR.rgb * 10.0;
if(isMoon) NEWCOLOR.rgb = COLOR.rgb * 10.0;
if(isSkyBox) NEWCOLOR.rgb = COLOR.rgb * 2.0;
NEWCOLOR.rgb = toLinear(NEWCOLOR.rgb);
NEWCOLOR.rgb = max(NEWCOLOR.rgb - NEWCOLOR.rgb * interleaved_gradientNoise()*0.05, 0.0);
gl_FragData[0] = vec4(COLOR.rgb*0.1, COLOR.a);
gl_FragData[0] = vec4(NEWCOLOR.rgb*0.1, COLOR.a);
#else
discard;
#endif