@driftengine/core 4.1.4 → 4.1.5
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/CHANGELOG.json +3796 -3770
- package/dist/render/backend/webgl2/renderer.d.ts +15 -0
- package/dist/render/backend/webgl2/renderer.js +28 -7
- package/dist/render/backend/webgpu/pointShadowPass.d.ts +4 -0
- package/dist/render/backend/webgpu/pointShadowPass.js +10 -0
- package/dist/render/backend/webgpu/renderer.js +7 -2
- package/dist/render/depthConvention.d.ts +19 -0
- package/dist/render/depthConvention.js +21 -0
- package/dist/render/livePointShadowSet.js +8 -0
- package/dist/render/pointShadowBudget.js +59 -5
- package/dist/render/pointShadowImage.d.ts +40 -0
- package/dist/render/pointShadowImage.js +20 -0
- package/dist/render/pointShadowMap.d.ts +4 -0
- package/dist/render/pointShadowMap.js +10 -0
- package/dist/render/pointShadowSystem.js +9 -0
- package/dist/render/renderQuality.d.ts +27 -4
- package/dist/render/renderQuality.js +1 -1
- package/dist/render/shaders/flat/main.d.ts +1 -1
- package/dist/render/shaders/flat/main.js +13 -5
- package/dist/render/shaders/flat/pointShadow.d.ts +1 -1
- package/dist/render/shaders/flat/pointShadow.js +42 -30
- package/dist/render/shaders/flat/preamble.js +26 -2
- package/dist/render/shaders/generated/flat.wgsl.d.ts +16 -16
- package/dist/render/shaders/generated/flat.wgsl.js +24 -24
- package/dist/render/shaders/sky.d.ts +10 -6
- package/dist/render/shaders/sky.js +35 -2
- package/package.json +6 -6
- package/src/render/backend/webgl2/renderer.ts +28 -7
- package/src/render/backend/webgpu/pointShadowPass.ts +13 -0
- package/src/render/backend/webgpu/renderer.ts +12 -2
- package/src/render/depthConvention.ts +22 -0
- package/src/render/livePointShadowSet.ts +7 -0
- package/src/render/pointShadowBudget.ts +58 -5
- package/src/render/pointShadowImage.ts +51 -0
- package/src/render/pointShadowMap.ts +13 -0
- package/src/render/pointShadowSystem.ts +8 -0
- package/src/render/renderQuality.ts +28 -5
- package/src/render/shaders/flat/main.ts +13 -5
- package/src/render/shaders/flat/pointShadow.ts +42 -30
- package/src/render/shaders/flat/preamble.ts +26 -2
- package/src/render/shaders/generated/flat.wgsl.ts +24 -24
- package/src/render/shaders/sky.ts +37 -2
|
@@ -7,7 +7,24 @@ import { glslFarDepth } from '../depthConvention.ts';
|
|
|
7
7
|
* interpolated rather than written. A sky that says 1.0 in a reversed engine is drawn at the
|
|
8
8
|
* *near* plane and covers the world; measured, that was 743,669 changed pixels of 921,600.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The source, as a function of which way depth actually runs.
|
|
12
|
+
*
|
|
13
|
+
* **Because on WebGL2 that is a runtime fact and this file is imported once.** Reversed depth there
|
|
14
|
+
* needs `EXT_clip_control`; a context that is not granted it runs conventional depth, and the
|
|
15
|
+
* renderer has a `reversedDepth` field saying so precisely because the two can disagree. This
|
|
16
|
+
* template used to bake `glslFarDepth()` at import, which reads the compile-time `REVERSED_DEPTH` —
|
|
17
|
+
* so on such a context the sky was written at `0.0` while the depth test ran conventionally, where
|
|
18
|
+
* `0.0` is the middle of the range rather than the far plane. The sky then beat everything in the
|
|
19
|
+
* far half of the scene.
|
|
20
|
+
*
|
|
21
|
+
* **Reported from Firefox on Linux, which exposes no `EXT_clip_control`**: the voxel sandbox drew
|
|
22
|
+
* only sky, the gilded chamber a single orange frame, and a consumer's world one flat colour with
|
|
23
|
+
* its interface still on top. Three symptoms, one cause, and the docstring above already named the
|
|
24
|
+
* mechanism in the other direction.
|
|
25
|
+
*/
|
|
26
|
+
function skySource(farDepth: string): string {
|
|
27
|
+
return `#version 300 es
|
|
11
28
|
const vec2 POS[3] = vec2[3](vec2(-1., -1.), vec2(3., -1.), vec2(-1., 3.));
|
|
12
29
|
|
|
13
30
|
out vec2 vNdc;
|
|
@@ -15,9 +32,27 @@ out vec2 vNdc;
|
|
|
15
32
|
void main() {
|
|
16
33
|
vNdc = POS[gl_VertexID];
|
|
17
34
|
/* The far plane, whichever way depth runs: see glslFarDepth. */
|
|
18
|
-
gl_Position = vec4(vNdc, ${
|
|
35
|
+
gl_Position = vec4(vNdc, ${farDepth}, 1.0);
|
|
19
36
|
}
|
|
20
37
|
`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The engine's own convention, which is what WebGPU always gets and what the WGSL is generated
|
|
42
|
+
* from. `scripts/wgsl.ts` reads this constant, so it stays a constant.
|
|
43
|
+
*/
|
|
44
|
+
export const SKY_VERT = skySource(glslFarDepth());
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The same shader for a context that may not have been granted reversed depth.
|
|
48
|
+
*
|
|
49
|
+
* WebGL2 compiles GLSL directly and is the only backend that can run either way, so it asks for
|
|
50
|
+
* the one matching what it got. WebGPU never calls this: it uses the generated WGSL, where the far
|
|
51
|
+
* plane is reversed by construction.
|
|
52
|
+
*/
|
|
53
|
+
export function skyVertFor(reversed: boolean): string {
|
|
54
|
+
return reversed ? SKY_VERT : skySource('1.0');
|
|
55
|
+
}
|
|
21
56
|
|
|
22
57
|
export const SKY_FRAG = `#version 300 es
|
|
23
58
|
precision highp float;
|