reze-engine 0.24.1 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/engine.d.ts +127 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +422 -34
- package/dist/gpu-profile.d.ts +19 -0
- package/dist/gpu-profile.d.ts.map +1 -0
- package/dist/gpu-profile.js +120 -0
- package/dist/graph/slots.d.ts.map +1 -1
- package/dist/graph/slots.js +10 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/physics/profile.d.ts +18 -0
- package/dist/physics/profile.d.ts.map +1 -0
- package/dist/physics/profile.js +44 -0
- package/dist/shaders/materials/common.d.ts +1 -1
- package/dist/shaders/materials/common.d.ts.map +1 -1
- package/dist/shaders/materials/common.js +143 -141
- package/dist/shaders/passes/composite.d.ts +23 -1
- package/dist/shaders/passes/composite.d.ts.map +1 -1
- package/dist/shaders/passes/composite.js +62 -16
- package/dist/shaders/passes/depth-prepass.d.ts +2 -0
- package/dist/shaders/passes/depth-prepass.d.ts.map +1 -0
- package/dist/shaders/passes/depth-prepass.js +56 -0
- package/dist/shaders/passes/ground.d.ts +1 -1
- package/dist/shaders/passes/ground.d.ts.map +1 -1
- package/dist/shaders/passes/ground.js +8 -0
- package/package.json +1 -1
- package/src/engine.ts +459 -34
- package/src/graph/slots.ts +11 -2
- package/src/index.ts +2 -0
- package/src/shaders/materials/common.ts +207 -205
- package/src/shaders/passes/composite.ts +89 -16
- package/src/shaders/passes/depth-prepass.ts +57 -0
- package/src/shaders/passes/ground.ts +8 -0
- package/dist/physics-debug.d.ts +0 -30
- package/dist/physics-debug.d.ts.map +0 -1
- package/dist/physics-debug.js +0 -526
- package/dist/shaders/passes/physics-debug.d.ts +0 -2
- package/dist/shaders/passes/physics-debug.d.ts.map +0 -1
- package/dist/shaders/passes/physics-debug.js +0 -69
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// Wireframe + solid overlay for physics rigid bodies (sphere / box / capsule).
|
|
2
|
-
// Rendered in its own pass after composite, straight to the swapchain — no
|
|
3
|
-
// MSAA, no depth, no MRT — so it sits cleanly on top of the tonemapped scene
|
|
4
|
-
// regardless of camera angle, model occlusion, or the composite alpha gate.
|
|
5
|
-
//
|
|
6
|
-
// SHAPE_KIND 0 = sphere → unit-sphere line/tri primitive scaled by size.x (radius)
|
|
7
|
-
// 1 = box → unit cube ±1 scaled by size.xyz (half-extents)
|
|
8
|
-
// 2 = capsule → unit cap+ring with per-vertex `axial` (-1/0/+1)
|
|
9
|
-
// that lifts cap rings/arcs ±halfHeight along Y;
|
|
10
|
-
// XZ scales by size.x (radius), Y by size.y/2.
|
|
11
|
-
// SOLID_ALPHA fragment alpha multiplier. Wireframe pipelines leave this at
|
|
12
|
-
// 1.0 for crisp edges; solid pipelines set it to ~0.2 so the fill
|
|
13
|
-
// stays gentle under stacked bodies.
|
|
14
|
-
export const PHYSICS_DEBUG_SHADER_WGSL = /* wgsl */ `
|
|
15
|
-
struct CameraUniforms {
|
|
16
|
-
view: mat4x4f,
|
|
17
|
-
projection: mat4x4f,
|
|
18
|
-
viewPos: vec3f,
|
|
19
|
-
_pad: f32,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
@group(0) @binding(0) var<uniform> camera: CameraUniforms;
|
|
23
|
-
|
|
24
|
-
override SHAPE_KIND: u32 = 0u;
|
|
25
|
-
override SOLID_ALPHA: f32 = 1.0;
|
|
26
|
-
|
|
27
|
-
struct VsIn {
|
|
28
|
-
@location(0) unit: vec4f, // xyz = unit pos; w = capsule axial anchor
|
|
29
|
-
@location(1) modelCol0: vec4f,
|
|
30
|
-
@location(2) modelCol1: vec4f,
|
|
31
|
-
@location(3) modelCol2: vec4f,
|
|
32
|
-
@location(4) modelCol3: vec4f,
|
|
33
|
-
@location(5) size: vec4f, // xyz = size; w unused
|
|
34
|
-
@location(6) color: vec4f,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
struct VsOut {
|
|
38
|
-
@builtin(position) pos: vec4f,
|
|
39
|
-
@location(0) color: vec4f,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
@vertex
|
|
43
|
-
fn vsMain(in: VsIn) -> VsOut {
|
|
44
|
-
let model = mat4x4f(in.modelCol0, in.modelCol1, in.modelCol2, in.modelCol3);
|
|
45
|
-
var local: vec3f;
|
|
46
|
-
if (SHAPE_KIND == 1u) {
|
|
47
|
-
local = in.unit.xyz * in.size.xyz;
|
|
48
|
-
} else if (SHAPE_KIND == 2u) {
|
|
49
|
-
// PMX capsule: size.x = radius, size.y = full cylinder height. Bullet 2.x's
|
|
50
|
-
// btCapsuleShape(radius, height) stores height/2 internally, so the actual
|
|
51
|
-
// collision cylinder spans ±size.y/2 — halve here to match.
|
|
52
|
-
let r = in.size.x;
|
|
53
|
-
let halfH = in.size.y * 0.5;
|
|
54
|
-
local = vec3f(in.unit.x * r, in.unit.y * r + halfH * in.unit.w, in.unit.z * r);
|
|
55
|
-
} else {
|
|
56
|
-
local = in.unit.xyz * in.size.x;
|
|
57
|
-
}
|
|
58
|
-
let world = model * vec4f(local, 1.0);
|
|
59
|
-
var out: VsOut;
|
|
60
|
-
out.pos = camera.projection * camera.view * world;
|
|
61
|
-
out.color = in.color;
|
|
62
|
-
return out;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@fragment
|
|
66
|
-
fn fsMain(in: VsOut) -> @location(0) vec4f {
|
|
67
|
-
return vec4f(in.color.rgb, in.color.a * SOLID_ALPHA);
|
|
68
|
-
}
|
|
69
|
-
`;
|