@onerjs/loaders 8.53.5 → 8.53.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BVH/bvhFileLoader.d.ts +4 -67
- package/BVH/bvhFileLoader.js +6 -130
- package/BVH/bvhFileLoader.js.map +1 -1
- package/BVH/bvhFileLoader.pure.d.ts +75 -0
- package/BVH/bvhFileLoader.pure.js +154 -0
- package/BVH/bvhFileLoader.pure.js.map +1 -0
- package/BVH/bvhFileLoader.types.d.ts +11 -0
- package/BVH/bvhFileLoader.types.js +2 -0
- package/BVH/bvhFileLoader.types.js.map +1 -0
- package/BVH/pure.d.ts +3 -0
- package/BVH/pure.js +5 -0
- package/BVH/pure.js.map +1 -0
- package/FBX/fbxFileLoader.d.ts +4 -192
- package/FBX/fbxFileLoader.js +6 -2437
- package/FBX/fbxFileLoader.js.map +1 -1
- package/FBX/fbxFileLoader.pure.d.ts +190 -0
- package/FBX/fbxFileLoader.pure.js +2451 -0
- package/FBX/fbxFileLoader.pure.js.map +1 -0
- package/FBX/fbxFileLoader.types.d.ts +11 -0
- package/FBX/fbxFileLoader.types.js +2 -0
- package/FBX/fbxFileLoader.types.js.map +1 -0
- package/FBX/pure.d.ts +3 -0
- package/FBX/pure.js +4 -0
- package/FBX/pure.js.map +1 -0
- package/OBJ/objFileLoader.d.ts +4 -134
- package/OBJ/objFileLoader.js +6 -315
- package/OBJ/objFileLoader.js.map +1 -1
- package/OBJ/objFileLoader.pure.d.ts +132 -0
- package/OBJ/objFileLoader.pure.js +329 -0
- package/OBJ/objFileLoader.pure.js.map +1 -0
- package/OBJ/objFileLoader.types.d.ts +11 -0
- package/OBJ/objFileLoader.types.js +2 -0
- package/OBJ/objFileLoader.types.js.map +1 -0
- package/OBJ/pure.d.ts +5 -0
- package/OBJ/pure.js +6 -0
- package/OBJ/pure.js.map +1 -0
- package/OBJ/solidParser.js +4 -3
- package/OBJ/solidParser.js.map +1 -1
- package/SPLAT/gaussianSplattingBlockAllocator.d.ts +137 -0
- package/SPLAT/gaussianSplattingBlockAllocator.js +555 -0
- package/SPLAT/gaussianSplattingBlockAllocator.js.map +1 -0
- package/SPLAT/gaussianSplattingDownloadManager.d.ts +109 -0
- package/SPLAT/gaussianSplattingDownloadManager.js +241 -0
- package/SPLAT/gaussianSplattingDownloadManager.js.map +1 -0
- package/SPLAT/gaussianSplattingResidencyController.d.ts +133 -0
- package/SPLAT/gaussianSplattingResidencyController.js +222 -0
- package/SPLAT/gaussianSplattingResidencyController.js.map +1 -0
- package/SPLAT/gaussianSplattingStream.d.ts +522 -0
- package/SPLAT/gaussianSplattingStream.js +1530 -0
- package/SPLAT/gaussianSplattingStream.js.map +1 -0
- package/SPLAT/gaussianSplattingWorkBuffer.d.ts +107 -0
- package/SPLAT/gaussianSplattingWorkBuffer.js +361 -0
- package/SPLAT/gaussianSplattingWorkBuffer.js.map +1 -0
- package/SPLAT/gaussianSplattingWorkBufferShaders.d.ts +40 -0
- package/SPLAT/gaussianSplattingWorkBufferShaders.js +337 -0
- package/SPLAT/gaussianSplattingWorkBufferShaders.js.map +1 -0
- package/SPLAT/index.d.ts +1 -0
- package/SPLAT/index.js +1 -0
- package/SPLAT/index.js.map +1 -1
- package/SPLAT/pure.d.ts +5 -0
- package/SPLAT/pure.js +7 -0
- package/SPLAT/pure.js.map +1 -0
- package/SPLAT/sog.d.ts +2 -93
- package/SPLAT/sog.js +4 -418
- package/SPLAT/sog.js.map +1 -1
- package/SPLAT/sog.pure.d.ts +102 -0
- package/SPLAT/sog.pure.js +514 -0
- package/SPLAT/sog.pure.js.map +1 -0
- package/SPLAT/splatFileLoader.d.ts +5 -98
- package/SPLAT/splatFileLoader.js +9 -587
- package/SPLAT/splatFileLoader.js.map +1 -1
- package/SPLAT/splatFileLoader.pure.d.ts +104 -0
- package/SPLAT/splatFileLoader.pure.js +650 -0
- package/SPLAT/splatFileLoader.pure.js.map +1 -0
- package/SPLAT/splatFileLoader.types.d.ts +11 -0
- package/SPLAT/splatFileLoader.types.js +2 -0
- package/SPLAT/splatFileLoader.types.js.map +1 -0
- package/STL/pure.d.ts +2 -0
- package/STL/pure.js +3 -0
- package/STL/pure.js.map +1 -0
- package/STL/stlFileLoader.d.ts +5 -76
- package/STL/stlFileLoader.js +7 -236
- package/STL/stlFileLoader.js.map +1 -1
- package/STL/stlFileLoader.pure.d.ts +73 -0
- package/STL/stlFileLoader.pure.js +249 -0
- package/STL/stlFileLoader.pure.js.map +1 -0
- package/STL/stlFileLoader.types.d.ts +10 -0
- package/STL/stlFileLoader.types.js +2 -0
- package/STL/stlFileLoader.types.js.map +1 -0
- package/glTF/1.0/pure.d.ts +3 -0
- package/glTF/1.0/pure.js +4 -0
- package/glTF/1.0/pure.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_lights_area.d.ts +4 -39
- package/glTF/2.0/Extensions/EXT_lights_area.js +6 -91
- package/glTF/2.0/Extensions/EXT_lights_area.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_area.pure.d.ts +38 -0
- package/glTF/2.0/Extensions/EXT_lights_area.pure.js +106 -0
- package/glTF/2.0/Extensions/EXT_lights_area.pure.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_lights_area.types.d.ts +9 -0
- package/glTF/2.0/Extensions/EXT_lights_area.types.js +2 -0
- package/glTF/2.0/Extensions/EXT_lights_area.types.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_lights_ies.d.ts +4 -39
- package/glTF/2.0/Extensions/EXT_lights_ies.js +6 -81
- package/glTF/2.0/Extensions/EXT_lights_ies.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_ies.pure.d.ts +38 -0
- package/glTF/2.0/Extensions/EXT_lights_ies.pure.js +96 -0
- package/glTF/2.0/Extensions/EXT_lights_ies.pure.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_lights_ies.types.d.ts +9 -0
- package/glTF/2.0/Extensions/EXT_lights_ies.types.js +2 -0
- package/glTF/2.0/Extensions/EXT_lights_ies.types.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +4 -46
- package/glTF/2.0/Extensions/EXT_lights_image_based.js +6 -113
- package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_lights_image_based.pure.d.ts +37 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.pure.js +128 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.pure.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.types.d.ts +17 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.types.js +2 -0
- package/glTF/2.0/Extensions/EXT_lights_image_based.types.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +5 -37
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +7 -92
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.pure.d.ts +35 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.pure.js +106 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.pure.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.types.d.ts +9 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.types.js +2 -0
- package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.types.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +4 -37
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js +6 -48
- package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_meshopt_compression.pure.d.ts +36 -0
- package/glTF/2.0/Extensions/EXT_meshopt_compression.pure.js +63 -0
- package/glTF/2.0/Extensions/EXT_meshopt_compression.pure.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_meshopt_compression.types.d.ts +9 -0
- package/glTF/2.0/Extensions/EXT_meshopt_compression.types.js +2 -0
- package/glTF/2.0/Extensions/EXT_meshopt_compression.types.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_texture_avif.d.ts +4 -32
- package/glTF/2.0/Extensions/EXT_texture_avif.js +6 -36
- package/glTF/2.0/Extensions/EXT_texture_avif.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_avif.pure.d.ts +31 -0
- package/glTF/2.0/Extensions/EXT_texture_avif.pure.js +51 -0
- package/glTF/2.0/Extensions/EXT_texture_avif.pure.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_texture_avif.types.d.ts +9 -0
- package/glTF/2.0/Extensions/EXT_texture_avif.types.js +2 -0
- package/glTF/2.0/Extensions/EXT_texture_avif.types.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +4 -31
- package/glTF/2.0/Extensions/EXT_texture_webp.js +6 -35
- package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.pure.d.ts +30 -0
- package/glTF/2.0/Extensions/EXT_texture_webp.pure.js +50 -0
- package/glTF/2.0/Extensions/EXT_texture_webp.pure.js.map +1 -0
- package/glTF/2.0/Extensions/EXT_texture_webp.types.d.ts +9 -0
- package/glTF/2.0/Extensions/EXT_texture_webp.types.js +2 -0
- package/glTF/2.0/Extensions/EXT_texture_webp.types.js.map +1 -0
- package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +4 -51
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js +6 -71
- package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -1
- package/glTF/2.0/Extensions/ExtrasAsMetadata.pure.d.ts +50 -0
- package/glTF/2.0/Extensions/ExtrasAsMetadata.pure.js +85 -0
- package/glTF/2.0/Extensions/ExtrasAsMetadata.pure.js.map +1 -0
- package/glTF/2.0/Extensions/ExtrasAsMetadata.types.d.ts +9 -0
- package/glTF/2.0/Extensions/ExtrasAsMetadata.types.js +2 -0
- package/glTF/2.0/Extensions/ExtrasAsMetadata.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.d.ts +5 -45
- package/glTF/2.0/Extensions/KHR_animation_pointer.js +7 -75
- package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_animation_pointer.pure.d.ts +43 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.pure.js +89 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_animation_pointer.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +4 -45
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +6 -90
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.pure.d.ts +44 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.pure.js +105 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_draco_mesh_compression.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_gaussian_splatting.d.ts +6 -0
- package/glTF/2.0/Extensions/KHR_gaussian_splatting.js +9 -0
- package/glTF/2.0/Extensions/KHR_gaussian_splatting.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_gaussian_splatting.pure.d.ts +35 -0
- package/glTF/2.0/Extensions/KHR_gaussian_splatting.pure.js +195 -0
- package/glTF/2.0/Extensions/KHR_gaussian_splatting.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_gaussian_splatting.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_gaussian_splatting.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_gaussian_splatting.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.d.ts +4 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.js +5 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity.d.ts +4 -36
- package/glTF/2.0/Extensions/KHR_interactivity.js +6 -148
- package/glTF/2.0/Extensions/KHR_interactivity.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.pure.d.ts +35 -0
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js +163 -0
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_interactivity.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_interactivity.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +4 -39
- package/glTF/2.0/Extensions/KHR_lights_punctual.js +6 -89
- package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_lights_punctual.pure.d.ts +38 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.pure.js +104 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_lights_punctual.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +4 -40
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +6 -63
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.pure.d.ts +39 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.pure.js +78 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_anisotropy.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +4 -41
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +6 -77
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.pure.d.ts +40 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.pure.js +92 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_clearcoat.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_coat.d.ts +4 -47
- package/glTF/2.0/Extensions/KHR_materials_coat.js +6 -117
- package/glTF/2.0/Extensions/KHR_materials_coat.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_coat.pure.d.ts +46 -0
- package/glTF/2.0/Extensions/KHR_materials_coat.pure.js +132 -0
- package/glTF/2.0/Extensions/KHR_materials_coat.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_coat.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_coat.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_coat.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.d.ts +4 -41
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.js +6 -56
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.pure.d.ts +40 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.pure.js +71 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_roughness.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.d.ts +4 -41
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +6 -71
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.pure.d.ts +40 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.pure.js +86 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.d.ts +4 -41
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js +6 -54
- package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_dispersion.pure.d.ts +40 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.pure.js +69 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_dispersion.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +4 -40
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +6 -45
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.pure.d.ts +39 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.pure.js +60 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_emissive_strength.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_fuzz.d.ts +4 -41
- package/glTF/2.0/Extensions/KHR_materials_fuzz.js +6 -75
- package/glTF/2.0/Extensions/KHR_materials_fuzz.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_fuzz.pure.d.ts +40 -0
- package/glTF/2.0/Extensions/KHR_materials_fuzz.pure.js +90 -0
- package/glTF/2.0/Extensions/KHR_materials_fuzz.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_fuzz.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_fuzz.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_fuzz.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +4 -44
- package/glTF/2.0/Extensions/KHR_materials_ior.js +6 -52
- package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_ior.pure.d.ts +43 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.pure.js +67 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_ior.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.d.ts +4 -40
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js +6 -66
- package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_iridescence.pure.d.ts +39 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.pure.js +81 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_iridescence.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +4 -40
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +6 -72
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.pure.d.ts +39 -0
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.pure.js +87 -0
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +4 -41
- package/glTF/2.0/Extensions/KHR_materials_sheen.js +6 -71
- package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_sheen.pure.d.ts +40 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.pure.js +86 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_sheen.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +4 -40
- package/glTF/2.0/Extensions/KHR_materials_specular.js +6 -74
- package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_specular.pure.d.ts +39 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.pure.js +89 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_specular.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +4 -40
- package/glTF/2.0/Extensions/KHR_materials_transmission.js +6 -70
- package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_transmission.pure.d.ts +39 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.pure.js +85 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_transmission.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +4 -40
- package/glTF/2.0/Extensions/KHR_materials_unlit.js +6 -64
- package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_unlit.pure.d.ts +39 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.pure.js +79 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_unlit.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +4 -110
- package/glTF/2.0/Extensions/KHR_materials_variants.js +6 -260
- package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_variants.pure.d.ts +97 -0
- package/glTF/2.0/Extensions/KHR_materials_variants.pure.js +275 -0
- package/glTF/2.0/Extensions/KHR_materials_variants.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_variants.types.d.ts +29 -0
- package/glTF/2.0/Extensions/KHR_materials_variants.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_variants.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +4 -41
- package/glTF/2.0/Extensions/KHR_materials_volume.js +6 -77
- package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume.pure.d.ts +40 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.pure.js +92 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_volume.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_volume_scatter.d.ts +4 -43
- package/glTF/2.0/Extensions/KHR_materials_volume_scatter.js +6 -113
- package/glTF/2.0/Extensions/KHR_materials_volume_scatter.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_materials_volume_scatter.pure.d.ts +42 -0
- package/glTF/2.0/Extensions/KHR_materials_volume_scatter.pure.js +128 -0
- package/glTF/2.0/Extensions/KHR_materials_volume_scatter.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_materials_volume_scatter.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_materials_volume_scatter.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_materials_volume_scatter.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +4 -27
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js +6 -20
- package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_mesh_quantization.pure.d.ts +26 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.pure.js +35 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_mesh_quantization.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.d.ts +4 -29
- package/glTF/2.0/Extensions/KHR_node_hoverability.js +6 -187
- package/glTF/2.0/Extensions/KHR_node_hoverability.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.d.ts +28 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js +202 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.d.ts +4 -28
- package/glTF/2.0/Extensions/KHR_node_selectability.js +6 -121
- package/glTF/2.0/Extensions/KHR_node_selectability.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.d.ts +27 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js +136 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.d.ts +4 -28
- package/glTF/2.0/Extensions/KHR_node_visibility.js +6 -64
- package/glTF/2.0/Extensions/KHR_node_visibility.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.d.ts +27 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.js +79 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +4 -31
- package/glTF/2.0/Extensions/KHR_texture_basisu.js +6 -35
- package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.pure.d.ts +30 -0
- package/glTF/2.0/Extensions/KHR_texture_basisu.pure.js +50 -0
- package/glTF/2.0/Extensions/KHR_texture_basisu.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_texture_basisu.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_texture_basisu.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_texture_basisu.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +4 -35
- package/glTF/2.0/Extensions/KHR_texture_transform.js +6 -56
- package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_transform.pure.d.ts +34 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.pure.js +71 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_texture_transform.types.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +4 -37
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +6 -45
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.pure.d.ts +36 -0
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.pure.js +60 -0
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.pure.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.types.d.ts +9 -0
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.types.js +2 -0
- package/glTF/2.0/Extensions/KHR_xmp_json_ld.types.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +5 -54
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js +7 -226
- package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_audio_emitter.pure.d.ts +52 -0
- package/glTF/2.0/Extensions/MSFT_audio_emitter.pure.js +240 -0
- package/glTF/2.0/Extensions/MSFT_audio_emitter.pure.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_audio_emitter.types.d.ts +9 -0
- package/glTF/2.0/Extensions/MSFT_audio_emitter.types.js +2 -0
- package/glTF/2.0/Extensions/MSFT_audio_emitter.types.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_lod.d.ts +4 -102
- package/glTF/2.0/Extensions/MSFT_lod.js +6 -335
- package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_lod.pure.d.ts +96 -0
- package/glTF/2.0/Extensions/MSFT_lod.pure.js +350 -0
- package/glTF/2.0/Extensions/MSFT_lod.pure.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_lod.types.d.ts +14 -0
- package/glTF/2.0/Extensions/MSFT_lod.types.js +2 -0
- package/glTF/2.0/Extensions/MSFT_lod.types.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +6 -27
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +8 -40
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.pure.d.ts +24 -0
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.pure.js +53 -0
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.pure.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.types.d.ts +9 -0
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.types.js +2 -0
- package/glTF/2.0/Extensions/MSFT_minecraftMesh.types.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +6 -27
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +8 -38
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -1
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.pure.d.ts +24 -0
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.pure.js +51 -0
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.pure.js.map +1 -0
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.types.d.ts +9 -0
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.types.js +2 -0
- package/glTF/2.0/Extensions/MSFT_sRGBFactors.types.js.map +1 -0
- package/glTF/2.0/Extensions/dynamic.js +5 -0
- package/glTF/2.0/Extensions/dynamic.js.map +1 -1
- package/glTF/2.0/Extensions/index.d.ts +1 -0
- package/glTF/2.0/Extensions/index.js +1 -0
- package/glTF/2.0/Extensions/index.js.map +1 -1
- package/glTF/2.0/Extensions/objectModelMapping.d.ts +31 -2
- package/glTF/2.0/Extensions/objectModelMapping.js +3 -3
- package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -1
- package/glTF/2.0/Extensions/pure.d.ts +46 -0
- package/glTF/2.0/Extensions/pure.js +48 -0
- package/glTF/2.0/Extensions/pure.js.map +1 -0
- package/glTF/2.0/glTFLoader.d.ts +1 -471
- package/glTF/2.0/glTFLoader.js +9 -2570
- package/glTF/2.0/glTFLoader.js.map +1 -1
- package/glTF/2.0/glTFLoader.pure.d.ts +476 -0
- package/glTF/2.0/glTFLoader.pure.js +2606 -0
- package/glTF/2.0/glTFLoader.pure.js.map +1 -0
- package/glTF/2.0/glTFLoaderAnimation.d.ts +2 -2
- package/glTF/2.0/glTFLoaderAnimation.js +2 -2
- package/glTF/2.0/glTFLoaderAnimation.js.map +1 -1
- package/glTF/2.0/pbrMaterialLoadingAdapter.d.ts +1 -1
- package/glTF/2.0/pbrMaterialLoadingAdapter.js +2 -2
- package/glTF/2.0/pbrMaterialLoadingAdapter.js.map +1 -1
- package/glTF/2.0/pure.d.ts +8 -0
- package/glTF/2.0/pure.js +10 -0
- package/glTF/2.0/pure.js.map +1 -0
- package/glTF/glTFFileLoader.d.ts +5 -571
- package/glTF/glTFFileLoader.js +6 -1016
- package/glTF/glTFFileLoader.js.map +1 -1
- package/glTF/glTFFileLoader.pure.d.ts +582 -0
- package/glTF/glTFFileLoader.pure.js +1044 -0
- package/glTF/glTFFileLoader.pure.js.map +1 -0
- package/glTF/glTFFileLoader.types.d.ts +11 -0
- package/glTF/glTFFileLoader.types.js +2 -0
- package/glTF/glTFFileLoader.types.js.map +1 -0
- package/glTF/glTFValidation.js +1 -1
- package/glTF/glTFValidation.js.map +1 -1
- package/glTF/pure.d.ts +6 -0
- package/glTF/pure.js +8 -0
- package/glTF/pure.js.map +1 -0
- package/package.json +3 -3
- package/pure.d.ts +8 -0
- package/pure.js +10 -0
- package/pure.js.map +1 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { GaussianSplattingMesh } from "@onerjs/core/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js";
|
|
2
|
+
import { AllocateShBuffers } from "@onerjs/core/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js";
|
|
3
|
+
import { GLTFLoader, ArrayItem } from "../glTFLoader.pure.js";
|
|
4
|
+
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
|
5
|
+
const NAME = "KHR_gaussian_splatting";
|
|
6
|
+
// Zeroth-order spherical harmonics coefficient used to reconstruct a base color from the SH DC term.
|
|
7
|
+
const ShC0 = 0.28209479177387814;
|
|
8
|
+
// Attribute semantics defined by the KHR_gaussian_splatting ellipse kernel.
|
|
9
|
+
const RotationAttribute = "KHR_gaussian_splatting:ROTATION";
|
|
10
|
+
const ScaleAttribute = "KHR_gaussian_splatting:SCALE";
|
|
11
|
+
const OpacityAttribute = "KHR_gaussian_splatting:OPACITY";
|
|
12
|
+
const ShDegree0Attribute = "KHR_gaussian_splatting:SH_DEGREE_0_COEF_0";
|
|
13
|
+
// Number of spherical harmonics coefficients (VEC3) for each degree beyond the DC term.
|
|
14
|
+
const ShCoefficientCountPerDegree = [0, 3, 5, 7];
|
|
15
|
+
function Clamp255(value) {
|
|
16
|
+
return value <= 0 ? 0 : value >= 255 ? 255 : (value + 0.5) | 0;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_gaussian_splatting/README.md)
|
|
20
|
+
* Loads a mesh primitive tagged with KHR_gaussian_splatting as a {@link GaussianSplattingMesh}.
|
|
21
|
+
*/
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
23
|
+
export class KHR_gaussian_splatting {
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
constructor(loader) {
|
|
28
|
+
/**
|
|
29
|
+
* The name of this extension.
|
|
30
|
+
*/
|
|
31
|
+
this.name = NAME;
|
|
32
|
+
this._loader = loader;
|
|
33
|
+
this.enabled = this._loader.isExtensionUsed(NAME);
|
|
34
|
+
}
|
|
35
|
+
/** @internal */
|
|
36
|
+
dispose() {
|
|
37
|
+
this._loader = null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
43
|
+
_loadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign) {
|
|
44
|
+
return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, async (extensionContext) => {
|
|
45
|
+
if (primitive.mode != undefined && primitive.mode !== 0 /* MeshPrimitiveMode.POINTS */) {
|
|
46
|
+
throw new Error(`${extensionContext}: Gaussian splatting primitives must use POINTS mode`);
|
|
47
|
+
}
|
|
48
|
+
const loader = this._loader;
|
|
49
|
+
const loadAttribute = (attributeName) => {
|
|
50
|
+
const accessorIndex = primitive.attributes[attributeName];
|
|
51
|
+
if (accessorIndex == undefined) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const accessor = ArrayItem.Get(`${context}/attributes/${attributeName}`, loader.gltf.accessors, accessorIndex);
|
|
55
|
+
return loader._loadFloatAccessorAsync(`/accessors/${accessor.index}`, accessor);
|
|
56
|
+
};
|
|
57
|
+
const positionsPromise = loadAttribute("POSITION");
|
|
58
|
+
if (!positionsPromise) {
|
|
59
|
+
throw new Error(`${extensionContext}: Gaussian splatting primitive is missing the POSITION attribute`);
|
|
60
|
+
}
|
|
61
|
+
// Determine which spherical harmonics degrees are present (all lower degrees must exist per spec).
|
|
62
|
+
let shDegree = 0;
|
|
63
|
+
const shAttributeNames = [];
|
|
64
|
+
for (let degree = 1; degree <= 3; degree++) {
|
|
65
|
+
if (primitive.attributes[`KHR_gaussian_splatting:SH_DEGREE_${degree}_COEF_0`] == undefined) {
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
shDegree = degree;
|
|
69
|
+
for (let coef = 0; coef < ShCoefficientCountPerDegree[degree]; coef++) {
|
|
70
|
+
shAttributeNames.push(`KHR_gaussian_splatting:SH_DEGREE_${degree}_COEF_${coef}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Create the Gaussian Splatting mesh and assign it to the node synchronously (before awaiting the
|
|
74
|
+
// attribute data). The base loader wires the node's transform node from this assign call
|
|
75
|
+
// synchronously, so it must happen before the first await. The splat data is uploaded afterwards.
|
|
76
|
+
const scene = loader.babylonScene;
|
|
77
|
+
scene._blockEntityCollection = !!loader._assetContainer;
|
|
78
|
+
const gaussianSplattingMesh = new GaussianSplattingMesh(name, null, scene);
|
|
79
|
+
gaussianSplattingMesh._parentContainer = loader._assetContainer;
|
|
80
|
+
scene._blockEntityCollection = false;
|
|
81
|
+
GLTFLoader.AddPointerMetadata(gaussianSplattingMesh, context);
|
|
82
|
+
loader.parent.onMeshLoadedObservable.notifyObservers(gaussianSplattingMesh);
|
|
83
|
+
assign(gaussianSplattingMesh);
|
|
84
|
+
const engineCaps = scene.getEngine().getCaps();
|
|
85
|
+
const [positions, rotations, scales, opacities, shDegree0, colors, ...shHigherDegrees] = await Promise.all([
|
|
86
|
+
positionsPromise,
|
|
87
|
+
loadAttribute(RotationAttribute),
|
|
88
|
+
loadAttribute(ScaleAttribute),
|
|
89
|
+
loadAttribute(OpacityAttribute),
|
|
90
|
+
loadAttribute(ShDegree0Attribute),
|
|
91
|
+
loadAttribute("COLOR_0"),
|
|
92
|
+
...shAttributeNames.map((attributeName) => loadAttribute(attributeName)),
|
|
93
|
+
]);
|
|
94
|
+
const splatCount = positions.length / 3;
|
|
95
|
+
const colorStride = colors ? colors.length / splatCount : 0;
|
|
96
|
+
const rowOutputLength = 3 * 4 + 3 * 4 + 4 + 4; // 32 bytes: position(12) scale(12) color RGBA(4) quaternion wxyz(4)
|
|
97
|
+
const buffer = new ArrayBuffer(rowOutputLength * splatCount);
|
|
98
|
+
const floatView = new Float32Array(buffer);
|
|
99
|
+
const byteView = new Uint8Array(buffer);
|
|
100
|
+
// Build spherical harmonics texture buffers for degrees above 0.
|
|
101
|
+
let shBuffers = null;
|
|
102
|
+
if (shDegree > 0) {
|
|
103
|
+
const shVectorCount = (shDegree + 1) * (shDegree + 1) - 1;
|
|
104
|
+
const shComponentCount = shVectorCount * 3;
|
|
105
|
+
const textureCount = Math.ceil(shComponentCount / 16);
|
|
106
|
+
const width = engineCaps.maxTextureSize;
|
|
107
|
+
const height = Math.ceil(splatCount / width);
|
|
108
|
+
shBuffers = AllocateShBuffers(textureCount, height * width * 4 * 4);
|
|
109
|
+
}
|
|
110
|
+
for (let i = 0; i < splatCount; i++) {
|
|
111
|
+
const floatBase = i * 8;
|
|
112
|
+
const byteBase = i * 32;
|
|
113
|
+
const p = i * 3;
|
|
114
|
+
// Position (float32 x3, bytes 0-11)
|
|
115
|
+
floatView[floatBase + 0] = positions[p + 0];
|
|
116
|
+
floatView[floatBase + 1] = positions[p + 1];
|
|
117
|
+
floatView[floatBase + 2] = positions[p + 2];
|
|
118
|
+
// Scale (float32 x3, bytes 12-23) — glTF stores linear scale directly.
|
|
119
|
+
floatView[floatBase + 3] = scales ? scales[p + 0] : 1;
|
|
120
|
+
floatView[floatBase + 4] = scales ? scales[p + 1] : 1;
|
|
121
|
+
floatView[floatBase + 5] = scales ? scales[p + 2] : 1;
|
|
122
|
+
// Color RGB (uint8 x3, bytes 24-26) — reconstructed from the SH DC term, or COLOR_0 as a fallback.
|
|
123
|
+
if (shDegree0) {
|
|
124
|
+
byteView[byteBase + 24] = Clamp255((0.5 + ShC0 * shDegree0[p + 0]) * 255);
|
|
125
|
+
byteView[byteBase + 25] = Clamp255((0.5 + ShC0 * shDegree0[p + 1]) * 255);
|
|
126
|
+
byteView[byteBase + 26] = Clamp255((0.5 + ShC0 * shDegree0[p + 2]) * 255);
|
|
127
|
+
}
|
|
128
|
+
else if (colors) {
|
|
129
|
+
const c = i * colorStride;
|
|
130
|
+
byteView[byteBase + 24] = Clamp255(colors[c + 0] * 255);
|
|
131
|
+
byteView[byteBase + 25] = Clamp255(colors[c + 1] * 255);
|
|
132
|
+
byteView[byteBase + 26] = Clamp255(colors[c + 2] * 255);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
byteView[byteBase + 24] = 255;
|
|
136
|
+
byteView[byteBase + 25] = 255;
|
|
137
|
+
byteView[byteBase + 26] = 255;
|
|
138
|
+
}
|
|
139
|
+
// Alpha (uint8, byte 27) — opacity is a normalized linear value per spec.
|
|
140
|
+
if (opacities) {
|
|
141
|
+
byteView[byteBase + 27] = Clamp255(opacities[i] * 255);
|
|
142
|
+
}
|
|
143
|
+
else if (colors && colorStride >= 4) {
|
|
144
|
+
byteView[byteBase + 27] = Clamp255(colors[i * colorStride + 3] * 255);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
byteView[byteBase + 27] = 255;
|
|
148
|
+
}
|
|
149
|
+
// Quaternion (uint8 x4, bytes 28-31) stored as wxyz encoded as q * 127.5 + 127.5. glTF stores xyzw.
|
|
150
|
+
const r = i * 4;
|
|
151
|
+
const qx = rotations ? rotations[r + 0] : 0;
|
|
152
|
+
const qy = rotations ? rotations[r + 1] : 0;
|
|
153
|
+
const qz = rotations ? rotations[r + 2] : 0;
|
|
154
|
+
const qw = rotations ? rotations[r + 3] : 1;
|
|
155
|
+
byteView[byteBase + 28] = Clamp255(qw * 127.5 + 127.5);
|
|
156
|
+
byteView[byteBase + 29] = Clamp255(qx * 127.5 + 127.5);
|
|
157
|
+
byteView[byteBase + 30] = Clamp255(qy * 127.5 + 127.5);
|
|
158
|
+
byteView[byteBase + 31] = Clamp255(qz * 127.5 + 127.5);
|
|
159
|
+
// Spherical harmonics (coefficient-major, channel-minor) encoded as coeff * 128 + 128.
|
|
160
|
+
if (shBuffers) {
|
|
161
|
+
const offsetPerSplat = i * 16;
|
|
162
|
+
for (let coef = 0; coef < shHigherDegrees.length; coef++) {
|
|
163
|
+
const coefData = shHigherDegrees[coef];
|
|
164
|
+
if (!coefData) {
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
for (let channel = 0; channel < 3; channel++) {
|
|
168
|
+
const flatIndex = coef * 3 + channel;
|
|
169
|
+
const textureIndex = flatIndex >> 4; // Math.floor(flatIndex / 16)
|
|
170
|
+
const byteIndexInTexture = flatIndex & 15; // flatIndex % 16
|
|
171
|
+
shBuffers[textureIndex][offsetPerSplat + byteIndexInTexture] = Clamp255(coefData[p + channel] * 128 + 128);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
await gaussianSplattingMesh.updateDataAsync(buffer, shBuffers ?? undefined, undefined, shDegree || undefined);
|
|
177
|
+
return gaussianSplattingMesh;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
let _Registered = false;
|
|
182
|
+
/**
|
|
183
|
+
* Registers the KHR_gaussian_splatting glTF loader extension.
|
|
184
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
185
|
+
*/
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
187
|
+
export function RegisterKHR_gaussian_splatting() {
|
|
188
|
+
if (_Registered) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
_Registered = true;
|
|
192
|
+
unregisterGLTFExtension(NAME);
|
|
193
|
+
registerGLTFExtension(NAME, true, (loader) => new KHR_gaussian_splatting(loader));
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=KHR_gaussian_splatting.pure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KHR_gaussian_splatting.pure.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_gaussian_splatting.pure.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,8DAA8D,CAAC;AAKjG,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,wBAAwB,CAAC;AAEtC,qGAAqG;AACrG,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC,4EAA4E;AAC5E,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAC5D,MAAM,cAAc,GAAG,8BAA8B,CAAC;AACtD,MAAM,gBAAg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I,CAAC,CAAC,CAAC,6BAA6B;4BAClE,MAAM,kBAAkB,GAAG,SAAS,GAAG,EAAE,CAAC,CAAC,iBAAiB;4BAC5D,SAAS,CAAC,YAAY,CAAC,CAAC,cAAc,GAAG,kBAAkB,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;wBAC/G,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;YAED,MAAM,qBAAqB,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,IAAI,SAAS,EAAE,SAAS,EAAE,QAAQ,IAAI,SAAS,CAAC,CAAC;YAE9G,OAAO,qBAAqB,CAAC;QACjC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,gEAAgE;AAChE,MAAM,UAAU,8BAA8B;IAC1C,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAE9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC;AACtF,CAAC","sourcesContent":["import { type Nullable } from \"core/types\";\r\nimport { type AbstractMesh } from \"core/Meshes/abstractMesh.pure\";\r\nimport { GaussianSplattingMesh } from \"core/Meshes/GaussianSplatting/gaussianSplattingMesh.pure\";\r\nimport { AllocateShBuffers } from \"core/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure\";\r\n\r\nimport { MeshPrimitiveMode, type IKHRGaussianSplatting } from \"babylonjs-gltf2interface\";\r\nimport { type IMeshPrimitive, type INode, type IMesh, type IAccessor } from \"../glTFLoaderInterfaces\";\r\nimport { type IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader.pure\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_gaussian_splatting\";\r\n\r\n// Zeroth-order spherical harmonics coefficient used to reconstruct a base color from the SH DC term.\r\nconst ShC0 = 0.28209479177387814;\r\n\r\n// Attribute semantics defined by the KHR_gaussian_splatting ellipse kernel.\r\nconst RotationAttribute = \"KHR_gaussian_splatting:ROTATION\";\r\nconst ScaleAttribute = \"KHR_gaussian_splatting:SCALE\";\r\nconst OpacityAttribute = \"KHR_gaussian_splatting:OPACITY\";\r\nconst ShDegree0Attribute = \"KHR_gaussian_splatting:SH_DEGREE_0_COEF_0\";\r\n\r\n// Number of spherical harmonics coefficients (VEC3) for each degree beyond the DC term.\r\nconst ShCoefficientCountPerDegree = [0, 3, 5, 7];\r\n\r\nfunction Clamp255(value: number): number {\r\n return value <= 0 ? 0 : value >= 255 ? 255 : (value + 0.5) | 0;\r\n}\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_gaussian_splatting/README.md)\r\n * Loads a mesh primitive tagged with KHR_gaussian_splatting as a {@link GaussianSplattingMesh}.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_gaussian_splatting implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose(): void {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line no-restricted-syntax\r\n public _loadMeshPrimitiveAsync(\r\n context: string,\r\n name: string,\r\n node: INode,\r\n mesh: IMesh,\r\n primitive: IMeshPrimitive,\r\n assign: (babylonMesh: AbstractMesh) => void\r\n ): Nullable<Promise<AbstractMesh>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRGaussianSplatting, AbstractMesh>(context, primitive, this.name, async (extensionContext) => {\r\n if (primitive.mode != undefined && primitive.mode !== MeshPrimitiveMode.POINTS) {\r\n throw new Error(`${extensionContext}: Gaussian splatting primitives must use POINTS mode`);\r\n }\r\n\r\n const loader = this._loader;\r\n\r\n const loadAttribute = (attributeName: string): Nullable<Promise<Float32Array>> => {\r\n const accessorIndex = primitive.attributes[attributeName];\r\n if (accessorIndex == undefined) {\r\n return null;\r\n }\r\n const accessor = ArrayItem.Get(`${context}/attributes/${attributeName}`, loader.gltf.accessors, accessorIndex) as IAccessor;\r\n return loader._loadFloatAccessorAsync(`/accessors/${accessor.index}`, accessor);\r\n };\r\n\r\n const positionsPromise = loadAttribute(\"POSITION\");\r\n if (!positionsPromise) {\r\n throw new Error(`${extensionContext}: Gaussian splatting primitive is missing the POSITION attribute`);\r\n }\r\n\r\n // Determine which spherical harmonics degrees are present (all lower degrees must exist per spec).\r\n let shDegree = 0;\r\n const shAttributeNames: string[] = [];\r\n for (let degree = 1; degree <= 3; degree++) {\r\n if (primitive.attributes[`KHR_gaussian_splatting:SH_DEGREE_${degree}_COEF_0`] == undefined) {\r\n break;\r\n }\r\n shDegree = degree;\r\n for (let coef = 0; coef < ShCoefficientCountPerDegree[degree]; coef++) {\r\n shAttributeNames.push(`KHR_gaussian_splatting:SH_DEGREE_${degree}_COEF_${coef}`);\r\n }\r\n }\r\n\r\n // Create the Gaussian Splatting mesh and assign it to the node synchronously (before awaiting the\r\n // attribute data). The base loader wires the node's transform node from this assign call\r\n // synchronously, so it must happen before the first await. The splat data is uploaded afterwards.\r\n const scene = loader.babylonScene;\r\n scene._blockEntityCollection = !!loader._assetContainer;\r\n const gaussianSplattingMesh = new GaussianSplattingMesh(name, null, scene);\r\n gaussianSplattingMesh._parentContainer = loader._assetContainer;\r\n scene._blockEntityCollection = false;\r\n\r\n GLTFLoader.AddPointerMetadata(gaussianSplattingMesh, context);\r\n loader.parent.onMeshLoadedObservable.notifyObservers(gaussianSplattingMesh);\r\n assign(gaussianSplattingMesh);\r\n\r\n const engineCaps = scene.getEngine().getCaps();\r\n\r\n const [positions, rotations, scales, opacities, shDegree0, colors, ...shHigherDegrees] = await Promise.all([\r\n positionsPromise,\r\n loadAttribute(RotationAttribute),\r\n loadAttribute(ScaleAttribute),\r\n loadAttribute(OpacityAttribute),\r\n loadAttribute(ShDegree0Attribute),\r\n loadAttribute(\"COLOR_0\"),\r\n ...shAttributeNames.map((attributeName): Nullable<Promise<Float32Array>> => loadAttribute(attributeName)),\r\n ]);\r\n\r\n const splatCount = positions.length / 3;\r\n const colorStride = colors ? colors.length / splatCount : 0;\r\n\r\n const rowOutputLength = 3 * 4 + 3 * 4 + 4 + 4; // 32 bytes: position(12) scale(12) color RGBA(4) quaternion wxyz(4)\r\n const buffer = new ArrayBuffer(rowOutputLength * splatCount);\r\n const floatView = new Float32Array(buffer);\r\n const byteView = new Uint8Array(buffer);\r\n\r\n // Build spherical harmonics texture buffers for degrees above 0.\r\n let shBuffers: Nullable<Uint8Array[]> = null;\r\n if (shDegree > 0) {\r\n const shVectorCount = (shDegree + 1) * (shDegree + 1) - 1;\r\n const shComponentCount = shVectorCount * 3;\r\n const textureCount = Math.ceil(shComponentCount / 16);\r\n const width = engineCaps.maxTextureSize;\r\n const height = Math.ceil(splatCount / width);\r\n shBuffers = AllocateShBuffers(textureCount, height * width * 4 * 4);\r\n }\r\n\r\n for (let i = 0; i < splatCount; i++) {\r\n const floatBase = i * 8;\r\n const byteBase = i * 32;\r\n const p = i * 3;\r\n\r\n // Position (float32 x3, bytes 0-11)\r\n floatView[floatBase + 0] = positions[p + 0];\r\n floatView[floatBase + 1] = positions[p + 1];\r\n floatView[floatBase + 2] = positions[p + 2];\r\n\r\n // Scale (float32 x3, bytes 12-23) — glTF stores linear scale directly.\r\n floatView[floatBase + 3] = scales ? scales[p + 0] : 1;\r\n floatView[floatBase + 4] = scales ? scales[p + 1] : 1;\r\n floatView[floatBase + 5] = scales ? scales[p + 2] : 1;\r\n\r\n // Color RGB (uint8 x3, bytes 24-26) — reconstructed from the SH DC term, or COLOR_0 as a fallback.\r\n if (shDegree0) {\r\n byteView[byteBase + 24] = Clamp255((0.5 + ShC0 * shDegree0[p + 0]) * 255);\r\n byteView[byteBase + 25] = Clamp255((0.5 + ShC0 * shDegree0[p + 1]) * 255);\r\n byteView[byteBase + 26] = Clamp255((0.5 + ShC0 * shDegree0[p + 2]) * 255);\r\n } else if (colors) {\r\n const c = i * colorStride;\r\n byteView[byteBase + 24] = Clamp255(colors[c + 0] * 255);\r\n byteView[byteBase + 25] = Clamp255(colors[c + 1] * 255);\r\n byteView[byteBase + 26] = Clamp255(colors[c + 2] * 255);\r\n } else {\r\n byteView[byteBase + 24] = 255;\r\n byteView[byteBase + 25] = 255;\r\n byteView[byteBase + 26] = 255;\r\n }\r\n\r\n // Alpha (uint8, byte 27) — opacity is a normalized linear value per spec.\r\n if (opacities) {\r\n byteView[byteBase + 27] = Clamp255(opacities[i] * 255);\r\n } else if (colors && colorStride >= 4) {\r\n byteView[byteBase + 27] = Clamp255(colors[i * colorStride + 3] * 255);\r\n } else {\r\n byteView[byteBase + 27] = 255;\r\n }\r\n\r\n // Quaternion (uint8 x4, bytes 28-31) stored as wxyz encoded as q * 127.5 + 127.5. glTF stores xyzw.\r\n const r = i * 4;\r\n const qx = rotations ? rotations[r + 0] : 0;\r\n const qy = rotations ? rotations[r + 1] : 0;\r\n const qz = rotations ? rotations[r + 2] : 0;\r\n const qw = rotations ? rotations[r + 3] : 1;\r\n byteView[byteBase + 28] = Clamp255(qw * 127.5 + 127.5);\r\n byteView[byteBase + 29] = Clamp255(qx * 127.5 + 127.5);\r\n byteView[byteBase + 30] = Clamp255(qy * 127.5 + 127.5);\r\n byteView[byteBase + 31] = Clamp255(qz * 127.5 + 127.5);\r\n\r\n // Spherical harmonics (coefficient-major, channel-minor) encoded as coeff * 128 + 128.\r\n if (shBuffers) {\r\n const offsetPerSplat = i * 16;\r\n for (let coef = 0; coef < shHigherDegrees.length; coef++) {\r\n const coefData = shHigherDegrees[coef];\r\n if (!coefData) {\r\n continue;\r\n }\r\n for (let channel = 0; channel < 3; channel++) {\r\n const flatIndex = coef * 3 + channel;\r\n const textureIndex = flatIndex >> 4; // Math.floor(flatIndex / 16)\r\n const byteIndexInTexture = flatIndex & 15; // flatIndex % 16\r\n shBuffers[textureIndex][offsetPerSplat + byteIndexInTexture] = Clamp255(coefData[p + channel] * 128 + 128);\r\n }\r\n }\r\n }\r\n }\r\n\r\n await gaussianSplattingMesh.updateDataAsync(buffer, shBuffers ?? undefined, undefined, shDegree || undefined);\r\n\r\n return gaussianSplattingMesh;\r\n });\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Registers the KHR_gaussian_splatting glTF loader extension.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function RegisterKHR_gaussian_splatting(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n unregisterGLTFExtension(NAME);\r\n\r\n registerGLTFExtension(NAME, true, (loader) => new KHR_gaussian_splatting(loader));\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KHR_gaussian_splatting.types.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_gaussian_splatting.types.ts"],"names":[],"mappings":"","sourcesContent":["export {};\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc, @typescript-eslint/naming-convention\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the KHR_gaussian_splatting extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_gaussian_splatting\"]: {};\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC","sourcesContent":["/** Pure barrel — re-exports only side-effect-free modules */\nexport * from \"./declarationMapper\";\nexport * from \"./interactivityGraphParser\";\nexport * from \"./flowGraphGLTFDataProvider\";\n"]}
|
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
import { type GLTFLoader } from "../glTFLoader.js";
|
|
2
|
-
import { type IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
|
|
3
|
-
import { type Scene } from "@onerjs/core/scene.js";
|
|
4
|
-
declare module "../../glTFFileLoader.js" {
|
|
5
|
-
interface GLTFLoaderExtensionOptions {
|
|
6
|
-
/**
|
|
7
|
-
* Defines options for the KHR_interactivity extension.
|
|
8
|
-
*/
|
|
9
|
-
["KHR_interactivity"]: {};
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
1
|
/**
|
|
13
|
-
*
|
|
2
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
3
|
+
* Import "./KHR_interactivity.pure" for tree-shakeable, side-effect-free usage.
|
|
14
4
|
*/
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The name of this extension.
|
|
19
|
-
*/
|
|
20
|
-
readonly name = "KHR_interactivity";
|
|
21
|
-
/**
|
|
22
|
-
* Defines whether this extension is enabled.
|
|
23
|
-
*/
|
|
24
|
-
enabled: boolean;
|
|
25
|
-
private _pathConverter?;
|
|
26
|
-
/**
|
|
27
|
-
* @internal
|
|
28
|
-
* @param _loader
|
|
29
|
-
*/
|
|
30
|
-
constructor(_loader: GLTFLoader);
|
|
31
|
-
dispose(): void;
|
|
32
|
-
onReady(): Promise<void>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @internal
|
|
36
|
-
* populates the object model with the interactivity extension
|
|
37
|
-
*/
|
|
38
|
-
export declare function _AddInteractivityObjectModel(scene: Scene): void;
|
|
5
|
+
export * from "./KHR_interactivity.types.js";
|
|
6
|
+
export * from "./KHR_interactivity.pure.js";
|
|
@@ -1,151 +1,9 @@
|
|
|
1
|
-
import { FlowGraphCoordinator } from "@onerjs/core/FlowGraph/flowGraphCoordinator.js";
|
|
2
|
-
import { ParseFlowGraphAsync } from "@onerjs/core/FlowGraph/flowGraphParser.js";
|
|
3
|
-
import { registerGLTFExtension, unregisterGLTFExtension } from "../glTFLoaderExtensionRegistry.js";
|
|
4
|
-
import { AddObjectAccessorToKey, GetPathToObjectConverter } from "./objectModelMapping.js";
|
|
5
|
-
import { InteractivityGraphToFlowGraphParser } from "./KHR_interactivity/interactivityGraphParser.js";
|
|
6
|
-
import { addToBlockFactory } from "@onerjs/core/FlowGraph/Blocks/flowGraphBlockFactory.js";
|
|
7
|
-
import { Quaternion, Vector3 } from "@onerjs/core/Maths/math.vector.js";
|
|
8
|
-
const NAME = "KHR_interactivity";
|
|
9
1
|
/**
|
|
10
|
-
*
|
|
2
|
+
* Re-exports the pure implementation and applies the runtime registration side effect.
|
|
3
|
+
* Import "./KHR_interactivity.pure" for tree-shakeable, side-effect-free usage.
|
|
11
4
|
*/
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
constructor(_loader) {
|
|
18
|
-
this._loader = _loader;
|
|
19
|
-
/**
|
|
20
|
-
* The name of this extension.
|
|
21
|
-
*/
|
|
22
|
-
this.name = NAME;
|
|
23
|
-
this.enabled = this._loader.isExtensionUsed(NAME);
|
|
24
|
-
this._pathConverter = GetPathToObjectConverter(this._loader.gltf);
|
|
25
|
-
// avoid starting animations automatically.
|
|
26
|
-
_loader._skipStartAnimationStep = true;
|
|
27
|
-
// Update object model with new pointers
|
|
28
|
-
const scene = _loader.babylonScene;
|
|
29
|
-
if (scene) {
|
|
30
|
-
_AddInteractivityObjectModel(scene);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
dispose() {
|
|
34
|
-
this._loader = null;
|
|
35
|
-
delete this._pathConverter;
|
|
36
|
-
}
|
|
37
|
-
// eslint-disable-next-line no-restricted-syntax, @typescript-eslint/no-misused-promises
|
|
38
|
-
async onReady() {
|
|
39
|
-
if (!this._loader.babylonScene || !this._pathConverter) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const scene = this._loader.babylonScene;
|
|
43
|
-
const interactivityDefinition = this._loader.gltf.extensions?.KHR_interactivity;
|
|
44
|
-
if (!interactivityDefinition) {
|
|
45
|
-
// This can technically throw, but it's not a critical error
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const coordinator = new FlowGraphCoordinator({ scene });
|
|
49
|
-
coordinator.dispatchEventsSynchronously = false; // glTF interactivity dispatches events asynchronously
|
|
50
|
-
const graphs = interactivityDefinition.graphs.map((graph) => {
|
|
51
|
-
const parser = new InteractivityGraphToFlowGraphParser(graph, this._loader.gltf, this._loader.parent.targetFps);
|
|
52
|
-
return parser.serializeToFlowGraph();
|
|
53
|
-
});
|
|
54
|
-
// parse each graph async
|
|
55
|
-
await Promise.all(graphs.map(async (graph) => await ParseFlowGraphAsync(graph, { coordinator, pathConverter: this._pathConverter })));
|
|
56
|
-
coordinator.start();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* @internal
|
|
61
|
-
* populates the object model with the interactivity extension
|
|
62
|
-
*/
|
|
63
|
-
export function _AddInteractivityObjectModel(scene) {
|
|
64
|
-
// Note - all of those are read-only, as per the specs!
|
|
65
|
-
// active camera rotation
|
|
66
|
-
AddObjectAccessorToKey("/extensions/KHR_interactivity/?/activeCamera/rotation", {
|
|
67
|
-
get: () => {
|
|
68
|
-
if (!scene.activeCamera) {
|
|
69
|
-
return new Quaternion(NaN, NaN, NaN, NaN);
|
|
70
|
-
}
|
|
71
|
-
const quat = Quaternion.FromRotationMatrix(scene.activeCamera.getWorldMatrix()).normalize();
|
|
72
|
-
if (!scene.useRightHandedSystem) {
|
|
73
|
-
quat.w *= -1; // glTF uses right-handed system, while babylon uses left-handed
|
|
74
|
-
quat.x *= -1; // glTF uses right-handed system, while babylon uses left-handed
|
|
75
|
-
}
|
|
76
|
-
return quat;
|
|
77
|
-
},
|
|
78
|
-
type: "Quaternion",
|
|
79
|
-
getTarget: () => scene.activeCamera,
|
|
80
|
-
});
|
|
81
|
-
// activeCamera position
|
|
82
|
-
AddObjectAccessorToKey("/extensions/KHR_interactivity/?/activeCamera/position", {
|
|
83
|
-
get: () => {
|
|
84
|
-
if (!scene.activeCamera) {
|
|
85
|
-
return new Vector3(NaN, NaN, NaN);
|
|
86
|
-
}
|
|
87
|
-
const pos = scene.activeCamera.getWorldMatrix().getTranslation(); // not global position
|
|
88
|
-
if (!scene.useRightHandedSystem) {
|
|
89
|
-
pos.x *= -1; // glTF uses right-handed system, while babylon uses left-handed
|
|
90
|
-
}
|
|
91
|
-
return pos;
|
|
92
|
-
},
|
|
93
|
-
type: "Vector3",
|
|
94
|
-
getTarget: () => scene.activeCamera,
|
|
95
|
-
});
|
|
96
|
-
// /animations/{} pointers:
|
|
97
|
-
AddObjectAccessorToKey("/animations/{}/extensions/KHR_interactivity/isPlaying", {
|
|
98
|
-
get: (animation) => {
|
|
99
|
-
return animation._babylonAnimationGroup?.isPlaying ?? false;
|
|
100
|
-
},
|
|
101
|
-
type: "boolean",
|
|
102
|
-
getTarget: (animation) => {
|
|
103
|
-
return animation._babylonAnimationGroup;
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
AddObjectAccessorToKey("/animations/{}/extensions/KHR_interactivity/minTime", {
|
|
107
|
-
get: (animation) => {
|
|
108
|
-
return (animation._babylonAnimationGroup?.from ?? 0) / 60; // fixed factor for duration-to-frames conversion
|
|
109
|
-
},
|
|
110
|
-
type: "number",
|
|
111
|
-
getTarget: (animation) => {
|
|
112
|
-
return animation._babylonAnimationGroup;
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
AddObjectAccessorToKey("/animations/{}/extensions/KHR_interactivity/maxTime", {
|
|
116
|
-
get: (animation) => {
|
|
117
|
-
return (animation._babylonAnimationGroup?.to ?? 0) / 60; // fixed factor for duration-to-frames conversion
|
|
118
|
-
},
|
|
119
|
-
type: "number",
|
|
120
|
-
getTarget: (animation) => {
|
|
121
|
-
return animation._babylonAnimationGroup;
|
|
122
|
-
},
|
|
123
|
-
});
|
|
124
|
-
// playhead
|
|
125
|
-
AddObjectAccessorToKey("/animations/{}/extensions/KHR_interactivity/playhead", {
|
|
126
|
-
get: (animation) => {
|
|
127
|
-
return (animation._babylonAnimationGroup?.getCurrentFrame() ?? 0) / 60; // fixed factor for duration-to-frames conversion
|
|
128
|
-
},
|
|
129
|
-
type: "number",
|
|
130
|
-
getTarget: (animation) => {
|
|
131
|
-
return animation._babylonAnimationGroup;
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
//virtualPlayhead - TODO, do we support this property in our animations? getCurrentFrame is the only method we have for this.
|
|
135
|
-
AddObjectAccessorToKey("/animations/{}/extensions/KHR_interactivity/virtualPlayhead", {
|
|
136
|
-
get: (animation) => {
|
|
137
|
-
return (animation._babylonAnimationGroup?.getCurrentFrame() ?? 0) / 60; // fixed factor for duration-to-frames conversion
|
|
138
|
-
},
|
|
139
|
-
type: "number",
|
|
140
|
-
getTarget: (animation) => {
|
|
141
|
-
return animation._babylonAnimationGroup;
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
// Register flow graph blocks. Do it here so they are available when the extension is enabled.
|
|
146
|
-
addToBlockFactory(NAME, "FlowGraphGLTFDataProvider", async () => {
|
|
147
|
-
return (await import("./KHR_interactivity/flowGraphGLTFDataProvider.js")).FlowGraphGLTFDataProvider;
|
|
148
|
-
});
|
|
149
|
-
unregisterGLTFExtension(NAME);
|
|
150
|
-
registerGLTFExtension(NAME, true, (loader) => new KHR_interactivity(loader));
|
|
5
|
+
export * from "./KHR_interactivity.types.js";
|
|
6
|
+
export * from "./KHR_interactivity.pure.js";
|
|
7
|
+
import { RegisterKHR_interactivity } from "./KHR_interactivity.pure.js";
|
|
8
|
+
RegisterKHR_interactivity();
|
|
151
9
|
//# sourceMappingURL=KHR_interactivity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KHR_interactivity.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,mCAAmC,EAAE,MAAM,8CAA8C,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAI7D,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAajC;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAY1B;;;OAGG;IACH,YAAoB,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;QAfvC;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC;QAaxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,cAAc,GAAG,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClE,2CAA2C;QAC3C,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AG,EAAE,CAAC,SAAqB,EAAE,EAAE;YAC3B,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,iDAAiD;QAC7H,CAAC;QACD,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,CAAC,SAAqB,EAAE,EAAE;YACjC,OAAO,SAAS,CAAC,sBAAsB,CAAC;QAC5C,CAAC;KACJ,CAAC,CAAC;IACH,8HAA8H;IAC9H,sBAAsB,CAAC,6DAA6D,EAAE;QAClF,GAAG,EAAE,CAAC,SAAqB,EAAE,EAAE;YAC3B,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,iDAAiD;QAC7H,CAAC;QACD,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,CAAC,SAAqB,EAAE,EAAE;YACjC,OAAO,SAAS,CAAC,sBAAsB,CAAC;QAC5C,CAAC;KACJ,CAAC,CAAC;AACP,CAAC;AAED,8FAA8F;AAC9F,iBAAiB,CAAC,IAAI,EAAE,2BAA2B,EAAE,KAAK,IAAI,EAAE;IAC5D,OAAO,CAAC,MAAM,MAAM,CAAC,+CAA+C,CAAC,CAAC,CAAC,yBAAyB,CAAC;AACrG,CAAC,CAAC,CAAC;AAEH,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { type IKHRInteractivity } from \"babylonjs-gltf2interface\";\r\nimport { type GLTFLoader } from \"../glTFLoader\";\r\nimport { type IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { FlowGraphCoordinator } from \"core/FlowGraph/flowGraphCoordinator\";\r\nimport { ParseFlowGraphAsync } from \"core/FlowGraph/flowGraphParser\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\nimport { type GLTFPathToObjectConverter } from \"./gltfPathToObjectConverter\";\r\nimport { AddObjectAccessorToKey, GetPathToObjectConverter } from \"./objectModelMapping\";\r\nimport { InteractivityGraphToFlowGraphParser } from \"./KHR_interactivity/interactivityGraphParser\";\r\nimport { addToBlockFactory } from \"core/FlowGraph/Blocks/flowGraphBlockFactory\";\r\nimport { Quaternion, Vector3 } from \"core/Maths/math.vector\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { type IAnimation } from \"../glTFLoaderInterfaces\";\r\n\r\nconst NAME = \"KHR_interactivity\";\r\n\r\ndeclare module \"../../glTFFileLoader\" {\r\n // eslint-disable-next-line jsdoc/require-jsdoc, @typescript-eslint/naming-convention\r\n export interface GLTFLoaderExtensionOptions {\r\n /**\r\n * Defines options for the KHR_interactivity extension.\r\n */\r\n // NOTE: Don't use NAME here as it will break the UMD type declarations.\r\n [\"KHR_interactivity\"]: {};\r\n }\r\n}\r\n\r\n/**\r\n * Loader extension for KHR_interactivity\r\n */\r\nexport class KHR_interactivity implements IGLTFLoaderExtension {\r\n /**\r\n * The name of this extension.\r\n */\r\n public readonly name = NAME;\r\n /**\r\n * Defines whether this extension is enabled.\r\n */\r\n public enabled: boolean;\r\n\r\n private _pathConverter?: GLTFPathToObjectConverter<any, any, any>;\r\n\r\n /**\r\n * @internal\r\n * @param _loader\r\n */\r\n constructor(private _loader: GLTFLoader) {\r\n this.enabled = this._loader.isExtensionUsed(NAME);\r\n this._pathConverter = GetPathToObjectConverter(this._loader.gltf);\r\n // avoid starting animations automatically.\r\n _loader._skipStartAnimationStep = true;\r\n\r\n // Update object model with new pointers\r\n\r\n const scene = _loader.babylonScene;\r\n if (scene) {\r\n _AddInteractivityObjectModel(scene);\r\n }\r\n }\r\n\r\n public dispose() {\r\n (this._loader as any) = null;\r\n delete this._pathConverter;\r\n }\r\n\r\n // eslint-disable-next-line no-restricted-syntax, @typescript-eslint/no-misused-promises\r\n public async onReady(): Promise<void> {\r\n if (!this._loader.babylonScene || !this._pathConverter) {\r\n return;\r\n }\r\n const scene = this._loader.babylonScene;\r\n const interactivityDefinition = this._loader.gltf.extensions?.KHR_interactivity as IKHRInteractivity;\r\n if (!interactivityDefinition) {\r\n // This can technically throw, but it's not a critical error\r\n return;\r\n }\r\n\r\n const coordinator = new FlowGraphCoordinator({ scene });\r\n coordinator.dispatchEventsSynchronously = false; // glTF interactivity dispatches events asynchronously\r\n const graphs = interactivityDefinition.graphs.map((graph) => {\r\n const parser = new InteractivityGraphToFlowGraphParser(graph, this._loader.gltf, this._loader.parent.targetFps);\r\n return parser.serializeToFlowGraph();\r\n });\r\n // parse each graph async\r\n await Promise.all(graphs.map(async (graph) => await ParseFlowGraphAsync(graph, { coordinator, pathConverter: this._pathConverter })));\r\n\r\n coordinator.start();\r\n }\r\n}\r\n\r\n/**\r\n * @internal\r\n * populates the object model with the interactivity extension\r\n */\r\nexport function _AddInteractivityObjectModel(scene: Scene) {\r\n // Note - all of those are read-only, as per the specs!\r\n\r\n // active camera rotation\r\n AddObjectAccessorToKey(\"/extensions/KHR_interactivity/?/activeCamera/rotation\", {\r\n get: () => {\r\n if (!scene.activeCamera) {\r\n return new Quaternion(NaN, NaN, NaN, NaN);\r\n }\r\n const quat = Quaternion.FromRotationMatrix(scene.activeCamera.getWorldMatrix()).normalize();\r\n if (!scene.useRightHandedSystem) {\r\n quat.w *= -1; // glTF uses right-handed system, while babylon uses left-handed\r\n quat.x *= -1; // glTF uses right-handed system, while babylon uses left-handed\r\n }\r\n return quat;\r\n },\r\n type: \"Quaternion\",\r\n getTarget: () => scene.activeCamera,\r\n });\r\n // activeCamera position\r\n AddObjectAccessorToKey(\"/extensions/KHR_interactivity/?/activeCamera/position\", {\r\n get: () => {\r\n if (!scene.activeCamera) {\r\n return new Vector3(NaN, NaN, NaN);\r\n }\r\n const pos = scene.activeCamera.getWorldMatrix().getTranslation(); // not global position\r\n if (!scene.useRightHandedSystem) {\r\n pos.x *= -1; // glTF uses right-handed system, while babylon uses left-handed\r\n }\r\n return pos;\r\n },\r\n type: \"Vector3\",\r\n getTarget: () => scene.activeCamera,\r\n });\r\n\r\n // /animations/{} pointers:\r\n AddObjectAccessorToKey(\"/animations/{}/extensions/KHR_interactivity/isPlaying\", {\r\n get: (animation: IAnimation) => {\r\n return animation._babylonAnimationGroup?.isPlaying ?? false;\r\n },\r\n type: \"boolean\",\r\n getTarget: (animation: IAnimation) => {\r\n return animation._babylonAnimationGroup;\r\n },\r\n });\r\n AddObjectAccessorToKey(\"/animations/{}/extensions/KHR_interactivity/minTime\", {\r\n get: (animation: IAnimation) => {\r\n return (animation._babylonAnimationGroup?.from ?? 0) / 60; // fixed factor for duration-to-frames conversion\r\n },\r\n type: \"number\",\r\n getTarget: (animation: IAnimation) => {\r\n return animation._babylonAnimationGroup;\r\n },\r\n });\r\n AddObjectAccessorToKey(\"/animations/{}/extensions/KHR_interactivity/maxTime\", {\r\n get: (animation: IAnimation) => {\r\n return (animation._babylonAnimationGroup?.to ?? 0) / 60; // fixed factor for duration-to-frames conversion\r\n },\r\n type: \"number\",\r\n getTarget: (animation: IAnimation) => {\r\n return animation._babylonAnimationGroup;\r\n },\r\n });\r\n // playhead\r\n AddObjectAccessorToKey(\"/animations/{}/extensions/KHR_interactivity/playhead\", {\r\n get: (animation: IAnimation) => {\r\n return (animation._babylonAnimationGroup?.getCurrentFrame() ?? 0) / 60; // fixed factor for duration-to-frames conversion\r\n },\r\n type: \"number\",\r\n getTarget: (animation: IAnimation) => {\r\n return animation._babylonAnimationGroup;\r\n },\r\n });\r\n //virtualPlayhead - TODO, do we support this property in our animations? getCurrentFrame is the only method we have for this.\r\n AddObjectAccessorToKey(\"/animations/{}/extensions/KHR_interactivity/virtualPlayhead\", {\r\n get: (animation: IAnimation) => {\r\n return (animation._babylonAnimationGroup?.getCurrentFrame() ?? 0) / 60; // fixed factor for duration-to-frames conversion\r\n },\r\n type: \"number\",\r\n getTarget: (animation: IAnimation) => {\r\n return animation._babylonAnimationGroup;\r\n },\r\n });\r\n}\r\n\r\n// Register flow graph blocks. Do it here so they are available when the extension is enabled.\r\naddToBlockFactory(NAME, \"FlowGraphGLTFDataProvider\", async () => {\r\n return (await import(\"./KHR_interactivity/flowGraphGLTFDataProvider\")).FlowGraphGLTFDataProvider;\r\n});\r\n\r\nunregisterGLTFExtension(NAME);\r\nregisterGLTFExtension(NAME, true, (loader) => new KHR_interactivity(loader));\r\n"]}
|
|
1
|
+
{"version":3,"file":"KHR_interactivity.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AAEzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,yBAAyB,EAAE,CAAC","sourcesContent":["/**\r\n * Re-exports the pure implementation and applies the runtime registration side effect.\r\n * Import \"./KHR_interactivity.pure\" for tree-shakeable, side-effect-free usage.\r\n */\r\nexport * from \"./KHR_interactivity.types\";\r\nexport * from \"./KHR_interactivity.pure\";\r\n\r\nimport { RegisterKHR_interactivity } from \"./KHR_interactivity.pure\";\r\nRegisterKHR_interactivity();\r\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type GLTFLoader } from "../glTFLoader.pure.js";
|
|
2
|
+
import { type IGLTFLoaderExtension } from "../glTFLoaderExtension.js";
|
|
3
|
+
import { type Scene } from "@onerjs/core/scene.js";
|
|
4
|
+
/**
|
|
5
|
+
* Loader extension for KHR_interactivity
|
|
6
|
+
*/
|
|
7
|
+
export declare class KHR_interactivity implements IGLTFLoaderExtension {
|
|
8
|
+
private _loader;
|
|
9
|
+
/**
|
|
10
|
+
* The name of this extension.
|
|
11
|
+
*/
|
|
12
|
+
readonly name = "KHR_interactivity";
|
|
13
|
+
/**
|
|
14
|
+
* Defines whether this extension is enabled.
|
|
15
|
+
*/
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
private _pathConverter?;
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
* @param _loader
|
|
21
|
+
*/
|
|
22
|
+
constructor(_loader: GLTFLoader);
|
|
23
|
+
dispose(): void;
|
|
24
|
+
onReady(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
* populates the object model with the interactivity extension
|
|
29
|
+
*/
|
|
30
|
+
export declare function _AddInteractivityObjectModel(scene: Scene): void;
|
|
31
|
+
/**
|
|
32
|
+
* Registers the KHR_interactivity glTF loader extension.
|
|
33
|
+
* Safe to call multiple times; only the first call has an effect.
|
|
34
|
+
*/
|
|
35
|
+
export declare function RegisterKHR_interactivity(): void;
|