mirror of
https://git.eaglercraft.rip/eaglercraft/eaglercraft-1.5.git
synced 2025-01-22 07:21:52 -05:00
fixes part 2.5
This commit is contained in:
parent
60fc4bc096
commit
d2ff714cf1
11 changed files with 64 additions and 108 deletions
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
// copyright (c) 2020-2023 lax1dude
|
// copyright (c) 2020-2023 lax1dude
|
||||||
// creative commons BY-NC 4.0
|
|
||||||
|
|
||||||
#line 7
|
#line 7
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package net.lax1dude.eaglercraft;
|
package net.lax1dude.eaglercraft;
|
||||||
|
|
||||||
|
import java.lang.management.ManagementFactory;
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -9,7 +11,7 @@ public class MinecraftMain {
|
||||||
|
|
||||||
public static void main(String[] par0ArrayOfStr) {
|
public static void main(String[] par0ArrayOfStr) {
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(null, "launch renderdoc (optionally) and press ok to continue", "eaglercraft", JOptionPane.PLAIN_MESSAGE);
|
JOptionPane.showMessageDialog(null, "launch renderdoc (optionally) and press ok to continue", "eaglercraft: " + ManagementFactory.getRuntimeMXBean().getName(), JOptionPane.PLAIN_MESSAGE);
|
||||||
|
|
||||||
EaglerAdapter.initializeContext();
|
EaglerAdapter.initializeContext();
|
||||||
LocalStorageManager.loadStorage();
|
LocalStorageManager.loadStorage();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -169,7 +169,7 @@ public class TextureTerrainMap implements IconRegister {
|
||||||
|
|
||||||
EaglerAdapter.glBindTexture(EaglerAdapter.GL_TEXTURE_2D, -1);
|
EaglerAdapter.glBindTexture(EaglerAdapter.GL_TEXTURE_2D, -1);
|
||||||
frames = EaglerAdapter._wglGenTextures();
|
frames = EaglerAdapter._wglGenTextures();
|
||||||
EaglerAdapter._wglBindTexture(EaglerAdapter.GL_TEXTURE_2D, frames);
|
EaglerAdapter.glBindTexture(EaglerAdapter.GL_TEXTURE_2D, frames);
|
||||||
|
|
||||||
EaglerImage mipLvl = populateAlpha(img);
|
EaglerImage mipLvl = populateAlpha(img);
|
||||||
uploadBuffer.clear();
|
uploadBuffer.clear();
|
||||||
|
@ -499,7 +499,7 @@ public class TextureTerrainMap implements IconRegister {
|
||||||
EaglerAdapter._wglBindFramebuffer(EaglerAdapter._wGL_FRAMEBUFFER, copyFramebuffer);
|
EaglerAdapter._wglBindFramebuffer(EaglerAdapter._wGL_FRAMEBUFFER, copyFramebuffer);
|
||||||
EaglerAdapter._wglReadBuffer(EaglerAdapter._wGL_COLOR_ATTACHMENT0);
|
EaglerAdapter._wglReadBuffer(EaglerAdapter._wGL_COLOR_ATTACHMENT0);
|
||||||
for(int i = 0; i < 5; i++) {
|
for(int i = 0; i < 5; i++) {
|
||||||
EaglerAdapter._wglBindTexture(EaglerAdapter.GL_TEXTURE_2D, icon.frames);
|
EaglerAdapter.glBindTexture(EaglerAdapter.GL_TEXTURE_2D, icon.frames);
|
||||||
EaglerAdapter._wglFramebufferTexture2D(EaglerAdapter._wGL_COLOR_ATTACHMENT0, icon.frames, i);
|
EaglerAdapter._wglFramebufferTexture2D(EaglerAdapter._wGL_COLOR_ATTACHMENT0, icon.frames, i);
|
||||||
EaglerAdapter.glBindTexture(EaglerAdapter.GL_TEXTURE_2D, texture);
|
EaglerAdapter.glBindTexture(EaglerAdapter.GL_TEXTURE_2D, texture);
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,8 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
||||||
|
|
||||||
static int selectedTex = 0;
|
static int selectedTex = 0;
|
||||||
static int selectedClientTex = 0;
|
static int selectedClientTex = 0;
|
||||||
static int[] boundTex = new int[2];
|
static int[] boundTexI = new int[2];
|
||||||
|
static TextureGL[] boundTex = new TextureGL[2];
|
||||||
static int tex0Serial = 0;
|
static int tex0Serial = 0;
|
||||||
static float tex0X = 0;
|
static float tex0X = 0;
|
||||||
static float tex0Y = 0;
|
static float tex0Y = 0;
|
||||||
|
@ -772,11 +773,26 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void glBindTexture(int p1, int p2) {
|
public static final void glBindTexture(int p1, int p2) {
|
||||||
if(boundTex[selectedTex] != p2) {
|
if(boundTexI[selectedTex] != p2) {
|
||||||
TextureGL t = texObjects.get(p2);
|
TextureGL t = texObjects.get(p2);
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, t);
|
if(boundTex[selectedTex] != t) {
|
||||||
|
_wglBindTexture(_wGL_TEXTURE_2D, t);
|
||||||
|
if (selectedTex == 0) {
|
||||||
|
boundTexture0 = t;
|
||||||
|
updateAnisotropicPatch();
|
||||||
|
}
|
||||||
|
boundTex[selectedTex] = t;
|
||||||
|
}
|
||||||
|
boundTexI[selectedTex] = p2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final void glBindTexture(int p1, TextureGL p2) {
|
||||||
|
boundTexI[selectedTex] = -1;
|
||||||
|
if(boundTex[selectedTex] != p2) {
|
||||||
|
_wglBindTexture(_wGL_TEXTURE_2D, p2);
|
||||||
if (selectedTex == 0) {
|
if (selectedTex == 0) {
|
||||||
boundTexture0 = t;
|
boundTexture0 = p2;
|
||||||
updateAnisotropicPatch();
|
updateAnisotropicPatch();
|
||||||
}
|
}
|
||||||
boundTex[selectedTex] = p2;
|
boundTex[selectedTex] = p2;
|
||||||
|
@ -1443,12 +1459,16 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
||||||
public static final void glActiveTexture(int p1) {
|
public static final void glActiveTexture(int p1) {
|
||||||
switch (p1) {
|
switch (p1) {
|
||||||
case GL_TEXTURE0:
|
case GL_TEXTURE0:
|
||||||
selectedTex = 0;
|
if(selectedTex != 0) {
|
||||||
_wglActiveTexture(_wGL_TEXTURE0);
|
selectedTex = 0;
|
||||||
|
_wglActiveTexture(_wGL_TEXTURE0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE1:
|
case GL_TEXTURE1:
|
||||||
selectedTex = 1;
|
if(selectedTex != 1) {
|
||||||
_wglActiveTexture(_wGL_TEXTURE1);
|
selectedTex = 1;
|
||||||
|
_wglActiveTexture(_wGL_TEXTURE1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.err.println("only two texture units implemented");
|
System.err.println("only two texture units implemented");
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class EffectPipeline {
|
||||||
noiseCounter = _wglGetUniformLocation(noiseProgram, "counter");
|
noiseCounter = _wglGetUniformLocation(noiseProgram, "counter");
|
||||||
|
|
||||||
noiseSourceTexture = _wglGenTextures();
|
noiseSourceTexture = _wglGenTextures();
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, noiseSourceTexture);
|
glBindTexture(_wGL_TEXTURE_2D, noiseSourceTexture);
|
||||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
|
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
|
||||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
|
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
|
||||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_REPEAT);
|
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_REPEAT);
|
||||||
|
@ -106,7 +106,7 @@ public class EffectPipeline {
|
||||||
noiseGenFramebuffer = _wglCreateFramebuffer();
|
noiseGenFramebuffer = _wglCreateFramebuffer();
|
||||||
noiseGenTexture = _wglGenTextures();
|
noiseGenTexture = _wglGenTextures();
|
||||||
|
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, noiseGenTexture);
|
glBindTexture(_wGL_TEXTURE_2D, noiseGenTexture);
|
||||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_LINEAR);
|
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_LINEAR);
|
||||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_LINEAR);
|
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_LINEAR);
|
||||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_REPEAT);
|
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_REPEAT);
|
||||||
|
@ -137,7 +137,7 @@ public class EffectPipeline {
|
||||||
|
|
||||||
_wglBindVertexArray0(renderQuadArray);
|
_wglBindVertexArray0(renderQuadArray);
|
||||||
glActiveTexture(_wGL_TEXTURE0);
|
glActiveTexture(_wGL_TEXTURE0);
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, noiseSourceTexture);
|
glBindTexture(_wGL_TEXTURE_2D, noiseSourceTexture);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
@ -162,10 +162,8 @@ public class EffectPipeline {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// three guesses to figure out what this does
|
|
||||||
|
|
||||||
glActiveTexture(_wGL_TEXTURE0);
|
glActiveTexture(_wGL_TEXTURE0);
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, noiseGenTexture);
|
glBindTexture(_wGL_TEXTURE_2D, noiseGenTexture);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class EffectPipelineFXAA {
|
||||||
framebuffer = _wglCreateFramebuffer();
|
framebuffer = _wglCreateFramebuffer();
|
||||||
fxaaSourceTexture = _wglGenTextures();
|
fxaaSourceTexture = _wglGenTextures();
|
||||||
|
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture);
|
glBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture);
|
||||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
|
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
|
||||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
|
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
|
||||||
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP);
|
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP);
|
||||||
|
@ -173,7 +173,7 @@ public class EffectPipelineFXAA {
|
||||||
if(isUsingFXAA == false) {
|
if(isUsingFXAA == false) {
|
||||||
initFXAA();
|
initFXAA();
|
||||||
}else {
|
}else {
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture);
|
glBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture);
|
||||||
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB8, width, height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, (ByteBuffer)null);
|
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB8, width, height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, (ByteBuffer)null);
|
||||||
_wglBindRenderbuffer(framebuffer_depth);
|
_wglBindRenderbuffer(framebuffer_depth);
|
||||||
_wglRenderbufferStorage(_wGL_DEPTH_COMPONENT32F, width, height);
|
_wglRenderbufferStorage(_wGL_DEPTH_COMPONENT32F, width, height);
|
||||||
|
@ -205,17 +205,17 @@ public class EffectPipelineFXAA {
|
||||||
_wglClear(_wGL_COLOR_BUFFER_BIT | _wGL_DEPTH_BUFFER_BIT);
|
_wglClear(_wGL_COLOR_BUFFER_BIT | _wGL_DEPTH_BUFFER_BIT);
|
||||||
if(state == 1) {
|
if(state == 1) {
|
||||||
_wglViewport(originalViewport[0], originalViewport[1], originalViewport[2], originalViewport[3]);
|
_wglViewport(originalViewport[0], originalViewport[1], originalViewport[2], originalViewport[3]);
|
||||||
_wglActiveTexture(_wGL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture);
|
glBindTexture(_wGL_TEXTURE_2D, fxaaSourceTexture);
|
||||||
_wglDisable(_wGL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
_wglDisable(_wGL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
_wglDepthMask(false);
|
glDepthMask(false);
|
||||||
_wglUseProgram(fxaaProgram);
|
_wglUseProgram(fxaaProgram);
|
||||||
_wglUniform2f(fxaaScreenSize, 1.0f / width, 1.0f / height);
|
_wglUniform2f(fxaaScreenSize, 1.0f / width, 1.0f / height);
|
||||||
_wglBindVertexArray0(renderQuadArray);
|
_wglBindVertexArray0(renderQuadArray);
|
||||||
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
|
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
|
||||||
_wglEnable(_wGL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
_wglDepthMask(true);
|
glDepthMask(true);
|
||||||
}else if(state == 2 || state == 3) {
|
}else if(state == 2 || state == 3) {
|
||||||
if(!EaglerAdapter.isWebGL) {
|
if(!EaglerAdapter.isWebGL) {
|
||||||
_wglDisable(_wGL_MULTISAMPLE);
|
_wglDisable(_wGL_MULTISAMPLE);
|
||||||
|
|
|
@ -313,7 +313,7 @@ public class FixedFunctionShader {
|
||||||
u_texCoordV1 = _wglGetUniformLocation(globject, "texCoordV1");
|
u_texCoordV1 = _wglGetUniformLocation(globject, "texCoordV1");
|
||||||
|
|
||||||
streamBuffer = new StreamBuffer(0x8000, 3, 8, (vertexArray, vertexBuffer) -> {
|
streamBuffer = new StreamBuffer(0x8000, 3, 8, (vertexArray, vertexBuffer) -> {
|
||||||
_wglBindVertexArray(vertexArray);
|
_wglBindVertexArray0(vertexArray);
|
||||||
_wglBindBuffer(_wGL_ARRAY_BUFFER, vertexBuffer);
|
_wglBindBuffer(_wGL_ARRAY_BUFFER, vertexBuffer);
|
||||||
setupArrayForProgram();
|
setupArrayForProgram();
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class GameOverlayFramebuffer {
|
||||||
depthBuffer = _wglCreateRenderBuffer();
|
depthBuffer = _wglCreateRenderBuffer();
|
||||||
framebufferColor = _wglGenTextures();
|
framebufferColor = _wglGenTextures();
|
||||||
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer);
|
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer);
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, framebufferColor);
|
glBindTexture(_wGL_TEXTURE_2D, framebufferColor);
|
||||||
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
_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_MIN_FILTER, GL_NEAREST);
|
||||||
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||||
|
@ -34,7 +34,7 @@ public class GameOverlayFramebuffer {
|
||||||
if(currentWidth != width || currentHeight != height) {
|
if(currentWidth != width || currentHeight != height) {
|
||||||
currentWidth = width;
|
currentWidth = width;
|
||||||
currentHeight = height;
|
currentHeight = height;
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, framebufferColor);
|
glBindTexture(_wGL_TEXTURE_2D, framebufferColor);
|
||||||
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGBA8, width, height, 0, _wGL_RGBA, _wGL_UNSIGNED_BYTE, (ByteBuffer)null);
|
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGBA8, width, height, 0, _wGL_RGBA, _wGL_UNSIGNED_BYTE, (ByteBuffer)null);
|
||||||
_wglBindRenderbuffer(depthBuffer);
|
_wglBindRenderbuffer(depthBuffer);
|
||||||
_wglRenderbufferStorage(0x81A5, width, height);
|
_wglRenderbufferStorage(0x81A5, width, height);
|
||||||
|
@ -53,7 +53,7 @@ public class GameOverlayFramebuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindTexture() {
|
public void bindTexture() {
|
||||||
_wglBindTexture(_wGL_TEXTURE_2D, framebufferColor);
|
glBindTexture(_wGL_TEXTURE_2D, framebufferColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package net.lax1dude.eaglercraft.glemu;
|
package net.lax1dude.eaglercraft.glemu;
|
||||||
|
|
||||||
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.*;
|
import static net.lax1dude.eaglercraft.EaglerAdapter.*;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
|
@ -88,7 +88,7 @@ public class HighPolyMesh {
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferArrayGL vertexArray = _wglCreateVertexArray();
|
BufferArrayGL vertexArray = _wglCreateVertexArray();
|
||||||
_wglBindVertexArray(vertexArray);
|
_wglBindVertexArray0(vertexArray);
|
||||||
|
|
||||||
up1.position(0).limit(intsOfVertex);
|
up1.position(0).limit(intsOfVertex);
|
||||||
|
|
||||||
|
|
|
@ -106,15 +106,6 @@ public class GuiIngameMenu extends GuiScreen {
|
||||||
this.drawCenteredString(this.fontRenderer, "Game menu", this.width / 2, 40, 16777215);
|
this.drawCenteredString(this.fontRenderer, "Game menu", this.width / 2, 40, 16777215);
|
||||||
super.drawScreen(par1, par2, par3);
|
super.drawScreen(par1, par2, par3);
|
||||||
StringTranslate var1 = StringTranslate.getInstance();
|
StringTranslate var1 = StringTranslate.getInstance();
|
||||||
if(par1 >= 3 && par1 < 123 && par2 >= 3 && par2 < 23) {
|
|
||||||
int c = 0xCCCC66;
|
|
||||||
EaglerAdapter.glPushMatrix();
|
|
||||||
EaglerAdapter.glTranslatef(126.0f, 6.0f, 0.0f);
|
|
||||||
EaglerAdapter.glScalef(0.8f, 0.8f, 0.8f);
|
|
||||||
this.drawString(fontRenderer, var1.translateKey("menu.skinCapeSettingsNote0"), 0, 0, c);
|
|
||||||
this.drawString(fontRenderer, var1.translateKey("menu.skinCapeSettingsNote1"), 0, 9, c);
|
|
||||||
EaglerAdapter.glPopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
drawString(fontRenderer, "Eaglercraft: " + ConfigConstants.version, 6, 27, 0x999999);
|
drawString(fontRenderer, "Eaglercraft: " + ConfigConstants.version, 6, 27, 0x999999);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue