@forgeax/engine-vfx-render 0.1.6 → 0.1.7
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/.tsbuildinfo +1 -1
- package/dist/host/vfx-runtime-host.d.ts +18 -5
- package/dist/host/vfx-runtime-host.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +11 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/gpu-host.integration.test.ts +84 -0
- package/src/host/vfx-runtime-host.ts +56 -16
- package/src/index.ts +1 -0
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import type { AssetRegistry as LegacyAssetRegistry } from '@forgeax/engine-assets-runtime';
|
|
2
|
-
import type { AssetRegistry as CoreAssetRegistry } from '@forgeax/engine-assets-runtime/internal';
|
|
1
|
+
import type { AssetRegistry as LegacyAssetRegistry, RuntimeAssetRegistry } from '@forgeax/engine-assets-runtime';
|
|
3
2
|
import { type EntityHandle, type World } from '@forgeax/engine-ecs';
|
|
4
|
-
import type { AssetDecoderLease, Result } from '@forgeax/engine-types';
|
|
3
|
+
import type { Asset, AssetDecoderLease, Result } from '@forgeax/engine-types';
|
|
5
4
|
import type { VfxDataInterfaceError, VfxDataInterfaceProvider, VfxDataInterfaceRequirement, VfxDataInterfaceResolution, VfxGpuPlayerInspectSnapshot, VfxGpuRuntimeDiagnostic, VfxReplayInput, VfxValueMap } from '@forgeax/engine-vfx';
|
|
6
5
|
import type { ParticleRenderCameraSource } from '../feature/camera.js';
|
|
7
6
|
import { gpuParticleRenderFeature } from '../feature/gpu-particle-feature.js';
|
|
8
7
|
import { type VfxDataInterfaceRegistry } from './data-interface-providers.js';
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Public authoring projection accepted by the VFX host. Editor owns the
|
|
10
|
+
* projection, while the Engine App still owns bytes/decoders/cache. Keeping
|
|
11
|
+
* this small structural seam public lets the Editor pass that projection
|
|
12
|
+
* without importing the runtime registry's internal module or fabricating a
|
|
13
|
+
* second registry identity.
|
|
14
|
+
*/
|
|
15
|
+
export interface VfxAuthoringAssetRegistry {
|
|
16
|
+
readonly loaders: {
|
|
17
|
+
registerPackLoader(loader: unknown): void;
|
|
18
|
+
};
|
|
19
|
+
lookup<T extends Asset = Asset>(guid: string): T | undefined;
|
|
20
|
+
readonly load?: (guid: string, kind: string) => Promise<Result<unknown, unknown>>;
|
|
21
|
+
}
|
|
22
|
+
type AssetRegistry = LegacyAssetRegistry | RuntimeAssetRegistry | VfxAuthoringAssetRegistry;
|
|
10
23
|
export interface VfxRuntimeHostOptions {
|
|
11
24
|
readonly camera: ParticleRenderCameraSource;
|
|
12
25
|
readonly maxQueuedTicks?: number;
|
|
@@ -77,7 +90,7 @@ export interface VfxRuntimeHost {
|
|
|
77
90
|
}, VfxRuntimeHostError>>;
|
|
78
91
|
}
|
|
79
92
|
/** Install the VFX owner decoder into the core registry. */
|
|
80
|
-
export declare function installVfxRuntimeDecoder(registry:
|
|
93
|
+
export declare function installVfxRuntimeDecoder(registry: RuntimeAssetRegistry): AssetDecoderLease;
|
|
81
94
|
export interface VfxRuntimeHostInspectSnapshot {
|
|
82
95
|
readonly generation: number;
|
|
83
96
|
/** VFX GPU resource generation; distinct from host attachment generation. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vfx-runtime-host.d.ts","sourceRoot":"","sources":["../../src/host/vfx-runtime-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"vfx-runtime-host.d.ts","sourceRoot":"","sources":["../../src/host/vfx-runtime-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,IAAI,mBAAmB,EACpC,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,KAA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AwB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,iBAAiB,CAE1F;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,6EAA6E;IAC7E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACzD,QAAQ,CAAC,WAAW,EAAE,SAAS,uBAAuB,EAAE,CAAC;CAC1D;AAsBD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAkSnF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export type { VfxStagePlanError, VfxStagePlanObservation, VfxStageReadiness, Vfx
|
|
|
6
6
|
export { observeStagePlan, stageDispatches, stageRecoveryReadiness, validatedStagePlan, } from './feature/stage-plan.js';
|
|
7
7
|
export type { VfxDataInterfaceAvailabilitySource, VfxDataInterfaceProvider, VfxDataInterfaceRegistry, } from './host/data-interface-providers.js';
|
|
8
8
|
export { createCameraProvider, createSceneDepthProvider, createVfxDataInterfaceRegistry, } from './host/data-interface-providers.js';
|
|
9
|
-
export type { VfxRuntimeHost, VfxRuntimeHostControl, VfxRuntimeHostControlError, VfxRuntimeHostError, VfxRuntimeHostInspectSnapshot, VfxRuntimeHostOptions, } from './host/vfx-runtime-host.js';
|
|
9
|
+
export type { VfxAuthoringAssetRegistry, VfxRuntimeHost, VfxRuntimeHostControl, VfxRuntimeHostControlError, VfxRuntimeHostError, VfxRuntimeHostInspectSnapshot, VfxRuntimeHostOptions, } from './host/vfx-runtime-host.js';
|
|
10
10
|
export { createVfxRuntimeHost, installVfxRuntimeDecoder } from './host/vfx-runtime-host.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,8BAA8B,EAC9B,wBAAwB,EACxB,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,kCAAkC,EAClC,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,8BAA8B,EAC9B,wBAAwB,EACxB,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,kCAAkC,EAClC,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { frustum } from '@forgeax/engine-math';
|
|
|
2
2
|
import { Transform } from '@forgeax/engine-scene';
|
|
3
3
|
import { err, ok } from '@forgeax/engine-types';
|
|
4
4
|
import { VFX_GPU_RUNTIME_RESOURCE_KEY, vfxGpuEffectContribution, vfxGpuEffectPackLoader, vfxGpuRuntimePlugin, resolveVfxDataInterfaces, ParticleEffectPlayer } from '@forgeax/engine-vfx';
|
|
5
|
-
import { getAssetRegistryResolver } from '@forgeax/engine-assets-runtime
|
|
5
|
+
import { getAssetRegistryResolver } from '@forgeax/engine-assets-runtime';
|
|
6
6
|
import { createWorldContext } from '@forgeax/engine-ecs';
|
|
7
7
|
|
|
8
8
|
// src/feature/event-resources.ts
|
|
@@ -1067,7 +1067,8 @@ function createVfxRuntimeHost(options) {
|
|
|
1067
1067
|
const cached = attached.renderAssets.get(key);
|
|
1068
1068
|
if (cached?.kind === kind) return cached;
|
|
1069
1069
|
if ("lookup" in attached.assets) {
|
|
1070
|
-
const
|
|
1070
|
+
const lookup = attached.assets.lookup;
|
|
1071
|
+
const legacy = lookup.call(attached.assets, guid);
|
|
1071
1072
|
if (legacy?.kind === kind) {
|
|
1072
1073
|
attached.renderAssets.set(key, legacy);
|
|
1073
1074
|
return legacy;
|
|
@@ -1078,9 +1079,10 @@ function createVfxRuntimeHost(options) {
|
|
|
1078
1079
|
attached.renderAssets.set(key, resolved);
|
|
1079
1080
|
return resolved;
|
|
1080
1081
|
}
|
|
1081
|
-
if ("load" in attached.assets && !attached.pendingRenderAssets.has(key)) {
|
|
1082
|
+
if ("load" in attached.assets && typeof attached.assets.load === "function" && !attached.pendingRenderAssets.has(key)) {
|
|
1082
1083
|
const epoch = attached.catalogEpoch;
|
|
1083
|
-
const
|
|
1084
|
+
const load = attached.assets.load;
|
|
1085
|
+
const request = load(guid, kind).then((result) => {
|
|
1084
1086
|
if (!result.ok || worlds.get(world) !== attached || attached.catalogEpoch !== epoch)
|
|
1085
1087
|
return;
|
|
1086
1088
|
attached.renderAssets.set(key, result.value);
|
|
@@ -1210,10 +1212,12 @@ function createVfxRuntimeHost(options) {
|
|
|
1210
1212
|
if (worlds.has(world)) return ok({ state: "already-attached" });
|
|
1211
1213
|
if (!registries.has(assets)) {
|
|
1212
1214
|
try {
|
|
1213
|
-
if ("
|
|
1215
|
+
if ("loaders" in assets) {
|
|
1216
|
+
assets.loaders.registerPackLoader(vfxGpuEffectPackLoader);
|
|
1217
|
+
} else if ("installDecoder" in assets) {
|
|
1214
1218
|
assets.installDecoder(vfxGpuEffectContribution.kind, vfxGpuEffectContribution.decoder);
|
|
1215
1219
|
} else {
|
|
1216
|
-
assets
|
|
1220
|
+
throw new TypeError("VFX assets registry exposes neither loaders nor installDecoder");
|
|
1217
1221
|
}
|
|
1218
1222
|
registries.add(assets);
|
|
1219
1223
|
} catch (cause) {
|
|
@@ -1245,7 +1249,7 @@ function createVfxRuntimeHost(options) {
|
|
|
1245
1249
|
);
|
|
1246
1250
|
}
|
|
1247
1251
|
let resolver;
|
|
1248
|
-
if ("installDecoder" in assets) {
|
|
1252
|
+
if (!("loaders" in assets) && "installDecoder" in assets) {
|
|
1249
1253
|
try {
|
|
1250
1254
|
resolver = getAssetRegistryResolver(assets);
|
|
1251
1255
|
} catch {
|