@babylonjs/core 9.9.0 → 9.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AudioV2/abstractAudio/audioEngineV2.d.ts +34 -1
- package/AudioV2/abstractAudio/audioEngineV2.js +54 -0
- package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.d.ts +12 -0
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js +18 -0
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js.map +1 -1
- package/AudioV2/abstractAudio/index.d.ts +1 -0
- package/AudioV2/abstractAudio/index.js +1 -0
- package/AudioV2/abstractAudio/index.js.map +1 -1
- package/AudioV2/abstractAudio/pure.d.ts +1 -0
- package/AudioV2/abstractAudio/pure.js +1 -0
- package/AudioV2/abstractAudio/pure.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +7 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +12 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +14 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +4 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +12 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.d.ts +2 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js +4 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.js +2 -1
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/Engines/abstractEngine.pure.js +9 -2
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/engine.pure.d.ts +23 -0
- package/Engines/engine.pure.js +96 -1
- package/Engines/engine.pure.js.map +1 -1
- package/Engines/nativeEngine.pure.d.ts +4 -0
- package/Engines/nativeEngine.pure.js +6 -0
- package/Engines/nativeEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +21 -0
- package/Engines/thinNativeEngine.pure.js +119 -4
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Engines/webgpuEngine.pure.d.ts +21 -0
- package/Engines/webgpuEngine.pure.js +46 -1
- package/Engines/webgpuEngine.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.d.ts +3 -0
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js +16 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js.map +1 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.d.ts +2 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +5 -2
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -1
- package/Gizmos/index.d.ts +1 -0
- package/Gizmos/index.js +1 -0
- package/Gizmos/index.js.map +1 -1
- package/Gizmos/pure.d.ts +1 -0
- package/Gizmos/pure.js +1 -0
- package/Gizmos/pure.js.map +1 -1
- package/Gizmos/spatialAudioGizmo.d.ts +55 -0
- package/Gizmos/spatialAudioGizmo.js +151 -0
- package/Gizmos/spatialAudioGizmo.js.map +1 -0
- package/Layers/selectionOutlineLayer.pure.d.ts +9 -2
- package/Layers/selectionOutlineLayer.pure.js +29 -6
- package/Layers/selectionOutlineLayer.pure.js.map +1 -1
- package/Layers/thinEffectLayer.d.ts +1 -0
- package/Layers/thinEffectLayer.js +7 -4
- package/Layers/thinEffectLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.d.ts +17 -3
- package/Layers/thinSelectionOutlineLayer.js +82 -17
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +5 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +54 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.pure.d.ts +13 -0
- package/Materials/PBR/openpbrMaterial.pure.js +17 -0
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +11 -1
- package/Materials/Textures/internalTexture.js +16 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.d.ts +2 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js +3 -2
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +32 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +180 -22
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +54 -10
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +130 -13
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.d.ts +5 -1
- package/Meshes/abstractMesh.pure.js +92 -2
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.pure.js +143 -2
- package/Meshes/thinInstanceMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.types.d.ts +2 -1
- package/Meshes/thinInstanceMesh.types.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +12 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/geometryBufferRenderer.pure.js +8 -0
- package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
- package/Rendering/objectRenderer.js +4 -2
- package/Rendering/objectRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +54 -5
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +14 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingVoxel.vertex.js +1 -0
- package/Shaders/gaussianSplattingVoxel.vertex.js.map +1 -1
- package/Shaders/selectionOutline.fragment.js +16 -4
- package/Shaders/selectionOutline.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +56 -5
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js +2 -3
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +14 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingVoxel.vertex.js +1 -0
- package/ShadersWGSL/gaussianSplattingVoxel.vertex.js.map +1 -1
- package/ShadersWGSL/selectionOutline.fragment.js +14 -2
- package/ShadersWGSL/selectionOutline.fragment.js.map +1 -1
- package/SmartAssets/index.d.ts +2 -2
- package/SmartAssets/index.js +2 -1
- package/SmartAssets/index.js.map +1 -1
- package/SmartAssets/pure.d.ts +1 -1
- package/SmartAssets/pure.js +2 -1
- package/SmartAssets/pure.js.map +1 -1
- package/SmartAssets/smartAssetManager.js +9 -0
- package/SmartAssets/smartAssetManager.js.map +1 -1
- package/XR/features/WebXRBodyTracking.pure.d.ts +16 -0
- package/XR/features/WebXRBodyTracking.pure.js +167 -30
- package/XR/features/WebXRBodyTracking.pure.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartAssetManager.js","sourceRoot":"","sources":["../../../../dev/core/src/SmartAssets/smartAssetManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAiB,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAGH,wBAAwB,EACxB,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,mBAAmB,GACtB,MAAM,wBAAwB,CAAC;AAEhC,gEAAgE;AAChE,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;AAyD1E,MAAM,0BAA0B,GAAG,IAAI,OAAO,EAAiD,CAAC;AAChG,MAAM,oCAAoC,GAAG,IAAI,UAAU,EAAqB,CAAC;AAEjF;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAAC,KAAY;IACzC,MAAM,OAAO,GAAsB;QAC/B,KAAK;QACL,mBAAmB,EAAE,IAAI,UAAU,EAAQ;QAC3C,eAAe,EAAE,IAAI;KACxB,CAAC;IAEF,MAAM,QAAQ,GAA+B;QACzC,IAAI,EAAE,IAAI,GAAG,EAAE;QACf,OAAO,EAAE,IAAI,GAAG,EAAE;QAClB,UAAU,EAAE,IAAI,GAAG,EAAE;QACrB,cAAc,EAAE,IAAI,OAAO,EAAE;QAC7B,WAAW,EAAE,IAAI,GAAG,EAAE;QACtB,aAAa,EAAE,IAAI,GAAG,EAAE;QACxB,QAAQ,EAAE,IAAI,GA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AAM,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QACnJ,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAC3B,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;AACL,CAAC;AAED,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjJ;;;;GAIG;AACH,MAAM,UAAU,8BAA8B;IAC1C,OAAO,iBAAiB,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,GAAW;IAC7B,OAAO,iBAAiB,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,kBAAkB,CAAC,SAA6B;IACrD,OAAO,SAAS,KAAK,SAAS,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;AACrF,CAAC","sourcesContent":["import { type Scene } from \"../scene\";\nimport { type AssetContainer } from \"../assetContainer\";\nimport { type Node } from \"../node\";\nimport { type Material } from \"../Materials/material\";\nimport { type BaseTexture } from \"../Materials/Textures/baseTexture\";\nimport { Texture } from \"../Materials/Textures/texture\";\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture\";\nimport { HDRCubeTexture } from \"../Materials/Textures/hdrCubeTexture\";\nimport { type AnimationGroup } from \"../Animations/animationGroup\";\nimport { Observable, type Observer } from \"../Misc/observable\";\nimport { Logger } from \"../Misc/logger\";\nimport { LoadAssetContainerAsync } from \"../Loading/sceneLoader\";\nimport { GetExtensionFromUrl } from \"../Misc/urlTools\";\nimport {\n type ISerializedSmartAssetEntry,\n type ISerializedSmartAssetMap,\n DeserializeSmartAssetMap,\n IsAbsoluteOrSpecialUrl,\n MakeRelative,\n ResolveAssetUrl,\n ReadJsonSourceAsync,\n} from \"./smartAssetSerializer\";\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst SMART_ASSET_MANAGER_KEY = Symbol.for(\"babylonjs:smartAssetManager\");\n\n/**\n * Stateful handle for a scene's smart asset registry.\n *\n * Smart asset behavior is exposed through module-level functions rather than\n * class methods so callers can import only the operations they need.\n */\nexport type SmartAssetManager = {\n /**\n * The scene this manager is attached to.\n */\n readonly scene: Scene;\n\n /**\n * Fires when the smart asset registry or loaded asset state changes.\n */\n readonly onChangedObservable: Observable<void>;\n\n /**\n * Optional callback invoked when an asset cannot be found at its registered URL.\n * Return a new URL or File to retry loading, or null to skip the asset.\n */\n onAssetNotFound: ((key: string, expectedUrl: string) => Promise<string | File | null>) | null;\n};\n\n/**\n * Optional registration data that helps select the correct loader when the URL\n * does not contain a usable file extension, such as blob-backed local files.\n */\ntype SmartAssetRegistrationOptions = Pick<ISerializedSmartAssetEntry, \"type\" | \"extension\" | \"metadata\">;\n\n/**\n * Optional load-time configuration. Includes the persistable {@link SmartAssetRegistrationOptions}\n * fields (type, extension, metadata) plus a transient `reloadSource` callback used by\n * {@link ReloadSmartAssetAsync} to fetch fresh bytes from disk for blob-backed assets.\n */\nexport type SmartAssetLoadOptions = SmartAssetRegistrationOptions & {\n /**\n * Optional callback invoked by {@link ReloadSmartAssetAsync} to obtain a fresh File\n * for the asset. Use this when the registered URL is a `blob:` URL backed by a\n * `FileSystemFileHandle` so Reload can re-read the underlying file from disk.\n */\n readonly reloadSource?: () => Promise<File>;\n};\n\ntype SmartAssetManagerInternals = {\n urls: Map<string, string>;\n options: Map<string, SmartAssetRegistrationOptions>;\n containers: Map<string, AssetContainer>;\n objectToKeyMap: WeakMap<object, string>;\n textureKeys: Set<string>;\n reloadSources: Map<string, () => Promise<File>>;\n blobUrls: Map<string, string>;\n sceneDisposeObserver: ReturnType<Scene[\"onDisposeObservable\"][\"add\"]> | null;\n};\n\nconst SmartAssetManagerInternals = new WeakMap<SmartAssetManager, SmartAssetManagerInternals>();\nconst OnSmartAssetManagerCreatedObservable = new Observable<SmartAssetManager>();\n\n/**\n * Creates a new SmartAssetManager state object and attaches it to the scene.\n *\n * Internal: callers should use {@link GetSmartAssetManager} which returns the\n * existing manager when one is already attached.\n * @param scene - The scene this manager operates on.\n * @returns The created smart asset manager state.\n */\nfunction CreateSmartAssetManager(scene: Scene): SmartAssetManager {\n const manager: SmartAssetManager = {\n scene,\n onChangedObservable: new Observable<void>(),\n onAssetNotFound: null,\n };\n\n const internal: SmartAssetManagerInternals = {\n urls: new Map(),\n options: new Map(),\n containers: new Map(),\n objectToKeyMap: new WeakMap(),\n textureKeys: new Set(),\n reloadSources: new Map(),\n blobUrls: new Map(),\n sceneDisposeObserver: null,\n };\n SmartAssetManagerInternals.set(manager, internal);\n\n if (!scene.metadata) {\n scene.metadata = {};\n }\n scene.metadata[SMART_ASSET_MANAGER_KEY] = manager;\n\n // Auto-dispose when the scene is disposed so the manager doesn't outlive it.\n internal.sceneDisposeObserver = scene.onDisposeObservable.add(() => DisposeSmartAssetManager(manager));\n\n OnSmartAssetManagerCreatedObservable.notifyObservers(manager);\n\n return manager;\n}\n\n/**\n * Returns the SmartAssetManager attached to the given scene, creating and\n * attaching one if none exists.\n * @param scene - The scene to look up or attach a manager to.\n * @returns The existing or newly created SmartAssetManager.\n */\nexport function GetSmartAssetManager(scene: Scene): SmartAssetManager {\n const existing = scene.metadata?.[SMART_ASSET_MANAGER_KEY] as SmartAssetManager | undefined;\n if (existing) {\n return existing;\n }\n return CreateSmartAssetManager(scene);\n}\n\n/**\n * Adds an observer that is notified whenever a SmartAssetManager is created.\n * @param callback - The callback to invoke with each newly created manager.\n * @returns The observer registration.\n */\nexport function AddSmartAssetManagerCreatedObserver(callback: (manager: SmartAssetManager) => void): Observer<SmartAssetManager> {\n // Wrap so the EventState second-arg from Observable.add isn't passed through to the caller.\n return OnSmartAssetManagerCreatedObservable.add((manager) => callback(manager));\n}\n\n/**\n * Registers a smart asset entry mapping a key to a URL.\n * @param scene - The scene whose smart asset registry to update.\n * @param key - Unique string identifier for this asset.\n * @param url - URL or path to the asset file.\n * @param options - Optional loader hints and metadata for this asset.\n */\nexport function RegisterSmartAsset(scene: Scene, key: string, url: string, options?: SmartAssetRegistrationOptions): void {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n RevokeManagedBlobUrl(internal, key, url);\n internal.urls.set(key, url);\n TrackManagedBlobUrl(internal, key, url);\n if (options) {\n const existingOptions = internal.options.get(key);\n internal.options.set(key, { ...existingOptions, ...options });\n if (options.type === \"texture\") {\n internal.textureKeys.add(key);\n } else if (options.type !== undefined) {\n internal.textureKeys.delete(key);\n }\n }\n manager.onChangedObservable.notifyObservers();\n}\n\n/**\n * Removes a key from the registry. If the asset is loaded, it is unloaded first.\n * @param scene - The scene that owns the smart asset.\n * @param key - The key to remove.\n * @returns A promise that resolves when the asset has been unloaded and removed.\n */\nexport async function RemoveSmartAssetAsync(scene: Scene, key: string): Promise<void> {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n if (internal.containers.has(key)) {\n await UnloadSmartAssetAsync(scene, key);\n }\n for (const tex of [...scene.textures]) {\n if (internal.objectToKeyMap.get(tex) === key) {\n internal.objectToKeyMap.delete(tex);\n tex.dispose();\n }\n }\n internal.urls.delete(key);\n internal.options.delete(key);\n internal.textureKeys.delete(key);\n internal.reloadSources.delete(key);\n RevokeManagedBlobUrl(internal, key);\n manager.onChangedObservable.notifyObservers();\n}\n\n/**\n * Returns all registered key-to-URL mappings.\n * @param scene - The scene whose smart asset registry to read.\n * @returns A read-only map of keys to URLs.\n */\nexport function GetAllSmartAssets(scene: Scene): ReadonlyMap<string, string> {\n return GetSmartAssetInternals(GetSmartAssetManager(scene)).urls;\n}\n\n/**\n * Loads a scene-file asset by key.\n * @param scene - The scene to load the asset into.\n * @param key - The key to load.\n * @param url - Optional URL. If provided, the key is registered first.\n * @param options - Optional loader hints and metadata for this asset.\n * @returns A promise resolving to the loaded AssetContainer.\n */\nexport async function LoadSmartAssetAsync(scene: Scene, key: string, url?: string, options?: SmartAssetLoadOptions): Promise<AssetContainer> {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n const previousUrl = internal.urls.get(key);\n const { reloadSource, ...registrationOptions } = options ?? {};\n if (url) {\n RegisterSmartAsset(scene, key, url, registrationOptions);\n }\n if (reloadSource) {\n internal.reloadSources.set(key, reloadSource);\n }\n\n const resolvedUrl = internal.urls.get(key);\n if (!resolvedUrl) {\n throw new Error(`SmartAssetManager: Key \"${key}\" is not registered. Provide a URL to auto-register.`);\n }\n\n const existing = internal.containers.get(key);\n if (existing) {\n if (url && url !== previousUrl) {\n // URL changed — drop the stale container before fetching the new one\n // so callers don't get a surprise cached return for an updated URL.\n await UnloadSmartAssetAsync(scene, key);\n } else {\n return existing;\n }\n }\n\n return await LoadSmartAssetSceneFileAsync(manager, key, resolvedUrl, internal.options.get(key)?.extension);\n}\n\n/**\n * Loads all registered assets concurrently.\n * @param scene - The scene whose registered assets to load.\n * @returns A promise resolving to loaded scene-file containers.\n */\nexport async function LoadAllSmartAssetsAsync(scene: Scene): Promise<AssetContainer[]> {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n const scenePromises: Promise<AssetContainer | null>[] = [];\n const texturePromises: Promise<void>[] = [];\n\n for (const [key, url] of Array.from(internal.urls)) {\n if (internal.containers.has(key)) {\n continue;\n }\n const options = internal.options.get(key);\n if (internal.textureKeys.has(key) || options?.type === \"texture\" || IsTextureUrl(url) || IsTextureExtension(options?.extension)) {\n const textureLoadAsync = async () => {\n try {\n await LoadSmartAssetTextureAsync(scene, key);\n } catch {\n Logger.Warn(`SmartAssetManager: Texture \"${key}\" could not be loaded — skipping.`);\n }\n };\n texturePromises.push(textureLoadAsync());\n } else {\n const sceneLoadAsync = async () => {\n try {\n return await LoadSmartAssetAsync(scene, key);\n } catch {\n Logger.Warn(`SmartAssetManager: Asset \"${key}\" could not be loaded — skipping.`);\n return null;\n }\n };\n scenePromises.push(sceneLoadAsync());\n }\n }\n\n await Promise.all(texturePromises);\n const results = await Promise.all(scenePromises);\n return results.filter((r): r is AssetContainer => r !== null);\n}\n\n/**\n * Loads a standalone texture by key.\n * @param scene - The scene to load the texture into.\n * @param key - The key to load.\n * @param url - Optional URL. If provided, the key is registered first.\n * @param options - Optional loader hints and metadata for this asset.\n * @returns A promise resolving to the loaded texture.\n */\nexport async function LoadSmartAssetTextureAsync(scene: Scene, key: string, url?: string, options?: SmartAssetLoadOptions): Promise<BaseTexture> {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n const previousUrl = internal.urls.get(key);\n const { reloadSource, ...registrationOptions } = options ?? {};\n if (url) {\n RegisterSmartAsset(scene, key, url, { ...registrationOptions, type: registrationOptions.type ?? \"texture\" });\n }\n if (reloadSource) {\n internal.reloadSources.set(key, reloadSource);\n }\n\n internal.textureKeys.add(key);\n\n // Mirror LoadSmartAssetAsync: if a tracked texture already exists for this key,\n // return it on a same-URL call (cache hit) or dispose it before reload on URL change.\n // Without this guard, calling LoadSmartAssetTextureAsync twice with the same URL\n // would create duplicate Texture objects in scene.textures.\n const existingTextures: BaseTexture[] = [];\n for (const tex of scene.textures) {\n if (internal.objectToKeyMap.get(tex) === key) {\n existingTextures.push(tex);\n }\n }\n if (existingTextures.length > 0) {\n if (url && previousUrl !== undefined && url !== previousUrl) {\n for (const tex of existingTextures) {\n internal.objectToKeyMap.delete(tex);\n tex.dispose();\n }\n } else {\n return existingTextures[0];\n }\n }\n\n const resolvedUrl = internal.urls.get(key);\n if (!resolvedUrl) {\n throw new Error(`SmartAssetManager: Key \"${key}\" is not registered. Provide a URL to auto-register.`);\n }\n\n const extensionHint = internal.options.get(key)?.extension;\n let texture: BaseTexture;\n try {\n texture = await CreateAndLoadTextureAsync(manager, resolvedUrl, extensionHint);\n } catch (error) {\n const fallback = await ResolveNotFoundAsync(manager, key, resolvedUrl);\n if (!fallback) {\n throw error;\n }\n texture = await CreateAndLoadTextureAsync(manager, fallback.url, fallback.extensionHint ?? extensionHint);\n }\n\n internal.objectToKeyMap.set(texture, key);\n manager.onChangedObservable.notifyObservers();\n return texture;\n}\n\n/**\n * Unloads a loaded asset while keeping the key registered.\n * @param scene - The scene whose smart asset to unload.\n * @param key - The key to unload.\n * @returns A promise that resolves once the asset has been unloaded.\n */\nexport async function UnloadSmartAssetAsync(scene: Scene, key: string): Promise<void> {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n const container = internal.containers.get(key);\n if (container) {\n container.removeAllFromScene();\n container.dispose();\n internal.containers.delete(key);\n manager.onChangedObservable.notifyObservers();\n return;\n }\n\n for (const tex of [...scene.textures]) {\n if (internal.objectToKeyMap.get(tex) === key) {\n internal.objectToKeyMap.delete(tex);\n tex.dispose();\n }\n }\n manager.onChangedObservable.notifyObservers();\n}\n\n/**\n * Unloads and re-loads an asset.\n * @param scene - The scene whose smart asset to reload.\n * @param key - The key to reload.\n * @returns A promise resolving to the newly loaded AssetContainer or BaseTexture.\n */\nexport async function ReloadSmartAssetAsync(scene: Scene, key: string): Promise<AssetContainer | BaseTexture> {\n const internal = GetSmartAssetInternals(GetSmartAssetManager(scene));\n const reloadSource = internal.reloadSources.get(key);\n if (reloadSource) {\n try {\n const freshFile = await reloadSource();\n const blobUrl = URL.createObjectURL(freshFile);\n RegisterSmartAsset(scene, key, blobUrl, { extension: GetExtensionFromUrl(freshFile.name) || internal.options.get(key)?.extension });\n } catch (e) {\n Logger.Warn(`SmartAssetManager: reloadSource callback failed for \"${key}\": ${e}`);\n }\n }\n\n await UnloadSmartAssetAsync(scene, key);\n\n if (internal.textureKeys.has(key)) {\n return await LoadSmartAssetTextureAsync(scene, key);\n }\n return await LoadSmartAssetAsync(scene, key);\n}\n\n/**\n * Finds which smart asset key owns a scene object.\n * @param scene - The scene whose registry to search.\n * @param object - A scene object.\n * @returns The key, or undefined if the object is not tracked.\n */\nexport function FindSmartAssetKeyForObject(scene: Scene, object: Node | Material | BaseTexture | AnimationGroup): string | undefined {\n return GetSmartAssetInternals(GetSmartAssetManager(scene)).objectToKeyMap.get(object);\n}\n\n/**\n * Serializes the registry to a JSON-compatible document.\n * If a baseUrl is provided, asset URLs are stored relative to it for portability.\n * @param scene - The scene whose registry to serialize.\n * @param baseUrl - Optional base URL for making asset paths relative.\n * @returns A serialized asset map document.\n */\nexport function SerializeSmartAssetManagerMap(scene: Scene, baseUrl?: string): ISerializedSmartAssetMap {\n const internal = GetSmartAssetInternals(GetSmartAssetManager(scene));\n const assets: Record<string, ISerializedSmartAssetEntry> = {};\n\n for (const [key, registeredUrl] of Array.from(internal.urls)) {\n let url = registeredUrl;\n if (baseUrl && !IsAbsoluteOrSpecialUrl(url)) {\n url = MakeRelative(url, baseUrl);\n }\n const options = internal.options.get(key);\n assets[key] = { url, ...options, ...(internal.textureKeys.has(key) ? { type: \"texture\" } : {}) };\n }\n\n return { version: 1, assets };\n}\n\n/**\n * Loads an asset map from a URL, File, or pre-parsed JSON object.\n * @param scene - The scene to load assets into.\n * @param source - A URL string, File object, or pre-parsed ISerializedSmartAssetMap.\n * @param rootUrl - Optional root URL for resolving relative asset paths.\n * @returns A promise that resolves after the map has been loaded and all registered assets have been attempted.\n */\nexport async function LoadSmartAssetMapAsync(scene: Scene, source: string | File | ISerializedSmartAssetMap, rootUrl?: string): Promise<void> {\n let resolvedRootUrl = rootUrl ?? \"\";\n\n if (typeof source === \"string\" && !rootUrl) {\n const { Tools } = await import(\"../Misc/tools\");\n resolvedRootUrl = Tools.GetFolderPath(source);\n }\n\n const raw = await ReadJsonSourceAsync(source);\n const doc = DeserializeSmartAssetMap(raw);\n\n for (const [key, entry] of Object.entries(doc.assets)) {\n const resolved = resolvedRootUrl ? ResolveAssetUrl(entry.url, resolvedRootUrl) : entry.url;\n RegisterSmartAsset(scene, key, resolved, { type: entry.type, extension: entry.extension, metadata: entry.metadata });\n }\n\n await LoadAllSmartAssetsAsync(scene);\n}\n\n/**\n * Registers an externally loaded AssetContainer under a key.\n * @param manager - The smart asset manager state.\n * @param key - The key to associate with the container.\n * @param container - The loaded AssetContainer.\n */\nfunction TrackLoadedSmartAssetContainer(manager: SmartAssetManager, key: string, container: AssetContainer): void {\n const internal = GetSmartAssetInternals(manager);\n internal.containers.set(key, container);\n TrackSmartAssetContainerObjects(manager, key, container);\n manager.onChangedObservable.notifyObservers();\n}\n\n/**\n * Disposes the manager, unloading all assets and detaching it from its scene.\n * Safe to call multiple times; subsequent calls are no-ops. Automatically invoked when the\n * owning scene is disposed.\n * @param manager - The smart asset manager state.\n */\nexport function DisposeSmartAssetManager(manager: SmartAssetManager): void {\n const internal = SmartAssetManagerInternals.get(manager);\n if (!internal) {\n return;\n }\n SmartAssetManagerInternals.delete(manager);\n\n if (internal.sceneDisposeObserver) {\n manager.scene.onDisposeObservable.remove(internal.sceneDisposeObserver);\n internal.sceneDisposeObserver = null;\n }\n\n for (const container of Array.from(internal.containers.values())) {\n container.removeAllFromScene();\n container.dispose();\n }\n for (const tex of [...manager.scene.textures]) {\n if (internal.objectToKeyMap.get(tex) !== undefined) {\n tex.dispose();\n }\n }\n\n internal.urls.clear();\n internal.options.clear();\n internal.textureKeys.clear();\n internal.reloadSources.clear();\n internal.containers.clear();\n for (const blobUrl of Array.from(internal.blobUrls.values())) {\n URL.revokeObjectURL(blobUrl);\n }\n internal.blobUrls.clear();\n\n manager.onChangedObservable.clear();\n\n if (manager.scene.metadata) {\n delete manager.scene.metadata[SMART_ASSET_MANAGER_KEY];\n }\n}\n\nfunction GetSmartAssetInternals(manager: SmartAssetManager): SmartAssetManagerInternals {\n const internal = SmartAssetManagerInternals.get(manager);\n if (!internal) {\n throw new Error(\"SmartAssetManager: Unknown manager state.\");\n }\n return internal;\n}\n\nfunction RevokeManagedBlobUrl(internal: SmartAssetManagerInternals, key: string, replacementUrl?: string): void {\n const blobUrl = internal.blobUrls.get(key);\n if (!blobUrl || blobUrl === replacementUrl) {\n return;\n }\n URL.revokeObjectURL(blobUrl);\n internal.blobUrls.delete(key);\n}\n\nfunction TrackManagedBlobUrl(internal: SmartAssetManagerInternals, key: string, url: string): void {\n if (url.startsWith(\"blob:\")) {\n internal.blobUrls.set(key, url);\n }\n}\n\nasync function CreateAndLoadTextureAsync(manager: SmartAssetManager, url: string, extensionHint?: string): Promise<BaseTexture> {\n return await new Promise<BaseTexture>((resolve, reject) => {\n const ext = (extensionHint || GetExtensionFromUrl(url)).toLowerCase();\n const onError = (message?: string, exception?: unknown) => {\n const err = exception instanceof Error ? exception : new Error(message ?? `SmartAssetManager: failed to load texture from \"${url}\".`);\n reject(err);\n };\n let texture: BaseTexture;\n const onLoad = () => resolve(texture);\n if (ext === \".hdr\") {\n // HDR equirectangular files require HDRCubeTexture — CubeTexture's .hdr\n // loader explicitly throws \".hdr not supported in Cube.\" so we can't\n // route HDRs through the generic CubeTexture path.\n texture = new HDRCubeTexture(url, manager.scene, 256, false, true, false, false, onLoad, onError);\n } else if (ext === \".env\" || ext === \".dds\") {\n texture = new CubeTexture(url, manager.scene, null, false, null, onLoad, onError, undefined, ext === \".env\");\n } else {\n texture = new Texture(url, manager.scene, undefined, undefined, undefined, onLoad, onError);\n }\n });\n}\n\nasync function ResolveNotFoundAsync(manager: SmartAssetManager, key: string, expectedUrl: string): Promise<{ url: string; extensionHint?: string } | null> {\n if (!manager.onAssetNotFound) {\n return null;\n }\n const resolution = await manager.onAssetNotFound(key, expectedUrl);\n if (resolution === null || resolution === undefined) {\n return null;\n }\n if (typeof resolution === \"string\") {\n RegisterSmartAsset(manager.scene, key, resolution);\n return { url: resolution, extensionHint: GetSmartAssetInternals(manager).options.get(key)?.extension };\n }\n const blobUrl = URL.createObjectURL(resolution);\n const extensionHint = GetExtensionFromUrl(resolution.name) || undefined;\n RegisterSmartAsset(manager.scene, key, blobUrl, { extension: extensionHint });\n return { url: blobUrl, extensionHint };\n}\n\nasync function LoadSmartAssetSceneFileAsync(manager: SmartAssetManager, key: string, url: string, extensionHint?: string): Promise<AssetContainer> {\n const loadAsync = async (loadUrl: string, extensionHint?: string) => {\n const container = await LoadAssetContainerAsync(loadUrl, manager.scene, { pluginExtension: extensionHint });\n container.addAllToScene();\n TrackLoadedSmartAssetContainer(manager, key, container);\n return container;\n };\n\n try {\n return await loadAsync(url, extensionHint);\n } catch (error) {\n const fallback = await ResolveNotFoundAsync(manager, key, url);\n if (fallback) {\n try {\n return await loadAsync(fallback.url, fallback.extensionHint);\n } catch (retryError) {\n Logger.Warn(`SmartAssetManager: Asset \"${key}\" could not be loaded from fallback \"${fallback.url}\".`);\n throw retryError;\n }\n }\n Logger.Warn(`SmartAssetManager: Asset \"${key}\" could not be loaded from \"${url}\".`);\n throw error;\n }\n}\n\nfunction TrackSmartAssetContainerObjects(manager: SmartAssetManager, key: string, container: AssetContainer): void {\n const internal = GetSmartAssetInternals(manager);\n\n for (const collection of [container.meshes, container.materials, container.textures, container.animationGroups, container.lights, container.cameras]) {\n for (const obj of collection) {\n internal.objectToKeyMap.set(obj, key);\n }\n }\n}\n\nconst TextureExtensions = new Set([\".png\", \".jpg\", \".jpeg\", \".bmp\", \".tga\", \".gif\", \".webp\", \".env\", \".hdr\", \".dds\", \".ktx\", \".ktx2\", \".basis\"]);\n\n/**\n * Returns the set of file extensions (including the leading dot) that {@link LoadAllSmartAssetsAsync}\n * treats as standalone textures.\n * @returns A read-only set of texture file extensions.\n */\nexport function GetSmartAssetTextureExtensions(): ReadonlySet<string> {\n return TextureExtensions;\n}\n\n/**\n * Returns true if the URL points to a standalone texture file.\n * @param url - The URL to check.\n * @returns True if the URL has a texture file extension.\n */\nfunction IsTextureUrl(url: string): boolean {\n return TextureExtensions.has(GetExtensionFromUrl(url));\n}\n\nfunction IsTextureExtension(extension: string | undefined): boolean {\n return extension !== undefined && TextureExtensions.has(extension.toLowerCase());\n}\n"]}
|
|
1
|
+
{"version":3,"file":"smartAssetManager.js","sourceRoot":"","sources":["../../../../dev/core/src/SmartAssets/smartAssetManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAiB,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAGH,wBAAwB,EACxB,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,mBAAmB,GACtB,MAAM,wBAAwB,CAAC;AAEhC,gEAAgE;AAChE,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;AAyD1E,MAAM,0BAA0B,GAAG,IAAI,OAAO,EAAiD,CAAC;AAChG,MAAM,oCAAoC,GAAG,IAAI,UAAU,EAAqB,CAAC;AAEjF;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAAC,KAAY;IACzC,MAAM,OAAO,GAAsB;QAC/B,KAAK;QACL,mBAAmB,EAAE,IAAI,UAAU,EAAQ;QAC3C,eAAe,EAAE,IAAI;KACxB,CAAC;IAEF,MAAM,QAAQ,GAA+B;QACzC,IAAI,EAAE,IAAI,GAAG,EAAE;QACf,OAAO,EAAE,IAAI,GAAG,EAAE;QAClB,UAAU,EAAE,IAAI,GAAG,EAAE;QACrB,cAAc,EAAE,IAAI,OAAO,EAAE;QAC7B,WAAW,EAAE,IAAI,GAAG,EAAE;QACtB,aAAa,EAAE,IAAI,GAAG,EAAE;QACxB,QAAQ,EAAE,IAAI,GAAG,EAA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AAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAEjD,KAAK,MAAM,UAAU,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,eAAe,EAAE,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QACnJ,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAC3B,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;AACL,CAAC;AAED,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjJ;;;;GAIG;AACH,MAAM,UAAU,8BAA8B;IAC1C,OAAO,iBAAiB,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,GAAW;IAC7B,OAAO,iBAAiB,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,kBAAkB,CAAC,SAA6B;IACrD,OAAO,SAAS,KAAK,SAAS,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;AACrF,CAAC","sourcesContent":["import { type Scene } from \"../scene\";\nimport { type AssetContainer } from \"../assetContainer\";\nimport { type Node } from \"../node\";\nimport { type Material } from \"../Materials/material\";\nimport { type BaseTexture } from \"../Materials/Textures/baseTexture\";\nimport { Texture } from \"../Materials/Textures/texture\";\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture\";\nimport { HDRCubeTexture } from \"../Materials/Textures/hdrCubeTexture\";\nimport { type AnimationGroup } from \"../Animations/animationGroup\";\nimport { Observable, type Observer } from \"../Misc/observable\";\nimport { Logger } from \"../Misc/logger\";\nimport { LoadAssetContainerAsync } from \"../Loading/sceneLoader\";\nimport { GetExtensionFromUrl } from \"../Misc/urlTools\";\nimport {\n type ISerializedSmartAssetEntry,\n type ISerializedSmartAssetMap,\n DeserializeSmartAssetMap,\n IsAbsoluteOrSpecialUrl,\n MakeRelative,\n ResolveAssetUrl,\n ReadJsonSourceAsync,\n} from \"./smartAssetSerializer\";\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst SMART_ASSET_MANAGER_KEY = Symbol.for(\"babylonjs:smartAssetManager\");\n\n/**\n * Stateful handle for a scene's smart asset registry.\n *\n * Smart asset behavior is exposed through module-level functions rather than\n * class methods so callers can import only the operations they need.\n */\nexport type SmartAssetManager = {\n /**\n * The scene this manager is attached to.\n */\n readonly scene: Scene;\n\n /**\n * Fires when the smart asset registry or loaded asset state changes.\n */\n readonly onChangedObservable: Observable<void>;\n\n /**\n * Optional callback invoked when an asset cannot be found at its registered URL.\n * Return a new URL or File to retry loading, or null to skip the asset.\n */\n onAssetNotFound: ((key: string, expectedUrl: string) => Promise<string | File | null>) | null;\n};\n\n/**\n * Optional registration data that helps select the correct loader when the URL\n * does not contain a usable file extension, such as blob-backed local files.\n */\ntype SmartAssetRegistrationOptions = Pick<ISerializedSmartAssetEntry, \"type\" | \"extension\" | \"metadata\">;\n\n/**\n * Optional load-time configuration. Includes the persistable {@link SmartAssetRegistrationOptions}\n * fields (type, extension, metadata) plus a transient `reloadSource` callback used by\n * {@link ReloadSmartAssetAsync} to fetch fresh bytes from disk for blob-backed assets.\n */\nexport type SmartAssetLoadOptions = SmartAssetRegistrationOptions & {\n /**\n * Optional callback invoked by {@link ReloadSmartAssetAsync} to obtain a fresh File\n * for the asset. Use this when the registered URL is a `blob:` URL backed by a\n * `FileSystemFileHandle` so Reload can re-read the underlying file from disk.\n */\n readonly reloadSource?: () => Promise<File>;\n};\n\ntype SmartAssetManagerInternals = {\n urls: Map<string, string>;\n options: Map<string, SmartAssetRegistrationOptions>;\n containers: Map<string, AssetContainer>;\n objectToKeyMap: WeakMap<object, string>;\n textureKeys: Set<string>;\n reloadSources: Map<string, () => Promise<File>>;\n blobUrls: Map<string, string>;\n sceneDisposeObserver: ReturnType<Scene[\"onDisposeObservable\"][\"add\"]> | null;\n};\n\nconst SmartAssetManagerInternals = new WeakMap<SmartAssetManager, SmartAssetManagerInternals>();\nconst OnSmartAssetManagerCreatedObservable = new Observable<SmartAssetManager>();\n\n/**\n * Creates a new SmartAssetManager state object and attaches it to the scene.\n *\n * Internal: callers should use {@link GetSmartAssetManager} which returns the\n * existing manager when one is already attached.\n * @param scene - The scene this manager operates on.\n * @returns The created smart asset manager state.\n */\nfunction CreateSmartAssetManager(scene: Scene): SmartAssetManager {\n const manager: SmartAssetManager = {\n scene,\n onChangedObservable: new Observable<void>(),\n onAssetNotFound: null,\n };\n\n const internal: SmartAssetManagerInternals = {\n urls: new Map(),\n options: new Map(),\n containers: new Map(),\n objectToKeyMap: new WeakMap(),\n textureKeys: new Set(),\n reloadSources: new Map(),\n blobUrls: new Map(),\n sceneDisposeObserver: null,\n };\n SmartAssetManagerInternals.set(manager, internal);\n\n if (!scene.metadata) {\n scene.metadata = {};\n }\n scene.metadata[SMART_ASSET_MANAGER_KEY] = manager;\n\n // Auto-dispose when the scene is disposed so the manager doesn't outlive it.\n internal.sceneDisposeObserver = scene.onDisposeObservable.add(() => DisposeSmartAssetManager(manager));\n\n OnSmartAssetManagerCreatedObservable.notifyObservers(manager);\n\n return manager;\n}\n\n/**\n * Returns the SmartAssetManager attached to the given scene, creating and\n * attaching one if none exists.\n * @param scene - The scene to look up or attach a manager to.\n * @returns The existing or newly created SmartAssetManager.\n */\nexport function GetSmartAssetManager(scene: Scene): SmartAssetManager {\n const existing = scene.metadata?.[SMART_ASSET_MANAGER_KEY] as SmartAssetManager | undefined;\n if (existing) {\n return existing;\n }\n return CreateSmartAssetManager(scene);\n}\n\n/**\n * Adds an observer that is notified whenever a SmartAssetManager is created.\n * @param callback - The callback to invoke with each newly created manager.\n * @returns The observer registration.\n */\nexport function AddSmartAssetManagerCreatedObserver(callback: (manager: SmartAssetManager) => void): Observer<SmartAssetManager> {\n // Wrap so the EventState second-arg from Observable.add isn't passed through to the caller.\n return OnSmartAssetManagerCreatedObservable.add((manager) => callback(manager));\n}\n\n/**\n * Registers a smart asset entry mapping a key to a URL.\n * @param scene - The scene whose smart asset registry to update.\n * @param key - Unique string identifier for this asset.\n * @param url - URL or path to the asset file.\n * @param options - Optional loader hints and metadata for this asset.\n */\nexport function RegisterSmartAsset(scene: Scene, key: string, url: string, options?: SmartAssetRegistrationOptions): void {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n RevokeManagedBlobUrl(internal, key, url);\n internal.urls.set(key, url);\n TrackManagedBlobUrl(internal, key, url);\n if (options) {\n const existingOptions = internal.options.get(key);\n internal.options.set(key, { ...existingOptions, ...options });\n if (options.type === \"texture\") {\n internal.textureKeys.add(key);\n } else if (options.type !== undefined) {\n internal.textureKeys.delete(key);\n }\n }\n manager.onChangedObservable.notifyObservers();\n}\n\n/**\n * Removes a key from the registry. If the asset is loaded, it is unloaded first.\n * @param scene - The scene that owns the smart asset.\n * @param key - The key to remove.\n * @returns A promise that resolves when the asset has been unloaded and removed.\n */\nexport async function RemoveSmartAssetAsync(scene: Scene, key: string): Promise<void> {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n if (internal.containers.has(key)) {\n await UnloadSmartAssetAsync(scene, key);\n }\n for (const tex of [...scene.textures]) {\n if (internal.objectToKeyMap.get(tex) === key) {\n internal.objectToKeyMap.delete(tex);\n tex.dispose();\n }\n }\n internal.urls.delete(key);\n internal.options.delete(key);\n internal.textureKeys.delete(key);\n internal.reloadSources.delete(key);\n RevokeManagedBlobUrl(internal, key);\n manager.onChangedObservable.notifyObservers();\n}\n\n/**\n * Returns all registered key-to-URL mappings.\n * @param scene - The scene whose smart asset registry to read.\n * @returns A read-only map of keys to URLs.\n */\nexport function GetAllSmartAssets(scene: Scene): ReadonlyMap<string, string> {\n return GetSmartAssetInternals(GetSmartAssetManager(scene)).urls;\n}\n\n/**\n * Loads a scene-file asset by key.\n * @param scene - The scene to load the asset into.\n * @param key - The key to load.\n * @param url - Optional URL. If provided, the key is registered first.\n * @param options - Optional loader hints and metadata for this asset.\n * @returns A promise resolving to the loaded AssetContainer.\n */\nexport async function LoadSmartAssetAsync(scene: Scene, key: string, url?: string, options?: SmartAssetLoadOptions): Promise<AssetContainer> {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n const previousUrl = internal.urls.get(key);\n const { reloadSource, ...registrationOptions } = options ?? {};\n if (url) {\n RegisterSmartAsset(scene, key, url, registrationOptions);\n }\n if (reloadSource) {\n internal.reloadSources.set(key, reloadSource);\n }\n\n const resolvedUrl = internal.urls.get(key);\n if (!resolvedUrl) {\n throw new Error(`SmartAssetManager: Key \"${key}\" is not registered. Provide a URL to auto-register.`);\n }\n\n const existing = internal.containers.get(key);\n if (existing) {\n if (url && url !== previousUrl) {\n // URL changed — drop the stale container before fetching the new one\n // so callers don't get a surprise cached return for an updated URL.\n await UnloadSmartAssetAsync(scene, key);\n } else {\n return existing;\n }\n }\n\n return await LoadSmartAssetSceneFileAsync(manager, key, resolvedUrl, internal.options.get(key)?.extension);\n}\n\n/**\n * Loads all registered assets concurrently.\n * @param scene - The scene whose registered assets to load.\n * @returns A promise resolving to loaded scene-file containers.\n */\nexport async function LoadAllSmartAssetsAsync(scene: Scene): Promise<AssetContainer[]> {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n const scenePromises: Promise<AssetContainer | null>[] = [];\n const texturePromises: Promise<void>[] = [];\n\n for (const [key, url] of Array.from(internal.urls)) {\n if (internal.containers.has(key)) {\n continue;\n }\n const options = internal.options.get(key);\n if (internal.textureKeys.has(key) || options?.type === \"texture\" || IsTextureUrl(url) || IsTextureExtension(options?.extension)) {\n const textureLoadAsync = async () => {\n try {\n await LoadSmartAssetTextureAsync(scene, key);\n } catch {\n Logger.Warn(`SmartAssetManager: Texture \"${key}\" could not be loaded — skipping.`);\n }\n };\n texturePromises.push(textureLoadAsync());\n } else {\n const sceneLoadAsync = async () => {\n try {\n return await LoadSmartAssetAsync(scene, key);\n } catch {\n Logger.Warn(`SmartAssetManager: Asset \"${key}\" could not be loaded — skipping.`);\n return null;\n }\n };\n scenePromises.push(sceneLoadAsync());\n }\n }\n\n await Promise.all(texturePromises);\n const results = await Promise.all(scenePromises);\n return results.filter((r): r is AssetContainer => r !== null);\n}\n\n/**\n * Loads a standalone texture by key.\n * @param scene - The scene to load the texture into.\n * @param key - The key to load.\n * @param url - Optional URL. If provided, the key is registered first.\n * @param options - Optional loader hints and metadata for this asset.\n * @returns A promise resolving to the loaded texture.\n */\nexport async function LoadSmartAssetTextureAsync(scene: Scene, key: string, url?: string, options?: SmartAssetLoadOptions): Promise<BaseTexture> {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n const previousUrl = internal.urls.get(key);\n const { reloadSource, ...registrationOptions } = options ?? {};\n if (url) {\n RegisterSmartAsset(scene, key, url, { ...registrationOptions, type: registrationOptions.type ?? \"texture\" });\n }\n if (reloadSource) {\n internal.reloadSources.set(key, reloadSource);\n }\n\n internal.textureKeys.add(key);\n\n // Mirror LoadSmartAssetAsync: if a tracked texture already exists for this key,\n // return it on a same-URL call (cache hit) or dispose it before reload on URL change.\n // Without this guard, calling LoadSmartAssetTextureAsync twice with the same URL\n // would create duplicate Texture objects in scene.textures.\n const existingTextures: BaseTexture[] = [];\n for (const tex of scene.textures) {\n if (internal.objectToKeyMap.get(tex) === key) {\n existingTextures.push(tex);\n }\n }\n if (existingTextures.length > 0) {\n if (url && previousUrl !== undefined && url !== previousUrl) {\n for (const tex of existingTextures) {\n internal.objectToKeyMap.delete(tex);\n tex.dispose();\n }\n } else {\n return existingTextures[0];\n }\n }\n\n const resolvedUrl = internal.urls.get(key);\n if (!resolvedUrl) {\n throw new Error(`SmartAssetManager: Key \"${key}\" is not registered. Provide a URL to auto-register.`);\n }\n\n const extensionHint = internal.options.get(key)?.extension;\n let texture: BaseTexture;\n try {\n texture = await CreateAndLoadTextureAsync(manager, resolvedUrl, extensionHint);\n } catch (error) {\n const fallback = await ResolveNotFoundAsync(manager, key, resolvedUrl);\n if (!fallback) {\n throw error;\n }\n texture = await CreateAndLoadTextureAsync(manager, fallback.url, fallback.extensionHint ?? extensionHint);\n }\n\n internal.objectToKeyMap.set(texture, key);\n\n // Surface the registry key as the texture's display name when the texture\n // doesn't already have one. For blob/data-URL textures (e.g. user-uploaded\n // files) the underlying `texture.name` is an opaque blob URL, so without\n // this any UI that shows texture names (Scene Explorer, material slot\n // pickers, override summaries) would render the blob URL instead of the\n // user-chosen key. We never overwrite a display name the caller already set.\n if (!texture.displayName) {\n texture.displayName = key;\n }\n\n manager.onChangedObservable.notifyObservers();\n return texture;\n}\n\n/**\n * Unloads a loaded asset while keeping the key registered.\n * @param scene - The scene whose smart asset to unload.\n * @param key - The key to unload.\n * @returns A promise that resolves once the asset has been unloaded.\n */\nexport async function UnloadSmartAssetAsync(scene: Scene, key: string): Promise<void> {\n const manager = GetSmartAssetManager(scene);\n const internal = GetSmartAssetInternals(manager);\n const container = internal.containers.get(key);\n if (container) {\n container.removeAllFromScene();\n container.dispose();\n internal.containers.delete(key);\n manager.onChangedObservable.notifyObservers();\n return;\n }\n\n for (const tex of [...scene.textures]) {\n if (internal.objectToKeyMap.get(tex) === key) {\n internal.objectToKeyMap.delete(tex);\n tex.dispose();\n }\n }\n manager.onChangedObservable.notifyObservers();\n}\n\n/**\n * Unloads and re-loads an asset.\n * @param scene - The scene whose smart asset to reload.\n * @param key - The key to reload.\n * @returns A promise resolving to the newly loaded AssetContainer or BaseTexture.\n */\nexport async function ReloadSmartAssetAsync(scene: Scene, key: string): Promise<AssetContainer | BaseTexture> {\n const internal = GetSmartAssetInternals(GetSmartAssetManager(scene));\n const reloadSource = internal.reloadSources.get(key);\n if (reloadSource) {\n try {\n const freshFile = await reloadSource();\n const blobUrl = URL.createObjectURL(freshFile);\n RegisterSmartAsset(scene, key, blobUrl, { extension: GetExtensionFromUrl(freshFile.name) || internal.options.get(key)?.extension });\n } catch (e) {\n Logger.Warn(`SmartAssetManager: reloadSource callback failed for \"${key}\": ${e}`);\n }\n }\n\n await UnloadSmartAssetAsync(scene, key);\n\n if (internal.textureKeys.has(key)) {\n return await LoadSmartAssetTextureAsync(scene, key);\n }\n return await LoadSmartAssetAsync(scene, key);\n}\n\n/**\n * Finds which smart asset key owns a scene object.\n * @param scene - The scene whose registry to search.\n * @param object - A scene object.\n * @returns The key, or undefined if the object is not tracked.\n */\nexport function FindSmartAssetKeyForObject(scene: Scene, object: Node | Material | BaseTexture | AnimationGroup): string | undefined {\n return GetSmartAssetInternals(GetSmartAssetManager(scene)).objectToKeyMap.get(object);\n}\n\n/**\n * Serializes the registry to a JSON-compatible document.\n * If a baseUrl is provided, asset URLs are stored relative to it for portability.\n * @param scene - The scene whose registry to serialize.\n * @param baseUrl - Optional base URL for making asset paths relative.\n * @returns A serialized asset map document.\n */\nexport function SerializeSmartAssetManagerMap(scene: Scene, baseUrl?: string): ISerializedSmartAssetMap {\n const internal = GetSmartAssetInternals(GetSmartAssetManager(scene));\n const assets: Record<string, ISerializedSmartAssetEntry> = {};\n\n for (const [key, registeredUrl] of Array.from(internal.urls)) {\n let url = registeredUrl;\n if (baseUrl && !IsAbsoluteOrSpecialUrl(url)) {\n url = MakeRelative(url, baseUrl);\n }\n const options = internal.options.get(key);\n assets[key] = { url, ...options, ...(internal.textureKeys.has(key) ? { type: \"texture\" } : {}) };\n }\n\n return { version: 1, assets };\n}\n\n/**\n * Loads an asset map from a URL, File, or pre-parsed JSON object.\n * @param scene - The scene to load assets into.\n * @param source - A URL string, File object, or pre-parsed ISerializedSmartAssetMap.\n * @param rootUrl - Optional root URL for resolving relative asset paths.\n * @returns A promise that resolves after the map has been loaded and all registered assets have been attempted.\n */\nexport async function LoadSmartAssetMapAsync(scene: Scene, source: string | File | ISerializedSmartAssetMap, rootUrl?: string): Promise<void> {\n let resolvedRootUrl = rootUrl ?? \"\";\n\n if (typeof source === \"string\" && !rootUrl) {\n const { Tools } = await import(\"../Misc/tools\");\n resolvedRootUrl = Tools.GetFolderPath(source);\n }\n\n const raw = await ReadJsonSourceAsync(source);\n const doc = DeserializeSmartAssetMap(raw);\n\n for (const [key, entry] of Object.entries(doc.assets)) {\n const resolved = resolvedRootUrl ? ResolveAssetUrl(entry.url, resolvedRootUrl) : entry.url;\n RegisterSmartAsset(scene, key, resolved, { type: entry.type, extension: entry.extension, metadata: entry.metadata });\n }\n\n await LoadAllSmartAssetsAsync(scene);\n}\n\n/**\n * Registers an externally loaded AssetContainer under a key.\n * @param manager - The smart asset manager state.\n * @param key - The key to associate with the container.\n * @param container - The loaded AssetContainer.\n */\nfunction TrackLoadedSmartAssetContainer(manager: SmartAssetManager, key: string, container: AssetContainer): void {\n const internal = GetSmartAssetInternals(manager);\n internal.containers.set(key, container);\n TrackSmartAssetContainerObjects(manager, key, container);\n manager.onChangedObservable.notifyObservers();\n}\n\n/**\n * Disposes the manager, unloading all assets and detaching it from its scene.\n * Safe to call multiple times; subsequent calls are no-ops. Automatically invoked when the\n * owning scene is disposed.\n * @param manager - The smart asset manager state.\n */\nexport function DisposeSmartAssetManager(manager: SmartAssetManager): void {\n const internal = SmartAssetManagerInternals.get(manager);\n if (!internal) {\n return;\n }\n SmartAssetManagerInternals.delete(manager);\n\n if (internal.sceneDisposeObserver) {\n manager.scene.onDisposeObservable.remove(internal.sceneDisposeObserver);\n internal.sceneDisposeObserver = null;\n }\n\n for (const container of Array.from(internal.containers.values())) {\n container.removeAllFromScene();\n container.dispose();\n }\n for (const tex of [...manager.scene.textures]) {\n if (internal.objectToKeyMap.get(tex) !== undefined) {\n tex.dispose();\n }\n }\n\n internal.urls.clear();\n internal.options.clear();\n internal.textureKeys.clear();\n internal.reloadSources.clear();\n internal.containers.clear();\n for (const blobUrl of Array.from(internal.blobUrls.values())) {\n URL.revokeObjectURL(blobUrl);\n }\n internal.blobUrls.clear();\n\n manager.onChangedObservable.clear();\n\n if (manager.scene.metadata) {\n delete manager.scene.metadata[SMART_ASSET_MANAGER_KEY];\n }\n}\n\nfunction GetSmartAssetInternals(manager: SmartAssetManager): SmartAssetManagerInternals {\n const internal = SmartAssetManagerInternals.get(manager);\n if (!internal) {\n throw new Error(\"SmartAssetManager: Unknown manager state.\");\n }\n return internal;\n}\n\nfunction RevokeManagedBlobUrl(internal: SmartAssetManagerInternals, key: string, replacementUrl?: string): void {\n const blobUrl = internal.blobUrls.get(key);\n if (!blobUrl || blobUrl === replacementUrl) {\n return;\n }\n URL.revokeObjectURL(blobUrl);\n internal.blobUrls.delete(key);\n}\n\nfunction TrackManagedBlobUrl(internal: SmartAssetManagerInternals, key: string, url: string): void {\n if (url.startsWith(\"blob:\")) {\n internal.blobUrls.set(key, url);\n }\n}\n\nasync function CreateAndLoadTextureAsync(manager: SmartAssetManager, url: string, extensionHint?: string): Promise<BaseTexture> {\n return await new Promise<BaseTexture>((resolve, reject) => {\n const ext = (extensionHint || GetExtensionFromUrl(url)).toLowerCase();\n const onError = (message?: string, exception?: unknown) => {\n const err = exception instanceof Error ? exception : new Error(message ?? `SmartAssetManager: failed to load texture from \"${url}\".`);\n reject(err);\n };\n let texture: BaseTexture;\n const onLoad = () => resolve(texture);\n if (ext === \".hdr\") {\n // HDR equirectangular files require HDRCubeTexture — CubeTexture's .hdr\n // loader explicitly throws \".hdr not supported in Cube.\" so we can't\n // route HDRs through the generic CubeTexture path.\n texture = new HDRCubeTexture(url, manager.scene, 256, false, true, false, false, onLoad, onError);\n } else if (ext === \".env\" || ext === \".dds\") {\n texture = new CubeTexture(url, manager.scene, null, false, null, onLoad, onError, undefined, ext === \".env\");\n } else {\n texture = new Texture(url, manager.scene, undefined, undefined, undefined, onLoad, onError);\n }\n });\n}\n\nasync function ResolveNotFoundAsync(manager: SmartAssetManager, key: string, expectedUrl: string): Promise<{ url: string; extensionHint?: string } | null> {\n if (!manager.onAssetNotFound) {\n return null;\n }\n const resolution = await manager.onAssetNotFound(key, expectedUrl);\n if (resolution === null || resolution === undefined) {\n return null;\n }\n if (typeof resolution === \"string\") {\n RegisterSmartAsset(manager.scene, key, resolution);\n return { url: resolution, extensionHint: GetSmartAssetInternals(manager).options.get(key)?.extension };\n }\n const blobUrl = URL.createObjectURL(resolution);\n const extensionHint = GetExtensionFromUrl(resolution.name) || undefined;\n RegisterSmartAsset(manager.scene, key, blobUrl, { extension: extensionHint });\n return { url: blobUrl, extensionHint };\n}\n\nasync function LoadSmartAssetSceneFileAsync(manager: SmartAssetManager, key: string, url: string, extensionHint?: string): Promise<AssetContainer> {\n const loadAsync = async (loadUrl: string, extensionHint?: string) => {\n const container = await LoadAssetContainerAsync(loadUrl, manager.scene, { pluginExtension: extensionHint });\n container.addAllToScene();\n TrackLoadedSmartAssetContainer(manager, key, container);\n return container;\n };\n\n try {\n return await loadAsync(url, extensionHint);\n } catch (error) {\n const fallback = await ResolveNotFoundAsync(manager, key, url);\n if (fallback) {\n try {\n return await loadAsync(fallback.url, fallback.extensionHint);\n } catch (retryError) {\n Logger.Warn(`SmartAssetManager: Asset \"${key}\" could not be loaded from fallback \"${fallback.url}\".`);\n throw retryError;\n }\n }\n Logger.Warn(`SmartAssetManager: Asset \"${key}\" could not be loaded from \"${url}\".`);\n throw error;\n }\n}\n\nfunction TrackSmartAssetContainerObjects(manager: SmartAssetManager, key: string, container: AssetContainer): void {\n const internal = GetSmartAssetInternals(manager);\n\n for (const collection of [container.meshes, container.materials, container.textures, container.animationGroups, container.lights, container.cameras]) {\n for (const obj of collection) {\n internal.objectToKeyMap.set(obj, key);\n }\n }\n}\n\nconst TextureExtensions = new Set([\".png\", \".jpg\", \".jpeg\", \".bmp\", \".tga\", \".gif\", \".webp\", \".env\", \".hdr\", \".dds\", \".ktx\", \".ktx2\", \".basis\"]);\n\n/**\n * Returns the set of file extensions (including the leading dot) that {@link LoadAllSmartAssetsAsync}\n * treats as standalone textures.\n * @returns A read-only set of texture file extensions.\n */\nexport function GetSmartAssetTextureExtensions(): ReadonlySet<string> {\n return TextureExtensions;\n}\n\n/**\n * Returns true if the URL points to a standalone texture file.\n * @param url - The URL to check.\n * @returns True if the URL has a texture file extension.\n */\nfunction IsTextureUrl(url: string): boolean {\n return TextureExtensions.has(GetExtensionFromUrl(url));\n}\n\nfunction IsTextureExtension(extension: string | undefined): boolean {\n return extension !== undefined && TextureExtensions.has(extension.toLowerCase());\n}\n"]}
|
|
@@ -487,6 +487,8 @@ export declare class WebXRTrackedBody implements IDisposable {
|
|
|
487
487
|
private _mappedChildBones;
|
|
488
488
|
/** Bind-space local child direction for each mapped bone. */
|
|
489
489
|
private _bindLocalAimDirections;
|
|
490
|
+
/** Bind-space local hand-plane normal used to correct wrist/hand twist from tracked finger positions. */
|
|
491
|
+
private _bindLocalTwistNormals;
|
|
490
492
|
/**
|
|
491
493
|
* XR joint index to aim each mapped bone at. This can be a mapped joint
|
|
492
494
|
* (same as `_boneToJointIdx.get(aimChildBone)`) or an **unmapped** XR
|
|
@@ -496,6 +498,8 @@ export declare class WebXRTrackedBody implements IDisposable {
|
|
|
496
498
|
* "where the hand is pointing".
|
|
497
499
|
*/
|
|
498
500
|
private _boneAimTargetJointIdx;
|
|
501
|
+
/** Per-bone pair of tracked joints that define the hand plane used for twist correction. */
|
|
502
|
+
private _boneTwistReferenceJointIdx;
|
|
499
503
|
/**
|
|
500
504
|
* Per-mapped-bone bind-pose world rotation in mesh-local space
|
|
501
505
|
* (decomposed from `bone.getFinalMatrix()` at bind time). Used by the
|
|
@@ -541,6 +545,15 @@ export declare class WebXRTrackedBody implements IDisposable {
|
|
|
541
545
|
private _tempParentAccumRot;
|
|
542
546
|
/** Scratch quaternion reused for the parent-world intermediate product. */
|
|
543
547
|
private _tempParentAccumTmp;
|
|
548
|
+
/** Scratch vectors reused by hand twist correction. */
|
|
549
|
+
private _tempTwistFirst;
|
|
550
|
+
private _tempTwistSecond;
|
|
551
|
+
private _tempTwistNormal;
|
|
552
|
+
private _tempCurrentTwistNormal;
|
|
553
|
+
private _tempProjectedTwistNormal;
|
|
554
|
+
private _tempProjectedDesiredTwistNormal;
|
|
555
|
+
private _tempTwistAimAxis;
|
|
556
|
+
private _tempTwistCross;
|
|
544
557
|
/** The skeleton reference for iterating bones in parent-first order. */
|
|
545
558
|
private _skeleton;
|
|
546
559
|
/** Cached inverse of the skeleton mesh's world matrix. */
|
|
@@ -718,6 +731,9 @@ export declare class WebXRTrackedBody implements IDisposable {
|
|
|
718
731
|
* direct-retarget path (or re-triggering auto-capture on the next frame).
|
|
719
732
|
*/
|
|
720
733
|
clearTrackedBind(): void;
|
|
734
|
+
private _computeNormalFromJointPositions;
|
|
735
|
+
private _projectOnPlaneToRef;
|
|
736
|
+
private _storeBindLocalTwistNormalFromPositions;
|
|
721
737
|
/** Internal: copy current desiredFinals into the tracked-bind slots. */
|
|
722
738
|
private _captureTrackedBindFromDesiredFinals;
|
|
723
739
|
/**
|
|
@@ -584,6 +584,16 @@ export const MixamoAimChildOverrides = {
|
|
|
584
584
|
["left-hand-wrist" /* WebXRBodyJoint.LEFT_HAND_WRIST */]: "left-hand-middle-metacarpal" /* WebXRBodyJoint.LEFT_HAND_MIDDLE_METACARPAL */,
|
|
585
585
|
["right-hand-wrist" /* WebXRBodyJoint.RIGHT_HAND_WRIST */]: "right-hand-middle-metacarpal" /* WebXRBodyJoint.RIGHT_HAND_MIDDLE_METACARPAL */,
|
|
586
586
|
};
|
|
587
|
+
const HandTwistReferenceJoints = {
|
|
588
|
+
["left-hand-wrist" /* WebXRBodyJoint.LEFT_HAND_WRIST */]: {
|
|
589
|
+
first: "left-hand-index-metacarpal" /* WebXRBodyJoint.LEFT_HAND_INDEX_METACARPAL */,
|
|
590
|
+
second: "left-hand-little-metacarpal" /* WebXRBodyJoint.LEFT_HAND_LITTLE_METACARPAL */,
|
|
591
|
+
},
|
|
592
|
+
["right-hand-wrist" /* WebXRBodyJoint.RIGHT_HAND_WRIST */]: {
|
|
593
|
+
first: "right-hand-index-metacarpal" /* WebXRBodyJoint.RIGHT_HAND_INDEX_METACARPAL */,
|
|
594
|
+
second: "right-hand-little-metacarpal" /* WebXRBodyJoint.RIGHT_HAND_LITTLE_METACARPAL */,
|
|
595
|
+
},
|
|
596
|
+
};
|
|
587
597
|
/**
|
|
588
598
|
* Resolve the Mixamo rig mapping for a given body mesh, auto-detecting the
|
|
589
599
|
* `mixamorig:` bone-name prefix. Falls back to the unprefixed names.
|
|
@@ -784,6 +794,8 @@ export class WebXRTrackedBody {
|
|
|
784
794
|
this._mappedChildBones = new Map();
|
|
785
795
|
/** Bind-space local child direction for each mapped bone. */
|
|
786
796
|
this._bindLocalAimDirections = new Map();
|
|
797
|
+
/** Bind-space local hand-plane normal used to correct wrist/hand twist from tracked finger positions. */
|
|
798
|
+
this._bindLocalTwistNormals = new Map();
|
|
787
799
|
/**
|
|
788
800
|
* XR joint index to aim each mapped bone at. This can be a mapped joint
|
|
789
801
|
* (same as `_boneToJointIdx.get(aimChildBone)`) or an **unmapped** XR
|
|
@@ -793,6 +805,8 @@ export class WebXRTrackedBody {
|
|
|
793
805
|
* "where the hand is pointing".
|
|
794
806
|
*/
|
|
795
807
|
this._boneAimTargetJointIdx = new Map();
|
|
808
|
+
/** Per-bone pair of tracked joints that define the hand plane used for twist correction. */
|
|
809
|
+
this._boneTwistReferenceJointIdx = new Map();
|
|
796
810
|
/**
|
|
797
811
|
* Per-mapped-bone bind-pose world rotation in mesh-local space
|
|
798
812
|
* (decomposed from `bone.getFinalMatrix()` at bind time). Used by the
|
|
@@ -838,6 +852,15 @@ export class WebXRTrackedBody {
|
|
|
838
852
|
this._tempParentAccumRot = new Quaternion();
|
|
839
853
|
/** Scratch quaternion reused for the parent-world intermediate product. */
|
|
840
854
|
this._tempParentAccumTmp = new Quaternion();
|
|
855
|
+
/** Scratch vectors reused by hand twist correction. */
|
|
856
|
+
this._tempTwistFirst = new Vector3();
|
|
857
|
+
this._tempTwistSecond = new Vector3();
|
|
858
|
+
this._tempTwistNormal = new Vector3();
|
|
859
|
+
this._tempCurrentTwistNormal = new Vector3();
|
|
860
|
+
this._tempProjectedTwistNormal = new Vector3();
|
|
861
|
+
this._tempProjectedDesiredTwistNormal = new Vector3();
|
|
862
|
+
this._tempTwistAimAxis = new Vector3();
|
|
863
|
+
this._tempTwistCross = new Vector3();
|
|
841
864
|
/** The skeleton reference for iterating bones in parent-first order. */
|
|
842
865
|
this._skeleton = null;
|
|
843
866
|
/** Cached inverse of the skeleton mesh's world matrix. */
|
|
@@ -940,7 +963,9 @@ export class WebXRTrackedBody {
|
|
|
940
963
|
this._mappedBoneBindLocals.clear();
|
|
941
964
|
this._mappedChildBones.clear();
|
|
942
965
|
this._bindLocalAimDirections.clear();
|
|
966
|
+
this._bindLocalTwistNormals.clear();
|
|
943
967
|
this._boneAimTargetJointIdx.clear();
|
|
968
|
+
this._boneTwistReferenceJointIdx.clear();
|
|
944
969
|
this._bindBoneWorldRotMeshLocal.clear();
|
|
945
970
|
this._computedBoneNewWorldRot.clear();
|
|
946
971
|
this._computedBoneNewWorldRotFrameId.clear();
|
|
@@ -1023,6 +1048,34 @@ export class WebXRTrackedBody {
|
|
|
1023
1048
|
this._bindBoneWorldRotMeshLocal.set(bone, this._tempRotQuat.clone());
|
|
1024
1049
|
}
|
|
1025
1050
|
}
|
|
1051
|
+
const findBestUnmappedDescendantForJoint = (bone, targetJointName) => {
|
|
1052
|
+
const tokens = targetJointName
|
|
1053
|
+
.toLowerCase()
|
|
1054
|
+
.split(/[_\-\s]+/)
|
|
1055
|
+
.filter((t) => t.length >= 4 && t !== "left" && t !== "right" && t !== "hand" && t !== "foot" && t !== "joint" && t !== "body");
|
|
1056
|
+
let bestDescendant = null;
|
|
1057
|
+
let bestScore = 0;
|
|
1058
|
+
const walk = (b) => {
|
|
1059
|
+
for (const child of b.children) {
|
|
1060
|
+
if (!this._boneToJointIdx.has(child)) {
|
|
1061
|
+
const lname = child.name.toLowerCase();
|
|
1062
|
+
let score = 0;
|
|
1063
|
+
for (const t of tokens) {
|
|
1064
|
+
if (lname.indexOf(t) !== -1) {
|
|
1065
|
+
score++;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
if (score > bestScore) {
|
|
1069
|
+
bestScore = score;
|
|
1070
|
+
bestDescendant = child;
|
|
1071
|
+
}
|
|
1072
|
+
walk(child);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
walk(bone);
|
|
1077
|
+
return bestScore > 0 ? bestDescendant : null;
|
|
1078
|
+
};
|
|
1026
1079
|
for (const bone of Array.from(this._boneToJointIdx.keys())) {
|
|
1027
1080
|
// Prefer an explicit override (XR-joint → XR-joint) when provided.
|
|
1028
1081
|
const selfJointIdx = this._boneToJointIdx.get(bone);
|
|
@@ -1074,37 +1127,16 @@ export class WebXRTrackedBody {
|
|
|
1074
1127
|
// offset).
|
|
1075
1128
|
if (overrideTargetJointIdx !== -1 && overrideTargetJointName) {
|
|
1076
1129
|
this._boneAimTargetJointIdx.set(bone, overrideTargetJointIdx);
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
.
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
// Find best-matching descendant bone: most tokens matched,
|
|
1084
|
-
// prefer shorter names (closer to the target).
|
|
1085
|
-
let bestDescendant = null;
|
|
1086
|
-
let bestScore = 0;
|
|
1087
|
-
const walk = (b) => {
|
|
1088
|
-
for (const child of b.children) {
|
|
1089
|
-
if (!this._boneToJointIdx.has(child)) {
|
|
1090
|
-
const lname = child.name.toLowerCase();
|
|
1091
|
-
let score = 0;
|
|
1092
|
-
for (const t of tokens) {
|
|
1093
|
-
if (lname.indexOf(t) !== -1) {
|
|
1094
|
-
score++;
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
if (score > bestScore) {
|
|
1098
|
-
bestScore = score;
|
|
1099
|
-
bestDescendant = child;
|
|
1100
|
-
}
|
|
1101
|
-
walk(child);
|
|
1102
|
-
}
|
|
1130
|
+
const twistReferences = HandTwistReferenceJoints[selfJointName];
|
|
1131
|
+
if (twistReferences) {
|
|
1132
|
+
const firstIdx = BodyJointNameToIndex.get(twistReferences.first);
|
|
1133
|
+
const secondIdx = BodyJointNameToIndex.get(twistReferences.second);
|
|
1134
|
+
if (firstIdx !== undefined && secondIdx !== undefined) {
|
|
1135
|
+
this._boneTwistReferenceJointIdx.set(bone, { first: firstIdx, second: secondIdx });
|
|
1103
1136
|
}
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
if (
|
|
1107
|
-
const descendant = bestDescendant;
|
|
1137
|
+
}
|
|
1138
|
+
const descendant = findBestUnmappedDescendantForJoint(bone, overrideTargetJointName);
|
|
1139
|
+
if (descendant) {
|
|
1108
1140
|
const boneBindPos = bindWorldPositions.get(bone);
|
|
1109
1141
|
// Walk up: descendant's bind world position isn't in
|
|
1110
1142
|
// bindWorldPositions (only mapped bones were added).
|
|
@@ -1124,6 +1156,18 @@ export class WebXRTrackedBody {
|
|
|
1124
1156
|
}
|
|
1125
1157
|
}
|
|
1126
1158
|
}
|
|
1159
|
+
if (twistReferences && boneBindPos && descBindFinal && bindWorldRotation) {
|
|
1160
|
+
const firstDescendant = findBestUnmappedDescendantForJoint(bone, twistReferences.first);
|
|
1161
|
+
const secondDescendant = findBestUnmappedDescendantForJoint(bone, twistReferences.second);
|
|
1162
|
+
const firstBindFinal = firstDescendant ? bindPoseFinals.get(firstDescendant) : null;
|
|
1163
|
+
const secondBindFinal = secondDescendant ? bindPoseFinals.get(secondDescendant) : null;
|
|
1164
|
+
if (firstBindFinal && secondBindFinal) {
|
|
1165
|
+
descBindFinal.decompose(undefined, undefined, this._tempPosVec);
|
|
1166
|
+
firstBindFinal.decompose(undefined, undefined, this._tempTwistFirst);
|
|
1167
|
+
secondBindFinal.decompose(undefined, undefined, this._tempTwistSecond);
|
|
1168
|
+
this._storeBindLocalTwistNormalFromPositions(bone, boneBindPos, this._tempPosVec, this._tempTwistFirst, this._tempTwistSecond, bindWorldRotation);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1127
1171
|
}
|
|
1128
1172
|
// If we couldn't find a descendant, bind aim will be
|
|
1129
1173
|
// computed from tracked-bind positions later (fallback).
|
|
@@ -1432,6 +1476,18 @@ export class WebXRTrackedBody {
|
|
|
1432
1476
|
this._tempJointMatrix.multiplyToRef(this._meshWorldMatrixInverse, this._tempLocalMatrix);
|
|
1433
1477
|
this._tempLocalMatrix.decompose(undefined, undefined, this._desiredFinalPositions[targetIdx]);
|
|
1434
1478
|
});
|
|
1479
|
+
this._boneTwistReferenceJointIdx.forEach((twistReferences) => {
|
|
1480
|
+
if (!this._jointHasBone[twistReferences.first]) {
|
|
1481
|
+
Matrix.FromArrayToRef(this._jointTransformMatrices, twistReferences.first * 16, this._tempJointMatrix);
|
|
1482
|
+
this._tempJointMatrix.multiplyToRef(this._meshWorldMatrixInverse, this._tempLocalMatrix);
|
|
1483
|
+
this._tempLocalMatrix.decompose(undefined, undefined, this._desiredFinalPositions[twistReferences.first]);
|
|
1484
|
+
}
|
|
1485
|
+
if (!this._jointHasBone[twistReferences.second]) {
|
|
1486
|
+
Matrix.FromArrayToRef(this._jointTransformMatrices, twistReferences.second * 16, this._tempJointMatrix);
|
|
1487
|
+
this._tempJointMatrix.multiplyToRef(this._meshWorldMatrixInverse, this._tempLocalMatrix);
|
|
1488
|
+
this._tempLocalMatrix.decompose(undefined, undefined, this._desiredFinalPositions[twistReferences.second]);
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1435
1491
|
// Auto-capture bind on first frame when enabled.
|
|
1436
1492
|
if (!this._hasTrackedBind && this.autoCaptureBindOnFirstFrame) {
|
|
1437
1493
|
this._captureTrackedBindFromDesiredFinals();
|
|
@@ -1513,6 +1569,45 @@ export class WebXRTrackedBody {
|
|
|
1513
1569
|
clearTrackedBind() {
|
|
1514
1570
|
this._hasTrackedBind = false;
|
|
1515
1571
|
}
|
|
1572
|
+
_computeNormalFromJointPositions(origin, aimTarget, first, second, result, aimAxisResult) {
|
|
1573
|
+
aimTarget.subtractToRef(origin, aimAxisResult);
|
|
1574
|
+
if (aimAxisResult.lengthSquared() < 1e-8) {
|
|
1575
|
+
return false;
|
|
1576
|
+
}
|
|
1577
|
+
aimAxisResult.normalize();
|
|
1578
|
+
first.subtractToRef(second, this._tempTwistCross);
|
|
1579
|
+
if (this._tempTwistCross.lengthSquared() < 1e-8) {
|
|
1580
|
+
return false;
|
|
1581
|
+
}
|
|
1582
|
+
this._tempTwistCross.normalize();
|
|
1583
|
+
Vector3.CrossToRef(aimAxisResult, this._tempTwistCross, result);
|
|
1584
|
+
if (result.lengthSquared() < 1e-8) {
|
|
1585
|
+
return false;
|
|
1586
|
+
}
|
|
1587
|
+
result.normalize();
|
|
1588
|
+
return true;
|
|
1589
|
+
}
|
|
1590
|
+
_projectOnPlaneToRef(vector, planeNormal, result) {
|
|
1591
|
+
const dot = Vector3.Dot(vector, planeNormal);
|
|
1592
|
+
result.copyFrom(planeNormal).scaleInPlace(-dot).addInPlace(vector);
|
|
1593
|
+
if (result.lengthSquared() < 1e-8) {
|
|
1594
|
+
return false;
|
|
1595
|
+
}
|
|
1596
|
+
result.normalize();
|
|
1597
|
+
return true;
|
|
1598
|
+
}
|
|
1599
|
+
_storeBindLocalTwistNormalFromPositions(bone, origin, aimTarget, first, second, bindWorldRotation) {
|
|
1600
|
+
if (!this._computeNormalFromJointPositions(origin, aimTarget, first, second, this._tempTwistNormal, this._tempTwistAimAxis)) {
|
|
1601
|
+
return;
|
|
1602
|
+
}
|
|
1603
|
+
Quaternion.InverseToRef(bindWorldRotation, this._tempRotQuat2);
|
|
1604
|
+
this._tempTwistNormal.rotateByQuaternionToRef(this._tempRotQuat2, this._tempLocalDirection);
|
|
1605
|
+
if (this._tempLocalDirection.lengthSquared() < 1e-8) {
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
this._tempLocalDirection.normalize();
|
|
1609
|
+
this._bindLocalTwistNormals.set(bone, this._tempLocalDirection.clone());
|
|
1610
|
+
}
|
|
1516
1611
|
/** Internal: copy current desiredFinals into the tracked-bind slots. */
|
|
1517
1612
|
_captureTrackedBindFromDesiredFinals() {
|
|
1518
1613
|
if (!this._trackedBindDesiredFinalRot) {
|
|
@@ -1536,6 +1631,14 @@ export class WebXRTrackedBody {
|
|
|
1536
1631
|
}
|
|
1537
1632
|
this._trackedBindDesiredFinalPos[targetIdx].copyFrom(this._desiredFinalPositions[targetIdx]);
|
|
1538
1633
|
}
|
|
1634
|
+
for (const twistReferences of Array.from(this._boneTwistReferenceJointIdx.values())) {
|
|
1635
|
+
if (!this._jointHasBone[twistReferences.first]) {
|
|
1636
|
+
this._trackedBindDesiredFinalPos[twistReferences.first].copyFrom(this._desiredFinalPositions[twistReferences.first]);
|
|
1637
|
+
}
|
|
1638
|
+
if (!this._jointHasBone[twistReferences.second]) {
|
|
1639
|
+
this._trackedBindDesiredFinalPos[twistReferences.second].copyFrom(this._desiredFinalPositions[twistReferences.second]);
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1539
1642
|
// For any bone whose aim target is UNMAPPED and therefore wasn't
|
|
1540
1643
|
// resolved at setBodyMesh time, compute its bind-local aim direction
|
|
1541
1644
|
// now — using tracked bind positions for both endpoints and the
|
|
@@ -1562,6 +1665,18 @@ export class WebXRTrackedBody {
|
|
|
1562
1665
|
this._tempLocalDirection.normalize();
|
|
1563
1666
|
this._bindLocalAimDirections.set(bone, this._tempLocalDirection.clone());
|
|
1564
1667
|
}
|
|
1668
|
+
for (const [bone, twistReferences] of Array.from(this._boneTwistReferenceJointIdx)) {
|
|
1669
|
+
if (this._bindLocalTwistNormals.has(bone)) {
|
|
1670
|
+
continue;
|
|
1671
|
+
}
|
|
1672
|
+
const selfJointIdx = this._boneToJointIdx.get(bone);
|
|
1673
|
+
const targetIdx = this._boneAimTargetJointIdx.get(bone);
|
|
1674
|
+
const bindWorldRot = this._bindBoneWorldRotMeshLocal.get(bone);
|
|
1675
|
+
if (selfJointIdx === undefined || targetIdx === undefined || !bindWorldRot) {
|
|
1676
|
+
continue;
|
|
1677
|
+
}
|
|
1678
|
+
this._storeBindLocalTwistNormalFromPositions(bone, this._trackedBindDesiredFinalPos[selfJointIdx], this._trackedBindDesiredFinalPos[targetIdx], this._trackedBindDesiredFinalPos[twistReferences.first], this._trackedBindDesiredFinalPos[twistReferences.second], bindWorldRot);
|
|
1679
|
+
}
|
|
1565
1680
|
this._hasTrackedBind = true;
|
|
1566
1681
|
}
|
|
1567
1682
|
/**
|
|
@@ -1644,6 +1759,28 @@ export class WebXRTrackedBody {
|
|
|
1644
1759
|
}
|
|
1645
1760
|
}
|
|
1646
1761
|
}
|
|
1762
|
+
const twistReferences = this._boneTwistReferenceJointIdx.get(bone);
|
|
1763
|
+
const bindLocalTwistNormal = this._bindLocalTwistNormals.get(bone);
|
|
1764
|
+
if (twistReferences && bindLocalTwistNormal && targetIdx !== undefined) {
|
|
1765
|
+
if (this._computeNormalFromJointPositions(this._desiredFinalPositions[jointIdx], this._desiredFinalPositions[targetIdx], this._desiredFinalPositions[twistReferences.first], this._desiredFinalPositions[twistReferences.second], this._tempTwistNormal, this._tempTwistAimAxis)) {
|
|
1766
|
+
// Rotate bind-space twist normal by the current world orientation,
|
|
1767
|
+
// then rotate around the aimed axis to match the tracked hand plane.
|
|
1768
|
+
bindLocalTwistNormal.rotateByQuaternionToRef(this._tempBoneWorldRot, this._tempCurrentTwistNormal);
|
|
1769
|
+
if (this._projectOnPlaneToRef(this._tempCurrentTwistNormal, this._tempTwistAimAxis, this._tempProjectedTwistNormal) &&
|
|
1770
|
+
this._projectOnPlaneToRef(this._tempTwistNormal, this._tempTwistAimAxis, this._tempProjectedDesiredTwistNormal)) {
|
|
1771
|
+
const dot = Vector3.Dot(this._tempProjectedTwistNormal, this._tempProjectedDesiredTwistNormal);
|
|
1772
|
+
if (dot < -0.9999) {
|
|
1773
|
+
Quaternion.RotationAxisToRef(this._tempTwistAimAxis, Math.PI, this._tempRotQuat2);
|
|
1774
|
+
}
|
|
1775
|
+
else {
|
|
1776
|
+
Quaternion.FromUnitVectorsToRef(this._tempProjectedTwistNormal, this._tempProjectedDesiredTwistNormal, this._tempRotQuat2);
|
|
1777
|
+
}
|
|
1778
|
+
this._tempRotQuat2.multiplyToRef(this._tempBoneWorldRot, this._tempDeltaQuat);
|
|
1779
|
+
this._tempBoneWorldRot.copyFrom(this._tempDeltaQuat);
|
|
1780
|
+
this._tempBoneWorldRot.normalize();
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1647
1784
|
}
|
|
1648
1785
|
// Store for children's parent lookup (reuse pooled quaternion).
|
|
1649
1786
|
let pooled = this._computedBoneNewWorldRot.get(bone);
|