rayzee 7.9.0 → 7.9.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/README.md +1 -1
- package/dist/rayzee.es.js +10 -6
- package/dist/rayzee.es.js.map +1 -1
- package/dist/rayzee.umd.js +1 -1
- package/dist/rayzee.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/Stages/NormalDepth.js +5 -2
- package/src/Stages/PathTracer.js +35 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Rayzee Engine
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/rayzee)
|
|
4
|
-
[](https://www.npmjs.com/package/rayzee)
|
|
5
5
|
[](https://www.npmjs.com/package/rayzee)
|
|
6
6
|
[](https://www.jsdelivr.com/package/npm/rayzee)
|
|
7
7
|
|
package/dist/rayzee.es.js
CHANGED
|
@@ -9432,7 +9432,7 @@ function Iu({ hitBufferRO: e, activeIndicesReadRO: t, sortedIndicesRW: n, sortGl
|
|
|
9432
9432
|
//#region src/Stages/PathTracer.js
|
|
9433
9433
|
var Lu = class extends $s {
|
|
9434
9434
|
constructor(e, t, n, r = {}) {
|
|
9435
|
-
super(e, t, n, r), this.name = "PathTracer", this._packedBuffers = null, this._queueManager = null, this._kernelManager = null, this._gBufferAttr = null, this._wavefrontReady = !1, this._auxGBufferEnabled = !1, this._auxGBufferUniform = V(0, "uint"), this._useDynamicDispatch = !0, this._sortMaterials = !1, this._useSubgroupCompact = !1, this._lastBounceCounts = null, this._lastBounceCountsBudget = -1, this._readbackPending = !1, this._readbackEveryNFrames = 4, this._readbackFrameCounter = 0, this._readbackGeneration = 0, this._bounceEarlyExitThreshold = 100, this._wfRenderWidth = V(1920, "int"), this._wfRenderHeight = V(1080, "int"), this._wfMaxRayCount = V(0, "uint"), this._wfCurrentBounce = V(0, "int"), this.vramTracker = new Uc(this.renderer), this._registerVRAMProviders(), console.log("PathTracer: initialized (wavefront)");
|
|
9435
|
+
super(e, t, n, r), this.name = "PathTracer", this._packedBuffers = null, this._queueManager = null, this._kernelManager = null, this._gBufferAttr = null, this._wavefrontReady = !1, this._auxGBufferEnabled = !1, this._auxGBufferUniform = V(0, "uint"), this._useDynamicDispatch = !0, this._sortMaterials = !1, this._useSubgroupCompact = !1, this._lastBounceCounts = null, this._lastBounceCountsBudget = -1, this._readbackPending = !1, this._readbackEveryNFrames = 4, this._readbackFrameCounter = 0, this._readbackGeneration = 0, this._curveSizingValid = !1, this._bounceEarlyExitThreshold = 100, this._wfRenderWidth = V(1920, "int"), this._wfRenderHeight = V(1080, "int"), this._wfMaxRayCount = V(0, "uint"), this._wfCurrentBounce = V(0, "int"), this.vramTracker = new Uc(this.renderer), this._registerVRAMProviders(), console.log("PathTracer: initialized (wavefront)");
|
|
9436
9436
|
}
|
|
9437
9437
|
_registerVRAMProviders() {
|
|
9438
9438
|
let e = this.vramTracker;
|
|
@@ -9487,7 +9487,7 @@ var Lu = class extends $s {
|
|
|
9487
9487
|
}
|
|
9488
9488
|
this.performanceMonitor?.start();
|
|
9489
9489
|
let t = this.frameCount, n = this.renderMode.value, r = null;
|
|
9490
|
-
n === 1 && t === 0 && (r = this.maxBounces.value, this.maxBounces.value = 1), this._handleResize(), this.manageASVGFForRenderMode(n), e && e.setState("tileRenderingComplete", !0), this.cameraChanged = this._updateCameraUniforms(), this.cameraOptimizer?.updateInteractionMode(this.cameraChanged), this._updateAccumulationUniforms(t, n), this.frame.value = t, this._setWfDispatch();
|
|
9490
|
+
n === 1 && t === 0 && (r = this.maxBounces.value, this.maxBounces.value = 1), this._handleResize(), this.manageASVGFForRenderMode(n), e && e.setState("tileRenderingComplete", !0), this.cameraChanged = this._updateCameraUniforms(), this.cameraOptimizer?.updateInteractionMode(this.cameraChanged), this.cameraChanged && (this._curveSizingValid = !1, this._readbackGeneration++), this._updateAccumulationUniforms(t, n), this.frame.value = t, this._setWfDispatch();
|
|
9491
9491
|
let i = this.storageTextures.getReadTextures();
|
|
9492
9492
|
this.shaderBuilder.prevColorTexNode && (this.shaderBuilder.prevColorTexNode.value = i.color, this.shaderBuilder.prevAlbedoTexNode.value = i.albedo), this._refreshWfTextureNodes();
|
|
9493
9493
|
let a = this._kernelManager;
|
|
@@ -9504,7 +9504,7 @@ var Lu = class extends $s {
|
|
|
9504
9504
|
let t = this._useDynamicDispatch;
|
|
9505
9505
|
if (t) {
|
|
9506
9506
|
let t = c;
|
|
9507
|
-
if (e > 0) {
|
|
9507
|
+
if (e > 0 && this._curveSizingValid) {
|
|
9508
9508
|
let n = e - 1, r;
|
|
9509
9509
|
n < u && l[n] !== void 0 ? r = l[n] : u > 0 && (r = l[u - 1]), t = r > 0 ? r : c;
|
|
9510
9510
|
}
|
|
@@ -9541,6 +9541,10 @@ var Lu = class extends $s {
|
|
|
9541
9541
|
super.setSize(e, t), this._rebuildKernelsIfResized(n, r);
|
|
9542
9542
|
}
|
|
9543
9543
|
_maybeReadbackCounters() {
|
|
9544
|
+
if (this.cameraChanged) {
|
|
9545
|
+
this._readbackFrameCounter = this._readbackEveryNFrames;
|
|
9546
|
+
return;
|
|
9547
|
+
}
|
|
9544
9548
|
if (this._readbackPending || (this._readbackFrameCounter++, this._readbackFrameCounter < this._readbackEveryNFrames)) return;
|
|
9545
9549
|
this._readbackFrameCounter = 0;
|
|
9546
9550
|
let e = this._queueManager?.getBounceCountsAttribute();
|
|
@@ -9548,7 +9552,7 @@ var Lu = class extends $s {
|
|
|
9548
9552
|
this._readbackPending = !0;
|
|
9549
9553
|
let t = this._readbackGeneration, n = this.maxBounces.value;
|
|
9550
9554
|
this.renderer.getArrayBufferAsync(e).then((e) => {
|
|
9551
|
-
t === this._readbackGeneration && (this._lastBounceCounts = new Uint32Array(e.slice(0)), this._lastBounceCountsBudget = n), this._readbackPending = !1;
|
|
9555
|
+
t === this._readbackGeneration && (this._lastBounceCounts = new Uint32Array(e.slice(0)), this._lastBounceCountsBudget = n, this._curveSizingValid = !0), this._readbackPending = !1;
|
|
9552
9556
|
}).catch((e) => {
|
|
9553
9557
|
console.warn("Wavefront bounceCounts readback failed:", e), this._readbackPending = !1;
|
|
9554
9558
|
});
|
|
@@ -9564,7 +9568,7 @@ var Lu = class extends $s {
|
|
|
9564
9568
|
_rebuildKernelsIfResized(e, t) {
|
|
9565
9569
|
let n = this.storageTextures.renderWidth, r = this.storageTextures.renderHeight;
|
|
9566
9570
|
if (n === e && r === t || !(this.materialData?.materialCount > 0)) return;
|
|
9567
|
-
this._lastBounceCounts = null, this._lastBounceCountsBudget = -1, this._readbackFrameCounter = 0, this._readbackGeneration++;
|
|
9571
|
+
this._lastBounceCounts = null, this._lastBounceCountsBudget = -1, this._curveSizingValid = !1, this._readbackFrameCounter = 0, this._readbackGeneration++;
|
|
9568
9572
|
let i = ac.requiredCapacity(n * r);
|
|
9569
9573
|
!this._packedBuffers || i > this._packedBuffers.capacity ? (this._kernelManager && this._kernelManager.dispose(), this._wavefrontReady = !1, this._buildWavefrontKernels()) : this._resizeWavefrontInPlace(n, r);
|
|
9570
9574
|
}
|
|
@@ -10000,7 +10004,7 @@ var Lu = class extends $s {
|
|
|
10000
10004
|
let d = U(M(l).add(.5).div(a).mul(2).sub(1), M(u).add(.5).div(o).mul(2).sub(1).negate(), 1), f = i.mul(W(d, 1)), m = I(ce(r[0].xyz, r[1].xyz, r[2].xyz).mul(f.xyz.div(f.w))), h = yi({
|
|
10001
10005
|
origin: U(r[3]),
|
|
10002
10006
|
direction: m
|
|
10003
|
-
}), g = Ci.wrap(tl(h, t, e)), _ = g.normal.mul(.5).add(.5), v = g.dst, y = g.didHit.select(W(_, v), W(0, 0, 0, M(65504)));
|
|
10007
|
+
}), g = Ci.wrap(tl(h, t, e)), _ = g.normal.mul(.5).add(.5), v = le(g.dst, M(65504)), y = g.didHit.select(W(_, v), W(0, 0, 0, M(65504)));
|
|
10004
10008
|
z(s, Le(B(l), B(u)), y).toWriteOnly();
|
|
10005
10009
|
let b = g.normal.toVar();
|
|
10006
10010
|
p(g.didHit, () => {
|