v0.7.0: SDL-free wasm worker backend (WebGPU + WebGL2) with on-demand assets
The engine now runs on a plain Web Worker (no SDL, no PROXY_TO_PTHREAD: in a pthread Emscripten proxies every filesystem syscall to the main browser thread, where synchronous XHR - and thus FS.createLazyFile - is forbidden). A page/worker pair transfers an OffscreenCanvas and forwards DOM input; assets load lazily from an embedded manifest, so entering a map fetches only that map and its tiles. Presentation: ra3.webgpu (WebGPU via Emscripten's emdawnwebgpu port, WGSL shaders, the default on wasm) and ra3.wasmgl (WebGL2, GLSL ES). The legacy SDL ra3.webgl backend is removed.
This commit is contained in:
@@ -130,17 +130,19 @@ float4 PSMain(VSOut input) : SV_Target {
|
||||
return float4(sky_color(dir), 1.0);
|
||||
}
|
||||
|
||||
// March the heightfield (bounded work: the step grows toward the horizon).
|
||||
// March the heightfield. The step grows quickly: the map diagonal is only
|
||||
// ~9000 world units, so marching past ~20000 adds cost without detail, and
|
||||
// a 6% growth rate more than doubles the worst-case iteration count.
|
||||
float t = CELL * 0.5;
|
||||
float dt = CELL * 0.5;
|
||||
float prev = t;
|
||||
bool hit = false;
|
||||
float hit_t = 0.0;
|
||||
for (int i = 0; i < 512 && t < 60000.0; ++i) {
|
||||
for (int i = 0; i < 256 && t < 20000.0; ++i) {
|
||||
float3 w = cam_pos + dir * t;
|
||||
if (w.x < 0.0 || w.y < 0.0 || w.x >= world_w || w.y >= world_h) {
|
||||
prev = t;
|
||||
dt *= 1.06;
|
||||
dt *= 1.10;
|
||||
t += dt;
|
||||
continue;
|
||||
}
|
||||
@@ -155,7 +157,7 @@ float4 PSMain(VSOut input) : SV_Target {
|
||||
break;
|
||||
}
|
||||
prev = t;
|
||||
dt *= 1.06;
|
||||
dt *= 1.10;
|
||||
t += dt;
|
||||
}
|
||||
if (!hit) {
|
||||
|
||||
Reference in New Issue
Block a user