fixed lighting and poor ANGLE issue #4994 patch performance

This commit is contained in:
LAX1DUDE 2022-01-08 23:35:35 -08:00
parent 1da594e102
commit f0aca67bb0
56 changed files with 64407 additions and 63553 deletions

View File

@ -28,6 +28,7 @@ sourceSets {
repositories {
jcenter()
}
dependencies {
implementation 'org.teavm:teavm-platform:0.6.1'
implementation 'org.teavm:teavm-classlib:0.6.1'
@ -36,11 +37,11 @@ dependencies {
teavm {
compileScopes = null;
minifying = false;
minifying = true;
maxTopLevelNames = 10000;
properties = null;
debugInformationGenerated = false;
sourceMapsGenerated = false;
sourceMapsGenerated = true;
sourceFilesCopied = false;
incremental = false;
transformers = null;

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -84,6 +84,8 @@ uniform vec2 texCoordV1;
#ifdef CC_lighting
uniform vec3 light0Pos;
uniform vec3 light1Pos;
uniform vec3 invertNormals;
uniform vec3 normalUniform;
#endif
#ifdef CC_fog
uniform vec4 fogColor;
@ -94,7 +96,6 @@ uniform float fogDensity;
uniform float fogPremultiply;
#endif
uniform vec4 colorUniform;
uniform vec3 normalUniform;
#ifdef CC_alphatest
uniform float alphaTestF;
#endif
@ -109,6 +110,9 @@ uniform vec4 textureGenR_V;
uniform vec4 textureGenQ_V;
uniform mat4 matrix_inverse_m;
#endif
#ifdef CC_patch_anisotropic
uniform vec2 anisotropic_fix;
#endif
#ifdef CC_TEX_GEN_STRQ
in vec4 v_object_pos;
@ -173,12 +177,11 @@ void main(){
#ifdef CC_unit0
#ifdef CC_a_texture0
#if (defined(CC_patch_anisotropic) && defined(CC_a_texture1) && defined(CC_a_color))
vec2 uv = (matrix_t * vec4(v_texture0, 0.0, 1.0)).xy ;
#ifdef CC_patch_anisotropic
vec2 uv = (matrix_t * vec4(v_texture0, 0.0, 1.0)).xy;
/* https://bugs.chromium.org/p/angleproject/issues/detail?id=4994 */
float x = 1024.0 * 63.0 / 64.0;
uv = ((uv * x) - fract(uv * x) + 0.5) / x;
uv = ((uv * anisotropic_fix) - fract(uv * anisotropic_fix) + 0.5) / anisotropic_fix;
color *= texture(tex0, uv).bgra;
#else
@ -207,16 +210,17 @@ void main(){
#ifdef CC_lighting
#ifdef CC_a_normal
vec3 normal = normalize(matrix_mn * ((v_normal.xyz - 0.5) * 2.0));
vec3 normal = ((v_normal.xyz - 0.5) * 2.0);
#else
vec3 normal = normalize(matrix_mn * normalUniform);
#endif
float ins = abs(dot(normal, light0Pos) + dot(normal, light1Pos));
color.rgb *= sqrt(0.4 + ins * 0.6);
vec3 normal = normalUniform;
#endif
normal = normalize(matrix_mn * normal);
float ins = max(dot(normal, -light0Pos), 0.0) + max(dot(normal, -light1Pos), 0.0);
color.rgb *= min((0.4 + ins * 0.6), 1.0);
#endif
#ifdef CC_fog
float dist = sqrt(v_position.x * v_position.x + v_position.y * v_position.y + v_position.z * v_position.z);
float dist = sqrt(dot(v_position, v_position));
float i = (fogMode == 1) ? clamp((dist - fogStart) / (fogEnd - fogStart), 0.0, 1.0) : clamp(1.0 - pow(2.718, -(fogDensity * dist)), 0.0, 1.0);
color.rgb = mix(color.rgb, fogColor.xyz, i * fogColor.a);
#endif

View File

@ -38,6 +38,8 @@ profile.playerSkin=Player Skin
profile.addSkin=Add Skin
profile.clearSkin=Clear List
fancyGraphicsNote=go to -> Options -> Video Settings on the pause menu to enable fancy graphics and smooth lighting
voice.title=Voice Channel
voice.addr=Channel Address
voice.connect=Connect
@ -143,6 +145,8 @@ lanServer.scanning=Scanning for games on your local network
lanServer.start=Start LAN World
lanServer.otherPlayers=Settings for Other Players
mcoServer.title=Minecraft Online World
addServer.SSLWarn1=you are on an https: page!
addServer.SSLWarn2=html5 will only allow wss://
multiplayer.title=Play Multiplayer
multiplayer.connect=Connect
@ -289,6 +293,8 @@ options.framebufferAntialias.auto=Auto
options.framebufferAntialias.fxaa=FXAA
options.framebufferAntialias.msaa4=MSAA4
options.framebufferAntialias.msaa8=MSAA8
options.patchAnisotropic=Fix ANGLE bug #4994
performance.max=Max FPS
performance.balanced=Balanced
performance.powersaver=Power saver

View File

@ -2,6 +2,8 @@ package net.lax1dude.eaglercraft;
import java.util.Arrays;
import javax.swing.JOptionPane;
import org.lwjgl.input.Keyboard;
import net.lax1dude.eaglercraft.EaglerAdapter;
@ -13,6 +15,8 @@ public class MinecraftMain {
public static void main(String[] par0ArrayOfStr) {
JOptionPane.showMessageDialog(null, "launch renderdoc (optionally) and press ok to continue", "eaglercraft", JOptionPane.PLAIN_MESSAGE);
EaglerAdapter.initializeContext();
LocalStorageManager.loadStorage();
ServerList.loadDefaultServers(Base64.encodeBase64String(EaglerAdapter.loadLocalStorage("forced")));

View File

@ -83,6 +83,14 @@ public class EaglerAdapterImpl2 {
return null;
}
}
public static final boolean isSSLPage() {
return true;
}
public static final String[] getIdentifier() {
return new String[0];
}
private static final boolean useEPKTest = false;
@ -224,6 +232,10 @@ public class EaglerAdapterImpl2 {
public static final class TextureGL {
protected final int obj;
public int w = -1;
public int h = -1;
public boolean nearest = true;
public boolean anisotropic = false;
protected TextureGL(int obj) {
this.obj = obj;
}
@ -572,6 +584,12 @@ public class EaglerAdapterImpl2 {
public static final void _wglLineWidth(float p1) {
GL11.glLineWidth(p1);
}
public static final int _wglGetTexParameteri(int p1) {
return GL11.glGetTexParameteri(GL11.GL_TEXTURE_2D, p1);
}
public static final float _wglGetTexParameterf(int p1) {
return GL11.glGetTexParameterf(GL11.GL_TEXTURE_2D, p1);
}
// =======================================================================================
@ -711,6 +729,9 @@ public class EaglerAdapterImpl2 {
ss.cleanup();
}
}
public static final boolean isWindows() {
return System.getProperty("os.name").toLowerCase().contains("windows");
}
public static final boolean mouseNext() {
return Mouse.next();
}

View File

@ -358,9 +358,9 @@ public class Tessellator {
public void setNormal(float par1, float par2, float par3) {
this.hasNormals = true;
float len = (float) Math.sqrt(par1 * par1 + par2 * par2 + par3 * par3);
int var4 = (int)((par1 / len) * 128.0F) + 127;
int var5 = (int)((par2 / len) * 128.0F) + 127;
int var6 = (int)((par3 / len) * 128.0F) + 127;
int var4 = (int)((par1 / len) * 127.0F) + 127;
int var5 = (int)((par2 / len) * 127.0F) + 127;
int var6 = (int)((par3 / len) * 127.0F) + 127;
this.normal = var4 & 255 | (var5 & 255) << 8 | (var6 & 255) << 16;
}

View File

@ -4,7 +4,7 @@ public class ConfigConstants {
public static boolean profanity = false;
public static final String version = "21m12-24";
public static final String version = "22m01a";
public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";

View File

@ -247,7 +247,6 @@ public class DefaultSkinRenderer {
int id = id2 - EaglerProfile.skinNames.size();
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
RenderHelper.enableStandardItemLighting();
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
EaglerAdapter.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
@ -257,6 +256,7 @@ public class DefaultSkinRenderer {
EaglerAdapter.glRotatef(180.0f, 1.0f, 0.0f, 0.0f);
EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL);
EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F);
RenderHelper.enableGUIStandardItemLighting();
EaglerAdapter.glTranslatef(0.0F, 1.0F, 0.0F);
EaglerAdapter.glRotatef(((y - my) * -0.06f), 1.0f, 0.0f, 0.0f);
EaglerAdapter.glRotatef(((x - mx) * 0.06f), 0.0f, 1.0f, 0.0f);

View File

@ -181,7 +181,7 @@ public class GuiScreenEditProfile extends GuiScreen {
protected void actionPerformed(GuiButton par1GuiButton) {
if(!dropDownOpen) {
if(par1GuiButton.id == 200) {
EaglerProfile.username = this.username.getText();
EaglerProfile.username = this.username.getText().length() == 0 ? "null" : this.username.getText();
EaglerProfile.presetSkinId = selectedSlot - EaglerProfile.skinNames.size();
if(EaglerProfile.presetSkinId < 0) {
EaglerProfile.presetSkinId = -1;

View File

@ -144,6 +144,10 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
private static boolean enableNormalArray = false;
private static boolean enableTex0Array = false;
private static boolean enableTex1Array = false;
private static boolean enableAnisotropicFix = false;
private static float anisotropicFixX = 1024.0f;
private static float anisotropicFixY = 1024.0f;
private static float colorR = 1.0f;
private static float colorG = 1.0f;
@ -160,6 +164,13 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
private static float tex0Y = 0;
private static float tex1X = 0;
private static float tex1Y = 0;
private static TextureGL boundTexture0 = null;
private static boolean enableAnisotropicPatch = false;
private static boolean hintAnisotropicPatch = false;
public static final void anisotropicPatch(boolean e) {
enableAnisotropicPatch = e;
}
private static boolean enableTexGen = false;
private static boolean enableColorMaterial = false;
@ -271,9 +282,6 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
_wglEnable(_wGL_BLEND);
break;
case GL_RESCALE_NORMAL:
//enableRescaleNormal = true;
//matNormalScalePointer = matModelPointer;
//matNormScaleV[0].setIdentity();
break;
case GL_TEXTURE_2D:
if(selectedTex == 0) {
@ -463,6 +471,10 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
}
public static final void glTexImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, ByteBuffer p9) {
if(p2 == 0 && selectedTex == 0 && boundTexture0 != null) {
boundTexture0.w = p4;
boundTexture0.h = p5;
}
_wglTexImage2D(_wGL_TEXTURE_2D, p2, _wGL_RGBA8, p4, p5, p6, _wGL_RGBA, _wGL_UNSIGNED_BYTE, p9);
}
public static final void glLight(int p1, int p2, FloatBuffer p3) {
@ -471,15 +483,29 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
public static final void glLightModel(int p1, FloatBuffer p2) {
}
private static Vector4f lightPos0vec0 = new Vector4f();
private static Vector4f lightPos1vec0 = new Vector4f();
private static Vector4f lightPos0vec = new Vector4f();
private static Vector4f lightPos1vec = new Vector4f();
public static final void copyModelToLightMatrix() {
lightPos0vec0.set(lightPos0vec);
lightPos1vec0.set(lightPos1vec);
lightPos0vec.set(0.2f, 1.0f, -0.7f, 0.0f); lightPos0vec.normalise();
lightPos1vec.set(-0.2f, 1.0f, 0.7f, 0.0f); lightPos1vec.normalise();
Matrix4f.transform(matModelV[matModelPointer], lightPos0vec, lightPos0vec).normalise();
Matrix4f.transform(matModelV[matModelPointer], lightPos1vec, lightPos1vec).normalise();
}
public static final void flipLightMatrix() {
lightPos0vec0.set(lightPos0vec);
lightPos1vec0.set(lightPos1vec);
lightPos0vec.y = -lightPos0vec.y;
lightPos1vec.y = -lightPos1vec.y;
}
public static final void revertLightMatrix() {
lightPos0vec.set(lightPos0vec0);
lightPos1vec.set(lightPos1vec0);
}
public static final void glPushMatrix() {
switch(matrixMode) {
case GL_MODELVIEW:
@ -603,8 +629,23 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
public static final void glColorMask(boolean p1, boolean p2, boolean p3, boolean p4) {
_wglColorMask(p1, p2, p3, p4);
}
private static final void updateAnisotropicPatch() {
if(selectedTex == 0) {
enableAnisotropicFix = false;
if(enableAnisotropicPatch && boundTexture0 != null && boundTexture0.anisotropic && boundTexture0.nearest) {
enableAnisotropicFix = true;
anisotropicFixX = boundTexture0.w;
anisotropicFixY = boundTexture0.h;
}
}
}
public static final void glBindTexture(int p1, int p2) {
_wglBindTexture(_wGL_TEXTURE_2D, texObjects.get(p2));
TextureGL t = texObjects.get(p2);
_wglBindTexture(_wGL_TEXTURE_2D, t);
if(selectedTex == 0) {
boundTexture0 = t;
updateAnisotropicPatch();
}
}
public static final void glCopyTexSubImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) {
_wglCopyTexSubImage2D(_wGL_TEXTURE_2D, p2, p3, p4, p5, p6, p7, p8);
@ -638,7 +679,12 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
case GL_REPEAT: pp3 = _wGL_REPEAT; break;
case GL_CLAMP: pp3 = _wGL_CLAMP; break;
}
if(selectedTex == 0 && boundTexture0 != null && pp2 == _wGL_TEXTURE_MAG_FILTER) {
boundTexture0.nearest = pp3 == _wGL_NEAREST;
}
_wglTexParameteri(pp1, pp2, pp3);
updateAnisotropicPatch();
}
public static final void glTexParameterf(int p1, int p2, float p3) {
int pp1 = 0;
@ -652,7 +698,11 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
default:
case GL_TEXTURE_MAX_ANISOTROPY: pp2 = _wGL_TEXTURE_MAX_ANISOTROPY; break;
}
if(selectedTex == 0 && boundTexture0 != null && pp2 == _wGL_TEXTURE_MAX_ANISOTROPY) {
boundTexture0.anisotropic = p3 > 1.0f;
}
_wglTexParameterf(pp1, pp2, p3);
updateAnisotropicPatch();
}
public static final void glLogicOp(int p1) {
@ -693,6 +743,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
if(!isCompilingDisplayList) {
compilingDisplayList = displayLists.get(p1);
if(compilingDisplayList != null) {
compilingDisplayList.shaderMode = -1;
compilingDisplayList.listLength = 0;
isCompilingDisplayList = true;
}
@ -775,12 +826,22 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
case GL_BGRA: pp3 = _wGL_BGRA; break;
}
*/
if(p2 == 0 && selectedTex == 0 && boundTexture0 != null) {
boundTexture0.w = p4;
boundTexture0.h = p5;
}
bytesUploaded += p9.remaining()*4;
_wglTexImage2D(_wGL_TEXTURE_2D, p2, _wGL_RGBA8, p4, p5, p6, _wGL_RGBA, _wGL_UNSIGNED_BYTE, p9);
updateAnisotropicPatch();
}
public static final void glTexImage2D_2(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, IntBuffer p9) {
if(p2 == 0 && selectedTex == 0 && boundTexture0 != null) {
boundTexture0.w = p4;
boundTexture0.h = p5;
}
bytesUploaded += p9.remaining()*4;
_wglTexImage2D(_wGL_TEXTURE_2D, p2, _wGL_RGB8, p4, p5, p6, _wGL_RGB, _wGL_UNSIGNED_BYTE, p9);
updateAnisotropicPatch();
}
public static final void glTexSubImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, IntBuffer p9) {
int pp1 = 0;
@ -859,6 +920,9 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break;
}
}
public static final void hintAnisotropicFix(boolean hint) {
hintAnisotropicPatch = hint;
}
private static final int getShaderModeFlag0() {
int mode = 0;
mode = (mode | (enableColorArray ? FixedFunctionShader.COLOR : 0));
@ -875,6 +939,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
mode = (mode | (enableAlphaTest ? FixedFunctionShader.ALPHATEST : 0));
mode = (mode | (enableTexture2D ? FixedFunctionShader.UNIT0 : 0));
mode = (mode | (enableTexture2D_1 ? FixedFunctionShader.UNIT1 : 0));
mode = (mode | ((enableTexture2D && (enableAnisotropicFix || (hintAnisotropicPatch && enableAnisotropicPatch))) ? FixedFunctionShader.FIX_ANISOTROPIC : 0));
return mode;
}
private static final int getShaderModeFlag() {
@ -889,6 +954,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
mode = (mode | (enableAlphaTest ? FixedFunctionShader.ALPHATEST : 0));
mode = (mode | (enableTexture2D ? FixedFunctionShader.UNIT0 : 0));
mode = (mode | (enableTexture2D_1 ? FixedFunctionShader.UNIT1 : 0));
mode = (mode | ((enableTexture2D && (enableAnisotropicFix || (hintAnisotropicPatch && enableAnisotropicPatch))) ? FixedFunctionShader.FIX_ANISOTROPIC : 0));
return mode;
}
private static FixedFunctionShader shader = null;
@ -930,6 +996,9 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
s.setTexGenR(texR_plane, texR_X, texR_Y, texR_Z, texR_W);
s.setTexGenQ(texQ_plane, texQ_X, texQ_Y, texQ_Z, texQ_W);
}
if(enableAnisotropicFix) {
s.setAnisotropicFix(anisotropicFixX, anisotropicFixY);
}
}
private static Object blankUploadArray = _wCreateLowLevelIntBuffer(525000);
public static final void glDrawArrays(int p1, int p2, int p3, Object buffer) {

View File

@ -3,13 +3,15 @@ package net.lax1dude.eaglercraft.glemu;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.glemu.vector.Matrix3f;
import net.lax1dude.eaglercraft.glemu.vector.Matrix4f;
import net.lax1dude.eaglercraft.glemu.vector.Vector2f;
import net.lax1dude.eaglercraft.glemu.vector.Vector3f;
import net.lax1dude.eaglercraft.glemu.vector.Vector4f;
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.*;
public class FixedFunctionShader {
private static final FixedFunctionShader[] instances = new FixedFunctionShader[1024]; //lol
private static final FixedFunctionShader[] instances = new FixedFunctionShader[2048]; //lol
public static void refreshCoreGL() {
for(int i = 0; i < instances.length; ++i) {
@ -31,6 +33,7 @@ public class FixedFunctionShader {
public static final int ALPHATEST = 128;
public static final int UNIT0 = 256;
public static final int UNIT1 = 512;
public static final int FIX_ANISOTROPIC = 1024;
public static FixedFunctionShader instance(int i) {
FixedFunctionShader s = instances[i];
@ -45,6 +48,7 @@ public class FixedFunctionShader {
boolean CC_alphatest = false;
boolean CC_unit0 = false;
boolean CC_unit1 = false;
boolean CC_anisotropic = false;
if((i & COLOR) == COLOR) {
CC_a_color = true;
}
@ -75,7 +79,10 @@ public class FixedFunctionShader {
if((i & UNIT1) == UNIT1) {
CC_unit1 = true;
}
s = new FixedFunctionShader(i, CC_a_color, CC_a_normal, CC_a_texture0, CC_a_texture1, CC_TEX_GEN_STRQ, CC_lighting, CC_fog, CC_alphatest, CC_unit0, CC_unit1);
if((i & FIX_ANISOTROPIC) == FIX_ANISOTROPIC) {
CC_anisotropic = true;
}
s = new FixedFunctionShader(i, CC_a_color, CC_a_normal, CC_a_texture0, CC_a_texture1, CC_TEX_GEN_STRQ, CC_lighting, CC_fog, CC_alphatest, CC_unit0, CC_unit1, CC_anisotropic);
instances[i] = s;
}
return s;
@ -93,6 +100,7 @@ public class FixedFunctionShader {
private final boolean enable_alphatest;
private final boolean enable_unit0;
private final boolean enable_unit1;
private final boolean enable_anisotropic_fix;
private final ProgramGL globject;
private UniformGL u_matrix_m = null;
@ -127,6 +135,9 @@ public class FixedFunctionShader {
private UniformGL u_light0Pos = null;
private UniformGL u_light1Pos = null;
//private UniformGL u_invertNormals = null;
private UniformGL u_anisotropic_fix = null;
private final int a_position;
private final int a_texture0;
@ -140,7 +151,7 @@ public class FixedFunctionShader {
public final BufferGL genericBuffer;
public boolean bufferIsInitialized = false;
private FixedFunctionShader(int j, boolean CC_a_color, boolean CC_a_normal, boolean CC_a_texture0, boolean CC_a_texture1, boolean CC_TEX_GEN_STRQ, boolean CC_lighting, boolean CC_fog, boolean CC_alphatest, boolean CC_unit0, boolean CC_unit1) {
private FixedFunctionShader(int j, boolean CC_a_color, boolean CC_a_normal, boolean CC_a_texture0, boolean CC_a_texture1, boolean CC_TEX_GEN_STRQ, boolean CC_lighting, boolean CC_fog, boolean CC_alphatest, boolean CC_unit0, boolean CC_unit1, boolean CC_anisotropic_fix) {
enable_color = CC_a_color;
enable_normal = CC_a_normal;
enable_texture0 = CC_a_texture0;
@ -151,6 +162,7 @@ public class FixedFunctionShader {
enable_alphatest = CC_alphatest;
enable_unit0 = CC_unit0;
enable_unit1 = CC_unit1;
enable_anisotropic_fix = CC_anisotropic_fix;
if(shaderSource == null) {
shaderSource = fileContents("/glsl/core.glsl");
@ -167,8 +179,7 @@ public class FixedFunctionShader {
if(enable_alphatest) source += "#define CC_alphatest\n";
if(enable_unit0) source += "#define CC_unit0\n";
if(enable_unit1) source += "#define CC_unit1\n";
//if(!EaglerAdapter._wisAnisotropicPatched()) source += "#define CC_patch_anisotropic\n";
source += "#define CC_patch_anisotropic\n";
if(enable_anisotropic_fix) source += "#define CC_patch_anisotropic\n";
source += shaderSource;
ShaderGL v = _wglCreateShader(_wGL_VERTEX_SHADER);
@ -215,6 +226,7 @@ public class FixedFunctionShader {
if(enable_lighting) {
u_normalUniform = _wglGetUniformLocation(globject, "normalUniform");
//u_invertNormals = _wglGetUniformLocation(globject, "invertNormals");
u_light0Pos = _wglGetUniformLocation(globject, "light0Pos");
u_light1Pos = _wglGetUniformLocation(globject, "light1Pos");
}
@ -244,6 +256,11 @@ public class FixedFunctionShader {
u_matrix_inverse_m = _wglGetUniformLocation(globject, "matrix_inverse_m");
}
if(enable_anisotropic_fix) {
u_anisotropic_fix = _wglGetUniformLocation(globject, "anisotropic_fix");
_wglUniform2f(u_anisotropic_fix, 1024.0f * 63.0f / 64.0f, 1024.0f * 63.0f / 64.0f);
}
_wglUniform1i(_wglGetUniformLocation(globject, "tex0"), 0);
_wglUniform1i(_wglGetUniformLocation(globject, "tex1"), 1);
@ -330,9 +347,33 @@ public class FixedFunctionShader {
private Matrix4f inverseModelMatrix = (Matrix4f) new Matrix4f().setZero();
private Vector4f light0Pos = new Vector4f();
private Vector4f light1Pos = new Vector4f();
private Vector2f anisotropicFix = new Vector2f(0.0f, 0.0f);
private boolean bound = false;
private float invertNormalsX = 0.0f;
private float invertNormalsY = 0.0f;
private float invertNormalsZ = 0.0f;
public void setInvertNormals(float x, float y, float z) {
/*
if(invertNormalsX != x || invertNormalsY != y || invertNormalsZ != z) {
invertNormalsX = x;
invertNormalsY = y;
invertNormalsZ = z;
_wglUniform3f(u_invertNormals, x, y, z);
}
*/
}
public void setAnisotropicFix(float x, float y) {
if(anisotropicFix.x != x || anisotropicFix.y != y) {
anisotropicFix.x = x;
anisotropicFix.y = y;
_wglUniform2f(u_anisotropic_fix, x, y);
}
}
public void setModelMatrix(Matrix4f mat) {
if(!mat.equals(modelMatrix)) {
modelMatrix.load(mat).store(modelBuffer);

View File

@ -1081,6 +1081,8 @@ public class Minecraft implements Runnable {
if (this.rightClickDelayTimer > 0) {
--this.rightClickDelayTimer;
}
EaglerAdapter.anisotropicPatch(this.gameSettings.patchAnisotropic);
this.mcProfiler.startSection("stats");
this.mcProfiler.endStartSection("gui");
@ -1497,8 +1499,12 @@ public class Minecraft implements Runnable {
//if(!EaglerAdapter._wisAnisotropicPatched()) {
// displayEaglercraftText("ANGLE Issue #4994 is unpatched on this browser, using fake aliased sampling on linear magnified terrain texture for anisotropic filtering. Chrome patch progress and information available at https://crbug.com/angleproject/4994");
//}
StringTranslate var4 = StringTranslate.getInstance();
displayEaglercraftText("go to -> Options -> Video Settings on the pause menu to enable fancy graphics");
if(!this.gameSettings.fancyGraphics || this.gameSettings.ambientOcclusion == 0) {
displayEaglercraftText(var4.translateKey("fancyGraphicsNote"));
}
this.thePlayer.preparePlayerToSpawn();
par1WorldClient.spawnEntityInWorld(this.thePlayer);

View File

@ -78,6 +78,8 @@ public class EffectRenderer {
break;
case 1:
terrain.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
break;
case 2:
items.bindTexture();

View File

@ -973,7 +973,7 @@ public class EntityRenderer {
RenderHelper.disableStandardItemLighting();
terrain.bindTexture();
EaglerAdapter.glTexParameterf(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAX_ANISOTROPY, 16.0f);
//EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, mc.gameSettings.fancyGraphics ? EaglerAdapter.GL_LINEAR_MIPMAP_LINEAR : EaglerAdapter.GL_NEAREST_MIPMAP_LINEAR);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST_MIPMAP_LINEAR);
EaglerAdapter.glAlphaFunc(EaglerAdapter.GL_GREATER, 0.6f);
this.mc.mcProfiler.endStartSection("terrain");
var5.sortAndRender(var4, 0, (double) par1);
@ -1041,7 +1041,7 @@ public class EntityRenderer {
//}
EaglerAdapter.glTexParameterf(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAX_ANISOTROPY, 1.0f);
//EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST_MIPMAP_LINEAR);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST_MIPMAP_LINEAR);
var6.renderTransparentParticles(var4, par1);
@ -1282,8 +1282,7 @@ public class EntityRenderer {
var8.startDrawingQuads();
}
var32 = ((float) (ticks + var21 * var21 * 3121 + var21 * 45238971 + var20 * var20 * 418711 + var20 * 13761 & 31) + par1) / 32.0F * (3.0F + this.random.nextFloat());
var32 = var32 % 100000.0f;
var32 = ((float) ((ticks + var21 * var21 * 3121 + var21 * 45238971 + var20 * var20 * 418711 + var20 * 13761 & 31) % 100000) + par1) / 32.0F * (3.0F + this.random.nextFloat());
double var33 = (double) ((float) var21 + 0.5F) - var41.posX;
var35 = (double) ((float) var20 + 0.5F) - var41.posZ;
float var37 = MathHelper.sqrt_double(var33 * var33 + var35 * var35) / (float) var16;
@ -1307,7 +1306,7 @@ public class EntityRenderer {
var8.startDrawingQuads();
}
var32 = (((float) (ticks & 511) + par1) / 512.0F);
var32 = (((float) (ticks % 512) + par1) / 512.0F);
float var46 = this.random.nextFloat() + var19 * 0.01F * (float) this.random.nextGaussian();
float var34 = this.random.nextFloat() + var19 * (float) this.random.nextGaussian() * 0.001F;
var35 = (double) ((float) var21 + 0.5F) - var41.posX;

View File

@ -7,7 +7,7 @@ public enum EnumOptions {
AMBIENT_OCCLUSION("options.ao", false, false), GUI_SCALE("options.guiScale", false, false), RENDER_CLOUDS("options.renderClouds", false, true), PARTICLES("options.particles", false, false),
CHAT_VISIBILITY("options.chat.visibility", false, false), CHAT_COLOR("options.chat.color", false, true), CHAT_LINKS("options.chat.links", false, true), CHAT_OPACITY("options.chat.opacity", true, false),
CHAT_LINKS_PROMPT("options.chat.links.prompt", false, true), USE_SERVER_TEXTURES("options.serverTextures", false, true), SNOOPER_ENABLED("options.snooper", false, true), USE_FULLSCREEN("options.fullscreen", false, true),
ENABLE_VSYNC("options.vsync", false, true), ENABLE_FOG("options.fog", false, true), SHOW_CAPE("options.showCape", false, true), ANTIALIASING("options.framebufferAntialias", false, false), CHAT_SCALE("options.chat.scale", true, false), CHAT_WIDTH("options.chat.width", true, false),
PATCH_ANGLE("options.patchAnisotropic", false, true), ENABLE_FOG("options.fog", false, true), SHOW_CAPE("options.showCape", false, true), ANTIALIASING("options.framebufferAntialias", false, false), CHAT_SCALE("options.chat.scale", true, false), CHAT_WIDTH("options.chat.width", true, false),
CHAT_HEIGHT_FOCUSED("options.chat.height.focused", true, false), CHAT_HEIGHT_UNFOCUSED("options.chat.height.unfocused", true, false);
private final boolean enumFloat;

View File

@ -65,7 +65,7 @@ class EnumOptionsHelper {
}
try {
enumOptionsMappingHelperArray[EnumOptions.ENABLE_VSYNC.ordinal()] = 12;
enumOptionsMappingHelperArray[EnumOptions.PATCH_ANGLE.ordinal()] = 12;
} catch (NoSuchFieldError var3) {
;
}

View File

@ -62,6 +62,7 @@ public class GameSettings {
public boolean showCape = true;
public boolean touchscreen = false;
public int antialiasMode = 1;
public boolean patchAnisotropic = false;
public int overrideWidth = 0;
public int overrideHeight = 0;
public boolean heldItemTooltips = true;
@ -142,6 +143,7 @@ public class GameSettings {
this.particleSetting = 0;
this.language = "en_US";
this.mc = par1Minecraft;
this.patchAnisotropic = EaglerAdapter.isWindows();
this.loadOptions();
}
@ -329,9 +331,9 @@ public class GameSettings {
}
}
if (par1EnumOptions == EnumOptions.ENABLE_VSYNC) {
this.enableVsync = !this.enableVsync;
EaglerAdapter.setVSyncEnabled(this.enableVsync);
if (par1EnumOptions == EnumOptions.PATCH_ANGLE) {
this.patchAnisotropic = !this.patchAnisotropic;
this.mc.renderGlobal.loadRenderers();
}
this.saveOptions();
@ -385,7 +387,7 @@ public class GameSettings {
return this.fullScreen;
case 12:
return this.enableVsync;
return this.patchAnisotropic;
case 13:
return this.showCape;
@ -493,6 +495,7 @@ public class GameSettings {
if(yee.hasKey("chatHeightUnfocused")) this.chatHeightUnfocused = yee.getFloat("chatHeightUnfocused");
if(yee.hasKey("chatScale")) this.chatScale = yee.getFloat("chatScale");
if(yee.hasKey("chatWidth")) this.chatWidth = yee.getFloat("chatWidth");
if(yee.hasKey("patchAnisotropic")) this.patchAnisotropic = yee.getBoolean("patchAnisotropic");
for (int var4 = 0; var4 < this.keyBindings.length; ++var4) {
if(yee.hasKey(keyBindings[var4].keyDescription)) this.keyBindings[var4].keyCode = yee.getInteger(keyBindings[var4].keyDescription);
@ -545,6 +548,7 @@ public class GameSettings {
yee.setFloat("chatHeightUnfocused", this.chatHeightUnfocused);
yee.setFloat("chatScale", this.chatScale);
yee.setFloat("chatWidth", this.chatWidth);
yee.setBoolean("patchAnisotropic", this.patchAnisotropic);
for (int var4 = 0; var4 < this.keyBindings.length; ++var4) {
yee.setInteger(keyBindings[var4].keyDescription, keyBindings[var4].keyCode);

View File

@ -123,7 +123,7 @@ public class GuiAchievement extends Gui {
this.theGame.fontRenderer.drawString(this.achievementStatName, var5 + 30, var6 + 18, -1);
}
RenderHelper.enableGUIStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting2();
EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING);
EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL);
EaglerAdapter.glEnable(EaglerAdapter.GL_COLOR_MATERIAL);

View File

@ -153,7 +153,7 @@ public class GuiBeacon extends GuiContainer {
}
}
RenderHelper.enableGUIStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting2();
}
private static final TextureLocation tex = new TextureLocation("/gui/beacon.png");

View File

@ -91,7 +91,7 @@ public abstract class GuiContainer extends GuiScreen {
EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING);
EaglerAdapter.glDisable(EaglerAdapter.GL_DEPTH_TEST);
super.drawScreen(par1, par2, par3);
RenderHelper.enableGUIStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting2();
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef((float) var4, (float) var5, 0.0F);
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
@ -268,7 +268,7 @@ public abstract class GuiContainer extends GuiScreen {
itemRenderer.zLevel = 0.0F;
EaglerAdapter.glEnable(EaglerAdapter.GL_LIGHTING);
EaglerAdapter.glEnable(EaglerAdapter.GL_DEPTH_TEST);
RenderHelper.enableGUIStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting2();
EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL);
}
}

View File

@ -534,7 +534,7 @@ public class GuiContainerCreative extends InventoryEffectRenderer {
*/
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderHelper.enableGUIStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting2();
CreativeTabs var4 = CreativeTabs.creativeTabArray[selectedTabIndex];
CreativeTabs[] var5 = CreativeTabs.creativeTabArray;
int var6 = var5.length;

View File

@ -288,7 +288,7 @@ public class GuiIngame extends Gui {
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
this.mc.mcProfiler.startSection("actionBar");
EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting2();
for (var18 = 0; var18 < 9; ++var18) {
var19 = var6 / 2 - 90 + var18 * 20 + 2;
@ -425,7 +425,7 @@ public class GuiIngame extends Gui {
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 46, 14737632);
var45 = "verts: "+(EaglerAdapter.getVertexesPerSecond() / 1000)+"k, triangles: "+(EaglerAdapter.getTrianglesPerSecond() / 1000)+"k";
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 56, 14737632);
var45 = "rendering backend: "+(EaglerAdapter.isWebGL ? "webgl10" : "opengl30");
var45 = "rendering backend: "+(EaglerAdapter.isWebGL ? "webgl20" : "opengl30");
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 66, 14737632);
var45 = "glsl "+(EaglerAdapter._wgetShaderHeader() +", 32 bytes/vert");
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 76, 14737632);
@ -718,6 +718,8 @@ public class GuiIngame extends Gui {
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, par1);
terrain.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
Icon var4 = Block.portal.getBlockTextureFromSide(1);
float var5 = var4.getMinU();
float var6 = var4.getMinV();

View File

@ -437,7 +437,7 @@ public class GuiMainMenu extends GuiScreen {
this.drawString(this.fontRenderer, "minecraft 1.5.2", 2, this.height - 20, 16777215);
this.drawString(this.fontRenderer, ConfigConstants.mainMenuString, 2, this.height - 10, 16777215);
String var10 = "copyright 2020 calder young";
String var10 = "copyright " + Calendar.getInstance().get(Calendar.YEAR) + " calder young";
this.drawString(this.fontRenderer, var10, this.width - this.fontRenderer.getStringWidth(var10) - 2, this.height - 10, 16777215);
var10 = "all rights reserved";

View File

@ -127,7 +127,7 @@ public class GuiMerchant extends GuiContainer {
ItemStack var9 = var8.getItemToBuy();
ItemStack var10 = var8.getSecondItemToBuy();
ItemStack var11 = var8.getItemToSell();
RenderHelper.enableGUIStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting2();
EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING);
EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL);
EaglerAdapter.glEnable(EaglerAdapter.GL_COLOR_MATERIAL);

View File

@ -31,8 +31,9 @@ public class GuiScreenAddServer extends GuiScreen {
StringTranslate var1 = StringTranslate.getInstance();
EaglerAdapter.enableRepeatEvents(true);
this.buttonList.clear();
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, var1.translateKey("addServer.add")));
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, var1.translateKey("gui.cancel")));
int sslOff = EaglerAdapter.isSSLPage() ? 36 : 0;
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12 + sslOff, var1.translateKey("addServer.add")));
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12 + sslOff, var1.translateKey("gui.cancel")));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, 142, var1.translateKey("addServer.hideAddress") + ": " + (this.newServerData.isHidingAddress() ? var1.translateKey("gui.yes") : var1.translateKey("gui.no"))));
this.serverName = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 66, 200, 20);
this.serverName.setFocused(true);
@ -113,6 +114,10 @@ public class GuiScreenAddServer extends GuiScreen {
this.drawCenteredString(this.fontRenderer, var4.translateKey("addServer.title"), this.width / 2, 17, 16777215);
this.drawString(this.fontRenderer, var4.translateKey("addServer.enterName"), this.width / 2 - 100, 53, 10526880);
this.drawString(this.fontRenderer, var4.translateKey("addServer.enterIp"), this.width / 2 - 100, 94, 10526880);
if(EaglerAdapter.isSSLPage()) {
this.drawCenteredString(this.fontRenderer, var4.translateKey("addServer.SSLWarn1"), this.width / 2, 169, 0xccccff);
this.drawCenteredString(this.fontRenderer, var4.translateKey("addServer.SSLWarn2"), this.width / 2, 181, 0xccccff);
}
this.serverName.drawTextBox();
this.serverAddress.drawTextBox();
super.drawScreen(par1, par2, par3);

View File

@ -90,6 +90,10 @@ public class GuiScreenServerList extends GuiScreen {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRenderer, var4.translateKey("selectServer.direct"), this.width / 2, this.height / 4 - 60 + 20, 16777215);
this.drawString(this.fontRenderer, var4.translateKey("addServer.enterIp"), this.width / 2 - 100, 100, 10526880);
if(EaglerAdapter.isSSLPage()) {
this.drawCenteredString(this.fontRenderer, var4.translateKey("addServer.SSLWarn1"), this.width / 2, 116 + 28, 0xccccff);
this.drawCenteredString(this.fontRenderer, var4.translateKey("addServer.SSLWarn2"), this.width / 2, 116 + 40, 0xccccff);
}
this.serverTextField.drawTextBox();
super.drawScreen(par1, par2, par3);
}

View File

@ -17,7 +17,7 @@ public class GuiVideoSettings extends GuiScreen {
/** An array of all of EnumOption's video options. */
private static EnumOptions[] videoOptions = new EnumOptions[] { EnumOptions.GRAPHICS, EnumOptions.RENDER_DISTANCE, EnumOptions.AMBIENT_OCCLUSION, EnumOptions.FRAMERATE_LIMIT, EnumOptions.ANAGLYPH, EnumOptions.VIEW_BOBBING,
EnumOptions.GUI_SCALE, EnumOptions.GAMMA, EnumOptions.RENDER_CLOUDS, EnumOptions.ENABLE_FOG, EnumOptions.PARTICLES, EnumOptions.ENABLE_VSYNC };
EnumOptions.GUI_SCALE, EnumOptions.GAMMA, EnumOptions.RENDER_CLOUDS, EnumOptions.ENABLE_FOG, EnumOptions.PARTICLES, EnumOptions.PATCH_ANGLE };
public GuiVideoSettings(GuiScreen par1GuiScreen, GameSettings par2GameSettings) {
this.parentGuiScreen = par1GuiScreen;

View File

@ -41,7 +41,9 @@ public class ItemRenderer {
if (par2ItemStack.getItemSpriteNumber() == 0 && Block.blocksList[par2ItemStack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) {
terrain.bindTexture();
EaglerAdapter.flipLightMatrix();
this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F);
EaglerAdapter.flipLightMatrix();
} else {
Icon var4 = par1EntityLiving.getItemIcon(par2ItemStack, par3);
@ -52,6 +54,8 @@ public class ItemRenderer {
if (par2ItemStack.getItemSpriteNumber() == 0) {
terrain.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
} else {
items.bindTexture();
}
@ -63,6 +67,7 @@ public class ItemRenderer {
float var9 = var4.getMaxV();
float var10 = 0.0F;
float var11 = 0.3F;
RenderHelper.enableStandardItemLighting2();
EaglerAdapter.glEnable(EaglerAdapter.GL_RESCALE_NORMAL);
EaglerAdapter.glTranslatef(-var10, -var11, 0.0F);
float var12 = 1.5F;
@ -103,6 +108,7 @@ public class ItemRenderer {
}
EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL);
EaglerAdapter.revertLightMatrix();
}
EaglerAdapter.glPopMatrix();
@ -451,6 +457,8 @@ public class ItemRenderer {
if (this.mc.thePlayer.isBurning()) {
terrain.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
this.renderFireInFirstPerson(par1);
}
@ -459,6 +467,8 @@ public class ItemRenderer {
int var3 = MathHelper.floor_double(this.mc.thePlayer.posY);
int var4 = MathHelper.floor_double(this.mc.thePlayer.posZ);
terrain.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
int var5 = this.mc.theWorld.getBlockId(var2, var3, var4);
if (this.mc.theWorld.isBlockNormalCube(var2, var3, var4)) {

View File

@ -72,14 +72,12 @@ public class ModelBox {
this.vertexPositions[5] = var19;
this.vertexPositions[6] = var20;
this.vertexPositions[7] = var21;
this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] { var19, var15, var16, var20 }, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth,
par1ModelRenderer.textureHeight);
this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] { var23, var18, var21, var17 }, par2, par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] { var19, var18, var23, var15 }, par2 + par9, par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] { var16, var17, var21, var20 }, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] { var15, var23, var17, var16 }, par2 + par9, par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] { var18, var19, var20, var21 }, par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth,
par1ModelRenderer.textureHeight);
this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] { var19, var15, var16, var20 }, Vec3.createVectorHelper(1.0, 0.0, 0.0), par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] { var23, var18, var21, var17 }, Vec3.createVectorHelper(-1.0, 0.0, 0.0), par2, par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] { var19, var18, var23, var15 }, Vec3.createVectorHelper(0.0, 1.0, 0.0), par2 + par9, par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] { var16, var17, var21, var20 }, Vec3.createVectorHelper(0.0, -1.0, 0.0), par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] { var15, var23, var17, var16 }, Vec3.createVectorHelper(0.0, 0.0, 1.0), par2 + par9, par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] { var18, var19, var20, var21 }, Vec3.createVectorHelper(0.0, 0.0, -1.0), par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
if (par1ModelRenderer.mirror) {
for (int var22 = 0; var22 < this.quadList.length; ++var22) {

View File

@ -47,6 +47,8 @@ public abstract class Render {
float var11 = par1Entity.width * 1.4F;
EaglerAdapter.glScalef(var11, var11, var11);
terrain.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
Tessellator var12 = Tessellator.instance;
float var13 = 0.5F;
float var14 = 0.0F;

View File

@ -6911,6 +6911,9 @@ public class RenderBlocks {
public void renderBlockAsItem(Block par1Block, int par2, float par3) {
Tessellator var4 = Tessellator.instance;
boolean var5 = par1Block.blockID == Block.grass.blockID;
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
if (par1Block == Block.dispenser || par1Block == Block.dropper || par1Block == Block.furnaceIdle) {
par2 = 3;
@ -6993,10 +6996,12 @@ public class RenderBlocks {
var4.draw();
EaglerAdapter.glTranslatef(0.5F, 0.5F, 0.5F);
} else if (var6 == 22) {
RenderHelper.enableStandardItemLighting();
EaglerAdapter.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
EaglerAdapter.glTranslatef(-0.5F, -0.5F, -0.5F);
ChestItemRenderHelper.instance.renderChest(par1Block, par2, par3);
EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL);
EaglerAdapter.revertLightMatrix();
} else if (var6 == 6) {
var4.startDrawingQuads();
var4.setNormal(0.0F, -1.0F, 0.0F);

View File

@ -24,6 +24,8 @@ public class RenderFallingSand extends Render {
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef((float) par2, (float) par4, (float) par6);
tex.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING);
Tessellator var12;

View File

@ -421,7 +421,7 @@ public class RenderGlobal implements IWorldAccess {
* Gets the render info for use on the Debug screen
*/
public String getDebugInfoRenders() {
return "C: " + this.renderersBeingRendered + "/" + this.renderersLoaded + "F: " + this.renderersBeingClipped + ", O: " + this.renderersBeingOccluded + ", E: " + this.renderersSkippingRenderPass;
return "C: " + this.renderersBeingRendered + "/" + this.renderersLoaded + ", F: " + this.renderersBeingClipped + ", O: " + this.renderersBeingOccluded + ", E: " + this.renderersSkippingRenderPass;
}
public String getDebugInfoShort() {
@ -1334,6 +1334,8 @@ public class RenderGlobal implements IWorldAccess {
float var7 = MathHelper.sin((float) Minecraft.getSystemTime() / 100.0F) * 0.2F + 0.8F;
EaglerAdapter.glColor4f(var7, var7, var7, MathHelper.sin((float) Minecraft.getSystemTime() / 200.0F) * 0.2F + 0.5F);
tex_terrain.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
}
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
@ -1348,6 +1350,8 @@ public class RenderGlobal implements IWorldAccess {
if (!this.damagedBlocks.isEmpty()) {
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_DST_COLOR, EaglerAdapter.GL_SRC_COLOR);
tex_terrain.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);

View File

@ -41,6 +41,12 @@ public class RenderHelper {
EaglerAdapter.glLightModel(EaglerAdapter.GL_LIGHT_MODEL_AMBIENT, setColorBuffer(var0, var0, var0, 1.0F));
*/
}
public static void enableStandardItemLighting2() {
EaglerAdapter.glPushMatrix();
EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F);
enableStandardItemLighting();
EaglerAdapter.glPopMatrix();
}
/**
* Sets OpenGL lighting for rendering blocks as items inside GUI screens (such
@ -50,6 +56,16 @@ public class RenderHelper {
EaglerAdapter.glPushMatrix();
EaglerAdapter.glRotatef(-30.0F, 0.0F, 1.0F, 0.0F);
EaglerAdapter.glRotatef(165.0F, 1.0F, 0.0F, 0.0F);
//EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F);
enableStandardItemLighting();
EaglerAdapter.glPopMatrix();
}
public static void enableGUIStandardItemLighting2() {
EaglerAdapter.glPushMatrix();
EaglerAdapter.glRotatef(-30.0F, 0.0F, 1.0F, 0.0F);
EaglerAdapter.glRotatef(165.0F, 1.0F, 0.0F, 0.0F);
EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F);
enableStandardItemLighting();
EaglerAdapter.glPopMatrix();
}

View File

@ -57,7 +57,9 @@ public class RenderIronGolem extends RenderLiving {
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
terrain.bindTexture();
EaglerAdapter.flipLightMatrix();
this.renderBlocks.renderBlockAsItem(Block.plantRed, 0, 1.0F);
EaglerAdapter.flipLightMatrix();
EaglerAdapter.glPopMatrix();
EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL);
}

View File

@ -94,7 +94,9 @@ public class RenderItem extends Render {
}
var18 = 1.0F;
EaglerAdapter.flipLightMatrix();
this.itemRenderBlocks.renderBlockAsItem(var22, var10.getItemDamage(), var18);
EaglerAdapter.flipLightMatrix();
EaglerAdapter.glPopMatrix();
}
} else {

View File

@ -42,7 +42,9 @@ public class RenderItemFrame extends Render {
EaglerAdapter.glPushMatrix();
this.renderBlocksInstance.overrideBlockBounds(0.0D, (double) (0.5F - var5 + 0.0625F), (double) (0.5F - var5 + 0.0625F), (double) (var3 * 0.5F), (double) (0.5F + var5 - 0.0625F), (double) (0.5F + var5 - 0.0625F));
this.renderBlocksInstance.setOverrideBlockTexture(this.field_94147_f);
//RenderHelper.enableStandardItemLighting2();
this.renderBlocksInstance.renderBlockAsItem(var2, 0, 1.0F);
//EaglerAdapter.revertLightMatrix();
this.renderBlocksInstance.clearOverrideBlockTexture();
this.renderBlocksInstance.unlockBlockBounds();
EaglerAdapter.glPopMatrix();
@ -131,7 +133,9 @@ public class RenderItemFrame extends Render {
}
RenderItem.renderInFrame = true;
EaglerAdapter.flipLightMatrix();
RenderManager.instance.renderEntityWithPosYaw(var3, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
EaglerAdapter.flipLightMatrix();
RenderItem.renderInFrame = false;
if (var3.getEntityItem().getItem() == Item.compass) {

View File

@ -101,7 +101,9 @@ public class RenderMinecart extends Render {
protected void renderBlockInMinecart(EntityMinecart par1EntityMinecart, float par2, Block par3Block, int par4) {
float var5 = par1EntityMinecart.getBrightness(par2);
EaglerAdapter.glPushMatrix();
EaglerAdapter.flipLightMatrix();
this.field_94145_f.renderBlockAsItem(par3Block, par4, var5);
EaglerAdapter.flipLightMatrix();
EaglerAdapter.glPopMatrix();
}

View File

@ -19,6 +19,7 @@ public class RenderMooshroom extends RenderLiving {
if (!par1EntityMooshroom.isChild()) {
terrain.bindTexture();
EaglerAdapter.flipLightMatrix();
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glScalef(1.0F, -1.0F, 1.0F);
@ -37,6 +38,7 @@ public class RenderMooshroom extends RenderLiving {
this.renderBlocks.renderBlockAsItem(Block.mushroomRed, 0, 1.0F);
EaglerAdapter.glPopMatrix();
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
EaglerAdapter.flipLightMatrix();
}
}

View File

@ -538,7 +538,9 @@ public class RenderPlayer extends RenderLiving {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) var5 / 1.0F, (float) var6 / 1.0F);
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
terrain.bindTexture();
EaglerAdapter.flipLightMatrix();
this.renderBlocks.renderBlockAsItem(Block.blocksList[s.itemID], s.getItemDamage(), 1.0F);
EaglerAdapter.flipLightMatrix();
EaglerAdapter.glPopMatrix();
EaglerAdapter.glDisable(EaglerAdapter.GL_RESCALE_NORMAL);
}

View File

@ -36,6 +36,7 @@ public class RenderTNTPrimed extends Render {
var10 = (1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F;
terrain.bindTexture();
EaglerAdapter.flipLightMatrix();
this.blockRenderer.renderBlockAsItem(Block.tnt, 0, par1EntityTNTPrimed.getBrightness(par9));
if (par1EntityTNTPrimed.fuse / 5 % 2 == 0) {
@ -50,6 +51,7 @@ public class RenderTNTPrimed extends Render {
EaglerAdapter.glEnable(EaglerAdapter.GL_LIGHTING);
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
}
EaglerAdapter.flipLightMatrix();
EaglerAdapter.glPopMatrix();
}

View File

@ -32,7 +32,9 @@ public class RenderTntMinecart extends RenderMinecart {
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_DST_ALPHA);
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, (1.0F - ((float) var5 - par2 + 1.0F) / 100.0F) * 0.8F);
EaglerAdapter.glPushMatrix();
EaglerAdapter.flipLightMatrix();
this.field_94145_f.renderBlockAsItem(Block.tnt, 0, 1.0F);
EaglerAdapter.flipLightMatrix();
EaglerAdapter.glPopMatrix();
EaglerAdapter.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);

View File

@ -5,16 +5,16 @@ import net.lax1dude.eaglercraft.adapter.Tessellator;
public class TexturedQuad {
public PositionTextureVertex[] vertexPositions;
public int nVertices;
private boolean invertNormal;
private Vec3 normal;
public TexturedQuad(PositionTextureVertex[] par1ArrayOfPositionTextureVertex) {
this.nVertices = 0;
this.invertNormal = false;
this.normal = null;
this.vertexPositions = par1ArrayOfPositionTextureVertex;
this.nVertices = par1ArrayOfPositionTextureVertex.length;
}
public TexturedQuad(PositionTextureVertex[] par1ArrayOfPositionTextureVertex, int par2, int par3, int par4, int par5, float par6, float par7) {
public TexturedQuad(PositionTextureVertex[] par1ArrayOfPositionTextureVertex, Vec3 normal, int par2, int par3, int par4, int par5, float par6, float par7) {
this(par1ArrayOfPositionTextureVertex);
float var8 = 0.0F / par6;
float var9 = 0.0F / par7;
@ -22,6 +22,7 @@ public class TexturedQuad {
par1ArrayOfPositionTextureVertex[1] = par1ArrayOfPositionTextureVertex[1].setTexturePosition((float) par2 / par6 + var8, (float) par3 / par7 + var9);
par1ArrayOfPositionTextureVertex[2] = par1ArrayOfPositionTextureVertex[2].setTexturePosition((float) par2 / par6 + var8, (float) par5 / par7 - var9);
par1ArrayOfPositionTextureVertex[3] = par1ArrayOfPositionTextureVertex[3].setTexturePosition((float) par4 / par6 - var8, (float) par5 / par7 - var9);
this.normal = normal;
}
public void flipFace() {
@ -30,20 +31,25 @@ public class TexturedQuad {
for (int var2 = 0; var2 < this.vertexPositions.length; ++var2) {
var1[var2] = this.vertexPositions[this.vertexPositions.length - var2 - 1];
}
this.normal.xCoord = -this.normal.xCoord;
this.normal.yCoord = -this.normal.yCoord;
this.normal.zCoord = -this.normal.zCoord;
this.vertexPositions = var1;
}
public void draw(Tessellator par1Tessellator, float par2) {
Vec3 var3 = this.vertexPositions[1].vector3D.subtract(this.vertexPositions[0].vector3D);
Vec3 var4 = this.vertexPositions[1].vector3D.subtract(this.vertexPositions[2].vector3D);
Vec3 var5 = var4.crossProduct(var3).normalize();
//Vec3 var3 = this.vertexPositions[1].vector3D.subtract(this.vertexPositions[0].vector3D);
//Vec3 var4 = this.vertexPositions[1].vector3D.subtract(this.vertexPositions[2].vector3D);
//Vec3 var5 = var4.crossProduct(var3).normalize();
par1Tessellator.startDrawingQuads();
if (this.invertNormal) {
par1Tessellator.setNormal(-((float) var5.xCoord), -((float) var5.yCoord), -((float) var5.zCoord));
} else {
par1Tessellator.setNormal((float) var5.xCoord, (float) var5.yCoord, (float) var5.zCoord);
//if (this.invertNormal) {
// par1Tessellator.setNormal(-((float) var5.xCoord), -((float) var5.yCoord), -((float) var5.zCoord));
//} else {
if(this.normal != null) {
par1Tessellator.setNormal((float) this.normal.xCoord, (float) this.normal.yCoord, (float) this.normal.zCoord);
}
for (int var6 = 0; var6 < 4; ++var6) {

View File

@ -17,6 +17,8 @@ public class TileEntityRendererPiston extends TileEntitySpecialRenderer {
if (var9 != null && par1TileEntityPiston.getProgress(par8) < 1.0F) {
Tessellator var10 = Tessellator.instance;
tex_terrain.bindTexture();
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_NEAREST);
RenderHelper.disableStandardItemLighting();
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);

View File

@ -150,6 +150,7 @@ public class WorldRenderer {
ChunkCache var9 = new ChunkCache(this.worldObj, var1 - var8, var2 - var8, var3 - var8, var4 + var8, var5 + var8, var6 + var8, var8);
Profiler p = Minecraft.getMinecraft().mcProfiler;
if (!var9.extendedLevelsInChunkCache()) {
EaglerAdapter.hintAnisotropicFix(true);
++chunksUpdated;
RenderBlocks var10 = new RenderBlocks(var9);
this.bytesDrawn = 0;
@ -222,6 +223,7 @@ public class WorldRenderer {
break;
}
}
EaglerAdapter.hintAnisotropicFix(false);
}
HashSet var22 = new HashSet();

View File

@ -17,6 +17,7 @@ import org.teavm.jso.ajax.ReadyStateChangeHandler;
import org.teavm.jso.ajax.XMLHttpRequest;
import org.teavm.jso.browser.TimerHandler;
import org.teavm.jso.browser.Window;
import org.teavm.jso.core.JSNumber;
import org.teavm.jso.dom.events.EventListener;
import org.teavm.jso.dom.events.KeyboardEvent;
import org.teavm.jso.dom.events.MessageEvent;
@ -51,6 +52,7 @@ import org.teavm.jso.websocket.WebSocket;
import net.lax1dude.eaglercraft.AssetRepository;
import net.lax1dude.eaglercraft.Base64;
import net.lax1dude.eaglercraft.EarlyLoadScreen;
import net.lax1dude.eaglercraft.LocalStorageManager;
import net.lax1dude.eaglercraft.adapter.teavm.WebGLQuery;
import net.lax1dude.eaglercraft.adapter.teavm.WebGLVertexArray;
import net.minecraft.src.MathHelper;
@ -63,7 +65,7 @@ public class EaglerAdapterImpl2 {
public static final boolean _wisWebGL() {
return true;
}
private static boolean isAnisotropicPatched = true;
private static boolean isAnisotropicPatched = false;
public static final boolean _wisAnisotropicPatched() {
return isAnisotropicPatched;
}
@ -71,6 +73,13 @@ public class EaglerAdapterImpl2 {
return "#version 300 es";
}
@JSBody(params = { }, script = "return window.location.href;")
private static native String getLocationString();
public static final boolean isSSLPage() {
return getLocationString().startsWith("https");
}
public static final InputStream loadResource(String path) {
byte[] file = loadResourceBytes(path);
if (file != null) {
@ -148,10 +157,21 @@ public class EaglerAdapterImpl2 {
private static EventListener keyup = null;
private static EventListener keypress = null;
private static EventListener wheel = null;
private static String[] identifier = new String[0];
public static final String[] getIdentifier() {
return identifier;
}
@JSBody(params = { "v" }, script = "try { return \"\"+window.eval(v); } catch(e) { return \"<error>\"; }")
private static native String getString(String var);
public static void onWindowUnload() {
LocalStorageManager.saveStorageA();
LocalStorageManager.saveStorageG();
LocalStorageManager.saveStorageP();
}
public static final void initializeContext(HTMLElement rootElement, String assetPackageURI) {
parent = rootElement;
String s = parent.getAttribute("style");
@ -257,7 +277,7 @@ public class EaglerAdapterImpl2 {
isWindowFocused = true;
}
});
execute("window.onbeforeunload = function(){return false;};");
onBeforeCloseRegister();
execute("window.eagsFileChooser = {\r\n" +
"inputElement: null,\r\n" +
"openFileChooser: function(ext, mime){\r\n" +
@ -432,7 +452,11 @@ public class EaglerAdapterImpl2 {
public static final int _wGL_FRAMEBUFFER = FRAMEBUFFER;
public static final class TextureGL {
protected final WebGLTexture obj;
protected final WebGLTexture obj;
public int w = -1;
public int h = -1;
public boolean nearest = true;
public boolean anisotropic = false;
protected TextureGL(WebGLTexture obj) {
this.obj = obj;
}
@ -808,6 +832,19 @@ public class EaglerAdapterImpl2 {
public static final void _wglBlitFramebuffer(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10) {
webgl.blitFramebuffer(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
}
@JSBody(params = { "ctx", "p" }, script = "return ctx.getTexParameter(0x0DE1, p) | 0;")
private static final native int __wglGetTexParameteri(WebGL2RenderingContext ctx, int p);
public static final int _wglGetTexParameteri(int p1) {
return __wglGetTexParameteri(webgl, p1);
}
@JSBody(params = { "ctx", "p" }, script = "return (0.0 + ctx.getTexParameter(0x0DE1, p));")
private static final native float __wglGetTexParameterf(WebGL2RenderingContext ctx, int p);
public static final float _wglGetTexParameterf(int p1) {
return __wglGetTexParameterf(webgl, p1);
}
public static final boolean isWindows() {
return getString("window.navigator.platform").toLowerCase().contains("win");
}
private static MouseEvent currentEvent = null;
private static KeyboardEvent currentEventK = null;
@ -1048,9 +1085,12 @@ public class EaglerAdapterImpl2 {
public static final void openLink(String url) {
win.open(url, "_blank");
}
@JSBody(params = { "str" }, script = "window.eval(str);")
private static native void execute(String str);
@JSBody(params = { }, script = "window.onbeforeunload = function(){javaMethods.get('net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.onWindowUnload()V').invoke();return false;};")
private static native void onBeforeCloseRegister();
@JSBody(params = { "ext", "mime" }, script = "window.eagsFileChooser.openFileChooser(ext, mime);")
public static native void openFileChooser(String ext, String mime);

View File

@ -349,9 +349,9 @@ public class Tessellator {
public void setNormal(float par1, float par2, float par3) {
this.hasNormals = true;
float len = (float) Math.sqrt(par1 * par1 + par2 * par2 + par3 * par3);
int var4 = (int)((par1 / len) * 128.0F) + 127;
int var5 = (int)((par2 / len) * 128.0F) + 127;
int var6 = (int)((par3 / len) * 128.0F) + 127;
int var4 = (int)((par1 / len) * 127.0F) + 127;
int var5 = (int)((par2 / len) * 127.0F) + 127;
int var6 = (int)((par3 / len) * 127.0F) + 127;
this.normal = var4 & 255 | (var5 & 255) << 8 | (var6 & 255) << 16;
}

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long