reformatted some classes

This commit is contained in:
LAX1DUDE 2022-08-03 23:06:34 -07:00
parent efcf5f8e77
commit 1e6b8170b5
13 changed files with 366 additions and 476 deletions

View File

@ -18,30 +18,7 @@ import org.teavm.jso.JSObject;
import org.teavm.jso.typedarrays.ArrayBuffer; import org.teavm.jso.typedarrays.ArrayBuffer;
import org.teavm.jso.typedarrays.Uint8Array; import org.teavm.jso.typedarrays.Uint8Array;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket00StartServer; import net.lax1dude.eaglercraft.sp.ipc.*;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket01StopServer;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket02InitWorld;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket03DeleteWorld;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket04RenameWorld;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket05RequestData;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket06RenameWorldNBT;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket07ImportWorld;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket09RequestResponse;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0ASetWorldDifficulty;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0BPause;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0CPlayerChannel;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0DProgressUpdate;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0EListWorlds;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket0FListFiles;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket10FileRead;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket12FileWrite;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket13FileCopyMove;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket14StringList;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket15ThrowException;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacket16NBTList;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacketBase;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacketFFProcessKeepAlive;
import net.lax1dude.eaglercraft.sp.ipc.IPCPacketManager;
import net.minecraft.src.AchievementList; import net.minecraft.src.AchievementList;
import net.minecraft.src.AchievementMap; import net.minecraft.src.AchievementMap;
import net.minecraft.src.ChunkCoordIntPair; import net.minecraft.src.ChunkCoordIntPair;

View File

@ -6,8 +6,6 @@ import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import net.lax1dude.eaglercraft.sp.ipc.IPCInputStream;
import net.lax1dude.eaglercraft.sp.ipc.IPCOutputStream;
import net.minecraft.src.INetworkManager; import net.minecraft.src.INetworkManager;
import net.minecraft.src.NetHandler; import net.minecraft.src.NetHandler;
import net.minecraft.src.Packet; import net.minecraft.src.Packet;

View File

