reze-engine 0.69.8 → 0.70.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/dist/_dbg-loader.mjs +1100 -0
- package/dist/camera-mount.d.ts +57 -0
- package/dist/camera-mount.d.ts.map +1 -0
- package/dist/camera-mount.js +249 -0
- package/dist/camera.d.ts +11 -0
- package/dist/camera.d.ts.map +1 -1
- package/dist/camera.js +31 -7
- package/dist/engine.d.ts +130 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +476 -12
- package/dist/graph/compile.js +1 -1
- package/dist/graph/registry.d.ts.map +1 -1
- package/dist/graph/registry.js +19 -2
- package/dist/graph/slots.js +117 -117
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/model.d.ts +35 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +170 -0
- package/dist/shaders/materials/common.d.ts +11 -1
- package/dist/shaders/materials/common.d.ts.map +1 -1
- package/dist/shaders/materials/common.js +571 -548
- package/dist/shaders/passes/cull.d.ts +1 -1
- package/dist/shaders/passes/cull.d.ts.map +1 -1
- package/dist/shaders/passes/cull.js +4 -1
- package/dist/shaders/passes/motion-blur.d.ts +35 -0
- package/dist/shaders/passes/motion-blur.d.ts.map +1 -0
- package/dist/shaders/passes/motion-blur.js +166 -0
- package/dist/shaders/passes/particles.d.ts.map +1 -1
- package/dist/shaders/passes/particles.js +13 -2
- package/dist/shaders/passes/shadow.d.ts +1 -1
- package/dist/shaders/passes/shadow.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/camera-mount.ts +281 -0
- package/src/camera.ts +27 -4
- package/src/engine.ts +21741 -21249
- package/src/graph/compile.ts +1 -1
- package/src/graph/registry.ts +20 -3
- package/src/graph/slots.ts +304 -304
- package/src/index.ts +4 -1
- package/src/model.ts +193 -0
- package/src/shaders/materials/common.ts +706 -682
- package/src/shaders/passes/cull.ts +4 -1
- package/src/shaders/passes/motion-blur.ts +171 -0
- package/src/shaders/passes/particles.ts +14 -2
package/src/camera.ts
CHANGED
|
@@ -219,10 +219,26 @@ export class Camera {
|
|
|
219
219
|
* to be left.
|
|
220
220
|
*/
|
|
221
221
|
getEyePosition(): Vec3 {
|
|
222
|
-
|
|
222
|
+
if (this.vmdDriven) return this.vmdEye()
|
|
223
|
+
const m = this.mountPose
|
|
224
|
+
if (m) return new Vec3(m.eye.x, m.eye.y, m.eye.z)
|
|
225
|
+
return this.getPosition()
|
|
223
226
|
}
|
|
224
227
|
|
|
228
|
+
/**
|
|
229
|
+
* The shot as a bone holds it (Engine.setCameraMount): an eye, a look and an
|
|
230
|
+
* up, set by the engine each frame. Outranks the orbit, not a VMD — the
|
|
231
|
+
* orbit's own alpha/beta/radius stay untouched underneath, so taking the
|
|
232
|
+
* mount off puts back the shot that was there. Null while unmounted.
|
|
233
|
+
*/
|
|
234
|
+
mountPose: { eye: Vec3; forward: Vec3; up: Vec3 } | null = null
|
|
235
|
+
|
|
225
236
|
getViewMatrix(): Mat4 {
|
|
237
|
+
if (!this.vmdDriven && this.mountPose) {
|
|
238
|
+
const { eye, forward: f, up: u } = this.mountPose
|
|
239
|
+
Mat4.lookAtInto(this._viewMat.values, eye.x, eye.y, eye.z, eye.x + f.x, eye.y + f.y, eye.z + f.z, u.x, u.y, u.z)
|
|
240
|
+
return this._viewMat
|
|
241
|
+
}
|
|
226
242
|
if (this.vmdDriven) {
|
|
227
243
|
const eye = this.vmdEye()
|
|
228
244
|
const s = this._quatScratch
|
|
@@ -409,6 +425,12 @@ export class Camera {
|
|
|
409
425
|
private updateNearFromRadius(): void {
|
|
410
426
|
const lo = this.reversedZ ? NEAR_MIN_REVERSED : NEAR_MIN_UNORM
|
|
411
427
|
const hi = this.reversedZ ? NEAR_MAX_REVERSED : NEAR_MAX_UNORM
|
|
428
|
+
// A mounted lens sits at her face or a hand's length from it: the orbit
|
|
429
|
+
// radius says nothing about that, and her own hands come right up to it.
|
|
430
|
+
if (this.mountPose && !this.vmdDriven) {
|
|
431
|
+
this.near = lo
|
|
432
|
+
return
|
|
433
|
+
}
|
|
412
434
|
this.near = Math.min(hi, Math.max(lo, this.radius / 50))
|
|
413
435
|
}
|
|
414
436
|
|
|
@@ -495,7 +517,8 @@ export class Camera {
|
|
|
495
517
|
}
|
|
496
518
|
|
|
497
519
|
private onMouseMove(e: MouseEvent) {
|
|
498
|
-
|
|
520
|
+
// A VMD or a mount owns the camera; orbit/pan is inert.
|
|
521
|
+
if (this.inputLocked || this.vmdDriven || this.mountPose) return
|
|
499
522
|
if (!this.isDragging) return
|
|
500
523
|
|
|
501
524
|
const deltaX = e.clientX - this.lastMousePos.x
|
|
@@ -520,7 +543,7 @@ export class Camera {
|
|
|
520
543
|
|
|
521
544
|
private onWheel(e: WheelEvent) {
|
|
522
545
|
e.preventDefault()
|
|
523
|
-
if (this.vmdDriven) return // VMD owns the camera; zoom is inert
|
|
546
|
+
if (this.vmdDriven || this.mountPose) return // VMD or mount owns the camera; zoom is inert
|
|
524
547
|
|
|
525
548
|
// Update camera radius (zoom)
|
|
526
549
|
this.radius += e.deltaY * this.wheelPrecision
|
|
@@ -572,7 +595,7 @@ export class Camera {
|
|
|
572
595
|
// native touch scrolling in every UI panel layered above the canvas.
|
|
573
596
|
if (!this.isDragging && !this.isPinching) return
|
|
574
597
|
e.preventDefault()
|
|
575
|
-
if (this.vmdDriven) return // VMD owns the camera; pinch/pan/rotate is inert
|
|
598
|
+
if (this.vmdDriven || this.mountPose) return // VMD or mount owns the camera; pinch/pan/rotate is inert
|
|
576
599
|
|
|
577
600
|
if (this.isPinching && e.touches.length === 2) {
|
|
578
601
|
// Two-finger gesture: can be pinch zoom or pan
|