@driftengine/script 4.8.7 → 4.10.0

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 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: 39.9 KB gzipped on top of core.** Measured by `scripts/size-gate.test.mjs`, which fails if it
6
+ **Cost: 40.4 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
@@ -6144,9 +6144,47 @@
6144
6144
  "scene.write"
6145
6145
  ],
6146
6146
  "deterministic": false,
6147
- "doc": "How far this frame is scaled into the tone curve, above 0. Replaces the profile's `outputExposure` for this frame onward. Adaptation is yours: a game knows it walked into a cave, and the renderer could only find out a frame late. Ignored unless the output transform is `aces`, since otherwise there is no curve to be exposed into.",
6147
+ "doc": "How far this frame is scaled into the tone curve, above 0. Replaces the profile's `outputExposure` for this frame onward. Adaptation is yours: a game knows it walked into a cave, and the renderer could only find out a frame late. Ignored where the output transform is `none` or `srgb`, since there is then no curve to be exposed into.",
6148
6148
  "implementation": "drift/render.exposure"
6149
6149
  },
6150
+ {
6151
+ "module": "drift/render",
6152
+ "name": "filmic",
6153
+ "signature": "fn(renderer: Renderer, slope: f32, toe: f32, shoulder: f32, blackClip: f32, whiteClip: f32) -> void",
6154
+ "params": [
6155
+ {
6156
+ "name": "renderer",
6157
+ "type": "Renderer"
6158
+ },
6159
+ {
6160
+ "name": "slope",
6161
+ "type": "f32"
6162
+ },
6163
+ {
6164
+ "name": "toe",
6165
+ "type": "f32"
6166
+ },
6167
+ {
6168
+ "name": "shoulder",
6169
+ "type": "f32"
6170
+ },
6171
+ {
6172
+ "name": "blackClip",
6173
+ "type": "f32"
6174
+ },
6175
+ {
6176
+ "name": "whiteClip",
6177
+ "type": "f32"
6178
+ }
6179
+ ],
6180
+ "returns": "void",
6181
+ "effects": [
6182
+ "scene.write"
6183
+ ],
6184
+ "deterministic": false,
6185
+ "doc": "The `filmic` output transform's curve, held until changed: the straight segment's slope through mid grey, how much of the curve the toe and the shoulder take (0 to 1), and how far black and white clip past their ends (0 to 1). The engine defaults are 0.88, 0.55, 0.26, 0 and 0.04. Mid grey stays mid grey whatever they are. A number out of range is clamped into it. Ignored unless the quality profile's output transform is `filmic`.",
6186
+ "implementation": "drift/render.filmic"
6187
+ },
6150
6188
  {
6151
6189
  "module": "drift/render",
6152
6190
  "name": "motionBlur",
@@ -79,8 +79,20 @@ export const RENDER_CAPABILITIES = [
79
79
  'never do at night.'),
80
80
  define('exposure', [R, { name: 'stops', type: 'f32' }], "How far this frame is scaled into the tone curve, above 0. Replaces the profile's " +
81
81
  '`outputExposure` for this frame onward. Adaptation is yours: a game knows it walked into a ' +
82
- 'cave, and the renderer could only find out a frame late. Ignored unless the output ' +
83
- 'transform is `aces`, since otherwise there is no curve to be exposed into.'),
82
+ 'cave, and the renderer could only find out a frame late. Ignored where the output ' +
83
+ 'transform is `none` or `srgb`, since there is then no curve to be exposed into.'),
84
+ define('filmic', [
85
+ R,
86
+ { name: 'slope', type: 'f32' },
87
+ { name: 'toe', type: 'f32' },
88
+ { name: 'shoulder', type: 'f32' },
89
+ { name: 'blackClip', type: 'f32' },
90
+ { name: 'whiteClip', type: 'f32' },
91
+ ], "The `filmic` output transform's curve, held until changed: the straight segment's slope " +
92
+ 'through mid grey, how much of the curve the toe and the shoulder take (0 to 1), and how ' +
93
+ 'far black and white clip past their ends (0 to 1). The engine defaults are 0.88, 0.55, ' +
94
+ '0.26, 0 and 0.04. Mid grey stays mid grey whatever they are. A number out of range is ' +
95
+ "clamped into it. Ignored unless the quality profile's output transform is `filmic`."),
84
96
  define('motionBlur', [R, { name: 'scale', type: 'f32' }], 'How much of the camera motion blur ceiling this frame takes, 0 to 1. Held until changed. ' +
85
97
  'Ramp it with whatever "fast" means here: blur that is always on stops being a speed cue ' +
86
98
  'within seconds and costs eight taps a moving pixel while doing so.'),
