u34
This commit is contained in:
parent
cfab2e85bf
commit
16648bc6c8
|
@ -33,8 +33,8 @@ out vec4 v_color4f;
|
|||
|
||||
uniform mat4 u_matrixTransform;
|
||||
uniform vec3 u_texCoordSize2f_particleSize1f;
|
||||
uniform vec4 u_transformParam_1_2_3_4_f;
|
||||
uniform float u_transformParam_5_f;
|
||||
uniform vec3 u_transformParam_1_2_5_f;
|
||||
uniform vec2 u_transformParam_3_4_f;
|
||||
uniform vec4 u_color4f;
|
||||
|
||||
uniform sampler2D u_lightmapTexture;
|
||||
|
@ -51,11 +51,8 @@ void main() {
|
|||
|
||||
vec3 pos3f = p_position3f;
|
||||
vec2 spos2f = a_position2f * particleSize;
|
||||
pos3f.x += u_transformParam_1_2_3_4_f.x * spos2f.x;
|
||||
pos3f.x += u_transformParam_1_2_3_4_f.w * spos2f.y;
|
||||
pos3f.y += u_transformParam_1_2_3_4_f.y * spos2f.y;
|
||||
pos3f.z += u_transformParam_1_2_3_4_f.z * spos2f.x;
|
||||
pos3f.z += u_transformParam_5_f * spos2f.y;
|
||||
pos3f += u_transformParam_1_2_5_f * spos2f.xyy;
|
||||
pos3f.zx += u_transformParam_3_4_f * spos2f;
|
||||
|
||||
gl_Position = u_matrixTransform * vec4(pos3f, 1.0);
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ 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;
|
||||
uniform vec3 u_transformParam_1_2_5_f;
|
||||
uniform vec2 u_transformParam_3_4_f;
|
||||
|
||||
void main() {
|
||||
v_color4f = p_color4f.bgra;
|
||||
|
@ -59,11 +59,8 @@ void main() {
|
|||
|
||||
vec3 pos3f = p_position3f;
|
||||
vec2 spos2f = a_position2f * particleSize;
|
||||
pos3f.x += u_transformParam_1_2_3_4_f.x * spos2f.x;
|
||||
pos3f.x += u_transformParam_1_2_3_4_f.w * spos2f.y;
|
||||
pos3f.y += u_transformParam_1_2_3_4_f.y * spos2f.y;
|
||||
pos3f.z += u_transformParam_1_2_3_4_f.z * spos2f.x;
|
||||
pos3f.z += u_transformParam_5_f * spos2f.y;
|
||||
pos3f += u_transformParam_1_2_5_f * spos2f.xyy;
|
||||
pos3f.zx += u_transformParam_3_4_f * spos2f;
|
||||
|
||||
#ifdef COMPILE_GBUFFER_VSH
|
||||
gl_Position = u_matrixTransform * vec4(pos3f, 1.0);
|
||||
|
|
|
@ -7,3 +7,4 @@ minecraft:redstone_torch,0,1.0000,0.1578,0.0000,4.0
|
|||
minecraft:sea_lantern,0,0.5530,0.6468,1.0000,10.0,
|
||||
minecraft:lava_bucket,0,1.0000,0.4461,0.1054,6.0,
|
||||
minecraft:nether_star,0,0.5711,0.6611,1.0000,6.0
|
||||
minecraft:ender_eye,0,0.1990,0.7750,0.4130,4.0
|
|
|
@ -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.1.0",
|
||||
"vers": "1.2.0",
|
||||
"author": "lax1dude",
|
||||
"api_vers": 1,
|
||||
"features": [
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
#line 2
|
||||
|
||||
/*
|
||||
* Copyright (c) 2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
precision lowp int;
|
||||
precision mediump float;
|
||||
precision mediump sampler2D;
|
||||
|
||||
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_inputTexture;
|
||||
uniform sampler2D u_lightmapTexture;
|
||||
|
||||
uniform mat4 u_inverseViewMatrix4f;
|
||||
|
||||
layout(std140) uniform u_chunkLightingData {
|
||||
mediump int u_dynamicLightCount1i;
|
||||
mediump int _paddingA_;
|
||||
mediump int _paddingB_;
|
||||
mediump int _paddingC_;
|
||||
mediump vec4 u_dynamicLightArray[12];
|
||||
};
|
||||
|
||||
void main() {
|
||||
vec4 color = texture(u_inputTexture, v_texCoord2f) * v_color4f;
|
||||
|
||||
if(color.a < 0.004) {
|
||||
discard;
|
||||
}
|
||||
|
||||
vec4 light;
|
||||
float diffuse = 0.0;
|
||||
if(u_dynamicLightCount1i > 0) {
|
||||
vec4 worldPosition4f = u_inverseViewMatrix4f * v_position4f;
|
||||
worldPosition4f.xyz /= worldPosition4f.w;
|
||||
vec3 normalVector3f = normalize(u_inverseViewMatrix4f[2].xyz);
|
||||
int safeLightCount = u_dynamicLightCount1i > 12 ? 0 : u_dynamicLightCount1i;
|
||||
for(int i = 0; i < safeLightCount; ++i) {
|
||||
light = u_dynamicLightArray[i];
|
||||
light.xyz = light.xyz - worldPosition4f.xyz;
|
||||
diffuse += max(dot(normalize(light.xyz), normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - sqrt(dot(light.xyz, light.xyz)), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
color *= texture(u_lightmapTexture, vec2(min(v_lightmap2f.x + diffuse * 0.066667, 1.0), v_lightmap2f.y));
|
||||
|
||||
output4f = color;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
#line 2
|
||||
|
||||
/*
|
||||
* Copyright (c) 2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
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 vec4 v_position4f;
|
||||
out vec2 v_texCoord2f;
|
||||
out vec4 v_color4f;
|
||||
out vec2 v_lightmap2f;
|
||||
|
||||
uniform mat4 u_modelViewMatrix4f;
|
||||
uniform mat4 u_projectionMatrix4f;
|
||||
uniform vec3 u_texCoordSize2f_particleSize1f;
|
||||
uniform vec3 u_transformParam_1_2_5_f;
|
||||
uniform vec2 u_transformParam_3_4_f;
|
||||
uniform vec4 u_color4f;
|
||||
|
||||
void main() {
|
||||
v_color4f = u_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;
|
||||
vec2 spos2f = a_position2f * particleSize;
|
||||
pos3f += u_transformParam_1_2_5_f * spos2f.xyy;
|
||||
pos3f.zx += u_transformParam_3_4_f * spos2f;
|
||||
|
||||
v_position4f = u_modelViewMatrix4f * vec4(pos3f, 1.0);
|
||||
gl_Position = u_projectionMatrix4f * v_position4f;
|
||||
}
|
210
desktopRuntime/resources/assets/eagler/glsl/dynamiclights/core_dynamiclights.fsh
Executable file
210
desktopRuntime/resources/assets/eagler/glsl/dynamiclights/core_dynamiclights.fsh
Executable file
|
@ -0,0 +1,210 @@
|
|||
#line 2
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022-2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
in vec4 v_position4f;
|
||||
|
||||
#ifdef COMPILE_TEXTURE_ATTRIB
|
||||
in vec2 v_texture2f;
|
||||
#endif
|
||||
|
||||
uniform vec4 u_color4f;
|
||||
|
||||
#ifdef COMPILE_BLEND_ADD
|
||||
uniform vec4 u_colorBlendSrc4f;
|
||||
uniform vec4 u_colorBlendAdd4f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_COLOR_ATTRIB
|
||||
in vec4 v_color4f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_NORMAL_ATTRIB
|
||||
in vec3 v_normal3f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_LIGHTMAP_ATTRIB
|
||||
in vec2 v_lightmap2f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_ENABLE_TEXTURE2D
|
||||
uniform sampler2D u_samplerTexture;
|
||||
#if !defined(COMPILE_TEXTURE_ATTRIB) && !defined(COMPILE_ENABLE_TEX_GEN)
|
||||
uniform vec2 u_textureCoords01;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_ENABLE_LIGHTMAP
|
||||
uniform sampler2D u_samplerLightmap;
|
||||
#ifndef COMPILE_LIGHTMAP_ATTRIB
|
||||
uniform vec2 u_textureCoords02;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_ENABLE_ALPHA_TEST
|
||||
uniform float u_alphaTestRef1f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_ENABLE_MC_LIGHTING
|
||||
uniform int u_lightsEnabled1i;
|
||||
uniform vec4 u_lightsDirections4fv[4];
|
||||
uniform vec3 u_lightsAmbient3f;
|
||||
#endif
|
||||
|
||||
#ifndef COMPILE_NORMAL_ATTRIB
|
||||
uniform vec3 u_uniformNormal3f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_ENABLE_FOG
|
||||
uniform vec4 u_fogParameters4f;
|
||||
uniform vec4 u_fogColor4f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_ENABLE_TEX_GEN
|
||||
in vec3 v_objectPosition3f;
|
||||
uniform ivec4 u_texGenPlane4i;
|
||||
uniform vec4 u_texGenS4f;
|
||||
uniform vec4 u_texGenT4f;
|
||||
uniform vec4 u_texGenR4f;
|
||||
uniform vec4 u_texGenQ4f;
|
||||
uniform mat4 u_textureMat4f01;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_ENABLE_ANISOTROPIC_FIX
|
||||
uniform vec2 u_textureAnisotropicFix;
|
||||
#endif
|
||||
|
||||
uniform mat4 u_inverseViewMatrix4f;
|
||||
|
||||
layout(std140) uniform u_chunkLightingData {
|
||||
mediump int u_dynamicLightCount1i;
|
||||
mediump int _paddingA_;
|
||||
mediump int _paddingB_;
|
||||
mediump int _paddingC_;
|
||||
mediump vec4 u_dynamicLightArray[12];
|
||||
};
|
||||
|
||||
layout(location = 0) out vec4 output4f;
|
||||
|
||||
void main() {
|
||||
|
||||
#ifdef COMPILE_COLOR_ATTRIB
|
||||
vec4 color = v_color4f * u_color4f;
|
||||
#else
|
||||
vec4 color = u_color4f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_ENABLE_TEX_GEN
|
||||
vec4 texGenVector;
|
||||
|
||||
vec4 texGenPosSrc[2];
|
||||
texGenPosSrc[0] = vec4(v_objectPosition3f, 1.0);
|
||||
texGenPosSrc[1] = v_position4f;
|
||||
|
||||
texGenVector.x = dot(texGenPosSrc[u_texGenPlane4i.x], u_texGenS4f);
|
||||
texGenVector.y = dot(texGenPosSrc[u_texGenPlane4i.y], u_texGenT4f);
|
||||
texGenVector.z = dot(texGenPosSrc[u_texGenPlane4i.z], u_texGenR4f);
|
||||
texGenVector.w = dot(texGenPosSrc[u_texGenPlane4i.w], u_texGenQ4f);
|
||||
|
||||
texGenVector = u_textureMat4f01 * texGenVector;
|
||||
color *= texture(u_samplerTexture, texGenVector.xy / texGenVector.w);
|
||||
|
||||
#ifdef COMPILE_ENABLE_ALPHA_TEST
|
||||
if(color.a < u_alphaTestRef1f) discard;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef COMPILE_ENABLE_TEXTURE2D
|
||||
#ifdef COMPILE_TEXTURE_ATTRIB
|
||||
#ifdef COMPILE_ENABLE_ANISOTROPIC_FIX
|
||||
// d3d11 doesn't support GL_NEAREST upscaling with anisotropic
|
||||
// filtering enabled, so it needs this stupid fix to 'work'
|
||||
vec2 uv = floor(v_texture2f * u_textureAnisotropicFix) + 0.5;
|
||||
color *= texture(u_samplerTexture, uv / u_textureAnisotropicFix);
|
||||
#else
|
||||
color *= texture(u_samplerTexture, v_texture2f);
|
||||
#endif
|
||||
#else
|
||||
color *= texture(u_samplerTexture, u_textureCoords01);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_NORMAL_ATTRIB
|
||||
vec3 normal = normalize(v_normal3f);
|
||||
#else
|
||||
vec3 normal = u_uniformNormal3f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_ENABLE_LIGHTMAP
|
||||
float diffuse = 0.0;
|
||||
vec4 light;
|
||||
if(u_dynamicLightCount1i > 0) {
|
||||
vec4 worldPosition4f = u_inverseViewMatrix4f * v_position4f;
|
||||
worldPosition4f.xyz /= worldPosition4f.w;
|
||||
vec3 normalVector3f = normalize(mat3(u_inverseViewMatrix4f) * normal);
|
||||
int safeLightCount = u_dynamicLightCount1i > 12 ? 0 : u_dynamicLightCount1i;
|
||||
for(int i = 0; i < safeLightCount; ++i) {
|
||||
light = u_dynamicLightArray[i];
|
||||
light.xyz = light.xyz - worldPosition4f.xyz;
|
||||
diffuse += max(dot(normalize(light.xyz), normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - sqrt(dot(light.xyz, light.xyz)), 0.0);
|
||||
}
|
||||
}
|
||||
#ifdef COMPILE_LIGHTMAP_ATTRIB
|
||||
color *= texture(u_samplerLightmap, vec2(min(v_lightmap2f.x + diffuse * 0.066667, 1.0), v_lightmap2f.y));
|
||||
#else
|
||||
color *= texture(u_samplerLightmap, vec2(min(u_textureCoords02.x + diffuse * 0.066667, 1.0), u_textureCoords02.y));
|
||||
#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
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_ENABLE_MC_LIGHTING
|
||||
#ifndef COMPILE_ENABLE_LIGHTMAP
|
||||
vec4 light;
|
||||
float diffuse = 0.0;
|
||||
#else
|
||||
diffuse = 0.0;
|
||||
#endif
|
||||
for(int i = 0; i < u_lightsEnabled1i; ++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_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 - 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
|
||||
|
||||
output4f = color;
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
#line 2
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022-2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
in vec3 a_position3f;
|
||||
|
||||
out vec4 v_position4f;
|
||||
|
||||
#ifdef COMPILE_ENABLE_TEX_GEN
|
||||
out vec3 v_objectPosition3f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_TEXTURE_ATTRIB
|
||||
in vec2 a_texture2f;
|
||||
out vec2 v_texture2f;
|
||||
uniform mat4 u_textureMat4f01;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_COLOR_ATTRIB
|
||||
in vec4 a_color4f;
|
||||
out vec4 v_color4f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_NORMAL_ATTRIB
|
||||
in vec4 a_normal4f;
|
||||
out vec3 v_normal3f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_LIGHTMAP_ATTRIB
|
||||
in vec2 a_lightmap2f;
|
||||
out vec2 v_lightmap2f;
|
||||
uniform mat4 u_textureMat4f02;
|
||||
#endif
|
||||
|
||||
uniform mat4 u_modelviewMat4f;
|
||||
uniform mat4 u_projectionMat4f;
|
||||
|
||||
#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
|
||||
|
||||
v_position4f = u_modelviewMat4f * vec4(a_position3f, 1.0);
|
||||
|
||||
#ifdef COMPILE_TEXTURE_ATTRIB
|
||||
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
|
||||
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_COLOR_ATTRIB
|
||||
v_color4f = a_color4f;
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_NORMAL_ATTRIB
|
||||
v_normal3f = normalize(mat3(u_modelviewMat4f) * a_normal4f.xyz);
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_LIGHTMAP_ATTRIB
|
||||
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 * v_position4f;
|
||||
}
|
9
desktopRuntime/resources/assets/eagler/mesh/readme.txt
Executable file
9
desktopRuntime/resources/assets/eagler/mesh/readme.txt
Executable file
|
@ -0,0 +1,9 @@
|
|||
THESE ARE NOT DOOM/GMOD MODELS!
|
||||
|
||||
The FNAW skins are stored in a proprietary format created by lax1dude.
|
||||
|
||||
The format is a container for raw OpenGL vertex buffer and index buffer data intended to be copied directly into the GPU's memory, along with a small amount of metadata.
|
||||
|
||||
Data is rendered in GL_TRIANGLES mode using glDrawElements.
|
||||
|
||||
See "net/lax1dude/eaglercraft/v1_8/opengl/EaglerMeshLoader.java" and "net/lax1dude/eaglercraft/v1_8/opengl/HighPolyMesh.java" for more details.
|
|
@ -129,6 +129,7 @@ eaglercraft.options.fastMath=Fast Math
|
|||
eaglercraft.options.fastMath.0=OFF
|
||||
eaglercraft.options.fastMath.1=Low
|
||||
eaglercraft.options.fastMath.2=High
|
||||
eaglercraft.options.dynamicLights=Dynamic Lights
|
||||
|
||||
eaglercraft.key.function=Function
|
||||
eaglercraft.key.zoomCamera=Zoom Camera
|
||||
|
@ -576,7 +577,12 @@ eaglercraft.singleplayer.demo.create.create.tooltip=Play the Minecraft 1.8 demo
|
|||
eaglercraft.singleplayer.demo.create.join=Join Shared World
|
||||
eaglercraft.singleplayer.demo.create.join.tooltip=Join someone else's world and play multiplayer
|
||||
|
||||
eaglercraft.createWorld.seedNote=Note: Vanilla seeds do not work!
|
||||
eaglercraft.createWorld.seedNote=Note: Vanilla seeds now work!
|
||||
|
||||
eaglercraft.singleplayer.oldseedwarning.title=Old World Detected!
|
||||
eaglercraft.singleplayer.oldseedwarning.msg1=Please use EaglercraftX u32 or older to "Re-Create" this world
|
||||
eaglercraft.singleplayer.oldseedwarning.msg2=The world's seed will not be the same otherwise :(
|
||||
eaglercraft.singleplayer.oldseedwarning.ok=OK
|
||||
|
||||
eaglercraft.singleplayer.outdatedLANServerKick=This is a 1.5.2 LAN world!
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.3","pluginButton":"Download \"EaglerXBungee-1.2.3.jar\"","pluginFilename":"EaglerXBungee.zip"}
|
||||
{"pluginName":"EaglercraftXBungee","pluginVersion":"1.2.5","pluginButton":"Download \"EaglerXBungee-1.2.5.jar\"","pluginFilename":"EaglerXBungee.zip"}
|
|
@ -3,7 +3,7 @@ package net.lax1dude.eaglercraft.v1_8;
|
|||
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022 lax1dude. All Rights Reserved.
|
||||
* Copyright (c) 2022-2024 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
|
||||
|
@ -25,19 +25,46 @@ public class EaglercraftRandom {
|
|||
|
||||
private static final double DOUBLE_UNIT = 0x1.0p-53;
|
||||
private long seed = 69;
|
||||
|
||||
private static int yee = 0;
|
||||
private final boolean enableScramble;
|
||||
|
||||
public EaglercraftRandom() {
|
||||
this(PlatformRuntime.randomSeed());
|
||||
}
|
||||
|
||||
public EaglercraftRandom(long seed) {
|
||||
this(seed, true);
|
||||
}
|
||||
|
||||
public EaglercraftRandom(boolean scramble) {
|
||||
this(PlatformRuntime.randomSeed(), scramble);
|
||||
}
|
||||
|
||||
/**
|
||||
* Older versions of EaglercraftX (and Eaglercraft) are missing the
|
||||
* "initialScramble" function from their setSeed function, which was what caused
|
||||
* world generation to not match vanilla. The "enableScramble" boolean is used
|
||||
* when players play on an old world created before the bug was fixed.
|
||||
*/
|
||||
public EaglercraftRandom(long seed, boolean scramble) {
|
||||
enableScramble = scramble;
|
||||
setSeed(seed);
|
||||
}
|
||||
|
||||
private static long initialScramble(long seed) {
|
||||
return (seed ^ multiplier) & mask;
|
||||
}
|
||||
|
||||
public void setSeed(long yeed) {
|
||||
seed = yeed;
|
||||
if(enableScramble) {
|
||||
seed = initialScramble(yeed);
|
||||
}else {
|
||||
seed = yeed;
|
||||
}
|
||||
haveNextNextGaussian = true;
|
||||
}
|
||||
|
||||
public boolean isScramble() {
|
||||
return enableScramble;
|
||||
}
|
||||
|
||||
protected int next(int bits) {
|
||||
|
|
|
@ -10,7 +10,7 @@ public class EaglercraftVersion {
|
|||
/// Customize these to fit your fork:
|
||||
|
||||
public static final String projectForkName = "EaglercraftX";
|
||||
public static final String projectForkVersion = "u32";
|
||||
public static final String projectForkVersion = "u34";
|
||||
public static final String projectForkVendor = "lax1dude";
|
||||
|
||||
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
|
||||
|
@ -20,7 +20,7 @@ public class EaglercraftVersion {
|
|||
public static final String projectOriginName = "EaglercraftX";
|
||||
public static final String projectOriginAuthor = "lax1dude";
|
||||
public static final String projectOriginRevision = "1.8";
|
||||
public static final String projectOriginVersion = "u32";
|
||||
public static final String projectOriginVersion = "u34";
|
||||
|
||||
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class EaglercraftVersion {
|
|||
public static final boolean enableUpdateService = true;
|
||||
|
||||
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
|
||||
public static final int updateBundlePackageVersionInt = 32;
|
||||
public static final int updateBundlePackageVersionInt = 34;
|
||||
|
||||
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
|
|||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.StreamBuffer.StreamBufferInstance;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
@ -904,7 +905,9 @@ public class FixedFunctionPipeline {
|
|||
_wglUniform3f(stateLightingAmbientUniform3f, r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(stateEnableMCLighting || DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
if(!stateHasAttribNormal) {
|
||||
serial = GlStateManager.stateNormalSerial;
|
||||
if(stateNormalSerial != serial) {
|
||||
|
|
|
@ -808,6 +808,22 @@ public class GlStateManager {
|
|||
}
|
||||
}
|
||||
|
||||
public static final void getFloat(int pname, FloatBuffer params) {
|
||||
switch(pname) {
|
||||
case GL_MODELVIEW_MATRIX:
|
||||
modelMatrixStack[modelMatrixStackPointer].store(params);
|
||||
break;
|
||||
case GL_PROJECTION_MATRIX:
|
||||
projectionMatrixStack[projectionMatrixStackPointer].store(params);
|
||||
break;
|
||||
case GL_TEXTURE_MATRIX:
|
||||
textureMatrixStack[activeTexture][textureMatrixStackPointer[activeTexture]].store(params);
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("glGetFloat can only be used to retrieve matricies!");
|
||||
}
|
||||
}
|
||||
|
||||
public static final void ortho(double left, double right, double bottom, double top, double zNear, double zFar) {
|
||||
Matrix4f matrix;
|
||||
switch(stateMatrixMode) {
|
||||
|
|
|
@ -49,8 +49,8 @@ public class InstancedParticleRenderer {
|
|||
private static IUniformGL u_matrixTransform = null;
|
||||
private static FloatBuffer matrixCopyBuffer = null;
|
||||
private static IUniformGL u_texCoordSize2f_particleSize1f = null;
|
||||
private static IUniformGL u_transformParam_1_2_3_4_f = null;
|
||||
private static IUniformGL u_transformParam_5_f = null;
|
||||
private static IUniformGL u_transformParam_1_2_5_f = null;
|
||||
private static IUniformGL u_transformParam_3_4_f = null;
|
||||
private static IUniformGL u_color4f = null;
|
||||
|
||||
private static IBufferArrayGL vertexArray = null;
|
||||
|
@ -154,8 +154,8 @@ public class InstancedParticleRenderer {
|
|||
|
||||
u_matrixTransform = _wglGetUniformLocation(shaderProgram, "u_matrixTransform");
|
||||
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(shaderProgram, "u_texCoordSize2f_particleSize1f");
|
||||
u_transformParam_1_2_3_4_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_1_2_3_4_f");
|
||||
u_transformParam_5_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_5_f");
|
||||
u_transformParam_1_2_5_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_1_2_5_f");
|
||||
u_transformParam_3_4_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_3_4_f");
|
||||
u_color4f = _wglGetUniformLocation(shaderProgram, "u_color4f");
|
||||
|
||||
_wglUniform1i(_wglGetUniformLocation(shaderProgram, "u_inputTexture"), 0);
|
||||
|
@ -260,17 +260,17 @@ public class InstancedParticleRenderer {
|
|||
}
|
||||
|
||||
if (transformParam1 != stateTransformParam1 || transformParam2 != stateTransformParam2
|
||||
|| transformParam3 != stateTransformParam3 || transformParam4 != stateTransformParam4) {
|
||||
_wglUniform4f(u_transformParam_1_2_3_4_f, transformParam1, transformParam2, transformParam3, transformParam4);
|
||||
|| transformParam5 != stateTransformParam5) {
|
||||
_wglUniform3f(u_transformParam_1_2_5_f, transformParam1, transformParam2, transformParam5);
|
||||
stateTransformParam1 = transformParam1;
|
||||
stateTransformParam2 = transformParam2;
|
||||
stateTransformParam3 = transformParam3;
|
||||
stateTransformParam4 = transformParam4;
|
||||
stateTransformParam5 = transformParam5;
|
||||
}
|
||||
|
||||
if (transformParam5 != stateTransformParam5) {
|
||||
_wglUniform1f(u_transformParam_5_f, transformParam5);
|
||||
stateTransformParam5 = transformParam5;
|
||||
if (transformParam3 != stateTransformParam3 || transformParam4 != stateTransformParam4) {
|
||||
_wglUniform2f(u_transformParam_3_4_f, transformParam3, transformParam4);
|
||||
stateTransformParam3 = transformParam3;
|
||||
stateTransformParam4 = transformParam4;
|
||||
}
|
||||
|
||||
int serial = GlStateManager.stateColorSerial;
|
||||
|
@ -319,4 +319,8 @@ public class InstancedParticleRenderer {
|
|||
_wglDrawArraysInstanced(GL_TRIANGLES, 0, 6, particleCount);
|
||||
}
|
||||
|
||||
public static void stupidColorSetHack(IUniformGL color4f) {
|
||||
_wglUniform4f(color4f, GlStateManager.stateColorR, GlStateManager.stateColorG, GlStateManager.stateColorB, GlStateManager.stateColorA);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class DeferredStateManager {
|
|||
}
|
||||
|
||||
public static final boolean isInDeferredPass() {
|
||||
return GlStateManager.isExtensionPipeline();
|
||||
return EaglerDeferredPipeline.instance != null && GlStateManager.isExtensionPipeline();
|
||||
}
|
||||
|
||||
public static final boolean isInForwardPass() {
|
||||
|
@ -153,10 +153,17 @@ public class DeferredStateManager {
|
|||
}
|
||||
|
||||
public static final void reportForwardRenderObjectPosition2(float x, float y, float z) {
|
||||
float posX = (float)((x + TileEntityRendererDispatcher.staticPlayerX) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerX / 16.0) << 4));
|
||||
float posY = (float)((y + TileEntityRendererDispatcher.staticPlayerY) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerY / 16.0) << 4));
|
||||
float posZ = (float)((z + TileEntityRendererDispatcher.staticPlayerZ) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerZ / 16.0) << 4));
|
||||
reportForwardRenderObjectPosition((int)posX, (int)posY, (int)posZ);
|
||||
EaglerDeferredPipeline instance = EaglerDeferredPipeline.instance;
|
||||
if(instance != null && enableForwardRender) {
|
||||
EaglerDeferredConfig cfg = instance.config;
|
||||
if(!cfg.is_rendering_dynamicLights || !cfg.shaderPackInfo.DYNAMIC_LIGHTS) {
|
||||
return;
|
||||
}
|
||||
float posX = (float)((x + TileEntityRendererDispatcher.staticPlayerX) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerX / 16.0) << 4));
|
||||
float posY = (float)((y + TileEntityRendererDispatcher.staticPlayerY) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerY / 16.0) << 4));
|
||||
float posZ = (float)((z + TileEntityRendererDispatcher.staticPlayerZ) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerZ / 16.0) << 4));
|
||||
instance.loadLightSourceBucket((int)posX, (int)posY, (int)posZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void setHDRTranslucentPassBlendFunc() {
|
||||
|
|
|
@ -2049,6 +2049,8 @@ public class EaglerDeferredPipeline {
|
|||
}
|
||||
}
|
||||
|
||||
truncateOverflowingLightBuffers();
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER DYNAMIC LIGHTS");
|
||||
}
|
||||
|
||||
|
@ -2305,6 +2307,19 @@ public class EaglerDeferredPipeline {
|
|||
return radius2 >= 0.0f;
|
||||
}
|
||||
|
||||
private void truncateOverflowingLightBuffers() {
|
||||
for(int i = 0; i < this.lightSourceBuckets.length; ++i) {
|
||||
List<DynamicLightInstance> lst = this.lightSourceBuckets[i];
|
||||
int k = lst.size();
|
||||
if(k > MAX_LIGHTS_PER_CHUNK) {
|
||||
lst.sort(comparatorLightRadius);
|
||||
for(int l = MAX_LIGHTS_PER_CHUNK - 1; l >= MAX_LIGHTS_PER_CHUNK; --l) {
|
||||
lst.remove(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLightSourceUBO() {
|
||||
if(currentLightSourceBucket == null) {
|
||||
currentBoundLightSourceBucket = null;
|
||||
|
@ -2332,7 +2347,6 @@ public class EaglerDeferredPipeline {
|
|||
}
|
||||
}
|
||||
|
||||
private static final List<DynamicLightInstance> tmpListLights = new ArrayList(32);
|
||||
private static final Comparator<DynamicLightInstance> comparatorLightRadius = (l1, l2) -> {
|
||||
return l1.radius < l2.radius ? 1 : -1;
|
||||
};
|
||||
|
@ -2340,10 +2354,6 @@ public class EaglerDeferredPipeline {
|
|||
private void populateLightSourceUBOFromBucket(List<DynamicLightInstance> lights) {
|
||||
int max = lights.size();
|
||||
if(max > MAX_LIGHTS_PER_CHUNK) {
|
||||
tmpListLights.clear();
|
||||
tmpListLights.addAll(lights);
|
||||
lights = tmpListLights;
|
||||
lights.sort(comparatorLightRadius);
|
||||
max = MAX_LIGHTS_PER_CHUNK;
|
||||
}
|
||||
chunkLightingDataCopyBuffer.clear();
|
||||
|
|
|
@ -124,8 +124,13 @@ public class ForwardAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
|
|||
shaderProgram.useProgram();
|
||||
|
||||
_wglUniform3f(shaderProgram.uniforms.u_texCoordSize2f_particleSize1f, texCoordWidth, texCoordHeight, 0.0625f);
|
||||
_wglUniform4f(shaderProgram.uniforms.u_transformParam_1_2_3_4_f, f1, f5, f2, f3);
|
||||
_wglUniform1f(shaderProgram.uniforms.u_transformParam_5_f, f4);
|
||||
if(shaderProgram.uniforms.u_transformParam_1_2_5_f != null) {
|
||||
_wglUniform3f(shaderProgram.uniforms.u_transformParam_1_2_5_f, f1, f5, f4);
|
||||
_wglUniform2f(shaderProgram.uniforms.u_transformParam_3_4_f, f2, f3);
|
||||
}else {
|
||||
_wglUniform4f(shaderProgram.uniforms.u_transformParam_1_2_3_4_f, f1, f5, f2, f3);
|
||||
_wglUniform1f(shaderProgram.uniforms.u_transformParam_5_f, f4);
|
||||
}
|
||||
if(isMaterialNormalTexture) {
|
||||
_wglUniform2f(shaderProgram.uniforms.u_textureYScale2f, 0.5f, 0.5f);
|
||||
}else {
|
||||
|
|
|
@ -124,8 +124,13 @@ public class GBufferAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
|
|||
shaderProgram.useProgram();
|
||||
|
||||
_wglUniform3f(shaderProgram.uniforms.u_texCoordSize2f_particleSize1f, texCoordWidth, texCoordHeight, 0.0625f);
|
||||
_wglUniform4f(shaderProgram.uniforms.u_transformParam_1_2_3_4_f, f1, f5, f2, f3);
|
||||
_wglUniform1f(shaderProgram.uniforms.u_transformParam_5_f, f4);
|
||||
if(shaderProgram.uniforms.u_transformParam_1_2_5_f != null) {
|
||||
_wglUniform3f(shaderProgram.uniforms.u_transformParam_1_2_5_f, f1, f5, f4);
|
||||
_wglUniform2f(shaderProgram.uniforms.u_transformParam_3_4_f, f2, f3);
|
||||
}else {
|
||||
_wglUniform4f(shaderProgram.uniforms.u_transformParam_1_2_3_4_f, f1, f5, f2, f3);
|
||||
_wglUniform1f(shaderProgram.uniforms.u_transformParam_5_f, f4);
|
||||
}
|
||||
if(isMaterialNormalTexture) {
|
||||
_wglUniform2f(shaderProgram.uniforms.u_textureYScale2f, 0.5f, 0.5f);
|
||||
}else {
|
||||
|
|
|
@ -69,6 +69,8 @@ public class PipelineShaderAccelParticleForward extends ShaderProgram<PipelineSh
|
|||
public IUniformGL u_texCoordSize2f_particleSize1f = null;
|
||||
public IUniformGL u_transformParam_1_2_3_4_f = null;
|
||||
public IUniformGL u_transformParam_5_f = null;
|
||||
public IUniformGL u_transformParam_1_2_5_f = null;
|
||||
public IUniformGL u_transformParam_3_4_f = null;
|
||||
public IUniformGL u_textureYScale2f = null;
|
||||
|
||||
public int u_chunkLightingDataBlockBinding = -1;
|
||||
|
@ -85,6 +87,8 @@ public class PipelineShaderAccelParticleForward extends ShaderProgram<PipelineSh
|
|||
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(prog, "u_texCoordSize2f_particleSize1f");
|
||||
u_transformParam_1_2_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_3_4_f");
|
||||
u_transformParam_5_f = _wglGetUniformLocation(prog, "u_transformParam_5_f");
|
||||
u_transformParam_1_2_5_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_5_f");
|
||||
u_transformParam_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_3_4_f");
|
||||
u_textureYScale2f = _wglGetUniformLocation(prog, "u_textureYScale2f");
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_diffuseTexture"), 0);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_samplerNormalMaterial"), 2);
|
||||
|
|
|
@ -53,6 +53,8 @@ public class PipelineShaderAccelParticleGBuffer extends ShaderProgram<PipelineSh
|
|||
public IUniformGL u_texCoordSize2f_particleSize1f = null;
|
||||
public IUniformGL u_transformParam_1_2_3_4_f = null;
|
||||
public IUniformGL u_transformParam_5_f = null;
|
||||
public IUniformGL u_transformParam_1_2_5_f = null;
|
||||
public IUniformGL u_transformParam_3_4_f = null;
|
||||
public IUniformGL u_textureYScale2f = null;
|
||||
|
||||
private Uniforms() {
|
||||
|
@ -64,6 +66,8 @@ public class PipelineShaderAccelParticleGBuffer extends ShaderProgram<PipelineSh
|
|||
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(prog, "u_texCoordSize2f_particleSize1f");
|
||||
u_transformParam_1_2_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_3_4_f");
|
||||
u_transformParam_5_f = _wglGetUniformLocation(prog, "u_transformParam_5_f");
|
||||
u_transformParam_1_2_5_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_5_f");
|
||||
u_transformParam_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_3_4_f");
|
||||
u_textureYScale2f = _wglGetUniformLocation(prog, "u_textureYScale2f");
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_diffuseTexture"), 0);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_samplerNormalMaterial"), 2);
|
||||
|
|
|
@ -92,6 +92,11 @@ public class ShaderSource {
|
|||
public static final ResourceLocation post_fxaa_fsh = new ResourceLocation("eagler:glsl/deferred/post_fxaa.fsh");
|
||||
public static final ResourceLocation hand_depth_mask_fsh = new ResourceLocation("eagler:glsl/deferred/hand_depth_mask.fsh");
|
||||
|
||||
public static final ResourceLocation core_dynamiclights_vsh = new ResourceLocation("eagler:glsl/dynamiclights/core_dynamiclights.vsh");
|
||||
public static final ResourceLocation core_dynamiclights_fsh = new ResourceLocation("eagler:glsl/dynamiclights/core_dynamiclights.fsh");
|
||||
public static final ResourceLocation accel_particle_dynamiclights_vsh = new ResourceLocation("eagler:glsl/dynamiclights/accel_particle_dynamiclights.vsh");
|
||||
public static final ResourceLocation accel_particle_dynamiclights_fsh = new ResourceLocation("eagler:glsl/dynamiclights/accel_particle_dynamiclights.fsh");
|
||||
|
||||
private static final Map<ResourceLocation, String> sourceCache = new HashMap();
|
||||
|
||||
private static boolean isHighP = false;
|
||||
|
|
|
@ -0,0 +1,287 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ExtGLEnums.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ArrayListSerial;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredPipeline;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ListSerial;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2023-2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightBucketLoader {
|
||||
|
||||
public IBufferGL buffer_chunkLightingData;
|
||||
private ByteBuffer chunkLightingDataCopyBuffer;
|
||||
private boolean isChunkLightingEnabled = false;
|
||||
public ListSerial<DynamicLightInstance> currentBoundLightSourceBucket;
|
||||
|
||||
public final ListSerial<DynamicLightInstance>[] lightSourceBuckets;
|
||||
public ListSerial<DynamicLightInstance> currentLightSourceBucket;
|
||||
|
||||
public static final int MAX_LIGHTS_PER_CHUNK = 12;
|
||||
|
||||
private final int lightSourceBucketsWidth;
|
||||
private final int lightSourceBucketsHeight;
|
||||
|
||||
private double currentRenderX = 0.0;
|
||||
private double currentRenderY = 0.0;
|
||||
private double currentRenderZ = 0.0;
|
||||
|
||||
public DynamicLightBucketLoader() {
|
||||
this.lightSourceBucketsWidth = 5;
|
||||
this.lightSourceBucketsHeight = 3;
|
||||
int cnt = 5 * 3 * 5;
|
||||
this.lightSourceBuckets = new ListSerial[cnt];
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
destroy();
|
||||
|
||||
buffer_chunkLightingData = _wglGenBuffers();
|
||||
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
|
||||
int lightingDataLength = 4 * MAX_LIGHTS_PER_CHUNK + 4;
|
||||
chunkLightingDataCopyBuffer = EagRuntime.allocateByteBuffer(lightingDataLength << 2);
|
||||
for(int i = 0; i < lightingDataLength; ++i) {
|
||||
chunkLightingDataCopyBuffer.putInt(0);
|
||||
}
|
||||
chunkLightingDataCopyBuffer.flip();
|
||||
_wglBufferData(_GL_UNIFORM_BUFFER, chunkLightingDataCopyBuffer, GL_DYNAMIC_DRAW);
|
||||
|
||||
for(int i = 0; i < this.lightSourceBuckets.length; ++i) {
|
||||
this.lightSourceBuckets[i] = new ArrayListSerial(16);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearBuckets() {
|
||||
for(int i = 0; i < this.lightSourceBuckets.length; ++i) {
|
||||
this.lightSourceBuckets[i].clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadLightSourceBucket(int relativeBlockX, int relativeBlockY, int relativeBlockZ) {
|
||||
int hw = lightSourceBucketsWidth / 2;
|
||||
int hh = lightSourceBucketsHeight / 2;
|
||||
int bucketX = (relativeBlockX >> 4) + hw;
|
||||
int bucketY = (relativeBlockY >> 4) + hh;
|
||||
int bucketZ = (relativeBlockZ >> 4) + hw;
|
||||
if(bucketX >= 0 && bucketY >= 0 && bucketZ >= 0 && bucketX < lightSourceBucketsWidth
|
||||
&& bucketY < lightSourceBucketsHeight && bucketZ < lightSourceBucketsWidth) {
|
||||
currentLightSourceBucket = lightSourceBuckets[bucketY * lightSourceBucketsWidth * lightSourceBucketsWidth
|
||||
+ bucketZ * lightSourceBucketsWidth + bucketX];
|
||||
}else {
|
||||
currentLightSourceBucket = null;
|
||||
}
|
||||
updateLightSourceUBO();
|
||||
}
|
||||
|
||||
public ListSerial<DynamicLightInstance> getLightSourceBucketRelativeChunkCoords(int cx, int cy, int cz) {
|
||||
int hw = lightSourceBucketsWidth / 2;
|
||||
int hh = lightSourceBucketsHeight / 2;
|
||||
cx += hw;
|
||||
cy += hh;
|
||||
cz += hw;
|
||||
if(cx < 0 || cx >= lightSourceBucketsWidth || cy < 0 || cy >= lightSourceBucketsHeight || cz < 0
|
||||
|| cz >= lightSourceBucketsWidth) {
|
||||
return null;
|
||||
}else {
|
||||
return lightSourceBuckets[cy * lightSourceBucketsWidth * lightSourceBucketsWidth
|
||||
+ cz * lightSourceBucketsWidth + cx];
|
||||
}
|
||||
}
|
||||
|
||||
public void addLightSourceToBucket(int cx, int cy, int cz, DynamicLightInstance dl) {
|
||||
ListSerial<DynamicLightInstance> lst = getLightSourceBucketRelativeChunkCoords(cx, cy, cz);
|
||||
if(lst != null) {
|
||||
lst.add(dl);
|
||||
}
|
||||
}
|
||||
|
||||
public void bucketLightSource(float x, float y, float z, DynamicLightInstance dl) {
|
||||
int bucketX = MathHelper.floor_float(x / 16.0f);
|
||||
int bucketY = MathHelper.floor_float(y / 16.0f);
|
||||
int bucketZ = MathHelper.floor_float(z / 16.0f);
|
||||
addLightSourceToBucket(bucketX, bucketY, bucketZ, dl);
|
||||
int minX = bucketX, maxX = bucketX;
|
||||
int minY = bucketY, maxY = bucketY;
|
||||
int minZ = bucketZ, maxZ = bucketZ;
|
||||
float lightLocalX = x - (bucketX << 4);
|
||||
float lightLocalY = y - (bucketY << 4);
|
||||
float lightLocalZ = z - (bucketZ << 4);
|
||||
float radius = dl.radius;
|
||||
boolean outOfBounds = false;
|
||||
if(lightLocalX - radius < 0.0f) {
|
||||
minX -= 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX - 1, bucketY, bucketZ, dl);
|
||||
}
|
||||
if(lightLocalY - radius < 0.0f) {
|
||||
minY -= 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX, bucketY - 1, bucketZ, dl);
|
||||
}
|
||||
if(lightLocalZ - radius < 0.0f) {
|
||||
minZ -= 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX, bucketY, bucketZ - 1, dl);
|
||||
}
|
||||
if(lightLocalX + radius >= 16.0f) {
|
||||
maxX += 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX + 1, bucketY, bucketZ, dl);
|
||||
}
|
||||
if(lightLocalY + radius >= 16.0f) {
|
||||
maxY += 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX, bucketY + 1, bucketZ, dl);
|
||||
}
|
||||
if(lightLocalZ + radius >= 16.0f) {
|
||||
maxZ += 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX, bucketY, bucketZ + 1, dl);
|
||||
}
|
||||
if(!outOfBounds) {
|
||||
return;
|
||||
}
|
||||
radius *= radius;
|
||||
for(int yy = minY; yy <= maxY; ++yy) {
|
||||
for(int zz = minZ; zz <= maxZ; ++zz) {
|
||||
for(int xx = minX; xx <= maxX; ++xx) {
|
||||
if((xx == bucketX ? 1 : 0) + (yy == bucketY ? 1 : 0) + (zz == bucketZ ? 1 : 0) > 1) {
|
||||
continue;
|
||||
}
|
||||
List<DynamicLightInstance> lst = getLightSourceBucketRelativeChunkCoords(xx, yy, zz);
|
||||
if(lst != null) {
|
||||
int bucketBoundsX = xx << 4;
|
||||
int bucketBoundsY = yy << 4;
|
||||
int bucketBoundsZ = zz << 4;
|
||||
if (EaglerDeferredPipeline.testAabSphere(bucketBoundsX, bucketBoundsY, bucketBoundsZ,
|
||||
bucketBoundsX + 16, bucketBoundsY + 16, bucketBoundsZ + 16, x, y, z, radius)) {
|
||||
lst.add(dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void truncateOverflowingBuffers() {
|
||||
for(int i = 0; i < this.lightSourceBuckets.length; ++i) {
|
||||
List<DynamicLightInstance> lst = this.lightSourceBuckets[i];
|
||||
int k = lst.size();
|
||||
if(k > MAX_LIGHTS_PER_CHUNK) {
|
||||
lst.sort(comparatorLightRadius);
|
||||
for(int l = MAX_LIGHTS_PER_CHUNK - 1; l >= MAX_LIGHTS_PER_CHUNK; --l) {
|
||||
lst.remove(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLightSourceUBO() {
|
||||
if(currentLightSourceBucket == null) {
|
||||
currentBoundLightSourceBucket = null;
|
||||
if(isChunkLightingEnabled) {
|
||||
isChunkLightingEnabled = false;
|
||||
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
|
||||
chunkLightingDataCopyBuffer.clear();
|
||||
chunkLightingDataCopyBuffer.putInt(0);
|
||||
chunkLightingDataCopyBuffer.flip();
|
||||
_wglBufferSubData(_GL_UNIFORM_BUFFER, 0, chunkLightingDataCopyBuffer);
|
||||
}
|
||||
}else {
|
||||
boolean isNew;
|
||||
if(!isChunkLightingEnabled) {
|
||||
isChunkLightingEnabled = true;
|
||||
isNew = true;
|
||||
}else {
|
||||
isNew = currentLightSourceBucket != currentBoundLightSourceBucket;
|
||||
}
|
||||
currentBoundLightSourceBucket = currentLightSourceBucket;
|
||||
if(isNew || currentBoundLightSourceBucket.eaglerCheck()) {
|
||||
populateLightSourceUBOFromBucket(currentBoundLightSourceBucket);
|
||||
currentBoundLightSourceBucket.eaglerResetCheck();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Comparator<DynamicLightInstance> comparatorLightRadius = (l1, l2) -> {
|
||||
return l1.radius < l2.radius ? 1 : -1;
|
||||
};
|
||||
|
||||
private void populateLightSourceUBOFromBucket(List<DynamicLightInstance> lights) {
|
||||
int max = lights.size();
|
||||
if(max > MAX_LIGHTS_PER_CHUNK) {
|
||||
//tmpListLights.clear();
|
||||
//tmpListLights.addAll(lights);
|
||||
//lights = tmpListLights;
|
||||
//lights.sort(comparatorLightRadius);
|
||||
max = MAX_LIGHTS_PER_CHUNK;
|
||||
}
|
||||
chunkLightingDataCopyBuffer.clear();
|
||||
chunkLightingDataCopyBuffer.putInt(max);
|
||||
if(max > 0) {
|
||||
chunkLightingDataCopyBuffer.putInt(0); //padding
|
||||
chunkLightingDataCopyBuffer.putInt(0); //padding
|
||||
chunkLightingDataCopyBuffer.putInt(0); //padding
|
||||
for(int i = 0; i < max; ++i) {
|
||||
DynamicLightInstance dl = lights.get(i);
|
||||
chunkLightingDataCopyBuffer.putFloat((float)(dl.posX - currentRenderX));
|
||||
chunkLightingDataCopyBuffer.putFloat((float)(dl.posY - currentRenderY));
|
||||
chunkLightingDataCopyBuffer.putFloat((float)(dl.posZ - currentRenderZ));
|
||||
chunkLightingDataCopyBuffer.putFloat(dl.radius);
|
||||
}
|
||||
}
|
||||
chunkLightingDataCopyBuffer.flip();
|
||||
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
|
||||
_wglBufferSubData(_GL_UNIFORM_BUFFER, 0, chunkLightingDataCopyBuffer);
|
||||
}
|
||||
|
||||
public void setRenderPos(double currentRenderX, double currentRenderY, double currentRenderZ) {
|
||||
this.currentRenderX = currentRenderX;
|
||||
this.currentRenderY = currentRenderY;
|
||||
this.currentRenderZ = currentRenderZ;
|
||||
}
|
||||
|
||||
public void bindUniformBuffer(int index) {
|
||||
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
|
||||
EaglercraftGPU.bindUniformBufferRange(index, buffer_chunkLightingData, 0, chunkLightingDataCopyBuffer.capacity());
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
if(chunkLightingDataCopyBuffer != null) {
|
||||
EagRuntime.freeByteBuffer(chunkLightingDataCopyBuffer);
|
||||
chunkLightingDataCopyBuffer = null;
|
||||
}
|
||||
if(buffer_chunkLightingData != null) {
|
||||
_wglDeleteBuffers(buffer_chunkLightingData);
|
||||
buffer_chunkLightingData = null;
|
||||
}
|
||||
for(int i = 0; i < this.lightSourceBuckets.length; ++i) {
|
||||
this.lightSourceBuckets[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
class DynamicLightInstance {
|
||||
|
||||
public final String lightName;
|
||||
long lastCacheHit = 0l;
|
||||
|
||||
double posX;
|
||||
double posY;
|
||||
double posZ;
|
||||
float radius;
|
||||
|
||||
public DynamicLightInstance(String lightName) {
|
||||
this.lightName = lightName;
|
||||
}
|
||||
|
||||
public void updateLight(double posX, double posY, double posZ, float radius) {
|
||||
this.lastCacheHit = System.currentTimeMillis();
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
|
||||
public float getRadiusInWorld() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.InstancedParticleRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.AbstractAcceleratedEffectRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program.DynamicLightsAccelParticleShader;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightsAcceleratedEffectRenderer extends AbstractAcceleratedEffectRenderer {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger("DynamicLightsAcceleratedEffectRenderer");
|
||||
|
||||
private ByteBuffer particleBuffer = null;
|
||||
private int particleCount = 0;
|
||||
private boolean particlesHasOverflowed = false;
|
||||
|
||||
private static final int BYTES_PER_PARTICLE = 24;
|
||||
private static final int PARTICLE_LIMIT = 5461;
|
||||
|
||||
private DynamicLightsAccelParticleShader shaderProgram = null;
|
||||
|
||||
private IBufferArrayGL vertexArray = null;
|
||||
private IBufferGL vertexBuffer = null;
|
||||
|
||||
private IBufferGL instancesBuffer = null;
|
||||
|
||||
private float f1;
|
||||
private float f2;
|
||||
private float f3;
|
||||
private float f4;
|
||||
private float f5;
|
||||
|
||||
public static boolean isMaterialNormalTexture = false;
|
||||
|
||||
public void initialize() {
|
||||
destroy();
|
||||
|
||||
if(DynamicLightsPipelineCompiler.matrixCopyBuffer == null) {
|
||||
DynamicLightsPipelineCompiler.matrixCopyBuffer = GLAllocation.createDirectFloatBuffer(16);
|
||||
}
|
||||
|
||||
shaderProgram = DynamicLightsAccelParticleShader.compile();
|
||||
shaderProgram.loadUniforms();
|
||||
|
||||
particleBuffer = EagRuntime.allocateByteBuffer(PARTICLE_LIMIT * BYTES_PER_PARTICLE);
|
||||
|
||||
vertexArray = _wglGenVertexArrays();
|
||||
vertexBuffer = _wglGenBuffers();
|
||||
instancesBuffer = _wglGenBuffers();
|
||||
|
||||
FloatBuffer verts = EagRuntime.allocateFloatBuffer(12);
|
||||
verts.put(new float[] {
|
||||
-1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f,
|
||||
-1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f
|
||||
});
|
||||
verts.flip();
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(vertexBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, verts, GL_STATIC_DRAW);
|
||||
|
||||
EagRuntime.freeFloatBuffer(verts);
|
||||
|
||||
_wglEnableVertexAttribArray(0);
|
||||
_wglVertexAttribPointer(0, 2, GL_FLOAT, false, 8, 0);
|
||||
_wglVertexAttribDivisor(0, 0);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, particleBuffer.remaining(), GL_STREAM_DRAW);
|
||||
|
||||
_wglEnableVertexAttribArray(1);
|
||||
_wglVertexAttribPointer(1, 3, GL_FLOAT, false, 24, 0);
|
||||
_wglVertexAttribDivisor(1, 1);
|
||||
|
||||
_wglEnableVertexAttribArray(2);
|
||||
_wglVertexAttribPointer(2, 2, GL_UNSIGNED_SHORT, false, 24, 12);
|
||||
_wglVertexAttribDivisor(2, 1);
|
||||
|
||||
_wglEnableVertexAttribArray(3);
|
||||
_wglVertexAttribPointer(3, 2, GL_UNSIGNED_BYTE, true, 24, 16);
|
||||
_wglVertexAttribDivisor(3, 1);
|
||||
|
||||
_wglEnableVertexAttribArray(4);
|
||||
_wglVertexAttribPointer(4, 2, GL_UNSIGNED_BYTE, false, 24, 18);
|
||||
_wglVertexAttribDivisor(4, 1);
|
||||
|
||||
_wglEnableVertexAttribArray(5);
|
||||
_wglVertexAttribPointer(5, 4, GL_UNSIGNED_BYTE, true, 24, 20);
|
||||
_wglVertexAttribDivisor(5, 1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(float texCoordWidth, float texCoordHeight) {
|
||||
if(particleCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
shaderProgram.useProgram();
|
||||
|
||||
_wglUniform3f(shaderProgram.uniforms.u_texCoordSize2f_particleSize1f, texCoordWidth, texCoordHeight, 0.0625f);
|
||||
_wglUniform3f(shaderProgram.uniforms.u_transformParam_1_2_5_f, f1, f5, f4);
|
||||
_wglUniform2f(shaderProgram.uniforms.u_transformParam_3_4_f, f2, f3);
|
||||
InstancedParticleRenderer.stupidColorSetHack(shaderProgram.uniforms.u_color4f);
|
||||
|
||||
FloatBuffer buf = DynamicLightsPipelineCompiler.matrixCopyBuffer;
|
||||
buf.clear();
|
||||
GlStateManager.getFloat(GL_MODELVIEW_MATRIX, buf);
|
||||
buf.flip();
|
||||
_wglUniformMatrix4fv(shaderProgram.uniforms.u_modelViewMatrix4f, false, buf);
|
||||
buf.clear();
|
||||
GlStateManager.getFloat(GL_PROJECTION_MATRIX, buf);
|
||||
buf.flip();
|
||||
_wglUniformMatrix4fv(shaderProgram.uniforms.u_projectionMatrix4f, false, buf);
|
||||
buf.clear();
|
||||
DynamicLightsStateManager.inverseViewMatrix.store(buf);
|
||||
buf.flip();
|
||||
_wglUniformMatrix4fv(shaderProgram.uniforms.u_inverseViewMatrix4f, false, buf);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
|
||||
int p = particleBuffer.position();
|
||||
int l = particleBuffer.limit();
|
||||
|
||||
particleBuffer.flip();
|
||||
_wglBufferSubData(GL_ARRAY_BUFFER, 0, particleBuffer);
|
||||
|
||||
particleBuffer.position(p);
|
||||
particleBuffer.limit(l);
|
||||
|
||||
_wglDrawArraysInstanced(GL_TRIANGLES, 0, 6, particleCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void begin(float partialTicks) {
|
||||
this.partialTicks = partialTicks;
|
||||
|
||||
particleBuffer.clear();
|
||||
particleCount = 0;
|
||||
particlesHasOverflowed = false;
|
||||
|
||||
Entity et = Minecraft.getMinecraft().getRenderViewEntity();
|
||||
if(et != null) {
|
||||
f1 = MathHelper.cos(et.rotationYaw * 0.017453292F);
|
||||
f2 = MathHelper.sin(et.rotationYaw * 0.017453292F);
|
||||
f3 = -f2 * MathHelper.sin(et.rotationPitch * 0.017453292F);
|
||||
f4 = f1 * MathHelper.sin(et.rotationPitch * 0.017453292F);
|
||||
f5 = MathHelper.cos(et.rotationPitch * 0.017453292F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY,
|
||||
int lightMapData, int texSize, float particleSize, int rgba) {
|
||||
if(particlesHasOverflowed) {
|
||||
return;
|
||||
}
|
||||
if(particleCount >= PARTICLE_LIMIT) {
|
||||
particlesHasOverflowed = true;
|
||||
logger.error("Particle buffer has overflowed! Exceeded {} particles, no more particles will be rendered.", PARTICLE_LIMIT);
|
||||
return;
|
||||
}
|
||||
++particleCount;
|
||||
ByteBuffer buf = particleBuffer;
|
||||
buf.putFloat(posX);
|
||||
buf.putFloat(posY);
|
||||
buf.putFloat(posZ);
|
||||
buf.putShort((short)particleIndexX);
|
||||
buf.putShort((short)particleIndexY);
|
||||
buf.put((byte)(lightMapData & 0xFF));
|
||||
buf.put((byte)((lightMapData >> 16) & 0xFF));
|
||||
buf.put((byte)(particleSize * 16.0f));
|
||||
buf.put((byte)texSize);
|
||||
buf.putInt(rgba);
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
if(particleBuffer != null) {
|
||||
EagRuntime.freeByteBuffer(particleBuffer);
|
||||
particleBuffer = null;
|
||||
}
|
||||
if(shaderProgram != null) {
|
||||
shaderProgram.destroy();
|
||||
shaderProgram = null;
|
||||
}
|
||||
if(vertexArray != null) {
|
||||
_wglDeleteVertexArrays(vertexArray);
|
||||
vertexArray = null;
|
||||
}
|
||||
if(vertexBuffer != null) {
|
||||
_wglDeleteBuffers(vertexBuffer);
|
||||
vertexBuffer = null;
|
||||
}
|
||||
if(instancesBuffer != null) {
|
||||
_wglDeleteBuffers(instancesBuffer);
|
||||
instancesBuffer = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionShader.FixedFunctionState;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.IExtPipelineCompiler;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderSource;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program.DynamicLightsExtPipelineShader;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightsPipelineCompiler implements IExtPipelineCompiler {
|
||||
|
||||
static FloatBuffer matrixCopyBuffer = null;
|
||||
|
||||
private static class PipelineInstance {
|
||||
|
||||
private final int coreBits;
|
||||
private final int extBits;
|
||||
|
||||
private DynamicLightsExtPipelineShader shader;
|
||||
|
||||
public PipelineInstance(int coreBits, int extBits) {
|
||||
this.coreBits = coreBits;
|
||||
this.extBits = extBits;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getShaderSource(int stateCoreBits, int stateExtBits, Object[] userPointer) {
|
||||
if(matrixCopyBuffer == null) {
|
||||
matrixCopyBuffer = GLAllocation.createDirectFloatBuffer(16);
|
||||
}
|
||||
userPointer[0] = new PipelineInstance(stateCoreBits, stateExtBits);
|
||||
return new String[] {
|
||||
ShaderSource.getSourceFor(ShaderSource.core_dynamiclights_vsh),
|
||||
ShaderSource.getSourceFor(ShaderSource.core_dynamiclights_fsh)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExtensionStatesCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentExtensionStateBits(int stateCoreBits) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCoreStateMask(int stateExtBits) {
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeNewShader(IProgramGL compiledProg, int stateCoreBits, int stateExtBits,
|
||||
Object[] userPointer) {
|
||||
DynamicLightsExtPipelineShader newShader = new DynamicLightsExtPipelineShader(compiledProg, stateCoreBits);
|
||||
((PipelineInstance)userPointer[0]).shader = newShader;
|
||||
newShader.loadUniforms();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePipeline(IProgramGL compiledProg, int stateCoreBits, int stateExtBits, Object[] userPointer) {
|
||||
if((stateCoreBits & FixedFunctionState.STATE_ENABLE_LIGHTMAP) != 0) {
|
||||
DynamicLightsExtPipelineShader.Uniforms uniforms = ((PipelineInstance)userPointer[0]).shader.uniforms;
|
||||
if(uniforms.u_inverseViewMatrix4f != null) {
|
||||
int serial = DynamicLightsStateManager.inverseViewMatrixSerial;
|
||||
if(uniforms.inverseViewMatrixSerial != serial) {
|
||||
uniforms.inverseViewMatrixSerial = serial;
|
||||
FloatBuffer buf = matrixCopyBuffer;
|
||||
buf.clear();
|
||||
DynamicLightsStateManager.inverseViewMatrix.store(buf);
|
||||
buf.flip();
|
||||
_wglUniformMatrix4fv(uniforms.u_inverseViewMatrix4f, false, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyPipeline(IProgramGL shaderProgram, int stateCoreBits, int stateExtBits, Object[] userPointer) {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,169 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionPipeline;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightsStateManager {
|
||||
|
||||
static final DynamicLightsPipelineCompiler deferredExtPipeline = new DynamicLightsPipelineCompiler();
|
||||
static final Map<String, DynamicLightInstance> lightRenderers = new HashMap();
|
||||
static final List<DynamicLightInstance> lightRenderList = new LinkedList();
|
||||
static final Matrix4f inverseViewMatrix = new Matrix4f();
|
||||
static int inverseViewMatrixSerial = 0;
|
||||
static DynamicLightBucketLoader bucketLoader = null;
|
||||
static DynamicLightsAcceleratedEffectRenderer accelParticleRenderer = null;
|
||||
static int lastTotal = 0;
|
||||
static long renderTimeout = 5000l;
|
||||
private static long lastTick = 0l;
|
||||
|
||||
public static final void enableDynamicLightsRender() {
|
||||
if(bucketLoader == null) {
|
||||
bucketLoader = new DynamicLightBucketLoader();
|
||||
bucketLoader.initialize();
|
||||
bucketLoader.bindUniformBuffer(0);
|
||||
FixedFunctionPipeline.loadExtensionPipeline(deferredExtPipeline);
|
||||
}
|
||||
if(accelParticleRenderer == null) {
|
||||
accelParticleRenderer = new DynamicLightsAcceleratedEffectRenderer();
|
||||
accelParticleRenderer.initialize();
|
||||
}
|
||||
}
|
||||
|
||||
public static final void bindAcceleratedEffectRenderer(EffectRenderer renderer) {
|
||||
renderer.acceleratedParticleRenderer = accelParticleRenderer;
|
||||
}
|
||||
|
||||
public static final void disableDynamicLightsRender(boolean unloadPipeline) {
|
||||
if(bucketLoader != null) {
|
||||
bucketLoader.destroy();
|
||||
bucketLoader = null;
|
||||
if(unloadPipeline) {
|
||||
FixedFunctionPipeline.loadExtensionPipeline(null);
|
||||
}
|
||||
}
|
||||
if(accelParticleRenderer != null) {
|
||||
accelParticleRenderer.destroy();
|
||||
accelParticleRenderer = null;
|
||||
}
|
||||
destroyAll();
|
||||
lightRenderList.clear();
|
||||
}
|
||||
|
||||
public static final boolean isDynamicLightsRender() {
|
||||
return bucketLoader != null;
|
||||
}
|
||||
|
||||
public static final boolean isInDynamicLightsPass() {
|
||||
return GlStateManager.isExtensionPipeline() && bucketLoader != null;
|
||||
}
|
||||
|
||||
public static final void reportForwardRenderObjectPosition(int centerX, int centerY, int centerZ) {
|
||||
if(bucketLoader != null) {
|
||||
bucketLoader.loadLightSourceBucket(centerX, centerY, centerZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void reportForwardRenderObjectPosition2(float x, float y, float z) {
|
||||
if(bucketLoader != null) {
|
||||
float posX = (float)((x + TileEntityRendererDispatcher.staticPlayerX) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerX / 16.0) << 4));
|
||||
float posY = (float)((y + TileEntityRendererDispatcher.staticPlayerY) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerY / 16.0) << 4));
|
||||
float posZ = (float)((z + TileEntityRendererDispatcher.staticPlayerZ) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerZ / 16.0) << 4));
|
||||
bucketLoader.loadLightSourceBucket((int)posX, (int)posY, (int)posZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void renderDynamicLight(String lightName, double posX, double posY, double posZ, float radius) {
|
||||
if(bucketLoader != null) {
|
||||
DynamicLightInstance dl = lightRenderers.get(lightName);
|
||||
if(dl == null) {
|
||||
lightRenderers.put(lightName, dl = new DynamicLightInstance(lightName));
|
||||
}
|
||||
dl.updateLight(posX, posY, posZ, radius);
|
||||
lightRenderList.add(dl);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void clearRenderList() {
|
||||
lightRenderList.clear();
|
||||
}
|
||||
|
||||
public static final void commitLightSourceBuckets(double renderPosX, double renderPosY, double renderPosZ) {
|
||||
updateTimers();
|
||||
lastTotal = lightRenderList.size();
|
||||
if(bucketLoader != null) {
|
||||
bucketLoader.clearBuckets();
|
||||
int entityChunkOriginX = MathHelper.floor_double(renderPosX / 16.0) << 4;
|
||||
int entityChunkOriginY = MathHelper.floor_double(renderPosY / 16.0) << 4;
|
||||
int entityChunkOriginZ = MathHelper.floor_double(renderPosZ / 16.0) << 4;
|
||||
Iterator<DynamicLightInstance> itr = lightRenderList.iterator();
|
||||
while(itr.hasNext()) {
|
||||
DynamicLightInstance dl = itr.next();
|
||||
float lightChunkPosX = (float)(dl.posX - entityChunkOriginX);
|
||||
float lightChunkPosY = (float)(dl.posY - entityChunkOriginY);
|
||||
float lightChunkPosZ = (float)(dl.posZ - entityChunkOriginZ);
|
||||
bucketLoader.bucketLightSource(lightChunkPosX, lightChunkPosY, lightChunkPosZ, dl);
|
||||
}
|
||||
bucketLoader.setRenderPos(renderPosX, renderPosY, renderPosZ);
|
||||
bucketLoader.truncateOverflowingBuffers();
|
||||
}
|
||||
lightRenderList.clear();
|
||||
}
|
||||
|
||||
public static final void setupInverseViewMatrix() {
|
||||
Matrix4f.invert(GlStateManager.getModelViewReference(), inverseViewMatrix);
|
||||
inverseViewMatrixSerial = GlStateManager.getModelViewSerial();
|
||||
}
|
||||
|
||||
private static final void updateTimers() {
|
||||
long millis = System.currentTimeMillis();
|
||||
if(millis - lastTick > 1000l) {
|
||||
lastTick = millis;
|
||||
Iterator<DynamicLightInstance> itr = lightRenderers.values().iterator();
|
||||
while(itr.hasNext()) {
|
||||
DynamicLightInstance dl = itr.next();
|
||||
if(millis - dl.lastCacheHit > renderTimeout) {
|
||||
dl.destroy();
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final void destroyAll() {
|
||||
Iterator<DynamicLightInstance> itr = lightRenderers.values().iterator();
|
||||
while(itr.hasNext()) {
|
||||
itr.next().destroy();
|
||||
}
|
||||
lightRenderers.clear();
|
||||
}
|
||||
|
||||
public static String getF3String() {
|
||||
return "DynamicLightsTotal: " + lastTotal;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_FRAGMENT_SHADER;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_VERTEX_SHADER;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.IProgramUniforms;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderCompiler;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderProgram;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderSource;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightsAccelParticleShader extends ShaderProgram<DynamicLightsAccelParticleShader.Uniforms> {
|
||||
|
||||
public static DynamicLightsAccelParticleShader compile() {
|
||||
IShaderGL accelParticleVSH = ShaderCompiler.compileShader("accel_particle_dynamiclights", GL_VERTEX_SHADER,
|
||||
ShaderSource.accel_particle_dynamiclights_vsh);
|
||||
IShaderGL accelParticleFSH = null;
|
||||
try {
|
||||
accelParticleFSH = ShaderCompiler.compileShader("accel_particle_dynamiclights", GL_FRAGMENT_SHADER,
|
||||
ShaderSource.accel_particle_dynamiclights_fsh);
|
||||
IProgramGL prog = ShaderCompiler.linkProgram("accel_particle_dynamiclights", accelParticleVSH, accelParticleFSH);
|
||||
return new DynamicLightsAccelParticleShader(prog);
|
||||
}finally {
|
||||
if(accelParticleVSH != null) {
|
||||
accelParticleVSH.free();
|
||||
}
|
||||
if(accelParticleFSH != null) {
|
||||
accelParticleFSH.free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DynamicLightsAccelParticleShader(IProgramGL prog) {
|
||||
super(prog, new Uniforms());
|
||||
}
|
||||
|
||||
public static class Uniforms implements IProgramUniforms {
|
||||
|
||||
public IUniformGL u_color4f = null;
|
||||
public IUniformGL u_modelViewMatrix4f = null;
|
||||
public IUniformGL u_projectionMatrix4f = null;
|
||||
public IUniformGL u_inverseViewMatrix4f = null;
|
||||
public IUniformGL u_texCoordSize2f_particleSize1f = null;
|
||||
public IUniformGL u_transformParam_1_2_5_f = null;
|
||||
public IUniformGL u_transformParam_3_4_f = null;
|
||||
|
||||
public int u_chunkLightingDataBlockBinding = -1;
|
||||
|
||||
private Uniforms() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUniforms(IProgramGL prog) {
|
||||
u_modelViewMatrix4f = _wglGetUniformLocation(prog, "u_modelViewMatrix4f");
|
||||
u_projectionMatrix4f = _wglGetUniformLocation(prog, "u_projectionMatrix4f");
|
||||
u_inverseViewMatrix4f = _wglGetUniformLocation(prog, "u_inverseViewMatrix4f");
|
||||
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(prog, "u_texCoordSize2f_particleSize1f");
|
||||
u_transformParam_1_2_5_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_5_f");
|
||||
u_transformParam_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_3_4_f");
|
||||
u_color4f = _wglGetUniformLocation(prog, "u_color4f");
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_inputTexture"), 0);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_lightmapTexture"), 1);
|
||||
int blockIndex = _wglGetUniformBlockIndex(prog, "u_chunkLightingData");
|
||||
if(blockIndex != -1) {
|
||||
_wglUniformBlockBinding(prog, blockIndex, 0);
|
||||
u_chunkLightingDataBlockBinding = 0;
|
||||
}else {
|
||||
u_chunkLightingDataBlockBinding = -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.IProgramUniforms;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderProgram;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightsExtPipelineShader extends ShaderProgram<DynamicLightsExtPipelineShader.Uniforms> {
|
||||
|
||||
public final int coreState;
|
||||
|
||||
public DynamicLightsExtPipelineShader(IProgramGL program, int coreState) {
|
||||
super(program, new Uniforms());
|
||||
this.coreState = coreState;
|
||||
}
|
||||
|
||||
public static class Uniforms implements IProgramUniforms {
|
||||
|
||||
public int u_chunkLightingDataBlockBinding = -1;
|
||||
|
||||
public int inverseViewMatrixSerial = -1;
|
||||
public IUniformGL u_inverseViewMatrix4f = null;
|
||||
|
||||
Uniforms() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUniforms(IProgramGL prog) {
|
||||
u_inverseViewMatrix4f = _wglGetUniformLocation(prog, "u_inverseViewMatrix4f");
|
||||
int blockIndex = _wglGetUniformBlockIndex(prog, "u_chunkLightingData");
|
||||
if(blockIndex != -1) {
|
||||
_wglUniformBlockBinding(prog, blockIndex, 0);
|
||||
u_chunkLightingDataBlockBinding = 0;
|
||||
}else {
|
||||
u_chunkLightingDataBlockBinding = -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -70,6 +70,8 @@ public class SingleplayerServerController implements ISaveFormat {
|
|||
public static final ClientIntegratedServerNetworkManager localPlayerNetworkManager = new ClientIntegratedServerNetworkManager(PLAYER_CHANNEL);
|
||||
private static final List<String> openLANChannels = new ArrayList();
|
||||
|
||||
private static final IPCPacketManager packetManagerInstance = new IPCPacketManager();
|
||||
|
||||
private SingleplayerServerController() {
|
||||
}
|
||||
|
||||
|
@ -247,7 +249,7 @@ public class SingleplayerServerController implements ISaveFormat {
|
|||
if(packetData.channel.equals(SingleplayerServerController.IPC_CHANNEL)) {
|
||||
IPCPacketBase ipc;
|
||||
try {
|
||||
ipc = IPCPacketManager.IPCDeserialize(packetData.contents);
|
||||
ipc = packetManagerInstance.IPCDeserialize(packetData.contents);
|
||||
}catch(IOException ex) {
|
||||
throw new RuntimeException("Failed to deserialize IPC packet", ex);
|
||||
}
|
||||
|
@ -402,7 +404,7 @@ public class SingleplayerServerController implements ISaveFormat {
|
|||
public static void sendIPCPacket(IPCPacketBase ipc) {
|
||||
byte[] pkt;
|
||||
try {
|
||||
pkt = IPCPacketManager.IPCSerialize(ipc);
|
||||
pkt = packetManagerInstance.IPCSerialize(ipc);
|
||||
}catch (IOException ex) {
|
||||
throw new RuntimeException("Failed to serialize IPC packet", ex);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.client.gui.GuiScreen;
|
|||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +39,7 @@ public class GuiScreenBackupWorldSelection extends GuiScreen {
|
|||
private GuiButton worldConvert = null;
|
||||
private GuiButton worldBackup = null;
|
||||
private long worldSeed;
|
||||
private boolean oldRNG;
|
||||
private NBTTagCompound levelDat;
|
||||
|
||||
private String worldName;
|
||||
|
@ -47,6 +49,7 @@ public class GuiScreenBackupWorldSelection extends GuiScreen {
|
|||
this.worldName = worldName;
|
||||
this.levelDat = levelDat;
|
||||
this.worldSeed = levelDat.getCompoundTag("Data").getLong("RandomSeed");
|
||||
this.oldRNG = levelDat.getCompoundTag("Data").getInteger("eaglerVersionSerial") == 0;
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
|
@ -62,7 +65,11 @@ public class GuiScreenBackupWorldSelection extends GuiScreen {
|
|||
this.drawDefaultBackground();
|
||||
|
||||
this.drawCenteredString(this.fontRendererObj, I18n.format("singleplayer.backup.title", worldName), this.width / 2, this.height / 5 - 35, 16777215);
|
||||
this.drawCenteredString(this.fontRendererObj, I18n.format("singleplayer.backup.seed") + " " + worldSeed, this.width / 2, this.height / 5 + 62, 0xAAAAFF);
|
||||
if(oldRNG) {
|
||||
this.drawCenteredString(this.fontRendererObj, I18n.format("singleplayer.backup.seed") + " " + worldSeed + " " + EnumChatFormatting.RED + "(pre-u34)", this.width / 2, this.height / 5 + 62, 0xAAAAFF);
|
||||
}else {
|
||||
this.drawCenteredString(this.fontRendererObj, I18n.format("singleplayer.backup.seed") + " " + worldSeed, this.width / 2, this.height / 5 + 62, 0xAAAAFF);
|
||||
}
|
||||
|
||||
int toolTipColor = 0xDDDDAA;
|
||||
if(worldRecreate.isMouseOver()) {
|
||||
|
@ -85,8 +92,13 @@ public class GuiScreenBackupWorldSelection extends GuiScreen {
|
|||
this.mc.displayGuiScreen(selectWorld);
|
||||
}else if(par1GuiButton.id == 1) {
|
||||
GuiCreateWorld cw = new GuiCreateWorld(selectWorld);
|
||||
cw.func_146318_a(new WorldInfo(this.levelDat.getCompoundTag("Data")));
|
||||
this.mc.displayGuiScreen(cw);
|
||||
WorldInfo inf = new WorldInfo(this.levelDat.getCompoundTag("Data"));
|
||||
cw.func_146318_a(inf);
|
||||
if(inf.isOldEaglercraftRandom()) {
|
||||
this.mc.displayGuiScreen(new GuiScreenOldSeedWarning(cw));
|
||||
}else {
|
||||
this.mc.displayGuiScreen(cw);
|
||||
}
|
||||
}else if(par1GuiButton.id == 2) {
|
||||
this.mc.displayGuiScreen(new GuiRenameWorld(this.selectWorld, this.worldName, true));
|
||||
}else if(par1GuiButton.id == 3) {
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.sp.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 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
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class GuiScreenOldSeedWarning extends GuiScreen {
|
||||
|
||||
private final GuiScreen cont;
|
||||
|
||||
public GuiScreenOldSeedWarning(GuiScreen cont) {
|
||||
this.cont = cont;
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
this.buttonList.clear();
|
||||
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 6 + 96, I18n.format("singleplayer.oldseedwarning.ok")));
|
||||
}
|
||||
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
this.drawDefaultBackground();
|
||||
this.drawCenteredString(fontRendererObj, I18n.format("singleplayer.oldseedwarning.title"), this.width / 2, 70, 11184810);
|
||||
this.drawCenteredString(fontRendererObj, I18n.format("singleplayer.oldseedwarning.msg1"), this.width / 2, 90, 16777215);
|
||||
this.drawCenteredString(fontRendererObj, I18n.format("singleplayer.oldseedwarning.msg2"), this.width / 2, 105, 16777215);
|
||||
super.drawScreen(par1, par2, par3);
|
||||
}
|
||||
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id == 0) {
|
||||
this.mc.displayGuiScreen(cont);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,11 +25,11 @@ public class IPCPacketManager {
|
|||
|
||||
public static final HashMap<Integer, Supplier<IPCPacketBase>> mappings = new HashMap();
|
||||
|
||||
public static final IPCInputStream IPC_INPUT_STREAM = new IPCInputStream();
|
||||
public static final IPCOutputStream IPC_OUTPUT_STREAM = new IPCOutputStream();
|
||||
public final IPCInputStream IPC_INPUT_STREAM = new IPCInputStream();
|
||||
public final IPCOutputStream IPC_OUTPUT_STREAM = new IPCOutputStream();
|
||||
|
||||
public static final DataInputStream IPC_DATA_INPUT_STREAM = new DataInputStream(IPC_INPUT_STREAM);
|
||||
public static final DataOutputStream IPC_DATA_OUTPUT_STREAM = new DataOutputStream(IPC_OUTPUT_STREAM);
|
||||
public final DataInputStream IPC_DATA_INPUT_STREAM = new DataInputStream(IPC_INPUT_STREAM);
|
||||
public final DataOutputStream IPC_DATA_OUTPUT_STREAM = new DataOutputStream(IPC_OUTPUT_STREAM);
|
||||
|
||||
static {
|
||||
mappings.put(IPCPacket00StartServer.ID, IPCPacket00StartServer::new);
|
||||
|
@ -60,7 +60,7 @@ public class IPCPacketManager {
|
|||
mappings.put(IPCPacketFFProcessKeepAlive.ID, IPCPacketFFProcessKeepAlive::new);
|
||||
}
|
||||
|
||||
public static byte[] IPCSerialize(IPCPacketBase pkt) throws IOException {
|
||||
public byte[] IPCSerialize(IPCPacketBase pkt) throws IOException {
|
||||
|
||||
IPC_OUTPUT_STREAM.feedBuffer(new byte[pkt.size() + 1], pkt.getClass().getSimpleName());
|
||||
IPC_OUTPUT_STREAM.write(pkt.id());
|
||||
|
@ -69,7 +69,7 @@ public class IPCPacketManager {
|
|||
return IPC_OUTPUT_STREAM.returnBuffer();
|
||||
}
|
||||
|
||||
public static IPCPacketBase IPCDeserialize(byte[] pkt) throws IOException {
|
||||
public IPCPacketBase IPCDeserialize(byte[] pkt) throws IOException {
|
||||
|
||||
IPC_INPUT_STREAM.feedBuffer(pkt);
|
||||
int i = IPC_INPUT_STREAM.read();
|
||||
|
|
|
@ -60,6 +60,8 @@ public class EaglerIntegratedServerWorker {
|
|||
|
||||
private static final Map<String, IntegratedServerPlayerNetworkManager> openChannels = new HashMap();
|
||||
|
||||
private static final IPCPacketManager packetManagerInstance = new IPCPacketManager();
|
||||
|
||||
private static void processAsyncMessageQueue() {
|
||||
List<IPCPacketData> pktList = ServerPlatformSingleplayer.recieveAllPacket();
|
||||
if(pktList != null) {
|
||||
|
@ -69,7 +71,7 @@ public class EaglerIntegratedServerWorker {
|
|||
if(packetData.channel.equals(SingleplayerServerController.IPC_CHANNEL)) {
|
||||
IPCPacketBase ipc;
|
||||
try {
|
||||
ipc = IPCPacketManager.IPCDeserialize(packetData.contents);
|
||||
ipc = packetManagerInstance.IPCDeserialize(packetData.contents);
|
||||
}catch(IOException ex) {
|
||||
throw new RuntimeException("Failed to deserialize IPC packet", ex);
|
||||
}
|
||||
|
@ -422,7 +424,7 @@ public class EaglerIntegratedServerWorker {
|
|||
public static void sendIPCPacket(IPCPacketBase ipc) {
|
||||
byte[] pkt;
|
||||
try {
|
||||
pkt = IPCPacketManager.IPCSerialize(ipc);
|
||||
pkt = packetManagerInstance.IPCSerialize(ipc);
|
||||
}catch (IOException ex) {
|
||||
throw new RuntimeException("Failed to serialize IPC packet", ex);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerIntegratedServerWorker;
|
|||
import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerSaveFormat;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
|
||||
|
@ -66,6 +67,9 @@ public class WorldConverterEPK {
|
|||
NBTTagCompound worldDatNBT = CompressedStreamTools.readCompressed(new EaglerInputStream(b));
|
||||
worldDatNBT.getCompoundTag("Data").setString("LevelName", newName);
|
||||
worldDatNBT.getCompoundTag("Data").setLong("LastPlayed", System.currentTimeMillis());
|
||||
if(has152Format) {
|
||||
WorldInfo.initEaglerVersion(worldDatNBT.getCompoundTag("Data"));
|
||||
}
|
||||
EaglerOutputStream tmp = new EaglerOutputStream();
|
||||
CompressedStreamTools.writeCompressed(worldDatNBT, tmp);
|
||||
b = tmp.toByteArray();
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerChunkLoader;
|
|||
import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerIntegratedServerWorker;
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerSaveFormat;
|
||||
import net.minecraft.world.chunk.storage.RegionFile;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
@ -98,9 +99,9 @@ public class WorldConverterMCA {
|
|||
gameRulesNBT.setString("colorCodes", s);
|
||||
gameRulesNBT.setString("doSignEditing", s);
|
||||
worldDatNBT.getCompoundTag("Data").setTag("GameRules", gameRulesNBT);
|
||||
|
||||
worldDatNBT.getCompoundTag("Data").setString("LevelName", newName);
|
||||
worldDatNBT.getCompoundTag("Data").setLong("LastPlayed", System.currentTimeMillis());
|
||||
WorldInfo.initEaglerVersion(worldDatNBT.getCompoundTag("Data"));
|
||||
EaglerOutputStream bo = new EaglerOutputStream();
|
||||
CompressedStreamTools.writeCompressed(worldDatNBT, bo);
|
||||
b = bo.toByteArray();
|
||||
|
|
|
@ -750,7 +750,18 @@ public class Minecraft implements IThreadListener {
|
|||
}
|
||||
|
||||
this.mcSoundHandler.unloadSounds();
|
||||
SingleplayerServerController.shutdownEaglercraftServer();
|
||||
if (SingleplayerServerController.isWorldRunning()) {
|
||||
SingleplayerServerController.shutdownEaglercraftServer();
|
||||
while (SingleplayerServerController.getStatusState() == IntegratedServerState.WORLD_UNLOADING) {
|
||||
EagUtils.sleep(50l);
|
||||
SingleplayerServerController.runTick();
|
||||
}
|
||||
}
|
||||
if (SingleplayerServerController.isIntegratedServerWorkerAlive()
|
||||
&& SingleplayerServerController.canKillWorker()) {
|
||||
SingleplayerServerController.killWorker();
|
||||
EagUtils.sleep(50l);
|
||||
}
|
||||
} finally {
|
||||
EagRuntime.destroy();
|
||||
if (!this.hasCrashed) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.lax1dude.eaglercraft.v1_8.HString;
|
|||
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformType;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.sp.SingleplayerServerController;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
|
@ -394,6 +395,9 @@ public class GuiOverlayDebug extends Gui {
|
|||
new Object[] { enumfacing, s,
|
||||
Float.valueOf(MathHelper.wrapAngleTo180_float(entity.rotationYaw)),
|
||||
Float.valueOf(MathHelper.wrapAngleTo180_float(entity.rotationPitch)) }) });
|
||||
if (DynamicLightsStateManager.isDynamicLightsRender()) {
|
||||
arraylist.add(6, DynamicLightsStateManager.getF3String());
|
||||
}
|
||||
if (this.mc.theWorld != null && this.mc.theWorld.isBlockLoaded(blockpos)) {
|
||||
Chunk chunk = this.mc.theWorld.getChunkFromBlockCoords(blockpos);
|
||||
arraylist.add("Biome: " + chunk.getBiome(blockpos, null).biomeName);
|
||||
|
|
|
@ -42,10 +42,10 @@ public class GuiVideoSettings extends GuiScreen {
|
|||
GameSettings.Options.VIEW_BOBBING, GameSettings.Options.GUI_SCALE, GameSettings.Options.GAMMA,
|
||||
GameSettings.Options.RENDER_CLOUDS, GameSettings.Options.PARTICLES, GameSettings.Options.FXAA,
|
||||
GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.BLOCK_ALTERNATIVES,
|
||||
GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.FOG, GameSettings.Options.FULLSCREEN,
|
||||
GameSettings.Options.FNAW_SKINS, GameSettings.Options.HUD_FPS, GameSettings.Options.HUD_COORDS,
|
||||
GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_STATS, GameSettings.Options.HUD_WORLD,
|
||||
GameSettings.Options.HUD_24H, GameSettings.Options.CHUNK_FIX };
|
||||
GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.FOG, GameSettings.Options.EAGLER_DYNAMIC_LIGHTS,
|
||||
GameSettings.Options.FULLSCREEN, GameSettings.Options.FNAW_SKINS, GameSettings.Options.HUD_FPS,
|
||||
GameSettings.Options.HUD_COORDS, GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_STATS,
|
||||
GameSettings.Options.HUD_WORLD, GameSettings.Options.HUD_24H, GameSettings.Options.CHUNK_FIX };
|
||||
|
||||
public GuiVideoSettings(GuiScreen parentScreenIn, GameSettings gameSettingsIn) {
|
||||
this.parentGuiScreen = parentScreenIn;
|
||||
|
|
|
@ -280,4 +280,8 @@ public class EntityFX extends Entity {
|
|||
+ this.particleRed + "," + this.particleGreen + "," + this.particleBlue + "," + this.particleAlpha
|
||||
+ "), Age " + this.particleAge;
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
|
|||
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.BlockVertexIDs;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -55,6 +56,7 @@ public class BlockFluidRenderer {
|
|||
WorldRenderer worldRendererIn) {
|
||||
BlockPos tmp = new BlockPos(0, 0, 0);
|
||||
boolean deferred = DeferredStateManager.isDeferredRenderer();
|
||||
boolean isDynamicLights = deferred || DynamicLightsStateManager.isDynamicLightsRender();
|
||||
BlockLiquid blockliquid = (BlockLiquid) blockStateIn.getBlock();
|
||||
boolean lava = blockliquid.getMaterial() == Material.lava;
|
||||
boolean realistic = !lava && DeferredStateManager.isRenderingRealisticWater();
|
||||
|
@ -151,7 +153,7 @@ public class BlockFluidRenderer {
|
|||
.tex((double) f15, (double) f19).lightmap(l2, i3).endVertex();
|
||||
worldRendererIn.pos(d0 + 1.0D, d1 + (double) f10, d2 + 0.0D).color(f24, f25, f26, 1.0F)
|
||||
.tex((double) f16, (double) f20).lightmap(l2, i3).endVertex();
|
||||
if (deferred)
|
||||
if (isDynamicLights)
|
||||
worldRendererIn.genNormals(true, f12 <= -999.0F ? BlockVertexIDs.builtin_water_still_vertex_id
|
||||
: BlockVertexIDs.builtin_water_flow_vertex_id);
|
||||
|
||||
|
@ -164,7 +166,7 @@ public class BlockFluidRenderer {
|
|||
.tex((double) f15, (double) f19).lightmap(l2, i3).endVertex();
|
||||
worldRendererIn.pos(d0 + 0.0D, d1 + (double) f8, d2 + 1.0D).color(f24, f25, f26, 1.0F)
|
||||
.tex((double) f14, (double) f18).lightmap(l2, i3).endVertex();
|
||||
if (deferred)
|
||||
if (isDynamicLights)
|
||||
worldRendererIn.genNormals(true, f12 <= -999.0F ? BlockVertexIDs.builtin_water_still_vertex_id
|
||||
: BlockVertexIDs.builtin_water_flow_vertex_id);
|
||||
}
|
||||
|
@ -186,7 +188,7 @@ public class BlockFluidRenderer {
|
|||
.lightmap(i2, j2).endVertex();
|
||||
worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(f3, f3, f3, 1.0F).tex((double) f36, (double) f38)
|
||||
.lightmap(i2, j2).endVertex();
|
||||
if (deferred)
|
||||
if (isDynamicLights)
|
||||
worldRendererIn.putNormal(0.0f, -1.0f, 0.0f, BlockVertexIDs.builtin_water_still_vertex_id);
|
||||
flag2 = true;
|
||||
}
|
||||
|
@ -272,7 +274,7 @@ public class BlockFluidRenderer {
|
|||
.lightmap(k, l).endVertex();
|
||||
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(f32, f33, f34, 1.0F).tex((double) f41, (double) f30)
|
||||
.lightmap(k, l).endVertex();
|
||||
if (deferred)
|
||||
if (isDynamicLights)
|
||||
worldRendererIn.putNormal(j1, 0.0f, k1, BlockVertexIDs.builtin_water_flow_vertex_id);
|
||||
if (!realistic) {
|
||||
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(f32, f33, f34, 1.0F)
|
||||
|
@ -283,7 +285,7 @@ public class BlockFluidRenderer {
|
|||
.tex((double) f27, (double) f29).lightmap(k, l).endVertex();
|
||||
worldRendererIn.pos(d3, d1 + (double) f39, d4).color(f32, f33, f34, 1.0F)
|
||||
.tex((double) f41, (double) f28).lightmap(k, l).endVertex();
|
||||
if (deferred)
|
||||
if (isDynamicLights)
|
||||
worldRendererIn.putNormal(-j1, 0.0f, -k1, BlockVertexIDs.builtin_water_flow_vertex_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
|||
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.VertexMarkerState;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -139,6 +140,7 @@ public class BlockModelRenderer {
|
|||
WorldRenderer worldRendererIn, List<BakedQuad> listQuadsIn, float[] quadBounds, BitSet boundsFlags,
|
||||
BlockModelRenderer.AmbientOcclusionFace aoFaceIn) {
|
||||
boolean isDeferred = DeferredStateManager.isDeferredRenderer();
|
||||
boolean isDynamicLights = isDeferred || DynamicLightsStateManager.isDynamicLightsRender();
|
||||
double d0 = (double) blockPosIn.getX();
|
||||
double d1 = (double) blockPosIn.getY();
|
||||
double d2 = (double) blockPosIn.getZ();
|
||||
|
@ -154,8 +156,9 @@ public class BlockModelRenderer {
|
|||
|
||||
for (int i = 0, l = listQuadsIn.size(); i < l; ++i) {
|
||||
BakedQuad bakedquad = listQuadsIn.get(i);
|
||||
int[] vertData = isDeferred ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
|
||||
this.fillQuadBounds(blockIn, vertData, bakedquad.getFace(), quadBounds, boundsFlags, isDeferred ? 8 : 7);
|
||||
int[] vertData = isDynamicLights ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
|
||||
this.fillQuadBounds(blockIn, vertData, bakedquad.getFace(), quadBounds, boundsFlags,
|
||||
isDynamicLights ? 8 : 7);
|
||||
aoFaceIn.updateVertexBrightness(blockAccessIn, blockIn, blockPosIn, bakedquad.getFace(), quadBounds,
|
||||
boundsFlags);
|
||||
worldRendererIn.addVertexData(vertData);
|
||||
|
@ -272,6 +275,7 @@ public class BlockModelRenderer {
|
|||
EnumFacing faceIn, int brightnessIn, boolean ownBrightness, WorldRenderer worldRendererIn,
|
||||
List<BakedQuad> listQuadsIn, BitSet boundsFlags, float[] quadBounds) {
|
||||
boolean isDeferred = DeferredStateManager.isDeferredRenderer();
|
||||
boolean isDynamicLights = isDeferred || DynamicLightsStateManager.isDynamicLightsRender();
|
||||
double d0 = (double) blockPosIn.getX();
|
||||
double d1 = (double) blockPosIn.getY();
|
||||
double d2 = (double) blockPosIn.getZ();
|
||||
|
@ -291,9 +295,9 @@ public class BlockModelRenderer {
|
|||
for (int m = 0, n = listQuadsIn.size(); m < n; ++m) {
|
||||
BakedQuad bakedquad = listQuadsIn.get(m);
|
||||
EnumFacing facingIn = bakedquad.getFace();
|
||||
int[] vertData = isDeferred ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
|
||||
int[] vertData = isDynamicLights ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
|
||||
blockPosIn.offsetEvenFaster(facingIn, blockpos0);
|
||||
this.fillQuadBounds(blockIn, vertData, facingIn, quadBounds, boundsFlags, isDeferred ? 8 : 7);
|
||||
this.fillQuadBounds(blockIn, vertData, facingIn, quadBounds, boundsFlags, isDynamicLights ? 8 : 7);
|
||||
boolean boundsFlags0 = boundsFlags.get(0);
|
||||
if (ownBrightness) {
|
||||
brightnessIn = boundsFlags0 ? blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos0)
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
|
|||
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.minecraft.client.renderer.chunk.RenderChunk;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumWorldBlockLayer;
|
||||
|
@ -53,10 +54,15 @@ public abstract class ChunkRenderContainer {
|
|||
float posZ = (float) ((double) blockpos.getZ() - this.viewEntityZ);
|
||||
GlStateManager.translate(posX, posY, posZ);
|
||||
if (DeferredStateManager.isInForwardPass()) {
|
||||
posX = (float) (blockpos.getX() - (MathHelper.floor_double(this.viewEntityX / 16.0) << 4)); // TODO
|
||||
posX = (float) (blockpos.getX() - (MathHelper.floor_double(this.viewEntityX / 16.0) << 4));
|
||||
posY = (float) (blockpos.getY() - (MathHelper.floor_double(this.viewEntityY / 16.0) << 4));
|
||||
posZ = (float) (blockpos.getZ() - (MathHelper.floor_double(this.viewEntityZ / 16.0) << 4));
|
||||
DeferredStateManager.reportForwardRenderObjectPosition((int) posX, (int) posY, (int) posZ);
|
||||
} else if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
posX = (float) (blockpos.getX() - (MathHelper.floor_double(this.viewEntityX / 16.0) << 4));
|
||||
posY = (float) (blockpos.getY() - (MathHelper.floor_double(this.viewEntityY / 16.0) << 4));
|
||||
posZ = (float) (blockpos.getZ() - (MathHelper.floor_double(this.viewEntityZ / 16.0) << 4));
|
||||
DynamicLightsStateManager.reportForwardRenderObjectPosition((int) posX, (int) posY, (int) posZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.NameTagRenderer;
|
|||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ShadersRenderPassFuture;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.gui.GuiShaderConfig;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.texture.EmissiveItems;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
|
||||
import net.lax1dude.eaglercraft.v1_8.voice.VoiceTagRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
|
||||
|
@ -653,6 +654,9 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
*/
|
||||
private void renderHand(float partialTicks, int xOffset) {
|
||||
if (!this.debugView) {
|
||||
if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
DynamicLightsStateManager.reportForwardRenderObjectPosition2(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
GlStateManager.matrixMode(GL_PROJECTION);
|
||||
GlStateManager.loadIdentity();
|
||||
float f = 0.07F;
|
||||
|
@ -848,7 +852,8 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
|
||||
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
this.mc.getTextureManager().bindTexture(this.locationLightMap);
|
||||
if (mc.gameSettings.fancyGraphics || mc.gameSettings.ambientOcclusion > 0) {
|
||||
if (mc.gameSettings.fancyGraphics || mc.gameSettings.ambientOcclusion > 0
|
||||
|| DynamicLightsStateManager.isDynamicLightsRender()) {
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
} else {
|
||||
|
@ -1098,14 +1103,27 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
GlStateManager.enableAlpha();
|
||||
GlStateManager.alphaFunc(GL_GREATER, 0.5F);
|
||||
this.mc.mcProfiler.startSection("center");
|
||||
boolean dlights = DynamicLightsStateManager.isDynamicLightsRender();
|
||||
if (dlights) {
|
||||
updateDynamicLightListEagler(partialTicks);
|
||||
}
|
||||
if (this.mc.gameSettings.anaglyph && !this.mc.gameSettings.shaders) {
|
||||
anaglyphField = 0;
|
||||
GlStateManager.colorMask(false, true, true, false);
|
||||
this.renderWorldPass(0, partialTicks, finishTimeNano);
|
||||
anaglyphField = 1;
|
||||
GlStateManager.colorMask(true, false, false, false);
|
||||
this.renderWorldPass(1, partialTicks, finishTimeNano);
|
||||
GlStateManager.colorMask(true, true, true, false);
|
||||
if (dlights) {
|
||||
GlStateManager.enableExtensionPipeline();
|
||||
}
|
||||
try {
|
||||
anaglyphField = 0;
|
||||
GlStateManager.colorMask(false, true, true, false);
|
||||
this.renderWorldPass(0, partialTicks, finishTimeNano);
|
||||
anaglyphField = 1;
|
||||
GlStateManager.colorMask(true, false, false, false);
|
||||
this.renderWorldPass(1, partialTicks, finishTimeNano);
|
||||
GlStateManager.colorMask(true, true, true, false);
|
||||
} finally {
|
||||
if (dlights) {
|
||||
GlStateManager.disableExtensionPipeline();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.mc.gameSettings.shaders) {
|
||||
try {
|
||||
|
@ -1121,7 +1139,16 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
mc.effectRenderer.acceleratedParticleRenderer = EffectRenderer.vanillaAcceleratedParticleRenderer;
|
||||
} else {
|
||||
mc.effectRenderer.acceleratedParticleRenderer = EffectRenderer.vanillaAcceleratedParticleRenderer;
|
||||
this.renderWorldPass(2, partialTicks, finishTimeNano);
|
||||
if (dlights) {
|
||||
GlStateManager.enableExtensionPipeline();
|
||||
}
|
||||
try {
|
||||
this.renderWorldPass(2, partialTicks, finishTimeNano);
|
||||
} finally {
|
||||
if (dlights) {
|
||||
GlStateManager.disableExtensionPipeline();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1143,6 +1170,10 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
this.mc.mcProfiler.endStartSection("camera");
|
||||
this.setupCameraTransform(partialTicks, pass);
|
||||
boolean isDynamicLights = DynamicLightsStateManager.isDynamicLightsRender();
|
||||
if (isDynamicLights) {
|
||||
DynamicLightsStateManager.setupInverseViewMatrix();
|
||||
}
|
||||
ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2);
|
||||
this.mc.mcProfiler.endStartSection("culling");
|
||||
Frustum frustum = new Frustum();
|
||||
|
@ -1150,6 +1181,9 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
|
||||
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
|
||||
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
|
||||
TileEntityRendererDispatcher.staticPlayerX = d0; // hack, needed for some eagler stuff
|
||||
TileEntityRendererDispatcher.staticPlayerY = d1;
|
||||
TileEntityRendererDispatcher.staticPlayerZ = d2;
|
||||
frustum.setPosition(d0, d1, d2);
|
||||
if (this.mc.gameSettings.renderDistanceChunks >= 4) {
|
||||
this.setupFog(-1, partialTicks);
|
||||
|
@ -1215,8 +1249,14 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
GlStateManager.disableAlpha();
|
||||
this.mc.mcProfiler.endStartSection("outline");
|
||||
if (isDynamicLights) {
|
||||
GlStateManager.disableExtensionPipeline();
|
||||
}
|
||||
renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks);
|
||||
GlStateManager.enableAlpha();
|
||||
if (isDynamicLights) {
|
||||
GlStateManager.enableExtensionPipeline();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1225,9 +1265,15 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
if (flag && this.mc.objectMouseOver != null && !entity.isInsideOfMaterial(Material.water)) {
|
||||
EntityPlayer entityplayer1 = (EntityPlayer) entity;
|
||||
GlStateManager.disableAlpha();
|
||||
if (isDynamicLights) {
|
||||
GlStateManager.disableExtensionPipeline();
|
||||
}
|
||||
this.mc.mcProfiler.endStartSection("outline");
|
||||
renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks);
|
||||
GlStateManager.enableAlpha();
|
||||
if (isDynamicLights) {
|
||||
GlStateManager.enableExtensionPipeline();
|
||||
}
|
||||
}
|
||||
|
||||
this.mc.mcProfiler.endStartSection("destroyProgress");
|
||||
|
@ -1245,7 +1291,14 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
RenderHelper.disableStandardItemLighting();
|
||||
this.setupFog(0, partialTicks);
|
||||
this.mc.mcProfiler.endStartSection("particles");
|
||||
if (isDynamicLights) {
|
||||
DynamicLightsStateManager.bindAcceleratedEffectRenderer(effectrenderer);
|
||||
DynamicLightsStateManager.reportForwardRenderObjectPosition2(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
effectrenderer.renderParticles(entity, partialTicks, 2);
|
||||
if (isDynamicLights) {
|
||||
effectrenderer.acceleratedParticleRenderer = null;
|
||||
}
|
||||
this.disableLightmap();
|
||||
}
|
||||
|
||||
|
@ -1285,6 +1338,20 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
|
||||
}
|
||||
|
||||
private void updateDynamicLightListEagler(float partialTicks) {
|
||||
DynamicLightsStateManager.clearRenderList();
|
||||
Entity entity = this.mc.getRenderViewEntity();
|
||||
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
|
||||
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
|
||||
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
|
||||
AxisAlignedBB entityAABB = new AxisAlignedBB(d0 - 48.0, d1 - 32.0, d2 - 48.0, d0 + 48.0, d1 + 32.0, d2 + 48.0);
|
||||
List<Entity> entities = this.mc.theWorld.getEntitiesWithinAABB(Entity.class, entityAABB);
|
||||
for (int i = 0, l = entities.size(); i < l; ++i) {
|
||||
entities.get(i).renderDynamicLightsEaglerSimple(partialTicks);
|
||||
}
|
||||
DynamicLightsStateManager.commitLightSourceBuckets(d0, d1, d2);
|
||||
}
|
||||
|
||||
private void renderCloudsCheck(RenderGlobal renderGlobalIn, float partialTicks, int pass) {
|
||||
if (this.mc.gameSettings.func_181147_e() != 0) {
|
||||
this.mc.mcProfiler.endStartSection("clouds");
|
||||
|
@ -1398,6 +1465,9 @@ public class EntityRenderer implements IResourceManagerReloadListener {
|
|||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
GlStateManager.alphaFunc(GL_GREATER, 0.1F);
|
||||
if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
DynamicLightsStateManager.reportForwardRenderObjectPosition2(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
} else {
|
||||
GlStateManager.enableAlpha();
|
||||
DeferredStateManager.setHDRTranslucentPassBlendFunc();
|
||||
|
|
|
@ -32,6 +32,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
|
|||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredConfig;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredPipeline;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.SharedPipelineShaders;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -466,6 +467,16 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
}
|
||||
SharedPipelineShaders.free();
|
||||
}
|
||||
|
||||
if (DeferredStateManager.isDeferredRenderer()) {
|
||||
DynamicLightsStateManager.disableDynamicLightsRender(false);
|
||||
} else {
|
||||
if (mc.gameSettings.enableDynamicLights) {
|
||||
DynamicLightsStateManager.enableDynamicLightsRender();
|
||||
} else {
|
||||
DynamicLightsStateManager.disableDynamicLightsRender(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1948,8 +1959,10 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
if (!this.damagedBlocks.isEmpty()) {
|
||||
this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
this.preRenderDamagedBlocks();
|
||||
worldRendererIn.begin(7, DeferredStateManager.isDeferredRenderer() ? VertexFormat.BLOCK_SHADERS
|
||||
: DefaultVertexFormats.BLOCK);
|
||||
worldRendererIn.begin(7,
|
||||
(DeferredStateManager.isDeferredRenderer() || DynamicLightsStateManager.isDynamicLightsRender())
|
||||
? VertexFormat.BLOCK_SHADERS
|
||||
: DefaultVertexFormats.BLOCK);
|
||||
worldRendererIn.setTranslation(-d0, -d1, -d2);
|
||||
worldRendererIn.markDirty();
|
||||
Iterator iterator = this.damagedBlocks.values().iterator();
|
||||
|
@ -1971,6 +1984,10 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
|
|||
int i = destroyblockprogress.getPartialBlockDamage();
|
||||
EaglerTextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i];
|
||||
BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
|
||||
if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
DynamicLightsStateManager.reportForwardRenderObjectPosition2(blockpos.x, blockpos.y,
|
||||
blockpos.z);
|
||||
}
|
||||
blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite,
|
||||
this.theWorld);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.VertexMarkerState;
|
|||
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.EnumFaceDirection;
|
||||
import net.minecraft.client.resources.model.ModelRotation;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -119,7 +120,9 @@ public class FaceBakery {
|
|||
float[] sprite, EaglerTextureAtlasSprite modelRotationIn, ModelRotation partRotation,
|
||||
BlockPartRotation uvLocked, boolean shade, boolean parFlag2, Vector3f calcNormal) {
|
||||
EnumFacing enumfacing = partRotation.rotateFace(facing);
|
||||
int i = (parFlag2 && stride != 8) ? this.getFaceShadeColor(enumfacing) : -1;
|
||||
int i = (parFlag2 && (stride != 8 || !Minecraft.getMinecraft().gameSettings.shaders))
|
||||
? this.getFaceShadeColor(enumfacing)
|
||||
: -1;
|
||||
EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing)
|
||||
.func_179025_a(vertexIndex);
|
||||
Vector3f vector3f = new Vector3f(sprite[enumfacedirection$vertexinformation.field_179184_a],
|
||||
|
@ -139,9 +142,15 @@ public class FaceBakery {
|
|||
faceData[i + 4 + 1] = Float
|
||||
.floatToRawIntBits(sprite.getInterpolatedV((double) faceUV.func_178346_b(vertexIndex)));
|
||||
if (stride == 8) {
|
||||
faceData[i] = Float.floatToRawIntBits(position.x * VertexMarkerState.localCoordDeriveHackX);
|
||||
faceData[i + 1] = Float.floatToRawIntBits(position.y * VertexMarkerState.localCoordDeriveHackY);
|
||||
faceData[i + 2] = Float.floatToRawIntBits(position.z * VertexMarkerState.localCoordDeriveHackZ);
|
||||
if (!Minecraft.getMinecraft().gameSettings.shaders) {
|
||||
faceData[i] = Float.floatToRawIntBits(position.x);
|
||||
faceData[i + 1] = Float.floatToRawIntBits(position.y);
|
||||
faceData[i + 2] = Float.floatToRawIntBits(position.z);
|
||||
} else {
|
||||
faceData[i] = Float.floatToRawIntBits(position.x * VertexMarkerState.localCoordDeriveHackX);
|
||||
faceData[i + 1] = Float.floatToRawIntBits(position.y * VertexMarkerState.localCoordDeriveHackY);
|
||||
faceData[i + 2] = Float.floatToRawIntBits(position.z * VertexMarkerState.localCoordDeriveHackZ);
|
||||
}
|
||||
if (calcNormal != null) {
|
||||
int x = (byte) ((int) (calcNormal.x * 127.0F)) & 255;
|
||||
int y = (byte) ((int) (calcNormal.y * 127.0F)) & 255;
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
|||
import net.lax1dude.eaglercraft.v1_8.opengl.VertexFormat;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -246,7 +247,9 @@ public class RenderChunk {
|
|||
|
||||
private void preRenderBlocks(WorldRenderer worldRendererIn, BlockPos pos) {
|
||||
worldRendererIn.begin(7,
|
||||
DeferredStateManager.isDeferredRenderer() ? VertexFormat.BLOCK_SHADERS : DefaultVertexFormats.BLOCK);
|
||||
(DeferredStateManager.isDeferredRenderer() || DynamicLightsStateManager.isDynamicLightsRender())
|
||||
? VertexFormat.BLOCK_SHADERS
|
||||
: DefaultVertexFormats.BLOCK);
|
||||
worldRendererIn.setTranslation((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
|||
import net.lax1dude.eaglercraft.v1_8.opengl.VertexFormat;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -66,8 +67,10 @@ public class RenderFallingBlock extends Render<EntityFallingBlock> {
|
|||
GlStateManager.disableLighting();
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
|
||||
worldrenderer.begin(7, DeferredStateManager.isDeferredRenderer() ? VertexFormat.BLOCK_SHADERS
|
||||
: DefaultVertexFormats.BLOCK);
|
||||
worldrenderer.begin(7,
|
||||
(DeferredStateManager.isDeferredRenderer()
|
||||
|| DynamicLightsStateManager.isDynamicLightsRender()) ? VertexFormat.BLOCK_SHADERS
|
||||
: DefaultVertexFormats.BLOCK);
|
||||
int i = blockpos.getX();
|
||||
int j = blockpos.getY();
|
||||
int k = blockpos.getZ();
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
|||
import net.lax1dude.eaglercraft.v1_8.opengl.OpenGlHelper;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.profile.RenderHighPoly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBed;
|
||||
|
@ -332,6 +333,10 @@ public class RenderManager {
|
|||
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
|
||||
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
|
||||
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
|
||||
if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
DynamicLightsStateManager.reportForwardRenderObjectPosition2((float) (d0 - viewerPosX),
|
||||
(float) (d1 - viewerPosY), (float) (d2 - viewerPosZ));
|
||||
}
|
||||
float f = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks;
|
||||
int i = entity.getBrightnessForRender(partialTicks);
|
||||
if (entity.isBurning()) {
|
||||
|
|
|
@ -93,6 +93,8 @@ public class LayerSpiderEyes implements LayerRenderer<EntitySpider> {
|
|||
this.spiderRenderer.bindTexture(SPIDER_EYES);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.enablePolygonOffset();
|
||||
GlStateManager.doPolygonOffset(-0.025f, 1.0f);
|
||||
GlStateManager.blendFunc(GL_ONE, GL_ONE);
|
||||
if (entityspider.isInvisible()) {
|
||||
GlStateManager.depthMask(false);
|
||||
|
@ -113,6 +115,7 @@ public class LayerSpiderEyes implements LayerRenderer<EntitySpider> {
|
|||
this.spiderRenderer.func_177105_a(entityspider, f2);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.disablePolygonOffset();
|
||||
}
|
||||
|
||||
public boolean shouldCombineTextures() {
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.google.common.collect.Maps;
|
|||
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.OpenGlHelper;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
|
@ -146,6 +147,9 @@ public class TileEntityRendererDispatcher {
|
|||
TileEntitySpecialRenderer tileentityspecialrenderer = this.getSpecialRenderer(tileEntityIn);
|
||||
if (tileentityspecialrenderer != null) {
|
||||
try {
|
||||
if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
DynamicLightsStateManager.reportForwardRenderObjectPosition2((float) x, (float) y, (float) z);
|
||||
}
|
||||
tileentityspecialrenderer.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, destroyStage);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Block Entity");
|
||||
|
|
|
@ -202,6 +202,7 @@ public class GameSettings {
|
|||
public EaglerDeferredConfig deferredShaderConf = new EaglerDeferredConfig();
|
||||
public boolean enableUpdateSvc = true;
|
||||
public boolean enableFNAWSkins = true;
|
||||
public boolean enableDynamicLights = false;
|
||||
|
||||
public int voiceListenRadius = 16;
|
||||
public float voiceListenVolume = 0.5f;
|
||||
|
@ -465,6 +466,11 @@ public class GameSettings {
|
|||
this.enableVsync = !this.enableVsync;
|
||||
}
|
||||
|
||||
if (parOptions == GameSettings.Options.EAGLER_DYNAMIC_LIGHTS) {
|
||||
this.enableDynamicLights = !this.enableDynamicLights;
|
||||
this.mc.renderGlobal.loadRenderers();
|
||||
}
|
||||
|
||||
this.saveOptions();
|
||||
}
|
||||
|
||||
|
@ -541,6 +547,8 @@ public class GameSettings {
|
|||
return this.enableFNAWSkins;
|
||||
case EAGLER_VSYNC:
|
||||
return this.enableVsync;
|
||||
case EAGLER_DYNAMIC_LIGHTS:
|
||||
return this.enableDynamicLights;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -986,6 +994,10 @@ public class GameSettings {
|
|||
this.enableFNAWSkins = astring[1].equals("true");
|
||||
}
|
||||
|
||||
if (astring[0].equals("enableDynamicLights")) {
|
||||
this.enableDynamicLights = astring[1].equals("true");
|
||||
}
|
||||
|
||||
deferredShaderConf.readOption(astring[0], astring[1]);
|
||||
} catch (Exception var8) {
|
||||
logger.warn("Skipping bad option: " + s);
|
||||
|
@ -1104,6 +1116,7 @@ public class GameSettings {
|
|||
printwriter.println("voiceSpeakVolume:" + this.voiceSpeakVolume);
|
||||
printwriter.println("voicePTTKey:" + this.voicePTTKey);
|
||||
printwriter.println("enableFNAWSkins:" + this.enableFNAWSkins);
|
||||
printwriter.println("enableDynamicLights:" + this.enableDynamicLights);
|
||||
|
||||
for (KeyBinding keybinding : this.keyBindings) {
|
||||
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
|
||||
|
@ -1206,7 +1219,7 @@ public class GameSettings {
|
|||
INVERT_MOUSE("options.invertMouse", false, true), SENSITIVITY("options.sensitivity", true, false),
|
||||
FOV("options.fov", true, false, 30.0F, 110.0F, 1.0F), GAMMA("options.gamma", true, false),
|
||||
SATURATION("options.saturation", true, false),
|
||||
RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 16.0F, 1.0F),
|
||||
RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 18.0F, 1.0F),
|
||||
VIEW_BOBBING("options.viewBobbing", false, true), ANAGLYPH("options.anaglyph", false, true),
|
||||
FRAMERATE_LIMIT("options.framerateLimit", true, false, 10.0F, 260.0F, 10.0F),
|
||||
FBO_ENABLE("options.fboEnable", false, true), RENDER_CLOUDS("options.renderClouds", false, false),
|
||||
|
@ -1238,7 +1251,7 @@ public class GameSettings {
|
|||
FOG("options.fog", false, true), FXAA("options.fxaa", false, false),
|
||||
FULLSCREEN("options.fullscreen", false, true),
|
||||
FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true),
|
||||
EAGLER_VSYNC("options.vsync", false, true);
|
||||
EAGLER_VSYNC("options.vsync", false, true), EAGLER_DYNAMIC_LIGHTS("options.dynamicLights", false, true);
|
||||
|
||||
private final boolean enumFloat;
|
||||
private final boolean enumBoolean;
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
|||
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||
import net.lax1dude.eaglercraft.v1_8.HString;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
|
@ -1013,7 +1014,12 @@ public abstract class Entity implements ICommandSender {
|
|||
|
||||
public int getBrightnessForRender(float var1) {
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.posY + (double) this.getEyeHeight(), this.posZ);
|
||||
return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getCombinedLight(blockpos, 0) : 0;
|
||||
int i = 0;
|
||||
if (DynamicLightsStateManager.isDynamicLightsRender()) {
|
||||
i += (int) (getEaglerDynamicLightsValueSimple(var1) * 15.0f);
|
||||
}
|
||||
return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getCombinedLight(blockpos, -i)
|
||||
: (i > 15 ? 240 : (i << 4));
|
||||
}
|
||||
|
||||
/**+
|
||||
|
@ -1021,7 +1027,11 @@ public abstract class Entity implements ICommandSender {
|
|||
*/
|
||||
public float getBrightness(float var1) {
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.posY + (double) this.getEyeHeight(), this.posZ);
|
||||
return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getLightBrightness(blockpos) : 0.0F;
|
||||
float f = this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getLightBrightness(blockpos) : 0.0F;
|
||||
if (DynamicLightsStateManager.isDynamicLightsRender()) {
|
||||
f = Math.min(f + getEaglerDynamicLightsValueSimple(var1), 1.0f);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
/**+
|
||||
|
@ -2380,7 +2390,8 @@ public abstract class Entity implements ICommandSender {
|
|||
double entityX2 = entityX - TileEntityRendererDispatcher.staticPlayerX;
|
||||
double entityY2 = entityY - TileEntityRendererDispatcher.staticPlayerY;
|
||||
double entityZ2 = entityZ - TileEntityRendererDispatcher.staticPlayerZ;
|
||||
if (Math.sqrt(entityX2 * entityX2 + entityY2 * entityY2 + entityZ2 * entityZ2) < 48.0 * 48.0) {
|
||||
if (entityX2 * entityX2 + entityY2 * entityY2
|
||||
+ entityZ2 * entityZ2 < (isInFrustum ? (64.0 * 64.0) : (24.0 * 24.0))) {
|
||||
renderDynamicLightsEaglerAt(entityX, entityY, entityZ, entityX2, entityY2, entityZ2, partialTicks,
|
||||
isInFrustum);
|
||||
}
|
||||
|
@ -2388,14 +2399,41 @@ public abstract class Entity implements ICommandSender {
|
|||
|
||||
protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
|
||||
double renderY, double renderZ, float partialTicks, boolean isInFrustum) {
|
||||
float size = Math.max(width, height);
|
||||
if (size < 1.0f && !isInFrustum) {
|
||||
return;
|
||||
}
|
||||
if (this.isBurning()) {
|
||||
float size = Math.max(width, height);
|
||||
if (size < 1.0f && !isInFrustum) {
|
||||
return;
|
||||
}
|
||||
float mag = 5.0f * size;
|
||||
DynamicLightManager.renderDynamicLight("entity_" + entityId + "_fire", entityX, entityY + height * 0.75,
|
||||
entityZ, mag, 0.487f * mag, 0.1411f * mag, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void renderDynamicLightsEaglerSimple(float partialTicks) {
|
||||
double entityX = prevPosX + (posX - prevPosX) * (double) partialTicks;
|
||||
double entityY = prevPosY + (posY - prevPosY) * (double) partialTicks;
|
||||
double entityZ = prevPosZ + (posZ - prevPosZ) * (double) partialTicks;
|
||||
renderDynamicLightsEaglerSimpleAt(entityX, entityY, entityZ, partialTicks);
|
||||
}
|
||||
|
||||
protected void renderDynamicLightsEaglerSimpleAt(double entityX, double entityY, double entityZ,
|
||||
float partialTicks) {
|
||||
float renderBrightness = this.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
if (renderBrightness > 0.1f) {
|
||||
DynamicLightsStateManager.renderDynamicLight("entity_" + entityId + "_lightmap", entityX,
|
||||
entityY + height * 0.85, entityZ, renderBrightness * 13.0f);
|
||||
}
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
float size = Math.max(width, height);
|
||||
if (size < 1.0f) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (this.isBurning()) {
|
||||
return size / 2.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
|
@ -1911,4 +1911,16 @@ public abstract class EntityLivingBase extends Entity {
|
|||
}
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
ItemStack itm = this.getHeldItem();
|
||||
if (itm != null && itm.stackSize > 0) {
|
||||
Item item = itm.getItem();
|
||||
if (item != null) {
|
||||
float f2 = item.getHeldItemBrightnessEagler();
|
||||
f = Math.min(f + f2 * 0.5f, 1.0f) + f2 * 0.5f;
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
|
@ -520,6 +520,10 @@ public class EntityWither extends EntityMob implements IBossDisplayData, IRanged
|
|||
return 15728880;
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public void fall(float var1, float var2) {
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.minecraft.entity.item;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -211,6 +212,21 @@ public class EntityEnderEye extends Entity {
|
|||
return 1.0F;
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
|
||||
double renderY, double renderZ, float partialTicks, boolean isInFrustum) {
|
||||
super.renderDynamicLightsEaglerAt(entityX, entityY, entityZ, renderX, renderY, renderZ, partialTicks,
|
||||
isInFrustum);
|
||||
if (isInFrustum && renderX * renderX + renderY * renderY + renderZ * renderZ < 150.0) {
|
||||
float mag = 0.5f;
|
||||
DynamicLightManager.renderDynamicLight("entity_" + getEntityId() + "_endereye", entityX, entityY + 0.2,
|
||||
entityZ, mag * 0.1990f, mag * 0.7750f, mag * 0.4130f, false);
|
||||
}
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float var1) {
|
||||
return 15728880;
|
||||
}
|
||||
|
|
|
@ -196,6 +196,10 @@ public class EntityFireworkRocket extends Entity {
|
|||
return super.getBrightness(f);
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float f) {
|
||||
return super.getBrightnessForRender(f);
|
||||
}
|
||||
|
|
|
@ -475,4 +475,17 @@ public class EntityItem extends Entity {
|
|||
isInFrustum);
|
||||
eaglerEmissiveFlag = Minecraft.getMinecraft().entityRenderer.renderItemEntityLight(this, 0.1f);
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
ItemStack itm = this.getEntityItem();
|
||||
if (itm != null && itm.stackSize > 0) {
|
||||
Item item = itm.getItem();
|
||||
if (item != null) {
|
||||
float f2 = item.getHeldItemBrightnessEagler() * 0.75f;
|
||||
f = Math.min(f + f2 * 0.5f, 1.0f) + f2 * 0.5f;
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import net.minecraft.entity.EntityHanging;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -252,4 +253,17 @@ public class EntityItemFrame extends EntityHanging {
|
|||
isInFrustum);
|
||||
eaglerEmissiveFlag = Minecraft.getMinecraft().entityRenderer.renderItemEntityLight(this, 0.1f);
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
ItemStack itm = this.getDisplayedItem();
|
||||
if (itm != null && itm.stackSize > 0) {
|
||||
Item item = itm.getItem();
|
||||
if (item != null) {
|
||||
float f2 = item.getHeldItemBrightnessEagler() * 0.75f;
|
||||
f = Math.min(f + f2 * 0.5f, 1.0f) + f2 * 0.5f;
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
|
@ -227,4 +227,12 @@ public class EntityMinecartTNT extends EntityMinecart {
|
|||
entityZ, dynamicLightMag, dynamicLightMag * 0.7792f, dynamicLightMag * 0.618f, false);
|
||||
}
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
if (minecartTNTFuse > -1 && minecartTNTFuse / 5 % 2 == 0) {
|
||||
f = Math.min(f + 0.75f, 1.25f);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
|
@ -145,4 +145,12 @@ public class EntityTNTPrimed extends Entity {
|
|||
entityZ, dynamicLightMag, dynamicLightMag * 0.7792f, dynamicLightMag * 0.618f, false);
|
||||
}
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
if (fuse / 5 % 2 == 0) {
|
||||
f = Math.min(f + 0.75f, 1.25f);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
|
@ -84,6 +84,10 @@ public class EntityXPOrb extends Entity {
|
|||
return j | k << 16;
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
return 0.25f;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
|
|
|
@ -104,6 +104,10 @@ public class EntityBlaze extends EntityMob {
|
|||
return 1.0F;
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
/**+
|
||||
* Called frequently so the entity can update its state every
|
||||
* tick as required. For example, zombies and skeletons use this
|
||||
|
|
|
@ -306,4 +306,13 @@ public class EntityCreeper extends EntityMob {
|
|||
DeferredStateManager.setEmissionConstant(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
float ff = getCreeperFlashIntensity(partialTicks);
|
||||
if ((int) (ff * 10.0F) % 2 != 0) {
|
||||
f = Math.min(f + 0.5f, 1.15f);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
|
@ -75,6 +75,10 @@ public class EntityMagmaCube extends EntitySlime {
|
|||
return 1.0F;
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
protected EnumParticleTypes getParticleType() {
|
||||
return EnumParticleTypes.FLAME;
|
||||
}
|
||||
|
|
|
@ -331,6 +331,10 @@ public abstract class EntityFireball extends Entity {
|
|||
return 1.0F;
|
||||
}
|
||||
|
||||
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public int getBrightnessForRender(float var1) {
|
||||
return 15728880;
|
||||
}
|
||||
|
|
|
@ -1113,4 +1113,8 @@ public class Item {
|
|||
: (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null))));
|
||||
}
|
||||
}
|
||||
|
||||
public float getHeldItemBrightnessEagler() {
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
|
@ -167,4 +167,8 @@ public class ItemBlock extends Item {
|
|||
public Block getBlock() {
|
||||
return this.block;
|
||||
}
|
||||
|
||||
public float getHeldItemBrightnessEagler() {
|
||||
return this.block.getLightValue() * 0.06667f;
|
||||
}
|
||||
}
|
|
@ -169,6 +169,11 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
|
|||
worldsettings = new WorldSettings(worldinfo);
|
||||
}
|
||||
|
||||
if (worldinfo.isOldEaglercraftRandom()) {
|
||||
LogManager.getLogger("EaglerMinecraftServer")
|
||||
.info("Detected a pre-u34 world, using old EaglercraftRandom implementation for world generation");
|
||||
}
|
||||
|
||||
for (int j = 0; j < this.worldServers.length; ++j) {
|
||||
byte b0 = 0;
|
||||
if (j == 1) {
|
||||
|
|
|
@ -50,7 +50,7 @@ public class Teleporter {
|
|||
|
||||
public Teleporter(WorldServer worldIn) {
|
||||
this.worldServerInstance = worldIn;
|
||||
this.random = new EaglercraftRandom(worldIn.getSeed());
|
||||
this.random = new EaglercraftRandom(worldIn.getSeed(), !worldIn.getWorldInfo().isOldEaglercraftRandom());
|
||||
}
|
||||
|
||||
public void placeInPortal(Entity entityIn, float rotationYaw) {
|
||||
|
|
|
@ -681,7 +681,12 @@ public abstract class World implements IBlockAccess {
|
|||
public int getCombinedLight(BlockPos pos, int lightValue) {
|
||||
int i = this.getLightFromNeighborsFor(EnumSkyBlock.SKY, pos);
|
||||
int j = this.getLightFromNeighborsFor(EnumSkyBlock.BLOCK, pos);
|
||||
if (j < lightValue) {
|
||||
if (lightValue < 0) {
|
||||
j += -lightValue;
|
||||
if (j > 15) {
|
||||
j = 15;
|
||||
}
|
||||
} else if (j < lightValue) {
|
||||
j = lightValue;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,8 +135,9 @@ public abstract class WorldProvider {
|
|||
--f;
|
||||
}
|
||||
|
||||
float f2 = f;
|
||||
f = 1.0F - (float) ((Math.cos((double) f * 3.141592653589793D) + 1.0D) / 2.0D);
|
||||
f = f + (f - f) / 3.0F;
|
||||
f = f2 + (f - f2) / 3.0F;
|
||||
return f;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,11 +84,12 @@ public class BiomeGenMesa extends BiomeGenBase {
|
|||
public void genTerrainBlocks(World world, EaglercraftRandom random, ChunkPrimer chunkprimer, int i, int j,
|
||||
double d0) {
|
||||
if (this.field_150621_aC == null || this.field_150622_aD != world.getSeed()) {
|
||||
this.func_150619_a(world.getSeed());
|
||||
this.func_150619_a(world.getSeed(), !world.getWorldInfo().isOldEaglercraftRandom());
|
||||
}
|
||||
|
||||
if (this.field_150623_aE == null || this.field_150624_aF == null || this.field_150622_aD != world.getSeed()) {
|
||||
EaglercraftRandom random1 = new EaglercraftRandom(this.field_150622_aD);
|
||||
EaglercraftRandom random1 = new EaglercraftRandom(this.field_150622_aD,
|
||||
!world.getWorldInfo().isOldEaglercraftRandom());
|
||||
this.field_150623_aE = new NoiseGeneratorPerlin(random1, 4);
|
||||
this.field_150624_aF = new NoiseGeneratorPerlin(random1, 1);
|
||||
}
|
||||
|
@ -197,10 +198,10 @@ public class BiomeGenMesa extends BiomeGenBase {
|
|||
|
||||
}
|
||||
|
||||
private void func_150619_a(long parLong1) {
|
||||
private void func_150619_a(long parLong1, boolean scrambleRNG) {
|
||||
this.field_150621_aC = new IBlockState[64];
|
||||
Arrays.fill(this.field_150621_aC, Blocks.hardened_clay.getDefaultState());
|
||||
EaglercraftRandom random = new EaglercraftRandom(parLong1);
|
||||
EaglercraftRandom random = new EaglercraftRandom(parLong1, scrambleRNG);
|
||||
this.field_150625_aG = new NoiseGeneratorPerlin(random, 1);
|
||||
|
||||
for (int l1 = 0; l1 < 64; ++l1) {
|
||||
|
|
|
@ -927,7 +927,7 @@ public class Chunk {
|
|||
public EaglercraftRandom getRandomWithSeed(long i) {
|
||||
return new EaglercraftRandom(this.worldObj.getSeed() + (long) (this.xPosition * this.xPosition * 4987142)
|
||||
+ (long) (this.xPosition * 5947611) + (long) (this.zPosition * this.zPosition) * 4392871L
|
||||
+ (long) (this.zPosition * 389711) ^ i);
|
||||
+ (long) (this.zPosition * 389711) ^ i, !this.worldObj.getWorldInfo().isOldEaglercraftRandom());
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
|
|
|
@ -163,9 +163,11 @@ public class EmptyChunk extends Chunk {
|
|||
}
|
||||
|
||||
public EaglercraftRandom getRandomWithSeed(long seed) {
|
||||
return new EaglercraftRandom(this.getWorld().getSeed() + (long) (this.xPosition * this.xPosition * 4987142)
|
||||
+ (long) (this.xPosition * 5947611) + (long) (this.zPosition * this.zPosition) * 4392871L
|
||||
+ (long) (this.zPosition * 389711) ^ seed);
|
||||
return new EaglercraftRandom(
|
||||
this.getWorld().getSeed() + (long) (this.xPosition * this.xPosition * 4987142)
|
||||
+ (long) (this.xPosition * 5947611) + (long) (this.zPosition * this.zPosition) * 4392871L
|
||||
+ (long) (this.zPosition * 389711) ^ seed,
|
||||
!this.getWorld().getWorldInfo().isOldEaglercraftRandom());
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ChunkProviderEnd implements IChunkProvider {
|
|||
|
||||
public ChunkProviderEnd(World worldIn, long parLong1) {
|
||||
this.endWorld = worldIn;
|
||||
this.endRNG = new EaglercraftRandom(parLong1);
|
||||
this.endRNG = new EaglercraftRandom(parLong1, !worldIn.getWorldInfo().isOldEaglercraftRandom());
|
||||
this.noiseGen1 = new NoiseGeneratorOctaves(this.endRNG, 16);
|
||||
this.noiseGen2 = new NoiseGeneratorOctaves(this.endRNG, 16);
|
||||
this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8);
|
||||
|
|
|
@ -57,7 +57,8 @@ public class ChunkProviderFlat implements IChunkProvider {
|
|||
|
||||
public ChunkProviderFlat(World worldIn, long seed, boolean generateStructures, String flatGeneratorSettings) {
|
||||
this.worldObj = worldIn;
|
||||
this.random = new EaglercraftRandom(seed);
|
||||
boolean scramble = !worldIn.getWorldInfo().isOldEaglercraftRandom();
|
||||
this.random = new EaglercraftRandom(seed, scramble);
|
||||
this.flatWorldGenInfo = FlatGeneratorInfo.createFlatGeneratorFromString(flatGeneratorSettings);
|
||||
if (generateStructures) {
|
||||
Map map = this.flatWorldGenInfo.getWorldFeatures();
|
||||
|
@ -67,23 +68,23 @@ public class ChunkProviderFlat implements IChunkProvider {
|
|||
map1.put("size", "1");
|
||||
}
|
||||
|
||||
this.structureGenerators.add(new MapGenVillage(map1));
|
||||
this.structureGenerators.add(new MapGenVillage(map1, scramble));
|
||||
}
|
||||
|
||||
if (map.containsKey("biome_1")) {
|
||||
this.structureGenerators.add(new MapGenScatteredFeature((Map) map.get("biome_1")));
|
||||
this.structureGenerators.add(new MapGenScatteredFeature((Map) map.get("biome_1"), scramble));
|
||||
}
|
||||
|
||||
if (map.containsKey("mineshaft")) {
|
||||
this.structureGenerators.add(new MapGenMineshaft((Map) map.get("mineshaft")));
|
||||
this.structureGenerators.add(new MapGenMineshaft((Map) map.get("mineshaft"), scramble));
|
||||
}
|
||||
|
||||
if (map.containsKey("stronghold")) {
|
||||
this.structureGenerators.add(new MapGenStronghold((Map) map.get("stronghold")));
|
||||
this.structureGenerators.add(new MapGenStronghold((Map) map.get("stronghold"), scramble));
|
||||
}
|
||||
|
||||
if (map.containsKey("oceanmonument")) {
|
||||
this.structureGenerators.add(new StructureOceanMonument((Map) map.get("oceanmonument")));
|
||||
this.structureGenerators.add(new StructureOceanMonument((Map) map.get("oceanmonument"), scramble));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,25 +62,13 @@ public class ChunkProviderGenerate implements IChunkProvider {
|
|||
private ChunkProviderSettings settings;
|
||||
private Block field_177476_s = Blocks.water;
|
||||
private double[] stoneNoise = new double[256];
|
||||
private MapGenBase caveGenerator = new MapGenCaves();
|
||||
/**+
|
||||
* Holds Stronghold Generator
|
||||
*/
|
||||
private MapGenStronghold strongholdGenerator = new MapGenStronghold();
|
||||
/**+
|
||||
* Holds Village Generator
|
||||
*/
|
||||
private MapGenVillage villageGenerator = new MapGenVillage();
|
||||
/**+
|
||||
* Holds Mineshaft Generator
|
||||
*/
|
||||
private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
|
||||
private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
|
||||
/**+
|
||||
* Holds ravine generator
|
||||
*/
|
||||
private MapGenBase ravineGenerator = new MapGenRavine();
|
||||
private StructureOceanMonument oceanMonumentGenerator = new StructureOceanMonument();
|
||||
private MapGenBase caveGenerator;
|
||||
private MapGenStronghold strongholdGenerator;
|
||||
private MapGenVillage villageGenerator;
|
||||
private MapGenMineshaft mineshaftGenerator;
|
||||
private MapGenScatteredFeature scatteredFeatureGenerator;
|
||||
private MapGenBase ravineGenerator;
|
||||
private StructureOceanMonument oceanMonumentGenerator;
|
||||
private BiomeGenBase[] biomesForGeneration;
|
||||
double[] field_147427_d;
|
||||
double[] field_147428_e;
|
||||
|
@ -91,7 +79,15 @@ public class ChunkProviderGenerate implements IChunkProvider {
|
|||
this.worldObj = worldIn;
|
||||
this.mapFeaturesEnabled = parFlag;
|
||||
this.field_177475_o = worldIn.getWorldInfo().getTerrainType();
|
||||
this.rand = new EaglercraftRandom(parLong1);
|
||||
boolean scramble = !worldIn.getWorldInfo().isOldEaglercraftRandom();
|
||||
this.rand = new EaglercraftRandom(parLong1, scramble);
|
||||
this.caveGenerator = new MapGenCaves(scramble);
|
||||
this.strongholdGenerator = new MapGenStronghold(scramble);
|
||||
this.villageGenerator = new MapGenVillage(scramble);
|
||||
this.mineshaftGenerator = new MapGenMineshaft(scramble);
|
||||
this.scatteredFeatureGenerator = new MapGenScatteredFeature(scramble);
|
||||
this.ravineGenerator = new MapGenRavine(scramble);
|
||||
this.oceanMonumentGenerator = new StructureOceanMonument(scramble);
|
||||
this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16);
|
||||
this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16);
|
||||
this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8);
|
||||
|
|
|
@ -77,8 +77,8 @@ public class ChunkProviderHell implements IChunkProvider {
|
|||
private final WorldGenHellLava field_177472_y = new WorldGenHellLava(Blocks.flowing_lava, false);
|
||||
private final GeneratorBushFeature field_177471_z = new GeneratorBushFeature(Blocks.brown_mushroom);
|
||||
private final GeneratorBushFeature field_177465_A = new GeneratorBushFeature(Blocks.red_mushroom);
|
||||
private final MapGenNetherBridge genNetherBridge = new MapGenNetherBridge();
|
||||
private final MapGenBase netherCaveGenerator = new MapGenCavesHell();
|
||||
private final MapGenNetherBridge genNetherBridge;
|
||||
private final MapGenBase netherCaveGenerator;
|
||||
double[] noiseData1;
|
||||
double[] noiseData2;
|
||||
double[] noiseData3;
|
||||
|
@ -88,7 +88,10 @@ public class ChunkProviderHell implements IChunkProvider {
|
|||
public ChunkProviderHell(World worldIn, boolean parFlag, long parLong1) {
|
||||
this.worldObj = worldIn;
|
||||
this.field_177466_i = parFlag;
|
||||
this.hellRNG = new EaglercraftRandom(parLong1);
|
||||
boolean scramble = !worldIn.getWorldInfo().isOldEaglercraftRandom();
|
||||
this.hellRNG = new EaglercraftRandom(parLong1, scramble);
|
||||
this.genNetherBridge = new MapGenNetherBridge(scramble);
|
||||
this.netherCaveGenerator = new MapGenCavesHell(scramble);
|
||||
this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16);
|
||||
this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16);
|
||||
this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8);
|
||||
|
|
|
@ -30,12 +30,17 @@ public class MapGenBase {
|
|||
* The number of Chunks to gen-check in any given direction.
|
||||
*/
|
||||
protected int range = 8;
|
||||
/**+
|
||||
* The RNG used by the MapGen classes.
|
||||
*/
|
||||
protected EaglercraftRandom rand = new EaglercraftRandom();
|
||||
protected EaglercraftRandom rand;
|
||||
protected World worldObj;
|
||||
|
||||
public MapGenBase() {
|
||||
this(true);
|
||||
}
|
||||
|
||||
public MapGenBase(boolean scramble) {
|
||||
rand = new EaglercraftRandom(scramble);
|
||||
}
|
||||
|
||||
public void generate(IChunkProvider chunkProviderIn, World worldIn, int x, int z, ChunkPrimer chunkPrimerIn) {
|
||||
int i = this.range;
|
||||
this.worldObj = worldIn;
|
||||
|
|
|
@ -32,6 +32,11 @@ import net.minecraft.world.chunk.ChunkPrimer;
|
|||
*
|
||||
*/
|
||||
public class MapGenCaves extends MapGenBase {
|
||||
|
||||
public MapGenCaves(boolean scramble) {
|
||||
super(scramble);
|
||||
}
|
||||
|
||||
protected void func_180703_a(long parLong1, int parInt1, int parInt2, ChunkPrimer parChunkPrimer, double parDouble1,
|
||||
double parDouble2, double parDouble3) {
|
||||
this.func_180702_a(parLong1, parInt1, parInt2, parChunkPrimer, parDouble1, parDouble2, parDouble3,
|
||||
|
@ -45,7 +50,7 @@ public class MapGenCaves extends MapGenBase {
|
|||
double d1 = (double) (parInt2 * 16 + 8);
|
||||
float f = 0.0F;
|
||||
float f1 = 0.0F;
|
||||
EaglercraftRandom random = new EaglercraftRandom(parLong1);
|
||||
EaglercraftRandom random = new EaglercraftRandom(parLong1, this.rand.isScramble());
|
||||
if (parInt4 <= 0) {
|
||||
int i = this.range * 16 - 16;
|
||||
parInt4 = i - random.nextInt(i / 4);
|
||||
|
|
|
@ -28,6 +28,11 @@ import net.minecraft.world.chunk.ChunkPrimer;
|
|||
*
|
||||
*/
|
||||
public class MapGenCavesHell extends MapGenBase {
|
||||
|
||||
public MapGenCavesHell(boolean scramble) {
|
||||
super(scramble);
|
||||
}
|
||||
|
||||
protected void func_180705_a(long parLong1, int parInt1, int parInt2, ChunkPrimer parChunkPrimer, double parDouble1,
|
||||
double parDouble2, double parDouble3) {
|
||||
this.func_180704_a(parLong1, parInt1, parInt2, parChunkPrimer, parDouble1, parDouble2, parDouble3,
|
||||
|
@ -41,7 +46,7 @@ public class MapGenCavesHell extends MapGenBase {
|
|||
double d1 = (double) (parInt2 * 16 + 8);
|
||||
float f = 0.0F;
|
||||
float f1 = 0.0F;
|
||||
EaglercraftRandom random = new EaglercraftRandom(parLong1);
|
||||
EaglercraftRandom random = new EaglercraftRandom(parLong1, this.rand.isScramble());
|
||||
if (parInt4 <= 0) {
|
||||
int i = this.range * 16 - 16;
|
||||
parInt4 = i - random.nextInt(i / 4);
|
||||
|
|
|
@ -31,10 +31,14 @@ import net.minecraft.world.chunk.ChunkPrimer;
|
|||
public class MapGenRavine extends MapGenBase {
|
||||
private float[] field_75046_d = new float[1024];
|
||||
|
||||
public MapGenRavine(boolean scramble) {
|
||||
super(scramble);
|
||||
}
|
||||
|
||||
protected void func_180707_a(long parLong1, int parInt1, int parInt2, ChunkPrimer parChunkPrimer, double parDouble1,
|
||||
double parDouble2, double parDouble3, float parFloat1, float parFloat2, float parFloat3, int parInt3,
|
||||
int parInt4, double parDouble4) {
|
||||
EaglercraftRandom random = new EaglercraftRandom(parLong1);
|
||||
EaglercraftRandom random = new EaglercraftRandom(parLong1, this.rand.isScramble());
|
||||
double d0 = (double) (parInt1 * 16 + 8);
|
||||
double d1 = (double) (parInt2 * 16 + 8);
|
||||
float f = 0.0F;
|
||||
|
|
|
@ -287,7 +287,7 @@ public class WorldGenBigTree extends WorldGenAbstractTree {
|
|||
public boolean generate(World worldIn, EaglercraftRandom rand, BlockPos position) {
|
||||
this.world = worldIn;
|
||||
this.basePos = position;
|
||||
this.rand = new EaglercraftRandom(rand.nextLong());
|
||||
this.rand = new EaglercraftRandom(rand.nextLong(), !worldIn.getWorldInfo().isOldEaglercraftRandom());
|
||||
if (this.heightLimit == 0) {
|
||||
this.heightLimit = 5 + this.rand.nextInt(this.heightLimitLimit);
|
||||
}
|
||||
|
|
|
@ -27,14 +27,16 @@ import net.minecraft.util.MathHelper;
|
|||
public class MapGenMineshaft extends MapGenStructure {
|
||||
private double field_82673_e = 0.004D;
|
||||
|
||||
public MapGenMineshaft() {
|
||||
public MapGenMineshaft(boolean scramble) {
|
||||
super(scramble);
|
||||
}
|
||||
|
||||
public String getStructureName() {
|
||||
return "Mineshaft";
|
||||
}
|
||||
|
||||
public MapGenMineshaft(Map<String, String> parMap) {
|
||||
public MapGenMineshaft(Map<String, String> parMap, boolean scramble) {
|
||||
super(scramble);
|
||||
for (Entry entry : parMap.entrySet()) {
|
||||
if (((String) entry.getKey()).equals("chance")) {
|
||||
this.field_82673_e = MathHelper.parseDoubleWithDefault((String) entry.getValue(), this.field_82673_e);
|
||||
|
|
|
@ -33,7 +33,8 @@ import net.minecraft.world.biome.BiomeGenBase;
|
|||
public class MapGenNetherBridge extends MapGenStructure {
|
||||
private List<BiomeGenBase.SpawnListEntry> spawnList = Lists.newArrayList();
|
||||
|
||||
public MapGenNetherBridge() {
|
||||
public MapGenNetherBridge(boolean scramble) {
|
||||
super(scramble);
|
||||
this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityBlaze.class, 10, 2, 3));
|
||||
this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 5, 4, 4));
|
||||
this.spawnList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 10, 4, 4));
|
||||
|
|
|
@ -39,15 +39,16 @@ public class MapGenScatteredFeature extends MapGenStructure {
|
|||
private int maxDistanceBetweenScatteredFeatures;
|
||||
private int minDistanceBetweenScatteredFeatures;
|
||||
|
||||
public MapGenScatteredFeature() {
|
||||
public MapGenScatteredFeature(boolean scramble) {
|
||||
super(scramble);
|
||||
this.scatteredFeatureSpawnList = Lists.newArrayList();
|
||||
this.maxDistanceBetweenScatteredFeatures = 32;
|
||||
this.minDistanceBetweenScatteredFeatures = 8;
|
||||
this.scatteredFeatureSpawnList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 1, 1, 1));
|
||||
}
|
||||
|
||||
public MapGenScatteredFeature(Map<String, String> parMap) {
|
||||
this();
|
||||
public MapGenScatteredFeature(Map<String, String> parMap, boolean scramble) {
|
||||
this(scramble);
|
||||
|
||||
for (Entry entry : parMap.entrySet()) {
|
||||
if (((String) entry.getKey()).equals("distance")) {
|
||||
|
|
|
@ -39,7 +39,8 @@ public class MapGenStronghold extends MapGenStructure {
|
|||
private double field_82671_h;
|
||||
private int field_82672_i;
|
||||
|
||||
public MapGenStronghold() {
|
||||
public MapGenStronghold(boolean scramble) {
|
||||
super(scramble);
|
||||
this.structureCoords = new ChunkCoordIntPair[3];
|
||||
this.field_82671_h = 32.0D;
|
||||
this.field_82672_i = 3;
|
||||
|
@ -55,8 +56,8 @@ public class MapGenStronghold extends MapGenStructure {
|
|||
|
||||
}
|
||||
|
||||
public MapGenStronghold(Map<String, String> parMap) {
|
||||
this();
|
||||
public MapGenStronghold(Map<String, String> parMap, boolean scramble) {
|
||||
this(scramble);
|
||||
|
||||
for (Entry entry : parMap.entrySet()) {
|
||||
if (((String) entry.getKey()).equals("distance")) {
|
||||
|
@ -79,7 +80,7 @@ public class MapGenStronghold extends MapGenStructure {
|
|||
|
||||
protected boolean canSpawnStructureAtCoords(int i, int j) {
|
||||
if (!this.ranBiomeCheck) {
|
||||
EaglercraftRandom random = new EaglercraftRandom();
|
||||
EaglercraftRandom random = new EaglercraftRandom(!this.worldObj.getWorldInfo().isOldEaglercraftRandom());
|
||||
random.setSeed(this.worldObj.getSeed());
|
||||
double d0 = random.nextDouble() * 3.141592653589793D * 2.0D;
|
||||
int k = 1;
|
||||
|
|
|
@ -46,6 +46,14 @@ public abstract class MapGenStructure extends MapGenBase {
|
|||
|
||||
public abstract String getStructureName();
|
||||
|
||||
public MapGenStructure() {
|
||||
super();
|
||||
}
|
||||
|
||||
public MapGenStructure(boolean scramble) {
|
||||
super(scramble);
|
||||
}
|
||||
|
||||
/**+
|
||||
* Recursively called by generate()
|
||||
*/
|
||||
|
|
|
@ -40,13 +40,14 @@ public class MapGenVillage extends MapGenStructure {
|
|||
private int field_82665_g;
|
||||
private int field_82666_h;
|
||||
|
||||
public MapGenVillage() {
|
||||
public MapGenVillage(boolean scramble) {
|
||||
super(scramble);
|
||||
this.field_82665_g = 32;
|
||||
this.field_82666_h = 8;
|
||||
}
|
||||
|
||||
public MapGenVillage(Map<String, String> parMap) {
|
||||
this();
|
||||
public MapGenVillage(Map<String, String> parMap, boolean scramble) {
|
||||
this(scramble);
|
||||
|
||||
for (Entry entry : parMap.entrySet()) {
|
||||
if (((String) entry.getKey()).equals("size")) {
|
||||
|
|
|
@ -45,13 +45,14 @@ public class StructureOceanMonument extends MapGenStructure {
|
|||
BiomeGenBase.deepOcean, BiomeGenBase.river, BiomeGenBase.frozenOcean, BiomeGenBase.frozenRiver });
|
||||
private static final List<BiomeGenBase.SpawnListEntry> field_175803_h = Lists.newArrayList();
|
||||
|
||||
public StructureOceanMonument() {
|
||||
public StructureOceanMonument(boolean scramble) {
|
||||
super(scramble);
|
||||
this.field_175800_f = 32;
|
||||
this.field_175801_g = 5;
|
||||
}
|
||||
|
||||
public StructureOceanMonument(Map<String, String> parMap) {
|
||||
this();
|
||||
public StructureOceanMonument(Map<String, String> parMap, boolean scramble) {
|
||||
this(scramble);
|
||||
|
||||
for (Entry entry : parMap.entrySet()) {
|
||||
if (((String) entry.getKey()).equals("spacing")) {
|
||||
|
|
|
@ -71,6 +71,9 @@ public class WorldInfo {
|
|||
private int borderWarningTime = 15;
|
||||
private GameRules theGameRules = new GameRules();
|
||||
|
||||
public static final int eaglerVersionCurrent = 1;
|
||||
private int eaglerVersion = eaglerVersionCurrent;
|
||||
|
||||
protected WorldInfo() {
|
||||
}
|
||||
|
||||
|
@ -187,6 +190,7 @@ public class WorldInfo {
|
|||
this.borderWarningTime = nbt.getInteger("BorderWarningTime");
|
||||
}
|
||||
|
||||
this.eaglerVersion = nbt.getInteger("eaglerVersionSerial");
|
||||
}
|
||||
|
||||
public WorldInfo(WorldSettings settings, String name) {
|
||||
|
@ -296,6 +300,7 @@ public class WorldInfo {
|
|||
nbt.setDouble("BorderSizeLerpTarget", this.borderSizeLerpTarget);
|
||||
nbt.setDouble("BorderWarningBlocks", (double) this.borderWarningDistance);
|
||||
nbt.setDouble("BorderWarningTime", (double) this.borderWarningTime);
|
||||
nbt.setInteger("eaglerVersionSerial", this.eaglerVersion);
|
||||
if (this.difficulty != null) {
|
||||
nbt.setByte("Difficulty", (byte) this.difficulty.getDifficultyId());
|
||||
}
|
||||
|
@ -712,6 +717,20 @@ public class WorldInfo {
|
|||
this.difficultyLocked = flag;
|
||||
}
|
||||
|
||||
public int getEaglerVersion() {
|
||||
return this.eaglerVersion;
|
||||
}
|
||||
|
||||
public boolean isOldEaglercraftRandom() {
|
||||
return this.eaglerVersion == 0;
|
||||
}
|
||||
|
||||
public static void initEaglerVersion(NBTTagCompound compound) {
|
||||
if (!compound.hasKey("eaglerVersionSerial", 99)) {
|
||||
compound.setInteger("eaglerVersionSerial", eaglerVersionCurrent);
|
||||
}
|
||||
}
|
||||
|
||||
/**+
|
||||
* Adds this WorldInfo instance to the crash report.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user