feat(web): add 2006Scape TeaVM WebGL2 client with mobile support and classic 2006 UI

Initializes the TeaVM-based 2006Scape-Web client repository with WebGL2 117HD rendering, WebSocket networking, SpessaSynth MIDI/PCM audio, and mobile-compatible touch/viewport controls. Preserves Revision 377 cache preloading via IndexedDB and localStorage-backed script and config persistence.

### Core Web Runtime & Rendering
- WebLauncher & DesktopHooks:
  - Added TeaVM entry point with URL/localStorage option parsing, async 377 cache preloading, and WebSocket port routing.
  - Implemented DesktopHooks.boxReflectValue using JSWrapper.isJava/maybeUnwrap to box TeaVM reflection primitives, plus localStorage persistence for plugin settings and imported scripts.
- WebHd117Renderer & RSImageProducer:
  - Implemented WebGL2 117HD rendering with 4x4 chunked static scenery VBOs and 0x010203 transparency sentinel so 0x000000 black UI elements stay opaque.
- WebReflectionSupplier:
  - Exposed PluginContext, PluginGraphics, ScriptInterpreter, ID lists, and Math/System/String/collection methods for TeaVM runtime reflection.

### Mobile & Classic 2006 Web UI
- index.html & RSApplet:
  - Styled the page to match the classic 2006 RuneScape webclient with optional classic navbar (auto-hidden below 765px), 1999-2006 Jagex footer, and responsive Fixed/Resizable/Fullscreen scaling.
  - Added Options modal (auto-login, server, world, 117HD, display mode, navbar) with scrollable body in mobile landscape.
  - Implemented Android-parity touch controls (tap, 450ms long-press right-click, 1-finger camera drag, 2-finger pinch zoom clamped to -1..8, and auto-keyboard on input fields).
This commit is contained in:
Dark98 committed 2026-11-30 20:45:03 +00:00
commit 3331ab745b
25 files changed
+4795

No files matched your search

+130
View File
@@ -0,0 +1,130 @@
package org.scape2006.web;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSObject;
import org.teavm.jso.dom.html.HTMLCanvasElement;
import org.teavm.jso.typedarrays.Float32Array;
import org.teavm.jso.typedarrays.Uint8Array;
/**
* TeaVM JSO bindings for WebGL 2.0 (OpenGL ES 3.0) used by WebHd117Renderer.
*/
public interface WebGL2 extends JSObject {
int COLOR_BUFFER_BIT = 0x00004000;
int DEPTH_BUFFER_BIT = 0x00000100;
int TRIANGLES = 0x0004;
int LEQUAL = 0x0203;
int SRC_ALPHA = 0x0302;
int ONE_MINUS_SRC_ALPHA = 0x0303;
int DEPTH_TEST = 0x0B71;
int BLEND = 0x0BE2;
int POLYGON_OFFSET_FILL = 0x8037;
int FLOAT = 0x1406;
int UNSIGNED_BYTE = 0x1401;
int UNSIGNED_INT = 0x1405;
int RGBA = 0x1908;
int RGBA8 = 0x8058;
int DEPTH_COMPONENT = 0x1902;
int DEPTH_COMPONENT24 = 0x81A6;
int TEXTURE_2D = 0x0DE1;
int TEXTURE_2D_ARRAY = 0x8C1A;
int TEXTURE0 = 0x84C0;
int TEXTURE1 = 0x84C1;
int TEXTURE2 = 0x84C2;
int TEXTURE_MIN_FILTER = 0x2801;
int TEXTURE_MAG_FILTER = 0x2800;
int TEXTURE_WRAP_S = 0x2802;
int TEXTURE_WRAP_T = 0x2803;
int NEAREST = 0x2600;
int LINEAR = 0x2601;
int LINEAR_MIPMAP_LINEAR = 0x2703;
int REPEAT = 0x2901;
int CLAMP_TO_EDGE = 0x812F;
int ARRAY_BUFFER = 0x8892;
int STATIC_DRAW = 0x88E4;
int STREAM_DRAW = 0x88E0;
int FRAMEBUFFER = 0x8D40;
int RENDERBUFFER = 0x8D41;
int COLOR_ATTACHMENT0 = 0x8CE0;
int DEPTH_ATTACHMENT = 0x8D00;
int NONE = 0;
int VERTEX_SHADER = 0x8B31;
int FRAGMENT_SHADER = 0x8B30;
int COMPILE_STATUS = 0x8B81;
int LINK_STATUS = 0x8B82;
interface Buffer extends JSObject {}
interface Framebuffer extends JSObject {}
interface Renderbuffer extends JSObject {}
interface Program extends JSObject {}
interface Shader extends JSObject {}
interface Texture extends JSObject {}
interface UniformLocation extends JSObject {}
@JSBody(params = {"canvas"}, script =
"return canvas.getContext('webgl2', { alpha: true, antialias: false, preserveDrawingBuffer: false });")
static WebGL2 getContext(HTMLCanvasElement canvas) {
return null;
}
void viewport(int x, int y, int width, int height);
void clearColor(float r, float g, float b, float a);
void clear(int mask);
void enable(int cap);
void disable(int cap);
void depthFunc(int func);
void depthMask(boolean flag);
void blendFunc(int sfactor, int dfactor);
void polygonOffset(float factor, float units);
Shader createShader(int type);
void shaderSource(Shader shader, String source);
void compileShader(Shader shader);
boolean getShaderParameter(Shader shader, int pname);
String getShaderInfoLog(Shader shader);
void deleteShader(Shader shader);
Program createProgram();
void attachShader(Program program, Shader shader);
void linkProgram(Program program);
boolean getProgramParameter(Program program, int pname);
String getProgramInfoLog(Program program);
void useProgram(Program program);
UniformLocation getUniformLocation(Program program, String name);
void uniform1i(UniformLocation loc, int v);
void uniform1f(UniformLocation loc, float v);
void uniform3f(UniformLocation loc, float x, float y, float z);
void uniform4fv(UniformLocation loc, Float32Array v);
void uniformMatrix4fv(UniformLocation loc, boolean transpose, Float32Array value);
Buffer createBuffer();
void bindBuffer(int target, Buffer buffer);
void bufferData(int target, int size, int usage);
void bufferData(int target, Float32Array data, int usage);
void bufferSubData(int target, int offset, Float32Array data);
void enableVertexAttribArray(int index);
void disableVertexAttribArray(int index);
void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, int offset);
void drawArrays(int mode, int first, int count);
Texture createTexture();
void activeTexture(int texture);
void bindTexture(int target, Texture texture);
void texParameteri(int target, int pname, int param);
void texImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, Uint8Array pixels);
void texImage3D(int target, int level, int internalformat, int width, int height, int depth, int border, int format, int type, Uint8Array pixels);
void generateMipmap(int target);
Framebuffer createFramebuffer();
void bindFramebuffer(int target, Framebuffer fb);
void framebufferTexture2D(int target, int attachment, int textarget, Texture texture, int level);
Renderbuffer createRenderbuffer();
void bindRenderbuffer(int target, Renderbuffer rb);
void renderbufferStorage(int target, int internalformat, int width, int height);
void framebufferRenderbuffer(int target, int attachment, int renderbuffertarget, Renderbuffer rb);
void drawBuffers(int[] buffers);
void readPixels(int x, int y, int width, int height, int format, int type, Uint8Array pixels);
}