mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-20 05:20:24 -07:00
Replace GLU mipmapping with GL_GENERATE_MIPMAP (GL 1.4)
This commit is contained in:
parent
e79d5ddee8
commit
87f04ac0e0
9 changed files with 63 additions and 58 deletions
|
|
@ -36,7 +36,7 @@ public final class Class165 {
|
|||
@Pc(12) int[] local12 = new int[1];
|
||||
local9.glGenTextures(1, local12, 0);
|
||||
this.anInt5901 = local12[0];
|
||||
Static63.anInt1942 += 16384;
|
||||
Static63.onCardTexture += 16384;
|
||||
GlRenderer.setTextureId(this.anInt5901);
|
||||
local9.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
|
||||
local9.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import java.nio.charset.StandardCharsets;
|
|||
import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration;
|
||||
import com.jogamp.nativewindow.awt.JAWTWindow;
|
||||
import com.jogamp.opengl.*;
|
||||
import com.jogamp.opengl.glu.gl2es1.GLUgl2es1;
|
||||
import jogamp.newt.awt.NewtFactoryAWT;
|
||||
import org.openrs2.deob.annotation.OriginalArg;
|
||||
import org.openrs2.deob.annotation.OriginalMember;
|
||||
|
|
@ -694,7 +693,6 @@ public final class GlRenderer {
|
|||
}
|
||||
gl = GLContext.getCurrentGL().getGL2();
|
||||
gl.glLineWidth((float) GameShell.canvasScale);
|
||||
new GLUgl2es1();
|
||||
enabled = true;
|
||||
canvasWidth = canvas.getSize().width;
|
||||
canvasHeight = canvas.getSize().height;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public final class GlSolidColorTexture extends SecondaryNode {
|
|||
local9.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGBA, 1, 1, 0, GL2.GL_RGBA, GL2.GL_UNSIGNED_BYTE, local61);
|
||||
local9.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
|
||||
local9.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
Static63.anInt1942 += local61.limit() - this.anInt5065;
|
||||
Static63.onCardTexture += local61.limit() - this.anInt5065;
|
||||
this.anInt5065 = local61.limit();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import java.nio.ByteBuffer;
|
||||
import com.jogamp.opengl.*;
|
||||
import com.jogamp.opengl.glu.gl2es1.GLUgl2es1;
|
||||
import org.openrs2.deob.annotation.OriginalArg;
|
||||
import org.openrs2.deob.annotation.OriginalClass;
|
||||
import org.openrs2.deob.annotation.OriginalMember;
|
||||
|
|
@ -19,13 +18,13 @@ public final class GlTexture extends SecondaryNode {
|
|||
private int[] anIntArray481;
|
||||
|
||||
@OriginalMember(owner = "client!uh", name = "bb", descriptor = "I")
|
||||
private int anInt5493 = -1;
|
||||
private int textureId = -1;
|
||||
|
||||
@OriginalMember(owner = "client!uh", name = "eb", descriptor = "Z")
|
||||
public boolean aBoolean287 = false;
|
||||
|
||||
@OriginalMember(owner = "client!uh", name = "db", descriptor = "I")
|
||||
private int anInt5495 = 0;
|
||||
private int textureSize = 0;
|
||||
|
||||
@OriginalMember(owner = "client!uh", name = "W", descriptor = "Lclient!lc;")
|
||||
private final Texture aClass88_1;
|
||||
|
|
@ -172,49 +171,57 @@ public final class GlTexture extends SecondaryNode {
|
|||
if (!this.aClass88_1.method2729(arg1, arg0)) {
|
||||
return false;
|
||||
}
|
||||
@Pc(22) GL2 local22 = GlRenderer.gl;
|
||||
@Pc(28) int local28 = arg2 ? 64 : 128;
|
||||
@Pc(22) GL2 gl = GlRenderer.gl;
|
||||
@Pc(28) int size = arg2 ? 64 : 128;
|
||||
@Pc(31) int local31 = Static56.method1314();
|
||||
if ((local31 & 0x1) == 0) {
|
||||
if (this.anInt5493 == -1) {
|
||||
@Pc(53) int[] local53 = new int[1];
|
||||
local22.glGenTextures(1, local53, 0);
|
||||
if (this.textureId == -1) {
|
||||
@Pc(53) int[] temp = new int[1];
|
||||
gl.glGenTextures(1, temp, 0);
|
||||
this.anInt5492 = Static63.contextId;
|
||||
this.anInt5493 = local53[0];
|
||||
GlRenderer.setTextureId(this.anInt5493);
|
||||
@Pc(82) ByteBuffer local82 = ByteBuffer.wrap(this.aClass88_1.method2728(local28, local28, this.aBoolean288, arg1, 0.7D, arg0));
|
||||
this.textureId = temp[0];
|
||||
GlRenderer.setTextureId(this.textureId);
|
||||
@Pc(82) ByteBuffer pixels = ByteBuffer.wrap(this.aClass88_1.method2728(size, size, this.aBoolean288, arg1, 0.7D, arg0));
|
||||
if (this.anInt5489 == 2) {
|
||||
@Pc(201) GLUgl2es1 local201 = new GLUgl2es1();
|
||||
local201.gluBuild2DMipmaps(3553, 6408, local28, local28, 6408, 5121, local82);
|
||||
local22.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR_MIPMAP_LINEAR);
|
||||
local22.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
Static63.anInt1942 += local82.limit() * 4 / 3 - this.anInt5495;
|
||||
this.anInt5495 = local82.limit() * 4 / 3;
|
||||
// GLU code:
|
||||
// @Pc(201) GLUgl2es1 local201 = new GLUgl2es1();
|
||||
// local201.gluBuild2DMipmaps(3553, 6408, size, size, 6408, 5121, pixels);
|
||||
// gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR_MIPMAP_LINEAR);
|
||||
// gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
// New code (OpenGL 1.4):
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_REPEAT);
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_REPEAT);
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR_MIPMAP_LINEAR);
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_GENERATE_MIPMAP, GL2.GL_TRUE);
|
||||
gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGBA8, size, size, 0, GL2.GL_RGBA, GL2.GL_UNSIGNED_BYTE, pixels);
|
||||
Static63.onCardTexture += pixels.limit() * 4 / 3 - this.textureSize;
|
||||
this.textureSize = pixels.limit() * 4 / 3;
|
||||
} else if (this.anInt5489 == 1) {
|
||||
@Pc(129) int local129 = 0;
|
||||
while (true) {
|
||||
local22.glTexImage2D(GL2.GL_TEXTURE_2D, local129++, GL2.GL_RGBA, local28, local28, 0, GL2.GL_RGBA, GL2.GL_UNSIGNED_BYTE, local82);
|
||||
local28 >>= 0x1;
|
||||
if (local28 == 0) {
|
||||
local22.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR_MIPMAP_LINEAR);
|
||||
local22.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
Static63.anInt1942 += local82.limit() * 4 / 3 - this.anInt5495;
|
||||
this.anInt5495 = local82.limit() * 4 / 3;
|
||||
gl.glTexImage2D(GL2.GL_TEXTURE_2D, local129++, GL2.GL_RGBA, size, size, 0, GL2.GL_RGBA, GL2.GL_UNSIGNED_BYTE, pixels);
|
||||
size >>= 0x1;
|
||||
if (size == 0) {
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR_MIPMAP_LINEAR);
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
Static63.onCardTexture += pixels.limit() * 4 / 3 - this.textureSize;
|
||||
this.textureSize = pixels.limit() * 4 / 3;
|
||||
break;
|
||||
}
|
||||
local82 = ByteBuffer.wrap(this.aClass88_1.method2728(local28, local28, this.aBoolean288, arg1, 0.7D, arg0));
|
||||
pixels = ByteBuffer.wrap(this.aClass88_1.method2728(size, size, this.aBoolean288, arg1, 0.7D, arg0));
|
||||
}
|
||||
} else {
|
||||
local22.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGBA, local28, local28, 0, GL2.GL_RGBA, GL2.GL_UNSIGNED_BYTE, local82);
|
||||
local22.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
|
||||
local22.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
Static63.anInt1942 += local82.limit() - this.anInt5495;
|
||||
this.anInt5495 = local82.limit();
|
||||
gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGBA, size, size, 0, GL2.GL_RGBA, GL2.GL_UNSIGNED_BYTE, pixels);
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
Static63.onCardTexture += pixels.limit() - this.textureSize;
|
||||
this.textureSize = pixels.limit();
|
||||
}
|
||||
local22.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, this.aBoolean285 ? GL2.GL_REPEAT : GL2.GL_CLAMP_TO_EDGE);
|
||||
local22.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, this.aBoolean284 ? GL2.GL_REPEAT : GL2.GL_CLAMP_TO_EDGE);
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, this.aBoolean285 ? GL2.GL_REPEAT : GL2.GL_CLAMP_TO_EDGE);
|
||||
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, this.aBoolean284 ? GL2.GL_REPEAT : GL2.GL_CLAMP_TO_EDGE);
|
||||
} else {
|
||||
GlRenderer.setTextureId(this.anInt5493);
|
||||
GlRenderer.setTextureId(this.textureId);
|
||||
}
|
||||
}
|
||||
if ((local31 & 0x2) == 0) {
|
||||
|
|
@ -227,8 +234,8 @@ public final class GlTexture extends SecondaryNode {
|
|||
if (this.anInt5497 == 0 && this.anInt5485 == 0) {
|
||||
GlRenderer.resetTextureMatrix();
|
||||
} else {
|
||||
@Pc(303) float local303 = (float) (this.anInt5497 * GlRenderer.anInt5323) / (float) local28;
|
||||
@Pc(312) float local312 = (float) (this.anInt5485 * GlRenderer.anInt5323) / (float) local28;
|
||||
@Pc(303) float local303 = (float) (this.anInt5497 * GlRenderer.anInt5323) / (float) size;
|
||||
@Pc(312) float local312 = (float) (this.anInt5485 * GlRenderer.anInt5323) / (float) size;
|
||||
GlRenderer.translateTextureMatrix(local312, local303, 0.0F);
|
||||
}
|
||||
}
|
||||
|
|
@ -280,10 +287,10 @@ public final class GlTexture extends SecondaryNode {
|
|||
@OriginalMember(owner = "client!uh", name = "finalize", descriptor = "()V")
|
||||
@Override
|
||||
public final void finalize() throws Throwable {
|
||||
if (this.anInt5493 != -1) {
|
||||
Static63.method1485(this.anInt5493, this.anInt5495, this.anInt5492);
|
||||
this.anInt5495 = 0;
|
||||
this.anInt5493 = -1;
|
||||
if (this.textureId != -1) {
|
||||
Static63.method1485(this.textureId, this.textureSize, this.anInt5492);
|
||||
this.textureSize = 0;
|
||||
this.textureId = -1;
|
||||
}
|
||||
super.finalize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ public final class SpecularMaterialRenderer implements MaterialRenderer {
|
|||
local1.glTexImage2D(local27 + GL2.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL2.GL_ALPHA, 64, 64, 0, GL2.GL_ALPHA, GL2.GL_UNSIGNED_BYTE, ByteBuffer.wrap(local25));
|
||||
local1.glBindTexture(GL2.GL_TEXTURE_CUBE_MAP, this.anIntArray519[2]);
|
||||
local1.glTexImage2D(local27 + GL2.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL2.GL_ALPHA, 64, 64, 0, GL2.GL_ALPHA, GL2.GL_UNSIGNED_BYTE, ByteBuffer.wrap(local19));
|
||||
Static63.anInt1942 += 12288;
|
||||
Static63.onCardTexture += 12288;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ public final class Static127 {
|
|||
if (GlRenderer.enabled && arg0.method3111(Static201.aClass100_406)) {
|
||||
System.out.println("oncard_geometry:" + Static63.anInt1945);
|
||||
System.out.println("oncard_2d:" + Static63.onCard2d);
|
||||
System.out.println("oncard_texture:" + Static63.anInt1942);
|
||||
System.out.println("oncard_texture:" + Static63.onCardTexture);
|
||||
}
|
||||
if (arg0.method3111(Static257.aClass100_99)) {
|
||||
Static175.method3279();
|
||||
|
|
|
|||
|
|
@ -57,26 +57,26 @@ public final class Static151 {
|
|||
local11 = new int[] { anInt3587 };
|
||||
local4.glDeleteTextures(1, local11, 0);
|
||||
anInt3587 = -1;
|
||||
Static63.anInt1942 -= aByteBuffer7.limit() * 2;
|
||||
Static63.onCardTexture -= aByteBuffer7.limit() * 2;
|
||||
}
|
||||
if (anIntArray341 != null) {
|
||||
local4 = GlRenderer.gl;
|
||||
local4.glDeleteTextures(64, anIntArray341, 0);
|
||||
anIntArray341 = null;
|
||||
Static63.anInt1942 -= aByteBuffer7.limit() * 2;
|
||||
Static63.onCardTexture -= aByteBuffer7.limit() * 2;
|
||||
}
|
||||
if (anInt3588 != -1) {
|
||||
local4 = GlRenderer.gl;
|
||||
local11 = new int[] { anInt3588 };
|
||||
local4.glDeleteTextures(1, local11, 0);
|
||||
anInt3588 = -1;
|
||||
Static63.anInt1942 -= aByteBuffer6.limit() * 2;
|
||||
Static63.onCardTexture -= aByteBuffer6.limit() * 2;
|
||||
}
|
||||
if (anIntArray340 != null) {
|
||||
local4 = GlRenderer.gl;
|
||||
local4.glDeleteTextures(64, anIntArray340, 0);
|
||||
anIntArray340 = null;
|
||||
Static63.anInt1942 -= aByteBuffer6.limit() * 2;
|
||||
Static63.onCardTexture -= aByteBuffer6.limit() * 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ public final class Static151 {
|
|||
local1.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
|
||||
local1.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
anInt3587 = local6[0];
|
||||
Static63.anInt1942 += aByteBuffer7.limit() * 2;
|
||||
Static63.onCardTexture += aByteBuffer7.limit() * 2;
|
||||
return;
|
||||
}
|
||||
anIntArray341 = new int[64];
|
||||
|
|
@ -112,7 +112,7 @@ public final class Static151 {
|
|||
local1.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
|
||||
local1.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
}
|
||||
Static63.anInt1942 += aByteBuffer7.limit() * 2;
|
||||
Static63.onCardTexture += aByteBuffer7.limit() * 2;
|
||||
}
|
||||
|
||||
@OriginalMember(owner = "client!lm", name = "f", descriptor = "()V")
|
||||
|
|
@ -127,7 +127,7 @@ public final class Static151 {
|
|||
local1.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
|
||||
local1.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
anInt3588 = local6[0];
|
||||
Static63.anInt1942 += aByteBuffer6.limit() * 2;
|
||||
Static63.onCardTexture += aByteBuffer6.limit() * 2;
|
||||
return;
|
||||
}
|
||||
anIntArray340 = new int[64];
|
||||
|
|
@ -139,6 +139,6 @@ public final class Static151 {
|
|||
local1.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
|
||||
local1.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
|
||||
}
|
||||
Static63.anInt1942 += aByteBuffer6.limit() * 2;
|
||||
Static63.onCardTexture += aByteBuffer6.limit() * 2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import org.openrs2.deob.annotation.Pc;
|
|||
public final class Static63 {
|
||||
|
||||
@OriginalMember(owner = "client!fa", name = "a", descriptor = "I")
|
||||
public static int anInt1942 = 0;
|
||||
public static int onCardTexture = 0;
|
||||
|
||||
@OriginalMember(owner = "client!fa", name = "b", descriptor = "Lclient!ih;")
|
||||
private static final LinkedList aClass69_48 = new LinkedList();
|
||||
|
|
@ -62,7 +62,7 @@ public final class Static63 {
|
|||
aClass69_51.method2278();
|
||||
anInt1945 = 0;
|
||||
onCard2d = 0;
|
||||
anInt1942 = 0;
|
||||
onCardTexture = 0;
|
||||
}
|
||||
|
||||
@OriginalMember(owner = "client!fa", name = "b", descriptor = "(III)V")
|
||||
|
|
@ -97,7 +97,7 @@ public final class Static63 {
|
|||
while (true) {
|
||||
local8 = (IntNode) aClass69_51.method2287();
|
||||
if (local8 == null) {
|
||||
if (anInt1945 + onCard2d + anInt1942 > 100663296 && MonotonicClock.currentTimeMillis() > aLong71 + 60000L) {
|
||||
if (anInt1945 + onCard2d + onCardTexture > 100663296 && MonotonicClock.currentTimeMillis() > aLong71 + 60000L) {
|
||||
System.gc();
|
||||
aLong71 = MonotonicClock.currentTimeMillis();
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ public final class Static63 {
|
|||
}
|
||||
}
|
||||
anIntArray151[local3++] = (int) local8.aLong192;
|
||||
anInt1942 -= local8.anInt3141;
|
||||
onCardTexture -= local8.anInt3141;
|
||||
if (local3 == 1000) {
|
||||
local1.glDeleteTextures(local3, anIntArray151, 0);
|
||||
local3 = 0;
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ public final class Static87 {
|
|||
local276 += 15;
|
||||
if (GlRenderer.enabled) {
|
||||
local514 = 16776960;
|
||||
local518 = (Static63.anInt1942 + Static63.anInt1945 + Static63.onCard2d) / 1024;
|
||||
local518 = (Static63.onCardTexture + Static63.anInt1945 + Static63.onCard2d) / 1024;
|
||||
if (local518 > 65536) {
|
||||
local514 = 16711680;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue