u18 commit

This commit is contained in:
kone 2023-05-06 14:41:29 -04:00
parent 7f95d86501
commit 6aee822284
1039 changed files with 61881 additions and 1154 deletions

View File

@ -7,17 +7,17 @@
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/CompileEPK.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/Java-WebSocket-1.5.1-with-dependencies.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/MakeOfflineDownload.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/codecjorbis-20101023.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/codecwav-20101023.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl-egl.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl-glfw.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl-jemalloc.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl-openal.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl-opengles.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl.jar"/>
<classpathentry kind="lib" path="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime/soundsystem-20120107.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/codecjorbis-20101023.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/codecwav-20101023.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/CompileEPK.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/Java-WebSocket-1.5.1-with-dependencies.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl-egl.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl-glfw.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl-jemalloc.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl-openal.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl-opengles.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/lwjgl.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/MakeOfflineDownload.jar"/>
<classpathentry kind="lib" path="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime/soundsystem-20120107.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -18,12 +18,12 @@
<link>
<name>src_lwjgl_java</name>
<type>2</type>
<location>/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/src/lwjgl/java</location>
<location>C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/src/lwjgl/java</location>
</link>
<link>
<name>src_main_java</name>
<type>2</type>
<location>/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/src/main/java</location>
<location>C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/src/main/java</location>
</link>
</linkedResources>
</projectDescription>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eclipseProject/src_main_java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/MainClass.java"/>
<listEntry value="/eclipseProject/src_lwjgl_java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/MainClass.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -18,5 +18,5 @@
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="eclipseProject"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="eclipseProject"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djava.library.path=."/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="/workspace/Resent-1.8/eaglercraftx-1.8/../eaglercraft_1.8_workspace/desktopRuntime"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="C:/Users/suvan/Downloads/bafybeiakklgbdjufhlcbsf2hksxbmxgyilobmvtcogt6ltdtweh5nyvbvi/../eaglercraft_1.8_workspace/desktopRuntime"/>
</launchConfiguration>

View File

@ -5,9 +5,11 @@
lax1dude:
- Creator of Eaglercraft
- Wrote HW accelerated OpenGL 1.3 emulator
- Wrote all desktop emulation code
- Ported the Minecraft 1.8 client src to TeaVM
- Wrote HW accelerated OpenGL 1.3 emulator
- Wrote the default shader pack
- Made the integrated PBR resource pack
- Wrote all desktop emulation code
- Wrote EaglercraftXBungee
- Wrote the patch and build system

View File

@ -15,8 +15,8 @@
*/
precision lowp int;
precision lowp float;
precision lowp sampler2D;
precision mediump float;
precision mediump sampler2D;
in vec2 v_texCoord2f;
in vec4 v_color4f;

View File

@ -15,8 +15,8 @@
*/
precision lowp int;
precision lowp float;
precision lowp sampler2D;
precision highp float;
precision mediump sampler2D;
layout(location = 0) in vec3 a_position3f;

View File

@ -15,8 +15,8 @@
*/
precision lowp int;
precision lowp float;
precision lowp sampler2D;
precision mediump float;
precision mediump sampler2D;
in vec2 v_texCoord2f;
in vec4 v_color4f;

View File

@ -15,8 +15,8 @@
*/
precision lowp int;
precision lowp float;
precision lowp sampler2D;
precision highp float;
precision mediump sampler2D;
layout(location = 0) in vec2 a_position2f;

View File

