@driftengine/script 4.3.0 → 4.4.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 +1 -1
- package/capabilities.json +26 -0
- package/dist/bindings/render.d.ts +1 -1
- package/dist/bindings/render.js +7 -1
- package/package.json +12 -12
- package/src/bindings/render.ts +12 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
The `drift/*` capability bindings: what this engine provides to DriftScript, and **the only place the
|
|
4
4
|
two are coupled**.
|
|
5
5
|
|
|
6
|
-
**Cost:
|
|
6
|
+
**Cost: 37.3 KB gzipped on top of core.** Measured by `scripts/size-gate.test.mjs`, which fails if it
|
|
7
7
|
drifts more than 3% — the number is derived from the same floors that gate asserts, so a README
|
|
8
8
|
quoting a stale one is a red suite rather than a thing somebody notices.
|
|
9
9
|
|
package/capabilities.json
CHANGED
|
@@ -5887,6 +5887,32 @@
|
|
|
5887
5887
|
"doc": "How much of the frame's bloom ceiling to take, 0 to 1. Held until changed. Does nothing when the quality profile's `bloom` is 0, because the chain is never built.",
|
|
5888
5888
|
"implementation": "drift/render.bloom"
|
|
5889
5889
|
},
|
|
5890
|
+
{
|
|
5891
|
+
"module": "drift/render",
|
|
5892
|
+
"name": "bloomAbove",
|
|
5893
|
+
"signature": "fn(renderer: Renderer, scale: f32, threshold: f32) -> void",
|
|
5894
|
+
"params": [
|
|
5895
|
+
{
|
|
5896
|
+
"name": "renderer",
|
|
5897
|
+
"type": "Renderer"
|
|
5898
|
+
},
|
|
5899
|
+
{
|
|
5900
|
+
"name": "scale",
|
|
5901
|
+
"type": "f32"
|
|
5902
|
+
},
|
|
5903
|
+
{
|
|
5904
|
+
"name": "threshold",
|
|
5905
|
+
"type": "f32"
|
|
5906
|
+
}
|
|
5907
|
+
],
|
|
5908
|
+
"returns": "void",
|
|
5909
|
+
"effects": [
|
|
5910
|
+
"scene.write"
|
|
5911
|
+
],
|
|
5912
|
+
"deterministic": false,
|
|
5913
|
+
"doc": "How much of the bloom ceiling to take, 0 to 1, and how bright a pixel must be before it blooms, in scene units, above 0. Both held until changed. The threshold is compared before exposure, so a script that moves `exposure` through a day moves this with it: pass the brightness wanted on screen over the exposure, or sunlit stone blooms at noon and lamps never do at night.",
|
|
5914
|
+
"implementation": "drift/render.bloomAbove"
|
|
5915
|
+
},
|
|
5890
5916
|
{
|
|
5891
5917
|
"module": "drift/render",
|
|
5892
5918
|
"name": "exposure",
|
|
@@ -23,7 +23,7 @@ export declare const RENDER_MODULE = "drift/render";
|
|
|
23
23
|
* from what the device can afford, and is clamped by `capabilityClamp` against what the adapter
|
|
24
24
|
* actually reports; a script that wrote to one would be overruling a decision made about hardware
|
|
25
25
|
* it cannot see, and two machines running the same script would draw different pictures for
|
|
26
|
-
* reasons the script did not choose. So this module binds the
|
|
26
|
+
* reasons the script did not choose. So this module binds the dials and none of the ceilings.
|
|
27
27
|
*
|
|
28
28
|
* ## Writes only, and the reason is the same one
|
|
29
29
|
*
|
package/dist/bindings/render.js
CHANGED
|
@@ -23,7 +23,7 @@ export const RENDER_MODULE = 'drift/render';
|
|
|
23
23
|
* from what the device can afford, and is clamped by `capabilityClamp` against what the adapter
|
|
24
24
|
* actually reports; a script that wrote to one would be overruling a decision made about hardware
|
|
25
25
|
* it cannot see, and two machines running the same script would draw different pictures for
|
|
26
|
-
* reasons the script did not choose. So this module binds the
|
|
26
|
+
* reasons the script did not choose. So this module binds the dials and none of the ceilings.
|
|
27
27
|
*
|
|
28
28
|
* ## Writes only, and the reason is the same one
|
|
29
29
|
*
|
|
@@ -72,6 +72,11 @@ const R = { name: 'renderer', type: 'Renderer' };
|
|
|
72
72
|
export const RENDER_CAPABILITIES = [
|
|
73
73
|
define('bloom', [R, { name: 'scale', type: 'f32' }], "How much of the frame's bloom ceiling to take, 0 to 1. Held until changed. Does nothing " +
|
|
74
74
|
"when the quality profile's `bloom` is 0, because the chain is never built."),
|
|
75
|
+
define('bloomAbove', [R, { name: 'scale', type: 'f32' }, { name: 'threshold', type: 'f32' }], 'How much of the bloom ceiling to take, 0 to 1, and how bright a pixel must be before it ' +
|
|
76
|
+
'blooms, in scene units, above 0. Both held until changed. The threshold is compared before ' +
|
|
77
|
+
'exposure, so a script that moves `exposure` through a day moves this with it: pass the ' +
|
|
78
|
+
'brightness wanted on screen over the exposure, or sunlit stone blooms at noon and lamps ' +
|
|
79
|
+
'never do at night.'),
|
|
75
80
|
define('exposure', [R, { name: 'stops', type: 'f32' }], "How far this frame is scaled into the tone curve, above 0. Replaces the profile's " +
|
|
76
81
|
'`outputExposure` for this frame onward. Adaptation is yours: a game knows it walked into a ' +
|
|
77
82
|
'cave, and the renderer could only find out a frame late. Ignored unless the output ' +
|
|
@@ -133,6 +138,7 @@ export const RENDER_CAPABILITIES = [
|
|
|
133
138
|
export function renderImplementation() {
|
|
134
139
|
return {
|
|
135
140
|
bloom: (renderer, scale) => renderer.setBloom(scale),
|
|
141
|
+
bloomAbove: (renderer, scale, threshold) => renderer.setBloom(scale, threshold),
|
|
136
142
|
exposure: (renderer, stops) => renderer.setOutputExposure(stops),
|
|
137
143
|
motionBlur: (renderer, scale) => renderer.setCameraMotionBlur(scale),
|
|
138
144
|
speedBlur: (renderer, strength) => renderer.setSpeedRush(strength),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driftengine/script",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "The drift/* capability bindings: what this engine provides to DriftScript, and the only place the two are coupled",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
"driftscript": "1.13.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@driftengine/ai": "4.
|
|
35
|
-
"@driftengine/animation": "4.
|
|
36
|
-
"@driftengine/audio": "4.
|
|
37
|
-
"@driftengine/chemistry": "4.
|
|
38
|
-
"@driftengine/core": "4.
|
|
39
|
-
"@driftengine/editor": "4.
|
|
40
|
-
"@driftengine/entities": "4.
|
|
41
|
-
"@driftengine/network": "4.
|
|
42
|
-
"@driftengine/terrain": "4.
|
|
43
|
-
"@driftengine/ui2d": "4.
|
|
44
|
-
"@driftengine/xr": "4.
|
|
34
|
+
"@driftengine/ai": "4.4.1",
|
|
35
|
+
"@driftengine/animation": "4.4.1",
|
|
36
|
+
"@driftengine/audio": "4.4.1",
|
|
37
|
+
"@driftengine/chemistry": "4.4.1",
|
|
38
|
+
"@driftengine/core": "4.4.1",
|
|
39
|
+
"@driftengine/editor": "4.4.1",
|
|
40
|
+
"@driftengine/entities": "4.4.1",
|
|
41
|
+
"@driftengine/network": "4.4.1",
|
|
42
|
+
"@driftengine/terrain": "4.4.1",
|
|
43
|
+
"@driftengine/ui2d": "4.4.1",
|
|
44
|
+
"@driftengine/xr": "4.4.1"
|
|
45
45
|
},
|
|
46
46
|
"author": "Drift Technologies",
|
|
47
47
|
"repository": {
|
package/src/bindings/render.ts
CHANGED
|
@@ -26,7 +26,7 @@ export const RENDER_MODULE = 'drift/render';
|
|
|
26
26
|
* from what the device can afford, and is clamped by `capabilityClamp` against what the adapter
|
|
27
27
|
* actually reports; a script that wrote to one would be overruling a decision made about hardware
|
|
28
28
|
* it cannot see, and two machines running the same script would draw different pictures for
|
|
29
|
-
* reasons the script did not choose. So this module binds the
|
|
29
|
+
* reasons the script did not choose. So this module binds the dials and none of the ceilings.
|
|
30
30
|
*
|
|
31
31
|
* ## Writes only, and the reason is the same one
|
|
32
32
|
*
|
|
@@ -87,6 +87,15 @@ export const RENDER_CAPABILITIES: readonly CapabilityDefinition[] = [
|
|
|
87
87
|
"How much of the frame's bloom ceiling to take, 0 to 1. Held until changed. Does nothing " +
|
|
88
88
|
"when the quality profile's `bloom` is 0, because the chain is never built.",
|
|
89
89
|
),
|
|
90
|
+
define(
|
|
91
|
+
'bloomAbove',
|
|
92
|
+
[R, { name: 'scale', type: 'f32' }, { name: 'threshold', type: 'f32' }],
|
|
93
|
+
'How much of the bloom ceiling to take, 0 to 1, and how bright a pixel must be before it ' +
|
|
94
|
+
'blooms, in scene units, above 0. Both held until changed. The threshold is compared before ' +
|
|
95
|
+
'exposure, so a script that moves `exposure` through a day moves this with it: pass the ' +
|
|
96
|
+
'brightness wanted on screen over the exposure, or sunlit stone blooms at noon and lamps ' +
|
|
97
|
+
'never do at night.',
|
|
98
|
+
),
|
|
90
99
|
define(
|
|
91
100
|
'exposure',
|
|
92
101
|
[R, { name: 'stops', type: 'f32' }],
|
|
@@ -173,6 +182,8 @@ export const RENDER_CAPABILITIES: readonly CapabilityDefinition[] = [
|
|
|
173
182
|
export function renderImplementation(): Record<string, unknown> {
|
|
174
183
|
return {
|
|
175
184
|
bloom: (renderer: RendererApi, scale: number) => renderer.setBloom(scale),
|
|
185
|
+
bloomAbove: (renderer: RendererApi, scale: number, threshold: number) =>
|
|
186
|
+
renderer.setBloom(scale, threshold),
|
|
176
187
|
exposure: (renderer: RendererApi, stops: number) => renderer.setOutputExposure(stops),
|
|
177
188
|
motionBlur: (renderer: RendererApi, scale: number) => renderer.setCameraMotionBlur(scale),
|
|
178
189
|
speedBlur: (renderer: RendererApi, strength: number) => renderer.setSpeedRush(strength),
|