@driftengine/core 3.61.2 → 3.61.4
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEPTH_CLEAR } from '../../depthConvention.js';
|
|
1
2
|
import { DEPTH_FORMAT } from './flatPass.js';
|
|
2
3
|
import { shaderModule } from './shaderModules.js';
|
|
3
4
|
/**
|
|
@@ -9,7 +10,10 @@ import { shaderModule } from './shaderModules.js';
|
|
|
9
10
|
* depth that way would silently un-occlude everything a scene draws *after* `endInset`.
|
|
10
11
|
*
|
|
11
12
|
* So the rect is drawn rather than cleared: one quad at the far plane, depth always written,
|
|
12
|
-
* colour written or masked off depending on whether the caller asked for a colour.
|
|
13
|
+
* colour written or masked off depending on whether the caller asked for a colour. **Which end of
|
|
14
|
+
* the buffer "the far plane" is comes from `depthConvention.ts`** and not from this file: depth is
|
|
15
|
+
* reversed here, and a quad that names the conventional end clears the inset to the *near* plane
|
|
16
|
+
* and makes it undrawable. See the note at the return.
|
|
13
17
|
*
|
|
14
18
|
* **Its own shader, and it is allowed to be.** This is not generated from GLSL and has no
|
|
15
19
|
* WebGL2 counterpart to stay honest against — the counterpart is `gl.clear`. The mip blit in
|
|
@@ -41,8 +45,24 @@ fn vertexMain(@builtin(vertex_index) index: u32) -> @builtin(position) vec4<f32>
|
|
|
41
45
|
vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0), vec2<f32>(0.0, 1.0),
|
|
42
46
|
);
|
|
43
47
|
let ndc = corner[index] * 2.0 - vec2<f32>(1.0, 1.0);
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
/*
|
|
49
|
+
* **The far plane, interpolated from the convention rather than written down.**
|
|
50
|
+
*
|
|
51
|
+
* This said \`1.0\`, under a comment calling it "the far plane, which is what a depth clear
|
|
52
|
+
* writes". That is true of a conventional depth buffer and this engine reverses depth, where
|
|
53
|
+
* 1.0 is the *near* plane and the compare is \`greater\`. The quad is drawn with
|
|
54
|
+
* \`depthCompare: 'always'\` and depth writes on, so it stamped the nearest possible value
|
|
55
|
+
* across the whole inset and every mesh drawn between \`beginInset\` and \`endInset\` failed
|
|
56
|
+
* the test against it: the box came out holding its clear colour and nothing else, on WebGPU
|
|
57
|
+
* only, with nothing logged. Reported from a game as two empty boxes on two menu screens, both
|
|
58
|
+
* of them the places it draws an inset.
|
|
59
|
+
*
|
|
60
|
+
* It is the mistake \`glslFarDepth\` exists because the sky made — a full-screen triangle at
|
|
61
|
+
* \`z = w\`, the far plane conventionally and the near plane once reversed. \`DEPTH_CLEAR\` is
|
|
62
|
+
* the same number by definition: what a depth attachment is cleared to, which is what a quad
|
|
63
|
+
* standing in for a depth clear must write.
|
|
64
|
+
*/
|
|
65
|
+
return vec4<f32>(ndc, ${DEPTH_CLEAR}.0, 1.0);
|
|
46
66
|
}
|
|
47
67
|
|
|
48
68
|
@fragment
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driftengine/core",
|
|
3
|
-
"version": "3.61.
|
|
3
|
+
"version": "3.61.4",
|
|
4
4
|
"description": "DriftEngine reusable browser 3D runtime",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"sideEffects": false,
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@driftengine/drft": "3.61.
|
|
33
|
-
"@driftengine/physics": "3.61.
|
|
32
|
+
"@driftengine/drft": "3.61.4",
|
|
33
|
+
"@driftengine/physics": "3.61.4",
|
|
34
34
|
"gl-matrix": "^3.4.3"
|
|
35
35
|
},
|
|
36
36
|
"author": "Drift Technologies",
|
|
@@ -58,5 +58,8 @@
|
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"prepack": "node ../../scripts/build.mjs @driftengine/core"
|
|
61
64
|
}
|
|
62
65
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PipelineCache } from './pipelineCache.ts';
|
|
2
|
+
import { DEPTH_CLEAR } from '../../depthConvention.ts';
|
|
2
3
|
import { DEPTH_FORMAT } from './flatPass.ts';
|
|
3
4
|
import { shaderModule } from './shaderModules.ts';
|
|
4
5
|
|
|
@@ -11,7 +12,10 @@ import { shaderModule } from './shaderModules.ts';
|
|
|
11
12
|
* depth that way would silently un-occlude everything a scene draws *after* `endInset`.
|
|
12
13
|
*
|
|
13
14
|
* So the rect is drawn rather than cleared: one quad at the far plane, depth always written,
|
|
14
|
-
* colour written or masked off depending on whether the caller asked for a colour.
|
|
15
|
+
* colour written or masked off depending on whether the caller asked for a colour. **Which end of
|
|
16
|
+
* the buffer "the far plane" is comes from `depthConvention.ts`** and not from this file: depth is
|
|
17
|
+
* reversed here, and a quad that names the conventional end clears the inset to the *near* plane
|
|
18
|
+
* and makes it undrawable. See the note at the return.
|
|
15
19
|
*
|
|
16
20
|
* **Its own shader, and it is allowed to be.** This is not generated from GLSL and has no
|
|
17
21
|
* WebGL2 counterpart to stay honest against — the counterpart is `gl.clear`. The mip blit in
|
|
@@ -43,8 +47,24 @@ fn vertexMain(@builtin(vertex_index) index: u32) -> @builtin(position) vec4<f32>
|
|
|
43
47
|
vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0), vec2<f32>(0.0, 1.0),
|
|
44
48
|
);
|
|
45
49
|
let ndc = corner[index] * 2.0 - vec2<f32>(1.0, 1.0);
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
/*
|
|
51
|
+
* **The far plane, interpolated from the convention rather than written down.**
|
|
52
|
+
*
|
|
53
|
+
* This said \`1.0\`, under a comment calling it "the far plane, which is what a depth clear
|
|
54
|
+
* writes". That is true of a conventional depth buffer and this engine reverses depth, where
|
|
55
|
+
* 1.0 is the *near* plane and the compare is \`greater\`. The quad is drawn with
|
|
56
|
+
* \`depthCompare: 'always'\` and depth writes on, so it stamped the nearest possible value
|
|
57
|
+
* across the whole inset and every mesh drawn between \`beginInset\` and \`endInset\` failed
|
|
58
|
+
* the test against it: the box came out holding its clear colour and nothing else, on WebGPU
|
|
59
|
+
* only, with nothing logged. Reported from a game as two empty boxes on two menu screens, both
|
|
60
|
+
* of them the places it draws an inset.
|
|
61
|
+
*
|
|
62
|
+
* It is the mistake \`glslFarDepth\` exists because the sky made — a full-screen triangle at
|
|
63
|
+
* \`z = w\`, the far plane conventionally and the near plane once reversed. \`DEPTH_CLEAR\` is
|
|
64
|
+
* the same number by definition: what a depth attachment is cleared to, which is what a quad
|
|
65
|
+
* standing in for a depth clear must write.
|
|
66
|
+
*/
|
|
67
|
+
return vec4<f32>(ndc, ${DEPTH_CLEAR}.0, 1.0);
|
|
48
68
|
}
|
|
49
69
|
|
|
50
70
|
@fragment
|