@ -141,6 +141,10 @@ void main() {
#endif
#endif
#ifdef COMPILE_BLEND_ADD
color = color * u_colorBlendSrc4f + u_colorBlendAdd4f;
#endif
#ifdef COMPILE_ENABLE_ALPHA_TEST
if(color.a < u_alphaTestRef1f) discard;
#endif
@ -154,24 +158,21 @@ void main() {
vec3 normal = u_uniformNormal3f;
#endif
float diffuse = 0.0;
vec4 light;
for(int i = 0; i < u_lightsEnabled1i; ++i) {
vec4 light = u_lightsDirections4fv[i];
light = u_lightsDirections4fv[i];
diffuse += max(dot(light.xyz, normal), 0.0) * light.w;
}
color.rgb *= min(u_lightsAmbient3f + vec3(diffuse), 1.0);
#endif
#ifdef COMPILE_BLEND_ADD
color.rgba = color.rgba * u_colorBlendSrc4f + u_colorBlendAdd4f;
#endif
#ifdef COMPILE_ENABLE_FOG
vec3 fogPos = v_position4f.xyz / v_position4f.w;
float dist = sqrt(dot(fogPos, fogPos));
float fogDensity = u_fogParameters4f.y;
float fogStart = u_fogParameters4f.z;
float fogEnd = u_fogParameters4f.w;
float f = u_fogParameters4f.x > 0.0 ? 1.0 - pow(2.718, -(fogDensity * dist)) :
float f = u_fogParameters4f.x > 0.0 ? 1.0 - exp(-fogDensity * dist) :
(dist - fogStart) / (fogEnd - fogStart);
color.rgb = mix(color.rgb, u_fogColor4f.rgb, clamp(f, 0.0, 1.0) * u_fogColor4f.a);
#endif

View File

@ -50,29 +50,29 @@ out vec2 v_lightmap2f;
uniform mat4 u_textureMat4f02;
#endif
#ifdef _COMPILE_VARYING_POSITION
uniform mat4 u_modelviewMat4f;
uniform mat4 u_projectionMat4f;
#else
uniform mat4 u_modelviewProjMat4f;
#ifdef COMPILE_NORMAL_ATTRIB
uniform mat4 u_modelviewMat4f;
#endif
#endif
#define TEX_MAT3(mat4In) mat3(mat4In[0].xyw,mat4In[1].xyw,mat4In[3].xyw)
void main() {
#ifdef COMPILE_ENABLE_TEX_GEN
v_objectPosition3f = a_position3f;
#endif
vec4 pos = u_modelviewMat4f * vec4(a_position3f, 1.0);
#ifdef _COMPILE_VARYING_POSITION
v_position4f = pos;
v_position4f = u_modelviewMat4f * vec4(a_position3f, 1.0);
#endif
#ifdef COMPILE_TEXTURE_ATTRIB
mat4x3 texMat4x3 = mat4x3(
u_textureMat4f01[0].xyw,
u_textureMat4f01[1].xyw,
u_textureMat4f01[2].xyw,
u_textureMat4f01[3].xyw
);
vec3 v_textureTmp3f = texMat4x3 * vec4(a_texture2f, 0.0, 1.0);
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
#endif
@ -85,19 +85,13 @@ void main() {
#endif
#ifdef COMPILE_LIGHTMAP_ATTRIB
#ifdef COMPILE_TEXTURE_ATTRIB
texMat4x3 = mat4x3(
#else
mat4x3 texMat4x3 = mat4x3(
#endif
u_textureMat4f02[0].xyw,
u_textureMat4f02[1].xyw,
u_textureMat4f02[2].xyw,
u_textureMat4f02[3].xyw
);
vec3 v_lightmapTmp3f = texMat4x3 * vec4(a_lightmap2f, 0.0, 1.0);
vec3 v_lightmapTmp3f = TEX_MAT3(u_textureMat4f02) * vec3(a_lightmap2f, 1.0);
v_lightmap2f = v_lightmapTmp3f.xy / v_lightmapTmp3f.z;
#endif
gl_Position = u_projectionMat4f * pos;
#ifdef _COMPILE_VARYING_POSITION
gl_Position = u_projectionMat4f * v_position4f;
#else
gl_Position = u_modelviewProjMat4f * vec4(a_position3f, 1.0);
#endif
}

View File

@ -0,0 +1,72 @@
#line 2
/*
* Copyright (c) 2023 LAX1DUDE. All Rights Reserved.
*
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
*
* NOT FOR COMMERCIAL OR MALICIOUS USE
*
* (please read the 'LICENSE' file this repo's root directory for more info)
*
*/
precision lowp int;
precision highp float;
precision mediump sampler2D;
layout(location = 0) in vec2 a_position2f;
layout(location = 1) in vec3 p_position3f;
layout(location = 2) in vec2 p_texCoords2i;
layout(location = 3) in vec2 p_lightMap2f;
layout(location = 4) in vec2 p_particleSize_texCoordsSize_2i;
layout(location = 5) in vec4 p_color4f;
out vec2 v_texCoord2f;
out vec4 v_color4f;
out vec2 v_lightmap2f;
#ifdef COMPILE_FORWARD_VSH
out vec4 v_position4f;
uniform mat4 u_modelViewMatrix4f;
uniform mat4 u_projectionMatrix4f;
#endif
#ifdef COMPILE_GBUFFER_VSH
uniform mat4 u_matrixTransform;
#endif
uniform vec3 u_texCoordSize2f_particleSize1f;
uniform vec4 u_transformParam_1_2_3_4_f;
uniform float u_transformParam_5_f;
void main() {
v_color4f = p_color4f.bgra;
v_lightmap2f = p_lightMap2f;
vec2 tex2f = a_position2f * 0.5 + 0.5;
tex2f.y = 1.0 - tex2f.y;
tex2f = p_texCoords2i + tex2f * p_particleSize_texCoordsSize_2i.y;
v_texCoord2f = tex2f * u_texCoordSize2f_particleSize1f.xy;
float particleSize = u_texCoordSize2f_particleSize1f.z * p_particleSize_texCoordsSize_2i.x;
vec3 pos3f = p_position3f;
pos3f.x += u_transformParam_1_2_3_4_f.x * particleSize * a_position2f.x;
pos3f.x += u_transformParam_1_2_3_4_f.w * particleSize * a_position2f.y;
pos3f.y += u_transformParam_1_2_3_4_f.y * particleSize * a_position2f.y;
pos3f.z += u_transformParam_1_2_3_4_f.z * particleSize * a_position2f.x;
pos3f.z += u_transformParam_5_f * particleSize * a_position2f.y;
#ifdef COMPILE_GBUFFER_VSH
gl_Position = u_matrixTransform * vec4(pos3f, 1.0);
#endif
#ifdef COMPILE_FORWARD_VSH
v_position4f = u_modelViewMatrix4f * vec4(pos3f, 1.0);
gl_Position = u_projectionMatrix4f * v_position4f;
#endif
}

View File

@ -0,0 +1,233 @@
#line 2
/*
* Copyright (c) 2023 LAX1DUDE. All Rights Reserved.
*
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
*
* NOT FOR COMMERCIAL OR MALICIOUS USE
*
* (please read the 'LICENSE' file this repo's root directory for more info)
*
*/
precision lowp int;
precision highp float;
precision mediump sampler2D;
precision highp sampler2DShadow;
in vec4 v_position4f;
in vec2 v_texCoord2f;
in vec4 v_color4f;
in vec2 v_lightmap2f;
layout(location = 0) out vec4 output4f;
uniform sampler2D u_diffuseTexture;
uniform vec2 u_textureYScale2f;
uniform mat4 u_inverseViewMatrix4f;
#ifdef COMPILE_DYNAMIC_LIGHTS
struct DynamicLight {
mediump vec4 u_lightPosition4f;
mediump vec4 u_lightColor4f;
};
layout(std140) uniform u_chunkLightingData {
mediump int u_dynamicLightCount1i;
mediump int _paddingA_;
mediump int _paddingB_;
mediump int _paddingC_;
DynamicLight u_dynamicLightArray[12];
};
#endif
layout(std140) uniform u_worldLightingData {
mediump vec4 u_sunDirection4f;
mediump vec4 u_sunColor3f_sky1f;
mediump vec4 u_fogParameters4f;
mediump vec4 u_fogColorLight4f;
mediump vec4 u_fogColorDark4f;
mediump vec4 u_fogColorAddSun4f;
mediump vec4 u_blockSkySunDynamicLightFac4f;
#ifdef COMPILE_SUN_SHADOW_LOD0
mediump mat4 u_sunShadowMatrixLOD04f;
#define DO_COMPILE_SUN_SHADOWS
#define SUN_SHADOW_MAP_FRAC 1.0
#endif
#ifdef COMPILE_SUN_SHADOW_LOD1
mediump mat4 u_sunShadowMatrixLOD04f;
mediump mat4 u_sunShadowMatrixLOD14f;
#define DO_COMPILE_SUN_SHADOWS
#define SUN_SHADOW_MAP_FRAC 0.5
#endif
#ifdef COMPILE_SUN_SHADOW_LOD2
mediump mat4 u_sunShadowMatrixLOD04f;
mediump mat4 u_sunShadowMatrixLOD14f;
mediump mat4 u_sunShadowMatrixLOD24f;
#define DO_COMPILE_SUN_SHADOWS
#define SUN_SHADOW_MAP_FRAC 0.3333333
#endif
};
uniform sampler2D u_samplerNormalMaterial;
uniform sampler2D u_metalsLUT;
#define LIB_INCLUDE_PBR_LIGHTING_FUNCTION
#define LIB_INCLUDE_PBR_LIGHTING_PREFETCH
#EAGLER INCLUDE (3) "eagler:glsl/deferred/lib/pbr_lighting.glsl"
uniform sampler2D u_irradianceMap;
#ifdef DO_COMPILE_SUN_SHADOWS
uniform sampler2DShadow u_sunShadowDepthTexture;
#endif
void main() {
vec4 worldPosition4f;
vec4 worldDirection4f;
vec4 diffuseColor4f;
vec3 normalVector3f;
vec2 lightmapCoords2f;
vec3 materialData3f;
// =========== RESOLVE CONSTANTS ============ //
worldPosition4f = u_inverseViewMatrix4f * v_position4f;
worldPosition4f.xyz /= worldPosition4f.w;
worldPosition4f.w = 1.0;
worldDirection4f = u_inverseViewMatrix4f * vec4(v_position4f.xyz / v_position4f.w, 0.0);
worldDirection4f.xyz = normalize(worldDirection4f.xyz);
lightmapCoords2f = v_lightmap2f;
normalVector3f = normalize(u_inverseViewMatrix4f[2].xyz);
// ========= CALCULATE DIFFUSE COLOR ========== //
diffuseColor4f = texture(u_diffuseTexture, v_texCoord2f) * v_color4f;
// ============= ALPHA TEST ============== //
if(diffuseColor4f.a < 0.004) discard;
// ========== RESOLVE MATERIALS =========== //
materialData3f = texture(u_samplerNormalMaterial, vec2(v_texCoord2f.x, v_texCoord2f.y * u_textureYScale2f.x + u_textureYScale2f.y)).rgb;
vec3 metalN, metalK;
PREFETCH_METALS(diffuseColor4f.rgb, materialData3f.g, metalN, metalK)
// ============ SUN LIGHTING ============== //
diffuseColor4f.rgb *= diffuseColor4f.rgb;
vec3 lightColor3f = vec3(0.0);
if(dot(u_sunDirection4f.xyz, normalVector3f) > 0.0 && lightmapCoords2f.g > 0.5 &&
(u_sunColor3f_sky1f.r + u_sunColor3f_sky1f.g + u_sunColor3f_sky1f.b) > 0.001) {
#ifdef DO_COMPILE_SUN_SHADOWS
// ========== SUN SHADOW: LOD0 ============ //
float skyLight = max(lightmapCoords2f.g * 2.0 - 1.0, 0.0);
float shadowSample = 1.0;
vec4 shadowWorldPos4f = worldPosition4f;
shadowWorldPos4f.xyz += normalVector3f * 0.05;
vec4 shadowTexPos4f;
vec2 tmpVec2;
for(;;) {
shadowTexPos4f = u_sunShadowMatrixLOD04f * shadowWorldPos4f;
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy * vec2(1.0, SUN_SHADOW_MAP_FRAC), shadowTexPos4f.z), 0.0);
break;
}
#if defined(COMPILE_SUN_SHADOW_LOD1) || defined(COMPILE_SUN_SHADOW_LOD2)
shadowTexPos4f = u_sunShadowMatrixLOD14f * shadowWorldPos4f;
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
shadowTexPos4f.y += 1.0;
shadowTexPos4f.y *= SUN_SHADOW_MAP_FRAC;
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy, shadowTexPos4f.z + 0.00015), 0.0);
break;
}
#endif
#ifdef COMPILE_SUN_SHADOW_LOD2
shadowTexPos4f = u_sunShadowMatrixLOD24f * shadowWorldPos4f;
if(shadowTexPos4f.xyz == clamp(shadowTexPos4f.xyz, vec3(0.005), vec3(0.995))) {
shadowTexPos4f.y += 2.0;
shadowTexPos4f.y *= SUN_SHADOW_MAP_FRAC;
shadowSample = textureLod(u_sunShadowDepthTexture, vec3(shadowTexPos4f.xy, shadowTexPos4f.z + 0.00015), 0.0);
}
#endif
break;
}
#endif
lightColor3f = u_sunColor3f_sky1f.rgb * max(lightmapCoords2f.g * 2.0 - 1.0, 0.0);
#ifdef DO_COMPILE_SUN_SHADOWS
lightColor3f *= shadowSample * skyLight;
#endif
vec3 normalWrap3f = normalVector3f * (dot(-worldDirection4f.xyz, normalVector3f) < 0.0 ? -1.0 : 1.0);
lightColor3f = eaglercraftLighting(diffuseColor4f.rgb, lightColor3f, -worldDirection4f.xyz, u_sunDirection4f.xyz, normalWrap3f, materialData3f, metalN, metalK) * u_blockSkySunDynamicLightFac4f.z;
}
// =========== IRRADIANCE MAP =========== //
lightmapCoords2f *= lightmapCoords2f;
vec3 irradianceMapSamplePos2f = normalVector3f;
irradianceMapSamplePos2f.xz /= abs(irradianceMapSamplePos2f.y) + 1.0;
float dst = 1.0 - dot(irradianceMapSamplePos2f.xz, irradianceMapSamplePos2f.xz);
dst *= dst;
irradianceMapSamplePos2f.xz *= 0.975;
vec3 skyLight = vec3(sqrt(0.01 + max(u_sunDirection4f.w, 0.0)));
if(dst < 0.005) {
vec4 sample1 = textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz * vec2(0.5, 0.25) + vec2(0.5, 0.25), 0.0);
vec4 sample2 = textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz * vec2(0.5, -0.25) + vec2(0.5, 0.75), 0.0);
skyLight += mix(sample1.rgb, sample2.rgb, smoothstep(0.0, 1.0, irradianceMapSamplePos2f.y * -12.5 + 0.5)).rgb;
}else {
irradianceMapSamplePos2f.xz *= vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : -0.25);
irradianceMapSamplePos2f.xz += vec2(0.5, irradianceMapSamplePos2f.y > 0.0 ? 0.25 : 0.75);
skyLight += textureLod(u_irradianceMap, irradianceMapSamplePos2f.xz, 0.0).rgb;
}
skyLight *= lightmapCoords2f.g * u_sunColor3f_sky1f.w;
#ifdef COMPILE_DYNAMIC_LIGHTS
// =========== DYNAMIC LIGHTING =========== //
vec3 dlightDist3f, dlightDir3f, dlightColor3f;
int safeLightCount = u_dynamicLightCount1i > 12 ? 0 : u_dynamicLightCount1i; // hate this
for(int i = 0; i < safeLightCount; ++i) {
dlightDist3f = worldPosition4f.xyz - u_dynamicLightArray[i].u_lightPosition4f.xyz;
dlightDir3f = normalize(dlightDist3f);
dlightDir3f = dlightDir3f * (dot(dlightDir3f, normalVector3f) < 0.0 ? 1.0 : -1.0);
dlightDir3f = materialData3f.b == 1.0 ? normalVector3f : -dlightDir3f;
if(dot(dlightDir3f, normalVector3f) <= 0.0) {
continue;
}
dlightColor3f = u_dynamicLightArray[i].u_lightColor4f.rgb / dot(dlightDist3f, dlightDist3f);
if(dlightColor3f.r + dlightColor3f.g + dlightColor3f.b < 0.025) {
continue;
}
lightColor3f += eaglercraftLighting(diffuseColor4f.rgb, dlightColor3f, -worldDirection4f.xyz, dlightDir3f, normalVector3f, materialData3f, metalN, metalK) * u_blockSkySunDynamicLightFac4f.w;
}
#endif
// ============ OUTPUT COLOR ============== //
vec3 blockLight = lightmapCoords2f.r * vec3(1.0, 0.5809, 0.2433) * 2.0 * u_blockSkySunDynamicLightFac4f.x;
skyLight *= u_blockSkySunDynamicLightFac4f.y;
float emissive = materialData3f.b == 1.0 ? 0.0 : materialData3f.b;
diffuseColor4f.rgb *= max(skyLight + blockLight, vec3(emissive * emissive * 20.0 + 0.075)) * 0.075;
diffuseColor4f.rgb += lightColor3f;
output4f = vec4(diffuseColor4f.rgb * diffuseColor4f.a, diffuseColor4f.a);
}

