fixes, part 1

This commit is contained in:
lax1dude 2023-10-08 20:42:25 -07:00
parent 08b3c9000e
commit 0154bd9744
15 changed files with 352 additions and 75 deletions

View File

@ -1,6 +1,5 @@
// eaglercraft opengl 1.3 emulation
// copyright (c) 2020 calder young
// copyright (c) 2020-2023 lax1dude
// creative commons BY-NC 4.0
#line 7
@ -130,6 +129,8 @@ in vec2 v_texture1;
out vec4 fragColor;
#define TEX_MAT3(mat4In) mat3(mat4In[0].xyw,mat4In[1].xyw,mat4In[3].xyw)
void main(){
#ifdef CC_a_color
vec4 color = colorUniform * v_color;
@ -147,9 +148,7 @@ void main(){
texPos.y = dot(texSrc[textureGenT_M], textureGenT_V);
texPos.z = dot(texSrc[textureGenR_M], textureGenR_V);
texPos.w = dot(texSrc[textureGenQ_M], textureGenQ_V);
texPos = matrix_t * texPos;
color *= texture(tex0, texPos.xy / texPos.w).bgra;
#ifdef CC_alphatest
if(color.a < alphaTestF){
@ -161,18 +160,18 @@ void main(){
#ifdef CC_a_texture0
#ifdef CC_patch_anisotropic
vec2 uv = (matrix_t * vec4(v_texture0, 0.0, 1.0)).xy;
vec2 uv = (TEX_MAT3(matrix_t) * vec3(v_texture0, 1.0)).xy;
/* 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
vec4 texColor = texture(tex0, (matrix_t * vec4(v_texture0, 0.0, 1.0)).xy);
vec4 texColor = texture(tex0, (TEX_MAT3(matrix_t) * vec3(v_texture0, 1.0)).xy);
#endif
#else
vec4 texColor = texture(tex0, (matrix_t * vec4(texCoordV0, 0.0, 1.0)).xy);
vec4 texColor = texture(tex0, (TEX_MAT3(matrix_t) * vec3(texCoordV0, 1.0)).xy);
#endif
#ifdef CC_swap_rb
@ -211,7 +210,7 @@ void main(){
#ifdef CC_fog
float dist = sqrt(dot(v_position, v_position));
float i = fogMode == 1 ? (dist - fogStart) / (fogEnd - fogStart) : 1.0 - pow(2.718, -(fogDensity * dist));
float i = fogMode == 1 ? (dist - fogStart) / (fogEnd - fogStart) : 1.0 - exp(-fogDensity * dist);
color.rgb = mix(color.rgb, fogColor.xyz, clamp(i, 0.0, 1.0) * fogColor.a);
#endif

View File

@ -58,7 +58,7 @@ out vec4 fragColor;
#define FxaaTex sampler2D
/*--------------------------------------------------------------------------*/
#define FxaaTexTop(t, p) texture(t, p)
#define FxaaTexTop(t, p) textureLod(t, p, 0.0)
/*============================================================================
GREEN AS LUMA OPTION SUPPORT FUNCTION
@ -241,15 +241,15 @@ uniform vec2 screenSize;
#define edgeThresholdMin 0.005
void main(){
vec2 screenSize05 = 0.5 * screenSize;
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);
posPos.xy = pos;
posPos.zw = pos + screenSize;
vec4 rcpFrameOpt;
rcpFrameOpt.xy = -screenSize05;
rcpFrameOpt.zw = screenSize05;
fragColor = vec4(FxaaPixelShader(pos + screenSize05, posPos, f_color, rcpFrameOpt, rcpFrameOpt * 4.0, edgeSharpness, edgeThreshold, edgeThresholdMin).rgb, 1.0);
}

View File

@ -7,4 +7,4 @@
* in the user manual at https://docs.gradle.org/6.0/userguide/multi_project_builds.html
*/
rootProject.name = 'eaglercraft'
rootProject.name = 'eaglercraft-1.5.2-service-pack-1'

View File

@ -228,6 +228,7 @@ public class EaglerAdapterImpl2 {
public static final int _wGL_ELEMENT_ARRAY_BUFFER = GL15.GL_ELEMENT_ARRAY_BUFFER;
public static final int _wGL_STATIC_DRAW = GL15.GL_STATIC_DRAW;
public static final int _wGL_DYNAMIC_DRAW = GL15.GL_DYNAMIC_DRAW;
public static final int _wGL_STREAM_DRAW = GL15.GL_STREAM_DRAW;
public static final int _wGL_INVALID_ENUM = GL11.GL_INVALID_ENUM;
public static final int _wGL_INVALID_VALUE= GL11.GL_INVALID_VALUE;
public static final int _wGL_INVALID_OPERATION = GL11.GL_INVALID_OPERATION;
@ -356,10 +357,12 @@ public class EaglerAdapterImpl2 {
public static final void _wglTexImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, ByteBuffer p9) {
GL11.glTexImage2D(p1, p2, p3, p4, p5, p6, p7, p8, p9);
}
public static final void _wglBlendFunc(int p1, int p2) {
GL11.glBlendFunc(p1, p2);
}
public static final void _wglBlendFuncSeparate(int p1, int p2, int p3, int p4) {
GL14.glBlendFuncSeparate(p1, p2, p3, p4);
}
public static final void _wglBlendColor(float r, float g, float b, float a) {
GL14.glBlendColor(r, g, b, a);
}
@ -480,6 +483,9 @@ public class EaglerAdapterImpl2 {
public static final void _wglBufferData0(int p1, IntBuffer p2, int p3) {
GL15.glBufferData(p1, p2, p3);
}
public static final void _wglBufferData00(int p1, long len, int p3) {
GL15.glBufferData(p1, len, p3);
}
public static final void _wglBufferSubData0(int p1, int p2, IntBuffer p3) {
GL15.glBufferSubData(p1, p2, p3);
}

View File

@ -6,10 +6,10 @@ public class ConfigConstants {
public static boolean profanity = false;
public static final String version = "22w43a";
public static final String version = "1.5.2-sp1";
public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/lax1dude/eaglercraft";
public static final String forkMe = null;
public static final boolean html5build = true;

View File

@ -9,6 +9,7 @@ import java.util.HashMap;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2;
import net.lax1dude.eaglercraft.glemu.StreamBuffer.StreamBufferInstance;
import net.lax1dude.eaglercraft.glemu.vector.Matrix4f;
import net.lax1dude.eaglercraft.glemu.vector.Vector3f;
import net.lax1dude.eaglercraft.glemu.vector.Vector4f;
@ -645,7 +646,17 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
public static final void glBlendFunc(int p1, int p2) {
fogPremultiply = (p1 == GL_ONE && p2 == GL_ONE_MINUS_SRC_ALPHA);
_wglBlendFunc(p1, p2);
if(overlayFBOBlending) {
_wglBlendFuncSeparate(p1, p2, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
}else {
_wglBlendFunc(p1, p2);
}
}
private static boolean overlayFBOBlending = false;
public static final void enableOverlayFramebufferBlending(boolean en) {
overlayFBOBlending = en;
}
public static final void glDepthMask(boolean p1) {
@ -1069,13 +1080,15 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
System.err.println("only GL_QUADS supported in a display list");
}
} else {
bytesUploaded += _wArrayByteLength(buffer);
int bl = _wArrayByteLength(buffer);
bytesUploaded += bl;
vertexDrawn += p3;
bindTheShader();
_wglBindVertexArray0(shader.genericArray);
_wglBindBuffer(_wGL_ARRAY_BUFFER, shader.genericBuffer);
StreamBufferInstance sb = shader.streamBuffer.getBuffer(bl);
_wglBindVertexArray0(sb.vertexArray);
_wglBindBuffer(_wGL_ARRAY_BUFFER, sb.vertexBuffer);
if (!shader.bufferIsInitialized) {
shader.bufferIsInitialized = true;
_wglBufferData(_wGL_ARRAY_BUFFER, blankUploadArray, _wGL_DYNAMIC_DRAW);
@ -1457,6 +1470,10 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
}
}
public static final void optimize() {
FixedFunctionShader.optimize();
}
private static long lastBandwidthReset = 0l;
private static int lastBandwidth = 0;

View File

@ -1,7 +1,6 @@
package net.lax1dude.eaglercraft.glemu;
import static net.lax1dude.eaglercraft.EaglerAdapter.*;
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30._wglBindVertexArray0;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@ -212,7 +211,7 @@ public class EffectPipelineFXAA {
_wglDisable(_wGL_CULL_FACE);
_wglDepthMask(false);
_wglUseProgram(fxaaProgram);
_wglUniform2f(fxaaScreenSize, width, height);
_wglUniform2f(fxaaScreenSize, 1.0f / width, 1.0f / height);
_wglBindVertexArray0(renderQuadArray);
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
_wglEnable(_wGL_DEPTH_TEST);

View File

@ -2,8 +2,9 @@ package net.lax1dude.eaglercraft.glemu;
import static net.lax1dude.eaglercraft.EaglerAdapter.*;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.BufferArrayGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.BufferGL;
import java.util.ArrayList;
import java.util.List;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.ProgramGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.ShaderGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.UniformGL;
@ -14,6 +15,7 @@ import net.lax1dude.eaglercraft.glemu.vector.Vector4f;
public class FixedFunctionShader {
private static final FixedFunctionShader[] instances = new FixedFunctionShader[4096]; //lol
private static final List<FixedFunctionShader> instanceList = new ArrayList();
public static void refreshCoreGL() {
for(int i = 0; i < instances.length; ++i) {
@ -22,6 +24,7 @@ public class FixedFunctionShader {
instances[i] = null;
}
}
instanceList.clear();
shaderSource = null;
}
@ -92,6 +95,7 @@ public class FixedFunctionShader {
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, CC_swap_rb);
instances[i] = s;
instanceList.add(s);
}
return s;
}
@ -154,8 +158,7 @@ public class FixedFunctionShader {
private final int attributeIndexesToEnable;
public final BufferArrayGL genericArray;
public final BufferGL genericBuffer;
public final StreamBuffer streamBuffer;
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,
@ -306,12 +309,12 @@ public class FixedFunctionShader {
u_texCoordV0 = _wglGetUniformLocation(globject, "texCoordV0");
u_texCoordV1 = _wglGetUniformLocation(globject, "texCoordV1");
genericArray = _wglCreateVertexArray();
genericBuffer = _wglCreateBuffer();
_wglBindVertexArray(genericArray);
_wglBindBuffer(_wGL_ARRAY_BUFFER, genericBuffer);
setupArrayForProgram();
streamBuffer = new StreamBuffer(0x8000, 3, 8, (vertexArray, vertexBuffer) -> {
_wglBindVertexArray(vertexArray);
_wglBindBuffer(_wGL_ARRAY_BUFFER, vertexBuffer);
setupArrayForProgram();
});
}
@ -344,6 +347,13 @@ public class FixedFunctionShader {
}
public static void optimize() {
FixedFunctionShader pp;
for(int i = 0, l = instanceList.size(); i < l; ++i) {
instanceList.get(i).streamBuffer.optimize();
}
}
private float[] modelBuffer = new float[16];
private float[] projectionBuffer = new float[16];
private float[] textureBuffer = new float[16];

View File

@ -0,0 +1,72 @@
package net.lax1dude.eaglercraft.glemu;
import static net.lax1dude.eaglercraft.EaglerAdapter.*;
import java.nio.ByteBuffer;
public class GameOverlayFramebuffer {
private long age = -1l;
private int currentWidth = -1;
private int currentHeight = -1;
private FramebufferGL framebuffer = null;
private TextureGL framebufferColor = null;
private RenderbufferGL depthBuffer = null;
public void beginRender(int width, int height) {
if(framebuffer == null) {
framebuffer = _wglCreateFramebuffer();
depthBuffer = _wglCreateRenderBuffer();
framebufferColor = _wglGenTextures();
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer);
_wglBindTexture(_wGL_TEXTURE_2D, framebufferColor);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
_wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, framebufferColor, 0);
_wglBindRenderbuffer(depthBuffer);
_wglFramebufferRenderbuffer(_wGL_DEPTH_ATTACHMENT, depthBuffer);
}
if(currentWidth != width || currentHeight != height) {
currentWidth = width;
currentHeight = height;
_wglBindTexture(_wGL_TEXTURE_2D, framebufferColor);
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGBA8, width, height, 0, _wGL_RGBA, _wGL_UNSIGNED_BYTE, (ByteBuffer)null);
_wglBindRenderbuffer(depthBuffer);
_wglRenderbufferStorage(0x81A5, width, height);
}
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer);
}
public void endRender() {
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
age = System.currentTimeMillis();
}
public long getAge() {
return age == -1l ? -1l : (System.currentTimeMillis() - age);
}
public void bindTexture() {
_wglBindTexture(_wGL_TEXTURE_2D, framebufferColor);
}
public void destroy() {
if(framebuffer != null) {
_wglDeleteFramebuffer(framebuffer);
_wglDeleteRenderbuffer(depthBuffer);
_wglDeleteTextures(framebufferColor);
framebuffer = null;
depthBuffer = null;
framebufferColor = null;
age = -1l;
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
}
}
}

View File

@ -0,0 +1,130 @@
package net.lax1dude.eaglercraft.glemu;
import static net.lax1dude.eaglercraft.EaglerAdapter.*;
public class StreamBuffer {
public final int initialSize;
public final int initialCount;
public final int maxCount;
protected StreamBufferInstance[] buffers;
protected int currentBufferId = 0;
protected int overflowCounter = 0;
protected final IStreamBufferInitializer initializer;
public static class StreamBufferInstance {
protected BufferArrayGL vertexArray = null;
protected BufferGL vertexBuffer = null;
protected int vertexBufferSize = 0;
public boolean bindQuad16 = false;
public boolean bindQuad32 = false;
public BufferArrayGL getVertexArray() {
return vertexArray;
}
public BufferGL getVertexBuffer() {
return vertexBuffer;
}
}
public static interface IStreamBufferInitializer {
void initialize(BufferArrayGL vertexArray, BufferGL vertexBuffer);
}
public StreamBuffer(int initialSize, int initialCount, int maxCount, IStreamBufferInitializer initializer) {
this.buffers = new StreamBufferInstance[initialCount];
for(int i = 0; i < this.buffers.length; ++i) {
this.buffers[i] = new StreamBufferInstance();
}
this.initialSize = initialSize;
this.initialCount = initialCount;
this.maxCount = maxCount;
this.initializer = initializer;
}
public StreamBufferInstance getBuffer(int requiredMemory) {
StreamBufferInstance next = buffers[(currentBufferId++) % buffers.length];
if(next.vertexBuffer == null) {
next.vertexBuffer = _wglCreateBuffer();
}
if(next.vertexArray == null) {
next.vertexArray = _wglCreateVertexArray();
initializer.initialize(next.vertexArray, next.vertexBuffer);
}
if(next.vertexBufferSize < requiredMemory) {
int newSize = (requiredMemory & 0xFFFFF000) + 0x2000;
_wglBindBuffer(_wGL_ARRAY_BUFFER, next.vertexBuffer);
_wglBufferData00(_wGL_ARRAY_BUFFER, newSize, _wGL_STREAM_DRAW);
next.vertexBufferSize = newSize;
}
return next;
}
public void optimize() {
overflowCounter += currentBufferId - buffers.length;
if(overflowCounter < -25) {
int newCount = buffers.length - 1 + ((overflowCounter + 25) / 5);
if(newCount < initialCount) {
newCount = initialCount;
}
if(newCount < buffers.length) {
StreamBufferInstance[] newArray = new StreamBufferInstance[newCount];
for(int i = 0; i < buffers.length; ++i) {
if(i < newArray.length) {
newArray[i] = buffers[i];
}else {
if(buffers[i].vertexArray != null) {
_wglDeleteVertexArray(buffers[i].vertexArray);
}
if(buffers[i].vertexBuffer != null) {
_wglDeleteBuffer(buffers[i].vertexBuffer);
}
}
}
buffers = newArray;
}
overflowCounter = 0;
}else if(overflowCounter > 15) {
int newCount = buffers.length + 1 + ((overflowCounter - 15) / 5);
if(newCount > maxCount) {
newCount = maxCount;
}
if(newCount > buffers.length) {
StreamBufferInstance[] newArray = new StreamBufferInstance[newCount];
for(int i = 0; i < newArray.length; ++i) {
if(i < buffers.length) {
newArray[i] = buffers[i];
}else {
newArray[i] = new StreamBufferInstance();
}
}
buffers = newArray;
}
overflowCounter = 0;
}
currentBufferId = 0;
}
public void destroy() {
for(int i = 0; i < buffers.length; ++i) {
StreamBufferInstance next = buffers[i];
if(next.vertexArray != null) {
_wglDeleteVertexArray(next.vertexArray);
}
if(next.vertexBuffer != null) {
_wglDeleteBuffer(next.vertexBuffer);
}
}
buffers = new StreamBufferInstance[initialCount];
for(int i = 0; i < buffers.length; ++i) {
buffers[i] = new StreamBufferInstance();
}
}
}

View File

@ -536,6 +536,7 @@ public class Minecraft implements Runnable {
EaglerAdapter.glAlphaFunc(EaglerAdapter.GL_GREATER, 0.1F);
EaglerAdapter.glFlush();
EaglerAdapter.updateDisplay();
EaglerAdapter.optimize();
}
/**
@ -780,6 +781,7 @@ public class Minecraft implements Runnable {
}
this.checkGLError("Post render");
EaglerAdapter.optimize();
++this.fpsCounter;
//boolean var5 = this.isGamePaused;
//this.isGamePaused = false;

View File

@ -10,6 +10,7 @@ import net.lax1dude.eaglercraft.TextureLocation;
import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.lax1dude.eaglercraft.glemu.EffectPipeline;
import net.lax1dude.eaglercraft.glemu.EffectPipelineFXAA;
import net.lax1dude.eaglercraft.glemu.GameOverlayFramebuffer;
import net.lax1dude.eaglercraft.glemu.vector.Matrix4f;
import net.minecraft.client.Minecraft;
@ -161,8 +162,11 @@ public class EntityRenderer {
public int startup = 0;
public int preStartup = 0;
private GameOverlayFramebuffer overlayFramebuffer;
public EntityRenderer(Minecraft par1Minecraft) {
this.mc = par1Minecraft;
this.overlayFramebuffer = new GameOverlayFramebuffer();
this.itemRenderer = new ItemRenderer(par1Minecraft);
this.lightmapTexture = par1Minecraft.renderEngine.allocateAndSetupTexture(new EaglerImage(16, 16, true));
this.lightmapColors = new int[256];
@ -929,9 +933,46 @@ public class EntityRenderer {
this.mc.mcProfiler.endStartSection("gui");
if (!this.mc.gameSettings.hideGUI || this.mc.currentScreen != null) {
this.mc.ingameGUI.renderGameOverlay(par1, this.mc.currentScreen != null, var16, var17);
EaglerAdapter.glAlphaFunc(EaglerAdapter.GL_GREATER, 0.1F);
long framebufferAge = this.overlayFramebuffer.getAge();
if(framebufferAge == -1l || framebufferAge > (Minecraft.debugFPS < 25 ? 125l : 75l)) {
this.overlayFramebuffer.beginRender(mc.displayWidth, mc.displayHeight);
EaglerAdapter.glColorMask(true, true, true, true);
EaglerAdapter.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
EaglerAdapter.glClear(EaglerAdapter.GL_COLOR_BUFFER_BIT | EaglerAdapter.GL_DEPTH_BUFFER_BIT);
EaglerAdapter.enableOverlayFramebufferBlending(true);
this.mc.ingameGUI.renderGameOverlay(par1, this.mc.currentScreen != null, var16, var17);
EaglerAdapter.enableOverlayFramebufferBlending(false);
this.overlayFramebuffer.endRender();
EaglerAdapter.glClearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F);
}
this.setupOverlayRendering();
EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING);
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
if (Minecraft.isFancyGraphicsEnabled()) {
this.mc.ingameGUI.renderVignette(this.mc.thePlayer.getBrightness(par1), var14, var15);
}
this.mc.ingameGUI.renderCrosshairs(var14, var15);
this.overlayFramebuffer.bindTexture();
EaglerAdapter.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
EaglerAdapter.glDisable(EaglerAdapter.GL_DEPTH_TEST);
EaglerAdapter.glDepthMask(false);
EaglerAdapter.glEnable(EaglerAdapter.EAG_SWAP_RB);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0.0D, (double) var15, -90.0D, 0.0D, 0.0D);
tessellator.addVertexWithUV((double) var14, (double) var15, -90.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double) var14, 0.0D, -90.0D, 1.0D, 1.0D);
tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 1.0D);
tessellator.draw();
EaglerAdapter.glDepthMask(true);
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
EaglerAdapter.glEnable(EaglerAdapter.GL_DEPTH_TEST);
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glDisable(EaglerAdapter.EAG_SWAP_RB);
}
this.mc.mcProfiler.endSection();
} else {
EaglerAdapter.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);

View File

@ -59,12 +59,7 @@ public class GuiIngame extends Gui {
FontRenderer var8 = this.mc.fontRenderer;
this.mc.entityRenderer.setupOverlayRendering();
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
if (Minecraft.isFancyGraphicsEnabled()) {
this.renderVignette(this.mc.thePlayer.getBrightness(par1), var6, var7);
} else {
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
}
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
ItemStack var9 = this.mc.thePlayer.inventory.armorItemInSlot(3);
@ -102,29 +97,9 @@ public class GuiIngame extends Gui {
this.zLevel = -90.0F;
this.drawTexturedModalRect(var6 / 2 - 91, var7 - 22, 0, 0, 182, 22);
this.drawTexturedModalRect(var6 / 2 - 91 - 1 + var31.currentItem * 20, var7 - 22 - 1, 0, 22, 24, 22);
tex_icons.bindTexture();
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_ONE_MINUS_DST_COLOR, EaglerAdapter.GL_ONE_MINUS_SRC_COLOR);
float i = mc.entityRenderer.startup / 900.0f - 0.5f;
if(i > 1.0f) i = 1.0f;
if(i < 0.0f) i = 0.0f;
float i2 = i * i;
if(i2 > 0.0f) {
float f = (float)((System.currentTimeMillis() % 1000000l) * 0.0002);
f += MathHelper.sin(f * 5.0f) * 0.2f;
i2 *= MathHelper.sin(f) + MathHelper.sin(f * 1.5f + 0.6f) + MathHelper.sin(f * 0.7f + 1.7f) +
MathHelper.sin(f * 3.0f + 3.0f);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef(var6 / 2, var7 / 2, 0.0f);
EaglerAdapter.glRotatef(i2 * 5.0f, 0.0f, 0.0f, 1.0f);
this.drawTexturedModalRect(-7, -7, 0, 0, 16, 16);
EaglerAdapter.glPopMatrix();
}else {
this.drawTexturedModalRect(var6 / 2 - 7, var7 / 2 - 7, 0, 0, 16, 16);
}
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
var11 = this.mc.thePlayer.hurtResistantTime / 3 % 2 == 1;
if (this.mc.thePlayer.hurtResistantTime < 10) {
@ -669,14 +644,14 @@ public class GuiIngame extends Gui {
int var19 = var23 - var12 * par4FontRenderer.FONT_HEIGHT;
int var20 = par3 - var24 + 2;
drawRect(var25 - 2, var19, var20, var19 + par4FontRenderer.FONT_HEIGHT, 1342177280);
par4FontRenderer.drawString(var16, var25, var19, 553648127);
par4FontRenderer.drawString(var17, var20 - par4FontRenderer.getStringWidth(var17), var19, 553648127);
par4FontRenderer.drawString(var16, var25, var19, 0xFFFFFFFF);
par4FontRenderer.drawString(var17, var20 - par4FontRenderer.getStringWidth(var17), var19, 0xFFFFFFFF);
if (var12 == var6.size()) {
String var21 = par1ScoreObjective.getDisplayName();
drawRect(var25 - 2, var19 - par4FontRenderer.FONT_HEIGHT - 1, var20, var19 - 1, 1610612736);
drawRect(var25 - 2, var19 - 1, var20, var19, 1342177280);
par4FontRenderer.drawString(var21, var25 + var7 / 2 - par4FontRenderer.getStringWidth(var21) / 2, var19 - par4FontRenderer.FONT_HEIGHT, 553648127);
par4FontRenderer.drawString(var21, var25 + var7 / 2 - par4FontRenderer.getStringWidth(var21) / 2, var19 - par4FontRenderer.FONT_HEIGHT, 0xFFFFFFFF);
}
}
}
@ -732,7 +707,7 @@ public class GuiIngame extends Gui {
/**
* Renders the vignette. Args: vignetteBrightness, width, height
*/
private void renderVignette(float par1, int par2, int par3) {
public void renderVignette(float par1, int par2, int par3) {
par1 = 1.0F - par1 * 0.5f;
if (par1 < 0.0F) {
@ -762,6 +737,31 @@ public class GuiIngame extends Gui {
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE_MINUS_SRC_ALPHA);
}
public void renderCrosshairs(int w, int h) {
tex_icons.bindTexture();
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_ONE_MINUS_DST_COLOR, EaglerAdapter.GL_ONE_MINUS_SRC_COLOR);
float i = mc.entityRenderer.startup / 900.0f - 0.5f;
if(i > 1.0f) i = 1.0f;
if(i < 0.0f) i = 0.0f;
float i2 = i * i;
if(i2 > 0.0f) {
float f = (float)((System.currentTimeMillis() % 1000000l) * 0.0002);
f += MathHelper.sin(f * 5.0f) * 0.2f;
i2 *= MathHelper.sin(f) + MathHelper.sin(f * 1.5f + 0.6f) + MathHelper.sin(f * 0.7f + 1.7f) +
MathHelper.sin(f * 3.0f + 3.0f);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef(w / 2, h / 2, 0.0f);
EaglerAdapter.glRotatef(i2 * 5.0f, 0.0f, 0.0f, 1.0f);
this.drawTexturedModalRect(-7, -7, 0, 0, 16, 16);
EaglerAdapter.glPopMatrix();
}else {
this.drawTexturedModalRect(w / 2 - 7, h / 2 - 7, 0, 0, 16, 16);
}
}
/**
* Renders the portal overlay. Args: portalStrength, width, height
*/

View File

@ -86,7 +86,7 @@ public class GuiMainMenu extends GuiScreen {
this.splashText = "missingno";
}
}
this.field_92025_p = EaglerAdapter._wisWebGL() ? ("eaglercraft javascript runtime") : ("eaglercraft desktop runtime");
this.field_92025_p = "Eaglercraft 1.5.2 Service Pack #1";
this.start = System.currentTimeMillis();
this.start += this.start % 10000l;
this.ackLines = new ArrayList();
@ -154,6 +154,7 @@ public class GuiMainMenu extends GuiScreen {
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, var4, var2.translateKey("menu.multiplayer")));
this.buttonList.add(new GuiButton(3, this.width / 2 - 100, var4 + 24, var2.translateKey("menu.forkme")));
}
((GuiButton)this.buttonList.get(this.buttonList.size() - 1)).enabled = false;
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, var4 + 72 + 12, 98, 20, var2.translateKey("menu.options")));
this.buttonList.add(new GuiButton(4, this.width / 2 + 2, var4 + 72 + 12, 98, 20, var2.translateKey("menu.editprofile")));
@ -504,7 +505,7 @@ public class GuiMainMenu extends GuiScreen {
this.drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44);
this.drawString(this.fontRenderer, "minecraft 1.5.2", 2, this.height - 20, 16777215);
this.drawString(this.fontRenderer, ConfigConstants.mainMenuString + EnumChatFormatting.GRAY + " (cracked)", 2, this.height - 10, 16777215);
this.drawString(this.fontRenderer, ConfigConstants.mainMenuString + " official", 2, this.height - 10, 16777215);
//String var10 = "Copyright " + Calendar.getInstance().get(Calendar.YEAR) + " Mojang AB.";
String var10 = "copyright 2013 Mojang AB";

View File

@ -917,7 +917,7 @@ public class RenderGlobal implements IWorldAccess {
var13 = (float) var27 * (float) Math.PI * 2.0F / (float) var26;
float var14 = MathHelper.sin(var13);
float var15 = MathHelper.cos(var13);
var23.addVertex((double) (var14 * 120.0F), (double) (var15 * 120.0F), (double) (-var15 * 40.0F * var24[3]));
var23.addVertex((double) (var14 * 120.0F), (double) (var15 * 120.0F), (double) (var15 * 40.0F * var24[3]));
}
var23.draw();