Update #48 - Added some features from OptiFine

This commit is contained in:
lax1dude
2025-01-24 18:39:36 -08:00
parent 1f0d593a8c
commit e83a912e38
1056 changed files with 17706 additions and 898 deletions

View File

@ -239,6 +239,58 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Project Name: Alfheim
Project Author: Red Studio
Project URL: https://github.com/Red-Studio-Ragnarok/Alfheim
Used For: Optimized lighting engine
* MIT License
*
* Copyright (c) 2023 Red Studio
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Project Name: OptiFine (1.8.9_HD_U_M6)
Project Author: sp614x
Project URL: https://optifine.net/
Used For: A few, limited portions we "borrowed" without the author's permission
Note: Eaglercraft is not OptiFine, we only use the code for connected textures
and maintaining compatibility with certain resource pack features
* The mod OptiFine is Copyright © 2011-2021 by sp614x and the intellectual
* property of the author.
* It may be not be reproduced under any circumstances except for personal,
* private use as long as it remains in its unaltered, unedited form.
* It may not be placed on any web site or otherwise distributed publicly
* without advance written permission.
* Use of this mod on any other website or as a part of any public display
* is strictly prohibited and a violation of copyright.
(sorry sp614x)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Project Name: Google Guava
Project Author: Google
Project URL: https://github.com/google/guava

View File

