rayzee 9.3.0 → 9.3.2
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/rayzee.es.js +59 -24
- package/dist/rayzee.umd.js +3 -3
- package/package.json +1 -1
- package/src/PathTracerApp.js +2 -2
- package/src/Processor/AssetLoader.js +3 -16
- package/src/Processor/SceneProcessor.js +8 -1
- package/src/Stages/PathTracerStage.js +8 -3
- package/src/managers/AnimationManager.js +52 -1
- package/src/managers/CameraManager.js +31 -5
package/dist/rayzee.es.js
CHANGED
|
@@ -29095,7 +29095,7 @@ function Vv(e, t, n, r) {
|
|
|
29095
29095
|
}
|
|
29096
29096
|
//#endregion
|
|
29097
29097
|
//#region src/version.js
|
|
29098
|
-
var Hv = "9.3.
|
|
29098
|
+
var Hv = "9.3.2", Uv = 1e4, Wv = 15e5;
|
|
29099
29099
|
function Gv(e, t, n = Uv) {
|
|
29100
29100
|
return e >= n && t / Wv < e / 3;
|
|
29101
29101
|
}
|
|
@@ -30178,19 +30178,28 @@ var dy = class {
|
|
|
30178
30178
|
triRecordsPerChunk: this.triangles.recordsPerChunk
|
|
30179
30179
|
});
|
|
30180
30180
|
}
|
|
30181
|
-
let i = this.instanceTable;
|
|
30181
|
+
let i = this.instanceTable, a = Mi.FLOATS_PER_TRIANGLE, o = [];
|
|
30182
30182
|
for (let e = 0; e < i.count; e++) {
|
|
30183
30183
|
if (!i.isSet[e] || !i.isOwner(e)) continue;
|
|
30184
30184
|
let t = n(e);
|
|
30185
|
-
if (t
|
|
30185
|
+
if (!t) continue;
|
|
30186
|
+
if (this._updateMeshTrianglePositions(e, t), r) {
|
|
30186
30187
|
let t = r(e);
|
|
30187
30188
|
t && this._patchMeshSmoothNormals(e, t);
|
|
30188
30189
|
}
|
|
30190
|
+
let s = i.triOffsetOf(e) * a, c = i.triCountOf(e) * a, l = o.at(-1);
|
|
30191
|
+
l && l.offset + l.count === s ? l.count += c : o.push({
|
|
30192
|
+
offset: s,
|
|
30193
|
+
count: c
|
|
30194
|
+
});
|
|
30189
30195
|
}
|
|
30190
30196
|
return new Promise((e, t) => {
|
|
30191
30197
|
this._refitWorker.onmessage = (n) => {
|
|
30192
30198
|
let r = n.data;
|
|
30193
|
-
r.type === "refitComplete" ? e({
|
|
30199
|
+
r.type === "refitComplete" ? e({
|
|
30200
|
+
refitTimeMs: r.refitTimeMs,
|
|
30201
|
+
triRanges: o
|
|
30202
|
+
}) : r.type === "error" && t(Error(r.error));
|
|
30194
30203
|
}, this._refitWorker.postMessage({ type: "refit" });
|
|
30195
30204
|
});
|
|
30196
30205
|
}
|
|
@@ -31154,8 +31163,8 @@ var vy = class {
|
|
|
31154
31163
|
_updateStorageBuffer(e, t) {
|
|
31155
31164
|
e && (e.array.set(t), e.clearUpdateRanges(), e.needsUpdate = !0);
|
|
31156
31165
|
}
|
|
31157
|
-
updateTriangleData(e) {
|
|
31158
|
-
e?.chunks?.length > 1 ? this._triangleRecords = e : e && (this._triangleFlat = e.chunks ? e.chunks[0] : e), this._uploadTriangles(0, this._triangleRecordCount);
|
|
31166
|
+
updateTriangleData(e, t) {
|
|
31167
|
+
e?.chunks?.length > 1 ? this._triangleRecords = e : e && (this._triangleFlat = e.chunks ? e.chunks[0] : e), t ? this.updateBufferRanges(t, []) : this._uploadTriangles(0, this._triangleRecordCount);
|
|
31159
31168
|
}
|
|
31160
31169
|
updateBVHData(e) {
|
|
31161
31170
|
if (this._bvhRecords) {
|
|
@@ -40846,16 +40855,10 @@ var hO = class e extends en {
|
|
|
40846
40855
|
return sO[e.split(".").pop().toLowerCase()] || null;
|
|
40847
40856
|
}
|
|
40848
40857
|
readFileAsArrayBuffer(e) {
|
|
40849
|
-
return
|
|
40850
|
-
let r = new FileReader();
|
|
40851
|
-
r.onload = (e) => t(e.target.result), r.onerror = (e) => n(e), r.readAsArrayBuffer(e);
|
|
40852
|
-
});
|
|
40858
|
+
return e.arrayBuffer();
|
|
40853
40859
|
}
|
|
40854
40860
|
readFileAsText(e) {
|
|
40855
|
-
return
|
|
40856
|
-
let r = new FileReader();
|
|
40857
|
-
r.onload = (e) => t(e.target.result), r.onerror = (e) => n(e), r.readAsText(e);
|
|
40858
|
-
});
|
|
40861
|
+
return e.text();
|
|
40859
40862
|
}
|
|
40860
40863
|
async loadAssetFromFile(e, t = {}) {
|
|
40861
40864
|
let n = e.name, r = this.getFileFormat(n);
|
|
@@ -42284,7 +42287,7 @@ var yO = class extends Mn {
|
|
|
42284
42287
|
this.camera = new yO(60, t / n || 1, .01, 1e3), this.camera.position.set(0, 0, 5), this.controls = new Dr(this.camera, e), this.controls.screenSpacePanning = !0, this.controls.zoomToCursor = !0, this.controls.saveState(), this._reportedOrthoHeight = null, this._reportOrthoHeight = this._reportOrthoHeight.bind(this), this.controls.addEventListener("change", this._reportOrthoHeight), this.walkControls = new FO(this.camera, e, this.controls), this.interactionManager = null, this.cameras = [this.camera], this.currentCameraIndex = 0, this._userCameraCounter = 0, this.autoFocusMode = ji.SMOOTHING_FACTOR ? "auto" : "manual", this.afScreenPoint = {
|
|
42285
42288
|
x: .5,
|
|
42286
42289
|
y: .5
|
|
42287
|
-
}, this.afSmoothingFactor = ji.SMOOTHING_FACTOR, this._lastValidFocusDistance = null, this._smoothedFocusDistance = null, this._afPointDirty = !1, this._afSuspended = !1, this._defaultCameraState = null, this._onResize = null, this._onReset = null, this._getSettings = null, this._applySettings = null;
|
|
42290
|
+
}, this.afSmoothingFactor = ji.SMOOTHING_FACTOR, this._lastValidFocusDistance = null, this._smoothedFocusDistance = null, this._afPointDirty = !1, this._afSuspended = !1, this._afPick = null, this._defaultCameraState = null, this._onResize = null, this._onReset = null, this._getSettings = null, this._applySettings = null;
|
|
42288
42291
|
}
|
|
42289
42292
|
setCameras(e) {
|
|
42290
42293
|
this.cameras = e, this._userCameraCounter = 0, this.resetAutoFocus();
|
|
@@ -42577,8 +42580,8 @@ var yO = class extends Mn {
|
|
|
42577
42580
|
this._afSuspended && (this._afSuspended = !1, this._smoothedFocusDistance = null);
|
|
42578
42581
|
let l = a;
|
|
42579
42582
|
if (l?.isReady && l.renderMode?.value === 1 && l.frameCount > 0 && !l.isComplete) return;
|
|
42580
|
-
let u = this.
|
|
42581
|
-
if (u) d = OC(u
|
|
42583
|
+
let u = this._pickFocusPoint(l.resetCount), d;
|
|
42584
|
+
if (u) d = OC(u, this.camera), this._lastValidFocusDistance = d;
|
|
42582
42585
|
else if (this._lastValidFocusDistance !== null) d = this._lastValidFocusDistance;
|
|
42583
42586
|
else {
|
|
42584
42587
|
let e = this.controls ? OC(this.controls.target, this.camera) : 0;
|
|
@@ -42599,6 +42602,22 @@ var yO = class extends Mn {
|
|
|
42599
42602
|
f ? c?.() : n > ji.RESET_THRESHOLD && s?.();
|
|
42600
42603
|
}
|
|
42601
42604
|
}
|
|
42605
|
+
_pickFocusPoint(e) {
|
|
42606
|
+
let t = this.camera, { x: n, y: r } = this.afScreenPoint, i = this._afPick ??= {
|
|
42607
|
+
point: new ur(),
|
|
42608
|
+
hit: !1,
|
|
42609
|
+
resetCount: NaN,
|
|
42610
|
+
x: NaN,
|
|
42611
|
+
y: NaN,
|
|
42612
|
+
view: new yn(),
|
|
42613
|
+
projection: new yn()
|
|
42614
|
+
};
|
|
42615
|
+
if (this._afPointDirty || e !== i.resetCount || n !== i.x || r !== i.y || !i.view.equals(t.matrixWorld) || !i.projection.equals(t.projectionMatrix)) {
|
|
42616
|
+
let a = this.interactionManager.pickSurface(n * 2 - 1, 1 - r * 2);
|
|
42617
|
+
i.hit = !!a, a && i.point.copy(a.point), i.resetCount = e, i.x = n, i.y = r, i.view.copy(t.matrixWorld), i.projection.copy(t.projectionMatrix);
|
|
42618
|
+
}
|
|
42619
|
+
return i.hit ? i.point : null;
|
|
42620
|
+
}
|
|
42602
42621
|
setInteractionManager(e) {
|
|
42603
42622
|
this.interactionManager = e;
|
|
42604
42623
|
}
|
|
@@ -45509,7 +45528,7 @@ var lA = 4096, uA = class {
|
|
|
45509
45528
|
}
|
|
45510
45529
|
}, mA = class extends en {
|
|
45511
45530
|
constructor() {
|
|
45512
|
-
super(), this.mixer = null, this.timer = new ir(), this.actions = [], this.isPlaying = !1, this._scene = null, this._mixerRoot = null, this._meshes = null, this._meshTriRanges = null, this._meshPositions = null, this._tempVec = new ur(), this._skinnedCache = null, this._clipsCache = null, this._savedTimeScale = 1, this.onFinished = null, this._rigid = !1, this._plans = null, this._allPlan = null, this._activeClip = 0, this._slotOf = null, this._lastWorld = null, this._lastVisible = null, this.wakeCallback = null, this.applyPoseCallback = null;
|
|
45531
|
+
super(), this.mixer = null, this.timer = new ir(), this.actions = [], this.isPlaying = !1, this._scene = null, this._mixerRoot = null, this._meshes = null, this._meshTriRanges = null, this._meshPositions = null, this._tempVec = new ur(), this._skinnedCache = null, this._clipsCache = null, this._savedTimeScale = 1, this.onFinished = null, this._rigid = !1, this._plans = null, this._allPlan = null, this._activeClip = 0, this._slotOf = null, this._lastWorld = null, this._lastVisible = null, this._lastMeshWorld = null, this._lastMorphWeights = null, this.wakeCallback = null, this.applyPoseCallback = null;
|
|
45513
45532
|
}
|
|
45514
45533
|
init(e, t, n, r) {
|
|
45515
45534
|
if (this.dispose(), !r || r.length === 0) return;
|
|
@@ -45531,7 +45550,7 @@ var lA = 4096, uA = class {
|
|
|
45531
45550
|
indices: r
|
|
45532
45551
|
}), o += i;
|
|
45533
45552
|
}
|
|
45534
|
-
this._skinnedCache = [], this._meshPositions = [];
|
|
45553
|
+
this._skinnedCache = [], this._meshPositions = [], this._lastMeshWorld = this._rigid ? null : new Float64Array(n.length * 16).fill(NaN), this._lastMorphWeights = [];
|
|
45535
45554
|
let s = n.filter((e) => e.isSkinnedMesh).length;
|
|
45536
45555
|
console.debug(`[AnimationManager] Init: ${r.length} clips, ${n.length} meshes (${s} skinned), ${o} triangles, ${this._rigid ? "rigid" : "deforming"}`);
|
|
45537
45556
|
}
|
|
@@ -45650,11 +45669,27 @@ var lA = 4096, uA = class {
|
|
|
45650
45669
|
_poseReader() {
|
|
45651
45670
|
if (this._mixerRoot.updateMatrixWorld(!0), this._rigid) return this._applyRigidPose(this._activeClip), null;
|
|
45652
45671
|
let e = this._planFor(this._activeClip)?.cameras;
|
|
45653
|
-
|
|
45672
|
+
e?.length && this.applyPoseCallback?.({
|
|
45654
45673
|
meshIndices: [],
|
|
45655
45674
|
visibilityChanged: !1,
|
|
45656
45675
|
cameras: e
|
|
45657
|
-
})
|
|
45676
|
+
});
|
|
45677
|
+
let t = new Int8Array(this._meshes.length);
|
|
45678
|
+
return (e) => (t[e] === 0 && (t[e] = this._meshes[e].isSkinnedMesh || this._poseChanged(e) ? 1 : -1), t[e] > 0 ? this._computeMeshPositions(e) : null);
|
|
45679
|
+
}
|
|
45680
|
+
_poseChanged(e) {
|
|
45681
|
+
let t = this._meshes[e], n = this._lastMeshWorld, r = t.matrixWorld.elements, i = e * 16, a = !1;
|
|
45682
|
+
for (let e = 0; e < 16; e++) if (n[i + e] !== r[e]) {
|
|
45683
|
+
for (let e = 0; e < 16; e++) n[i + e] = r[e];
|
|
45684
|
+
a = !0;
|
|
45685
|
+
break;
|
|
45686
|
+
}
|
|
45687
|
+
let o = t.morphTargetInfluences;
|
|
45688
|
+
if (o?.length) {
|
|
45689
|
+
let t = this._lastMorphWeights[e];
|
|
45690
|
+
(!t || t.length !== o.length || t.some((e, t) => e !== o[t])) && (this._lastMorphWeights[e] = Float64Array.from(o), a = !0);
|
|
45691
|
+
}
|
|
45692
|
+
return a;
|
|
45658
45693
|
}
|
|
45659
45694
|
_computeMeshPositions(e) {
|
|
45660
45695
|
let t = this._tempVec, n = this._meshes[e], { count: r, uniqueVerts: i, indices: a } = this._meshTriRanges[e], o = this._scratch(this._skinnedCache, e, i * 3), s = this._scratch(this._meshPositions, e, r * 9), c = n.matrixWorld;
|
|
@@ -45683,7 +45718,7 @@ var lA = 4096, uA = class {
|
|
|
45683
45718
|
}), this._clipsCache;
|
|
45684
45719
|
}
|
|
45685
45720
|
dispose() {
|
|
45686
|
-
this.mixer &&= (this.mixer.stopAllAction(), this.mixer.uncacheRoot(this._mixerRoot), null), this.actions = [], this.isPlaying = !1, this.timer.reset(), this._scene = null, this._mixerRoot = null, this._meshes = null, this._meshTriRanges = null, this._meshPositions = null, this._skinnedCache = null, this._clipsCache = null, this._rigid = !1, this._plans = null, this._allPlan = null, this._activeClip = 0, this._slotOf = null, this._lastWorld = null, this._lastVisible = null;
|
|
45721
|
+
this.mixer &&= (this.mixer.stopAllAction(), this.mixer.uncacheRoot(this._mixerRoot), null), this.actions = [], this.isPlaying = !1, this.timer.reset(), this._scene = null, this._mixerRoot = null, this._meshes = null, this._meshTriRanges = null, this._meshPositions = null, this._skinnedCache = null, this._clipsCache = null, this._rigid = !1, this._plans = null, this._allPlan = null, this._activeClip = 0, this._slotOf = null, this._lastWorld = null, this._lastVisible = null, this._lastMeshWorld = null, this._lastMorphWeights = null;
|
|
45687
45722
|
}
|
|
45688
45723
|
}, hA = new ur(0, 0, -1), gA = (e) => {
|
|
45689
45724
|
for (; e.parent;) e = e.parent;
|
|
@@ -46571,8 +46606,8 @@ var BA = class extends en {
|
|
|
46571
46606
|
}
|
|
46572
46607
|
async refitBVH(e, t) {
|
|
46573
46608
|
await this.ensureSceneResident();
|
|
46574
|
-
let n = await this._sdf.refitBVH(e, t);
|
|
46575
|
-
return this.stages.pathTracer.updateTriangleData(this._sdf.triangles), this.stages.pathTracer.updateBVHData(this._sdf.bvh), this.reset(!1, { motion: !0 }),
|
|
46609
|
+
let { triRanges: n, ...r } = await this._sdf.refitBVH(e, t);
|
|
46610
|
+
return this.stages.pathTracer.updateTriangleData(this._sdf.triangles, n), this.stages.pathTracer.updateBVHData(this._sdf.bvh), this.reset(!1, { motion: !0 }), r;
|
|
46576
46611
|
}
|
|
46577
46612
|
refitBLASes(e, t, n) {
|
|
46578
46613
|
if (this._sdf?.spilled) throw Error("refitBLASes: the scene is spilled to disk — await app.ensureSceneResident() first");
|