@@ -140,6 +152,7 @@ export function renderImplementation() {
140
152
  bloom: (renderer, scale) => renderer.setBloom(scale),
141
153
  bloomAbove: (renderer, scale, threshold) => renderer.setBloom(scale, threshold),
142
154
  exposure: (renderer, stops) => renderer.setOutputExposure(stops),
155
+ filmic: (renderer, slope, toe, shoulder, blackClip, whiteClip) => renderer.setFilmicCurve({ slope, toe, shoulder, blackClip, whiteClip }),
143
156
  motionBlur: (renderer, scale) => renderer.setCameraMotionBlur(scale),
144
157
  speedBlur: (renderer, strength) => renderer.setSpeedRush(strength),
145
158
  focus: (renderer, distance, range, scale) => renderer.setDepthOfField(distance, range, scale),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driftengine/script",
3
- "version": "4.8.7",
3
+ "version": "4.10.0",
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.17.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@driftengine/ai": "4.8.7",
35
- "@driftengine/animation": "4.8.7",
36
- "@driftengine/audio": "4.8.7",
37
- "@driftengine/chemistry": "4.8.7",
38
- "@driftengine/core": "4.8.7",
39
- "@driftengine/editor": "4.8.7",
40
- "@driftengine/entities": "4.8.7",
41
- "@driftengine/network": "4.8.7",
42
- "@driftengine/terrain": "4.8.7",
43
- "@driftengine/ui2d": "4.8.7",
44
- "@driftengine/xr": "4.8.7"
34
+ "@driftengine/ai": "4.10.0",
35
+ "@driftengine/animation": "4.10.0",
36
+ "@driftengine/audio": "4.10.0",
37
+ "@driftengine/chemistry": "4.10.0",
38
+ "@driftengine/core": "4.10.0",
39
+ "@driftengine/editor": "4.10.0",
40
+ "@driftengine/entities": "4.10.0",
41
+ "@driftengine/network": "4.10.0",
42
+ "@driftengine/terrain": "4.10.0",
43
+ "@driftengine/ui2d": "4.10.0",
44
+ "@driftengine/xr": "4.10.0"
45
45
  },
46
46
  "author": "Drift Technologies",
47
47
  "repository": {
@@ -101,8 +101,24 @@ export const RENDER_CAPABILITIES: readonly CapabilityDefinition[] = [
101
101
  [R, { name: 'stops', type: 'f32' }],
102
102
  "How far this frame is scaled into the tone curve, above 0. Replaces the profile's " +
103
103
  '`outputExposure` for this frame onward. Adaptation is yours: a game knows it walked into a ' +
104
- 'cave, and the renderer could only find out a frame late. Ignored unless the output ' +
105
- 'transform is `aces`, since otherwise there is no curve to be exposed into.',
104
+ 'cave, and the renderer could only find out a frame late. Ignored where the output ' +
105
+ 'transform is `none` or `srgb`, since there is then no curve to be exposed into.',
106
+ ),
107
+ define(
108
+ 'filmic',
109
+ [
110
+ R,
111
+ { name: 'slope', type: 'f32' },
112
+ { name: 'toe', type: 'f32' },
113
+ { name: 'shoulder', type: 'f32' },
114
+ { name: 'blackClip', type: 'f32' },
115
+ { name: 'whiteClip', type: 'f32' },
116
+ ],
117
+ "The `filmic` output transform's curve, held until changed: the straight segment's slope " +
118
+ 'through mid grey, how much of the curve the toe and the shoulder take (0 to 1), and how ' +
119
+ 'far black and white clip past their ends (0 to 1). The engine defaults are 0.88, 0.55, ' +
120
+ '0.26, 0 and 0.04. Mid grey stays mid grey whatever they are. A number out of range is ' +
121
+ "clamped into it. Ignored unless the quality profile's output transform is `filmic`.",
106
122
  ),
107
123
  define(
108
124
  'motionBlur',
@@ -185,6 +201,14 @@ export function renderImplementation(): Record<string, unknown> {
185
201
  bloomAbove: (renderer: RendererApi, scale: number, threshold: number) =>
186
202
  renderer.setBloom(scale, threshold),
187
203
  exposure: (renderer: RendererApi, stops: number) => renderer.setOutputExposure(stops),
204
+ filmic: (
205
+ renderer: RendererApi,
206
+ slope: number,
207
+ toe: number,
208
+ shoulder: number,
209
+ blackClip: number,
210
+ whiteClip: number,
211
+ ) => renderer.setFilmicCurve({ slope, toe, shoulder, blackClip, whiteClip }),
188
212
  motionBlur: (renderer: RendererApi, scale: number) => renderer.setCameraMotionBlur(scale),
189
213
  speedBlur: (renderer: RendererApi, strength: number) => renderer.setSpeedRush(strength),
190
214
  focus: (renderer: RendererApi, distance: number, range: number, scale: number) =>