reze-engine 0.55.16 → 0.56.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/dist/camera.d.ts +12 -0
- package/dist/camera.d.ts.map +1 -1
- package/dist/camera.js +20 -3
- package/dist/engine.d.ts +253 -5
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +1078 -104
- package/dist/model.d.ts +10 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +16 -0
- package/dist/overlay.d.ts +0 -5
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +0 -5
- package/dist/reflection.d.ts +17 -4
- package/dist/reflection.d.ts.map +1 -1
- package/dist/reflection.js +93 -38
- package/dist/shaders/directives.d.ts +15 -0
- package/dist/shaders/directives.d.ts.map +1 -1
- package/dist/shaders/directives.js +5 -0
- package/dist/shaders/passes/ground.d.ts.map +1 -1
- package/dist/shaders/passes/ground.js +42 -6
- package/dist/shaders/passes/mirror.d.ts +32 -0
- package/dist/shaders/passes/mirror.d.ts.map +1 -0
- package/dist/shaders/passes/mirror.js +284 -0
- package/dist/shaders/passes/scene-contract.d.ts +6 -0
- package/dist/shaders/passes/scene-contract.d.ts.map +1 -1
- package/dist/shaders/passes/scene-contract.js +8 -0
- package/package.json +1 -1
- package/src/camera.ts +21 -4
- package/src/engine.ts +1158 -108
- package/src/model.ts +16 -0
- package/src/overlay.ts +0 -5
- package/src/reflection.ts +103 -37
- package/src/shaders/directives.ts +20 -0
- package/src/shaders/passes/ground.ts +42 -6
- package/src/shaders/passes/mirror.ts +289 -0
- package/src/shaders/passes/scene-contract.ts +14 -0
|
@@ -84,6 +84,12 @@ type SceneRenderClass =
|
|
|
84
84
|
| "ground"
|
|
85
85
|
/** Backface-expanded hulls. Also a material blend — it is geometry. */
|
|
86
86
|
| "outline"
|
|
87
|
+
/** A mirror surface: opaque geometry carrying a projective sample of the
|
|
88
|
+
* reflection target. Blends like a material because it IS one, and is out of
|
|
89
|
+
* WRITES_ID because what it shows is a picture of the cast rather than the
|
|
90
|
+
* cast — a reflection that claimed her object id would seed the distance
|
|
91
|
+
* field twice and put every silhouette effect's border around the glass. */
|
|
92
|
+
| "mirror"
|
|
87
93
|
/** Particles and ribbons in their default, non-additive mode. */
|
|
88
94
|
| "particle"
|
|
89
95
|
/** Particles declaring `#blend additive` — LIGHT rather than matter, so
|
|
@@ -158,12 +164,20 @@ const ADD_PREMULTIPLIED: GPUBlendState = {
|
|
|
158
164
|
* consequence. Outline hulls, particles and ribbons are OUT: they are not
|
|
159
165
|
* things you would ever address by id, and a hull would overwrite the id of the
|
|
160
166
|
* body it traces.
|
|
167
|
+
*
|
|
168
|
+
* So is the mirror — see the class's own note.
|
|
161
169
|
*/
|
|
162
170
|
const WRITES_ID = new Set<SceneRenderClass>(["material", "ground"])
|
|
163
171
|
|
|
164
172
|
/** The blends each class writes its two attachments with. */
|
|
165
173
|
const BLENDS: Record<Exclude<SceneRenderClass, "depth-prepass">, [GPUBlendState, GPUBlendState]> = {
|
|
166
174
|
material: [ALPHA_OVER, ALPHA_OVER],
|
|
175
|
+
// PREMULTIPLIED, like the ground and for the same reason: what a mirror
|
|
176
|
+
// writes is a sample of the HDR target, and that target already holds colour
|
|
177
|
+
// premultiplied by its own alpha. Handed to the src-alpha blend it would be
|
|
178
|
+
// weighted a second time, and a reflection at coverage 0.5 would arrive at a
|
|
179
|
+
// quarter strength.
|
|
180
|
+
mirror: [PREMULTIPLIED_OVER, ALPHA_OVER],
|
|
167
181
|
// PREMULTIPLIED colour, alone among the classes — see the blend's own note.
|
|
168
182
|
// The aux is ordinary alpha-over: the ground writes its mask unweighted, like
|
|
169
183
|
// everything else, and coverage is what the blend applies.
|