LordXido commited on
Commit
816d7cb
·
verified ·
1 Parent(s): b55e088

Update world.wgsl

Browse files
Files changed (1) hide show
  1. world.wgsl +16 -37
world.wgsl CHANGED
@@ -1,40 +1,19 @@
1
- // ===================================
2
- // CodexReality3D WebGPU Compute Kernel
3
- // ===================================
4
-
5
- @group(0) @binding(0)
6
- var<storage, read_write> field : array<f32>;
7
-
8
- struct Params {
9
- psi : f32,
10
- sigma : f32,
11
- width : u32,
12
- height: u32,
13
- };
14
-
15
- @group(0) @binding(1)
16
- var<uniform> params : Params;
17
-
18
- @compute @workgroup_size(8,8)
19
- fn main(@builtin(global_invocation_id) id : vec3<u32>) {
20
- let x = id.x;
21
- let y = id.y;
22
-
23
- if (x == 0u || y == 0u ||
24
- x >= params.width - 1u ||
25
- y >= params.height - 1u) {
26
- return;
27
  }
28
 
29
- let i = y * params.width + x;
30
-
31
- let v = field[i];
32
- let lap =
33
- field[i - 1u] +
34
- field[i + 1u] +
35
- field[i - params.width] +
36
- field[i + params.width] -
37
- 4.0 * v;
38
-
39
- field[i] = v + params.sigma * lap + params.psi;
40
  }
 
1
+ // world.js — v9.2
2
+ export class World {
3
+ constructor(gpu) {
4
+ this.gpu = gpu;
5
+ this.t = 0;
6
+
7
+ if (gpu.mode === "gpu") {
8
+ console.log("[World] GPU mode active");
9
+ // Future: bind pipelines here
10
+ } else {
11
+ console.log("[World] CPU mode active");
12
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
14
 
15
+ update(dt) {
16
+ this.t += dt;
17
+ // Deterministic state evolution hook
18
+ }
 
 
 
 
 
 
 
19
  }