- ra3.webgl: a Web peer of Vulkan/Direct3D (SDL3 canvas + GLES3/WebGL2), with 2D blit and the GPU terrain raymarch; GLSL ES shaders; null fallback off Emscripten. backend::webgl + default_backend() (webgl under Emscripten). - Emscripten toolchain + Dockerfile.wasm + scripts/build-wasm.sh; import std, global -fexceptions, and Asyncify so the blocking frame loop yields to the browser (display::sleep_frame calls emscripten_sleep). - apps/web/shell.html + apps/web/serve.py (Range-capable dev server). - Assets: browsers forbid synchronous on-demand reads on the main thread (and FS.createLazyFile / the WasmFS fetch backend are worker-only; SDL3's Emscripten backend is main-thread DOM only, so the engine cannot run in a worker). The wasm build therefore preloads a compact per-map set via OPENRA3_WEB_ASSETS. - New openra3 textures --map ID lists the loose terrain TGAs a map resolves to (terrain::resolve_texture_files, shared with load_textures_from_dir). - Fixes: webgl heightmap used GL_R16 = 0x8229 (that is R8) -> upload rejected, terrain flattened to water; now 0x822A. Logger uses a stdout console sink on the web (stderr maps to console.error); a GL error check logs bad uploads. - CI: wasm image + build jobs.
34 lines
1.4 KiB
HTML
34 lines
1.4 KiB
HTML
<!doctype html>
|
|
<!-- Emscripten shell for OpenRA3. SDL3 (built for Emscripten) renders into the
|
|
canvas element below; the SCRIPT placeholder is replaced by the generated
|
|
loader. Note: the shell preprocessor treats a leading hash as a directive,
|
|
so do not begin a line with one. -->
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
|
<title>OpenRA3</title>
|
|
<style>
|
|
html, body { margin: 0; height: 100%; background: #1a0a08; overflow: hidden; }
|
|
#canvas { display: block; width: 100vw; height: 100vh; outline: none; }
|
|
#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
|
|
color: #ecbe50; font: 16px/1.4 monospace; pointer-events: none; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<canvas id="canvas" tabindex="-1" oncontextmenu="event.preventDefault()"></canvas>
|
|
<div id="loading">Loading OpenRA3…</div>
|
|
<script>
|
|
// Emscripten merges this into the generated Module; drop the loading
|
|
// placeholder once the runtime is up.
|
|
var Module = {
|
|
onRuntimeInitialized: function () {
|
|
var el = document.getElementById('loading');
|
|
if (el) el.remove();
|
|
}
|
|
};
|
|
</script>
|
|
{{{ SCRIPT }}}
|
|
</body>
|
|
</html>
|