@fps-games/editor 0.1.6-beta.1 → 0.1.7-beta.1
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/agent-bridge/capabilities/assets.d.ts +8 -0
- package/dist/agent-bridge/capabilities/assets.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/assets.js +226 -0
- package/dist/agent-bridge/capabilities/assets.js.map +1 -0
- package/dist/agent-bridge/capabilities/editor-state.d.ts +5 -0
- package/dist/agent-bridge/capabilities/editor-state.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/editor-state.js +72 -0
- package/dist/agent-bridge/capabilities/editor-state.js.map +1 -0
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts +4 -0
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/host-lifecycle.js +87 -0
- package/dist/agent-bridge/capabilities/host-lifecycle.js.map +1 -0
- package/dist/agent-bridge/capabilities/prefabs.d.ts +5 -0
- package/dist/agent-bridge/capabilities/prefabs.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/prefabs.js +735 -0
- package/dist/agent-bridge/capabilities/prefabs.js.map +1 -0
- package/dist/agent-bridge/capabilities/scene-objects.d.ts +9 -0
- package/dist/agent-bridge/capabilities/scene-objects.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/scene-objects.js +394 -0
- package/dist/agent-bridge/capabilities/scene-objects.js.map +1 -0
- package/dist/agent-bridge/capabilities/selection.d.ts +5 -0
- package/dist/agent-bridge/capabilities/selection.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/selection.js +57 -0
- package/dist/agent-bridge/capabilities/selection.js.map +1 -0
- package/dist/agent-bridge/capabilities/shadows.d.ts +5 -0
- package/dist/agent-bridge/capabilities/shadows.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/shadows.js +1876 -0
- package/dist/agent-bridge/capabilities/shadows.js.map +1 -0
- package/dist/agent-bridge/capabilities/transform.d.ts +5 -0
- package/dist/agent-bridge/capabilities/transform.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/transform.js +162 -0
- package/dist/agent-bridge/capabilities/transform.js.map +1 -0
- package/dist/agent-bridge/capabilities/ui-regions.d.ts +4 -0
- package/dist/agent-bridge/capabilities/ui-regions.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/ui-regions.js +168 -0
- package/dist/agent-bridge/capabilities/ui-regions.js.map +1 -0
- package/dist/agent-bridge/capabilities/viewport.d.ts +5 -0
- package/dist/agent-bridge/capabilities/viewport.d.ts.map +1 -0
- package/dist/agent-bridge/capabilities/viewport.js +407 -0
- package/dist/agent-bridge/capabilities/viewport.js.map +1 -0
- package/dist/agent-bridge/capability-sources.d.ts +6 -0
- package/dist/agent-bridge/capability-sources.d.ts.map +1 -0
- package/dist/agent-bridge/capability-sources.js +26 -0
- package/dist/agent-bridge/capability-sources.js.map +1 -0
- package/dist/agent-bridge/diagnostics.d.ts +12 -0
- package/dist/agent-bridge/diagnostics.d.ts.map +1 -0
- package/dist/agent-bridge/diagnostics.js +45 -0
- package/dist/agent-bridge/diagnostics.js.map +1 -0
- package/dist/agent-bridge/index.d.ts +5 -0
- package/dist/agent-bridge/index.d.ts.map +1 -0
- package/dist/agent-bridge/index.js +5 -0
- package/dist/agent-bridge/index.js.map +1 -0
- package/dist/agent-bridge/register.d.ts +4 -0
- package/dist/agent-bridge/register.d.ts.map +1 -0
- package/dist/agent-bridge/register.js +908 -0
- package/dist/agent-bridge/register.js.map +1 -0
- package/dist/agent-bridge/shared.d.ts +189 -0
- package/dist/agent-bridge/shared.d.ts.map +1 -0
- package/dist/agent-bridge/shared.js +39 -0
- package/dist/agent-bridge/shared.js.map +1 -0
- package/dist/agent-bridge/source-types.d.ts +90 -0
- package/dist/agent-bridge/source-types.d.ts.map +1 -0
- package/dist/agent-bridge/source-types.js +2 -0
- package/dist/agent-bridge/source-types.js.map +1 -0
- package/dist/build-info.json +17 -17
- package/dist/local-editor-agent-bridge-transport.d.ts +95 -0
- package/dist/local-editor-agent-bridge-transport.d.ts.map +1 -0
- package/dist/local-editor-agent-bridge-transport.js +340 -0
- package/dist/local-editor-agent-bridge-transport.js.map +1 -0
- package/dist/local-editor-agent-bridge.d.ts +2 -0
- package/dist/local-editor-agent-bridge.d.ts.map +1 -0
- package/dist/local-editor-agent-bridge.js +2 -0
- package/dist/local-editor-agent-bridge.js.map +1 -0
- package/dist/local-editor-harness.d.ts +26 -2
- package/dist/local-editor-harness.d.ts.map +1 -1
- package/dist/local-editor-harness.js +773 -75
- package/dist/local-editor-harness.js.map +1 -1
- package/dist/playable-babylon-rendering.js +20 -0
- package/dist/playable-babylon-rendering.js.map +1 -1
- package/dist/playable-local-editor-host.d.ts +5 -0
- package/dist/playable-local-editor-host.d.ts.map +1 -1
- package/dist/playable-local-editor-host.js +2 -0
- package/dist/playable-local-editor-host.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/blob-shadow-system.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/blob-shadow-system.js +6 -4
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/blob-shadow-system.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-shaders.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-shaders.js +103 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-shaders.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-system.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-system.js +330 -27
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/planar-shadow-system.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-artifact-system.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-artifact-system.js +159 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-artifact-system.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-baker.js +8 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/static-projected-shadow-baker.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.d.ts +53 -2
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.js +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/shadows/types.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/package.json +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +30 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.js +346 -11
- package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.d.ts +11 -0
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.js +113 -29
- package/node_modules/@fps-games/editor-babylon/dist/scene-view-camera-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.d.ts +13 -1
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.js +543 -3
- package/node_modules/@fps-games/editor-babylon/dist/shadow-preview-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/package.json +5 -5
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts +5 -2
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/index.js +3 -1
- package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-context-menu.js +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-context-menu.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-actions.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-actions.js +7 -9
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-actions.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-attach-dialog.js +2 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-attach-dialog.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-command-adapter.d.ts +21 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-command-adapter.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-command-adapter.js +75 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-command-adapter.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.js +288 -71
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-scope.d.ts +5 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-scope.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-scope.js +92 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-scope.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.d.ts +3 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.js +22 -7
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-tree.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.d.ts +4 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.js +21 -14
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts +19 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js +79 -39
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.js +2 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-primitives.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +68 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts +2 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js +10 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +3 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js +401 -241
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/package.json +3 -3
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.d.ts +18 -0
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.js +102 -0
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/index.d.ts +1 -0
- package/node_modules/@fps-games/editor-core/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/index.js +1 -0
- package/node_modules/@fps-games/editor-core/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts +1 -1
- package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/viewport-tools.js.map +1 -1
- package/node_modules/@fps-games/editor-core/package.json +2 -2
- package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/config.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/config.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/config.js +9 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/config.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.d.ts +6 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.js +89 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/generated-module.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/identity.d.ts +18 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/identity.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/identity.js +121 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/identity.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.d.ts +4 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.js +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/index.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/metadata.d.ts +27 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/metadata.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/metadata.js +782 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/metadata.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/node.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/node.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/node.js +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/node.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/registry.d.ts +80 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/registry.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/registry.js +600 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/registry.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/types.d.ts +51 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/types.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/types.js +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-database/types.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.d.ts +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.js +4 -42
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/document.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/index.d.ts +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/index.js +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/placement.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/placement.js +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/placement.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/types.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/asset-placement/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.d.ts +42 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.js +612 -8
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/types.d.ts +42 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/index.d.ts +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/index.js +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/schema.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/schema.js +16 -9
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/schema.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/validators.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/validators.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/validators.js +28 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/field-schema/validators.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.js +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.d.ts +82 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.js +396 -22
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/document-sections.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.d.ts +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.js +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/validation.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/validation.js +0 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/inspector/validation.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/lighting-debug/math.d.ts +29 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/lighting-debug/math.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/lighting-debug/math.js +143 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/lighting-debug/math.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.js +99 -11
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/field-patch.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/reducer.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/reducer.js +4 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/reducer.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/transform.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/transform.js +19 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/mutation/transform.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.js +19 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/rendering-profile/panel.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/assets.d.ts +1 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/assets.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/assets.js +0 -14
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/assets.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/import-plan.d.ts +1 -7
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/import-plan.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/import-plan.js +3 -32
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/import-plan.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.js +16 -32
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/nodes.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/types.d.ts +5 -22
- package/node_modules/@fps-games/editor-playable-sdk/dist/runtime-preview/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/compiler.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/compiler.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/compiler.js +996 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/compiler.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/index.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/index.js +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/index.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/types.d.ts +152 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/types.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/types.js +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-compiler/types.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/protocol.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/protocol.js +4 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/protocol.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.js +224 -12
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/descriptors.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/inspector.js +158 -50
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/patch.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/patch.js +45 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/serialized-property/patch.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/index.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/index.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/index.js +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/index.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/legacy.d.ts +21 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/legacy.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/legacy.js +158 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/legacy.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/quality.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/quality.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/quality.js +83 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/quality.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/resolver.d.ts +35 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/resolver.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/resolver.js +363 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/resolver.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/types.d.ts +105 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/types.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/types.js +6 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/shadow-system/types.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.js +44 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/static-shadows/artifact.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/asset-authoring.d.ts +26 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/asset-authoring.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/asset-authoring.js +105 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/asset-authoring.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js +3 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/package.json +3 -3
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts +1127 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.js +2180 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.d.ts +68 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.js +23 -0
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts +2 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/index.js +2 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-protocol/package.json +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,782 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
export async function resolvePlayableEditorAssetMetadata(input) {
|
|
4
|
+
const metadata = {
|
|
5
|
+
...(input.existingMetadata ?? {}),
|
|
6
|
+
...(input.payloadMetadata ?? {}),
|
|
7
|
+
};
|
|
8
|
+
const assetAnalysis = await resolvePlayableEditorAssetAnalysis(input);
|
|
9
|
+
if (assetAnalysis)
|
|
10
|
+
metadata.assetAnalysis = assetAnalysis;
|
|
11
|
+
else
|
|
12
|
+
delete metadata.assetAnalysis;
|
|
13
|
+
if (input.kind === 'texture' || input.kind === 'image') {
|
|
14
|
+
const textureCapabilities = createPlayableEditorTextureAssetCapabilities(input.sourcePath, metadata);
|
|
15
|
+
if (textureCapabilities) {
|
|
16
|
+
metadata.textureUsage = textureCapabilities.usage;
|
|
17
|
+
metadata.capabilities = {
|
|
18
|
+
...(isRecord(metadata.capabilities) ? metadata.capabilities : {}),
|
|
19
|
+
materialTexture: textureCapabilities.materialTexture,
|
|
20
|
+
environmentTexture: textureCapabilities.environmentTexture,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return Object.keys(metadata).length > 0 ? metadata : null;
|
|
24
|
+
}
|
|
25
|
+
if (input.kind !== 'model')
|
|
26
|
+
return Object.keys(metadata).length > 0 ? metadata : null;
|
|
27
|
+
const materialSlots = await extractPlayableEditorGltfMaterialSlots(input.sourcePath, {
|
|
28
|
+
assetGuid: input.guid,
|
|
29
|
+
assetId: input.assetId,
|
|
30
|
+
cwd: input.cwd,
|
|
31
|
+
assetsDir: input.assetsDir,
|
|
32
|
+
existingMaterialSlots: metadata.materialSlots,
|
|
33
|
+
});
|
|
34
|
+
if (materialSlots.length === 0) {
|
|
35
|
+
delete metadata.materialSlots;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
metadata.materialSlots = materialSlots;
|
|
39
|
+
}
|
|
40
|
+
return Object.keys(metadata).length > 0 ? metadata : null;
|
|
41
|
+
}
|
|
42
|
+
export async function resolvePlayableEditorAssetAnalysis(input) {
|
|
43
|
+
if (input.kind === 'model') {
|
|
44
|
+
return resolvePlayableEditorGltfAssetAnalysis(input.sourcePath);
|
|
45
|
+
}
|
|
46
|
+
if (input.kind === 'texture' || input.kind === 'image') {
|
|
47
|
+
return resolvePlayableEditorImageAssetAnalysis(input.sourcePath);
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
export async function extractPlayableEditorGltfMaterialSlots(sourcePath, context = {}) {
|
|
52
|
+
try {
|
|
53
|
+
const gltf = await readGltfJson(sourcePath);
|
|
54
|
+
return collectGltfMaterialSlots(gltf, {
|
|
55
|
+
...context,
|
|
56
|
+
sourcePath,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function readGltfJson(sourcePath) {
|
|
64
|
+
const extension = path.extname(sourcePath).toLowerCase();
|
|
65
|
+
if (extension === '.gltf') {
|
|
66
|
+
return JSON.parse(await fs.readFile(sourcePath, 'utf8'));
|
|
67
|
+
}
|
|
68
|
+
if (extension !== '.glb')
|
|
69
|
+
return null;
|
|
70
|
+
const bytes = await fs.readFile(sourcePath);
|
|
71
|
+
if (bytes.length < 20 || bytes.toString('utf8', 0, 4) !== 'glTF')
|
|
72
|
+
return null;
|
|
73
|
+
const version = bytes.readUInt32LE(4);
|
|
74
|
+
if (version !== 2)
|
|
75
|
+
return null;
|
|
76
|
+
const declaredLength = bytes.readUInt32LE(8);
|
|
77
|
+
if (declaredLength > bytes.length)
|
|
78
|
+
return null;
|
|
79
|
+
let offset = 12;
|
|
80
|
+
while (offset + 8 <= bytes.length) {
|
|
81
|
+
const chunkLength = bytes.readUInt32LE(offset);
|
|
82
|
+
const chunkType = bytes.readUInt32LE(offset + 4);
|
|
83
|
+
offset += 8;
|
|
84
|
+
if (offset + chunkLength > bytes.length)
|
|
85
|
+
return null;
|
|
86
|
+
if (chunkType === 0x4e4f534a) {
|
|
87
|
+
const jsonText = bytes.toString('utf8', offset, offset + chunkLength).replace(/\0+$/g, '');
|
|
88
|
+
return JSON.parse(jsonText);
|
|
89
|
+
}
|
|
90
|
+
offset += chunkLength;
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
async function resolvePlayableEditorGltfAssetAnalysis(sourcePath) {
|
|
95
|
+
try {
|
|
96
|
+
const gltf = await readGltfJson(sourcePath);
|
|
97
|
+
if (!gltf || typeof gltf !== 'object')
|
|
98
|
+
return null;
|
|
99
|
+
const scenes = Array.isArray(gltf.scenes) ? gltf.scenes : [];
|
|
100
|
+
const nodes = Array.isArray(gltf.nodes) ? gltf.nodes : [];
|
|
101
|
+
const meshes = Array.isArray(gltf.meshes) ? gltf.meshes : [];
|
|
102
|
+
const materials = Array.isArray(gltf.materials) ? gltf.materials : [];
|
|
103
|
+
const textures = Array.isArray(gltf.textures) ? gltf.textures : [];
|
|
104
|
+
const images = Array.isArray(gltf.images) ? gltf.images : [];
|
|
105
|
+
const animations = Array.isArray(gltf.animations) ? gltf.animations : [];
|
|
106
|
+
const skins = Array.isArray(gltf.skins) ? gltf.skins : [];
|
|
107
|
+
const primitiveCount = meshes.reduce((count, mesh) => (count + (Array.isArray(mesh?.primitives) ? mesh.primitives.length : 0)), 0);
|
|
108
|
+
const complexity = resolveAssetComplexity({
|
|
109
|
+
nodeCount: nodes.length,
|
|
110
|
+
meshCount: meshes.length,
|
|
111
|
+
primitiveCount,
|
|
112
|
+
materialCount: materials.length,
|
|
113
|
+
textureCount: textures.length,
|
|
114
|
+
imageCount: images.length,
|
|
115
|
+
});
|
|
116
|
+
const diagnostics = createGltfAssetAnalysisDiagnostics({
|
|
117
|
+
nodeCount: nodes.length,
|
|
118
|
+
meshCount: meshes.length,
|
|
119
|
+
primitiveCount,
|
|
120
|
+
materialCount: materials.length,
|
|
121
|
+
textureCount: textures.length,
|
|
122
|
+
imageCount: images.length,
|
|
123
|
+
animationCount: animations.length,
|
|
124
|
+
skinCount: skins.length,
|
|
125
|
+
complexity,
|
|
126
|
+
});
|
|
127
|
+
const analysis = {
|
|
128
|
+
kind: 'gltf',
|
|
129
|
+
format: path.extname(sourcePath).toLowerCase() === '.gltf' ? 'gltf' : 'glb',
|
|
130
|
+
summary: `${nodes.length} nodes, ${meshes.length} meshes, ${primitiveCount} primitives, ${materials.length} materials`,
|
|
131
|
+
complexity,
|
|
132
|
+
sceneCount: scenes.length,
|
|
133
|
+
nodeCount: nodes.length,
|
|
134
|
+
meshCount: meshes.length,
|
|
135
|
+
primitiveCount,
|
|
136
|
+
materialCount: materials.length,
|
|
137
|
+
textureCount: textures.length,
|
|
138
|
+
imageCount: images.length,
|
|
139
|
+
animationCount: animations.length,
|
|
140
|
+
skinCount: skins.length,
|
|
141
|
+
meshes: createGltfMeshAnalysisSummaries(meshes, materials),
|
|
142
|
+
materials: createGltfMaterialAnalysisSummaries(gltf),
|
|
143
|
+
diagnostics,
|
|
144
|
+
};
|
|
145
|
+
return analysis;
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async function resolvePlayableEditorImageAssetAnalysis(sourcePath) {
|
|
152
|
+
try {
|
|
153
|
+
const bytes = await fs.readFile(sourcePath);
|
|
154
|
+
const extension = path.extname(sourcePath).toLowerCase();
|
|
155
|
+
const image = extension === '.png'
|
|
156
|
+
? readPngImageAnalysis(bytes)
|
|
157
|
+
: extension === '.jpg' || extension === '.jpeg'
|
|
158
|
+
? readJpegImageAnalysis(bytes)
|
|
159
|
+
: extension === '.webp'
|
|
160
|
+
? readWebpImageAnalysis(bytes)
|
|
161
|
+
: null;
|
|
162
|
+
if (!image)
|
|
163
|
+
return null;
|
|
164
|
+
const diagnostics = createImageAssetAnalysisDiagnostics(image);
|
|
165
|
+
return {
|
|
166
|
+
kind: 'image',
|
|
167
|
+
format: image.format,
|
|
168
|
+
summary: `${image.width}x${image.height} ${image.mime}`,
|
|
169
|
+
complexity: image.estimatedPixels >= 4096 * 4096 ? 'high' : image.estimatedPixels >= 2048 * 2048 ? 'medium' : 'low',
|
|
170
|
+
width: image.width,
|
|
171
|
+
height: image.height,
|
|
172
|
+
mime: image.mime,
|
|
173
|
+
bitDepth: image.bitDepth,
|
|
174
|
+
hasAlpha: image.hasAlpha,
|
|
175
|
+
estimatedPixels: image.estimatedPixels,
|
|
176
|
+
diagnostics,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function createGltfMeshAnalysisSummaries(meshes, materials) {
|
|
184
|
+
return meshes.slice(0, 50).map((mesh, meshIndex) => {
|
|
185
|
+
const primitives = Array.isArray(mesh?.primitives) ? mesh.primitives : [];
|
|
186
|
+
const materialIndices = [...new Set(primitives
|
|
187
|
+
.map((primitive) => Number.isInteger(primitive?.material) ? primitive.material : -1)
|
|
188
|
+
.filter((materialIndex) => materialIndex >= 0))];
|
|
189
|
+
return {
|
|
190
|
+
meshIndex,
|
|
191
|
+
...(typeof mesh?.name === 'string' && mesh.name.trim() ? { name: mesh.name.trim() } : {}),
|
|
192
|
+
primitiveCount: primitives.length,
|
|
193
|
+
...(materialIndices.length > 0 ? { materialIndices } : {}),
|
|
194
|
+
...(materialIndices.length > 0
|
|
195
|
+
? {
|
|
196
|
+
materialNames: materialIndices
|
|
197
|
+
.map((materialIndex) => {
|
|
198
|
+
const material = materials[materialIndex];
|
|
199
|
+
return typeof material?.name === 'string' ? material.name.trim() : '';
|
|
200
|
+
})
|
|
201
|
+
.filter(Boolean),
|
|
202
|
+
}
|
|
203
|
+
: {}),
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function createGltfMaterialAnalysisSummaries(gltf) {
|
|
208
|
+
const materials = Array.isArray(gltf?.materials) ? gltf.materials : [];
|
|
209
|
+
return materials.slice(0, 50).map((material, sourceMaterialIndex) => {
|
|
210
|
+
const pbr = material?.pbrMetallicRoughness && typeof material.pbrMetallicRoughness === 'object'
|
|
211
|
+
? material.pbrMetallicRoughness
|
|
212
|
+
: {};
|
|
213
|
+
const textureSlots = readGltfMaterialTextureSlots(material, pbr);
|
|
214
|
+
return {
|
|
215
|
+
sourceMaterialIndex,
|
|
216
|
+
...(typeof material?.name === 'string' && material.name.trim() ? { materialName: material.name.trim() } : {}),
|
|
217
|
+
...(Array.isArray(pbr.baseColorFactor) ? { baseColorFactor: pbr.baseColorFactor.slice(0, 4) } : {}),
|
|
218
|
+
metallicFactor: Number.isFinite(pbr.metallicFactor) ? pbr.metallicFactor : 1,
|
|
219
|
+
roughnessFactor: Number.isFinite(pbr.roughnessFactor) ? pbr.roughnessFactor : 1,
|
|
220
|
+
alphaMode: normalizeGltfAlphaMode(material?.alphaMode) ?? 'opaque',
|
|
221
|
+
...(Number.isFinite(material?.alphaCutoff) ? { alphaCutoff: material.alphaCutoff } : {}),
|
|
222
|
+
...(textureSlots.length > 0 ? { textureSlots } : {}),
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function readGltfMaterialTextureSlots(material, pbr) {
|
|
227
|
+
const slots = [];
|
|
228
|
+
pushGltfTextureSlot(slots, 'baseColor', pbr?.baseColorTexture);
|
|
229
|
+
pushGltfTextureSlot(slots, 'metallicRoughness', pbr?.metallicRoughnessTexture);
|
|
230
|
+
pushGltfTextureSlot(slots, 'normal', material?.normalTexture);
|
|
231
|
+
pushGltfTextureSlot(slots, 'occlusion', material?.occlusionTexture);
|
|
232
|
+
pushGltfTextureSlot(slots, 'emissive', material?.emissiveTexture);
|
|
233
|
+
return slots;
|
|
234
|
+
}
|
|
235
|
+
function pushGltfTextureSlot(slots, slot, textureInfo) {
|
|
236
|
+
if (!isRecord(textureInfo) || !Number.isInteger(textureInfo.index))
|
|
237
|
+
return;
|
|
238
|
+
slots.push({
|
|
239
|
+
slot,
|
|
240
|
+
textureIndex: textureInfo.index,
|
|
241
|
+
...(Number.isFinite(textureInfo.texCoord) ? { texCoord: textureInfo.texCoord } : {}),
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function resolveAssetComplexity(input) {
|
|
245
|
+
if (input.nodeCount >= 300
|
|
246
|
+
|| input.meshCount >= 250
|
|
247
|
+
|| input.primitiveCount >= 300
|
|
248
|
+
|| input.materialCount >= 200
|
|
249
|
+
|| input.textureCount >= 80
|
|
250
|
+
|| input.imageCount >= 80)
|
|
251
|
+
return 'high';
|
|
252
|
+
if (input.nodeCount >= 100
|
|
253
|
+
|| input.meshCount >= 80
|
|
254
|
+
|| input.primitiveCount >= 100
|
|
255
|
+
|| input.materialCount >= 50
|
|
256
|
+
|| input.textureCount >= 24
|
|
257
|
+
|| input.imageCount >= 24)
|
|
258
|
+
return 'medium';
|
|
259
|
+
return 'low';
|
|
260
|
+
}
|
|
261
|
+
function createGltfAssetAnalysisDiagnostics(input) {
|
|
262
|
+
const diagnostics = [];
|
|
263
|
+
if (input.complexity === 'high') {
|
|
264
|
+
diagnostics.push({
|
|
265
|
+
severity: 'warning',
|
|
266
|
+
source: 'asset',
|
|
267
|
+
code: 'asset.analysis.highComplexity',
|
|
268
|
+
message: 'GLTF asset is structurally complex; agent should place and inspect it before duplicating or using dense shadows.',
|
|
269
|
+
details: {
|
|
270
|
+
nodeCount: input.nodeCount,
|
|
271
|
+
meshCount: input.meshCount,
|
|
272
|
+
primitiveCount: input.primitiveCount,
|
|
273
|
+
materialCount: input.materialCount,
|
|
274
|
+
textureCount: input.textureCount,
|
|
275
|
+
imageCount: input.imageCount,
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
if (input.animationCount > 0 || input.skinCount > 0) {
|
|
280
|
+
diagnostics.push({
|
|
281
|
+
severity: 'info',
|
|
282
|
+
source: 'asset',
|
|
283
|
+
code: 'asset.analysis.riggedOrAnimated',
|
|
284
|
+
message: 'GLTF asset contains animation or skin data.',
|
|
285
|
+
details: {
|
|
286
|
+
animationCount: input.animationCount,
|
|
287
|
+
skinCount: input.skinCount,
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
return diagnostics;
|
|
292
|
+
}
|
|
293
|
+
function readPngImageAnalysis(bytes) {
|
|
294
|
+
if (bytes.length < 33)
|
|
295
|
+
return null;
|
|
296
|
+
if (bytes[0] !== 0x89
|
|
297
|
+
|| bytes.toString('ascii', 1, 4) !== 'PNG'
|
|
298
|
+
|| bytes[4] !== 0x0d
|
|
299
|
+
|| bytes[5] !== 0x0a
|
|
300
|
+
|| bytes[6] !== 0x1a
|
|
301
|
+
|| bytes[7] !== 0x0a)
|
|
302
|
+
return null;
|
|
303
|
+
const chunkType = bytes.toString('ascii', 12, 16);
|
|
304
|
+
if (chunkType !== 'IHDR')
|
|
305
|
+
return null;
|
|
306
|
+
const width = bytes.readUInt32BE(16);
|
|
307
|
+
const height = bytes.readUInt32BE(20);
|
|
308
|
+
const bitDepth = bytes[24];
|
|
309
|
+
const colorType = bytes[25];
|
|
310
|
+
return {
|
|
311
|
+
format: 'png',
|
|
312
|
+
mime: 'image/png',
|
|
313
|
+
width,
|
|
314
|
+
height,
|
|
315
|
+
bitDepth,
|
|
316
|
+
hasAlpha: colorType === 4 || colorType === 6,
|
|
317
|
+
estimatedPixels: width * height,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function readJpegImageAnalysis(bytes) {
|
|
321
|
+
if (bytes.length < 4 || bytes[0] !== 0xff || bytes[1] !== 0xd8)
|
|
322
|
+
return null;
|
|
323
|
+
let offset = 2;
|
|
324
|
+
while (offset + 9 < bytes.length) {
|
|
325
|
+
if (bytes[offset] !== 0xff) {
|
|
326
|
+
offset += 1;
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
const marker = bytes[offset + 1];
|
|
330
|
+
const length = bytes.readUInt16BE(offset + 2);
|
|
331
|
+
if (length < 2)
|
|
332
|
+
return null;
|
|
333
|
+
const isStartOfFrame = (marker >= 0xc0
|
|
334
|
+
&& marker <= 0xcf
|
|
335
|
+
&& ![0xc4, 0xc8, 0xcc].includes(marker));
|
|
336
|
+
if (isStartOfFrame && offset + 8 < bytes.length) {
|
|
337
|
+
const bitDepth = bytes[offset + 4];
|
|
338
|
+
const height = bytes.readUInt16BE(offset + 5);
|
|
339
|
+
const width = bytes.readUInt16BE(offset + 7);
|
|
340
|
+
return {
|
|
341
|
+
format: 'jpeg',
|
|
342
|
+
mime: 'image/jpeg',
|
|
343
|
+
width,
|
|
344
|
+
height,
|
|
345
|
+
bitDepth,
|
|
346
|
+
hasAlpha: false,
|
|
347
|
+
estimatedPixels: width * height,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
offset += 2 + length;
|
|
351
|
+
}
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
function readWebpImageAnalysis(bytes) {
|
|
355
|
+
if (bytes.length < 30 || bytes.toString('ascii', 0, 4) !== 'RIFF' || bytes.toString('ascii', 8, 12) !== 'WEBP')
|
|
356
|
+
return null;
|
|
357
|
+
const chunkType = bytes.toString('ascii', 12, 16);
|
|
358
|
+
if (chunkType === 'VP8X' && bytes.length >= 30) {
|
|
359
|
+
const flags = bytes[20];
|
|
360
|
+
const width = readUInt24LE(bytes, 24) + 1;
|
|
361
|
+
const height = readUInt24LE(bytes, 27) + 1;
|
|
362
|
+
return {
|
|
363
|
+
format: 'webp',
|
|
364
|
+
mime: 'image/webp',
|
|
365
|
+
width,
|
|
366
|
+
height,
|
|
367
|
+
hasAlpha: (flags & 0x10) !== 0,
|
|
368
|
+
estimatedPixels: width * height,
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
if (chunkType === 'VP8 ' && bytes.length >= 30) {
|
|
372
|
+
const width = bytes.readUInt16LE(26) & 0x3fff;
|
|
373
|
+
const height = bytes.readUInt16LE(28) & 0x3fff;
|
|
374
|
+
return {
|
|
375
|
+
format: 'webp',
|
|
376
|
+
mime: 'image/webp',
|
|
377
|
+
width,
|
|
378
|
+
height,
|
|
379
|
+
hasAlpha: false,
|
|
380
|
+
estimatedPixels: width * height,
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
if (chunkType === 'VP8L' && bytes.length >= 25 && bytes[20] === 0x2f) {
|
|
384
|
+
const bits = bytes.readUInt32LE(21);
|
|
385
|
+
const width = (bits & 0x3fff) + 1;
|
|
386
|
+
const height = ((bits >> 14) & 0x3fff) + 1;
|
|
387
|
+
return {
|
|
388
|
+
format: 'webp',
|
|
389
|
+
mime: 'image/webp',
|
|
390
|
+
width,
|
|
391
|
+
height,
|
|
392
|
+
hasAlpha: true,
|
|
393
|
+
estimatedPixels: width * height,
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
function readUInt24LE(bytes, offset) {
|
|
399
|
+
return bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16);
|
|
400
|
+
}
|
|
401
|
+
function createImageAssetAnalysisDiagnostics(input) {
|
|
402
|
+
const diagnostics = [];
|
|
403
|
+
if (input.estimatedPixels >= 4096 * 4096) {
|
|
404
|
+
diagnostics.push({
|
|
405
|
+
severity: 'warning',
|
|
406
|
+
source: 'asset',
|
|
407
|
+
code: 'asset.analysis.largeImage',
|
|
408
|
+
message: 'Image asset is large; agent should inspect texture usage before assigning it broadly.',
|
|
409
|
+
details: {
|
|
410
|
+
width: input.width,
|
|
411
|
+
height: input.height,
|
|
412
|
+
estimatedPixels: input.estimatedPixels,
|
|
413
|
+
},
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
return diagnostics;
|
|
417
|
+
}
|
|
418
|
+
function collectGltfMaterialSlots(gltf, context = {}) {
|
|
419
|
+
if (!gltf || typeof gltf !== 'object')
|
|
420
|
+
return [];
|
|
421
|
+
const nodes = Array.isArray(gltf.nodes) ? gltf.nodes : [];
|
|
422
|
+
const meshes = Array.isArray(gltf.meshes) ? gltf.meshes : [];
|
|
423
|
+
const materials = Array.isArray(gltf.materials) ? gltf.materials : [];
|
|
424
|
+
const sourceMaterialProfiles = collectGltfSourceMaterialProfiles(gltf, context);
|
|
425
|
+
const sceneIndexes = collectGltfSceneRootNodeIndexes(gltf);
|
|
426
|
+
const parentByNode = buildGltfParentIndex(nodes);
|
|
427
|
+
const rootSet = new Set(sceneIndexes);
|
|
428
|
+
const previousSlotIdByOwnerPath = createPreviousMaterialSlotIdMap(context.existingMaterialSlots);
|
|
429
|
+
const currentOwnerPathCounts = countGltfMaterialSlotOwnerPaths(nodes, meshes, parentByNode, rootSet);
|
|
430
|
+
const slots = [];
|
|
431
|
+
for (let nodeIndex = 0; nodeIndex < nodes.length; nodeIndex += 1) {
|
|
432
|
+
const node = nodes[nodeIndex];
|
|
433
|
+
const meshIndex = Number.isInteger(node?.mesh) ? node.mesh : -1;
|
|
434
|
+
if (meshIndex < 0 || meshIndex >= meshes.length)
|
|
435
|
+
continue;
|
|
436
|
+
const ownerNodePath = buildGltfOwnerNodePath(nodes, parentByNode, rootSet, nodeIndex);
|
|
437
|
+
if (!ownerNodePath)
|
|
438
|
+
continue;
|
|
439
|
+
const mesh = meshes[meshIndex];
|
|
440
|
+
const materialRefs = readGltfNodeMeshMaterialRefs(mesh, materials);
|
|
441
|
+
const sourceMaterialIndex = materialRefs.indices[0] ?? -1;
|
|
442
|
+
const materialName = materialRefs.names[0] ?? null;
|
|
443
|
+
const reusablePreviousSlotId = currentOwnerPathCounts.get(ownerNodePath) === 1
|
|
444
|
+
? previousSlotIdByOwnerPath.get(ownerNodePath)
|
|
445
|
+
: null;
|
|
446
|
+
const slotId = reusablePreviousSlotId
|
|
447
|
+
?? createGltfMaterialSlotId({
|
|
448
|
+
assetGuid: context.assetGuid,
|
|
449
|
+
assetId: context.assetId,
|
|
450
|
+
nodeIndex,
|
|
451
|
+
meshIndex,
|
|
452
|
+
});
|
|
453
|
+
slots.push({
|
|
454
|
+
slotId,
|
|
455
|
+
ownerNodePath,
|
|
456
|
+
label: readGltfNodeMeshLabel(node, mesh, ownerNodePath),
|
|
457
|
+
nodeIndex,
|
|
458
|
+
meshIndex,
|
|
459
|
+
...(sourceMaterialIndex >= 0 ? { sourceMaterialIndex } : {}),
|
|
460
|
+
...(materialRefs.indices.length > 0 ? { sourceMaterialIndices: materialRefs.indices } : {}),
|
|
461
|
+
...(materialName ? { materialName } : {}),
|
|
462
|
+
...(materialRefs.names.length > 0 ? { materialNames: materialRefs.names } : {}),
|
|
463
|
+
...pickGltfSlotSourceMaterialProfiles(sourceMaterialProfiles, materialRefs.indices),
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
return slots.sort((left, right) => String(left.ownerNodePath).localeCompare(String(right.ownerNodePath)));
|
|
467
|
+
}
|
|
468
|
+
function collectGltfSourceMaterialProfiles(gltf, context = {}) {
|
|
469
|
+
const materials = Array.isArray(gltf?.materials) ? gltf.materials : [];
|
|
470
|
+
const profiles = [];
|
|
471
|
+
for (let sourceMaterialIndex = 0; sourceMaterialIndex < materials.length; sourceMaterialIndex += 1) {
|
|
472
|
+
const sourceProfile = readGltfSourceMaterialProfile(gltf, sourceMaterialIndex, context);
|
|
473
|
+
if (sourceProfile)
|
|
474
|
+
profiles.push(sourceProfile);
|
|
475
|
+
}
|
|
476
|
+
return profiles;
|
|
477
|
+
}
|
|
478
|
+
function pickGltfSlotSourceMaterialProfiles(sourceProfiles, sourceMaterialIndices) {
|
|
479
|
+
if (!sourceMaterialIndices.length || !sourceProfiles.length)
|
|
480
|
+
return {};
|
|
481
|
+
const profileByIndex = new Map(sourceProfiles.map(profile => [profile.sourceMaterialIndex, profile]));
|
|
482
|
+
const sourceMaterialProfiles = sourceMaterialIndices
|
|
483
|
+
.map(sourceMaterialIndex => profileByIndex.get(sourceMaterialIndex))
|
|
484
|
+
.filter(Boolean);
|
|
485
|
+
return sourceMaterialProfiles.length > 0 ? { sourceMaterialProfiles } : {};
|
|
486
|
+
}
|
|
487
|
+
function readGltfSourceMaterialProfile(gltf, sourceMaterialIndex, context = {}) {
|
|
488
|
+
const material = Array.isArray(gltf?.materials) ? gltf.materials[sourceMaterialIndex] : null;
|
|
489
|
+
if (!material || typeof material !== 'object')
|
|
490
|
+
return null;
|
|
491
|
+
const profile = {};
|
|
492
|
+
const textureHints = [];
|
|
493
|
+
const pbr = material.pbrMetallicRoughness && typeof material.pbrMetallicRoughness === 'object'
|
|
494
|
+
? material.pbrMetallicRoughness
|
|
495
|
+
: {};
|
|
496
|
+
const baseColor = {};
|
|
497
|
+
const baseColorFactor = Array.isArray(pbr.baseColorFactor) ? pbr.baseColorFactor : null;
|
|
498
|
+
const baseColorRgb = readGltfRgbFactor(baseColorFactor);
|
|
499
|
+
if (baseColorRgb)
|
|
500
|
+
baseColor.color = baseColorRgb;
|
|
501
|
+
const baseColorTextureRef = applyGltfTextureRef(gltf, pbr.baseColorTexture, context, 'baseColor.texture', baseColor, 'texture', textureHints);
|
|
502
|
+
if (Object.keys(baseColor).length > 0)
|
|
503
|
+
profile.baseColor = {
|
|
504
|
+
...baseColor,
|
|
505
|
+
brightness: 1,
|
|
506
|
+
saturation: 1,
|
|
507
|
+
contrast: 1,
|
|
508
|
+
hue: 0,
|
|
509
|
+
};
|
|
510
|
+
const normal = {};
|
|
511
|
+
applyGltfTextureRef(gltf, material.normalTexture, context, 'normal.texture', normal, 'texture', textureHints);
|
|
512
|
+
if (Number.isFinite(material.normalTexture?.scale))
|
|
513
|
+
normal.strength = material.normalTexture.scale;
|
|
514
|
+
else if (normal.texture)
|
|
515
|
+
normal.strength = 1;
|
|
516
|
+
if (Object.keys(normal).length > 0)
|
|
517
|
+
profile.normal = normal;
|
|
518
|
+
profile.metallic = Number.isFinite(pbr.metallicFactor) ? pbr.metallicFactor : 1;
|
|
519
|
+
profile.roughness = Number.isFinite(pbr.roughnessFactor) ? pbr.roughnessFactor : 1;
|
|
520
|
+
const metallicRoughness = {};
|
|
521
|
+
applyGltfTextureRef(gltf, pbr.metallicRoughnessTexture, context, 'metallicRoughness.texture', metallicRoughness, 'texture', textureHints);
|
|
522
|
+
if (Object.keys(metallicRoughness).length > 0)
|
|
523
|
+
profile.metallicRoughness = metallicRoughness;
|
|
524
|
+
const occlusion = {};
|
|
525
|
+
applyGltfTextureRef(gltf, material.occlusionTexture, context, 'occlusion.texture', occlusion, 'texture', textureHints);
|
|
526
|
+
if (Number.isFinite(material.occlusionTexture?.strength))
|
|
527
|
+
occlusion.strength = material.occlusionTexture.strength;
|
|
528
|
+
else if (occlusion.texture)
|
|
529
|
+
occlusion.strength = 1;
|
|
530
|
+
if (Object.keys(occlusion).length > 0)
|
|
531
|
+
profile.occlusion = occlusion;
|
|
532
|
+
const emission = {};
|
|
533
|
+
const emissiveColor = readGltfRgbFactor(Array.isArray(material.emissiveFactor) ? material.emissiveFactor : null);
|
|
534
|
+
const hasEmissionColor = emissiveColor && (emissiveColor.r !== 0 || emissiveColor.g !== 0 || emissiveColor.b !== 0);
|
|
535
|
+
if (hasEmissionColor)
|
|
536
|
+
emission.color = emissiveColor;
|
|
537
|
+
applyGltfTextureRef(gltf, material.emissiveTexture, context, 'emission.texture', emission, 'texture', textureHints);
|
|
538
|
+
if (hasEmissionColor)
|
|
539
|
+
emission.intensity = 1;
|
|
540
|
+
if (Object.keys(emission).length > 0)
|
|
541
|
+
profile.emission = emission;
|
|
542
|
+
const alpha = {};
|
|
543
|
+
const alphaMode = normalizeGltfAlphaMode(material.alphaMode);
|
|
544
|
+
if (alphaMode)
|
|
545
|
+
alpha.mode = alphaMode;
|
|
546
|
+
if (alphaMode === 'mask' || alphaMode === 'blend') {
|
|
547
|
+
if (baseColorFactor && Number.isFinite(baseColorFactor[3]) && baseColorFactor[3] !== 1)
|
|
548
|
+
alpha.opacity = baseColorFactor[3];
|
|
549
|
+
if (Number.isFinite(material.alphaCutoff))
|
|
550
|
+
alpha.cutoff = material.alphaCutoff;
|
|
551
|
+
else if (alphaMode === 'mask')
|
|
552
|
+
alpha.cutoff = 0.5;
|
|
553
|
+
if (baseColorTextureRef.texture) {
|
|
554
|
+
alpha.texture = structuredClone(baseColorTextureRef.texture);
|
|
555
|
+
}
|
|
556
|
+
else if (baseColorTextureRef.hint) {
|
|
557
|
+
textureHints.push({
|
|
558
|
+
...baseColorTextureRef.hint,
|
|
559
|
+
profilePath: 'alpha.texture',
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
if (Object.keys(alpha).length > 0)
|
|
564
|
+
profile.alpha = alpha;
|
|
565
|
+
if (Object.keys(profile).length === 0 && textureHints.length === 0)
|
|
566
|
+
return null;
|
|
567
|
+
const materialName = typeof material.name === 'string' && material.name.trim() ? material.name.trim() : '';
|
|
568
|
+
return {
|
|
569
|
+
sourceMaterialIndex,
|
|
570
|
+
...(materialName ? { materialName } : {}),
|
|
571
|
+
...(Object.keys(profile).length > 0 ? { profile } : {}),
|
|
572
|
+
...(textureHints.length > 0 ? { textureHints } : {}),
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
function readGltfRgbFactor(value) {
|
|
576
|
+
if (!Array.isArray(value) || value.length < 3)
|
|
577
|
+
return null;
|
|
578
|
+
const [r, g, b] = value;
|
|
579
|
+
return Number.isFinite(r) && Number.isFinite(g) && Number.isFinite(b) ? { r, g, b } : null;
|
|
580
|
+
}
|
|
581
|
+
function normalizeGltfAlphaMode(value) {
|
|
582
|
+
if (value === 'MASK')
|
|
583
|
+
return 'mask';
|
|
584
|
+
if (value === 'BLEND')
|
|
585
|
+
return 'blend';
|
|
586
|
+
if (value === 'OPAQUE')
|
|
587
|
+
return 'opaque';
|
|
588
|
+
return null;
|
|
589
|
+
}
|
|
590
|
+
function applyGltfTextureRef(gltf, textureInfo, context, profilePath, target, targetProperty, textureHints) {
|
|
591
|
+
const result = resolveGltfTextureRef(gltf, textureInfo, context, profilePath);
|
|
592
|
+
if (result.texture)
|
|
593
|
+
target[targetProperty] = result.texture;
|
|
594
|
+
if (result.hint)
|
|
595
|
+
textureHints.push(result.hint);
|
|
596
|
+
return result;
|
|
597
|
+
}
|
|
598
|
+
function resolveGltfTextureRef(gltf, textureInfo, context, profilePath) {
|
|
599
|
+
const textureRecord = isRecord(textureInfo) ? textureInfo : {};
|
|
600
|
+
const textureIndex = Number.isInteger(textureRecord.index) ? textureRecord.index : -1;
|
|
601
|
+
if (textureIndex < 0)
|
|
602
|
+
return {};
|
|
603
|
+
const textures = Array.isArray(gltf?.textures) ? gltf.textures : [];
|
|
604
|
+
const images = Array.isArray(gltf?.images) ? gltf.images : [];
|
|
605
|
+
const texture = textures[textureIndex];
|
|
606
|
+
const imageIndex = Number.isInteger(texture?.source) ? texture.source : -1;
|
|
607
|
+
const image = imageIndex >= 0 ? images[imageIndex] : null;
|
|
608
|
+
const uri = typeof image?.uri === 'string' ? image.uri.trim() : '';
|
|
609
|
+
const baseHint = {
|
|
610
|
+
profilePath,
|
|
611
|
+
textureIndex,
|
|
612
|
+
...(imageIndex >= 0 ? { imageIndex } : {}),
|
|
613
|
+
...(uri ? { uri } : {}),
|
|
614
|
+
...(Number.isInteger(image?.bufferView) ? { bufferView: image.bufferView } : {}),
|
|
615
|
+
...(typeof image?.mimeType === 'string' && image.mimeType.trim() ? { mimeType: image.mimeType.trim() } : {}),
|
|
616
|
+
};
|
|
617
|
+
if (image?.bufferView != null)
|
|
618
|
+
return { hint: { ...baseHint, reason: 'embedded-texture' } };
|
|
619
|
+
if (!uri)
|
|
620
|
+
return { hint: { ...baseHint, reason: 'missing-image-uri' } };
|
|
621
|
+
if (/^data:/i.test(uri))
|
|
622
|
+
return { hint: { ...baseHint, reason: 'embedded-texture' } };
|
|
623
|
+
if (/^https?:\/\//i.test(uri) || uri.startsWith('/'))
|
|
624
|
+
return { texture: { url: uri } };
|
|
625
|
+
let decodedUri = uri;
|
|
626
|
+
try {
|
|
627
|
+
decodedUri = decodeURIComponent(uri);
|
|
628
|
+
}
|
|
629
|
+
catch {
|
|
630
|
+
return { hint: { ...baseHint, reason: 'unresolved-external-texture' } };
|
|
631
|
+
}
|
|
632
|
+
const sourceDir = path.dirname(String(context.sourcePath ?? ''));
|
|
633
|
+
const absolutePath = path.resolve(sourceDir, decodedUri);
|
|
634
|
+
const assetsDir = context.assetsDir ? path.resolve(context.assetsDir) : '';
|
|
635
|
+
const cwd = context.cwd ? path.resolve(context.cwd) : '';
|
|
636
|
+
const relativeToAssets = assetsDir ? path.relative(assetsDir, absolutePath) : '../';
|
|
637
|
+
if (assetsDir && cwd && relativeToAssets && !relativeToAssets.startsWith('..') && !path.isAbsolute(relativeToAssets)) {
|
|
638
|
+
const relativeToCwd = path.relative(cwd, absolutePath).split(path.sep).join('/');
|
|
639
|
+
return { texture: { url: `/${relativeToCwd}` } };
|
|
640
|
+
}
|
|
641
|
+
return { hint: { ...baseHint, reason: 'unresolved-external-texture' } };
|
|
642
|
+
}
|
|
643
|
+
function countGltfMaterialSlotOwnerPaths(nodes, meshes, parentByNode, rootSet) {
|
|
644
|
+
const counts = new Map();
|
|
645
|
+
for (let nodeIndex = 0; nodeIndex < nodes.length; nodeIndex += 1) {
|
|
646
|
+
const meshIndex = Number.isInteger(nodes[nodeIndex]?.mesh) ? nodes[nodeIndex].mesh : -1;
|
|
647
|
+
if (meshIndex < 0 || meshIndex >= meshes.length)
|
|
648
|
+
continue;
|
|
649
|
+
const ownerNodePath = buildGltfOwnerNodePath(nodes, parentByNode, rootSet, nodeIndex);
|
|
650
|
+
if (!ownerNodePath)
|
|
651
|
+
continue;
|
|
652
|
+
counts.set(ownerNodePath, (counts.get(ownerNodePath) ?? 0) + 1);
|
|
653
|
+
}
|
|
654
|
+
return counts;
|
|
655
|
+
}
|
|
656
|
+
function createPreviousMaterialSlotIdMap(rawSlots) {
|
|
657
|
+
const result = new Map();
|
|
658
|
+
if (!Array.isArray(rawSlots))
|
|
659
|
+
return result;
|
|
660
|
+
const ownerPathCounts = new Map();
|
|
661
|
+
for (const rawSlot of rawSlots) {
|
|
662
|
+
if (!isRecord(rawSlot))
|
|
663
|
+
continue;
|
|
664
|
+
const ownerNodePath = typeof rawSlot.ownerNodePath === 'string'
|
|
665
|
+
? rawSlot.ownerNodePath.trim().replace(/^\/+|\/+$/g, '')
|
|
666
|
+
: '';
|
|
667
|
+
if (ownerNodePath)
|
|
668
|
+
ownerPathCounts.set(ownerNodePath, (ownerPathCounts.get(ownerNodePath) ?? 0) + 1);
|
|
669
|
+
}
|
|
670
|
+
for (const rawSlot of rawSlots) {
|
|
671
|
+
if (!isRecord(rawSlot))
|
|
672
|
+
continue;
|
|
673
|
+
const ownerNodePath = typeof rawSlot.ownerNodePath === 'string'
|
|
674
|
+
? rawSlot.ownerNodePath.trim().replace(/^\/+|\/+$/g, '')
|
|
675
|
+
: '';
|
|
676
|
+
const slotId = typeof rawSlot.slotId === 'string' ? rawSlot.slotId.trim() : '';
|
|
677
|
+
if (ownerNodePath && slotId && ownerPathCounts.get(ownerNodePath) === 1)
|
|
678
|
+
result.set(ownerNodePath, slotId);
|
|
679
|
+
}
|
|
680
|
+
return result;
|
|
681
|
+
}
|
|
682
|
+
function createGltfMaterialSlotId(input) {
|
|
683
|
+
const seed = `${input.assetGuid || input.assetId || 'asset'}:${input.nodeIndex}:${input.meshIndex}`;
|
|
684
|
+
return `slot_${stableHashToken(seed)}`;
|
|
685
|
+
}
|
|
686
|
+
function createPlayableEditorTextureAssetCapabilities(sourcePath, metadata) {
|
|
687
|
+
if (metadata.textureUsage === 'environment' || metadata.usage === 'environment') {
|
|
688
|
+
return { usage: 'environment', materialTexture: false, environmentTexture: true };
|
|
689
|
+
}
|
|
690
|
+
if (isRecord(metadata.capabilities) && metadata.capabilities.environmentTexture === true) {
|
|
691
|
+
return { usage: 'environment', materialTexture: false, environmentTexture: true };
|
|
692
|
+
}
|
|
693
|
+
const extension = path.extname(sourcePath).toLowerCase();
|
|
694
|
+
if (['.env', '.hdr', '.dds', '.ktx', '.ktx2'].includes(extension)) {
|
|
695
|
+
return { usage: 'environment', materialTexture: false, environmentTexture: true };
|
|
696
|
+
}
|
|
697
|
+
if (['.png', '.jpg', '.jpeg', '.webp'].includes(extension)) {
|
|
698
|
+
return { usage: 'material', materialTexture: true, environmentTexture: false };
|
|
699
|
+
}
|
|
700
|
+
return null;
|
|
701
|
+
}
|
|
702
|
+
function collectGltfSceneRootNodeIndexes(gltf) {
|
|
703
|
+
const scenes = Array.isArray(gltf.scenes) ? gltf.scenes : [];
|
|
704
|
+
const sceneIndex = Number.isInteger(gltf.scene) ? gltf.scene : 0;
|
|
705
|
+
const scene = scenes[sceneIndex] ?? scenes[0];
|
|
706
|
+
return Array.isArray(scene?.nodes) ? scene.nodes.filter(Number.isInteger) : [];
|
|
707
|
+
}
|
|
708
|
+
function buildGltfParentIndex(nodes) {
|
|
709
|
+
const parentByNode = new Map();
|
|
710
|
+
for (let parentIndex = 0; parentIndex < nodes.length; parentIndex += 1) {
|
|
711
|
+
const children = Array.isArray(nodes[parentIndex]?.children) ? nodes[parentIndex].children : [];
|
|
712
|
+
for (const childIndex of children) {
|
|
713
|
+
if (Number.isInteger(childIndex) && !parentByNode.has(childIndex)) {
|
|
714
|
+
parentByNode.set(childIndex, parentIndex);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return parentByNode;
|
|
719
|
+
}
|
|
720
|
+
function buildGltfOwnerNodePath(nodes, parentByNode, rootSet, nodeIndex) {
|
|
721
|
+
const segments = [];
|
|
722
|
+
let currentIndex = nodeIndex;
|
|
723
|
+
const visited = new Set();
|
|
724
|
+
while (Number.isInteger(currentIndex) && currentIndex >= 0 && currentIndex < nodes.length) {
|
|
725
|
+
if (visited.has(currentIndex))
|
|
726
|
+
return '';
|
|
727
|
+
visited.add(currentIndex);
|
|
728
|
+
segments.push(stableGltfNodeSegment(nodes[currentIndex], currentIndex));
|
|
729
|
+
const parentIndex = parentByNode.get(currentIndex);
|
|
730
|
+
if (typeof parentIndex !== 'number' || !Number.isInteger(parentIndex))
|
|
731
|
+
break;
|
|
732
|
+
currentIndex = parentIndex;
|
|
733
|
+
}
|
|
734
|
+
segments.reverse();
|
|
735
|
+
if (segments.length > 1 && rootSet.has(currentIndex))
|
|
736
|
+
segments.shift();
|
|
737
|
+
return segments.filter(Boolean).join('/');
|
|
738
|
+
}
|
|
739
|
+
function stableGltfNodeSegment(node, index) {
|
|
740
|
+
const name = isRecord(node) && typeof node.name === 'string' ? node.name.trim() : '';
|
|
741
|
+
return name || `node_${index}`;
|
|
742
|
+
}
|
|
743
|
+
function readGltfNodeMeshLabel(node, mesh, ownerNodePath) {
|
|
744
|
+
const nodeName = isRecord(node) && typeof node.name === 'string' ? node.name.trim() : '';
|
|
745
|
+
const meshName = isRecord(mesh) && typeof mesh.name === 'string' ? mesh.name.trim() : '';
|
|
746
|
+
return nodeName || meshName || ownerNodePath.split('/').filter(Boolean).pop() || ownerNodePath;
|
|
747
|
+
}
|
|
748
|
+
function readGltfNodeMeshMaterialRefs(mesh, materials) {
|
|
749
|
+
const meshRecord = isRecord(mesh) ? mesh : {};
|
|
750
|
+
const primitives = Array.isArray(meshRecord.primitives) ? meshRecord.primitives : [];
|
|
751
|
+
const indices = [];
|
|
752
|
+
const seen = new Set();
|
|
753
|
+
for (const primitive of primitives) {
|
|
754
|
+
const materialIndex = Number.isInteger(primitive?.material) ? primitive.material : -1;
|
|
755
|
+
if (materialIndex >= 0 && !seen.has(materialIndex)) {
|
|
756
|
+
seen.add(materialIndex);
|
|
757
|
+
indices.push(materialIndex);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return {
|
|
761
|
+
indices,
|
|
762
|
+
names: indices
|
|
763
|
+
.map((materialIndex) => {
|
|
764
|
+
const material = materials[materialIndex];
|
|
765
|
+
return typeof material?.name === 'string' ? material.name.trim() : '';
|
|
766
|
+
})
|
|
767
|
+
.filter(Boolean),
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
function isRecord(value) {
|
|
771
|
+
return value != null && typeof value === 'object' && !Array.isArray(value);
|
|
772
|
+
}
|
|
773
|
+
function stableHashToken(value) {
|
|
774
|
+
const text = String(value ?? '');
|
|
775
|
+
let hash = 0x811c9dc5;
|
|
776
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
777
|
+
hash ^= text.charCodeAt(index);
|
|
778
|
+
hash = Math.imul(hash, 0x01000193);
|
|
779
|
+
}
|
|
780
|
+
return (hash >>> 0).toString(16).padStart(8, '0');
|
|
781
|
+
}
|
|
782
|
+
//# sourceMappingURL=metadata.js.map
|