Performance patch part 2
This commit is contained in:
parent
484b7b9e9b
commit
33ba016e56
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
|||
gradle/
|
||||
desktopRuntime/
|
||||
.gradle/
|
||||
desktopRuntime/
|
||||
build/
|
|
@ -25,13 +25,13 @@ sourceSets {
|
|||
|
||||
teavm.js {
|
||||
addedToWebApp = true;
|
||||
mainClass = "net.lax1dude.eaglercraft.Client"
|
||||
mainClass = "net.PeytonPlayz585.Client"
|
||||
outputDir = file("web");
|
||||
targetFileName = "app.js";
|
||||
obfuscated = true;
|
||||
sourceMap = true;
|
||||
entryPointName = 'main';
|
||||
properties = null;
|
||||
optimization = org.teavm.gradle.api.OptimizationLevel.AGGRESSIVE;
|
||||
optimization = org.teavm.gradle.api.OptimizationLevel.BALANCED;
|
||||
processMemory = 512;
|
||||
}
|
|
@ -12,5 +12,8 @@
|
|||
<classpathentry kind="lib" path="jars/lwjgl.jar"/>
|
||||
<classpathentry kind="lib" path="jars/lwjgl-opengles.jar"/>
|
||||
<classpathentry kind="lib" path="jars/Java-WebSocket-1.5.1-with-dependencies.jar"/>
|
||||
<classpathentry kind="lib" path="jars/teavm-interop-0.6.1.jar"/>
|
||||
<classpathentry kind="lib" path="jars/teavm-jso-0.6.1.jar"/>
|
||||
<classpathentry kind="lib" path="jars/teavm-jso-apis-0.6.1.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>src_teavm_java</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC../src/teavm/java</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>src_lwjgl_java</name>
|
||||
<type>2</type>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -23,10 +23,14 @@ in vec4 a_color;
|
|||
#ifdef CC_a_normal
|
||||
in vec4 a_normal;
|
||||
#endif
|
||||
|
||||
#ifdef CC_fog
|
||||
out vec4 v_position;
|
||||
#ifdef CC_a_texture1
|
||||
in vec2 a_texture1;
|
||||
#endif
|
||||
|
||||
#ifdef CC_TEX_GEN_STRQ
|
||||
out vec4 v_object_pos;
|
||||
#endif
|
||||
out vec4 v_position;
|
||||
#ifdef CC_a_color
|
||||
out vec4 v_color;
|
||||
#endif
|
||||
|
@ -36,11 +40,20 @@ out vec4 v_normal;
|
|||
#ifdef CC_a_texture0
|
||||
out vec2 v_texture0;
|
||||
#endif
|
||||
#ifdef CC_a_texture1
|
||||
out vec2 v_texture1;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CC_VERT
|
||||
|
||||
void main(){
|
||||
vec4 pos = matrix_m * vec4(a_position, 1.0);
|
||||
#ifdef CC_fog
|
||||
v_position = pos;
|
||||
#ifdef CC_TEX_GEN_STRQ
|
||||
v_object_pos = vec4(a_position, 1.0);
|
||||
#endif
|
||||
#ifdef CC_a_color
|
||||
v_color = a_color;
|
||||
|
@ -50,6 +63,9 @@ void main(){
|
|||
#endif
|
||||
#ifdef CC_a_texture0
|
||||
v_texture0 = a_texture0;
|
||||
#endif
|
||||
#ifdef CC_a_texture1
|
||||
v_texture1 = a_texture1;
|
||||
#endif
|
||||
gl_Position = matrix_p * pos;
|
||||
}
|
||||
|
@ -58,12 +74,10 @@ void main(){
|
|||
|
||||
#ifdef CC_FRAG
|
||||
|
||||
#ifdef CC_unit0
|
||||
uniform sampler2D tex0;
|
||||
#ifndef CC_a_texture0
|
||||
uniform sampler2D tex1;
|
||||
uniform vec2 texCoordV0;
|
||||
#endif
|
||||
#endif
|
||||
uniform vec2 texCoordV1;
|
||||
#ifdef CC_lighting
|
||||
uniform vec3 light0Pos;
|
||||
uniform vec3 light1Pos;
|
||||
|
@ -71,20 +85,35 @@ uniform vec3 normalUniform;
|
|||
#endif
|
||||
#ifdef CC_fog
|
||||
uniform vec4 fogColor;
|
||||
uniform int fogMode;
|
||||
uniform float fogStart;
|
||||
uniform float fogEnd;
|
||||
uniform float fogDensity;
|
||||
uniform float fogPremultiply;
|
||||
//X = uniform float fogMode;
|
||||
//Y = uniform float fogStart;
|
||||
//Z = uniform float fogEnd - fogStart;
|
||||
//W = uniform float fogDensity;
|
||||
uniform vec4 fogParam;
|
||||
#endif
|
||||
uniform vec4 colorUniform;
|
||||
#ifdef CC_alphatest
|
||||
uniform float alphaTestF;
|
||||
#endif
|
||||
|
||||
#ifdef CC_fog
|
||||
in vec4 v_position;
|
||||
#ifdef CC_TEX_GEN_STRQ
|
||||
//uniform int textureGenS_M;
|
||||
//uniform int textureGenT_M;
|
||||
//uniform int textureGenR_M;
|
||||
//uniform int textureGenQ_M;
|
||||
uniform ivec4 textureGen_M;
|
||||
uniform vec4 textureGenS_V;
|
||||
uniform vec4 textureGenT_V;
|
||||
uniform vec4 textureGenR_V;
|
||||
uniform vec4 textureGenQ_V;
|
||||
#endif
|
||||
#ifdef CC_patch_anisotropic
|
||||
uniform vec2 anisotropic_fix;
|
||||
#endif
|
||||
|
||||
#ifdef CC_TEX_GEN_STRQ
|
||||
in vec4 v_object_pos;
|
||||
#endif
|
||||
in vec4 v_position;
|
||||
#ifdef CC_a_color
|
||||
in vec4 v_color;
|
||||
#endif
|
||||
|
@ -94,10 +123,14 @@ in vec4 v_normal;
|
|||
#ifdef CC_a_texture0
|
||||
in vec2 v_texture0;
|
||||
#endif
|
||||
#ifdef CC_a_texture1
|
||||
in vec2 v_texture1;
|
||||
#endif
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
#define TEX_MAT3x2(mat4In) mat3x2(mat4In[0].xy,mat4In[1].xy,mat4In[3].xy)
|
||||
#define TEX_MAT4x3(mat4In) mat4x3(mat4In[0].xyw,mat4In[1].xyw,mat4In[2].xyw,mat4In[3].xyw)
|
||||
|
||||
void main(){
|
||||
#ifdef CC_a_color
|
||||
|
@ -106,12 +139,48 @@ void main(){
|
|||
vec4 color = colorUniform;
|
||||
#endif
|
||||
|
||||
#ifdef CC_TEX_GEN_STRQ
|
||||
vec4 texSrc[2];
|
||||
texSrc[0] = v_object_pos;
|
||||
texSrc[1] = v_position;
|
||||
|
||||
vec4 texPos;
|
||||
texPos.x = dot(texSrc[textureGen_M.x], textureGenS_V);
|
||||
texPos.y = dot(texSrc[textureGen_M.y], textureGenT_V);
|
||||
texPos.z = dot(texSrc[textureGen_M.z], textureGenR_V);
|
||||
texPos.w = dot(texSrc[textureGen_M.w], textureGenQ_V);
|
||||
texPos.xyz = TEX_MAT4x3(matrix_t) * texPos;
|
||||
color *= texture(tex0, texPos.xy / texPos.z).bgra;
|
||||
#ifdef CC_alphatest
|
||||
if(color.a < alphaTestF){
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#ifdef CC_unit0
|
||||
#ifdef CC_a_texture0
|
||||
color *= texture(tex0, (TEX_MAT3x2(matrix_t) * vec3(v_texture0, 1.0)).xy).rgba;
|
||||
|
||||
#ifdef CC_patch_anisotropic
|
||||
vec2 uv = TEX_MAT3x2(matrix_t) * vec3(v_texture0, 1.0);
|
||||
|
||||
/* https://bugs.chromium.org/p/angleproject/issues/detail?id=4994 */
|
||||
uv = ((uv * anisotropic_fix) - fract(uv * anisotropic_fix) + 0.5) / anisotropic_fix;
|
||||
|
||||
vec4 texColor = texture(tex0, uv);
|
||||
#else
|
||||
color *= texture(tex0, (TEX_MAT3x2(matrix_t) * vec3(texCoordV0, 1.0)).xy).rgba;
|
||||
vec4 texColor = texture(tex0, TEX_MAT3x2(matrix_t) * vec3(v_texture0, 1.0));
|
||||
#endif
|
||||
|
||||
#else
|
||||
vec4 texColor = texture(tex0, TEX_MAT3x2(matrix_t) * vec3(texCoordV0, 1.0));
|
||||
#endif
|
||||
|
||||
#ifdef CC_swap_rb
|
||||
color *= texColor.rgba;
|
||||
#else
|
||||
color *= texColor.bgra;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CC_alphatest
|
||||
|
@ -120,6 +189,15 @@ void main(){
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CC_unit1
|
||||
#ifdef CC_a_texture1
|
||||
color.rgb *= texture(tex1, (v_texture1 + 8.0) * 0.00390625).bgr;
|
||||
#else
|
||||
color.rgb *= texture(tex1, (texCoordV1 + 8.0) * 0.00390625).bgr;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CC_lighting
|
||||
#ifdef CC_a_normal
|
||||
vec3 normal = ((v_normal.xyz - 0.5) * 2.0);
|
||||
|
@ -133,11 +211,12 @@ void main(){
|
|||
|
||||
#ifdef CC_fog
|
||||
float dist = sqrt(dot(v_position, v_position));
|
||||
float i = (fogMode == 1) ? clamp((dist - fogStart) / (fogEnd - fogStart), 0.0, 1.0) : clamp(1.0 - exp(-(fogDensity * dist)), 0.0, 1.0);
|
||||
color.rgb = mix(color.rgb, fogColor.xyz, i * fogColor.a);
|
||||
float i = fogParam.x == 1.0 ? (dist - fogParam.y) / fogParam.z : 1.0 - exp(-fogParam.w * dist);
|
||||
color.rgb = mix(color.rgb, fogColor.xyz, clamp(i, 0.0, 1.0) * fogColor.a);
|
||||
#endif
|
||||
|
||||
fragColor = color;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,255 +0,0 @@
|
|||
#line 0
|
||||
|
||||
precision lowp int;
|
||||
precision lowp sampler2D;
|
||||
precision lowp float;
|
||||
|
||||
in vec2 pos;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
#define FXAA_PC 1
|
||||
#define FXAA_GLSL_130 1
|
||||
#define FXAA_FAST_PIXEL_OFFSET 0
|
||||
#define FXAA_GATHER4_ALPHA 0
|
||||
|
||||
#ifndef FXAA_GREEN_AS_LUMA
|
||||
// For those using non-linear color,
|
||||
// and either not able to get luma in alpha, or not wanting to,
|
||||
// this enables FXAA to run using green as a proxy for luma.
|
||||
// So with this enabled, no need to pack luma in alpha.
|
||||
//
|
||||
// This will turn off AA on anything which lacks some amount of green.
|
||||
// Pure red and blue or combination of only R and B, will get no AA.
|
||||
//
|
||||
// Might want to lower the settings for both,
|
||||
// fxaaConsoleEdgeThresholdMin
|
||||
// fxaaQualityEdgeThresholdMin
|
||||
// In order to insure AA does not get turned off on colors
|
||||
// which contain a minor amount of green.
|
||||
//
|
||||
// 1 = On.
|
||||
// 0 = Off.
|
||||
//
|
||||
#define FXAA_GREEN_AS_LUMA 1
|
||||
#endif
|
||||
|
||||
#ifndef FXAA_DISCARD
|
||||
// 1 = Use discard on pixels which don't need AA.
|
||||
// 0 = Return unchanged color on pixels which don't need AA.
|
||||
#define FXAA_DISCARD 0
|
||||
#endif
|
||||
|
||||
/*============================================================================
|
||||
API PORTING
|
||||
============================================================================*/
|
||||
#define FxaaBool bool
|
||||
#define FxaaDiscard discard
|
||||
#define FxaaFloat float
|
||||
#define FxaaFloat2 vec2
|
||||
#define FxaaFloat3 vec3
|
||||
#define FxaaFloat4 vec4
|
||||
#define FxaaHalf float
|
||||
#define FxaaHalf2 vec2
|
||||
#define FxaaHalf3 vec3
|
||||
#define FxaaHalf4 vec4
|
||||
#define FxaaInt2 ivec2
|
||||
#define FxaaSat(x) clamp(x, 0.0, 1.0)
|
||||
#define FxaaTex sampler2D
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#define FxaaTexTop(t, p) texture(t, p)
|
||||
|
||||
/*============================================================================
|
||||
GREEN AS LUMA OPTION SUPPORT FUNCTION
|
||||
============================================================================*/
|
||||
#if (FXAA_GREEN_AS_LUMA == 0)
|
||||
// TODO Luma
|
||||
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return dot(rgba.xyz, vec3(0.299, 0.587, 0.114)); }
|
||||
#else
|
||||
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
|
||||
#endif
|
||||
|
||||
/*============================================================================
|
||||
FXAA3 CONSOLE - PC VERSION
|
||||
============================================================================*/
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat4 FxaaPixelShader(
|
||||
// See FXAA Quality FxaaPixelShader() source for docs on Inputs!
|
||||
//
|
||||
// Use noperspective interpolation here (turn off perspective interpolation).
|
||||
// {xy} = center of pixel
|
||||
FxaaFloat2 pos,
|
||||
//
|
||||
// Used only for FXAA Console, and not used on the 360 version.
|
||||
// Use noperspective interpolation here (turn off perspective interpolation).
|
||||
// {xy__} = upper left of pixel
|
||||
// {__zw} = lower right of pixel
|
||||
FxaaFloat4 fxaaConsolePosPos,
|
||||
//
|
||||
// Input color texture.
|
||||
// {rgb_} = color in linear or perceptual color space
|
||||
// if (FXAA_GREEN_AS_LUMA == 0)
|
||||
// {___a} = luma in perceptual color space (not linear)
|
||||
FxaaTex tex,
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// This must be from a constant/uniform.
|
||||
// This effects sub-pixel AA quality and inversely sharpness.
|
||||
// Where N ranges between,
|
||||
// N = 0.50 (default)
|
||||
// N = 0.33 (sharper)
|
||||
// {x___} = -N/screenWidthInPixels
|
||||
// {_y__} = -N/screenHeightInPixels
|
||||
// {__z_} = N/screenWidthInPixels
|
||||
// {___w} = N/screenHeightInPixels
|
||||
FxaaFloat4 fxaaConsoleRcpFrameOpt,
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// Not used on 360, but used on PS3 and PC.
|
||||
// This must be from a constant/uniform.
|
||||
// {x___} = -2.0/screenWidthInPixels
|
||||
// {_y__} = -2.0/screenHeightInPixels
|
||||
// {__z_} = 2.0/screenWidthInPixels
|
||||
// {___w} = 2.0/screenHeightInPixels
|
||||
FxaaFloat4 fxaaConsoleRcpFrameOpt2,
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.
|
||||
// It is here now to allow easier tuning.
|
||||
// This does not effect PS3, as this needs to be compiled in.
|
||||
// Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3.
|
||||
// Due to the PS3 being ALU bound,
|
||||
// there are only three safe values here: 2 and 4 and 8.
|
||||
// These options use the shaders ability to a free *|/ by 2|4|8.
|
||||
// For all other platforms can be a non-power of two.
|
||||
// 8.0 is sharper (default!!!)
|
||||
// 4.0 is softer
|
||||
// 2.0 is really soft (good only for vector graphics inputs)
|
||||
FxaaFloat fxaaConsoleEdgeSharpness,
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define.
|
||||
// It is here now to allow easier tuning.
|
||||
// This does not effect PS3, as this needs to be compiled in.
|
||||
// Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3.
|
||||
// Due to the PS3 being ALU bound,
|
||||
// there are only two safe values here: 1/4 and 1/8.
|
||||
// These options use the shaders ability to a free *|/ by 2|4|8.
|
||||
// The console setting has a different mapping than the quality setting.
|
||||
// Other platforms can use other values.
|
||||
// 0.125 leaves less aliasing, but is softer (default!!!)
|
||||
// 0.25 leaves more aliasing, and is sharper
|
||||
FxaaFloat fxaaConsoleEdgeThreshold,
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// This used to be the FXAA_CONSOLE__EDGE_THRESHOLD_MIN define.
|
||||
// It is here now to allow easier tuning.
|
||||
// Trims the algorithm from processing darks.
|
||||
// The console setting has a different mapping than the quality setting.
|
||||
// This does not apply to PS3,
|
||||
// PS3 was simplified to avoid more shader instructions.
|
||||
// 0.06 - faster but more aliasing in darks
|
||||
// 0.05 - default
|
||||
// 0.04 - slower and less aliasing in darks
|
||||
// Special notes when using FXAA_GREEN_AS_LUMA,
|
||||
// Likely want to set this to zero.
|
||||
// As colors that are mostly not-green
|
||||
// will appear very dark in the green channel!
|
||||
// Tune by looking at mostly non-green content,
|
||||
// then start at zero and increase until aliasing is a problem.
|
||||
FxaaFloat fxaaConsoleEdgeThresholdMin
|
||||
) {
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaNw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xy));
|
||||
FxaaFloat lumaSw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xw));
|
||||
FxaaFloat lumaNe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zy));
|
||||
FxaaFloat lumaSe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zw));
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat4 rgbyM = FxaaTexTop(tex, pos.xy);
|
||||
#if (FXAA_GREEN_AS_LUMA == 0)
|
||||
// TODO Luma
|
||||
FxaaFloat lumaM = FxaaLuma(rgbyM);
|
||||
#else
|
||||
FxaaFloat lumaM = rgbyM.y;
|
||||
#endif
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaMaxNwSw = max(lumaNw, lumaSw);
|
||||
lumaNe += 1.0/384.0;
|
||||
FxaaFloat lumaMinNwSw = min(lumaNw, lumaSw);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaMaxNeSe = max(lumaNe, lumaSe);
|
||||
FxaaFloat lumaMinNeSe = min(lumaNe, lumaSe);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaMax = max(lumaMaxNeSe, lumaMaxNwSw);
|
||||
FxaaFloat lumaMin = min(lumaMinNeSe, lumaMinNwSw);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaMaxScaled = lumaMax * fxaaConsoleEdgeThreshold;
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat lumaMinM = min(lumaMin, lumaM);
|
||||
FxaaFloat lumaMaxScaledClamped = max(fxaaConsoleEdgeThresholdMin, lumaMaxScaled);
|
||||
FxaaFloat lumaMaxM = max(lumaMax, lumaM);
|
||||
FxaaFloat dirSwMinusNe = lumaSw - lumaNe;
|
||||
FxaaFloat lumaMaxSubMinM = lumaMaxM - lumaMinM;
|
||||
FxaaFloat dirSeMinusNw = lumaSe - lumaNw;
|
||||
if(lumaMaxSubMinM < lumaMaxScaledClamped)
|
||||
{
|
||||
#if (FXAA_DISCARD == 1)
|
||||
FxaaDiscard;
|
||||
#else
|
||||
return rgbyM;
|
||||
#endif
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat2 dir;
|
||||
dir.x = dirSwMinusNe + dirSeMinusNw;
|
||||
dir.y = dirSwMinusNe - dirSeMinusNw;
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat2 dir1 = normalize(dir.xy);
|
||||
FxaaFloat4 rgbyN1 = FxaaTexTop(tex, pos.xy - dir1 * fxaaConsoleRcpFrameOpt.zw);
|
||||
FxaaFloat4 rgbyP1 = FxaaTexTop(tex, pos.xy + dir1 * fxaaConsoleRcpFrameOpt.zw);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * fxaaConsoleEdgeSharpness;
|
||||
FxaaFloat2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat2 dir2x = dir2 * fxaaConsoleRcpFrameOpt2.zw;
|
||||
FxaaFloat4 rgbyN2 = FxaaTexTop(tex, pos.xy - dir2x);
|
||||
FxaaFloat4 rgbyP2 = FxaaTexTop(tex, pos.xy + dir2x);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
FxaaFloat4 rgbyA = rgbyN1 + rgbyP1;
|
||||
FxaaFloat4 rgbyB = ((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25);
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#if (FXAA_GREEN_AS_LUMA == 0)
|
||||
// TODO Luma
|
||||
float lumaB = FxaaLuma(rgbyB);
|
||||
#else
|
||||
float lumaB = rgbyB.y;
|
||||
#endif
|
||||
if((lumaB < lumaMin) || (lumaB > lumaMax))
|
||||
rgbyB.xyz = rgbyA.xyz * 0.5;
|
||||
//
|
||||
return rgbyB;
|
||||
}
|
||||
/*==========================================================================*/
|
||||
|
||||
uniform sampler2D f_color;
|
||||
|
||||
uniform vec2 screenSize;
|
||||
|
||||
#define edgeSharpness 7.0
|
||||
#define edgeThreshold 0.1
|
||||
#define edgeThresholdMin 0.005
|
||||
|
||||
void main(){
|
||||
vec4 posPos;
|
||||
posPos.xy = pos - (0.6 / screenSize);
|
||||
posPos.zw = pos + (0.6 / screenSize);
|
||||
vec4 rcpFrameOpt;
|
||||
rcpFrameOpt.xy = vec2(-0.50, -0.50) / screenSize;
|
||||
rcpFrameOpt.zw = vec2( 0.50, 0.50) / screenSize;
|
||||
vec4 rcpFrameOpt2;
|
||||
rcpFrameOpt2.xy = vec2(-2.0, -2.0) / screenSize;
|
||||
rcpFrameOpt2.zw = vec2( 2.0, 2.0) / screenSize;
|
||||
|
||||
fragColor = vec4(FxaaPixelShader(pos, posPos, f_color, rcpFrameOpt, rcpFrameOpt2, edgeSharpness, edgeThreshold, edgeThresholdMin).rgb, 1.0);
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
#line 2
|
||||
|
||||
precision highp int;
|
||||
precision highp sampler2D;
|
||||
precision highp float;
|
||||
|
||||
#ifdef CC_VERT
|
||||
uniform mat4 matrix_m;
|
||||
uniform mat4 matrix_p;
|
||||
|
||||
in vec3 a_vert;
|
||||
|
||||
void main(){
|
||||
gl_Position = (matrix_p * (matrix_m * vec4(a_vert, 1.0)));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CC_FRAG
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
fragColor = vec4(1.0);
|
||||
}
|
||||
#endif
|
|
@ -1,13 +0,0 @@
|
|||
#line 0
|
||||
|
||||
precision lowp int;
|
||||
precision lowp sampler2D;
|
||||
precision lowp float;
|
||||
|
||||
in vec2 a_pos;
|
||||
|
||||
out vec2 pos;
|
||||
|
||||
void main(){
|
||||
gl_Position = vec4((pos = a_pos) * 2.0 - 1.0, 0.0, 1.0);
|
||||
}
|
376
src/lwjgl/java/net/PeytonPlayz585/fileutils/File.java
Normal file
376
src/lwjgl/java/net/PeytonPlayz585/fileutils/File.java
Normal file
|
@ -0,0 +1,376 @@
|
|||
package net.PeytonPlayz585.fileutils;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class File {
|
||||
|
||||
private static final java.io.File filesystemBaseDirectory = new java.io.File("filesystem");
|
||||
|
||||
static {
|
||||
filesystemBaseDirectory.mkdirs();
|
||||
}
|
||||
|
||||
private String path;
|
||||
private transient int prefixLength;
|
||||
private final char slash = '/';
|
||||
private static final String pathSeperator = "/";
|
||||
private static final String[] altPathSeperator = new String[] { "\\" };
|
||||
|
||||
public File(String pathName) {
|
||||
if (pathName == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
this.path = this.normalize(pathName);
|
||||
this.prefixLength = this.prefixLength(this.path);
|
||||
}
|
||||
|
||||
public File(String parent, String child) {
|
||||
if (child == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
if(parent != null) {
|
||||
this.path = this.createPath(parent, child);
|
||||
} else {
|
||||
this.path = this.normalize(child);
|
||||
}
|
||||
}
|
||||
|
||||
public File(File parent, String child) {
|
||||
if (child == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if(parent != null) {
|
||||
this.path = this.createPath(parent.path, child);
|
||||
} else {
|
||||
this.path = this.normalize(child);
|
||||
}
|
||||
}
|
||||
|
||||
private int prefixLength(String path) {
|
||||
char slash = this.slash;
|
||||
int n = path.length();
|
||||
if (n == 0) return 0;
|
||||
char c0 = path.charAt(0);
|
||||
char c1 = (n > 1) ? path.charAt(1) : 0;
|
||||
if (c0 == slash) {
|
||||
if (c1 == slash) return 2;
|
||||
return 1;
|
||||
}
|
||||
if (isLetter(c0) && (c1 == ':')) {
|
||||
if ((n > 2) && (path.charAt(2) == slash))
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private boolean isLetter(char c) {
|
||||
return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'));
|
||||
}
|
||||
|
||||
private String normalize(String p) {
|
||||
for(int i = 0; i < altPathSeperator.length; ++i) {
|
||||
p = p.replace(altPathSeperator[i], pathSeperator);
|
||||
}
|
||||
if(p.startsWith(pathSeperator)) {
|
||||
p = p.substring(1);
|
||||
}
|
||||
if(p.endsWith(pathSeperator)) {
|
||||
p = p.substring(0, p.length() - pathSeperator.length());
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
private String[] splitPath(String p) {
|
||||
String[] pth = normalize(p).split(pathSeperator);
|
||||
for(int i = 0; i < pth.length; ++i) {
|
||||
pth[i] = pth[i].trim();
|
||||
}
|
||||
return pth;
|
||||
}
|
||||
|
||||
private String createPath(Object... p) {
|
||||
ArrayList<String> r = new ArrayList();
|
||||
for(int i = 0; i < p.length; ++i) {
|
||||
if(p[i] == null) {
|
||||
continue;
|
||||
}
|
||||
String gg = p[i].toString();
|
||||
if(gg == null) {
|
||||
continue;
|
||||
}
|
||||
String[] parts = splitPath(gg);
|
||||
for(int j = 0; j < parts.length; ++j) {
|
||||
if(parts[j] == null || parts[j].equals(".")) {
|
||||
continue;
|
||||
}else if(parts[j].equals("..") && r.size() > 0) {
|
||||
int k = r.size() - 1;
|
||||
if(!r.get(k).equals("..")) {
|
||||
r.remove(k);
|
||||
}else {
|
||||
r.add("..");
|
||||
}
|
||||
}else {
|
||||
r.add(parts[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(r.size() > 0) {
|
||||
StringBuilder s = new StringBuilder();
|
||||
for(int i = 0; i < r.size(); ++i) {
|
||||
if(i > 0) {
|
||||
s.append(pathSeperator);
|
||||
}
|
||||
s.append(r.get(i));
|
||||
}
|
||||
return s.toString();
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ======== Virtual Filesystem Functions =============
|
||||
|
||||
public String getName() {
|
||||
int index = path.lastIndexOf(slash);
|
||||
if (index < prefixLength) return path.substring(prefixLength);
|
||||
return path.substring(index + 1);
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public boolean exists() {
|
||||
return exists(path);
|
||||
}
|
||||
|
||||
public boolean isDirectory() {
|
||||
return exists(path) && directoryExists(path);
|
||||
}
|
||||
|
||||
public void renameTo(File newPath) {
|
||||
renameFile(path, newPath.path);
|
||||
}
|
||||
|
||||
public byte[] read() {
|
||||
return readFile(path);
|
||||
}
|
||||
|
||||
public void write(byte[] data) {
|
||||
writeFile(path, data);
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
deleteFile(path);
|
||||
}
|
||||
|
||||
public void mkdir() {
|
||||
(new java.io.File(filesystemBaseDirectory, stripPath(path))).mkdir();
|
||||
}
|
||||
|
||||
public File[] listFiles() {
|
||||
Collection<FileEntry> collection = listFiles(path, false, false);
|
||||
int size = collection.size();
|
||||
FileEntry[] entries = collection.toArray(new FileEntry[size]);
|
||||
File[] files = new File[size];
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
files[i] = new File(entries[i].path);
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
public static final boolean exists(String path) {
|
||||
return (new java.io.File(filesystemBaseDirectory, stripPath(path))).exists();
|
||||
}
|
||||
|
||||
public static final boolean fileExists(String path) {
|
||||
return (new java.io.File(filesystemBaseDirectory, stripPath(path))).isFile();
|
||||
}
|
||||
|
||||
public static final boolean directoryExists(String path) {
|
||||
return (new java.io.File(filesystemBaseDirectory, stripPath(path))).isDirectory();
|
||||
}
|
||||
|
||||
public static final boolean pathExists(String path) {
|
||||
return (new java.io.File(filesystemBaseDirectory, stripPath(path))).exists();
|
||||
}
|
||||
|
||||
public static final void writeFile(String path, byte[] data) {
|
||||
try {
|
||||
java.io.File f = new java.io.File(filesystemBaseDirectory, stripPath(path));
|
||||
java.io.File p = f.getParentFile();
|
||||
if(p != null) {
|
||||
p.mkdirs();
|
||||
}
|
||||
FileOutputStream os = new FileOutputStream(f);
|
||||
os.write(data);
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static final byte[] readFile(String path) {
|
||||
java.io.File f = new java.io.File(filesystemBaseDirectory, stripPath(path));
|
||||
if(!f.isFile()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
byte[] ret = new byte[(int)f.length()];
|
||||
FileInputStream in = new FileInputStream(f);
|
||||
in.read(ret);
|
||||
in.close();
|
||||
return ret;
|
||||
}catch(IOException ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static final long getLastModified(String path) {
|
||||
return (new java.io.File(filesystemBaseDirectory, stripPath(path))).lastModified();
|
||||
}
|
||||
|
||||
public static final int getFileSize(String path) {
|
||||
return (int)(new java.io.File(filesystemBaseDirectory, stripPath(path))).length();
|
||||
}
|
||||
|
||||
public static final void renameFile(String oldPath, String newPath) {
|
||||
java.io.File f1 = new java.io.File(filesystemBaseDirectory, stripPath(oldPath));
|
||||
java.io.File f2 = new java.io.File(filesystemBaseDirectory, stripPath(newPath));
|
||||
if(f1.exists()) {
|
||||
if(f2.exists()) {
|
||||
try {
|
||||
FileInputStream fs1 = new FileInputStream(f1);
|
||||
FileOutputStream fs2 = new FileOutputStream(f2);
|
||||
byte[] buffer = new byte[1024 * 64];
|
||||
int a;
|
||||
while((a = fs1.read(buffer)) > 0) {
|
||||
fs2.write(buffer, 0, a);
|
||||
}
|
||||
fs1.close();
|
||||
fs2.close();
|
||||
f1.delete();
|
||||
} catch (IOException e) {
|
||||
System.err.println("Copy from '" + oldPath + "' to '" + newPath + "' failed");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else {
|
||||
java.io.File p = f2.getParentFile();
|
||||
if(p != null) {
|
||||
p.mkdirs();
|
||||
}
|
||||
f1.renameTo(f2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final void copyFile(String oldPath, String newPath) {
|
||||
try {
|
||||
java.io.File ff2 = new java.io.File(filesystemBaseDirectory, stripPath(newPath));
|
||||
java.io.File p = ff2.getParentFile();
|
||||
if(p != null) {
|
||||
p.mkdirs();
|
||||
}
|
||||
FileInputStream f1 = new FileInputStream(new java.io.File(filesystemBaseDirectory, stripPath(oldPath)));
|
||||
FileOutputStream f2 = new FileOutputStream(ff2);
|
||||
byte[] buffer = new byte[1024 * 64];
|
||||
int a;
|
||||
while((a = f1.read(buffer)) > 0) {
|
||||
f2.write(buffer, 0, a);
|
||||
}
|
||||
f1.close();
|
||||
f2.close();
|
||||
} catch (IOException e) {
|
||||
System.err.println("Copy from '" + oldPath + "' to '" + newPath + "' failed");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static final void deleteFile(String path) {
|
||||
(new java.io.File(filesystemBaseDirectory, stripPath(path))).delete();
|
||||
}
|
||||
|
||||
public static final Collection<FileEntry> listFiles(String path, boolean listDirs, boolean recursiveDirs) {
|
||||
path = stripPath(path);
|
||||
ArrayList<FileEntry> ret = new ArrayList<>();
|
||||
java.io.File f = new java.io.File(filesystemBaseDirectory, path);
|
||||
if(f.isFile()) {
|
||||
ret.add(new FileEntry(path, false, f.lastModified()));
|
||||
}else if(f.isDirectory()) {
|
||||
for(java.io.File ff : f.listFiles()) {
|
||||
if(ff.isDirectory()) {
|
||||
if(listDirs && !recursiveDirs) {
|
||||
ret.add(new FileEntry(path + "/" + ff.getName(), true, -1l));
|
||||
}
|
||||
if(recursiveDirs) {
|
||||
recursiveListing(path + "/" + ff.getName(), ff, ret, listDirs, recursiveDirs);
|
||||
}
|
||||
}else {
|
||||
ret.add(new FileEntry(path + "/" + ff.getName(), false, ff.lastModified()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static void recursiveListing(String path, java.io.File f, Collection<FileEntry> lst, boolean listDirs, boolean recursiveDirs) {
|
||||
if(f.isFile()) {
|
||||
lst.add(new FileEntry(path, false, f.lastModified()));
|
||||
}else if(f.isDirectory()) {
|
||||
if(listDirs) {
|
||||
lst.add(new FileEntry(path, true, -1l));
|
||||
}
|
||||
if(recursiveDirs) {
|
||||
for(java.io.File ff : f.listFiles()) {
|
||||
recursiveListing(path + "/" + ff.getName(), ff, lst, listDirs, recursiveDirs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final Collection<FileEntry> listFilesAndDirectories(String path) {
|
||||
return listFiles(path, true, false);
|
||||
}
|
||||
|
||||
public static final Collection<FileEntry> listFilesRecursive(String path) {
|
||||
return listFiles(path, false, true);
|
||||
}
|
||||
|
||||
public static final FileEntry[] listFiles(String path) {
|
||||
Collection<FileEntry> entries = listFilesAndDirectories(path);
|
||||
FileEntry[] entryArray = new FileEntry[entries.size()];
|
||||
|
||||
int i = 0;
|
||||
for(FileEntry entry : entries) {
|
||||
entryArray[i] = entry;
|
||||
i = i + 1;
|
||||
}
|
||||
return entryArray;
|
||||
}
|
||||
|
||||
private static String stripPath(String str) {
|
||||
if(str.startsWith("/")) {
|
||||
str = str.substring(1);
|
||||
}
|
||||
if(str.endsWith("/")) {
|
||||
str = str.substring(0, str.length() - 1);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static boolean isCompressed(byte[] b) {
|
||||
if(b == null || b.length < 2) {
|
||||
return false;
|
||||
}
|
||||
return (b[0] == (byte) 0x1F) && (b[1] == (byte) 0x8B);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package net.PeytonPlayz585.fileutils;
|
||||
|
||||
public class FileChooserResult {
|
||||
|
||||
public final String fileName;
|
||||
public final byte[] fileData;
|
||||
|
||||
public FileChooserResult(String fileName, byte[] fileData) {
|
||||
this.fileName = fileName;
|
||||
this.fileData = fileData;
|
||||
}
|
||||
|
||||
}
|
36
src/lwjgl/java/net/PeytonPlayz585/fileutils/FileEntry.java
Normal file
36
src/lwjgl/java/net/PeytonPlayz585/fileutils/FileEntry.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package net.PeytonPlayz585.fileutils;
|
||||
|
||||
public class FileEntry {
|
||||
|
||||
public final String path;
|
||||
public final boolean isDirectory;
|
||||
public final long lastModified;
|
||||
|
||||
public FileEntry(String path, boolean isDirectory, long lastModified) {
|
||||
this.path = path;
|
||||
this.isDirectory = isDirectory;
|
||||
this.lastModified = lastModified;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
int i = path.indexOf('/');
|
||||
if(i >= 0) {
|
||||
return path.substring(i + 1);
|
||||
}else {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFile() {
|
||||
return !isDirectory;
|
||||
}
|
||||
|
||||
public long length() {
|
||||
return File.getFileSize(path);
|
||||
}
|
||||
|
||||
public long lastModified() {
|
||||
return File.getLastModified(path);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package net.PeytonPlayz585.fileutils;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class FilesystemUtils {
|
||||
|
||||
public static void recursiveDeleteDirectory(String dir) {
|
||||
Collection<FileEntry> lst = File.listFiles(dir, true, true);
|
||||
for(FileEntry t : lst) {
|
||||
if(!t.isDirectory) {
|
||||
File.deleteFile(t.path);
|
||||
}
|
||||
}
|
||||
for(FileEntry t : lst) {
|
||||
if(t.isDirectory) {
|
||||
File.deleteFile(t.path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Why THE FUCK was this even here in the first place
|
||||
//File.deleteFile(dir);
|
||||
}
|
||||
|
||||
}
|
9
src/lwjgl/java/net/PeytonPlayz585/opengl/GL11.java
Normal file
9
src/lwjgl/java/net/PeytonPlayz585/opengl/GL11.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package net.PeytonPlayz585.opengl;
|
||||
|
||||
public class GL11 extends GL11_1 {
|
||||
|
||||
public static class EaglerAdapterImpl2 extends GL11_1.EaglerAdapterImpl2 {
|
||||
|
||||
}
|
||||
|
||||
}
|
7572
src/lwjgl/java/net/PeytonPlayz585/opengl/GL11_1.java
Normal file
7572
src/lwjgl/java/net/PeytonPlayz585/opengl/GL11_1.java
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -43,7 +43,7 @@ public class SoundManager {
|
|||
|
||||
file = "sounds/" + file;
|
||||
if(flag) {
|
||||
int i1 = GL11.beginPlayback(file + k + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
int i1 = GL11.EaglerAdapterImpl2.beginPlayback(file + k + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
if(i1 == -1) {
|
||||
try {
|
||||
throw new FileNotFoundException("Audio file " + file + " not found!");
|
||||
|
@ -54,37 +54,37 @@ public class SoundManager {
|
|||
} else {
|
||||
Random rand = new Random();
|
||||
int i1 = rand.nextInt(4 - 1 + 1) + 1;
|
||||
int i2 = GL11.beginPlayback(file + i1 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
int i2 = GL11.EaglerAdapterImpl2.beginPlayback(file + i1 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
if(i2 == -1) {
|
||||
int i3 = 0;
|
||||
if(i1 == 4) {
|
||||
i3 = GL11.beginPlayback(file + 3 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
i3 = GL11.EaglerAdapterImpl2.beginPlayback(file + 3 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
if(i3 == -1) {
|
||||
i3 = GL11.beginPlayback(file + 2 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
i3 = GL11.EaglerAdapterImpl2.beginPlayback(file + 2 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
if(i3 == -1) {
|
||||
i3 = GL11.beginPlayback(file + 1 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
i3 = GL11.EaglerAdapterImpl2.beginPlayback(file + 1 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(i1 == 3) {
|
||||
i3 = GL11.beginPlayback(file + 2 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
i3 = GL11.EaglerAdapterImpl2.beginPlayback(file + 2 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
if(i3 == -1) {
|
||||
i3 = GL11.beginPlayback(file + 1 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
i3 = GL11.EaglerAdapterImpl2.beginPlayback(file + 1 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
}
|
||||
}
|
||||
|
||||
if(i1 == 2) {
|
||||
i3 = GL11.beginPlayback(file + 1 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
i3 = GL11.EaglerAdapterImpl2.beginPlayback(file + 1 + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
}
|
||||
|
||||
if(i1 == 1) {
|
||||
i3 = GL11.beginPlayback(file + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
i3 = GL11.EaglerAdapterImpl2.beginPlayback(file + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
}
|
||||
|
||||
if(i3 == -1) {
|
||||
int i4 = 0;
|
||||
i4 = GL11.beginPlayback(file + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
i4 = GL11.EaglerAdapterImpl2.beginPlayback(file + ".mp3", f, g, h, i * Minecraft.getMinecraft().gameSettings.soundVolume, j);
|
||||
if(i4 == -1) {
|
||||
try {
|
||||
throw new FileNotFoundException("Audio file " + file + " not found!");
|
||||
|
@ -99,7 +99,7 @@ public class SoundManager {
|
|||
|
||||
public void func_338_a(EntityPlayer player, float f) {
|
||||
if(player == null) {
|
||||
GL11.setListenerPos(0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f);
|
||||
GL11.EaglerAdapterImpl2.setListenerPos(0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f);
|
||||
} else {
|
||||
double x = player.prevPosX + (player.posX - player.prevPosX) * f;
|
||||
double y = player.prevPosY + (player.posY - player.prevPosY) * f;
|
||||
|
@ -108,7 +108,7 @@ public class SoundManager {
|
|||
double yaw = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
|
||||
|
||||
try {
|
||||
GL11.setListenerPos((float)x, (float)y, (float)z, (float)player.motionX, (float)player.motionY, (float)player.motionZ, (float)pitch, (float)yaw);
|
||||
GL11.EaglerAdapterImpl2.setListenerPos((float)x, (float)y, (float)z, (float)player.motionX, (float)player.motionY, (float)player.motionZ, (float)pitch, (float)yaw);
|
||||
} catch(Exception e) {
|
||||
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class SoundManager {
|
|||
}
|
||||
|
||||
volume *= 0.25F;
|
||||
int i = GL11.beginPlaybackStatic(sound, volume * Minecraft.getMinecraft().gameSettings.soundVolume, pitch);
|
||||
int i = GL11.EaglerAdapterImpl2.beginPlaybackStatic(sound, volume * Minecraft.getMinecraft().gameSettings.soundVolume, pitch);
|
||||
if(i == - 1) {
|
||||
try {
|
||||
throw new FileNotFoundException("Audio file " + file + " not found!");
|
||||
|
@ -155,8 +155,8 @@ public class SoundManager {
|
|||
|
||||
public void musicTick() throws FileNotFoundException {
|
||||
if(Minecraft.getMinecraft().gameSettings.musicVolume == 0.0F || Minecraft.getMinecraft().theWorld == null) {
|
||||
if(GL11.isPlaying(song)) {
|
||||
GL11.endSound(song);
|
||||
if(GL11.EaglerAdapterImpl2.isPlaying(song)) {
|
||||
GL11.EaglerAdapterImpl2.endSound(song);
|
||||
}
|
||||
musicFlag = true;
|
||||
musicTimer = 0;
|
||||
|
@ -165,7 +165,7 @@ public class SoundManager {
|
|||
return;
|
||||
}
|
||||
|
||||
if(!GL11.isPlaying(song) && musicFlag && !musicTimerSet) {
|
||||
if(!GL11.EaglerAdapterImpl2.isPlaying(song) && musicFlag && !musicTimerSet) {
|
||||
Random rand = new Random();
|
||||
musicTimer = rand.nextInt(6 - 3 + 1) + 3;
|
||||
musicTimer = musicTimer * 60;
|
||||
|
@ -176,7 +176,7 @@ public class SoundManager {
|
|||
return;
|
||||
}
|
||||
|
||||
if(!GL11.isPlaying(song) && musicFlag && musicTimerSet) {
|
||||
if(!GL11.EaglerAdapterImpl2.isPlaying(song) && musicFlag && musicTimerSet) {
|
||||
if(Minecraft.getMinecraft().ticksRan >= ticks) {
|
||||
musicFlag = false;
|
||||
musicTimer = 0;
|
||||
|
@ -186,7 +186,7 @@ public class SoundManager {
|
|||
}
|
||||
}
|
||||
|
||||
if(!GL11.isPlaying(song) && !musicFlag) {
|
||||
if(!GL11.EaglerAdapterImpl2.isPlaying(song) && !musicFlag) {
|
||||
Random rand = new Random();
|
||||
int i = rand.nextInt(2);
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class SoundManager {
|
|||
return;
|
||||
}
|
||||
prevSong = songToPlay;
|
||||
song = GL11.beginPlaybackStatic("/music/" + songToPlay + ".mp3", Minecraft.getMinecraft().gameSettings.musicVolume, 1.0F);
|
||||
song = GL11.EaglerAdapterImpl2.beginPlaybackStatic("/music/" + songToPlay + ".mp3", Minecraft.getMinecraft().gameSettings.musicVolume, 1.0F);
|
||||
if(song == -1) {
|
||||
throw new FileNotFoundException("Audio file " + songToPlay + ".mp3 not found!");
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ public class SoundManager {
|
|||
return;
|
||||
}
|
||||
prevSong = songToPlay;
|
||||
song = GL11.beginPlaybackStatic("/newMusic/" + songToPlay + ".mp3", Minecraft.getMinecraft().gameSettings.musicVolume, 1.0F);
|
||||
song = GL11.EaglerAdapterImpl2.beginPlaybackStatic("/newMusic/" + songToPlay + ".mp3", Minecraft.getMinecraft().gameSettings.musicVolume, 1.0F);
|
||||
if(song == -1) {
|
||||
throw new FileNotFoundException("Audio file " + songToPlay + ".mp3 not found!");
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public class Client {
|
|||
//JOptionPane.showMessageDialog(null, "Press ok to continue", "Alpha v1.2.6",
|
||||
//JOptionPane.PLAIN_MESSAGE);
|
||||
|
||||
GL11.initializeContext();
|
||||
GL11.EaglerAdapterImpl2.initializeContext();
|
||||
|
||||
Minecraft mc = new Minecraft();
|
||||
mc.field_6320_i = new Session("Player");
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -81,77 +81,68 @@ public class Tessellator {
|
|||
private int normal;
|
||||
|
||||
/** The static instance of the Tessellator. */
|
||||
public static final Tessellator instance = new Tessellator(525000);
|
||||
public static final Tessellator instance = new Tessellator(2097152);
|
||||
|
||||
/** Whether this tessellator is currently in draw mode. */
|
||||
private boolean isDrawing = false;
|
||||
|
||||
/** Whether we are currently using VBO or not. */
|
||||
private boolean useVBO = false;
|
||||
|
||||
/** The size of the buffers used (in integers). */
|
||||
|
||||
private int bufferSize;
|
||||
|
||||
|
||||
private Tessellator(int par1) {
|
||||
this.bufferSize = par1;
|
||||
this.byteBuffer = ByteBuffer.allocateDirect(par1 * 4).order(ByteOrder.nativeOrder());
|
||||
this.byteBuffer = GLAllocation.createDirectByteBuffer(par1 * 4);
|
||||
this.intBuffer = this.byteBuffer.asIntBuffer();
|
||||
this.rawBuffer = new int[par1];
|
||||
this.useVBO = false;// tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
|
||||
|
||||
// if (this.useVBO) {
|
||||
// this.vertexBuffers = GLAllocation.createDirectIntBuffer(this.vboCount);
|
||||
// ARBVertexBufferObject.glGenBuffersARB(this.vertexBuffers);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the data set up in this tessellator and resets the state to prepare for
|
||||
* new drawing.
|
||||
*/
|
||||
public int draw() {
|
||||
public void draw() {
|
||||
if (!this.isDrawing) {
|
||||
return 0;
|
||||
throw new IllegalStateException("Not tesselating!");
|
||||
} else {
|
||||
this.isDrawing = false;
|
||||
|
||||
if (this.vertexCount > 0) {
|
||||
IntBuffer up = null;
|
||||
IntBuffer upload = null;
|
||||
this.intBuffer.clear();
|
||||
this.intBuffer.put(rawBuffer, 0, this.rawBufferIndex);
|
||||
this.intBuffer.flip();
|
||||
up = this.intBuffer;
|
||||
upload = this.intBuffer;
|
||||
|
||||
if (this.hasTexture) {
|
||||
GL11.glEnableVertexAttrib(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
if(this.hasTexture) {
|
||||
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
if (this.hasColor) {
|
||||
GL11.glEnableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
||||
if(this.hasColor) {
|
||||
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if (this.hasNormals) {
|
||||
GL11.glEnableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
||||
if(this.hasNormals) {
|
||||
GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
|
||||
}
|
||||
|
||||
GL11.glDrawArrays(this.drawMode, 0, this.vertexCount, up);
|
||||
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
GL11.glDrawArrays(this.drawMode, GL11.GL_POINTS, this.vertexCount, upload);
|
||||
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
|
||||
|
||||
if (this.hasTexture) {
|
||||
GL11.glDisableVertexAttrib(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
if(this.hasTexture) {
|
||||
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
if (this.hasColor) {
|
||||
GL11.glDisableVertexAttrib(GL11.GL_COLOR_ARRAY);
|
||||
if(this.hasColor) {
|
||||
GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if (this.hasNormals) {
|
||||
GL11.glDisableVertexAttrib(GL11.GL_NORMAL_ARRAY);
|
||||
if(this.hasNormals) {
|
||||
GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);
|
||||
}
|
||||
}
|
||||
|
||||
int var1 = this.rawBufferIndex * 4;
|
||||
this.reset();
|
||||
return var1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +159,7 @@ public class Tessellator {
|
|||
* Sets draw mode in the tessellator to draw quads.
|
||||
*/
|
||||
public void startDrawingQuads() {
|
||||
this.startDrawing(GL11.GL_QUADS);
|
||||
this.startDrawing(7);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,15 +168,16 @@ public class Tessellator {
|
|||
*/
|
||||
public void startDrawing(int par1) {
|
||||
if (this.isDrawing) {
|
||||
this.draw();
|
||||
throw new IllegalStateException("Already tesselating!");
|
||||
} else {
|
||||
this.isDrawing = true;
|
||||
this.reset();
|
||||
this.drawMode = par1;
|
||||
this.hasNormals = false;
|
||||
this.hasColor = false;
|
||||
this.hasTexture = false;
|
||||
this.isColorDisabled = false;
|
||||
}
|
||||
this.isDrawing = true;
|
||||
this.reset();
|
||||
this.drawMode = par1;
|
||||
this.hasNormals = false;
|
||||
this.hasColor = false;
|
||||
this.hasTexture = false;
|
||||
this.isColorDisabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -193,81 +185,68 @@ public class Tessellator {
|
|||
*/
|
||||
public void setTextureUV(double par1, double par3) {
|
||||
this.hasTexture = true;
|
||||
this.textureU = par1;
|
||||
this.textureV = par3;
|
||||
this.textureU = (float) par1;
|
||||
this.textureV = (float) par3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the RGB values as specified, converting from floats between 0 and 1 to
|
||||
* integers from 0-255.
|
||||
*/
|
||||
public void setColorOpaque_F(float par1, float par2, float par3) {
|
||||
this.setColorOpaque((int) (par1 * 255 |