refactor(web): rename 117HD WebGL2 renderer and UI references to 317HD

Renames `WebHd117Renderer` and all remaining `117HD` symbols, build exclusions, and UI labels in `2006Scape-Web` to `317HD`.

### WebGL2 Renderer & Build
- `WebHd317Renderer.java`:
  - Renamed from `WebHd117Renderer.java` and updated class/log references to `WebHd317Renderer` / `317HD`.
- `build.gradle`, `WebLauncher.java`, `RSImageProducer.java`, `DesktopHooks.java`, `WebGL2.java`:
  - Updated `DesktopHd117Renderer.java` exclusion to `DesktopHd317Renderer.java` and updated pipeline/renderer call sites to `HD317Pipeline` and `WebHd317Renderer`.
- `src/main/webapp/index.html`:
  - Updated UI label from `117HD (WebGL2)` to `317HD (WebGL2)`.
This commit is contained in:
Dark98 committed 2026-11-30 21:57:21 +00:00
1 parent 33235cec55
commit ededb882a0
7 files changed
+48 -48

No files matched your search

@@ -12,7 +12,7 @@ import org.teavm.jso.typedarrays.Uint8ClampedArray;
/**
* Web implementation of DesktopHooks for TeaVM.
* Bridges audio (Web Audio + SpessaSynth), clipboard, screenshots, and 117HD backend init.
* Bridges audio (Web Audio + SpessaSynth), clipboard, screenshots, and 317HD backend init.
*/
public final class DesktopHooks {
@@ -164,10 +164,10 @@ public final class DesktopHooks {
HTMLCanvasElement canvas = RSImageProducer.getCanvas();
if (canvas == null) return;
Uint8ClampedArray rgba = toRgbaOpaque(minimapPixels, 172 * 156);
boolean toGpu = WebHd117Renderer.ensureOverlayReady();
boolean toGpu = WebHd317Renderer.ensureOverlayReady();
HTMLCanvasElement hudC = jsDrawModernMinimap(canvas, rgba, windowWidth, !toGpu);
if (toGpu && hudC != null) {
WebHd117Renderer.drawHudCanvas(hudC, windowWidth - 249, 0, 249, 168);
WebHd317Renderer.drawHudCanvas(hudC, windowWidth - 249, 0, 249, 168);
}
}
@@ -179,10 +179,10 @@ public final class DesktopHooks {
? toRgbaOpaque(chatContentPixels, 479 * 96) : null;
Uint8ClampedArray buttonsRgba = (chatButtonsPixels != null && chatButtonsPixels.length >= 496 * 50)
? toRgbaOpaque(chatButtonsPixels, 496 * 50) : null;
boolean toGpu = WebHd117Renderer.ensureOverlayReady();
boolean toGpu = WebHd317Renderer.ensureOverlayReady();
HTMLCanvasElement hudC = jsDrawModernChat(canvas, contentRgba, buttonsRgba, windowHeight, !toGpu);
if (toGpu && hudC != null) {
WebHd117Renderer.drawHudCanvas(hudC, 0, windowHeight - 165, 519, 165);
WebHd317Renderer.drawHudCanvas(hudC, 0, windowHeight - 165, 519, 165);
}
}
@@ -248,10 +248,10 @@ public final class DesktopHooks {
rgba.set(j + 3, (short) 0);
}
}
boolean toGpu = WebHd117Renderer.ensureOverlayReady();
boolean toGpu = WebHd317Renderer.ensureOverlayReady();
HTMLCanvasElement hudC = jsDrawModernTab(canvas, rgba, windowWidth - 249, windowHeight - 343, !toGpu);
if (toGpu && hudC != null) {
WebHd117Renderer.drawHudCanvas(hudC, windowWidth - 249, windowHeight - 343, 249, 343);
WebHd317Renderer.drawHudCanvas(hudC, windowWidth - 249, windowHeight - 343, 249, 343);
}
}
@@ -304,7 +304,7 @@ public final class DesktopHooks {
double minScale = Math.max(1.0, Math.max(765.0 / rawW, 503.0 / rawH));
int w = Math.max(765, (int) Math.round(rawW * minScale));
int h = Math.max(503, (int) Math.round(rawH * minScale));
boolean fullRes = "true".equalsIgnoreCase(getParameter("fullres")) || HD117Pipeline.isGpuActive();
boolean fullRes = "true".equalsIgnoreCase(getParameter("fullres")) || HD317Pipeline.isGpuActive();
if (!fullRes && w > 1280) {
w = 1280;
h = Math.max(503, (int) Math.round(rawH * (1280.0 / rawW)));
@@ -479,8 +479,8 @@ public final class DesktopHooks {
private static native void jsRedrawScaledLogin(HTMLCanvasElement canvas, int winW, int winH, int dx, int dy, int dw, int dh);
public static void initHdBackend() {
if (HD117Pipeline.backend == null) {
HD117Pipeline.backend = new WebHd117Renderer();
if (HD317Pipeline.backend == null) {
HD317Pipeline.backend = new WebHd317Renderer();
}
}
@@ -81,13 +81,13 @@ public final class RSImageProducer {
}
ensureCanvas();
if (ctx2d == null) return;
boolean gpuViewport = HD117Pipeline.isGpuActive() && anInt316 == ClientSettings.VIEWPORT_WIDTH && anInt317 == ClientSettings.VIEWPORT_HEIGHT;
if (WebHd117Renderer.ensureOverlayReady()) {
boolean gpuViewport = HD317Pipeline.isGpuActive() && anInt316 == ClientSettings.VIEWPORT_WIDTH && anInt317 == ClientSettings.VIEWPORT_HEIGHT;
if (WebHd317Renderer.ensureOverlayReady()) {
if (!cleared2dForGpu && canvas != null) {
ctx2d.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
cleared2dForGpu = true;
}
WebHd117Renderer.drawHudPixels(anIntArray315, x, y, anInt316, anInt317, gpuViewport);
WebHd317Renderer.drawHudPixels(anIntArray315, x, y, anInt316, anInt317, gpuViewport);
return;
}
cleared2dForGpu = false;
+1 -1
View File
@@ -7,7 +7,7 @@ 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.
* TeaVM JSO bindings for WebGL 2.0 (OpenGL ES 3.0) used by WebHd317Renderer.
*/
public interface WebGL2 extends JSObject {
@@ -14,10 +14,10 @@ import java.nio.ByteOrder;
import java.util.Arrays;
/**
* WebGL 2.0 (GLSL ES 3.00) 117HD Hardware Renderer for 2006Scape-Web.
* Reuses HD117Pipeline shaders, HdSceneUploader, HdMaterial, and HdProceduralGenerator.
* WebGL 2.0 (GLSL ES 3.00) 317HD Hardware Renderer for 2006Scape-Web.
* Reuses HD317Pipeline shaders, HdSceneUploader, HdMaterial, and HdProceduralGenerator.
*/
public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
public final class WebHd317Renderer implements HD317Pipeline.HdRendererBackend {
private static final String OVERLAY_VERT =
"#version 300 es\n" +
@@ -39,7 +39,7 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
" fragColor = texture(uTex, vUv);\n" +
"}\n";
private static WebHd117Renderer instance = null;
private static WebHd317Renderer instance = null;
private int shadowMapSize = 1024;
private static final boolean IS_IOS = jsIsIos();
private final HdProceduralGenerator procGen = new HdProceduralGenerator();
@@ -144,7 +144,7 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
private ObjectManager lastObjectManager = null;
private WorldController lastWorldController = null;
public WebHd117Renderer() {
public WebHd317Renderer() {
instance = this;
float len = (float) Math.sqrt(sunDir[0] * sunDir[0] + sunDir[1] * sunDir[1] + sunDir[2] * sunDir[2]);
sunDir[0] /= len;
@@ -167,7 +167,7 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
sceneUploader.setSceneContext(procGen, worldController);
sceneLoaded = true;
} catch (Throwable t) {
System.err.println("[WebHd117Renderer] Error generating scene data: " + t.getMessage());
System.err.println("[WebHd317Renderer] Error generating scene data: " + t.getMessage());
}
}
@@ -272,8 +272,8 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
computeCameraAndLightMatrices(width, height);
selectActiveLights();
boolean shadowsOn = HD117Pipeline.cfgShadowsEnabled && !IS_IOS;
int desiredShadowSize = IS_IOS ? 512 : HD117Pipeline.cfgShadowResolution;
boolean shadowsOn = HD317Pipeline.cfgShadowsEnabled && !IS_IOS;
int desiredShadowSize = IS_IOS ? 512 : HD317Pipeline.cfgShadowResolution;
if (shadowsOn && desiredShadowSize != shadowMapSize &&
(desiredShadowSize == 512 || desiredShadowSize == 1024 || desiredShadowSize == 2048)) {
shadowMapSize = desiredShadowSize;
@@ -345,7 +345,7 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
gl.disable(WebGL2.POLYGON_OFFSET_FILL);
}
// Pass 2: Main 117HD Scene directly onto #gl-canvas default framebuffer (zero readPixels!)
// Pass 2: Main 317HD Scene directly onto #gl-canvas default framebuffer (zero readPixels!)
int targetCanvasW = ClientSettings.isDesktopModern() ? width : 765;
int targetCanvasH = ClientSettings.isDesktopModern() ? height : 503;
if (glCanvas.getWidth() != targetCanvasW || glCanvas.getHeight() != targetCanvasH
@@ -382,18 +382,18 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
gl.uniform3f(uSceneAmbientColor, ambientColor[0], ambientColor[1], ambientColor[2]);
gl.uniform3f(uSceneSkyColor, skyColor[0], skyColor[1], skyColor[2]);
gl.uniform3f(uSceneFogColor, fogColor[0], fogColor[1], fogColor[2]);
gl.uniform1f(uSceneFogMin, HD117Pipeline.cfgAtmosphericFog ? fogMin : 999999.0f);
gl.uniform1f(uSceneFogMax, HD117Pipeline.cfgAtmosphericFog ? fogMax : 1000000.0f);
gl.uniform1f(uSceneFogMin, HD317Pipeline.cfgAtmosphericFog ? fogMin : 999999.0f);
gl.uniform1f(uSceneFogMax, HD317Pipeline.cfgAtmosphericFog ? fogMax : 1000000.0f);
gl.uniform1f(uSceneTime, (System.currentTimeMillis() - startTimeMs) * 0.001f);
gl.uniform1f(uSceneShadowTexelSize, 1.0f / shadowMapSize);
gl.uniform1i(uSceneShadowsEnabled, shadowsOn ? 1 : 0);
gl.uniform1i(uSceneShadowSoftPcf, HD117Pipeline.cfgShadowSoftPcf ? 1 : 0);
gl.uniform1i(uSceneGroundTextures, HD117Pipeline.cfgGroundTextures ? 1 : 0);
gl.uniform1i(uSceneNormalMapping, HD117Pipeline.cfgNormalMapping ? 1 : 0);
gl.uniform1i(uSceneWaterShader, HD117Pipeline.cfgWaterShader ? 1 : 0);
gl.uniform1f(uSceneSaturation, HD117Pipeline.cfgSaturation);
gl.uniform1f(uSceneBrightness, HD117Pipeline.cfgBrightness);
gl.uniform1i(uSceneContrastCurve, HD117Pipeline.cfgContrastCurve ? 1 : 0);
gl.uniform1i(uSceneShadowSoftPcf, HD317Pipeline.cfgShadowSoftPcf ? 1 : 0);
gl.uniform1i(uSceneGroundTextures, HD317Pipeline.cfgGroundTextures ? 1 : 0);
gl.uniform1i(uSceneNormalMapping, HD317Pipeline.cfgNormalMapping ? 1 : 0);
gl.uniform1i(uSceneWaterShader, HD317Pipeline.cfgWaterShader ? 1 : 0);
gl.uniform1f(uSceneSaturation, HD317Pipeline.cfgSaturation);
gl.uniform1f(uSceneBrightness, HD317Pipeline.cfgBrightness);
gl.uniform1i(uSceneContrastCurve, HD317Pipeline.cfgContrastCurve ? 1 : 0);
gl.uniform1i(uSceneLightCount, activeLightCount);
if (activeLightCount > 0) {
@@ -471,7 +471,7 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
loggedFirstFrame = true;
int err = getGlError(gl);
if (err != 0) {
RSApplet.appendLog("[WebHd117Renderer] glErr=" + err);
RSApplet.appendLog("[WebHd317Renderer] glErr=" + err);
}
}
// Clear dstPixels to sentinel 0x010203 (transparent) so 0x000000 black UI/shadows stay opaque on #game-canvas above #gl-canvas
@@ -630,9 +630,9 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
return false;
}
shadowProgram = createProgram(HD117Pipeline.SHADOW_VERT, HD117Pipeline.SHADOW_FRAG);
String sceneFragRgba = HD117Pipeline.SCENE_FRAG_DIRECT.replace("col.b, col.g, col.r", "col.r, col.g, col.b");
sceneProgram = createProgram(HD117Pipeline.SCENE_VERT, sceneFragRgba);
shadowProgram = createProgram(HD317Pipeline.SHADOW_VERT, HD317Pipeline.SHADOW_FRAG);
String sceneFragRgba = HD317Pipeline.SCENE_FRAG_DIRECT.replace("col.b, col.g, col.r", "col.r, col.g, col.b");
sceneProgram = createProgram(HD317Pipeline.SCENE_VERT, sceneFragRgba);
if (shadowProgram == null || sceneProgram == null) {
glFailed = true;
return false;
@@ -698,7 +698,7 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
glInitialized = true;
return true;
} catch (Throwable t) {
RSApplet.appendLog("[WebHd117Renderer] WebGL2 init failed: " + t);
RSApplet.appendLog("[WebHd317Renderer] WebGL2 init failed: " + t);
glFailed = true;
return false;
}
@@ -711,7 +711,7 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
public static boolean ensureOverlayReady() {
if (isOverlayReady()) return true;
if (instance == null) {
new WebHd117Renderer();
new WebHd317Renderer();
}
return instance.ensureOverlayContext();
}
@@ -819,7 +819,7 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
gl.attachShader(prog, fs);
gl.linkProgram(prog);
if (!gl.getProgramParameter(prog, WebGL2.LINK_STATUS)) {
RSApplet.appendLog("[WebHd117Renderer] Link error: " + gl.getProgramInfoLog(prog));
RSApplet.appendLog("[WebHd317Renderer] Link error: " + gl.getProgramInfoLog(prog));
return null;
}
return prog;
@@ -834,7 +834,7 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
gl.shaderSource(shader, src);
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, WebGL2.COMPILE_STATUS)) {
RSApplet.appendLog("[WebHd117Renderer] Shader error: " + gl.getShaderInfoLog(shader));
RSApplet.appendLog("[WebHd317Renderer] Shader error: " + gl.getShaderInfoLog(shader));
gl.deleteShader(shader);
return null;
}
@@ -915,7 +915,7 @@ public final class WebHd117Renderer implements HD117Pipeline.HdRendererBackend {
private void selectActiveLights() {
activeLightCount = 0;
if (!HD117Pipeline.cfgDynamicLights) return;
if (!HD317Pipeline.cfgDynamicLights) return;
int total = procGen.sceneLightCount;
if (total <= 0) return;
@@ -7,7 +7,7 @@ import org.teavm.jso.typedarrays.Uint8Array;
/**
* TeaVM browser entrypoint for 2006Scape-Web.
* Preloads the 377 cache via IndexedDB / HTTP fetch, initializes 117HD WebGL2, and boots Game.
* Preloads the 377 cache via IndexedDB / HTTP fetch, initializes 317HD WebGL2, and boots Game.
*/
public final class WebLauncher {
@@ -49,11 +49,11 @@ public final class WebLauncher {
String hdParam = DesktopHooks.getParameter("hd");
String optHd = getSavedOption("hd");
if ("true".equalsIgnoreCase(hdParam) || "1".equals(hdParam)) {
ClientSettings.HD_117 = true;
ClientSettings.HD_317 = true;
} else if ("false".equalsIgnoreCase(hdParam) || "0".equals(hdParam)) {
ClientSettings.HD_117 = false;
ClientSettings.HD_317 = false;
} else if ("true".equalsIgnoreCase(optHd)) {
ClientSettings.HD_117 = true;
ClientSettings.HD_317 = true;
}
String resizeParam = DesktopHooks.getParameter("resize");
String optMode = getSavedOption("displayMode");
@@ -80,7 +80,7 @@ public final class WebLauncher {
// Keep desktop/mouse layout in browser; Signlink.mainapp non-null routes sockets via Signlink.opensocket()
ClientSettings.ANDROID = false;
Signlink.mainapp = new Object();
HD117Pipeline.useStaticScenery = true;
HD317Pipeline.useStaticScenery = true;
DesktopHooks.initHdBackend();
RSApplet.updateLoadingOverlay(10, "Loading 377 cache from IndexedDB / HTTP...");