@ -238,9 +238,12 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
} }
public static void glClearStack() { public static void glClearStack() {
matModelV[0].load(matModelV[matModelPointer]); matModelPointer = 0; matModelV[0].load(matModelV[matModelPointer]);
matProjV[0].load(matProjV[matProjPointer]); matProjPointer = 0; matModelPointer = 0;
matTexV[0].load(matTexV[matTexPointer]); matTexPointer = 0; matProjV[0].load(matProjV[matProjPointer]);
matProjPointer = 0;
matTexV[0].load(matTexV[matTexPointer]);
matTexPointer = 0;
} }
private static BufferGL quadsToTrianglesBuffer = null; private static BufferGL quadsToTrianglesBuffer = null;
@ -252,6 +255,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
private BufferGL glbuffer; private BufferGL glbuffer;
private int shaderMode; private int shaderMode;
private int listLength; private int listLength;
private DisplayList(int id) { private DisplayList(int id) {
this.id = id; this.id = id;
this.glarray = null; this.glarray = null;
@ -317,31 +321,44 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
public static final void glShadeModel(int p1) { public static final void glShadeModel(int p1) {
} }
public static final void glClearDepth(float p1) { public static final void glClearDepth(float p1) {
_wglClearDepth(-p1); _wglClearDepth(-p1);
} }
public static final void glDepthFunc(int p1) { public static final void glDepthFunc(int p1) {
int f = _wGL_GEQUAL; int f = _wGL_GEQUAL;
switch (p1) { switch (p1) {
case GL_GREATER: f = _wGL_LESS; break; case GL_GREATER:
case GL_LEQUAL: f = _wGL_GEQUAL; break; f = _wGL_LESS;
case GL_EQUAL: f = _wGL_EQUAL; break;
default: break; case GL_LEQUAL:
f = _wGL_GEQUAL;
break;
case GL_EQUAL:
f = _wGL_EQUAL;
default:
break;
} }
_wglDepthFunc(f); _wglDepthFunc(f);
} }
public static final void glAlphaFunc(int p1, float p2) { public static final void glAlphaFunc(int p1, float p2) {
alphaThresh = p2; alphaThresh = p2;
} }
public static final void glCullFace(int p1) { public static final void glCullFace(int p1) {
_wglCullFace(p1); _wglCullFace(p1);
} }
public static final void glMatrixMode(int p1) { public static final void glMatrixMode(int p1) {
matrixMode = p1; matrixMode = p1;
} }
private static final Matrix4f getMatrix() { private static final Matrix4f getMatrix() {
switch (matrixMode) { switch (matrixMode) {
case GL_MODELVIEW: case GL_MODELVIEW:
@ -353,15 +370,19 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
return matTexV[matTexPointer]; return matTexV[matTexPointer];
} }
} }
public static final void glLoadIdentity() { public static final void glLoadIdentity() {
getMatrix().setIdentity(); getMatrix().setIdentity();
} }
public static final void glViewport(int p1, int p2, int p3, int p4) { public static final void glViewport(int p1, int p2, int p3, int p4) {
_wglViewport(p1, p2, p3, p4); _wglViewport(p1, p2, p3, p4);
} }
public static final void glClear(int p1) { public static final void glClear(int p1) {
_wglClear(p1); _wglClear(p1);
} }
public static final void glOrtho(float left, float right, float bottom, float top, float zNear, float zFar) { public static final void glOrtho(float left, float right, float bottom, float top, float zNear, float zFar) {
Matrix4f res = getMatrix(); Matrix4f res = getMatrix();
res.m00 = 2.0f / (right - left); res.m00 = 2.0f / (right - left);
@ -381,7 +402,9 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
res.m32 = (zFar + zNear) / (zFar - zNear); res.m32 = (zFar + zNear) / (zFar - zNear);
res.m33 = 1.0f; res.m33 = 1.0f;
} }
private static final Vector3f deevis = new Vector3f(); private static final Vector3f deevis = new Vector3f();
public static final void glTranslatef(float p1, float p2, float p3) { public static final void glTranslatef(float p1, float p2, float p3) {
deevis.set(p1, p2, p3); deevis.set(p1, p2, p3);
getMatrix().translate(deevis); getMatrix().translate(deevis);
@ -389,9 +412,11 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
System.err.println("matrix is not supported while recording display list use tessellator class instead"); System.err.println("matrix is not supported while recording display list use tessellator class instead");
} }
} }
public static final void glClearColor(float p1, float p2, float p3, float p4) { public static final void glClearColor(float p1, float p2, float p3, float p4) {
_wglClearColor(p1, p2, p3, p4); _wglClearColor(p1, p2, p3, p4);
} }
public static final void glDisable(int p1) { public static final void glDisable(int p1) {
switch (p1) { switch (p1) {
case GL_DEPTH_TEST: case GL_DEPTH_TEST:
@ -441,48 +466,62 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
public static final void glColor4f(float p1, float p2, float p3, float p4) { public static final void glColor4f(float p1, float p2, float p3, float p4) {
colorR = p1; colorR = p1;
colorG = p2; colorG = p2;
colorB = p3; colorB = p3;
colorA = p4; colorA = p4;
} }
public static final int glGetError() { public static final int glGetError() {
int err = _wglGetError(); int err = _wglGetError();
if(err == _wGL_CONTEXT_LOST_WEBGL) return GL_CONTEXT_LOST_WEBGL; if (err == _wGL_CONTEXT_LOST_WEBGL)
return GL_CONTEXT_LOST_WEBGL;
return err; return err;
} }
public static final void glFlush() { public static final void glFlush() {
EaglerAdapter._wglFlush(); EaglerAdapter._wglFlush();
} }
public static final void glLineWidth(float p1) { public static final void glLineWidth(float p1) {
} }
public static final void glTexImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, ByteBuffer p9) {
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) { if (p2 == 0 && selectedTex == 0 && boundTexture0 != null) {
boundTexture0.w = p4; boundTexture0.w = p4;
boundTexture0.h = p5; boundTexture0.h = p5;
} }
_wglTexImage2D(_wGL_TEXTURE_2D, p2, _wGL_RGBA8, p4, p5, p6, _wGL_RGBA, _wGL_UNSIGNED_BYTE, p9); _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) { public static final void glLight(int p1, int p2, FloatBuffer p3) {
} }
public static final void glLightModel(int p1, FloatBuffer p2) { public static final void glLightModel(int p1, FloatBuffer p2) {
} }
private static Vector4f lightPos0vec0 = new Vector4f(); private static Vector4f lightPos0vec0 = new Vector4f();
private static Vector4f lightPos1vec0 = new Vector4f(); private static Vector4f lightPos1vec0 = new Vector4f();
private static Vector4f lightPos0vec = new Vector4f(); private static Vector4f lightPos0vec = new Vector4f();
private static Vector4f lightPos1vec = new Vector4f(); private static Vector4f lightPos1vec = new Vector4f();
public static final void copyModelToLightMatrix() { public static final void copyModelToLightMatrix() {
lightPos0vec0.set(lightPos0vec); lightPos0vec0.set(lightPos0vec);
lightPos1vec0.set(lightPos1vec); lightPos1vec0.set(lightPos1vec);
lightPos0vec.set(0.2f, 1.0f, -0.7f, 0.0f); lightPos0vec.normalise(); lightPos0vec.set(0.2f, 1.0f, -0.7f, 0.0f);
lightPos1vec.set(-0.2f, 1.0f, 0.7f, 0.0f); lightPos1vec.normalise(); 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], lightPos0vec, lightPos0vec).normalise();
Matrix4f.transform(matModelV[matModelPointer], lightPos1vec, lightPos1vec).normalise(); Matrix4f.transform(matModelV[matModelPointer], lightPos1vec, lightPos1vec).normalise();
} }
public static final void flipLightMatrix() { public static final void flipLightMatrix() {
lightPos0vec.x = -lightPos0vec.x; lightPos0vec.x = -lightPos0vec.x;
lightPos1vec.x = -lightPos1vec.x; lightPos1vec.x = -lightPos1vec.x;
@ -491,10 +530,12 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
lightPos0vec.z = -lightPos0vec.z; lightPos0vec.z = -lightPos0vec.z;
lightPos1vec.z = -lightPos1vec.z; lightPos1vec.z = -lightPos1vec.z;
} }
public static final void revertLightMatrix() { public static final void revertLightMatrix() {
lightPos0vec.set(lightPos0vec0); lightPos0vec.set(lightPos0vec0);
lightPos1vec.set(lightPos1vec0); lightPos1vec.set(lightPos1vec0);
} }
public static final void glPushMatrix() { public static final void glPushMatrix() {
switch (matrixMode) { switch (matrixMode) {
case GL_MODELVIEW: case GL_MODELVIEW:
@ -524,7 +565,9 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
private static final float toRad = 0.0174532925f; private static final float toRad = 0.0174532925f;
public static final void glRotatef(float p1, float p2, float p3, float p4) { public static final void glRotatef(float p1, float p2, float p3, float p4) {
deevis.set(p2, p3, p4); deevis.set(p2, p3, p4);
getMatrix().rotate(p1 * toRad, deevis); getMatrix().rotate(p1 * toRad, deevis);
@ -532,6 +575,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
System.err.println("matrix is not supported while recording display list use tessellator class instead"); System.err.println("matrix is not supported while recording display list use tessellator class instead");
} }
} }
public static final void glPopMatrix() { public static final void glPopMatrix() {
switch (matrixMode) { switch (matrixMode) {
case GL_MODELVIEW: case GL_MODELVIEW:
@ -558,9 +602,11 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
public static final void glColorMaterial(int p1, int p2) { public static final void glColorMaterial(int p1, int p2) {
} }
public static final void glGetFloat(int p1, FloatBuffer p2) { public static final void glGetFloat(int p1, FloatBuffer p2) {
switch (p1) { switch (p1) {
case GL_MODELVIEW_MATRIX: case GL_MODELVIEW_MATRIX:
@ -572,11 +618,13 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
public static final void glGetInteger(int p1, int[] p2) { public static final void glGetInteger(int p1, int[] p2) {
if (p1 == GL_VIEWPORT) { if (p1 == GL_VIEWPORT) {
_wglGetParameter(_wGL_VIEWPORT, 4, p2); _wglGetParameter(_wGL_VIEWPORT, 4, p2);
} }
} }
public static final void glScalef(float p1, float p2, float p3) { public static final void glScalef(float p1, float p2, float p3) {
deevis.set(p1, p2, p3); deevis.set(p1, p2, p3);
getMatrix().scale(deevis); getMatrix().scale(deevis);
@ -584,20 +632,26 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
System.err.println("matrix is not supported while recording display list use tessellator class instead"); System.err.println("matrix is not supported while recording display list use tessellator class instead");
} }
} }
private static final Matrix4f tmpMat = new Matrix4f(); private static final Matrix4f tmpMat = new Matrix4f();
public static final void glMultMatrixf(Matrix4f mat) { public static final void glMultMatrixf(Matrix4f mat) {
getMatrix().load(Matrix4f.mul(getMatrix(), mat, tmpMat)); getMatrix().load(Matrix4f.mul(getMatrix(), mat, tmpMat));
} }
public static final void glBlendFunc(int p1, int p2) { public static final void glBlendFunc(int p1, int p2) {
fogPremultiply = (p1 == GL_ONE && p2 == GL_ONE_MINUS_SRC_ALPHA); fogPremultiply = (p1 == GL_ONE && p2 == GL_ONE_MINUS_SRC_ALPHA);
_wglBlendFunc(p1, p2); _wglBlendFunc(p1, p2);
} }
public static final void glDepthMask(boolean p1) { public static final void glDepthMask(boolean p1) {
_wglDepthMask(p1); _wglDepthMask(p1);
} }
public static final void glColorMask(boolean p1, boolean p2, boolean p3, boolean p4) { public static final void glColorMask(boolean p1, boolean p2, boolean p3, boolean p4) {
_wglColorMask(p1, p2, p3, p4); _wglColorMask(p1, p2, p3, p4);
} }
private static final void updateAnisotropicPatch() { private static final void updateAnisotropicPatch() {
if (selectedTex == 0) { if (selectedTex == 0) {
enableAnisotropicFix = false; enableAnisotropicFix = false;
@ -608,6 +662,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
} }
} }
} }
public static final void glBindTexture(int p1, int p2) { public static final void glBindTexture(int p1, int p2) {
TextureGL t = texObjects.get(p2); TextureGL t = texObjects.get(p2);
_wglBindTexture(_wGL_TEXTURE_2D, t); _wglBindTexture(_wGL_TEXTURE_2D, t);
@ -616,9 +671,11 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
updateAnisotropicPatch(); updateAnisotropicPatch();
} }
} }
public static final void glCopyTexSubImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) { 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); _wglCopyTexSubImage2D(_wGL_TEXTURE_2D, p2, p3, p4, p5, p6, p7, p8);
} }
public static final void glTexParameteri(int p1, int p2, int p3) { public static final void glTexParameteri(int p1, int p2, int p3) {
if (selectedTex == 0 && boundTexture0 != null && p2 == GL_TEXTURE_MAG_FILTER) { if (selectedTex == 0 && boundTexture0 != null && p2 == GL_TEXTURE_MAG_FILTER) {
boundTexture0.nearest = p3 == GL_NEAREST; boundTexture0.nearest = p3 == GL_NEAREST;
@ -626,6 +683,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
_wglTexParameteri(p1, p2, p3); _wglTexParameteri(p1, p2, p3);
updateAnisotropicPatch(); updateAnisotropicPatch();
} }
public static final void glTexParameterf(int p1, int p2, float p3) { public static final void glTexParameterf(int p1, int p2, float p3) {
if (selectedTex == 0 && boundTexture0 != null && p2 == GL_TEXTURE_MAX_ANISOTROPY) { if (selectedTex == 0 && boundTexture0 != null && p2 == GL_TEXTURE_MAX_ANISOTROPY) {
boundTexture0.anisotropic = p3 > 1.0f; boundTexture0.anisotropic = p3 > 1.0f;
@ -633,15 +691,18 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
_wglTexParameterf(p1, p2 == GL_TEXTURE_MAX_ANISOTROPY ? _wGL_TEXTURE_MAX_ANISOTROPY : p2, p3); _wglTexParameterf(p1, p2 == GL_TEXTURE_MAX_ANISOTROPY ? _wGL_TEXTURE_MAX_ANISOTROPY : p2, p3);
updateAnisotropicPatch(); updateAnisotropicPatch();
} }
public static final void glLogicOp(int p1) { public static final void glLogicOp(int p1) {
} }
public static final void glNormal3f(float p1, float p2, float p3) { public static final void glNormal3f(float p1, float p2, float p3) {
float len = (float) Math.sqrt(p1 * p1 + p2 * p2 + p3 * p3); float len = (float) Math.sqrt(p1 * p1 + p2 * p2 + p3 * p3);
normalX = p1 / len; normalX = p1 / len;
normalY = p2 / len; normalY = p2 / len;
normalZ = p3 / len; normalZ = p3 / len;
} }
public static final int glGenLists(int p1) { public static final int glGenLists(int p1) {
int base = displayListId + 1; int base = displayListId + 1;
for (int i = 0; i < p1; i++) { for (int i = 0; i < p1; i++) {
@ -650,11 +711,14 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
} }
return base; return base;
} }
public static final void _wglBindVertexArray0(BufferArrayGL p1) { public static final void _wglBindVertexArray0(BufferArrayGL p1) {
currentArray = p1; currentArray = p1;
_wglBindVertexArray(p1); _wglBindVertexArray(p1);
} }
private static int displayListId = 0; private static int displayListId = 0;
public static final void glCallList(int p1) { public static final void glCallList(int p1) {
if (!isCompilingDisplayList) { if (!isCompilingDisplayList) {
DisplayList d = displayListsInitialized.get(p1); DisplayList d = displayListsInitialized.get(p1);
@ -668,6 +732,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
} }
} }
} }
public static final void glNewList(int p1, int p2) { public static final void glNewList(int p1, int p2) {
if (!isCompilingDisplayList) { if (!isCompilingDisplayList) {
compilingDisplayList = displayLists.get(p1); compilingDisplayList = displayLists.get(p1);
@ -678,6 +743,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
} }
} }
} }
public static final void glEndList() { public static final void glEndList() {
if (isCompilingDisplayList) { if (isCompilingDisplayList) {
isCompilingDisplayList = false; isCompilingDisplayList = false;
@ -699,6 +765,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
} }
} }
} }
public static final HighPolyMesh loadMesh(String path) { public static final HighPolyMesh loadMesh(String path) {
try { try {
return HighPolyMesh.loadMeshData(EaglerAdapter.loadResourceBytes(path)); return HighPolyMesh.loadMeshData(EaglerAdapter.loadResourceBytes(path));
@ -708,15 +775,18 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
return null; return null;
} }
} }
public static final void glColor3f(float p1, float p2, float p3) { public static final void glColor3f(float p1, float p2, float p3) {
colorR = p1; colorR = p1;
colorG = p2; colorG = p2;
colorB = p3; colorB = p3;
colorA = 1.0f; colorA = 1.0f;
} }
public static final void glTexGeni(int p1, int p2, int p3) { public static final void glTexGeni(int p1, int p2, int p3) {
} }
public static final void glTexGen(int p1, int p2, FloatBuffer p3) { public static final void glTexGen(int p1, int p2, FloatBuffer p3) {
switch (p1) { switch (p1) {
case GL_S: case GL_S:
@ -749,20 +819,13 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
public static final void glTexImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, IntBuffer p9) {
public static final void glTexImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8,
IntBuffer p9) {
/* /*
int pp2 = 0; * int pp2 = 0; switch(p3) { default: case GL_RGBA: pp2 = _wGL_RGBA; break; case
switch(p3) { * GL_BGRA: pp2 = _wGL_BGRA; break; } int pp3 = 0; switch(p7) { default: case
default: * GL_RGBA: pp3 = _wGL_RGBA; break; case GL_BGRA: pp3 = _wGL_BGRA; break; }
case GL_RGBA: pp2 = _wGL_RGBA; break;
case GL_BGRA: pp2 = _wGL_BGRA; break;
}
int pp3 = 0;
switch(p7) {
default:
case GL_RGBA: pp3 = _wGL_RGBA; break;
case GL_BGRA: pp3 = _wGL_BGRA; break;
}
*/ */
if (p2 == 0 && selectedTex == 0 && boundTexture0 != null) { if (p2 == 0 && selectedTex == 0 && boundTexture0 != null) {
boundTexture0.w = p4; boundTexture0.w = p4;
@ -772,7 +835,9 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
_wglTexImage2D(_wGL_TEXTURE_2D, p2, _wGL_RGBA8, p4, p5, p6, _wGL_RGBA, _wGL_UNSIGNED_BYTE, p9); _wglTexImage2D(_wGL_TEXTURE_2D, p2, _wGL_RGBA8, p4, p5, p6, _wGL_RGBA, _wGL_UNSIGNED_BYTE, p9);
updateAnisotropicPatch(); 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) {
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) { if (p2 == 0 && selectedTex == 0 && boundTexture0 != null) {
boundTexture0.w = p4; boundTexture0.w = p4;
boundTexture0.h = p5; boundTexture0.h = p5;
@ -781,35 +846,39 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
_wglTexImage2D(_wGL_TEXTURE_2D, p2, _wGL_RGB8, p4, p5, p6, _wGL_RGB, _wGL_UNSIGNED_BYTE, p9); _wglTexImage2D(_wGL_TEXTURE_2D, p2, _wGL_RGB8, p4, p5, p6, _wGL_RGB, _wGL_UNSIGNED_BYTE, p9);
updateAnisotropicPatch(); updateAnisotropicPatch();
} }
public static final void glTexSubImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, IntBuffer p9) {
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; int pp1 = 0;
switch (p1) { switch (p1) {
default: default:
case GL_TEXTURE_2D: pp1 = _wGL_TEXTURE_2D; break; case GL_TEXTURE_2D:
pp1 = _wGL_TEXTURE_2D;
break;
// case GL_TEXTURE_3D: pp1 = _wGL_TEXTURE_3D; break; // case GL_TEXTURE_3D: pp1 = _wGL_TEXTURE_3D; break;
} }
/* /*
int pp3 = 0; * int pp3 = 0; switch(p7) { default: case GL_RGBA: pp3 = _wGL_RGBA; break; case
switch(p7) { * GL_BGRA: pp3 = _wGL_BGRA; break; }
default:
case GL_RGBA: pp3 = _wGL_RGBA; break;
case GL_BGRA: pp3 = _wGL_BGRA; break;
}
*/ */
bytesUploaded += p9.remaining() * 4; bytesUploaded += p9.remaining() * 4;
_wglTexSubImage2D(pp1, p2, p3, p4, p5, p6, _wGL_RGBA, _wGL_UNSIGNED_BYTE, p9); _wglTexSubImage2D(pp1, p2, p3, p4, p5, p6, _wGL_RGBA, _wGL_UNSIGNED_BYTE, p9);
} }
public static final void glDeleteTextures(int p1) { public static final void glDeleteTextures(int p1) {
_wglDeleteTextures(texObjects.free(p1)); _wglDeleteTextures(texObjects.free(p1));
} }
public static final void glPolygonOffset(float p1, float p2) { public static final void glPolygonOffset(float p1, float p2) {
_wglPolygonOffset(p1, p2); _wglPolygonOffset(p1, p2);
} }
public static final void glCallLists(IntBuffer p1) { public static final void glCallLists(IntBuffer p1) {
while (p1.hasRemaining()) { while (p1.hasRemaining()) {
glCallList(p1.get()); glCallList(p1.get());
} }
} }
public static final void glEnableVertexAttrib(int p1) { public static final void glEnableVertexAttrib(int p1) {
switch (p1) { switch (p1) {
case GL_COLOR_ARRAY: case GL_COLOR_ARRAY:
@ -834,6 +903,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
public static final void glDisableVertexAttrib(int p1) { public static final void glDisableVertexAttrib(int p1) {
switch (p1) { switch (p1) {
case GL_COLOR_ARRAY: case GL_COLOR_ARRAY:
@ -858,9 +928,11 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
public static final void hintAnisotropicFix(boolean hint) { public static final void hintAnisotropicFix(boolean hint) {
hintAnisotropicPatch = hint; hintAnisotropicPatch = hint;
} }
private static final int getShaderModeFlag0() { private static final int getShaderModeFlag0() {
int mode = 0; int mode = 0;
mode = (mode | (enableColorArray ? FixedFunctionShader.COLOR : 0)); mode = (mode | (enableColorArray ? FixedFunctionShader.COLOR : 0));
@ -869,6 +941,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
mode = (mode | (enableTex1Array ? FixedFunctionShader.TEXTURE1 : 0)); mode = (mode | (enableTex1Array ? FixedFunctionShader.TEXTURE1 : 0));
return mode; return mode;
} }
private static final int getShaderModeFlag1() { private static final int getShaderModeFlag1() {
int mode = 0; int mode = 0;
mode = (mode | (enableTexGen ? FixedFunctionShader.TEXGEN : 0)); mode = (mode | (enableTexGen ? FixedFunctionShader.TEXGEN : 0));
@ -877,10 +950,13 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
mode = (mode | (enableAlphaTest ? FixedFunctionShader.ALPHATEST : 0)); mode = (mode | (enableAlphaTest ? FixedFunctionShader.ALPHATEST : 0));
mode = (mode | (enableTexture2D ? FixedFunctionShader.UNIT0 : 0)); mode = (mode | (enableTexture2D ? FixedFunctionShader.UNIT0 : 0));
mode = (mode | (enableTexture2D_1 ? FixedFunctionShader.UNIT1 : 0)); mode = (mode | (enableTexture2D_1 ? FixedFunctionShader.UNIT1 : 0));
mode = (mode | ((enableTexture2D && (enableAnisotropicFix || (hintAnisotropicPatch && enableAnisotropicPatch))) ? FixedFunctionShader.FIX_ANISOTROPIC : 0)); mode = (mode | ((enableTexture2D && (enableAnisotropicFix || (hintAnisotropicPatch && enableAnisotropicPatch)))
? FixedFunctionShader.FIX_ANISOTROPIC
: 0));
mode = (mode | (swapRB ? FixedFunctionShader.SWAP_RB : 0)); mode = (mode | (swapRB ? FixedFunctionShader.SWAP_RB : 0));
return mode; return mode;
} }
private static final int getShaderModeFlag() { private static final int getShaderModeFlag() {
int mode = 0; int mode = 0;
mode = (mode | (enableColorArray ? FixedFunctionShader.COLOR : 0)); mode = (mode | (enableColorArray ? FixedFunctionShader.COLOR : 0));
@ -893,14 +969,19 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
mode = (mode | (enableAlphaTest ? FixedFunctionShader.ALPHATEST : 0)); mode = (mode | (enableAlphaTest ? FixedFunctionShader.ALPHATEST : 0));
mode = (mode | (enableTexture2D ? FixedFunctionShader.UNIT0 : 0)); mode = (mode | (enableTexture2D ? FixedFunctionShader.UNIT0 : 0));
mode = (mode | (enableTexture2D_1 ? FixedFunctionShader.UNIT1 : 0)); mode = (mode | (enableTexture2D_1 ? FixedFunctionShader.UNIT1 : 0));
mode = (mode | ((enableTexture2D && (enableAnisotropicFix || (hintAnisotropicPatch && enableAnisotropicPatch))) ? FixedFunctionShader.FIX_ANISOTROPIC : 0)); mode = (mode | ((enableTexture2D && (enableAnisotropicFix || (hintAnisotropicPatch && enableAnisotropicPatch)))
? FixedFunctionShader.FIX_ANISOTROPIC
: 0));
mode = (mode | (swapRB ? FixedFunctionShader.SWAP_RB : 0)); mode = (mode | (swapRB ? FixedFunctionShader.SWAP_RB : 0));
return mode; return mode;
} }
private static FixedFunctionShader shader = null; private static FixedFunctionShader shader = null;
private static final void bindTheShader() { private static final void bindTheShader() {
bindTheShader(getShaderModeFlag()); bindTheShader(getShaderModeFlag());
} }
private static final void bindTheShader(int mode) { private static final void bindTheShader(int mode) {
FixedFunctionShader s = shader = FixedFunctionShader.instance(mode); FixedFunctionShader s = shader = FixedFunctionShader.instance(mode);
s.useProgram(); s.useProgram();
@ -933,14 +1014,18 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
s.setAnisotropicFix(anisotropicFixX, anisotropicFixY); s.setAnisotropicFix(anisotropicFixX, anisotropicFixY);
} }
} }
public static final void drawHighPoly(HighPolyMesh msh) { public static final void drawHighPoly(HighPolyMesh msh) {
bindTheShader((msh.hasTexture ? (FixedFunctionShader.NORMAL | FixedFunctionShader.TEXTURE0) : FixedFunctionShader.NORMAL) | getShaderModeFlag1()); bindTheShader((msh.hasTexture ? (FixedFunctionShader.NORMAL | FixedFunctionShader.TEXTURE0)
: FixedFunctionShader.NORMAL) | getShaderModeFlag1());
_wglBindVertexArray(msh.vertexArray); _wglBindVertexArray(msh.vertexArray);
_wglDrawElements(_wGL_TRIANGLES, msh.indexCount, _wGL_UNSIGNED_SHORT, 0); _wglDrawElements(_wGL_TRIANGLES, msh.indexCount, _wGL_UNSIGNED_SHORT, 0);
triangleDrawn += msh.indexCount / 3; triangleDrawn += msh.indexCount / 3;
shader.unuseProgram(); shader.unuseProgram();
} }
private static Object blankUploadArray = _wCreateLowLevelIntBuffer(525000); private static Object blankUploadArray = _wCreateLowLevelIntBuffer(525000);
public static final void glDrawArrays(int p1, int p2, int p3, Object buffer) { public static final void glDrawArrays(int p1, int p2, int p3, Object buffer) {
if (isCompilingDisplayList) { if (isCompilingDisplayList) {
if (p1 == GL_QUADS) { if (p1 == GL_QUADS) {
@ -1002,7 +1087,8 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
private static final void _wglDrawQuadArrays(int p2, int p3) { private static final void _wglDrawQuadArrays(int p2, int p3) {
if (quadsToTrianglesBuffer == null) { if (quadsToTrianglesBuffer == null) {
IntBuffer upload = isWebGL ? IntBuffer.wrap(new int[98400 / 2]) : ByteBuffer.allocateDirect(98400 * 2).order(ByteOrder.nativeOrder()).asIntBuffer(); IntBuffer upload = isWebGL ? IntBuffer.wrap(new int[98400 / 2])
: ByteBuffer.allocateDirect(98400 * 2).order(ByteOrder.nativeOrder()).asIntBuffer();
for (int i = 0; i < 16384; ++i) { for (int i = 0; i < 16384; ++i) {
int v1 = i * 4; int v1 = i * 4;
int v2 = i * 4 + 1; int v2 = i * 4 + 1;
@ -1024,7 +1110,6 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
_wglDrawElements(_wGL_TRIANGLES, p3 * 6 / 4, _wGL_UNSIGNED_SHORT, p2 * 6 / 4); _wglDrawElements(_wGL_TRIANGLES, p3 * 6 / 4, _wGL_UNSIGNED_SHORT, p2 * 6 / 4);
} }
private static BufferArrayGL occlusion_vao = null; private static BufferArrayGL occlusion_vao = null;
private static BufferGL occlusion_vbo = null; private static BufferGL occlusion_vbo = null;
private static ProgramGL occlusion_program = null; private static ProgramGL occlusion_program = null;
@ -1035,12 +1120,15 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
occlusion_vao = _wglCreateVertexArray(); occlusion_vao = _wglCreateVertexArray();
occlusion_vbo = _wglCreateBuffer(); occlusion_vbo = _wglCreateBuffer();
IntBuffer upload = (isWebGL ? IntBuffer.wrap(new int[108]) : ByteBuffer.allocateDirect(108 << 2).order(ByteOrder.nativeOrder()).asIntBuffer()); IntBuffer upload = (isWebGL ? IntBuffer.wrap(new int[108])
float[] verts = new float[] { : ByteBuffer.allocateDirect(108 << 2).order(ByteOrder.nativeOrder()).asIntBuffer());
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, float[] verts = new float[] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,
0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,
}; 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f };
for (int i = 0; i < verts.length; i++) { for (int i = 0; i < verts.length; i++) {
upload.put(Float.floatToRawIntBits(verts[i])); upload.put(Float.floatToRawIntBits(verts[i]));
} }
@ -1060,10 +1148,12 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
_wglShaderSource(frag, _wgetShaderHeader() + "\n#define CC_FRAG\n" + src); _wglShaderSource(frag, _wgetShaderHeader() + "\n#define CC_FRAG\n" + src);
_wglCompileShader(vert); _wglCompileShader(vert);
if (!_wglGetShaderCompiled(vert)) System.err.println(("\n" + _wglGetShaderInfoLog(vert)).replace("\n", "\n[/glsl/occl.glsl][VERT] ") + "\n"); if (!_wglGetShaderCompiled(vert))
System.err.println(("\n" + _wglGetShaderInfoLog(vert)).replace("\n", "\n[/glsl/occl.glsl][VERT] ") + "\n");
_wglCompileShader(frag); _wglCompileShader(frag);
if (!_wglGetShaderCompiled(frag)) System.err.println(("\n" + _wglGetShaderInfoLog(frag)).replace("\n", "\n[/glsl/occl.glsl][FRAG] ") + "\n"); if (!_wglGetShaderCompiled(frag))
System.err.println(("\n" + _wglGetShaderInfoLog(frag)).replace("\n", "\n[/glsl/occl.glsl][FRAG] ") + "\n");
occlusion_program = _wglCreateProgram(); occlusion_program = _wglCreateProgram();
@ -1075,7 +1165,9 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
_wglDeleteShader(vert); _wglDeleteShader(vert);
_wglDeleteShader(frag); _wglDeleteShader(frag);
if(!_wglGetProgramLinked(occlusion_program)) System.err.println(("\n\n"+_wglGetProgramInfoLog(occlusion_program)).replace("\n", "\n[/glsl/occl.glsl][LINKER] ")); if (!_wglGetProgramLinked(occlusion_program))
System.err.println(
("\n\n" + _wglGetProgramInfoLog(occlusion_program)).replace("\n", "\n[/glsl/occl.glsl][LINKER] "));
_wglUseProgram(occlusion_program); _wglUseProgram(occlusion_program);
occlusion_matrix_m = _wglGetUniformLocation(occlusion_program, "matrix_m"); occlusion_matrix_m = _wglGetUniformLocation(occlusion_program, "matrix_m");
@ -1102,7 +1194,8 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
private static float[] occlusionProj = new float[16]; private static float[] occlusionProj = new float[16];
public static final void glBindOcclusionBB() { public static final void glBindOcclusionBB() {
if(occlusion_vao == null) initializeOcclusionObjects(); if (occlusion_vao == null)
initializeOcclusionObjects();
_wglUseProgram(occlusion_program); _wglUseProgram(occlusion_program);
_wglBindVertexArray(occlusion_vao); _wglBindVertexArray(occlusion_vao);
if (!cachedOcclusionP.equals(matProjV[matProjPointer])) { if (!cachedOcclusionP.equals(matProjV[matProjPointer])) {
@ -1116,7 +1209,8 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
} }
public static final void glDrawOcclusionBB(float posX, float posY, float posZ, float sizeX, float sizeY, float sizeZ) { public static final void glDrawOcclusionBB(float posX, float posY, float posZ, float sizeX, float sizeY,
float sizeZ) {
glPushMatrix(); glPushMatrix();
glTranslatef(posX - sizeX * 0.01f, posY - sizeY * 0.01f, posZ - sizeZ * 0.01f); glTranslatef(posX - sizeX * 0.01f, posY - sizeY * 0.01f, posZ - sizeZ * 0.01f);
glScalef(sizeX * 1.02f, sizeY * 1.02f, sizeZ * 1.02f); glScalef(sizeX * 1.02f, sizeY * 1.02f, sizeZ * 1.02f);
@ -1144,24 +1238,25 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
public static final int glGenTextures() { public static final int glGenTextures() {
return texObjects.register(_wglGenTextures()); return texObjects.register(_wglGenTextures());
} }
public static final void glTexSubImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, ByteBuffer p9) {
public static final void glTexSubImage2D(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8,
ByteBuffer p9) {
int pp1 = 0; int pp1 = 0;
switch (p1) { switch (p1) {
default: default:
case GL_TEXTURE_2D: pp1 = _wGL_TEXTURE_2D; break; case GL_TEXTURE_2D:
pp1 = _wGL_TEXTURE_2D;
break;
// case GL_TEXTURE_3D: pp1 = _wGL_TEXTURE_3D; break; // case GL_TEXTURE_3D: pp1 = _wGL_TEXTURE_3D; break;
} }
/* /*
int pp3 = 0; * int pp3 = 0; switch(p7) { default: case GL_RGBA: pp3 = _wGL_RGBA; break; case
switch(p7) { * GL_BGRA: pp3 = _wGL_BGRA; break; }
default:
case GL_RGBA: pp3 = _wGL_RGBA; break;
case GL_BGRA: pp3 = _wGL_BGRA; break;
}
*/ */
bytesUploaded += p9.remaining(); bytesUploaded += p9.remaining();
_wglTexSubImage2D(pp1, p2, p3, p4, p5, p6, _wGL_RGBA, _wGL_UNSIGNED_BYTE, p9); _wglTexSubImage2D(pp1, p2, p3, p4, p5, p6, _wGL_RGBA, _wGL_UNSIGNED_BYTE, p9);
} }
public static final void glFogi(int p1, int p2) { public static final void glFogi(int p1, int p2) {
if (p1 == GL_FOG_MODE) { if (p1 == GL_FOG_MODE) {
switch (p2) { switch (p2) {
@ -1175,6 +1270,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
} }
} }
} }
public static final void glFogf(int p1, float p2) { public static final void glFogf(int p1, float p2) {
switch (p1) { switch (p1) {
case GL_FOG_START: case GL_FOG_START:
@ -1190,6 +1286,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
public static final void glFog(int p1, FloatBuffer p2) { public static final void glFog(int p1, FloatBuffer p2) {
if (p1 == GL_FOG_COLOR) { if (p1 == GL_FOG_COLOR) {
fogColorR = p2.get(); fogColorR = p2.get();
@ -1198,6 +1295,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
fogColorA = p2.get(); fogColorA = p2.get();
} }
} }
public static final void glDeleteLists(int p1, int p2) { public static final void glDeleteLists(int p1, int p2) {
for (int i = 0; i < p2; i++) { for (int i = 0; i < p2; i++) {
DisplayList d = displayListsInitialized.remove(p1 + i); DisplayList d = displayListsInitialized.remove(p1 + i);
@ -1208,6 +1306,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
displayLists.remove(p1 + i); displayLists.remove(p1 + i);
} }
} }
public static final void glActiveTexture(int p1) { public static final void glActiveTexture(int p1) {
switch (p1) { switch (p1) {
case GL_TEXTURE0: case GL_TEXTURE0:
@ -1223,6 +1322,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
public static final void glClientActiveTexture(int p1) { public static final void glClientActiveTexture(int p1) {
switch (p1) { switch (p1) {
case GL_TEXTURE0: case GL_TEXTURE0:
@ -1236,6 +1336,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
public static final void glMultiTexCoord2f(int p1, float p2, float p3) { public static final void glMultiTexCoord2f(int p1, float p2, float p3) {
switch (p1) { switch (p1) {
case GL_TEXTURE0: case GL_TEXTURE0:
@ -1251,20 +1352,25 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
break; break;
} }
} }
private static Matrix4f unprojA = new Matrix4f(); private static Matrix4f unprojA = new Matrix4f();
private static Matrix4f unprojB = new Matrix4f(); private static Matrix4f unprojB = new Matrix4f();
private static Vector4f unprojC = new Vector4f(); private static Vector4f unprojC = new Vector4f();
public static final void gluUnProject(float p1, float p2, float p3, FloatBuffer p4, FloatBuffer p5, int[] p6, FloatBuffer p7) {
public static final void gluUnProject(float p1, float p2, float p3, FloatBuffer p4, FloatBuffer p5, int[] p6,
FloatBuffer p7) {
unprojA.load(p4); unprojA.load(p4);
unprojB.load(p5); unprojB.load(p5);
Matrix4f.mul(unprojA, unprojB, unprojB); Matrix4f.mul(unprojA, unprojB, unprojB);
unprojB.invert(); unprojB.invert();
unprojC.set(((p1 - (float)p6[0]) / (float)p6[2]) * 2f - 1f, ((p2 - (float)p6[1]) / (float)p6[3]) * 2f - 1f, p3, 1.0f); unprojC.set(((p1 - (float) p6[0]) / (float) p6[2]) * 2f - 1f, ((p2 - (float) p6[1]) / (float) p6[3]) * 2f - 1f,
p3, 1.0f);
Matrix4f.transform(unprojB, unprojC, unprojC); Matrix4f.transform(unprojB, unprojC, unprojC);
p7.put(unprojC.x / unprojC.w); p7.put(unprojC.x / unprojC.w);
p7.put(unprojC.y / unprojC.w); p7.put(unprojC.y / unprojC.w);
p7.put(unprojC.z / unprojC.w); p7.put(unprojC.z / unprojC.w);
} }
public static final void gluPerspective(float fovy, float aspect, float zNear, float zFar) { public static final void gluPerspective(float fovy, float aspect, float zNear, float zFar) {
Matrix4f res = getMatrix(); Matrix4f res = getMatrix();
float cotangent = (float) Math.cos(fovy * toRad * 0.5f) / (float) Math.sin(fovy * toRad * 0.5f); float cotangent = (float) Math.cos(fovy * toRad * 0.5f) / (float) Math.sin(fovy * toRad * 0.5f);
@ -1285,6 +1391,7 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
res.m32 = 2.0f * zFar * zNear / (zFar - zNear); res.m32 = 2.0f * zFar * zNear / (zFar - zNear);
res.m33 = 0.0f; res.m33 = 0.0f;
} }
public static final void gluPerspectiveFlat(float fovy, float aspect, float zNear, float zFar) { public static final void gluPerspectiveFlat(float fovy, float aspect, float zNear, float zFar) {
Matrix4f res = getMatrix(); Matrix4f res = getMatrix();
float cotangent = (float) Math.cos(fovy * toRad * 0.5f) / (float) Math.sin(fovy * toRad * 0.5f); float cotangent = (float) Math.cos(fovy * toRad * 0.5f) / (float) Math.sin(fovy * toRad * 0.5f);
@ -1305,18 +1412,27 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
res.m32 = 2.0f * zFar * zNear / (zFar - zNear); res.m32 = 2.0f * zFar * zNear / (zFar - zNear);
res.m33 = 0.0f; res.m33 = 0.0f;
} }
public static final String gluErrorString(int p1) { public static final String gluErrorString(int p1) {
switch (p1) { switch (p1) {
case GL_INVALID_ENUM: return "GL_INVALID_ENUM"; case GL_INVALID_ENUM:
case GL_INVALID_VALUE: return "GL_INVALID_VALUE"; return "GL_INVALID_ENUM";
case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION"; case GL_INVALID_VALUE:
case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY"; return "GL_INVALID_VALUE";
case GL_CONTEXT_LOST_WEBGL: return "CONTEXT_LOST_WEBGL"; case GL_INVALID_OPERATION:
default: return "Unknown Error"; return "GL_INVALID_OPERATION";
case GL_OUT_OF_MEMORY:
return "GL_OUT_OF_MEMORY";
case GL_CONTEXT_LOST_WEBGL:
return "CONTEXT_LOST_WEBGL";
default:
return "Unknown Error";
} }
} }
private static long lastBandwidthReset = 0l; private static long lastBandwidthReset = 0l;
private static int lastBandwidth = 0; private static int lastBandwidth = 0;
public static final int getBitsPerSecond() { public static final int getBitsPerSecond() {
if (System.currentTimeMillis() - lastBandwidthReset > 1000) { if (System.currentTimeMillis() - lastBandwidthReset > 1000) {
lastBandwidthReset = System.currentTimeMillis(); lastBandwidthReset = System.currentTimeMillis();
@ -1325,11 +1441,13 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
} }
return lastBandwidth; return lastBandwidth;
} }
public static final int getVertexesPerSecond() { public static final int getVertexesPerSecond() {
int ret = vertexDrawn; int ret = vertexDrawn;
vertexDrawn = 0; vertexDrawn = 0;
return ret; return ret;
} }
public static final int getTrianglesPerSecond() { public static final int getTrianglesPerSecond() {
int ret = triangleDrawn; int ret = triangleDrawn;
triangleDrawn = 0; triangleDrawn = 0;

View File

@ -1,77 +1,6 @@
package net.lax1dude.eaglercraft.glemu; package net.lax1dude.eaglercraft.glemu;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_ARRAY_BUFFER; import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.*;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_CLAMP;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_COLOR_ATTACHMENT0;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_CULL_FACE;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_DEPTH24_STENCIL8;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_DEPTH_STENCIL;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_DEPTH_STENCIL_ATTACHMENT;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_DEPTH_TEST;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_FLOAT;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_FRAGMENT_SHADER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_FRAMEBUFFER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_LINEAR;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_NEAREST;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_RGB;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_STATIC_DRAW;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE0;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE1;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE2;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE_2D;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE_MAG_FILTER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE_MIN_FILTER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE_WRAP_S;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE_WRAP_T;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TRIANGLES;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_UNSIGNED_BYTE;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_UNSIGNED_INT_24_8;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_VERTEX_SHADER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_VIEWPORT;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wgetShaderHeader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglActiveTexture;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglAttachShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindAttributeLocation;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindFramebuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindTexture;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindVertexArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBufferData0;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCompileShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateFramebuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateVertexArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDeleteProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDeleteShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDepthMask;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDetachShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDisable;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDrawArrays;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglEnableVertexAttribArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglFramebufferTexture2D;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGenTextures;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetParameter;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetProgramInfoLog;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetProgramLinked;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetShaderCompiled;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetShaderInfoLog;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetUniformLocation;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglLinkProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglShaderSource;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglTexImage2D;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglTexParameteri;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform1f;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform1i;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform2f;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform2i;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform3f;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniformMat4fv;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUseProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglVertexAttribPointer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglViewport;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.fileContents;
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.isWebGL; import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.isWebGL;
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.matProjPointer; import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.matProjPointer;
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.matProjV; import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.matProjV;

View File

@ -1,99 +1,12 @@
package net.lax1dude.eaglercraft.glemu; package net.lax1dude.eaglercraft.glemu;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_ARRAY_BUFFER; import static net.lax1dude.eaglercraft.EaglerAdapter.*;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_BACK;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_CLAMP;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_COLOR_ATTACHMENT0;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_COLOR_BUFFER_BIT;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_CULL_FACE;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_DEPTH_ATTACHMENT;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_DEPTH_BUFFER_BIT;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_DEPTH_COMPONENT32F;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_DEPTH_TEST;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_DRAW_FRAMEBUFFER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_FLOAT;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_FRAGMENT_SHADER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_FRAMEBUFFER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_LINE_SMOOTH;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_MULTISAMPLE;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_NEAREST;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_READ_FRAMEBUFFER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_RGB;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_RGB8;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_STATIC_DRAW;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE0;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE_2D;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE_MAG_FILTER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE_MIN_FILTER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE_WRAP_S;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TEXTURE_WRAP_T;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_TRIANGLES;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_UNSIGNED_BYTE;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_VERTEX_SHADER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wgetShaderHeader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglActiveTexture;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglAttachShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindFramebuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindRenderbuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindTexture;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindVertexArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBlitFramebuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBufferData0;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglClear;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCompileShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateFramebuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateRenderBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateVertexArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDeleteFramebuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDeleteRenderbuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDeleteShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDeleteTextures;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDepthMask;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDetachShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDisable;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDrawArrays;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDrawBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglEnable;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglEnableVertexAttribArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglFramebufferRenderbuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglFramebufferTexture2D;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGenTextures;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetProgramInfoLog;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetProgramLinked;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetShaderCompiled;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetShaderInfoLog;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetUniformLocation;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglLinkProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglRenderbufferStorage;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglRenderbufferStorageMultisample;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglShaderSource;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglTexImage2D;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglTexParameteri;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform1i;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform2f;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUseProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglVertexAttribPointer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglViewport;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.fileContents;
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.isWebGL;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.BufferArrayGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.BufferGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.FramebufferGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.ProgramGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RenderbufferGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.ShaderGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.TextureGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.UniformGL;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
public class EffectPipelineFXAA { public class EffectPipelineFXAA {

View File

@ -1,40 +1,7 @@
package net.lax1dude.eaglercraft.glemu; package net.lax1dude.eaglercraft.glemu;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_ARRAY_BUFFER; import static net.lax1dude.eaglercraft.EaglerAdapter.*;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_FRAGMENT_SHADER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_VERTEX_SHADER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wgetShaderHeader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglAttachShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindAttributeLocation;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindVertexArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCompileShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateVertexArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDeleteProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDeleteShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDetachShader;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglEnableVertexAttribArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetProgramInfoLog;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetProgramLinked;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetShaderCompiled;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetShaderInfoLog;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglGetUniformLocation;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglLinkProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglShaderSource;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform1f;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform1i;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform2f;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform3f;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniform4f;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUniformMat4fv;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglUseProgram;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglVertexAttribPointer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.fileContents;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.BufferArrayGL; import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.BufferArrayGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.BufferGL; import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.BufferGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.ProgramGL; import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.ProgramGL;
@ -352,22 +319,22 @@ public class FixedFunctionShader {
public void setupArrayForProgram() { public void setupArrayForProgram() {
_wglEnableVertexAttribArray(a_position); _wglEnableVertexAttribArray(a_position);
_wglVertexAttribPointer(a_position, 3, EaglerAdapter._wGL_FLOAT, false, 32, 0); _wglVertexAttribPointer(a_position, 3, _wGL_FLOAT, false, 32, 0);
if(enable_texture0) { if(enable_texture0) {
_wglEnableVertexAttribArray(a_texture0); _wglEnableVertexAttribArray(a_texture0);
_wglVertexAttribPointer(a_texture0, 2, EaglerAdapter._wGL_FLOAT, false, 32, 12); _wglVertexAttribPointer(a_texture0, 2, _wGL_FLOAT, false, 32, 12);
} }
if(enable_color) { if(enable_color) {
_wglEnableVertexAttribArray(a_color); _wglEnableVertexAttribArray(a_color);
_wglVertexAttribPointer(a_color, 4, EaglerAdapter._wGL_UNSIGNED_BYTE, true, 32, 20); _wglVertexAttribPointer(a_color, 4, _wGL_UNSIGNED_BYTE, true, 32, 20);
} }
if(enable_normal) { if(enable_normal) {
_wglEnableVertexAttribArray(a_normal); _wglEnableVertexAttribArray(a_normal);
_wglVertexAttribPointer(a_normal, 4, EaglerAdapter._wGL_UNSIGNED_BYTE, true, 32, 24); _wglVertexAttribPointer(a_normal, 4, _wGL_UNSIGNED_BYTE, true, 32, 24);
} }
if(enable_texture1) { if(enable_texture1) {
_wglEnableVertexAttribArray(a_texture1); _wglEnableVertexAttribArray(a_texture1);
_wglVertexAttribPointer(a_texture1, 2, EaglerAdapter._wGL_SHORT, false, 32, 28); _wglVertexAttribPointer(a_texture1, 2, _wGL_SHORT, false, 32, 28);
} }
} }

View File

@ -1,19 +1,6 @@
package net.lax1dude.eaglercraft.glemu; package net.lax1dude.eaglercraft.glemu;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_ARRAY_BUFFER; import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.*;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_ELEMENT_ARRAY_BUFFER;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_FLOAT;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_STATIC_DRAW;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wGL_UNSIGNED_BYTE;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBindVertexArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglBufferData0;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglCreateVertexArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDeleteBuffer;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglDeleteVertexArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglEnableVertexAttribArray;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2._wglVertexAttribPointer;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.DataInputStream; import java.io.DataInputStream;

View File

@ -8,11 +8,11 @@ import net.lax1dude.eaglercraft.DefaultSkinRenderer;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglerProfile; import net.lax1dude.eaglercraft.EaglerProfile;
import net.lax1dude.eaglercraft.GuiScreenEditProfile; import net.lax1dude.eaglercraft.GuiScreenEditProfile;
import net.lax1dude.eaglercraft.GuiScreenLicense;
import net.lax1dude.eaglercraft.GuiScreenSingleplayerConnecting; import net.lax1dude.eaglercraft.GuiScreenSingleplayerConnecting;
import net.lax1dude.eaglercraft.GuiScreenSingleplayerLoading; import net.lax1dude.eaglercraft.GuiScreenSingleplayerLoading;
import net.lax1dude.eaglercraft.IntegratedServer;
import net.lax1dude.eaglercraft.GuiScreenLicense;
import net.lax1dude.eaglercraft.GuiVoiceOverlay; import net.lax1dude.eaglercraft.GuiVoiceOverlay;
import net.lax1dude.eaglercraft.IntegratedServer;
import net.lax1dude.eaglercraft.LocalStorageManager; import net.lax1dude.eaglercraft.LocalStorageManager;
import net.lax1dude.eaglercraft.Voice; import net.lax1dude.eaglercraft.Voice;
import net.lax1dude.eaglercraft.WorkerNetworkManager; import net.lax1dude.eaglercraft.WorkerNetworkManager;

View File

@ -4,11 +4,10 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import net.lax1dude.eaglercraft.ConfigConstants;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom; import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.lax1dude.eaglercraft.IntegratedServer;
import net.lax1dude.eaglercraft.EnumBrowser; import net.lax1dude.eaglercraft.EnumBrowser;
import net.lax1dude.eaglercraft.IntegratedServer;
import net.lax1dude.eaglercraft.TextureLocation; import net.lax1dude.eaglercraft.TextureLocation;
import net.lax1dude.eaglercraft.adapter.Tessellator; import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.lax1dude.eaglercraft.glemu.EffectPipeline; import net.lax1dude.eaglercraft.glemu.EffectPipeline;

View File

@ -9,7 +9,6 @@ import java.util.List;
import net.lax1dude.eaglercraft.GuiScreenBackupWorld; import net.lax1dude.eaglercraft.GuiScreenBackupWorld;
import net.lax1dude.eaglercraft.GuiScreenCreateWorldSelection; import net.lax1dude.eaglercraft.GuiScreenCreateWorldSelection;
import net.lax1dude.eaglercraft.GuiScreenSingleplayerLoading; import net.lax1dude.eaglercraft.GuiScreenSingleplayerLoading;
import net.lax1dude.eaglercraft.GuiScreenSingleplayerNotImplemented;
import net.lax1dude.eaglercraft.IntegratedServer; import net.lax1dude.eaglercraft.IntegratedServer;
public class GuiSelectWorld extends GuiScreen { public class GuiSelectWorld extends GuiScreen {

View File

@ -12,10 +12,10 @@ import java.util.function.Consumer;
import net.lax1dude.eaglercraft.DefaultSkinRenderer; import net.lax1dude.eaglercraft.DefaultSkinRenderer;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.IntegratedServer;
import net.lax1dude.eaglercraft.EaglercraftRandom; import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.lax1dude.eaglercraft.GuiScreenSingleplayerException; import net.lax1dude.eaglercraft.GuiScreenSingleplayerException;
import net.lax1dude.eaglercraft.GuiScreenSingleplayerLoading; import net.lax1dude.eaglercraft.GuiScreenSingleplayerLoading;
import net.lax1dude.eaglercraft.IntegratedServer;
import net.lax1dude.eaglercraft.Voice; import net.lax1dude.eaglercraft.Voice;
import net.lax1dude.eaglercraft.WebsocketNetworkManager; import net.lax1dude.eaglercraft.WebsocketNetworkManager;
import net.lax1dude.eaglercraft.WorkerNetworkManager; import net.lax1dude.eaglercraft.WorkerNetworkManager;

View File

@ -2,7 +2,6 @@ package net.minecraft.src;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -11,7 +10,10 @@ import java.util.Set;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import net.lax1dude.eaglercraft.*; import net.lax1dude.eaglercraft.Base64;
import net.lax1dude.eaglercraft.ConfigConstants;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.LocalStorageManager;
import net.lax1dude.eaglercraft.ServerQuery.QueryResponse; import net.lax1dude.eaglercraft.ServerQuery.QueryResponse;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit; import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;

View File

@ -1,6 +1,7 @@
package net.lax1dude.eaglercraft.adapter; package net.lax1dude.eaglercraft.adapter;
import static net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext.*; import static net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext.*;
import static org.teavm.jso.webgl.WebGLRenderingContext.*;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -24,6 +25,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.json.JSONObject; import org.json.JSONObject;
import org.teavm.interop.Async; import org.teavm.interop.Async;
import org.teavm.interop.AsyncCallback; import org.teavm.interop.AsyncCallback;
@ -35,9 +37,9 @@ import org.teavm.jso.ajax.XMLHttpRequest;
import org.teavm.jso.browser.Storage; import org.teavm.jso.browser.Storage;
import org.teavm.jso.browser.TimerHandler; import org.teavm.jso.browser.TimerHandler;
import org.teavm.jso.browser.Window; import org.teavm.jso.browser.Window;
import org.teavm.jso.dom.events.ErrorEvent;
import org.teavm.jso.canvas.CanvasRenderingContext2D; import org.teavm.jso.canvas.CanvasRenderingContext2D;
import org.teavm.jso.canvas.ImageData; import org.teavm.jso.canvas.ImageData;
import org.teavm.jso.dom.events.ErrorEvent;
import org.teavm.jso.dom.events.Event; import org.teavm.jso.dom.events.Event;
import org.teavm.jso.dom.events.EventListener; import org.teavm.jso.dom.events.EventListener;
import org.teavm.jso.dom.events.KeyboardEvent; import org.teavm.jso.dom.events.KeyboardEvent;
@ -96,7 +98,6 @@ import net.lax1dude.eaglercraft.adapter.teavm.SelfDefence;
import net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext; import net.lax1dude.eaglercraft.adapter.teavm.WebGL2RenderingContext;
import net.lax1dude.eaglercraft.adapter.teavm.WebGLQuery; import net.lax1dude.eaglercraft.adapter.teavm.WebGLQuery;
import net.lax1dude.eaglercraft.adapter.teavm.WebGLVertexArray; import net.lax1dude.eaglercraft.adapter.teavm.WebGLVertexArray;
import net.minecraft.client.Minecraft;
import net.minecraft.src.MathHelper; import net.minecraft.src.MathHelper;
public class EaglerAdapterImpl2 { public class EaglerAdapterImpl2 {