@ -141,8 +141,9 @@ void main() {
reflectDir.xz += vec2(0.5, reflectDir.y > 0.0 ? 0.25 : 0.75);
envMapSample4f = textureLod(u_environmentMap, reflectDir.xz, 0.0);
}
if(envMapSample4f.a > 0.0) {
specular = eaglercraftIBL_Specular(diffuseColor3f.rgb, envMapSample4f.rgb, viewDir3f, normalVector3f, materialData4f.rgb);
envMapSample4f.a += min(lightmapCoords2f.g * 2.0, 1.0) * (1.0 - envMapSample4f.a);
if(envMapSample4f.a == 1.0) {
specular = eaglercraftIBL_Specular(diffuseColor3f.rgb, envMapSample4f.rgb * envMapSample4f.a, viewDir3f, normalVector3f, materialData4f.rgb);
specular *= 1.0 - sqrt(posDst) * 0.2;
}
break;

View File

@ -21,7 +21,7 @@ precision highp sampler2DShadow;
in vec4 v_position4f;
#ifdef COMPILE_FOG_LIGHT_SHAFTS
in vec2 v_positionClip2f;
in vec3 v_positionClip3f;
#endif
#ifdef COMPILE_TEXTURE_ATTRIB
@ -351,7 +351,7 @@ void main() {
f += materialData3f.r < 0.5 ? 1.0 : 0.0;
while(f == 0.0) {
float dst2 = dot(worldPosition4f.xyz, worldPosition4f.xyz);
if(dst2 > 16.0) {
if(dst2 > 25.0) {
break;
}
vec3 reflectDir = reflect(worldDirection4f.xyz, normalVector3f);
@ -369,8 +369,9 @@ void main() {
reflectDir.xz += vec2(0.5, reflectDir.y > 0.0 ? 0.25 : 0.75);
envMapSample4f = textureLod(u_environmentMap, reflectDir.xz, 0.0);
}
if(envMapSample4f.a > 0.0) {
lightColor3f += eaglercraftIBL_Specular(diffuseColor4f.rgb, envMapSample4f.rgb, worldDirection4f.xyz, normalVector3f, materialData3f, metalN, metalK) * (1.0 - sqrt(dst2) * 0.25);
envMapSample4f.a += min(lightmapCoords2f.g * 2.0, 1.0) * (1.0 - envMapSample4f.a);
if(envMapSample4f.a == 1.0) {
lightColor3f += eaglercraftIBL_Specular(diffuseColor4f.rgb, envMapSample4f.rgb * envMapSample4f.a, worldDirection4f.xyz, normalVector3f, materialData3f, metalN, metalK) * (1.0 - sqrt(dst2) * 0.2);
}
break;
}
@ -453,7 +454,7 @@ void main() {
fogBlend4f.rgb *= textureLod(u_irradianceMap, atmosSamplePos.xz, 0.0).rgb;
#ifdef COMPILE_FOG_LIGHT_SHAFTS
fogBlend4f.rgb *= pow(textureLod(u_lightShaftsTexture, v_positionClip2f * 0.5 + 0.5, 0.0).r * 0.9 + 0.1, 2.25);
fogBlend4f.rgb *= pow(textureLod(u_lightShaftsTexture, (v_positionClip3f.xy / v_positionClip3f.z) * 0.5 + 0.5, 0.0).r * 0.9 + 0.1, 2.25);
fogBlend4f.a = fogBlend4f.a * 0.85 + 0.2;
#endif
break;

View File

@ -21,7 +21,7 @@ in vec3 a_position3f;
out vec4 v_position4f;
#ifdef COMPILE_FOG_LIGHT_SHAFTS
out vec2 v_positionClip2f;
out vec3 v_positionClip3f;
#endif
#ifdef COMPILE_TEXTURE_ATTRIB
@ -98,6 +98,6 @@ void main() {
#endif
#ifdef COMPILE_FOG_LIGHT_SHAFTS
v_positionClip2f = gl_Position.xy / gl_Position.w;
v_positionClip3f = gl_Position.xyw;
#endif
}

View File

@ -238,7 +238,7 @@ void main() {
for(;;) {
float dst2 = dot(worldPosition4f.xyz, worldPosition4f.xyz);
if(dst2 > 16.0) {
if(dst2 > 25.0) {
break;
}
vec3 reflectDir = reflect(worldDirection4f.xyz, normalVector3f);
@ -256,8 +256,9 @@ void main() {
reflectDir.xz += vec2(0.5, reflectDir.y > 0.0 ? 0.25 : 0.75);
envMapSample4f = textureLod(u_environmentMap, reflectDir.xz, 0.0);
}
if(envMapSample4f.a > 0.0) {
lightColor3f += eaglercraftIBL_Specular_Glass(envMapSample4f.rgb, worldDirection4f.xyz, normalVector3f) * (1.0 - sqrt(dst2) * 0.25);
envMapSample4f.a += min(lightmapCoords2f.g * 2.0, 1.0) * (1.0 - envMapSample4f.a);
if(envMapSample4f.a == 1.0) {
lightColor3f += eaglercraftIBL_Specular_Glass(envMapSample4f.rgb * envMapSample4f.a, worldDirection4f.xyz, normalVector3f) * (1.0 - sqrt(dst2) * 0.2);
}
break;
}

View File

@ -19,7 +19,7 @@
precision highp sampler2DShadow;
in vec4 v_position4f;
in vec2 v_positionClip2f;
in vec3 v_positionClip3f;
#ifdef COMPILE_TEXTURE_ATTRIB
in vec2 v_texture2f;
@ -434,7 +434,7 @@ void main() {
fogBlend4f.rgb *= textureLod(u_irradianceMap, atmosSamplePos.xz, 0.0).rgb + u_fogColorAddSun4f.rgb;
#ifdef COMPILE_FOG_LIGHT_SHAFTS
fogBlend4f.rgb *= pow(textureLod(u_lightShaftsTexture, v_positionClip2f * 0.5 + 0.5, 0.0).r * 0.9 + 0.1, 2.25);
fogBlend4f.rgb *= pow(textureLod(u_lightShaftsTexture, (v_positionClip3f.xy / v_positionClip3f.z) * 0.5 + 0.5, 0.0).r * 0.9 + 0.1, 2.25);
fogBlend4f.a = fogBlend4f.a * 0.85 + 0.2;
#endif
break;

View File

@ -21,7 +21,7 @@ in vec3 a_position3f;
out vec4 v_position4f;
#ifdef COMPILE_FOG_LIGHT_SHAFTS
out vec2 v_positionClip2f;
out vec3 v_positionClip3f;
#endif
#ifdef COMPILE_TEXTURE_ATTRIB
@ -77,6 +77,6 @@ void main() {
gl_Position = u_projectionMat4f * v_position4f;
#ifdef COMPILE_FOG_LIGHT_SHAFTS
v_positionClip2f = gl_Position.xy / gl_Position.w;
v_positionClip3f = gl_Position.xyw;
#endif
}

View File

@ -1,7 +1,7 @@
{
"name": "§eHigh Performance PBR",
"desc": "Pack made from scratch specifically for this client, designed to give what I call the best balance between quality and performance possible in a browser but obviously that's just my opinion",
"vers": "1.3.0",
"vers": "1.3.1",
"author": "lax1dude",
"api_vers": 1,
"features": [

View File

@ -1,7 +1,7 @@
#line 2
/*
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
* Copyright (c) 2022-2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@ -16,7 +16,7 @@
*
*/
EAGLER_IN(vec2, v_position2f)
EAGLER_IN(vec2, v_texCoords2f)
EAGLER_FRAG_OUT()
@ -24,10 +24,8 @@ uniform sampler2D u_inputTexture;
uniform float u_textureLod1f;
uniform vec4 u_blendFactor4f;
uniform vec4 u_blendBias4f;
uniform mat3 u_matrixTransform;
void main() {
vec3 coords = u_matrixTransform * vec3(v_position2f, 1.0);
vec4 color4f = EAGLER_TEXTURE_2D_LOD(u_inputTexture, coords.xy, u_textureLod1f);
vec4 color4f = EAGLER_TEXTURE_2D_LOD(u_inputTexture, v_texCoords2f, u_textureLod1f);
EAGLER_FRAG_COLOR = color4f * u_blendFactor4f + u_blendBias4f;
}