@forgeax/engine-render 0.1.35 → 0.1.36
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 +17 -0
- package/dist/assembly/webgpu-vertex-layouts.d.ts.map +1 -1
- package/dist/{chunk-MXTWKZO4.mjs → chunk-2OZAS3WU.mjs} +225 -4
- package/dist/chunk-2OZAS3WU.mjs.map +1 -0
- package/dist/{chunk-G6HDNGY7.mjs → chunk-BZQ4CDRF.mjs} +24 -230
- package/dist/chunk-BZQ4CDRF.mjs.map +1 -0
- package/dist/{chunk-LNIUIKQ7.mjs → chunk-CJOV2XLO.mjs} +77 -19
- package/dist/chunk-CJOV2XLO.mjs.map +1 -0
- package/dist/{chunk-3XUBWRY2.mjs → chunk-D6WSBXJ2.mjs} +4 -4
- package/dist/{chunk-3XUBWRY2.mjs.map → chunk-D6WSBXJ2.mjs.map} +1 -1
- package/dist/{chunk-LM5IE7GF.mjs → chunk-DRF6OULX.mjs} +3 -3
- package/dist/{chunk-LM5IE7GF.mjs.map → chunk-DRF6OULX.mjs.map} +1 -1
- package/dist/{chunk-SGPUJW3F.mjs → chunk-OB5WAFYH.mjs} +3 -3
- package/dist/{chunk-SGPUJW3F.mjs.map → chunk-OB5WAFYH.mjs.map} +1 -1
- package/dist/{chunk-MZ4C7EHF.mjs → chunk-OEYKKMXG.mjs} +5 -5
- package/dist/{chunk-MZ4C7EHF.mjs.map → chunk-OEYKKMXG.mjs.map} +1 -1
- package/dist/construct-renderer.mjs +130 -71
- package/dist/construct-renderer.mjs.map +1 -1
- package/dist/device/device-scope.d.ts.map +1 -1
- package/dist/features/particle-mesh-layout.d.ts +19 -0
- package/dist/features/particle-mesh-layout.d.ts.map +1 -0
- package/dist/features/types.d.ts +5 -1
- package/dist/features/types.d.ts.map +1 -1
- package/dist/gpu-driven/production-raster.d.ts +1 -1
- package/dist/gpu-driven/production-raster.d.ts.map +1 -1
- package/dist/gpu-driven/shadow-views.d.ts +1 -1
- package/dist/gpu-driven/shadow-views.d.ts.map +1 -1
- package/dist/gpu-driven/view-gpu.d.ts +1 -1
- package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
- package/dist/index.mjs +48 -36
- package/dist/index.mjs.map +1 -1
- package/dist/internal.mjs +5 -5
- package/dist/pbr-pipeline.d.ts.map +1 -1
- package/dist/publication/publisher.d.ts +1 -0
- package/dist/publication/publisher.d.ts.map +1 -1
- package/dist/record/frame.d.ts.map +1 -1
- package/dist/record/prepared-material-bindings.d.ts +1 -2
- package/dist/record/prepared-material-bindings.d.ts.map +1 -1
- package/dist/record/render-context.d.ts +2 -0
- package/dist/record/render-context.d.ts.map +1 -1
- package/dist/record/shadow-pass.d.ts +2 -2
- package/dist/record/shadow-pass.d.ts.map +1 -1
- package/dist/record/typed-frame-graph.d.ts.map +1 -1
- package/dist/recovery/render-system-candidate.d.ts +1 -8
- package/dist/recovery/render-system-candidate.d.ts.map +1 -1
- package/dist/render-system-extract-tail.d.ts.map +1 -1
- package/dist/render-system-extract.d.ts.map +1 -1
- package/dist/render-system.d.ts.map +1 -1
- package/dist/temporal/index.mjs +4 -4
- package/dist/typed-shadow-passes.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/__tests__/device-scope-lifecycle.unit.test.ts +26 -0
- package/src/__tests__/gpu-driven-production.integration.test.ts +18 -1
- package/src/__tests__/gpu-driven-shadow-views.unit.test.ts +23 -0
- package/src/__tests__/material-vertex-texture.browser.test.ts +7 -0
- package/src/__tests__/material-vertex-texture.dawn.test.ts +7 -0
- package/src/__tests__/material-vertex-texture.fixture.ts +31 -0
- package/src/__tests__/recovery-candidate-prepare.contract.test.ts +5 -0
- package/src/__tests__/renderer-factory-material-contract.unit.test.ts +106 -4
- package/src/__tests__/runtime-material-program.integration.test.ts +79 -0
- package/src/__tests__/vertex-layouts-ssot.unit.test.ts +23 -3
- package/src/assembly/webgpu-renderer.ts +12 -9
- package/src/assembly/webgpu-vertex-layouts.ts +2 -9
- package/src/device/device-scope.ts +3 -0
- package/src/features/particle-mesh-layout.ts +25 -0
- package/src/features/types.ts +5 -1
- package/src/gpu-driven/production-raster.ts +9 -3
- package/src/gpu-driven/shadow-views.ts +27 -2
- package/src/gpu-driven/view-gpu.ts +5 -0
- package/src/pbr-pipeline.ts +4 -1
- package/src/publication/__tests__/features.integration.test.ts +51 -0
- package/src/publication/__tests__/publication.integration.test.ts +45 -0
- package/src/publication/publisher.ts +56 -29
- package/src/record/__tests__/prepared-runtime-material.integration.test.ts +134 -0
- package/src/record/frame.ts +45 -6
- package/src/record/prepared-material-bindings.ts +11 -37
- package/src/record/render-context.ts +2 -0
- package/src/record/shadow-pass.ts +65 -4
- package/src/record/typed-frame-graph.ts +5 -1
- package/src/recovery/render-system-candidate.ts +1 -9
- package/src/render-system-extract-tail.ts +15 -6
- package/src/render-system-extract.ts +9 -2
- package/src/render-system.ts +0 -1
- package/src/typed-shadow-passes.ts +36 -5
- package/dist/chunk-G6HDNGY7.mjs.map +0 -1
- package/dist/chunk-LNIUIKQ7.mjs.map +0 -1
- package/dist/chunk-MXTWKZO4.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -2981,6 +2981,17 @@ targets, and draw/dispatch commands. Graph buffer and texture access is derived
|
|
|
2981
2981
|
from those roles; producers never author a second `reads`/`writes` ledger and
|
|
2982
2982
|
never receive an encoder or submit authority.
|
|
2983
2983
|
|
|
2984
|
+
Prepared feature materials resolve the same World content as ordinary materials,
|
|
2985
|
+
and published readers consume that accepted projection. Feature publication uses
|
|
2986
|
+
canonical material/mesh handles and preserves the base payload's GUID when
|
|
2987
|
+
runtime content creates a new value object. Numeric World overrides preserve
|
|
2988
|
+
the shared source's cooked Forward, ShadowCaster and scene-index program
|
|
2989
|
+
selection, including when the Catalogue later replaces the same GUID. User material textures and samplers
|
|
2990
|
+
are visible to both vertex and fragment stages, including displacement through
|
|
2991
|
+
`textureSampleLevel`; engine-injected lighting bindings retain their own scopes.
|
|
2992
|
+
Terminal DeviceScope children detach from their parent after cleanup; retiring
|
|
2993
|
+
children remain owned until their in-flight work can release them.
|
|
2994
|
+
|
|
2984
2995
|
Prepared material-input layouts accept `particleInputLanes` from 1 through 4
|
|
2985
2996
|
(omission selects the canonical one-lane layout). The count is valid only for a
|
|
2986
2997
|
material-input vertex layout. Render derives its instance stride and attributes
|
|
@@ -3638,6 +3649,12 @@ The source retains identity and dependency indexes. The receiver owns the only
|
|
|
3638
3649
|
persistent RenderScene for this path and resolves assets through `AssetReader`.
|
|
3639
3650
|
Same-realm Renderer consumers keep their synchronous World path.
|
|
3640
3651
|
|
|
3652
|
+
A publisher admits at most two outstanding revisions: one consuming frame and
|
|
3653
|
+
one sealed successor. Feedback and returned storage are revision-scoped; recycling
|
|
3654
|
+
is ordered, and returned buffers remain available across a drained pipeline.
|
|
3655
|
+
`prepare()` refuses a third frame until capacity returns. Call `accept()` synchronously
|
|
3656
|
+
after successful transfer so source change evidence cannot cross an asynchronous write.
|
|
3657
|
+
|
|
3641
3658
|
Feature frame data and feedback must be structured-cloneable. Extracted data
|
|
3642
3659
|
remains immutable until its submission acknowledgment. A feature's
|
|
3643
3660
|
`assetDependencies(data)` declares GUID roots; their catalog closure and cooked
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-vertex-layouts.d.ts","sourceRoot":"","sources":["../../src/assembly/webgpu-vertex-layouts.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,0BAA0B,EAE/B,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"webgpu-vertex-layouts.d.ts","sourceRoot":"","sources":["../../src/assembly/webgpu-vertex-layouts.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,0BAA0B,EAE/B,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AA2FhE,0EAA0E;AAC1E,eAAO,MAAM,8BAA8B,oBAAoC,CAAC;AAChF,eAAO,MAAM,uCAAuC,oBAA4B,CAAC;AAEjF,eAAO,MAAM,2CAA2C,yBAEZ,CAAC;AAE7C,eAAO,MAAM,0CAA0C,yBAEX,CAAC;AAE7C,eAAO,MAAM,wCAAwC,yBAET,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,8CAA8C,yBAGf,CAAC;AAW7C,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAElF;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,KAAK,CAAC,EAAE,MAAM,GACb,SAAS,qBAAqB,EAAE,GAAG,SAAS,CA8B9C;AAgBD,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,SAAS,0BAA0B,EAAE,GAC7C,SAAS,qBAAqB,EAAE,CAUlC;AAED,wBAAgB,gCAAgC,CAAC,OAAO,EAAE;IACxD,mBAAmB,EAAE,MAAM,GAAG,iBAAiB,CAAC;IAChD,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,sBAAsB,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC3D,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC/C,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC,GAAG,SAAS,qBAAqB,EAAE,CAsDnC"}
|
|
@@ -1148,18 +1148,21 @@ var DeviceScope = class _DeviceScope {
|
|
|
1148
1148
|
this.clearChildren();
|
|
1149
1149
|
this._clearResources();
|
|
1150
1150
|
this.lifecycleState = "retired";
|
|
1151
|
+
this.parent?.detachChild(this);
|
|
1151
1152
|
}
|
|
1152
1153
|
abandon() {
|
|
1153
1154
|
if (this.lifecycleState !== "active") return;
|
|
1154
1155
|
this.lifecycleState = "abandoned";
|
|
1155
1156
|
this.clearChildren();
|
|
1156
1157
|
this._clearResources();
|
|
1158
|
+
this.parent?.detachChild(this);
|
|
1157
1159
|
}
|
|
1158
1160
|
dispose() {
|
|
1159
1161
|
if (this.lifecycleState === "disposed") return;
|
|
1160
1162
|
this.lifecycleState = "disposed";
|
|
1161
1163
|
this.clearChildren();
|
|
1162
1164
|
this._clearResources();
|
|
1165
|
+
this.parent?.detachChild(this);
|
|
1163
1166
|
}
|
|
1164
1167
|
async replace(generation, resources) {
|
|
1165
1168
|
const replacement = new _DeviceScope(generation, this.owner, this);
|
|
@@ -1985,7 +1988,7 @@ function buildPbrMaterialUserRegionEntries(paramSchema = STANDARD_PIPELINE_PARAM
|
|
|
1985
1988
|
let entries = derived.bglEntries.map(
|
|
1986
1989
|
(entry) => ({
|
|
1987
1990
|
binding: entry.binding,
|
|
1988
|
-
visibility: entry.visibility,
|
|
1991
|
+
visibility: entry.texture !== void 0 || entry.sampler !== void 0 ? GPU_SHADER_STAGE_VERTEX | GPU_SHADER_STAGE_FRAGMENT : entry.visibility,
|
|
1989
1992
|
...entry.buffer === void 0 ? {} : { buffer: entry.buffer },
|
|
1990
1993
|
...entry.sampler === void 0 ? {} : { sampler: entry.sampler },
|
|
1991
1994
|
...entry.texture === void 0 ? {} : { texture: entry.texture },
|
|
@@ -3263,6 +3266,224 @@ function buildGpuDrivenDraws(input) {
|
|
|
3263
3266
|
});
|
|
3264
3267
|
}
|
|
3265
3268
|
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
+
// src/instances-derived-bounds.ts
|
|
3270
|
+
var fingerprintScalar = new Float32Array(1);
|
|
3271
|
+
var fingerprintBits = new Uint32Array(fingerprintScalar.buffer);
|
|
3272
|
+
function fingerprintNumericArray(values) {
|
|
3273
|
+
let hash = 2166136261;
|
|
3274
|
+
for (let index = 0; index < values.length; index += 1) {
|
|
3275
|
+
fingerprintScalar[0] = Number(values[index]);
|
|
3276
|
+
hash = Math.imul(hash ^ (fingerprintBits[0] ?? 0), 16777619) >>> 0;
|
|
3277
|
+
}
|
|
3278
|
+
return hash >>> 0;
|
|
3279
|
+
}
|
|
3280
|
+
function finiteAabb(aabb) {
|
|
3281
|
+
if (aabb === void 0 || aabb.length < 6) return false;
|
|
3282
|
+
const minX = aabb[0];
|
|
3283
|
+
const minY = aabb[1];
|
|
3284
|
+
const minZ = aabb[2];
|
|
3285
|
+
const maxX = aabb[3];
|
|
3286
|
+
const maxY = aabb[4];
|
|
3287
|
+
const maxZ = aabb[5];
|
|
3288
|
+
return Number.isFinite(minX) && Number.isFinite(minY) && Number.isFinite(minZ) && Number.isFinite(maxX) && Number.isFinite(maxY) && Number.isFinite(maxZ) && minX <= maxX && minY <= maxY && minZ <= maxZ;
|
|
3289
|
+
}
|
|
3290
|
+
function finiteMatrix(matrix) {
|
|
3291
|
+
if (matrix.length < 16) return false;
|
|
3292
|
+
for (let index = 0; index < 16; index += 1) {
|
|
3293
|
+
if (!Number.isFinite(matrix[index])) return false;
|
|
3294
|
+
}
|
|
3295
|
+
return true;
|
|
3296
|
+
}
|
|
3297
|
+
function multiplyMat4(out, left, right, rightOffset = 0) {
|
|
3298
|
+
for (let column = 0; column < 4; column += 1) {
|
|
3299
|
+
const rightColumn = rightOffset + column * 4;
|
|
3300
|
+
const right0 = Number(right[rightColumn] ?? 0);
|
|
3301
|
+
const right1 = Number(right[rightColumn + 1] ?? 0);
|
|
3302
|
+
const right2 = Number(right[rightColumn + 2] ?? 0);
|
|
3303
|
+
const right3 = Number(right[rightColumn + 3] ?? 0);
|
|
3304
|
+
const outOffset = column * 4;
|
|
3305
|
+
out[outOffset] = Number(left[0] ?? 0) * right0 + Number(left[4] ?? 0) * right1 + Number(left[8] ?? 0) * right2 + Number(left[12] ?? 0) * right3;
|
|
3306
|
+
out[outOffset + 1] = Number(left[1] ?? 0) * right0 + Number(left[5] ?? 0) * right1 + Number(left[9] ?? 0) * right2 + Number(left[13] ?? 0) * right3;
|
|
3307
|
+
out[outOffset + 2] = Number(left[2] ?? 0) * right0 + Number(left[6] ?? 0) * right1 + Number(left[10] ?? 0) * right2 + Number(left[14] ?? 0) * right3;
|
|
3308
|
+
out[outOffset + 3] = Number(left[3] ?? 0) * right0 + Number(left[7] ?? 0) * right1 + Number(left[11] ?? 0) * right2 + Number(left[15] ?? 0) * right3;
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
function finiteMatrixAt(values, offset) {
|
|
3312
|
+
if (values.length - offset < 16) return false;
|
|
3313
|
+
for (let index = 0; index < 16; index += 1) {
|
|
3314
|
+
if (!Number.isFinite(values[offset + index])) return false;
|
|
3315
|
+
}
|
|
3316
|
+
return true;
|
|
3317
|
+
}
|
|
3318
|
+
function isAffine(matrix) {
|
|
3319
|
+
return matrix[3] === 0 && matrix[7] === 0 && matrix[11] === 0 && matrix[15] === 1;
|
|
3320
|
+
}
|
|
3321
|
+
function includeBox(out, candidate, initialized) {
|
|
3322
|
+
const minX = candidate[0];
|
|
3323
|
+
const minY = candidate[1];
|
|
3324
|
+
const minZ = candidate[2];
|
|
3325
|
+
const maxX = candidate[3];
|
|
3326
|
+
const maxY = candidate[4];
|
|
3327
|
+
const maxZ = candidate[5];
|
|
3328
|
+
if (!initialized) {
|
|
3329
|
+
out[0] = minX;
|
|
3330
|
+
out[1] = minY;
|
|
3331
|
+
out[2] = minZ;
|
|
3332
|
+
out[3] = maxX;
|
|
3333
|
+
out[4] = maxY;
|
|
3334
|
+
out[5] = maxZ;
|
|
3335
|
+
return true;
|
|
3336
|
+
}
|
|
3337
|
+
if (minX < (out[0] ?? Number.POSITIVE_INFINITY)) out[0] = minX;
|
|
3338
|
+
if (minY < (out[1] ?? Number.POSITIVE_INFINITY)) out[1] = minY;
|
|
3339
|
+
if (minZ < (out[2] ?? Number.POSITIVE_INFINITY)) out[2] = minZ;
|
|
3340
|
+
if (maxX > (out[3] ?? Number.NEGATIVE_INFINITY)) out[3] = maxX;
|
|
3341
|
+
if (maxY > (out[4] ?? Number.NEGATIVE_INFINITY)) out[4] = maxY;
|
|
3342
|
+
if (maxZ > (out[5] ?? Number.NEGATIVE_INFINITY)) out[5] = maxZ;
|
|
3343
|
+
return true;
|
|
3344
|
+
}
|
|
3345
|
+
function transformAabb(out, local, matrix) {
|
|
3346
|
+
const minX = local[0];
|
|
3347
|
+
const minY = local[1];
|
|
3348
|
+
const minZ = local[2];
|
|
3349
|
+
const maxX = local[3];
|
|
3350
|
+
const maxY = local[4];
|
|
3351
|
+
const maxZ = local[5];
|
|
3352
|
+
const centerX = (minX + maxX) * 0.5;
|
|
3353
|
+
const centerY = (minY + maxY) * 0.5;
|
|
3354
|
+
const centerZ = (minZ + maxZ) * 0.5;
|
|
3355
|
+
const extentX = (maxX - minX) * 0.5;
|
|
3356
|
+
const extentY = (maxY - minY) * 0.5;
|
|
3357
|
+
const extentZ = (maxZ - minZ) * 0.5;
|
|
3358
|
+
if (isAffine(matrix)) {
|
|
3359
|
+
const centerWorldX = matrix[0] * centerX + matrix[4] * centerY + matrix[8] * centerZ + matrix[12];
|
|
3360
|
+
const centerWorldY = matrix[1] * centerX + matrix[5] * centerY + matrix[9] * centerZ + matrix[13];
|
|
3361
|
+
const centerWorldZ = matrix[2] * centerX + matrix[6] * centerY + matrix[10] * centerZ + matrix[14];
|
|
3362
|
+
const extentWorldX = Math.abs(matrix[0]) * extentX + Math.abs(matrix[4]) * extentY + Math.abs(matrix[8]) * extentZ;
|
|
3363
|
+
const extentWorldY = Math.abs(matrix[1]) * extentX + Math.abs(matrix[5]) * extentY + Math.abs(matrix[9]) * extentZ;
|
|
3364
|
+
const extentWorldZ = Math.abs(matrix[2]) * extentX + Math.abs(matrix[6]) * extentY + Math.abs(matrix[10]) * extentZ;
|
|
3365
|
+
out[0] = centerWorldX - extentWorldX;
|
|
3366
|
+
out[1] = centerWorldY - extentWorldY;
|
|
3367
|
+
out[2] = centerWorldZ - extentWorldZ;
|
|
3368
|
+
out[3] = centerWorldX + extentWorldX;
|
|
3369
|
+
out[4] = centerWorldY + extentWorldY;
|
|
3370
|
+
out[5] = centerWorldZ + extentWorldZ;
|
|
3371
|
+
return finiteAabb(out);
|
|
3372
|
+
}
|
|
3373
|
+
let minimumW = Number.POSITIVE_INFINITY;
|
|
3374
|
+
let maximumW = Number.NEGATIVE_INFINITY;
|
|
3375
|
+
for (let corner = 0; corner < 8; corner += 1) {
|
|
3376
|
+
const x = (corner & 1) === 0 ? minX : maxX;
|
|
3377
|
+
const y = (corner & 2) === 0 ? minY : maxY;
|
|
3378
|
+
const z = (corner & 4) === 0 ? minZ : maxZ;
|
|
3379
|
+
const w = matrix[3] * x + matrix[7] * y + matrix[11] * z + matrix[15];
|
|
3380
|
+
if (!Number.isFinite(w)) return false;
|
|
3381
|
+
if (w < minimumW) minimumW = w;
|
|
3382
|
+
if (w > maximumW) maximumW = w;
|
|
3383
|
+
}
|
|
3384
|
+
if (minimumW <= 0 && maximumW >= 0) return false;
|
|
3385
|
+
let unionMinX = Number.POSITIVE_INFINITY;
|
|
3386
|
+
let unionMinY = Number.POSITIVE_INFINITY;
|
|
3387
|
+
let unionMinZ = Number.POSITIVE_INFINITY;
|
|
3388
|
+
let unionMaxX = Number.NEGATIVE_INFINITY;
|
|
3389
|
+
let unionMaxY = Number.NEGATIVE_INFINITY;
|
|
3390
|
+
let unionMaxZ = Number.NEGATIVE_INFINITY;
|
|
3391
|
+
for (let corner = 0; corner < 8; corner += 1) {
|
|
3392
|
+
const x = (corner & 1) === 0 ? minX : maxX;
|
|
3393
|
+
const y = (corner & 2) === 0 ? minY : maxY;
|
|
3394
|
+
const z = (corner & 4) === 0 ? minZ : maxZ;
|
|
3395
|
+
const rawX = matrix[0] * x + matrix[4] * y + matrix[8] * z + matrix[12];
|
|
3396
|
+
const rawY = matrix[1] * x + matrix[5] * y + matrix[9] * z + matrix[13];
|
|
3397
|
+
const rawZ = matrix[2] * x + matrix[6] * y + matrix[10] * z + matrix[14];
|
|
3398
|
+
const w = matrix[3] * x + matrix[7] * y + matrix[11] * z + matrix[15];
|
|
3399
|
+
const projectedX = rawX / w;
|
|
3400
|
+
const projectedY = rawY / w;
|
|
3401
|
+
const projectedZ = rawZ / w;
|
|
3402
|
+
if (!Number.isFinite(projectedX) || !Number.isFinite(projectedY) || !Number.isFinite(projectedZ)) {
|
|
3403
|
+
return false;
|
|
3404
|
+
}
|
|
3405
|
+
if (projectedX < unionMinX) unionMinX = projectedX;
|
|
3406
|
+
if (projectedY < unionMinY) unionMinY = projectedY;
|
|
3407
|
+
if (projectedZ < unionMinZ) unionMinZ = projectedZ;
|
|
3408
|
+
if (projectedX > unionMaxX) unionMaxX = projectedX;
|
|
3409
|
+
if (projectedY > unionMaxY) unionMaxY = projectedY;
|
|
3410
|
+
if (projectedZ > unionMaxZ) unionMaxZ = projectedZ;
|
|
3411
|
+
}
|
|
3412
|
+
out[0] = unionMinX;
|
|
3413
|
+
out[1] = unionMinY;
|
|
3414
|
+
out[2] = unionMinZ;
|
|
3415
|
+
out[3] = unionMaxX;
|
|
3416
|
+
out[4] = unionMaxY;
|
|
3417
|
+
out[5] = unionMaxZ;
|
|
3418
|
+
return finiteAabb(out);
|
|
3419
|
+
}
|
|
3420
|
+
function deriveInstancesUnionBounds(input) {
|
|
3421
|
+
const { meshAabb, entityWorld, transforms } = input;
|
|
3422
|
+
if (!finiteAabb(meshAabb) || !finiteMatrix(entityWorld) || transforms === void 0) {
|
|
3423
|
+
return void 0;
|
|
3424
|
+
}
|
|
3425
|
+
if (transforms.length === 0 || transforms.length % 16 !== 0) return void 0;
|
|
3426
|
+
const local = meshAabb;
|
|
3427
|
+
const union = new Float32Array(6);
|
|
3428
|
+
const composed = new Float32Array(16);
|
|
3429
|
+
const transformed = new Float32Array(6);
|
|
3430
|
+
let initialized = false;
|
|
3431
|
+
for (let offset = 0; offset < transforms.length; offset += 16) {
|
|
3432
|
+
if (!finiteMatrixAt(transforms, offset)) return void 0;
|
|
3433
|
+
multiplyMat4(composed, entityWorld, transforms, offset);
|
|
3434
|
+
if (!finiteMatrix(composed) || !transformAabb(transformed, local, composed)) return void 0;
|
|
3435
|
+
initialized = includeBox(union, transformed, initialized);
|
|
3436
|
+
}
|
|
3437
|
+
return initialized && finiteAabb(union) ? union : void 0;
|
|
3438
|
+
}
|
|
3439
|
+
var InstanceBoundsCache = class {
|
|
3440
|
+
entries = /* @__PURE__ */ new Map();
|
|
3441
|
+
hits = 0;
|
|
3442
|
+
misses = 0;
|
|
3443
|
+
derives = 0;
|
|
3444
|
+
invalidations = 0;
|
|
3445
|
+
key(input) {
|
|
3446
|
+
return `${input.worldId === void 0 ? "" : `${input.worldId}:`}${input.entityKey}`;
|
|
3447
|
+
}
|
|
3448
|
+
get(input) {
|
|
3449
|
+
const previous = this.entries.get(this.key(input));
|
|
3450
|
+
if (previous !== void 0 && previous.meshGeneration === input.meshGeneration && previous.transformGeneration === input.transformGeneration && previous.matrixGeneration === input.matrixGeneration) {
|
|
3451
|
+
this.hits += 1;
|
|
3452
|
+
return previous.bounds;
|
|
3453
|
+
}
|
|
3454
|
+
this.misses += 1;
|
|
3455
|
+
this.derives += 1;
|
|
3456
|
+
const bounds = deriveInstancesUnionBounds(input);
|
|
3457
|
+
this.entries.set(this.key(input), {
|
|
3458
|
+
...input.worldId === void 0 ? {} : { worldId: input.worldId },
|
|
3459
|
+
entityKey: input.entityKey,
|
|
3460
|
+
meshGeneration: input.meshGeneration,
|
|
3461
|
+
transformGeneration: input.transformGeneration,
|
|
3462
|
+
matrixGeneration: input.matrixGeneration,
|
|
3463
|
+
bounds
|
|
3464
|
+
});
|
|
3465
|
+
return bounds;
|
|
3466
|
+
}
|
|
3467
|
+
invalidate(entityKey, worldId) {
|
|
3468
|
+
if (entityKey === void 0) {
|
|
3469
|
+
if (this.entries.size > 0) this.invalidations += this.entries.size;
|
|
3470
|
+
this.entries.clear();
|
|
3471
|
+
} else {
|
|
3472
|
+
if (this.entries.delete(this.key({ entityKey, ...worldId === void 0 ? {} : { worldId } }))) {
|
|
3473
|
+
this.invalidations += 1;
|
|
3474
|
+
}
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
inspect() {
|
|
3478
|
+
return {
|
|
3479
|
+
hits: this.hits,
|
|
3480
|
+
misses: this.misses,
|
|
3481
|
+
derives: this.derives,
|
|
3482
|
+
invalidations: this.invalidations
|
|
3483
|
+
};
|
|
3484
|
+
}
|
|
3485
|
+
};
|
|
3486
|
+
|
|
3487
|
+
export { AtmosphereInvalidParameterError, AutoExposureCapabilityUnavailableError, AutoExposureInvalidParameterError, AutoExposureStageFailedError, AutoExposureStaleGenerationError, BarrelDistortionInvalidParameterError, COOKIE_MATRIX_BYTES, COOKIE_SLICE_CAPACITY, COOKIE_SLICE_SIZE, DEFAULT_MOTION_BLUR_PARAMS, DeviceScope, DynamicResolutionInvalidParameterError, DynamicResolutionRequiresTaaError, DynamicResolutionTimingUnavailableError, EXTENDED_LIGHTING_REQUIRED_SAMPLED_TEXTURES, EXTENDED_LIGHTING_TOPOLOGY, EnvironmentGenerationFailedError, EnvironmentSourceConflictError, EquirectProjectionFailedError, FXAA_POST_PROCESS_ID, FogCardinalityError, FrameReceiptStaleError, GPU_BUFFER_USAGE_COPY_DST, GPU_BUFFER_USAGE_COPY_SRC, GPU_BUFFER_USAGE_INDEX, GPU_BUFFER_USAGE_INDIRECT, GPU_BUFFER_USAGE_MAP_READ, GPU_BUFFER_USAGE_QUERY_RESOLVE, GPU_BUFFER_USAGE_STORAGE, GPU_BUFFER_USAGE_UNIFORM, GPU_BUFFER_USAGE_VERTEX, GPU_SHADER_STAGE_COMPUTE, GPU_SHADER_STAGE_FRAGMENT, GPU_SHADER_STAGE_VERTEX, GPU_TEXTURE_USAGE_COPY_DST, GPU_TEXTURE_USAGE_COPY_SRC, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING, GPU_TEXTURE_USAGE_STORAGE_BINDING, GPU_TEXTURE_USAGE_TEXTURE_BINDING, GpuDrivenPreparationError, IES_SLICE_CAPACITY, IES_SLICE_HEIGHT, IES_SLICE_WIDTH, InstanceBoundsCache, InstanceProjectionStore, InstanceTransformsError, LifecycleTransaction, MOTION_BLUR_PARAMS_BYTE_SIZE, MaterialSkinAttrMissingError, MotionBlurValidationError, ObservationUnavailableError, OwnerStageFailedError, PointShadowAtlasBoundsViolationError, PointShadowAtlasUninitializedError, PointsLinesBudgetExceededError, PointsLinesInvalidStyleError, PointsLinesMaterialUnsupportedError, PointsLinesPrepareFailedError, PointsLinesStyleUnsupportedError, PointsLinesTopologyMismatchError, RENDER_PHASE_CATALOG, RenderFeatureCapabilityMissingError, RenderFeatureDrawRecordingFailedError, RenderFeaturePreparationFailedError, RenderFeaturePreparedStateMismatchError, RenderFeatureRegistrationConflictError, RenderFeatureStageFailedError, RenderIntentInvalidError, RenderTargetCapabilityMissingError, RenderTargetDescriptorInvalidError, RenderTargetOperationFailedError, RenderTargetStateInvalidError, RendererContractFailureError, RendererOperationError, SHADOW_ATLAS_DEFAULT_FACE_SIZE, SHADOW_ATLAS_DEFAULT_LAYERS, SHADOW_CASTER_SHADER_ID, SKIN_MATERIAL_SHADER_ID, SPRITE_PASS_PER_INSTANCE_REGION_VARIANT_SET, STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, SceneDataUnavailableError, ShadowAtlas, ShadowInvalidConfigError, SkinMaterialMismatchError, SkinPaletteOverflowError, StandardClusterIndexOverflowError, StandardClusterTransportUnavailableError, StandardLightBudgetExceededError, StandardProfileInvalidError, TaaCapsInsufficientError, TemporalFrameSubmitError, TransmissionCapabilityMissingError, VertexColorVariantConflictError, VideoUploadUnsupportedError, VolumeDensityShapeMismatchError, VolumeInvalidBoundsError, VolumeInvalidParametersError, VolumeOwnerConflictError, buildBindGroupLayoutDescriptor, buildGpuDrivenDraws, buildGpuDrivenPbrInstancesBindGroupLayout, buildGpuDrivenPbrPipelineLayout, buildGpuDrivenPbrSkinPipelineLayout, buildPbrMaterialUserRegionEntries, buildPbrPipelineLayouts, buildPbrSkinLayouts, buildSurfaceDirectInstancesBindGroupLayout, createAutoExposureError, createAutoExposureInspection, createHdrpBindGroupLayoutDescriptor, createHdrpSkinBindGroupLayoutDescriptor, createLightResourceUnavailable, createPbrSkinMeshBindGroupEntries, createRenderTargetMaterialSource, createVisibilityBudget, deriveExtendedLightingCapability, deriveInstancesUnionBounds, effectiveMotionBlurSampleCount, extendedLightingSampledTextureCapacityAvailable, fingerprintNumericArray, getOpaqueResourceIdentity, getTextureIdentity, gpuDrivenDrawKey, gpuDrivenMaterialArtifactKey, gpuDrivenShadowDrawKey, gpuDrivenSourceDrawItemIndex, hasRequiredVertexInputs, instanceCollectionCacheKey, instanceUploadRangesForResident, isCanonicalStandardPbrMaterialShader, isMotionBlurIntervalValid, isStandardPbrMaterialShader, isStandardPbrSkinMaterialShader, makeZeroCameraFallbackSnapshot, matchPass, materialBindGroupLayoutIdentity, motionBlurExposureScale, motionBlurSampleDelta, motionBlurTemporalDemand, pbrSkinMeshDynamicOffsets, physicalTextureFields, renderTargetMaterialSourceIdentity, resolveMotionBlurParams, resolvePipelineGroup2Contract, resolveRenderTargetMaterialSource, selectPasses, shadowCasterVariantSet, validateGraphTargetCaptureReadback, validateInstanceTransforms, validateMotionBlurParams, worldEntityKey };
|
|
3488
|
+
//# sourceMappingURL=chunk-2OZAS3WU.mjs.map
|
|
3489
|
+
//# sourceMappingURL=chunk-2OZAS3WU.mjs.map
|