View File

@ -0,0 +1,42 @@
#line 2
/*
* Copyright (c) 2023 LAX1DUDE. All Rights Reserved.
*
* WITH THE EXCEPTION OF PATCH FILES, MINIFIED JAVASCRIPT, AND ALL FILES
* NORMALLY FOUND IN AN UNMODIFIED MINECRAFT RESOURCE PACK, YOU ARE NOT ALLOWED
* TO SHARE, DISTRIBUTE, OR REPURPOSE ANY FILE USED BY OR PRODUCED BY THE
* SOFTWARE IN THIS REPOSITORY WITHOUT PRIOR PERMISSION FROM THE PROJECT AUTHOR.
*
* NOT FOR COMMERCIAL OR MALICIOUS USE
*
* (please read the 'LICENSE' file this repo's root directory for more info)
*
*/
precision lowp int;
precision mediump float;
precision mediump sampler2D;
in vec2 v_texCoord2f;
in vec4 v_color4f;
in vec2 v_lightmap2f;
layout(location = 0) out vec4 gbufferColor4f;
layout(location = 1) out vec4 gbufferNormal4f;
layout(location = 2) out vec4 gbufferMaterial4f;
uniform sampler2D u_diffuseTexture;
uniform sampler2D u_samplerNormalMaterial;
uniform vec2 u_textureYScale2f;
void main() {
vec4 diffuseRGBA = texture(u_diffuseTexture, v_texCoord2f) * v_color4f;
if(diffuseRGBA.a < 0.004) {
discard;
}
gbufferColor4f = vec4(diffuseRGBA.rgb, v_lightmap2f.r);
gbufferNormal4f = vec4(0.5, 0.5, 1.0, v_lightmap2f.g);
gbufferMaterial4f = vec4(texture(u_samplerNormalMaterial, vec2(v_texCoord2f.x, v_texCoord2f.y * u_textureYScale2f.x + u_textureYScale2f.y)).rgb, 1.0);
}

View File

@ -0,0 +1 @@
these are just low quality fallback material textures for the default vanilla resource pack when no PBR resource pack is loaded, if you would like to make a PBR resource pack put your _n and _s textures in the "/assets/minecraft/textures/" directory of your zip file, do not modify any files within "/assets/eagler/glsl/deferred/assets_pbr/textures/" because they will not be recognized

Some files were not shown because too many files have changed in this diff Show More