@relu-interactives/spatial-ecs 0.5.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{System-V_mv07le.d.cts → System-8D-XBDKZ.d.cts} +734 -8
- package/dist/{System-V_mv07le.d.ts → System-DPMAW30g.d.ts} +734 -8
- package/dist/{XRHandPose-CU3vNFuS.d.ts → XRHandPose-G0Dl-F0w.d.ts} +93 -3
- package/dist/{XRHandPose-CQTLGxFC.d.cts → XRHandPose-VQMT1WXj.d.cts} +93 -3
- package/dist/animation/index.cjs +252 -0
- package/dist/animation/index.cjs.map +1 -0
- package/dist/animation/index.d.cts +100 -0
- package/dist/animation/index.d.ts +100 -0
- package/dist/animation/index.js +4 -0
- package/dist/animation/index.js.map +1 -0
- package/dist/chunk-CKTHDXPS.js +11 -0
- package/dist/chunk-CKTHDXPS.js.map +1 -0
- package/dist/chunk-G4XJ53LS.js +1237 -0
- package/dist/chunk-G4XJ53LS.js.map +1 -0
- package/dist/chunk-GSWC6LLD.js +241 -0
- package/dist/chunk-GSWC6LLD.js.map +1 -0
- package/dist/{chunk-DF5SSRN6.js → chunk-JIJQFW6P.js} +1216 -2920
- package/dist/chunk-JIJQFW6P.js.map +1 -0
- package/dist/{chunk-BUEKOSR5.js → chunk-NNDUOQ7O.js} +188 -14
- package/dist/chunk-NNDUOQ7O.js.map +1 -0
- package/dist/chunk-OHCNPPMX.js +334 -0
- package/dist/chunk-OHCNPPMX.js.map +1 -0
- package/dist/{chunk-RXBLOO5B.js → chunk-SGF73YTF.js} +105 -715
- package/dist/chunk-SGF73YTF.js.map +1 -0
- package/dist/chunk-U727NTWQ.js +2856 -0
- package/dist/chunk-U727NTWQ.js.map +1 -0
- package/dist/{chunk-OY7ZODZP.js → chunk-XE4OXN2W.js} +3 -9
- package/dist/chunk-XE4OXN2W.js.map +1 -0
- package/dist/{chunk-OWQSESTO.js → chunk-XU2DVWCP.js} +4 -3
- package/dist/chunk-XU2DVWCP.js.map +1 -0
- package/dist/components/index.cjs +183 -10
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +5 -3
- package/dist/components/index.d.ts +5 -3
- package/dist/components/index.js +3 -2
- package/dist/docs/api/Behaviour/classes/Behaviour.md +366 -79
- package/dist/docs/api/Behaviour/index.md +7 -3
- package/dist/docs/api/Behaviour/type-aliases/UiInteractionEvent.md +35 -0
- package/dist/docs/api/Component/classes/Component.md +14 -1
- package/dist/docs/api/components/classes/AnimationComponent.md +26 -26
- package/dist/docs/api/components/classes/AudioComponent.md +19 -19
- package/dist/docs/api/components/classes/CameraComponent.md +14 -14
- package/dist/docs/api/components/classes/EntityType.md +4 -4
- package/dist/docs/api/components/classes/Environment.md +5 -4
- package/dist/docs/api/components/classes/ImageComponent.md +7 -7
- package/dist/docs/api/components/classes/ImageTarget.md +8 -8
- package/dist/docs/api/components/classes/ImageTargetAnchor.md +4 -4
- package/dist/docs/api/components/classes/InstanceSlotComponent.md +4 -4
- package/dist/docs/api/components/classes/InstancedMeshComponent.md +10 -10
- package/dist/docs/api/components/classes/LightComponent.md +6 -6
- package/dist/docs/api/components/classes/MaterialComponent.md +16 -16
- package/dist/docs/api/components/classes/MeshComponent.md +3 -3
- package/dist/docs/api/components/classes/MeshGeometryComponent.md +9 -9
- package/dist/docs/api/components/classes/ModelComponent.md +8 -5
- package/dist/docs/api/components/classes/Name.md +3 -3
- package/dist/docs/api/components/classes/Object3DRef.md +4 -4
- package/dist/docs/api/components/classes/ParentId.md +3 -3
- package/dist/docs/api/components/classes/PhysicsComponent.md +7 -6
- package/dist/docs/api/components/classes/Postprocessing.md +3 -3
- package/dist/docs/api/components/classes/PrefabInstance.md +5 -5
- package/dist/docs/api/components/classes/PrefabNode.md +3 -3
- package/dist/docs/api/components/classes/ScriptComponent.md +5 -5
- package/dist/docs/api/components/classes/ScriptObjectComponent.md +9 -9
- package/dist/docs/api/components/classes/Selectable.md +3 -3
- package/dist/docs/api/components/classes/SelectionTransformState.md +5 -5
- package/dist/docs/api/components/classes/SpriteComponent.md +7 -7
- package/dist/docs/api/components/classes/TransformComponent.md +12 -12
- package/dist/docs/api/components/classes/UIButtonComponent.md +63 -0
- package/dist/docs/api/components/classes/UIPanelComponent.md +62 -0
- package/dist/docs/api/components/classes/UISliderComponent.md +59 -0
- package/dist/docs/api/components/classes/UITextComponent.md +59 -0
- package/dist/docs/api/components/classes/UIToggleComponent.md +56 -0
- package/dist/docs/api/components/classes/VRTeleportAreaComponent.md +53 -0
- package/dist/docs/api/components/classes/VideoComponent.md +28 -28
- package/dist/docs/api/components/classes/XRAnchorComponent.md +64 -0
- package/dist/docs/api/components/classes/XREnvironmentComponent.md +64 -0
- package/dist/docs/api/components/classes/XRHandPoseComponent.md +50 -0
- package/dist/docs/api/components/classes/XRInteractableComponent.md +74 -0
- package/dist/docs/api/components/classes/XRInteractorComponent.md +57 -0
- package/dist/docs/api/components/classes/XRInteractorSideComponent.md +50 -0
- package/dist/docs/api/components/classes/XRRigComponent.md +68 -0
- package/dist/docs/api/components/functions/createAttachPoint.md +25 -0
- package/dist/docs/api/components/functions/createHandPoseEntry.md +25 -0
- package/dist/docs/api/components/functions/defaultMaterialValue.md +1 -1
- package/dist/docs/api/components/functions/handPoseDefinitionFor.md +33 -0
- package/dist/docs/api/components/functions/normalizeEnvironmentLighting.md +30 -0
- package/dist/docs/api/components/functions/normalizePhysicsState.md +1 -1
- package/dist/docs/api/components/functions/setModelLoadState.md +33 -0
- package/dist/docs/api/components/functions/setPhysicsLiveRef.md +3 -9
- package/dist/docs/api/components/index.md +61 -4
- package/dist/docs/api/components/type-aliases/AnimationComponentOptions.md +9 -9
- package/dist/docs/api/components/type-aliases/CameraComponentOptions.md +13 -13
- package/dist/docs/api/components/type-aliases/CameraProjection.md +1 -1
- package/dist/docs/api/components/type-aliases/CameraRuntimeType.md +5 -3
- package/dist/docs/api/components/type-aliases/ColliderShape.md +1 -1
- package/dist/docs/api/components/type-aliases/ColliderState.md +20 -20
- package/dist/docs/api/components/type-aliases/CubeMeshParameters.md +4 -4
- package/dist/docs/api/components/type-aliases/EditableMeshObjectKind.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentFogState.md +8 -8
- package/dist/docs/api/components/type-aliases/EnvironmentFogType.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentGradientEffect.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentLightingState.md +40 -0
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxImageProjection.md +22 -0
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxState.md +9 -7
- package/dist/docs/api/components/type-aliases/EnvironmentSkyboxType.md +1 -1
- package/dist/docs/api/components/type-aliases/EnvironmentState.md +7 -5
- package/dist/docs/api/components/type-aliases/EnvironmentToneMapping.md +16 -0
- package/dist/docs/api/components/type-aliases/ImageTargetAnchorOptions.md +3 -3
- package/dist/docs/api/components/type-aliases/ImageTargetReference.md +7 -7
- package/dist/docs/api/components/type-aliases/InstanceTransform.md +13 -13
- package/dist/docs/api/components/type-aliases/InstancedMeshKind.md +1 -1
- package/dist/docs/api/components/type-aliases/LightShadowState.md +37 -0
- package/dist/docs/api/components/type-aliases/LightValueState.md +13 -11
- package/dist/docs/api/components/type-aliases/MaterialTypeValue.md +1 -1
- package/dist/docs/api/components/type-aliases/MaterialValueState.md +28 -28
- package/dist/docs/api/components/type-aliases/MeshGeometryParameters.md +1 -1
- package/dist/docs/api/components/type-aliases/MeshGeometryParametersByKind.md +7 -7
- package/dist/docs/api/components/type-aliases/ModelLoadState.md +15 -0
- package/dist/docs/api/components/type-aliases/PhysicsState.md +3 -3
- package/dist/docs/api/components/type-aliases/PlaneMeshParameters.md +3 -3
- package/dist/docs/api/components/type-aliases/PostprocessingState.md +62 -62
- package/dist/docs/api/components/type-aliases/RadiusHeightMeshParameters.md +3 -3
- package/dist/docs/api/components/type-aliases/RadiusMeshParameters.md +2 -2
- package/dist/docs/api/components/type-aliases/RigidbodyState.md +17 -17
- package/dist/docs/api/components/type-aliases/RigidbodyType.md +1 -1
- package/dist/docs/api/components/type-aliases/ScriptEntry.md +8 -8
- package/dist/docs/api/components/type-aliases/ScriptObjectComponentInput.md +1 -1
- package/dist/docs/api/components/type-aliases/ScriptObjectRuntimeState.md +1 -1
- package/dist/docs/api/components/type-aliases/TextureFilteringValue.md +1 -1
- package/dist/docs/api/components/type-aliases/TransformData.md +4 -4
- package/dist/docs/api/components/type-aliases/TransformModeValue.md +1 -1
- package/dist/docs/api/components/type-aliases/TransformSpaceValue.md +1 -1
- package/dist/docs/api/components/type-aliases/UIButtonOptions.md +45 -0
- package/dist/docs/api/components/type-aliases/UIPanelOptions.md +39 -0
- package/dist/docs/api/components/type-aliases/UISliderOptions.md +39 -0
- package/dist/docs/api/components/type-aliases/UITextOptions.md +41 -0
- package/dist/docs/api/components/type-aliases/UIToggleOptions.md +35 -0
- package/dist/docs/api/components/type-aliases/UiFollowMode.md +15 -0
- package/dist/docs/api/components/type-aliases/UiTextAlign.md +13 -0
- package/dist/docs/api/components/type-aliases/UiTextVAlign.md +13 -0
- package/dist/docs/api/components/type-aliases/VRTeleportAreaOptions.md +29 -0
- package/dist/docs/api/components/type-aliases/Vec3.md +4 -4
- package/dist/docs/api/components/type-aliases/VrTeleportShape.md +15 -0
- package/dist/docs/api/components/type-aliases/XRAnchorOptions.md +23 -0
- package/dist/docs/api/components/type-aliases/XRHandPoseOptions.md +23 -0
- package/dist/docs/api/components/type-aliases/XRInteractableOptions.md +75 -0
- package/dist/docs/api/components/type-aliases/XRInteractorOptions.md +37 -0
- package/dist/docs/api/components/type-aliases/XRRigOptions.md +51 -0
- package/dist/docs/api/components/type-aliases/XrAttachPoint.md +53 -0
- package/dist/docs/api/components/type-aliases/XrDistanceGrabBehavior.md +19 -0
- package/dist/docs/api/components/type-aliases/XrEnvironmentKind.md +15 -0
- package/dist/docs/api/components/type-aliases/XrEnvironmentOrientation.md +15 -0
- package/dist/docs/api/components/type-aliases/XrEnvironmentPhysics.md +25 -0
- package/dist/docs/api/components/type-aliases/XrGrabGesture.md +19 -0
- package/dist/docs/api/components/type-aliases/XrGrabHands.md +20 -0
- package/dist/docs/api/components/type-aliases/XrGrabReach.md +20 -0
- package/dist/docs/api/components/type-aliases/XrHandPoseEntry.md +49 -0
- package/dist/docs/api/components/type-aliases/XrHandPreset.md +19 -0
- package/dist/docs/api/components/type-aliases/XrInteractorSide.md +15 -0
- package/dist/docs/api/components/type-aliases/XrInteractorType.md +13 -0
- package/dist/docs/api/components/type-aliases/XrLocomotionMode.md +15 -0
- package/dist/docs/api/components/type-aliases/XrTrackingOrigin.md +24 -0
- package/dist/docs/api/components/type-aliases/XrTwoHandRotation.md +15 -0
- package/dist/docs/api/components/variables/DEFAULT_COLLIDER_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_ENVIRONMENT_LIGHTING.md +15 -0
- package/dist/docs/api/components/variables/DEFAULT_ENVIRONMENT_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_INSTANCED_MESH_PARAMETERS.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_INSTANCE_TRANSFORM.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_MESH_GEOMETRY_PARAMETERS.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_PHYSICS_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_POSE_CURLS.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_POSE_DIRECTIONS.md +13 -0
- package/dist/docs/api/components/variables/DEFAULT_POSTPROCESSING_STATE.md +1 -1
- package/dist/docs/api/components/variables/DEFAULT_RIGIDBODY_STATE.md +1 -1
- package/dist/docs/api/components/variables/MODEL_NO_PATH_MESSAGE.md +15 -0
- package/dist/docs/api/index/classes/AnimationStateMachine.md +16 -16
- package/dist/docs/api/index/classes/AnimationStateManager.md +13 -13
- package/dist/docs/api/index/classes/AnimationSystem.md +3 -3
- package/dist/docs/api/index/classes/AudioSystem.md +4 -4
- package/dist/docs/api/index/classes/CameraSyncSystem.md +2 -2
- package/dist/docs/api/index/classes/EnvironmentSyncSystem.md +19 -4
- package/dist/docs/api/index/classes/HandPoseTracker.md +114 -0
- package/dist/docs/api/index/classes/InputSystem.md +33 -33
- package/dist/docs/api/index/classes/InstancedMeshSystem.md +2 -2
- package/dist/docs/api/index/classes/LightSyncSystem.md +2 -2
- package/dist/docs/api/index/classes/MaterialSyncSystem.md +3 -3
- package/dist/docs/api/index/classes/MeshGeometrySystem.md +2 -2
- package/dist/docs/api/index/classes/ObjectManagementSystem.md +14 -14
- package/dist/docs/api/index/classes/ObjectVisibilitySystem.md +2 -2
- package/dist/docs/api/index/classes/PhysicsSyncSystem.md +4 -4
- package/dist/docs/api/index/classes/PostprocessingSyncSystem.md +34 -10
- package/dist/docs/api/index/classes/RenderSystem.md +13 -4
- package/dist/docs/api/index/classes/ScriptBehaviourSystem.md +9 -5
- package/dist/docs/api/index/classes/ScriptObject.md +10 -10
- package/dist/docs/api/index/classes/ScriptObjectSystem.md +6 -6
- package/dist/docs/api/index/classes/TeleportAimGate.md +114 -0
- package/dist/docs/api/index/classes/ThrowVelocityTracker.md +89 -0
- package/dist/docs/api/index/classes/TransformSyncSystem.md +2 -2
- package/dist/docs/api/index/classes/UIInteractionSystem.md +60 -0
- package/dist/docs/api/index/classes/UIPanelSystem.md +79 -0
- package/dist/docs/api/index/classes/VRTeleportAreaSystem.md +49 -0
- package/dist/docs/api/index/classes/VideoSystem.md +8 -6
- package/dist/docs/api/index/classes/World.md +282 -100
- package/dist/docs/api/index/classes/XRAnchorSystem.md +90 -0
- package/dist/docs/api/index/classes/XRControllerVisualSystem.md +77 -0
- package/dist/docs/api/index/classes/XREnvironmentSystem.md +137 -0
- package/dist/docs/api/index/classes/XRHandPoseSystem.md +107 -0
- package/dist/docs/api/index/classes/XRHitTestSystem.md +93 -0
- package/dist/docs/api/index/classes/XRHoverVisualSystem.md +76 -0
- package/dist/docs/api/index/classes/XRInputSystem.md +189 -0
- package/dist/docs/api/index/classes/XRInteractionSystem.md +323 -0
- package/dist/docs/api/index/classes/XRLocomotionSystem.md +128 -0
- package/dist/docs/api/index/classes/XRSessionSystem.md +116 -0
- package/dist/docs/api/index/classes/XRTeleportVisualSystem.md +75 -0
- package/dist/docs/api/index/functions/angularVelocityFrom.md +33 -0
- package/dist/docs/api/index/functions/applyHandMaterial.md +26 -0
- package/dist/docs/api/index/functions/applyPrefabToSnapshotInstances.md +1 -1
- package/dist/docs/api/index/functions/arcGroundCrossing.md +30 -0
- package/dist/docs/api/index/functions/buildComponentValueMaps.md +1 -1
- package/dist/docs/api/index/functions/buildNodeKeyMapsFromSnapshot.md +1 -1
- package/dist/docs/api/index/functions/buildNodeMapsFromSnapshot.md +1 -1
- package/dist/docs/api/index/functions/canonicalizeComponentValue.md +1 -1
- package/dist/docs/api/index/functions/clearModelCache.md +1 -1
- package/dist/docs/api/index/functions/clearPrefabCache.md +1 -1
- package/dist/docs/api/index/functions/cloneHandPose.md +23 -0
- package/dist/docs/api/index/functions/collectDiffPaths.md +1 -1
- package/dist/docs/api/index/functions/collectDirectPrefabDependencies.md +1 -1
- package/dist/docs/api/index/functions/collectEntitySubtree.md +1 -1
- package/dist/docs/api/index/functions/collectSnapshotSubtreeIds.md +1 -1
- package/dist/docs/api/index/functions/computeFingerCurl.md +29 -0
- package/dist/docs/api/index/functions/computeHandShape.md +29 -0
- package/dist/docs/api/index/functions/computeInstanceOverrides.md +1 -1
- package/dist/docs/api/index/functions/computePalmPose.md +30 -0
- package/dist/docs/api/index/functions/computePalmWidth.md +25 -0
- package/dist/docs/api/index/functions/computePinch.md +29 -0
- package/dist/docs/api/index/functions/computeSpread.md +33 -0
- package/dist/docs/api/index/functions/createAnimationComponent.md +1 -1
- package/dist/docs/api/index/functions/createAudioComponent.md +1 -1
- package/dist/docs/api/index/functions/createCameraComponent.md +1 -1
- package/dist/docs/api/index/functions/createEntityTypeComponent.md +2 -2
- package/dist/docs/api/index/functions/createEnvironmentComponent.md +1 -1
- package/dist/docs/api/index/functions/createHandMaterial.md +30 -0
- package/dist/docs/api/index/functions/createImageComponent.md +1 -1
- package/dist/docs/api/index/functions/createImageTargetAnchorComponent.md +1 -1
- package/dist/docs/api/index/functions/createImageTargetComponent.md +2 -2
- package/dist/docs/api/index/functions/createInstanceSlotComponent.md +1 -1
- package/dist/docs/api/index/functions/createInstancedMeshComponent.md +1 -1
- package/dist/docs/api/index/functions/createLightComponent.md +2 -2
- package/dist/docs/api/index/functions/createMaterialComponent.md +2 -2
- package/dist/docs/api/index/functions/createMeshComponent.md +1 -1
- package/dist/docs/api/index/functions/createMeshGeometryComponent.md +1 -1
- package/dist/docs/api/index/functions/createModelComponent.md +1 -1
- package/dist/docs/api/index/functions/createNameComponent.md +1 -1
- package/dist/docs/api/index/functions/createObject3DRefComponent.md +1 -1
- package/dist/docs/api/index/functions/createParentIdComponent.md +1 -1
- package/dist/docs/api/index/functions/createPhysicsComponent.md +1 -1
- package/dist/docs/api/index/functions/createPostprocessingComponent.md +1 -1
- package/dist/docs/api/index/functions/createScriptComponent.md +1 -1
- package/dist/docs/api/index/functions/createScriptObjectComponent.md +1 -1
- package/dist/docs/api/index/functions/createSelectableComponent.md +1 -1
- package/dist/docs/api/index/functions/createSelectionTransformStateComponent.md +1 -1
- package/dist/docs/api/index/functions/createSpriteComponent.md +1 -1
- package/dist/docs/api/index/functions/createTransformComponent.md +1 -1
- package/dist/docs/api/index/functions/createUIButtonComponent.md +28 -0
- package/dist/docs/api/index/functions/createUIPanelComponent.md +28 -0
- package/dist/docs/api/index/functions/createUISliderComponent.md +28 -0
- package/dist/docs/api/index/functions/createUITextComponent.md +28 -0
- package/dist/docs/api/index/functions/createUIToggleComponent.md +28 -0
- package/dist/docs/api/index/functions/createVRTeleportAreaComponent.md +28 -0
- package/dist/docs/api/index/functions/createVideoComponent.md +1 -1
- package/dist/docs/api/index/functions/createXRAnchorComponent.md +28 -0
- package/dist/docs/api/index/functions/createXRHandPoseComponent.md +28 -0
- package/dist/docs/api/index/functions/createXRInteractableComponent.md +28 -0
- package/dist/docs/api/index/functions/createXRInteractorComponent.md +28 -0
- package/dist/docs/api/index/functions/createXRInteractorSideComponent.md +28 -0
- package/dist/docs/api/index/functions/createXRRigComponent.md +28 -0
- package/dist/docs/api/index/functions/decanonicalizeComponentValue.md +1 -1
- package/dist/docs/api/index/functions/despawnPrefab.md +1 -1
- package/dist/docs/api/index/functions/encodeOverride.md +1 -1
- package/dist/docs/api/index/functions/estimateHandScale.md +28 -0
- package/dist/docs/api/index/functions/findSnapshotRootEntityIds.md +1 -1
- package/dist/docs/api/index/functions/findTopLevelNestedRegions.md +1 -1
- package/dist/docs/api/index/functions/getHandPosePreset.md +31 -0
- package/dist/docs/api/index/functions/groupOverridePaths.md +1 -1
- package/dist/docs/api/index/functions/handPoseFromCurls.md +42 -0
- package/dist/docs/api/index/functions/hydrateWorldFromSnapshot.md +1 -1
- package/dist/docs/api/index/functions/hydrateWorldFromSnapshotDetailed.md +1 -1
- package/dist/docs/api/index/functions/indexSnapshotByEntity.md +1 -1
- package/dist/docs/api/index/functions/instantiateSubtree.md +1 -1
- package/dist/docs/api/index/functions/loadPrefab.md +1 -1
- package/dist/docs/api/index/functions/loadSharedGltf.md +1 -1
- package/dist/docs/api/index/functions/matchHandPose.md +34 -0
- package/dist/docs/api/index/functions/mergeComponentValue.md +1 -1
- package/dist/docs/api/index/functions/parseOverride.md +1 -1
- package/dist/docs/api/index/functions/parsePrefabAsset.md +1 -1
- package/dist/docs/api/index/functions/prefabFileVersionFor.md +1 -1
- package/dist/docs/api/index/functions/readXrCapabilities.md +30 -0
- package/dist/docs/api/index/functions/registerDefaultComponentFactories.md +1 -1
- package/dist/docs/api/index/functions/registerDefaultFactories.md +1 -1
- package/dist/docs/api/index/functions/remapSnapshotEntityIds.md +3 -3
- package/dist/docs/api/index/functions/resolveDracoDecoderPath.md +1 -1
- package/dist/docs/api/index/functions/restoreComponentState.md +1 -1
- package/dist/docs/api/index/functions/restorePostCreateComponents.md +1 -1
- package/dist/docs/api/index/functions/sampleTeleportArc.md +40 -0
- package/dist/docs/api/index/functions/serializeEntitySubtree.md +1 -1
- package/dist/docs/api/index/functions/setDracoDecoderPath.md +1 -1
- package/dist/docs/api/index/functions/setPrefabAssetUrlResolver.md +1 -1
- package/dist/docs/api/index/functions/spawnPrefab.md +1 -1
- package/dist/docs/api/index/index.md +116 -4
- package/dist/docs/api/index/interfaces/ChromaKeyOptions.md +20 -0
- package/dist/docs/api/index/interfaces/EcsSystem.md +3 -3
- package/dist/docs/api/index/interfaces/PostprocessingBuildContext.md +21 -0
- package/dist/docs/api/index/interfaces/PostprocessingPipeline.md +84 -0
- package/dist/docs/api/index/interfaces/RenderBackend.md +168 -0
- package/dist/docs/api/index/interfaces/StateMachine.md +13 -13
- package/dist/docs/api/index/type-aliases/AnimationStateCallbacks.md +4 -4
- package/dist/docs/api/index/type-aliases/ApplyPrefabToSnapshotResult.md +3 -3
- package/dist/docs/api/index/type-aliases/ComponentFactory.md +1 -1
- package/dist/docs/api/index/type-aliases/ComponentValueMaps.md +50 -26
- package/dist/docs/api/index/type-aliases/EcsComponentFactoryKind.md +14 -2
- package/dist/docs/api/index/type-aliases/EcsRenderer.md +17 -0
- package/dist/docs/api/index/type-aliases/EcsWorldComponentSnapshot.md +3 -3
- package/dist/docs/api/index/type-aliases/EcsWorldStateSnapshotLike.md +4 -4
- package/dist/docs/api/index/type-aliases/ExternalRefWarning.md +5 -5
- package/dist/docs/api/index/type-aliases/HandMaterialOptions.md +32 -0
- package/dist/docs/api/index/type-aliases/HandPoseTrackerOptions.md +27 -0
- package/dist/docs/api/index/type-aliases/HydrateOptions.md +3 -3
- package/dist/docs/api/index/type-aliases/HydrateWorldFromSnapshotResult.md +4 -4
- package/dist/docs/api/index/type-aliases/InstantiateSubtreeResult.md +3 -3
- package/dist/docs/api/index/type-aliases/KeyboardKey.md +1 -1
- package/dist/docs/api/index/type-aliases/ModuleLoader.md +1 -1
- package/dist/docs/api/index/type-aliases/MouseButton.md +1 -1
- package/dist/docs/api/index/type-aliases/NestedRegion.md +5 -5
- package/dist/docs/api/index/type-aliases/NodeKeyMaps.md +5 -5
- package/dist/docs/api/index/type-aliases/NodeMaps.md +4 -4
- package/dist/docs/api/index/type-aliases/PrefabAsset.md +5 -5
- package/dist/docs/api/index/type-aliases/RemapSnapshotOptions.md +2 -2
- package/dist/docs/api/index/type-aliases/RendererKind.md +15 -0
- package/dist/docs/api/index/type-aliases/ScriptBehaviourSystemOptions.md +23 -0
- package/dist/docs/api/index/type-aliases/ScriptErrorEvent.md +39 -0
- package/dist/docs/api/index/type-aliases/ScriptErrorListener.md +25 -0
- package/dist/docs/api/index/type-aliases/ScriptErrorPhase.md +28 -0
- package/dist/docs/api/index/type-aliases/ScriptErrorReport.md +31 -0
- package/dist/docs/api/index/type-aliases/ScriptErrorSource.md +15 -0
- package/dist/docs/api/index/type-aliases/SelectionContext.md +4 -4
- package/dist/docs/api/index/type-aliases/SerializeEntitySubtreeResult.md +4 -4
- package/dist/docs/api/index/type-aliases/SpawnPrefabOptions.md +5 -5
- package/dist/docs/api/index/type-aliases/SpawnPrefabSource.md +1 -1
- package/dist/docs/api/index/type-aliases/SubtreeSnapshot.md +3 -3
- package/dist/docs/api/index/type-aliases/UiCanvasLike.md +46 -0
- package/dist/docs/api/index/type-aliases/VelocitySample.md +23 -0
- package/dist/docs/api/index/type-aliases/XrCapabilities.md +41 -0
- package/dist/docs/api/index/type-aliases/XrFinger.md +13 -0
- package/dist/docs/api/index/type-aliases/XrFingerCurl.md +27 -0
- package/dist/docs/api/index/type-aliases/XrFingerTarget.md +31 -0
- package/dist/docs/api/index/type-aliases/XrHandJointName.md +40 -0
- package/dist/docs/api/index/type-aliases/XrHandJoints.md +18 -0
- package/dist/docs/api/index/type-aliases/XrHandPoseAxis.md +15 -0
- package/dist/docs/api/index/type-aliases/XrHandPoseContext.md +23 -0
- package/dist/docs/api/index/type-aliases/XrHandPoseDefinition.md +47 -0
- package/dist/docs/api/index/type-aliases/XrHandPoseDirection.md +21 -0
- package/dist/docs/api/index/type-aliases/XrHandPoseEvent.md +13 -0
- package/dist/docs/api/index/type-aliases/XrHandPoseEventDetail.md +27 -0
- package/dist/docs/api/index/type-aliases/XrHandPoseMatch.md +25 -0
- package/dist/docs/api/index/type-aliases/XrHandPoseOrientation.md +25 -0
- package/dist/docs/api/index/type-aliases/XrHandShape.md +46 -0
- package/dist/docs/api/index/type-aliases/XrHandedness.md +15 -0
- package/dist/docs/api/index/type-aliases/XrHitResult.md +25 -0
- package/dist/docs/api/index/type-aliases/XrInputKind.md +19 -0
- package/dist/docs/api/index/type-aliases/XrInputState.md +60 -0
- package/dist/docs/api/index/type-aliases/XrPalmPose.md +31 -0
- package/dist/docs/api/index/variables/ADDED_NODE_MARKER_COMPONENT.md +2 -2
- package/dist/docs/api/index/variables/ARC_GRAVITY.md +15 -0
- package/dist/docs/api/index/variables/ARC_MAX_TIME.md +15 -0
- package/dist/docs/api/index/variables/ARC_SPEED.md +15 -0
- package/dist/docs/api/index/variables/ARC_STEPS.md +15 -0
- package/dist/docs/api/index/variables/CURLED_COS.md +13 -0
- package/dist/docs/api/index/variables/DEFAULT_DIRECTION_TOLERANCE.md +15 -0
- package/dist/docs/api/index/variables/DEFAULT_ENTER_CONFIDENCE.md +13 -0
- package/dist/docs/api/index/variables/DEFAULT_EXIT_CONFIDENCE.md +13 -0
- package/dist/docs/api/index/variables/DEFAULT_LOST_GRACE_SECONDS.md +13 -0
- package/dist/docs/api/index/variables/DEFAULT_MIN_HOLD_SECONDS.md +13 -0
- package/dist/docs/api/index/variables/DEFAULT_SCRIPT_ERROR_RETRY_DELAY.md +17 -0
- package/dist/docs/api/index/variables/FALLBACK_HAND_SCALE.md +15 -0
- package/dist/docs/api/index/variables/HAND_POSE_PRESETS.md +19 -0
- package/dist/docs/api/index/variables/HAND_POSE_PRESET_IDS.md +15 -0
- package/dist/docs/api/index/variables/HYDRATABLE_ENTITY_KINDS.md +1 -1
- package/dist/docs/api/index/variables/KeyboardKeys.md +89 -89
- package/dist/docs/api/index/variables/MATCH_FALLOFF.md +15 -0
- package/dist/docs/api/index/variables/MAX_PLAUSIBLE_SPEED.md +25 -0
- package/dist/docs/api/index/variables/MAX_SAMPLE_AGE_SECONDS.md +18 -0
- package/dist/docs/api/index/variables/NODE_KEY_SEPARATOR.md +1 -1
- package/dist/docs/api/index/variables/NO_XR_CAPABILITIES.md +15 -0
- package/dist/docs/api/index/variables/OVERRIDE_DIFF_EXCLUDED_COMPONENTS.md +1 -1
- package/dist/docs/api/index/variables/OVERRIDE_ROOT_EXCLUDED_COMPONENTS.md +1 -1
- package/dist/docs/api/index/variables/PINCH_FINGERS.md +15 -0
- package/dist/docs/api/index/variables/PREFAB_FILE_VERSION.md +1 -1
- package/dist/docs/api/index/variables/PREFAB_FILE_VERSION_NESTED.md +1 -1
- package/dist/docs/api/index/variables/SCRIPT_OBJECT_ROOT_FLAG.md +1 -1
- package/dist/docs/api/index/variables/SHARED_MODEL_RESOURCE_FLAG.md +1 -1
- package/dist/docs/api/index/variables/STRAIGHT_COS.md +19 -0
- package/dist/docs/api/index/variables/VELOCITY_SAMPLES.md +15 -0
- package/dist/docs/api/index/variables/XR_FINGERS.md +13 -0
- package/dist/docs/api/index/variables/XR_HOVER_SHELL_FLAG.md +15 -0
- package/dist/docs/api/index/variables/webglBackend.md +16 -0
- package/dist/docs/api/typedoc-sidebar.json +1 -1
- package/dist/docs/api/types/type-aliases/AssetInput.md +3 -3
- package/dist/docs/api/types/type-aliases/CheckboxInput.md +3 -3
- package/dist/docs/api/types/type-aliases/ColorInput.md +1 -1
- package/dist/docs/api/types/type-aliases/ComponentInput.md +4 -4
- package/dist/docs/api/types/type-aliases/ComponentKind.md +1 -1
- package/dist/docs/api/types/type-aliases/DropdownInput.md +3 -3
- package/dist/docs/api/types/type-aliases/DropdownOption.md +3 -3
- package/dist/docs/api/types/type-aliases/EcsEntityEditorKind.md +1 -1
- package/dist/docs/api/types/type-aliases/EcsEntityKind.md +10 -2
- package/dist/docs/api/types/type-aliases/EntityId.md +1 -1
- package/dist/docs/api/types/type-aliases/EntityInput.md +3 -3
- package/dist/docs/api/types/type-aliases/FloatInput.md +1 -1
- package/dist/docs/api/types/type-aliases/IntersectionResult.md +3 -3
- package/dist/docs/api/types/type-aliases/ParentLookup.md +3 -3
- package/dist/docs/api/types/type-aliases/SelectionListener.md +1 -1
- package/dist/docs/api/types/type-aliases/SliderInput.md +5 -5
- package/dist/docs/api/types/type-aliases/TextInput.md +1 -1
- package/dist/docs/api/types/type-aliases/ToggleInput.md +1 -1
- package/dist/docs/api/types/type-aliases/Vec3.md +1 -1
- package/dist/docs/api/types/type-aliases/Vector2Input.md +3 -3
- package/dist/docs/api/types/type-aliases/Vector3Input.md +4 -4
- package/dist/docs/api/types/type-aliases/WorldEntityView.md +1 -1
- package/dist/docs/guide/audio-mixing-and-sound-banks.md +71 -0
- package/dist/docs/guide/authoring-a-behaviour.md +3 -3
- package/dist/docs/guide/authoring-a-script-object.md +12 -9
- package/dist/docs/guide/behaviour-data-binding/index.md +11 -11
- package/dist/docs/guide/behaviour-lifecycle.md +9 -0
- package/dist/docs/guide/bone-attachments-and-ik.md +128 -0
- package/dist/docs/guide/component-catalog.md +10 -2
- package/dist/docs/guide/components/light.md +42 -0
- package/dist/docs/guide/components/model.md +32 -3
- package/dist/docs/guide/concepts.md +2 -2
- package/dist/docs/guide/getting-started/creating-objects.md +2 -2
- package/dist/docs/guide/getting-started/editing-objects.md +2 -2
- package/dist/docs/guide/getting-started/editor/ai-agent.md +227 -0
- package/dist/docs/guide/getting-started/editor/hierarchy.md +2 -2
- package/dist/docs/guide/getting-started/editor/index.md +3 -2
- package/dist/docs/guide/getting-started/editor/inspector.md +2 -2
- package/dist/docs/guide/getting-started/editor/scene-inspector.md +3 -3
- package/dist/docs/guide/getting-started/editor/toolbar.md +11 -11
- package/dist/docs/guide/getting-started/editor/viewport.md +17 -9
- package/dist/docs/guide/getting-started/index.md +1 -1
- package/dist/docs/guide/getting-started/installation.md +1 -1
- package/dist/docs/guide/getting-started/preview-and-test.md +7 -7
- package/dist/docs/guide/getting-started/project-types/image-tracking.md +23 -11
- package/dist/docs/guide/getting-started/project-types/index.md +4 -4
- package/dist/docs/guide/getting-started/project-types/vr.md +270 -2
- package/dist/docs/guide/getting-started/projects.md +4 -5
- package/dist/docs/guide/getting-started/shortcuts.md +5 -4
- package/dist/docs/guide/multiplayer.md +92 -0
- package/dist/docs/guide/scene/environment.md +101 -4
- package/dist/docs/guide/scene/index.md +4 -4
- package/dist/docs/guide/scene/postprocessing.md +67 -5
- package/dist/docs/guide/spawning/area-light.md +2 -0
- package/dist/docs/guide/systems/environment-sync-system.md +11 -6
- package/dist/docs/guide/systems/light-sync-system.md +5 -3
- package/dist/docs/guide/systems/postprocessing-sync-system.md +16 -6
- package/dist/docs/guide/systems/render-system.md +7 -6
- package/dist/docs/guide/systems/script-behaviour-system.md +7 -5
- package/dist/docs/guide/systems/script-object-system.md +3 -1
- package/dist/docs/guide/systems/video-system.md +1 -1
- package/dist/docs/guide/webgpu-and-tsl.md +415 -0
- package/dist/docs/guide/world-api.md +52 -2
- package/dist/factories/index.cjs +770 -283
- package/dist/factories/index.cjs.map +1 -1
- package/dist/factories/index.d.cts +14 -3
- package/dist/factories/index.d.ts +14 -3
- package/dist/factories/index.js +7 -4
- package/dist/{index-D2Jt_JzH.d.ts → index-C61n65PE.d.ts} +135 -42
- package/dist/{index-DaG03vyN.d.cts → index-C70N4BYG.d.cts} +135 -42
- package/dist/{index-C3ik3sA1.d.ts → index-D9DjrUn3.d.cts} +25 -3
- package/dist/{index-Dlr-7-4m.d.cts → index-DppafVu4.d.ts} +25 -3
- package/dist/index.cjs +3642 -1263
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +113 -11
- package/dist/index.d.ts +113 -11
- package/dist/index.js +187 -12
- package/dist/index.js.map +1 -1
- package/dist/network/index.cjs +4896 -0
- package/dist/network/index.cjs.map +1 -0
- package/dist/network/index.d.cts +98 -0
- package/dist/network/index.d.ts +98 -0
- package/dist/network/index.js +493 -0
- package/dist/network/index.js.map +1 -0
- package/dist/systems/index.cjs +3958 -1762
- package/dist/systems/index.cjs.map +1 -1
- package/dist/systems/index.d.cts +4 -2
- package/dist/systems/index.d.ts +4 -2
- package/dist/systems/index.js +8 -4
- package/dist/types.d.cts +3 -1
- package/dist/types.d.ts +3 -1
- package/dist/webgpu/index.d.ts +113 -0
- package/dist/webgpu/index.js +302 -0
- package/dist/webgpu/index.js.map +1 -0
- package/dist/worldSnapshotUtils.d.cts +3 -1
- package/dist/worldSnapshotUtils.d.ts +3 -1
- package/dist/worldSnapshotUtils.js +3 -2
- package/package.json +19 -3
- package/dist/chunk-BUEKOSR5.js.map +0 -1
- package/dist/chunk-DF5SSRN6.js.map +0 -1
- package/dist/chunk-OWQSESTO.js.map +0 -1
- package/dist/chunk-OY7ZODZP.js.map +0 -1
- package/dist/chunk-RXBLOO5B.js.map +0 -1
- package/dist/chunk-WJD2VKEH.js +0 -315
- package/dist/chunk-WJD2VKEH.js.map +0 -1
package/dist/factories/index.cjs
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var SkeletonUtils_js = require('three/examples/jsm/utils/SkeletonUtils.js');
|
|
5
|
-
var RectAreaLightHelper_js = require('three/examples/jsm/helpers/RectAreaLightHelper.js');
|
|
3
|
+
var THREE2 = require('three');
|
|
6
4
|
var DRACOLoader_js = require('three/examples/jsm/loaders/DRACOLoader.js');
|
|
7
5
|
var GLTFLoader_js = require('three/examples/jsm/loaders/GLTFLoader.js');
|
|
6
|
+
var meshopt_decoder_module_js = require('three/examples/jsm/libs/meshopt_decoder.module.js');
|
|
7
|
+
var SkeletonUtils_js = require('three/examples/jsm/utils/SkeletonUtils.js');
|
|
8
|
+
var RectAreaLightHelper_js = require('three/examples/jsm/helpers/RectAreaLightHelper.js');
|
|
9
|
+
var EffectComposer_js = require('three/examples/jsm/postprocessing/EffectComposer.js');
|
|
10
|
+
var RenderPass_js = require('three/examples/jsm/postprocessing/RenderPass.js');
|
|
11
|
+
var UnrealBloomPass_js = require('three/examples/jsm/postprocessing/UnrealBloomPass.js');
|
|
12
|
+
var DotScreenPass_js = require('three/examples/jsm/postprocessing/DotScreenPass.js');
|
|
13
|
+
var GlitchPass_js = require('three/examples/jsm/postprocessing/GlitchPass.js');
|
|
14
|
+
var FilmPass_js = require('three/examples/jsm/postprocessing/FilmPass.js');
|
|
15
|
+
var BokehPass_js = require('three/examples/jsm/postprocessing/BokehPass.js');
|
|
16
|
+
var SSAOPass_js = require('three/examples/jsm/postprocessing/SSAOPass.js');
|
|
17
|
+
var ShaderPass_js = require('three/examples/jsm/postprocessing/ShaderPass.js');
|
|
18
|
+
var OutputPass_js = require('three/examples/jsm/postprocessing/OutputPass.js');
|
|
19
|
+
var SMAAPass_js = require('three/examples/jsm/postprocessing/SMAAPass.js');
|
|
20
|
+
var HueSaturationShader_js = require('three/examples/jsm/shaders/HueSaturationShader.js');
|
|
21
|
+
var RGBShiftShader_js = require('three/examples/jsm/shaders/RGBShiftShader.js');
|
|
22
|
+
var SepiaShader_js = require('three/examples/jsm/shaders/SepiaShader.js');
|
|
23
|
+
var VignetteShader_js = require('three/examples/jsm/shaders/VignetteShader.js');
|
|
8
24
|
|
|
9
25
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
26
|
function _interopNamespace(e) {
|
|
@@ -25,7 +41,7 @@ function _interopNamespace(e) {
|
|
|
25
41
|
return Object.freeze(n);
|
|
26
42
|
}
|
|
27
43
|
|
|
28
|
-
var
|
|
44
|
+
var THREE2__namespace = /*#__PURE__*/_interopNamespace(THREE2);
|
|
29
45
|
|
|
30
46
|
var __defProp = Object.defineProperty;
|
|
31
47
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -298,14 +314,14 @@ var _AnimationComponent = class _AnimationComponent extends Component {
|
|
|
298
314
|
return;
|
|
299
315
|
}
|
|
300
316
|
this.importedClips = clips.map((entry) => {
|
|
301
|
-
if (entry instanceof
|
|
317
|
+
if (entry instanceof THREE2__namespace.AnimationClip) {
|
|
302
318
|
return { clip: entry, sourceUrl: null };
|
|
303
319
|
}
|
|
304
320
|
if (!entry || typeof entry !== "object") {
|
|
305
321
|
return null;
|
|
306
322
|
}
|
|
307
323
|
const candidate = entry;
|
|
308
|
-
if (!(candidate.clip instanceof
|
|
324
|
+
if (!(candidate.clip instanceof THREE2__namespace.AnimationClip)) {
|
|
309
325
|
return null;
|
|
310
326
|
}
|
|
311
327
|
return {
|
|
@@ -448,7 +464,8 @@ var DEFAULT_AUDIO_OPTIONS = {
|
|
|
448
464
|
positional: false,
|
|
449
465
|
refDistance: 1,
|
|
450
466
|
distanceModel: "inverse",
|
|
451
|
-
rolloffFactor: 1
|
|
467
|
+
rolloffFactor: 1,
|
|
468
|
+
bus: "sfx"
|
|
452
469
|
};
|
|
453
470
|
var _AudioComponent = class _AudioComponent extends Component {
|
|
454
471
|
constructor(path, options = {}) {
|
|
@@ -513,11 +530,11 @@ function normalizeDistanceModel(distanceModel) {
|
|
|
513
530
|
}
|
|
514
531
|
__name(normalizeDistanceModel, "normalizeDistanceModel");
|
|
515
532
|
function createConfiguredAudio(listener, options) {
|
|
516
|
-
const sound = options.positional ? new
|
|
533
|
+
const sound = options.positional ? new THREE2__namespace.PositionalAudio(listener) : new THREE2__namespace.Audio(listener);
|
|
517
534
|
sound.setLoop(options.loop);
|
|
518
535
|
sound.setVolume(options.volume);
|
|
519
536
|
sound.setPlaybackRate(options.pitch);
|
|
520
|
-
if (sound instanceof
|
|
537
|
+
if (sound instanceof THREE2__namespace.PositionalAudio) {
|
|
521
538
|
sound.setRefDistance(options.refDistance);
|
|
522
539
|
sound.setDistanceModel(normalizeDistanceModel(options.distanceModel));
|
|
523
540
|
sound.setRolloffFactor(options.rolloffFactor);
|
|
@@ -527,16 +544,16 @@ function createConfiguredAudio(listener, options) {
|
|
|
527
544
|
__name(createConfiguredAudio, "createConfiguredAudio");
|
|
528
545
|
function createAudioEditorHelper() {
|
|
529
546
|
if (typeof document === "undefined") {
|
|
530
|
-
const geometry = new
|
|
531
|
-
new
|
|
547
|
+
const geometry = new THREE2__namespace.EdgesGeometry(
|
|
548
|
+
new THREE2__namespace.OctahedronGeometry(0.22, 0)
|
|
532
549
|
);
|
|
533
|
-
const material2 = new
|
|
550
|
+
const material2 = new THREE2__namespace.LineBasicMaterial({
|
|
534
551
|
color: "#8bc8ff",
|
|
535
552
|
transparent: true,
|
|
536
553
|
opacity: 0.95,
|
|
537
554
|
depthTest: false
|
|
538
555
|
});
|
|
539
|
-
const fallback = new
|
|
556
|
+
const fallback = new THREE2__namespace.LineSegments(geometry, material2);
|
|
540
557
|
fallback.renderOrder = 10;
|
|
541
558
|
fallback.userData.ecsHelper = true;
|
|
542
559
|
fallback.visible = false;
|
|
@@ -548,7 +565,7 @@ function createAudioEditorHelper() {
|
|
|
548
565
|
canvas.height = size;
|
|
549
566
|
const ctx = canvas.getContext("2d");
|
|
550
567
|
if (!ctx) {
|
|
551
|
-
return new
|
|
568
|
+
return new THREE2__namespace.Object3D();
|
|
552
569
|
}
|
|
553
570
|
ctx.clearRect(0, 0, size, size);
|
|
554
571
|
ctx.fillStyle = "rgba(27, 35, 52, 0.9)";
|
|
@@ -579,14 +596,14 @@ function createAudioEditorHelper() {
|
|
|
579
596
|
ctx.beginPath();
|
|
580
597
|
ctx.arc(56, 48, 16, -0.8, 0.8);
|
|
581
598
|
ctx.stroke();
|
|
582
|
-
const texture = new
|
|
599
|
+
const texture = new THREE2__namespace.CanvasTexture(canvas);
|
|
583
600
|
texture.needsUpdate = true;
|
|
584
|
-
const material = new
|
|
601
|
+
const material = new THREE2__namespace.SpriteMaterial({
|
|
585
602
|
map: texture,
|
|
586
603
|
transparent: true,
|
|
587
604
|
depthTest: false
|
|
588
605
|
});
|
|
589
|
-
const helper = new
|
|
606
|
+
const helper = new THREE2__namespace.Sprite(material);
|
|
590
607
|
helper.scale.set(0.68, 0.68, 0.68);
|
|
591
608
|
helper.renderOrder = 10;
|
|
592
609
|
helper.userData.ecsHelper = true;
|
|
@@ -620,7 +637,7 @@ var DEFAULT_ORTHO_TOP = 5;
|
|
|
620
637
|
var DEFAULT_ORTHO_BOTTOM = -5;
|
|
621
638
|
var DEFAULT_ZOOM = 1;
|
|
622
639
|
function inferProjection(camera) {
|
|
623
|
-
if (camera instanceof
|
|
640
|
+
if (camera instanceof THREE2__namespace.OrthographicCamera) {
|
|
624
641
|
return "orthographic";
|
|
625
642
|
}
|
|
626
643
|
return "perspective";
|
|
@@ -641,7 +658,7 @@ function readCameraFar(camera) {
|
|
|
641
658
|
}
|
|
642
659
|
__name(readCameraFar, "readCameraFar");
|
|
643
660
|
function inferFov(camera) {
|
|
644
|
-
if (camera instanceof
|
|
661
|
+
if (camera instanceof THREE2__namespace.PerspectiveCamera && Number.isFinite(camera.fov)) {
|
|
645
662
|
return camera.fov;
|
|
646
663
|
}
|
|
647
664
|
return DEFAULT_FOV;
|
|
@@ -664,28 +681,28 @@ function inferFar(camera) {
|
|
|
664
681
|
}
|
|
665
682
|
__name(inferFar, "inferFar");
|
|
666
683
|
function inferOrthoLeft(camera) {
|
|
667
|
-
if (camera instanceof
|
|
684
|
+
if (camera instanceof THREE2__namespace.OrthographicCamera && Number.isFinite(camera.left)) {
|
|
668
685
|
return camera.left;
|
|
669
686
|
}
|
|
670
687
|
return DEFAULT_ORTHO_LEFT;
|
|
671
688
|
}
|
|
672
689
|
__name(inferOrthoLeft, "inferOrthoLeft");
|
|
673
690
|
function inferOrthoRight(camera) {
|
|
674
|
-
if (camera instanceof
|
|
691
|
+
if (camera instanceof THREE2__namespace.OrthographicCamera && Number.isFinite(camera.right)) {
|
|
675
692
|
return camera.right;
|
|
676
693
|
}
|
|
677
694
|
return DEFAULT_ORTHO_RIGHT;
|
|
678
695
|
}
|
|
679
696
|
__name(inferOrthoRight, "inferOrthoRight");
|
|
680
697
|
function inferOrthoTop(camera) {
|
|
681
|
-
if (camera instanceof
|
|
698
|
+
if (camera instanceof THREE2__namespace.OrthographicCamera && Number.isFinite(camera.top)) {
|
|
682
699
|
return camera.top;
|
|
683
700
|
}
|
|
684
701
|
return DEFAULT_ORTHO_TOP;
|
|
685
702
|
}
|
|
686
703
|
__name(inferOrthoTop, "inferOrthoTop");
|
|
687
704
|
function inferOrthoBottom(camera) {
|
|
688
|
-
if (camera instanceof
|
|
705
|
+
if (camera instanceof THREE2__namespace.OrthographicCamera && Number.isFinite(camera.bottom)) {
|
|
689
706
|
return camera.bottom;
|
|
690
707
|
}
|
|
691
708
|
return DEFAULT_ORTHO_BOTTOM;
|
|
@@ -701,7 +718,7 @@ __name(inferZoom, "inferZoom");
|
|
|
701
718
|
var _CameraComponent = class _CameraComponent extends Component {
|
|
702
719
|
constructor(payload = {}) {
|
|
703
720
|
super();
|
|
704
|
-
this.camera = payload.camera ?? new
|
|
721
|
+
this.camera = payload.camera ?? new THREE2__namespace.PerspectiveCamera();
|
|
705
722
|
this.type = payload.type ?? "3d";
|
|
706
723
|
this.isDefault = typeof payload.isDefault === "boolean" ? payload.isDefault : false;
|
|
707
724
|
this.projection = payload.projection ?? inferProjection(payload.camera);
|
|
@@ -732,7 +749,7 @@ var Object3DRef = _Object3DRef;
|
|
|
732
749
|
// core/factories/components/CameraFactory.ts
|
|
733
750
|
function createCameraComponent(world, entityId, payload = {}) {
|
|
734
751
|
const object = world.getComponent(entityId, Object3DRef)?.object;
|
|
735
|
-
const objectCamera = object instanceof
|
|
752
|
+
const objectCamera = object instanceof THREE2__namespace.Camera ? object : void 0;
|
|
736
753
|
const component = new CameraComponent({
|
|
737
754
|
...payload,
|
|
738
755
|
camera: payload.camera ?? objectCamera
|
|
@@ -1068,6 +1085,16 @@ function createPhysicsComponent(world, entityId, values) {
|
|
|
1068
1085
|
__name(createPhysicsComponent, "createPhysicsComponent");
|
|
1069
1086
|
|
|
1070
1087
|
// core/components/Environment.ts
|
|
1088
|
+
var DEFAULT_ENVIRONMENT_LIGHTING = {
|
|
1089
|
+
envMapUrl: "",
|
|
1090
|
+
envIntensity: 1,
|
|
1091
|
+
envRotationY: 0,
|
|
1092
|
+
useAsBackground: false,
|
|
1093
|
+
backgroundBlurriness: 0,
|
|
1094
|
+
backgroundIntensity: 1,
|
|
1095
|
+
toneMapping: "none",
|
|
1096
|
+
exposure: 1
|
|
1097
|
+
};
|
|
1071
1098
|
var DEFAULT_ENVIRONMENT_STATE = {
|
|
1072
1099
|
skybox: {
|
|
1073
1100
|
type: "none",
|
|
@@ -1140,22 +1167,62 @@ function toFiniteNumber2(value, fallback) {
|
|
|
1140
1167
|
return value;
|
|
1141
1168
|
}
|
|
1142
1169
|
__name(toFiniteNumber2, "toFiniteNumber");
|
|
1170
|
+
function normalizeImageProjection(value) {
|
|
1171
|
+
return value === "screen" || value === "equirect" ? value : void 0;
|
|
1172
|
+
}
|
|
1173
|
+
__name(normalizeImageProjection, "normalizeImageProjection");
|
|
1174
|
+
function normalizeToneMapping(value) {
|
|
1175
|
+
if (value === "none" || value === "aces" || value === "agx" || value === "neutral") {
|
|
1176
|
+
return value;
|
|
1177
|
+
}
|
|
1178
|
+
return DEFAULT_ENVIRONMENT_LIGHTING.toneMapping;
|
|
1179
|
+
}
|
|
1180
|
+
__name(normalizeToneMapping, "normalizeToneMapping");
|
|
1181
|
+
function normalizeEnvironmentLighting(value) {
|
|
1182
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
1183
|
+
return void 0;
|
|
1184
|
+
}
|
|
1185
|
+
const lighting = value;
|
|
1186
|
+
const defaults = DEFAULT_ENVIRONMENT_LIGHTING;
|
|
1187
|
+
return {
|
|
1188
|
+
envMapUrl: typeof lighting.envMapUrl === "string" ? lighting.envMapUrl : defaults.envMapUrl,
|
|
1189
|
+
envIntensity: Math.max(0, toFiniteNumber2(lighting.envIntensity, defaults.envIntensity)),
|
|
1190
|
+
envRotationY: toFiniteNumber2(lighting.envRotationY, defaults.envRotationY),
|
|
1191
|
+
useAsBackground: typeof lighting.useAsBackground === "boolean" ? lighting.useAsBackground : defaults.useAsBackground,
|
|
1192
|
+
backgroundBlurriness: Math.min(
|
|
1193
|
+
1,
|
|
1194
|
+
Math.max(0, toFiniteNumber2(lighting.backgroundBlurriness, defaults.backgroundBlurriness))
|
|
1195
|
+
),
|
|
1196
|
+
backgroundIntensity: Math.max(
|
|
1197
|
+
0,
|
|
1198
|
+
toFiniteNumber2(lighting.backgroundIntensity, defaults.backgroundIntensity)
|
|
1199
|
+
),
|
|
1200
|
+
toneMapping: normalizeToneMapping(lighting.toneMapping),
|
|
1201
|
+
exposure: Math.max(0, toFiniteNumber2(lighting.exposure, defaults.exposure))
|
|
1202
|
+
};
|
|
1203
|
+
}
|
|
1204
|
+
__name(normalizeEnvironmentLighting, "normalizeEnvironmentLighting");
|
|
1143
1205
|
var _Environment = class _Environment extends Component {
|
|
1144
1206
|
constructor(values) {
|
|
1145
1207
|
super();
|
|
1146
1208
|
const skybox = values?.skybox;
|
|
1147
1209
|
const fog = values?.fog;
|
|
1148
1210
|
const gravity = values?.gravity;
|
|
1211
|
+
const skyboxState = {
|
|
1212
|
+
type: normalizeSkyboxType(skybox?.type),
|
|
1213
|
+
color: typeof skybox?.color === "string" ? skybox.color : DEFAULT_ENVIRONMENT_STATE.skybox.color,
|
|
1214
|
+
imageUrl: typeof skybox?.imageUrl === "string" ? skybox.imageUrl : DEFAULT_ENVIRONMENT_STATE.skybox.imageUrl,
|
|
1215
|
+
gradient: {
|
|
1216
|
+
colors: normalizeColors(skybox?.gradient?.colors),
|
|
1217
|
+
effect: normalizeGradientEffect(skybox?.gradient?.effect)
|
|
1218
|
+
}
|
|
1219
|
+
};
|
|
1220
|
+
const imageProjection = normalizeImageProjection(skybox?.imageProjection);
|
|
1221
|
+
if (imageProjection) {
|
|
1222
|
+
skyboxState.imageProjection = imageProjection;
|
|
1223
|
+
}
|
|
1149
1224
|
this.values = {
|
|
1150
|
-
skybox:
|
|
1151
|
-
type: normalizeSkyboxType(skybox?.type),
|
|
1152
|
-
color: typeof skybox?.color === "string" ? skybox.color : DEFAULT_ENVIRONMENT_STATE.skybox.color,
|
|
1153
|
-
imageUrl: typeof skybox?.imageUrl === "string" ? skybox.imageUrl : DEFAULT_ENVIRONMENT_STATE.skybox.imageUrl,
|
|
1154
|
-
gradient: {
|
|
1155
|
-
colors: normalizeColors(skybox?.gradient?.colors),
|
|
1156
|
-
effect: normalizeGradientEffect(skybox?.gradient?.effect)
|
|
1157
|
-
}
|
|
1158
|
-
},
|
|
1225
|
+
skybox: skyboxState,
|
|
1159
1226
|
fog: {
|
|
1160
1227
|
type: normalizeFogType(fog?.type),
|
|
1161
1228
|
color: typeof fog?.color === "string" ? fog.color : DEFAULT_ENVIRONMENT_STATE.fog.color,
|
|
@@ -1186,6 +1253,10 @@ var _Environment = class _Environment extends Component {
|
|
|
1186
1253
|
DEFAULT_ENVIRONMENT_STATE.fixedTimeStep
|
|
1187
1254
|
)
|
|
1188
1255
|
};
|
|
1256
|
+
const lighting = normalizeEnvironmentLighting(values?.lighting);
|
|
1257
|
+
if (lighting) {
|
|
1258
|
+
this.values.lighting = lighting;
|
|
1259
|
+
}
|
|
1189
1260
|
}
|
|
1190
1261
|
};
|
|
1191
1262
|
__name(_Environment, "Environment");
|
|
@@ -1290,15 +1361,15 @@ function createValueState(light) {
|
|
|
1290
1361
|
castShadow: light.castShadow ?? false,
|
|
1291
1362
|
frustumCulling: light.frustumCulled
|
|
1292
1363
|
};
|
|
1293
|
-
if (light instanceof
|
|
1364
|
+
if (light instanceof THREE2__namespace.PointLight) {
|
|
1294
1365
|
base.distance = light.distance;
|
|
1295
1366
|
base.decay = light.decay;
|
|
1296
|
-
} else if (light instanceof
|
|
1367
|
+
} else if (light instanceof THREE2__namespace.SpotLight) {
|
|
1297
1368
|
base.distance = light.distance;
|
|
1298
1369
|
base.decay = light.decay;
|
|
1299
1370
|
base.angle = light.angle;
|
|
1300
1371
|
base.penumbra = light.penumbra;
|
|
1301
|
-
} else if (light instanceof
|
|
1372
|
+
} else if (light instanceof THREE2__namespace.RectAreaLight) {
|
|
1302
1373
|
base.width = light.width;
|
|
1303
1374
|
base.height = light.height;
|
|
1304
1375
|
}
|
|
@@ -1341,13 +1412,13 @@ function toHexColor2(value, fallback) {
|
|
|
1341
1412
|
}
|
|
1342
1413
|
__name(toHexColor2, "toHexColor");
|
|
1343
1414
|
function getMaterialType(material) {
|
|
1344
|
-
if (material instanceof
|
|
1415
|
+
if (material instanceof THREE2__namespace.MeshPhysicalMaterial) {
|
|
1345
1416
|
return "physical";
|
|
1346
1417
|
}
|
|
1347
|
-
if (material instanceof
|
|
1418
|
+
if (material instanceof THREE2__namespace.MeshPhongMaterial) {
|
|
1348
1419
|
return "phong";
|
|
1349
1420
|
}
|
|
1350
|
-
if (material instanceof
|
|
1421
|
+
if (material instanceof THREE2__namespace.MeshBasicMaterial) {
|
|
1351
1422
|
return "basic";
|
|
1352
1423
|
}
|
|
1353
1424
|
return "standard";
|
|
@@ -1382,8 +1453,8 @@ function createMaterialValue(material) {
|
|
|
1382
1453
|
opacity: typeof materialRecord.opacity === "number" ? materialRecord.opacity : 1,
|
|
1383
1454
|
emissive: toHexColor2(materialRecord.emissive, "#000000"),
|
|
1384
1455
|
emissiveIntensity: typeof materialRecord.emissiveIntensity === "number" ? materialRecord.emissiveIntensity : 0,
|
|
1385
|
-
side: typeof materialRecord.side === "number" ? materialRecord.side :
|
|
1386
|
-
blending: typeof materialRecord.blending === "number" ? materialRecord.blending :
|
|
1456
|
+
side: typeof materialRecord.side === "number" ? materialRecord.side : THREE2__namespace.FrontSide,
|
|
1457
|
+
blending: typeof materialRecord.blending === "number" ? materialRecord.blending : THREE2__namespace.NormalBlending,
|
|
1387
1458
|
depthTest: materialRecord.depthTest !== false,
|
|
1388
1459
|
depthWrite: materialRecord.depthWrite !== false,
|
|
1389
1460
|
wireframe: Boolean(materialRecord.wireframe),
|
|
@@ -1415,7 +1486,7 @@ function createMaterialValue(material) {
|
|
|
1415
1486
|
materialRecord.lightMap
|
|
1416
1487
|
),
|
|
1417
1488
|
envMap: textureImageSrc(materialRecord.envMap),
|
|
1418
|
-
textureFiltering: map?.magFilter ===
|
|
1489
|
+
textureFiltering: map?.magFilter === THREE2__namespace.NearestFilter ? "sharp" : "smooth",
|
|
1419
1490
|
useMipmaps: map?.generateMipmaps !== false
|
|
1420
1491
|
};
|
|
1421
1492
|
}
|
|
@@ -1430,8 +1501,8 @@ function defaultMaterialValue() {
|
|
|
1430
1501
|
opacity: 1,
|
|
1431
1502
|
emissive: "#000000",
|
|
1432
1503
|
emissiveIntensity: 0,
|
|
1433
|
-
side:
|
|
1434
|
-
blending:
|
|
1504
|
+
side: THREE2__namespace.FrontSide,
|
|
1505
|
+
blending: THREE2__namespace.NormalBlending,
|
|
1435
1506
|
depthTest: true,
|
|
1436
1507
|
depthWrite: true,
|
|
1437
1508
|
wireframe: false,
|
|
@@ -1542,11 +1613,32 @@ function createMeshGeometryComponent(world, entityId, ...args) {
|
|
|
1542
1613
|
__name(createMeshGeometryComponent, "createMeshGeometryComponent");
|
|
1543
1614
|
|
|
1544
1615
|
// core/components/Model.ts
|
|
1616
|
+
var MODEL_NO_PATH_MESSAGE = "No model path set.";
|
|
1617
|
+
function setModelLoadState(component, state, error) {
|
|
1618
|
+
Object.defineProperty(component, "loadState", {
|
|
1619
|
+
value: state,
|
|
1620
|
+
writable: true,
|
|
1621
|
+
configurable: true,
|
|
1622
|
+
enumerable: false
|
|
1623
|
+
});
|
|
1624
|
+
Object.defineProperty(component, "loadError", {
|
|
1625
|
+
value: state === "error" ? error ?? "Failed to load model." : void 0,
|
|
1626
|
+
writable: true,
|
|
1627
|
+
configurable: true,
|
|
1628
|
+
enumerable: false
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
__name(setModelLoadState, "setModelLoadState");
|
|
1545
1632
|
var _ModelComponent = class _ModelComponent extends Component {
|
|
1546
1633
|
constructor(path) {
|
|
1547
1634
|
super();
|
|
1548
1635
|
this.path = path;
|
|
1549
1636
|
this.object = null;
|
|
1637
|
+
if (path) {
|
|
1638
|
+
setModelLoadState(this, "loading");
|
|
1639
|
+
} else {
|
|
1640
|
+
setModelLoadState(this, "error", MODEL_NO_PATH_MESSAGE);
|
|
1641
|
+
}
|
|
1550
1642
|
}
|
|
1551
1643
|
};
|
|
1552
1644
|
__name(_ModelComponent, "ModelComponent");
|
|
@@ -2002,14 +2094,14 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
2002
2094
|
z: scale.z ?? 1
|
|
2003
2095
|
};
|
|
2004
2096
|
}
|
|
2005
|
-
toPositionVector3(target = new
|
|
2097
|
+
toPositionVector3(target = new THREE2.Vector3()) {
|
|
2006
2098
|
return target.set(this.position.x, this.position.y, this.position.z);
|
|
2007
2099
|
}
|
|
2008
|
-
toRotationEuler(target = new
|
|
2100
|
+
toRotationEuler(target = new THREE2.Euler(), order = "XYZ") {
|
|
2009
2101
|
return target.set(this.rotation.x, this.rotation.y, this.rotation.z, order);
|
|
2010
2102
|
}
|
|
2011
|
-
toRotationQuaternion(target = new
|
|
2012
|
-
const euler = new
|
|
2103
|
+
toRotationQuaternion(target = new THREE2.Quaternion(), order = "XYZ") {
|
|
2104
|
+
const euler = new THREE2.Euler(
|
|
2013
2105
|
this.rotation.x,
|
|
2014
2106
|
this.rotation.y,
|
|
2015
2107
|
this.rotation.z,
|
|
@@ -2017,7 +2109,7 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
2017
2109
|
);
|
|
2018
2110
|
return target.setFromEuler(euler);
|
|
2019
2111
|
}
|
|
2020
|
-
toScaleVector3(target = new
|
|
2112
|
+
toScaleVector3(target = new THREE2.Vector3()) {
|
|
2021
2113
|
return target.set(this.scale.x, this.scale.y, this.scale.z);
|
|
2022
2114
|
}
|
|
2023
2115
|
setPosition(input) {
|
|
@@ -2035,8 +2127,8 @@ var _TransformComponent = class _TransformComponent extends Component {
|
|
|
2035
2127
|
return this;
|
|
2036
2128
|
}
|
|
2037
2129
|
setRotation(input, order = "XYZ") {
|
|
2038
|
-
if (input instanceof
|
|
2039
|
-
const euler = new
|
|
2130
|
+
if (input instanceof THREE2.Quaternion) {
|
|
2131
|
+
const euler = new THREE2.Euler().setFromQuaternion(input, order);
|
|
2040
2132
|
this.rotation.x = euler.x;
|
|
2041
2133
|
this.rotation.y = euler.y;
|
|
2042
2134
|
this.rotation.z = euler.z;
|
|
@@ -2361,6 +2453,134 @@ function createXRAnchorComponent(world, entityId, ...args) {
|
|
|
2361
2453
|
}
|
|
2362
2454
|
__name(createXRAnchorComponent, "createXRAnchorComponent");
|
|
2363
2455
|
|
|
2456
|
+
// core/components/BoneAttachment.ts
|
|
2457
|
+
var _BoneAttachmentComponent = class _BoneAttachmentComponent extends Component {
|
|
2458
|
+
constructor(options) {
|
|
2459
|
+
super();
|
|
2460
|
+
this.bone = options?.bone ?? "";
|
|
2461
|
+
this.humanoid = options?.humanoid ?? null;
|
|
2462
|
+
this.compensateScale = options?.compensateScale ?? true;
|
|
2463
|
+
this.enabled = options?.enabled ?? true;
|
|
2464
|
+
}
|
|
2465
|
+
};
|
|
2466
|
+
__name(_BoneAttachmentComponent, "BoneAttachmentComponent");
|
|
2467
|
+
var BoneAttachmentComponent = _BoneAttachmentComponent;
|
|
2468
|
+
|
|
2469
|
+
// core/factories/components/BoneAttachmentFactory.ts
|
|
2470
|
+
function createBoneAttachmentComponent(world, entityId, ...args) {
|
|
2471
|
+
const component = new BoneAttachmentComponent(...args);
|
|
2472
|
+
world.addComponent(entityId, component);
|
|
2473
|
+
return component;
|
|
2474
|
+
}
|
|
2475
|
+
__name(createBoneAttachmentComponent, "createBoneAttachmentComponent");
|
|
2476
|
+
|
|
2477
|
+
// core/components/IK.ts
|
|
2478
|
+
function normalizeIKChain(chain) {
|
|
2479
|
+
const weight = typeof chain.weight === "number" && Number.isFinite(chain.weight) ? chain.weight : 1;
|
|
2480
|
+
return {
|
|
2481
|
+
limb: chain.limb,
|
|
2482
|
+
target: typeof chain.target === "number" ? chain.target : null,
|
|
2483
|
+
pole: typeof chain.pole === "number" ? chain.pole : null,
|
|
2484
|
+
weight: Math.min(1, Math.max(0, weight)),
|
|
2485
|
+
matchRotation: chain.matchRotation ?? false,
|
|
2486
|
+
enabled: chain.enabled ?? true
|
|
2487
|
+
};
|
|
2488
|
+
}
|
|
2489
|
+
__name(normalizeIKChain, "normalizeIKChain");
|
|
2490
|
+
var _IKComponent = class _IKComponent extends Component {
|
|
2491
|
+
constructor(options) {
|
|
2492
|
+
super();
|
|
2493
|
+
this.chains = (options?.chains ?? []).map(normalizeIKChain);
|
|
2494
|
+
this.enabled = options?.enabled ?? true;
|
|
2495
|
+
}
|
|
2496
|
+
};
|
|
2497
|
+
__name(_IKComponent, "IKComponent");
|
|
2498
|
+
var IKComponent = _IKComponent;
|
|
2499
|
+
|
|
2500
|
+
// core/factories/components/IKFactory.ts
|
|
2501
|
+
function createIKComponent(world, entityId, ...args) {
|
|
2502
|
+
const component = new IKComponent(...args);
|
|
2503
|
+
world.addComponent(entityId, component);
|
|
2504
|
+
return component;
|
|
2505
|
+
}
|
|
2506
|
+
__name(createIKComponent, "createIKComponent");
|
|
2507
|
+
|
|
2508
|
+
// core/components/Network.ts
|
|
2509
|
+
var _NetworkIdentityComponent = class _NetworkIdentityComponent extends Component {
|
|
2510
|
+
constructor() {
|
|
2511
|
+
super();
|
|
2512
|
+
for (const key of ["networkId", "owner"]) {
|
|
2513
|
+
Object.defineProperty(this, key, {
|
|
2514
|
+
value: "",
|
|
2515
|
+
writable: true,
|
|
2516
|
+
configurable: true,
|
|
2517
|
+
enumerable: false
|
|
2518
|
+
});
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
};
|
|
2522
|
+
__name(_NetworkIdentityComponent, "NetworkIdentityComponent");
|
|
2523
|
+
var NetworkIdentityComponent = _NetworkIdentityComponent;
|
|
2524
|
+
var _NetworkTransformComponent = class _NetworkTransformComponent extends Component {
|
|
2525
|
+
constructor(options = {}) {
|
|
2526
|
+
super();
|
|
2527
|
+
this.enabled = true;
|
|
2528
|
+
/** Updates per second the owner sends. */
|
|
2529
|
+
this.sendRate = 20;
|
|
2530
|
+
/** How far in the past others see it, in ms. More is smoother; less is more current. */
|
|
2531
|
+
this.interpolationMs = 100;
|
|
2532
|
+
this.syncRotation = true;
|
|
2533
|
+
/** A jump longer than this (m) snaps instead of sliding, for respawns and teleports. */
|
|
2534
|
+
this.teleportDistance = 5;
|
|
2535
|
+
Object.assign(this, options);
|
|
2536
|
+
}
|
|
2537
|
+
};
|
|
2538
|
+
__name(_NetworkTransformComponent, "NetworkTransformComponent");
|
|
2539
|
+
var NetworkTransformComponent = _NetworkTransformComponent;
|
|
2540
|
+
var _NetworkedPropsComponent = class _NetworkedPropsComponent extends Component {
|
|
2541
|
+
constructor(values = {}) {
|
|
2542
|
+
super();
|
|
2543
|
+
this.values = values;
|
|
2544
|
+
}
|
|
2545
|
+
};
|
|
2546
|
+
__name(_NetworkedPropsComponent, "NetworkedPropsComponent");
|
|
2547
|
+
var NetworkedPropsComponent = _NetworkedPropsComponent;
|
|
2548
|
+
var _NetworkSpawnerComponent = class _NetworkSpawnerComponent extends Component {
|
|
2549
|
+
constructor(playerPrefab = "", spawnRadius = 2) {
|
|
2550
|
+
super();
|
|
2551
|
+
this.playerPrefab = playerPrefab;
|
|
2552
|
+
this.spawnRadius = spawnRadius;
|
|
2553
|
+
}
|
|
2554
|
+
};
|
|
2555
|
+
__name(_NetworkSpawnerComponent, "NetworkSpawnerComponent");
|
|
2556
|
+
var NetworkSpawnerComponent = _NetworkSpawnerComponent;
|
|
2557
|
+
|
|
2558
|
+
// core/factories/components/NetworkFactory.ts
|
|
2559
|
+
function createNetworkIdentityComponent(world, entityId) {
|
|
2560
|
+
const component = new NetworkIdentityComponent();
|
|
2561
|
+
world.addComponent(entityId, component);
|
|
2562
|
+
return component;
|
|
2563
|
+
}
|
|
2564
|
+
__name(createNetworkIdentityComponent, "createNetworkIdentityComponent");
|
|
2565
|
+
function createNetworkTransformComponent(world, entityId, ...args) {
|
|
2566
|
+
const component = new NetworkTransformComponent(...args);
|
|
2567
|
+
world.addComponent(entityId, component);
|
|
2568
|
+
return component;
|
|
2569
|
+
}
|
|
2570
|
+
__name(createNetworkTransformComponent, "createNetworkTransformComponent");
|
|
2571
|
+
function createNetworkedPropsComponent(world, entityId, ...args) {
|
|
2572
|
+
const component = new NetworkedPropsComponent(...args);
|
|
2573
|
+
world.addComponent(entityId, component);
|
|
2574
|
+
return component;
|
|
2575
|
+
}
|
|
2576
|
+
__name(createNetworkedPropsComponent, "createNetworkedPropsComponent");
|
|
2577
|
+
function createNetworkSpawnerComponent(world, entityId, ...args) {
|
|
2578
|
+
const component = new NetworkSpawnerComponent(...args);
|
|
2579
|
+
world.addComponent(entityId, component);
|
|
2580
|
+
return component;
|
|
2581
|
+
}
|
|
2582
|
+
__name(createNetworkSpawnerComponent, "createNetworkSpawnerComponent");
|
|
2583
|
+
|
|
2364
2584
|
// core/components/XRInteractable.ts
|
|
2365
2585
|
var _XRInteractableComponent = class _XRInteractableComponent extends Component {
|
|
2366
2586
|
constructor(options) {
|
|
@@ -2607,6 +2827,12 @@ function registerDefaultComponentFactories(objectManagementSystem) {
|
|
|
2607
2827
|
objectManagementSystem.registerComponentFactory("vrTeleportArea", createVRTeleportAreaComponent);
|
|
2608
2828
|
objectManagementSystem.registerComponentFactory("xrHandPose", createXRHandPoseComponent);
|
|
2609
2829
|
objectManagementSystem.registerComponentFactory("xrAnchor", createXRAnchorComponent);
|
|
2830
|
+
objectManagementSystem.registerComponentFactory("boneAttachment", createBoneAttachmentComponent);
|
|
2831
|
+
objectManagementSystem.registerComponentFactory("ik", createIKComponent);
|
|
2832
|
+
objectManagementSystem.registerComponentFactory("networkIdentity", createNetworkIdentityComponent);
|
|
2833
|
+
objectManagementSystem.registerComponentFactory("networkTransform", createNetworkTransformComponent);
|
|
2834
|
+
objectManagementSystem.registerComponentFactory("networkedProps", createNetworkedPropsComponent);
|
|
2835
|
+
objectManagementSystem.registerComponentFactory("networkSpawner", createNetworkSpawnerComponent);
|
|
2610
2836
|
objectManagementSystem.registerComponentFactory("uiPanel", createUIPanelComponent);
|
|
2611
2837
|
objectManagementSystem.registerComponentFactory("uiText", createUITextComponent);
|
|
2612
2838
|
objectManagementSystem.registerComponentFactory("uiButton", createUIButtonComponent);
|
|
@@ -2654,11 +2880,49 @@ function registerDefaultComponentFactories(objectManagementSystem) {
|
|
|
2654
2880
|
objectManagementSystem.registerComponentFactory("instancedMesh", createInstancedMeshComponent);
|
|
2655
2881
|
}
|
|
2656
2882
|
__name(registerDefaultComponentFactories, "registerDefaultComponentFactories");
|
|
2883
|
+
|
|
2884
|
+
// core/utils/dracoDecoderPath.ts
|
|
2885
|
+
var LOCAL_DRACO_DECODER_RELATIVE_PATH = "./assets/draco/";
|
|
2886
|
+
var DRACO_DECODER_CDN_PATH = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/";
|
|
2887
|
+
function isBlockedBrowserFileUrl(url) {
|
|
2888
|
+
return url.startsWith("file://");
|
|
2889
|
+
}
|
|
2890
|
+
__name(isBlockedBrowserFileUrl, "isBlockedBrowserFileUrl");
|
|
2891
|
+
function resolveDracoDecoderPath() {
|
|
2892
|
+
try {
|
|
2893
|
+
const resolvedPath = new URL(
|
|
2894
|
+
LOCAL_DRACO_DECODER_RELATIVE_PATH,
|
|
2895
|
+
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))
|
|
2896
|
+
).toString();
|
|
2897
|
+
if (isBlockedBrowserFileUrl(resolvedPath)) {
|
|
2898
|
+
return DRACO_DECODER_CDN_PATH;
|
|
2899
|
+
}
|
|
2900
|
+
return resolvedPath;
|
|
2901
|
+
} catch {
|
|
2902
|
+
return DRACO_DECODER_CDN_PATH;
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
__name(resolveDracoDecoderPath, "resolveDracoDecoderPath");
|
|
2906
|
+
|
|
2907
|
+
// core/utils/gltfLoader.ts
|
|
2908
|
+
function createGLTFLoader() {
|
|
2909
|
+
const loader = new GLTFLoader_js.GLTFLoader();
|
|
2910
|
+
try {
|
|
2911
|
+
const dracoLoader = new DRACOLoader_js.DRACOLoader();
|
|
2912
|
+
dracoLoader.setDecoderPath(resolveDracoDecoderPath());
|
|
2913
|
+
loader.setDRACOLoader(dracoLoader);
|
|
2914
|
+
} catch (error) {
|
|
2915
|
+
console.warn("DRACOLoader could not be configured. Loading non-Draco models only.", error);
|
|
2916
|
+
}
|
|
2917
|
+
loader.setMeshoptDecoder(meshopt_decoder_module_js.MeshoptDecoder);
|
|
2918
|
+
return loader;
|
|
2919
|
+
}
|
|
2920
|
+
__name(createGLTFLoader, "createGLTFLoader");
|
|
2657
2921
|
var SHARED_MODEL_RESOURCE_FLAG = "spatialEcsSharedModelResource";
|
|
2658
2922
|
var modelCache = /* @__PURE__ */ new Map();
|
|
2659
2923
|
function markSharedResources(root) {
|
|
2660
2924
|
root.traverse((child) => {
|
|
2661
|
-
if (!(child instanceof
|
|
2925
|
+
if (!(child instanceof THREE2__namespace.Mesh)) {
|
|
2662
2926
|
return;
|
|
2663
2927
|
}
|
|
2664
2928
|
if (child.geometry) {
|
|
@@ -2693,7 +2957,108 @@ function cloneModelScene(scene) {
|
|
|
2693
2957
|
}
|
|
2694
2958
|
__name(cloneModelScene, "cloneModelScene");
|
|
2695
2959
|
|
|
2960
|
+
// core/factories/objects/ModelFactory.ts
|
|
2961
|
+
function getModelFileName(path) {
|
|
2962
|
+
const segments = path.split(/[\\/]/).filter(Boolean);
|
|
2963
|
+
return segments[segments.length - 1] ?? "";
|
|
2964
|
+
}
|
|
2965
|
+
__name(getModelFileName, "getModelFileName");
|
|
2966
|
+
function createModelLoader() {
|
|
2967
|
+
return createGLTFLoader();
|
|
2968
|
+
}
|
|
2969
|
+
__name(createModelLoader, "createModelLoader");
|
|
2970
|
+
function createModel({
|
|
2971
|
+
world,
|
|
2972
|
+
scene,
|
|
2973
|
+
payload,
|
|
2974
|
+
isEditor
|
|
2975
|
+
}) {
|
|
2976
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
2977
|
+
const modelPath = payload.path ?? "";
|
|
2978
|
+
const entityId = createBaseEntity(world, anchor, {
|
|
2979
|
+
label: payload.name ?? "Model",
|
|
2980
|
+
entityType: "model",
|
|
2981
|
+
transformInput: payload.transform
|
|
2982
|
+
});
|
|
2983
|
+
const model = createModelComponent(world, entityId, modelPath);
|
|
2984
|
+
createMeshGeometryComponent(world, entityId, "model", anchor, {}, {
|
|
2985
|
+
modelName: getModelFileName(modelPath),
|
|
2986
|
+
castShadow: false,
|
|
2987
|
+
receiveShadow: false
|
|
2988
|
+
});
|
|
2989
|
+
model.object = anchor;
|
|
2990
|
+
scene.add(anchor);
|
|
2991
|
+
if (!modelPath) {
|
|
2992
|
+
return entityId;
|
|
2993
|
+
}
|
|
2994
|
+
setModelLoadState(model, "loading");
|
|
2995
|
+
loadModelInto({ world, entityId, anchor, modelPath, isEditor: Boolean(isEditor) });
|
|
2996
|
+
return entityId;
|
|
2997
|
+
}
|
|
2998
|
+
__name(createModel, "createModel");
|
|
2999
|
+
function loadModelInto({
|
|
3000
|
+
world,
|
|
3001
|
+
entityId,
|
|
3002
|
+
anchor,
|
|
3003
|
+
modelPath,
|
|
3004
|
+
isEditor
|
|
3005
|
+
}) {
|
|
3006
|
+
const model = world.getComponent(entityId, ModelComponent);
|
|
3007
|
+
const meshGeometry = world.getComponent(entityId, MeshGeometryComponent);
|
|
3008
|
+
if (!model) return;
|
|
3009
|
+
const attachLoadedModel = /* @__PURE__ */ __name((gltf, object) => {
|
|
3010
|
+
if (!world.hasEntity(entityId) || world.getComponent(entityId, ModelComponent) !== model) {
|
|
3011
|
+
return;
|
|
3012
|
+
}
|
|
3013
|
+
object.userData.entityId = entityId;
|
|
3014
|
+
object.traverse((child) => {
|
|
3015
|
+
child.userData.entityId = entityId;
|
|
3016
|
+
});
|
|
3017
|
+
anchor.add(object);
|
|
3018
|
+
model.object = object;
|
|
3019
|
+
if (meshGeometry) meshGeometry.object = object;
|
|
3020
|
+
if (gltf.animations.length > 0) {
|
|
3021
|
+
let animation = world.getComponent(entityId, AnimationComponent);
|
|
3022
|
+
if (!animation) {
|
|
3023
|
+
animation = createAnimationComponent(world, entityId, {
|
|
3024
|
+
clips: gltf.animations,
|
|
3025
|
+
externalClipSources: [],
|
|
3026
|
+
paused: false,
|
|
3027
|
+
reverse: false,
|
|
3028
|
+
timeScale: 1,
|
|
3029
|
+
crossFadeDuration: 0
|
|
3030
|
+
});
|
|
3031
|
+
}
|
|
3032
|
+
animation.setModelClips(gltf.animations);
|
|
3033
|
+
}
|
|
3034
|
+
setModelLoadState(model, "loaded");
|
|
3035
|
+
}, "attachLoadedModel");
|
|
3036
|
+
const onLoadError = /* @__PURE__ */ __name((error) => {
|
|
3037
|
+
const message = error instanceof Error && error.message ? error.message : typeof error === "string" && error ? error : `Failed to load model: ${modelPath}`;
|
|
3038
|
+
setModelLoadState(model, "error", message);
|
|
3039
|
+
console.error(`Failed to load model: ${modelPath}`, error);
|
|
3040
|
+
}, "onLoadError");
|
|
3041
|
+
if (isEditor) {
|
|
3042
|
+
createModelLoader().load(
|
|
3043
|
+
modelPath,
|
|
3044
|
+
(gltf) => attachLoadedModel(gltf, gltf.scene),
|
|
3045
|
+
void 0,
|
|
3046
|
+
onLoadError
|
|
3047
|
+
);
|
|
3048
|
+
} else {
|
|
3049
|
+
loadSharedGltf(
|
|
3050
|
+
modelPath,
|
|
3051
|
+
() => new Promise((resolve, reject) => {
|
|
3052
|
+
createModelLoader().load(modelPath, resolve, void 0, reject);
|
|
3053
|
+
})
|
|
3054
|
+
).then((gltf) => attachLoadedModel(gltf, cloneModelScene(gltf.scene))).catch(onLoadError);
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
__name(loadModelInto, "loadModelInto");
|
|
3058
|
+
|
|
2696
3059
|
// core/systems/ObjectManagementSystem.ts
|
|
3060
|
+
new THREE2__namespace.Vector3();
|
|
3061
|
+
new THREE2__namespace.Vector3();
|
|
2697
3062
|
function createTransform(input) {
|
|
2698
3063
|
return new TransformComponent(input);
|
|
2699
3064
|
}
|
|
@@ -2732,10 +3097,10 @@ __name(createBaseEntity, "createBaseEntity");
|
|
|
2732
3097
|
// core/factories/objects/AudioFactory.ts
|
|
2733
3098
|
function getOrCreateListener(camera) {
|
|
2734
3099
|
const existing = camera.userData.ecsAudioListener;
|
|
2735
|
-
if (existing instanceof
|
|
3100
|
+
if (existing instanceof THREE2__namespace.AudioListener) {
|
|
2736
3101
|
return existing;
|
|
2737
3102
|
}
|
|
2738
|
-
const listener = new
|
|
3103
|
+
const listener = new THREE2__namespace.AudioListener();
|
|
2739
3104
|
camera.add(listener);
|
|
2740
3105
|
camera.userData.ecsAudioListener = listener;
|
|
2741
3106
|
return listener;
|
|
@@ -2748,7 +3113,7 @@ function createAudio({
|
|
|
2748
3113
|
payload,
|
|
2749
3114
|
isEditor
|
|
2750
3115
|
}) {
|
|
2751
|
-
const anchor = new
|
|
3116
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
2752
3117
|
const entityId = createBaseEntity(world, anchor, {
|
|
2753
3118
|
label: payload.name ?? "Audio",
|
|
2754
3119
|
entityType: "audio",
|
|
@@ -2770,7 +3135,7 @@ function createAudio({
|
|
|
2770
3135
|
return entityId;
|
|
2771
3136
|
}
|
|
2772
3137
|
if (!isEditor) {
|
|
2773
|
-
const loader = new
|
|
3138
|
+
const loader = new THREE2__namespace.AudioLoader();
|
|
2774
3139
|
loader.load(
|
|
2775
3140
|
audio.path,
|
|
2776
3141
|
(buffer) => {
|
|
@@ -2845,7 +3210,7 @@ function applyCameraSettings(camera, options) {
|
|
|
2845
3210
|
const near = typeof options.near === "number" ? options.near : DEFAULT_NEAR2;
|
|
2846
3211
|
const far = typeof options.far === "number" ? options.far : DEFAULT_FAR2;
|
|
2847
3212
|
const projection = options.projection;
|
|
2848
|
-
if (camera instanceof
|
|
3213
|
+
if (camera instanceof THREE2__namespace.PerspectiveCamera) {
|
|
2849
3214
|
if (!projection || projection === "perspective") {
|
|
2850
3215
|
camera.fov = typeof options.fov === "number" ? options.fov : DEFAULT_FOV2;
|
|
2851
3216
|
}
|
|
@@ -2855,7 +3220,7 @@ function applyCameraSettings(camera, options) {
|
|
|
2855
3220
|
camera.updateProjectionMatrix();
|
|
2856
3221
|
return;
|
|
2857
3222
|
}
|
|
2858
|
-
if (camera instanceof
|
|
3223
|
+
if (camera instanceof THREE2__namespace.OrthographicCamera) {
|
|
2859
3224
|
camera.left = typeof options.left === "number" ? options.left : -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2860
3225
|
camera.right = typeof options.right === "number" ? options.right : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2861
3226
|
camera.top = typeof options.top === "number" ? options.top : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
@@ -2876,7 +3241,7 @@ function createCameraObject(options) {
|
|
|
2876
3241
|
const bottom = options.bottom ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2877
3242
|
const left = options.left ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2878
3243
|
const right = options.right ?? DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2879
|
-
const camera = new
|
|
3244
|
+
const camera = new THREE2__namespace.OrthographicCamera(
|
|
2880
3245
|
left,
|
|
2881
3246
|
right,
|
|
2882
3247
|
top,
|
|
@@ -2888,7 +3253,7 @@ function createCameraObject(options) {
|
|
|
2888
3253
|
camera.updateProjectionMatrix();
|
|
2889
3254
|
return camera;
|
|
2890
3255
|
}
|
|
2891
|
-
return new
|
|
3256
|
+
return new THREE2__namespace.PerspectiveCamera(
|
|
2892
3257
|
options.fov ?? DEFAULT_FOV2,
|
|
2893
3258
|
readViewportAspect(),
|
|
2894
3259
|
near,
|
|
@@ -2906,7 +3271,7 @@ function createCamera({ world, scene, camera, payload, isEditor }) {
|
|
|
2906
3271
|
transformInput: payload.transform
|
|
2907
3272
|
});
|
|
2908
3273
|
const objectRef = world.getComponent(entityId, Object3DRef);
|
|
2909
|
-
if (objectRef?.object instanceof
|
|
3274
|
+
if (objectRef?.object instanceof THREE2__namespace.Camera) {
|
|
2910
3275
|
objectRef.object.userData.entityId = entityId;
|
|
2911
3276
|
}
|
|
2912
3277
|
const componentOptions = {
|
|
@@ -2938,9 +3303,9 @@ function createCapsule({
|
|
|
2938
3303
|
scene,
|
|
2939
3304
|
payload
|
|
2940
3305
|
}) {
|
|
2941
|
-
const geometry = new
|
|
2942
|
-
const material = new
|
|
2943
|
-
const mesh = new
|
|
3306
|
+
const geometry = new THREE2__namespace.CapsuleGeometry(0.5, 1, 4, 8);
|
|
3307
|
+
const material = new THREE2__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
3308
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
2944
3309
|
const entityId = createBaseEntity(world, mesh, {
|
|
2945
3310
|
label: payload.name ?? "Capsule",
|
|
2946
3311
|
entityType: "capsule",
|
|
@@ -2960,9 +3325,9 @@ function createCapsule({
|
|
|
2960
3325
|
}
|
|
2961
3326
|
__name(createCapsule, "createCapsule");
|
|
2962
3327
|
function createCube({ world, scene, payload }) {
|
|
2963
|
-
const geometry = new
|
|
2964
|
-
const material = new
|
|
2965
|
-
const mesh = new
|
|
3328
|
+
const geometry = new THREE2__namespace.BoxGeometry(1, 1, 1);
|
|
3329
|
+
const material = new THREE2__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
3330
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
2966
3331
|
const entityId = createBaseEntity(world, mesh, {
|
|
2967
3332
|
label: payload.name ?? "Cube",
|
|
2968
3333
|
entityType: "cube",
|
|
@@ -2987,9 +3352,9 @@ function createCylinder({
|
|
|
2987
3352
|
scene,
|
|
2988
3353
|
payload
|
|
2989
3354
|
}) {
|
|
2990
|
-
const geometry = new
|
|
2991
|
-
const material = new
|
|
2992
|
-
const mesh = new
|
|
3355
|
+
const geometry = new THREE2__namespace.CylinderGeometry(0.5, 0.5, 1, 20);
|
|
3356
|
+
const material = new THREE2__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
3357
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
2993
3358
|
const entityId = createBaseEntity(world, mesh, {
|
|
2994
3359
|
label: payload.name ?? "Cylinder",
|
|
2995
3360
|
entityType: "cylinder",
|
|
@@ -3009,7 +3374,7 @@ function createCylinder({
|
|
|
3009
3374
|
}
|
|
3010
3375
|
__name(createCylinder, "createCylinder");
|
|
3011
3376
|
function createEmpty({ world, scene, payload, isEditor }) {
|
|
3012
|
-
const object = new
|
|
3377
|
+
const object = new THREE2__namespace.Group();
|
|
3013
3378
|
const entityId = createBaseEntity(world, object, {
|
|
3014
3379
|
label: payload.name ?? "Empty",
|
|
3015
3380
|
entityType: "empty",
|
|
@@ -3020,7 +3385,7 @@ function createEmpty({ world, scene, payload, isEditor }) {
|
|
|
3020
3385
|
}
|
|
3021
3386
|
__name(createEmpty, "createEmpty");
|
|
3022
3387
|
function createImage({ world, scene, payload }) {
|
|
3023
|
-
const anchor = new
|
|
3388
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3024
3389
|
const imagePath = payload.path ?? "";
|
|
3025
3390
|
const entityId = createBaseEntity(world, anchor, {
|
|
3026
3391
|
label: payload.name ?? "Image",
|
|
@@ -3033,7 +3398,7 @@ function createImage({ world, scene, payload }) {
|
|
|
3033
3398
|
if (!imagePath) {
|
|
3034
3399
|
return entityId;
|
|
3035
3400
|
}
|
|
3036
|
-
const loader = new
|
|
3401
|
+
const loader = new THREE2__namespace.TextureLoader();
|
|
3037
3402
|
loader.load(
|
|
3038
3403
|
imagePath,
|
|
3039
3404
|
(texture) => {
|
|
@@ -3041,13 +3406,13 @@ function createImage({ world, scene, payload }) {
|
|
|
3041
3406
|
texture.dispose();
|
|
3042
3407
|
return;
|
|
3043
3408
|
}
|
|
3044
|
-
const material = new
|
|
3409
|
+
const material = new THREE2__namespace.MeshBasicMaterial({
|
|
3045
3410
|
map: texture,
|
|
3046
3411
|
transparent: true,
|
|
3047
|
-
side:
|
|
3412
|
+
side: THREE2__namespace.DoubleSide
|
|
3048
3413
|
});
|
|
3049
|
-
const geometry = new
|
|
3050
|
-
const plane = new
|
|
3414
|
+
const geometry = new THREE2__namespace.PlaneGeometry(1, 1);
|
|
3415
|
+
const plane = new THREE2__namespace.Mesh(geometry, material);
|
|
3051
3416
|
plane.userData.entityId = entityId;
|
|
3052
3417
|
const textureImage = texture.image;
|
|
3053
3418
|
const width = textureImage?.width ?? 1;
|
|
@@ -3093,7 +3458,7 @@ function createImageTarget({
|
|
|
3093
3458
|
payload,
|
|
3094
3459
|
isEditor
|
|
3095
3460
|
}) {
|
|
3096
|
-
const anchor = new
|
|
3461
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3097
3462
|
const imagePath = payload.path ?? "";
|
|
3098
3463
|
const entityId = createBaseEntity(world, anchor, {
|
|
3099
3464
|
label: payload.name ?? "Image Target",
|
|
@@ -3110,7 +3475,7 @@ function createImageTarget({
|
|
|
3110
3475
|
if (!isEditor || !imagePath) {
|
|
3111
3476
|
return entityId;
|
|
3112
3477
|
}
|
|
3113
|
-
const loader = new
|
|
3478
|
+
const loader = new THREE2__namespace.TextureLoader();
|
|
3114
3479
|
loader.load(
|
|
3115
3480
|
imagePath,
|
|
3116
3481
|
(texture) => {
|
|
@@ -3118,13 +3483,13 @@ function createImageTarget({
|
|
|
3118
3483
|
texture.dispose();
|
|
3119
3484
|
return;
|
|
3120
3485
|
}
|
|
3121
|
-
const material = new
|
|
3486
|
+
const material = new THREE2__namespace.MeshBasicMaterial({
|
|
3122
3487
|
map: texture,
|
|
3123
3488
|
transparent: true,
|
|
3124
|
-
side:
|
|
3489
|
+
side: THREE2__namespace.DoubleSide
|
|
3125
3490
|
});
|
|
3126
|
-
const geometry = new
|
|
3127
|
-
const plane = new
|
|
3491
|
+
const geometry = new THREE2__namespace.PlaneGeometry(1, 1);
|
|
3492
|
+
const plane = new THREE2__namespace.Mesh(geometry, material);
|
|
3128
3493
|
plane.userData.entityId = entityId;
|
|
3129
3494
|
const textureImage = texture.image;
|
|
3130
3495
|
const width = textureImage?.width ?? 1;
|
|
@@ -3175,7 +3540,7 @@ function createInstancedMesh({
|
|
|
3175
3540
|
scene,
|
|
3176
3541
|
payload
|
|
3177
3542
|
}) {
|
|
3178
|
-
const anchor = new
|
|
3543
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3179
3544
|
const opts = payload.options ?? {};
|
|
3180
3545
|
const meshKind = isInstancedMeshKind(opts.meshKind) ? opts.meshKind : "cube";
|
|
3181
3546
|
const meshParameters = opts.meshParameters && typeof opts.meshParameters === "object" ? opts.meshParameters : void 0;
|
|
@@ -3246,7 +3611,7 @@ function createAmbientLight({
|
|
|
3246
3611
|
scene,
|
|
3247
3612
|
payload
|
|
3248
3613
|
}) {
|
|
3249
|
-
const light = new
|
|
3614
|
+
const light = new THREE2__namespace.AmbientLight("#ffffff", 0.6);
|
|
3250
3615
|
const entityId = createBaseEntity(world, light, {
|
|
3251
3616
|
label: payload.name ?? "Ambient Light",
|
|
3252
3617
|
entityType: "ambientLight",
|
|
@@ -3257,13 +3622,272 @@ function createAmbientLight({
|
|
|
3257
3622
|
return entityId;
|
|
3258
3623
|
}
|
|
3259
3624
|
__name(createAmbientLight, "createAmbientLight");
|
|
3625
|
+
var PixelationShader = {
|
|
3626
|
+
name: "PixelationShader",
|
|
3627
|
+
uniforms: {
|
|
3628
|
+
tDiffuse: { value: null },
|
|
3629
|
+
resolution: { value: new THREE2__namespace.Vector2(1, 1) },
|
|
3630
|
+
pixelSize: { value: 6 }
|
|
3631
|
+
},
|
|
3632
|
+
vertexShader: (
|
|
3633
|
+
/* glsl */
|
|
3634
|
+
`
|
|
3635
|
+
varying vec2 vUv;
|
|
3636
|
+
void main() {
|
|
3637
|
+
vUv = uv;
|
|
3638
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
3639
|
+
}
|
|
3640
|
+
`
|
|
3641
|
+
),
|
|
3642
|
+
fragmentShader: (
|
|
3643
|
+
/* glsl */
|
|
3644
|
+
`
|
|
3645
|
+
uniform sampler2D tDiffuse;
|
|
3646
|
+
uniform vec2 resolution;
|
|
3647
|
+
uniform float pixelSize;
|
|
3648
|
+
varying vec2 vUv;
|
|
3649
|
+
void main() {
|
|
3650
|
+
vec2 block = max(pixelSize, 1.0) / resolution;
|
|
3651
|
+
vec2 coord = block * (floor(vUv / block) + 0.5);
|
|
3652
|
+
gl_FragColor = texture2D(tDiffuse, coord);
|
|
3653
|
+
}
|
|
3654
|
+
`
|
|
3655
|
+
)
|
|
3656
|
+
};
|
|
3657
|
+
var _PixelationPass = class _PixelationPass extends ShaderPass_js.ShaderPass {
|
|
3658
|
+
constructor(granularity, getPixelRatio) {
|
|
3659
|
+
super(PixelationShader);
|
|
3660
|
+
this.granularity = Math.max(1, granularity);
|
|
3661
|
+
this.getPixelRatio = getPixelRatio;
|
|
3662
|
+
this.updatePixelSize();
|
|
3663
|
+
}
|
|
3664
|
+
updatePixelSize() {
|
|
3665
|
+
const uniform = this.uniforms.pixelSize;
|
|
3666
|
+
if (uniform) {
|
|
3667
|
+
uniform.value = this.granularity * Math.max(1, this.getPixelRatio());
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
setSize(width, height) {
|
|
3671
|
+
const resolution = this.uniforms.resolution;
|
|
3672
|
+
if (resolution) {
|
|
3673
|
+
resolution.value.set(Math.max(1, width), Math.max(1, height));
|
|
3674
|
+
}
|
|
3675
|
+
this.updatePixelSize();
|
|
3676
|
+
}
|
|
3677
|
+
};
|
|
3678
|
+
__name(_PixelationPass, "PixelationPass");
|
|
3679
|
+
var PixelationPass = _PixelationPass;
|
|
3680
|
+
function createWebglPostprocessing({
|
|
3681
|
+
renderer: rendererInput,
|
|
3682
|
+
scene,
|
|
3683
|
+
camera,
|
|
3684
|
+
values
|
|
3685
|
+
}) {
|
|
3686
|
+
const renderer = rendererInput;
|
|
3687
|
+
const composer = new EffectComposer_js.EffectComposer(renderer);
|
|
3688
|
+
composer.addPass(new RenderPass_js.RenderPass(scene, camera));
|
|
3689
|
+
if (values.dof.enabled) {
|
|
3690
|
+
composer.addPass(
|
|
3691
|
+
new BokehPass_js.BokehPass(scene, camera, {
|
|
3692
|
+
focus: values.dof.focusDistance,
|
|
3693
|
+
aperture: Math.max(0, values.dof.focalLength),
|
|
3694
|
+
maxblur: Math.max(0, values.dof.bokehScale)
|
|
3695
|
+
})
|
|
3696
|
+
);
|
|
3697
|
+
}
|
|
3698
|
+
if (values.bloom.enabled) {
|
|
3699
|
+
const size = renderer.getSize(new THREE2__namespace.Vector2());
|
|
3700
|
+
composer.addPass(
|
|
3701
|
+
new UnrealBloomPass_js.UnrealBloomPass(
|
|
3702
|
+
new THREE2__namespace.Vector2(size.width, size.height),
|
|
3703
|
+
values.bloom.intensity,
|
|
3704
|
+
values.bloom.radius,
|
|
3705
|
+
values.bloom.threshold
|
|
3706
|
+
)
|
|
3707
|
+
);
|
|
3708
|
+
}
|
|
3709
|
+
if (values.vignette.enabled) {
|
|
3710
|
+
const pass = new ShaderPass_js.ShaderPass(VignetteShader_js.VignetteShader);
|
|
3711
|
+
const offset = pass.uniforms.offset;
|
|
3712
|
+
const darkness = pass.uniforms.darkness;
|
|
3713
|
+
if (offset) {
|
|
3714
|
+
offset.value = values.vignette.offset;
|
|
3715
|
+
}
|
|
3716
|
+
if (darkness) {
|
|
3717
|
+
darkness.value = values.vignette.darkness;
|
|
3718
|
+
}
|
|
3719
|
+
composer.addPass(pass);
|
|
3720
|
+
}
|
|
3721
|
+
if (values.hueSaturation.enabled) {
|
|
3722
|
+
const pass = new ShaderPass_js.ShaderPass(HueSaturationShader_js.HueSaturationShader);
|
|
3723
|
+
const hue = pass.uniforms.hue;
|
|
3724
|
+
const saturation = pass.uniforms.saturation;
|
|
3725
|
+
if (hue) {
|
|
3726
|
+
hue.value = values.hueSaturation.hue;
|
|
3727
|
+
}
|
|
3728
|
+
if (saturation) {
|
|
3729
|
+
saturation.value = values.hueSaturation.saturation;
|
|
3730
|
+
}
|
|
3731
|
+
composer.addPass(pass);
|
|
3732
|
+
}
|
|
3733
|
+
if (values.sepia.enabled) {
|
|
3734
|
+
const pass = new ShaderPass_js.ShaderPass(SepiaShader_js.SepiaShader);
|
|
3735
|
+
const amount = pass.uniforms.amount;
|
|
3736
|
+
if (amount) {
|
|
3737
|
+
amount.value = values.sepia.intensity;
|
|
3738
|
+
}
|
|
3739
|
+
composer.addPass(pass);
|
|
3740
|
+
}
|
|
3741
|
+
if (values.noise.enabled) {
|
|
3742
|
+
composer.addPass(new FilmPass_js.FilmPass(values.noise.opacity));
|
|
3743
|
+
}
|
|
3744
|
+
if (values.dotScreen.enabled) {
|
|
3745
|
+
composer.addPass(
|
|
3746
|
+
new DotScreenPass_js.DotScreenPass(
|
|
3747
|
+
new THREE2__namespace.Vector2(0, 0),
|
|
3748
|
+
values.dotScreen.angle ?? values.dotScreen.dotScreenAngle,
|
|
3749
|
+
values.dotScreen.scale ?? values.dotScreen.dotScreenScale
|
|
3750
|
+
)
|
|
3751
|
+
);
|
|
3752
|
+
}
|
|
3753
|
+
if (values.ssao.enabled) {
|
|
3754
|
+
const pass = new SSAOPass_js.SSAOPass(scene, camera);
|
|
3755
|
+
pass.kernelRadius = values.ssao.radius;
|
|
3756
|
+
pass.minDistance = 1e-3;
|
|
3757
|
+
pass.maxDistance = Math.max(0.01, values.ssao.intensity);
|
|
3758
|
+
composer.addPass(pass);
|
|
3759
|
+
}
|
|
3760
|
+
if (values.glitch.enabled) {
|
|
3761
|
+
const pass = new GlitchPass_js.GlitchPass();
|
|
3762
|
+
pass.enabled = true;
|
|
3763
|
+
pass.goWild = Boolean(values.glitch.active);
|
|
3764
|
+
composer.addPass(pass);
|
|
3765
|
+
}
|
|
3766
|
+
if (values.chromAberration.enabled) {
|
|
3767
|
+
const pass = new ShaderPass_js.ShaderPass(RGBShiftShader_js.RGBShiftShader);
|
|
3768
|
+
const { offsetX, offsetY } = values.chromAberration;
|
|
3769
|
+
const amount = pass.uniforms.amount;
|
|
3770
|
+
const angle = pass.uniforms.angle;
|
|
3771
|
+
if (amount) {
|
|
3772
|
+
amount.value = Math.hypot(offsetX, offsetY);
|
|
3773
|
+
}
|
|
3774
|
+
if (angle) {
|
|
3775
|
+
angle.value = Math.atan2(offsetY, offsetX);
|
|
3776
|
+
}
|
|
3777
|
+
composer.addPass(pass);
|
|
3778
|
+
}
|
|
3779
|
+
if (values.pixelation.enabled) {
|
|
3780
|
+
composer.addPass(
|
|
3781
|
+
new PixelationPass(
|
|
3782
|
+
values.pixelation.granularity,
|
|
3783
|
+
() => typeof renderer.getPixelRatio === "function" ? renderer.getPixelRatio() : 1
|
|
3784
|
+
)
|
|
3785
|
+
);
|
|
3786
|
+
}
|
|
3787
|
+
if (values.smaa.enabled) {
|
|
3788
|
+
composer.addPass(new SMAAPass_js.SMAAPass());
|
|
3789
|
+
}
|
|
3790
|
+
composer.addPass(new OutputPass_js.OutputPass());
|
|
3791
|
+
return composer;
|
|
3792
|
+
}
|
|
3793
|
+
__name(createWebglPostprocessing, "createWebglPostprocessing");
|
|
3794
|
+
var CHROMA_KEY_FLAG = "ecsChromaKey";
|
|
3795
|
+
function createWebglChromaKeyMaterial(texture, options) {
|
|
3796
|
+
const material = new THREE2__namespace.ShaderMaterial({
|
|
3797
|
+
uniforms: {
|
|
3798
|
+
tex: { value: texture },
|
|
3799
|
+
keyColor: { value: new THREE2__namespace.Color(options.keyColor) },
|
|
3800
|
+
similarity: { value: options.similarity },
|
|
3801
|
+
smoothness: { value: options.smoothness },
|
|
3802
|
+
spill: { value: options.spill }
|
|
3803
|
+
},
|
|
3804
|
+
vertexShader: `
|
|
3805
|
+
varying vec2 vUv;
|
|
3806
|
+
void main() {
|
|
3807
|
+
vUv = uv;
|
|
3808
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
3809
|
+
}
|
|
3810
|
+
`,
|
|
3811
|
+
fragmentShader: `
|
|
3812
|
+
uniform sampler2D tex;
|
|
3813
|
+
uniform vec3 keyColor;
|
|
3814
|
+
uniform float similarity;
|
|
3815
|
+
uniform float smoothness;
|
|
3816
|
+
uniform float spill;
|
|
3817
|
+
varying vec2 vUv;
|
|
3818
|
+
|
|
3819
|
+
void main() {
|
|
3820
|
+
vec4 texel = texture2D(tex, vUv);
|
|
3821
|
+
float chromaDist = distance(texel.rgb, keyColor);
|
|
3822
|
+
float alpha = smoothstep(similarity, similarity + smoothness, chromaDist);
|
|
3823
|
+
|
|
3824
|
+
float spillFactor = smoothstep(similarity, similarity + spill + smoothness, chromaDist);
|
|
3825
|
+
vec3 despilled = mix(vec3(dot(texel.rgb, vec3(0.299, 0.587, 0.114))), texel.rgb, spillFactor);
|
|
3826
|
+
|
|
3827
|
+
gl_FragColor = vec4(despilled, texel.a * alpha);
|
|
3828
|
+
}
|
|
3829
|
+
`,
|
|
3830
|
+
transparent: true,
|
|
3831
|
+
side: THREE2__namespace.DoubleSide
|
|
3832
|
+
});
|
|
3833
|
+
material.userData[CHROMA_KEY_FLAG] = true;
|
|
3834
|
+
return material;
|
|
3835
|
+
}
|
|
3836
|
+
__name(createWebglChromaKeyMaterial, "createWebglChromaKeyMaterial");
|
|
3837
|
+
function updateWebglChromaKeyMaterial(material, options) {
|
|
3838
|
+
if (!(material instanceof THREE2__namespace.ShaderMaterial)) return false;
|
|
3839
|
+
const { keyColor, similarity, smoothness, spill } = material.uniforms;
|
|
3840
|
+
if (!keyColor || !similarity || !smoothness || !spill) return false;
|
|
3841
|
+
keyColor.value.set(options.keyColor);
|
|
3842
|
+
similarity.value = options.similarity;
|
|
3843
|
+
smoothness.value = options.smoothness;
|
|
3844
|
+
spill.value = options.spill;
|
|
3845
|
+
return true;
|
|
3846
|
+
}
|
|
3847
|
+
__name(updateWebglChromaKeyMaterial, "updateWebglChromaKeyMaterial");
|
|
3848
|
+
var areaLightTablesRequested = false;
|
|
3849
|
+
function prepareWebglAreaLights() {
|
|
3850
|
+
if (areaLightTablesRequested) return;
|
|
3851
|
+
areaLightTablesRequested = true;
|
|
3852
|
+
import('three/examples/jsm/lights/RectAreaLightUniformsLib.js').then(
|
|
3853
|
+
({ RectAreaLightUniformsLib }) => {
|
|
3854
|
+
RectAreaLightUniformsLib.init();
|
|
3855
|
+
},
|
|
3856
|
+
(error) => {
|
|
3857
|
+
areaLightTablesRequested = false;
|
|
3858
|
+
console.warn("[spatial-ecs] Could not load the area light tables.", error);
|
|
3859
|
+
}
|
|
3860
|
+
);
|
|
3861
|
+
}
|
|
3862
|
+
__name(prepareWebglAreaLights, "prepareWebglAreaLights");
|
|
3863
|
+
var webglBackend = {
|
|
3864
|
+
kind: "webgl",
|
|
3865
|
+
prepareAreaLights: prepareWebglAreaLights,
|
|
3866
|
+
createPostprocessing: createWebglPostprocessing,
|
|
3867
|
+
createChromaKeyMaterial: createWebglChromaKeyMaterial,
|
|
3868
|
+
updateChromaKeyMaterial: updateWebglChromaKeyMaterial
|
|
3869
|
+
};
|
|
3870
|
+
|
|
3871
|
+
// core/render/resolveBackend.ts
|
|
3872
|
+
function readWorldRenderBackend(world) {
|
|
3873
|
+
const getter = world?.getRenderBackend;
|
|
3874
|
+
if (typeof getter === "function") {
|
|
3875
|
+
const backend = getter.call(world);
|
|
3876
|
+
if (backend) return backend;
|
|
3877
|
+
}
|
|
3878
|
+
return webglBackend;
|
|
3879
|
+
}
|
|
3880
|
+
__name(readWorldRenderBackend, "readWorldRenderBackend");
|
|
3881
|
+
|
|
3882
|
+
// core/factories/objects/lights/AreaLightFactory.ts
|
|
3260
3883
|
function createAreaLight({
|
|
3261
3884
|
world,
|
|
3262
3885
|
scene,
|
|
3263
3886
|
payload,
|
|
3264
3887
|
isEditor
|
|
3265
3888
|
}) {
|
|
3266
|
-
|
|
3889
|
+
readWorldRenderBackend(world).prepareAreaLights?.(world);
|
|
3890
|
+
const light = new THREE2__namespace.RectAreaLight("#ffffff", 5, 4, 4);
|
|
3267
3891
|
light.lookAt(0, 0, 0);
|
|
3268
3892
|
const entityId = createBaseEntity(world, light, {
|
|
3269
3893
|
label: payload.name ?? "Area Light",
|
|
@@ -3292,7 +3916,7 @@ function createDirectionalLight({
|
|
|
3292
3916
|
payload,
|
|
3293
3917
|
isEditor
|
|
3294
3918
|
}) {
|
|
3295
|
-
const light = new
|
|
3919
|
+
const light = new THREE2__namespace.DirectionalLight("#ffffff", 1.5);
|
|
3296
3920
|
light.castShadow = true;
|
|
3297
3921
|
const entityId = createBaseEntity(world, light, {
|
|
3298
3922
|
label: payload.name ?? "Directional Light",
|
|
@@ -3303,7 +3927,7 @@ function createDirectionalLight({
|
|
|
3303
3927
|
});
|
|
3304
3928
|
createLightComponent(world, entityId, light);
|
|
3305
3929
|
if (isEditor) {
|
|
3306
|
-
const helper = new
|
|
3930
|
+
const helper = new THREE2__namespace.DirectionalLightHelper(light, 1.8, "#38bdf8");
|
|
3307
3931
|
helper.onBeforeRender = () => {
|
|
3308
3932
|
helper.update();
|
|
3309
3933
|
};
|
|
@@ -3321,7 +3945,7 @@ function createPointLight({
|
|
|
3321
3945
|
payload,
|
|
3322
3946
|
isEditor
|
|
3323
3947
|
}) {
|
|
3324
|
-
const light = new
|
|
3948
|
+
const light = new THREE2__namespace.PointLight("#ffffff", 1, 10);
|
|
3325
3949
|
const entityId = createBaseEntity(world, light, {
|
|
3326
3950
|
label: payload.name ?? "Point Light",
|
|
3327
3951
|
entityType: "pointLight",
|
|
@@ -3331,7 +3955,7 @@ function createPointLight({
|
|
|
3331
3955
|
});
|
|
3332
3956
|
createLightComponent(world, entityId, light);
|
|
3333
3957
|
if (isEditor) {
|
|
3334
|
-
const helper = new
|
|
3958
|
+
const helper = new THREE2__namespace.PointLightHelper(light, 0.35, "#fbbf24");
|
|
3335
3959
|
helper.onBeforeRender = () => {
|
|
3336
3960
|
helper.update();
|
|
3337
3961
|
};
|
|
@@ -3349,7 +3973,7 @@ function createSpotLight({
|
|
|
3349
3973
|
payload,
|
|
3350
3974
|
isEditor
|
|
3351
3975
|
}) {
|
|
3352
|
-
const light = new
|
|
3976
|
+
const light = new THREE2__namespace.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
|
|
3353
3977
|
const entityId = createBaseEntity(world, light, {
|
|
3354
3978
|
label: payload.name ?? "Spot Light",
|
|
3355
3979
|
entityType: "spotLight",
|
|
@@ -3359,7 +3983,7 @@ function createSpotLight({
|
|
|
3359
3983
|
});
|
|
3360
3984
|
createLightComponent(world, entityId, light);
|
|
3361
3985
|
if (isEditor) {
|
|
3362
|
-
const helper = new
|
|
3986
|
+
const helper = new THREE2__namespace.SpotLightHelper(light, "#f59e0b");
|
|
3363
3987
|
helper.onBeforeRender = () => {
|
|
3364
3988
|
helper.update();
|
|
3365
3989
|
};
|
|
@@ -3371,126 +3995,13 @@ function createSpotLight({
|
|
|
3371
3995
|
return entityId;
|
|
3372
3996
|
}
|
|
3373
3997
|
__name(createSpotLight, "createSpotLight");
|
|
3374
|
-
|
|
3375
|
-
// core/utils/dracoDecoderPath.ts
|
|
3376
|
-
var LOCAL_DRACO_DECODER_RELATIVE_PATH = "./assets/draco/";
|
|
3377
|
-
var DRACO_DECODER_CDN_PATH = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/";
|
|
3378
|
-
function isBlockedBrowserFileUrl(url) {
|
|
3379
|
-
return url.startsWith("file://");
|
|
3380
|
-
}
|
|
3381
|
-
__name(isBlockedBrowserFileUrl, "isBlockedBrowserFileUrl");
|
|
3382
|
-
function resolveDracoDecoderPath() {
|
|
3383
|
-
try {
|
|
3384
|
-
const resolvedPath = new URL(
|
|
3385
|
-
LOCAL_DRACO_DECODER_RELATIVE_PATH,
|
|
3386
|
-
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))
|
|
3387
|
-
).toString();
|
|
3388
|
-
if (isBlockedBrowserFileUrl(resolvedPath)) {
|
|
3389
|
-
return DRACO_DECODER_CDN_PATH;
|
|
3390
|
-
}
|
|
3391
|
-
return resolvedPath;
|
|
3392
|
-
} catch {
|
|
3393
|
-
return DRACO_DECODER_CDN_PATH;
|
|
3394
|
-
}
|
|
3395
|
-
}
|
|
3396
|
-
__name(resolveDracoDecoderPath, "resolveDracoDecoderPath");
|
|
3397
|
-
|
|
3398
|
-
// core/factories/objects/ModelFactory.ts
|
|
3399
|
-
function getModelFileName(path) {
|
|
3400
|
-
const segments = path.split(/[\\/]/).filter(Boolean);
|
|
3401
|
-
return segments[segments.length - 1] ?? "";
|
|
3402
|
-
}
|
|
3403
|
-
__name(getModelFileName, "getModelFileName");
|
|
3404
|
-
function createModelLoader() {
|
|
3405
|
-
const loader = new GLTFLoader_js.GLTFLoader();
|
|
3406
|
-
try {
|
|
3407
|
-
const dracoLoader = new DRACOLoader_js.DRACOLoader();
|
|
3408
|
-
dracoLoader.setDecoderPath(resolveDracoDecoderPath());
|
|
3409
|
-
loader.setDRACOLoader(dracoLoader);
|
|
3410
|
-
} catch (error) {
|
|
3411
|
-
console.warn("DRACOLoader could not be configured. Loading non-Draco models only.", error);
|
|
3412
|
-
}
|
|
3413
|
-
return loader;
|
|
3414
|
-
}
|
|
3415
|
-
__name(createModelLoader, "createModelLoader");
|
|
3416
|
-
function createModel({
|
|
3417
|
-
world,
|
|
3418
|
-
scene,
|
|
3419
|
-
payload,
|
|
3420
|
-
isEditor
|
|
3421
|
-
}) {
|
|
3422
|
-
const anchor = new THREE37__namespace.Object3D();
|
|
3423
|
-
const modelPath = payload.path ?? "";
|
|
3424
|
-
const entityId = createBaseEntity(world, anchor, {
|
|
3425
|
-
label: payload.name ?? "Model",
|
|
3426
|
-
entityType: "model",
|
|
3427
|
-
transformInput: payload.transform
|
|
3428
|
-
});
|
|
3429
|
-
const model = createModelComponent(world, entityId, modelPath);
|
|
3430
|
-
const meshGeometry = createMeshGeometryComponent(world, entityId, "model", anchor, {}, {
|
|
3431
|
-
modelName: getModelFileName(modelPath),
|
|
3432
|
-
castShadow: false,
|
|
3433
|
-
receiveShadow: false
|
|
3434
|
-
});
|
|
3435
|
-
model.object = anchor;
|
|
3436
|
-
scene.add(anchor);
|
|
3437
|
-
if (!modelPath) {
|
|
3438
|
-
return entityId;
|
|
3439
|
-
}
|
|
3440
|
-
const attachLoadedModel = /* @__PURE__ */ __name((gltf, object) => {
|
|
3441
|
-
if (!world.hasEntity(entityId)) {
|
|
3442
|
-
return;
|
|
3443
|
-
}
|
|
3444
|
-
object.userData.entityId = entityId;
|
|
3445
|
-
object.traverse((child) => {
|
|
3446
|
-
child.userData.entityId = entityId;
|
|
3447
|
-
});
|
|
3448
|
-
anchor.add(object);
|
|
3449
|
-
model.object = object;
|
|
3450
|
-
meshGeometry.object = object;
|
|
3451
|
-
if (gltf.animations.length > 0) {
|
|
3452
|
-
let animation = world.getComponent(entityId, AnimationComponent);
|
|
3453
|
-
if (!animation) {
|
|
3454
|
-
animation = createAnimationComponent(world, entityId, {
|
|
3455
|
-
clips: gltf.animations,
|
|
3456
|
-
externalClipSources: [],
|
|
3457
|
-
paused: false,
|
|
3458
|
-
reverse: false,
|
|
3459
|
-
timeScale: 1,
|
|
3460
|
-
crossFadeDuration: 0
|
|
3461
|
-
});
|
|
3462
|
-
}
|
|
3463
|
-
animation.setModelClips(gltf.animations);
|
|
3464
|
-
}
|
|
3465
|
-
}, "attachLoadedModel");
|
|
3466
|
-
const onLoadError = /* @__PURE__ */ __name((error) => {
|
|
3467
|
-
console.error(`Failed to load model: ${modelPath}`, error);
|
|
3468
|
-
}, "onLoadError");
|
|
3469
|
-
if (isEditor) {
|
|
3470
|
-
createModelLoader().load(
|
|
3471
|
-
modelPath,
|
|
3472
|
-
(gltf) => attachLoadedModel(gltf, gltf.scene),
|
|
3473
|
-
void 0,
|
|
3474
|
-
onLoadError
|
|
3475
|
-
);
|
|
3476
|
-
} else {
|
|
3477
|
-
loadSharedGltf(
|
|
3478
|
-
modelPath,
|
|
3479
|
-
() => new Promise((resolve, reject) => {
|
|
3480
|
-
createModelLoader().load(modelPath, resolve, void 0, reject);
|
|
3481
|
-
})
|
|
3482
|
-
).then((gltf) => attachLoadedModel(gltf, cloneModelScene(gltf.scene))).catch(onLoadError);
|
|
3483
|
-
}
|
|
3484
|
-
return entityId;
|
|
3485
|
-
}
|
|
3486
|
-
__name(createModel, "createModel");
|
|
3487
3998
|
function createPlane({ world, scene, payload }) {
|
|
3488
|
-
const geometry = new
|
|
3489
|
-
const material = new
|
|
3999
|
+
const geometry = new THREE2__namespace.PlaneGeometry(100, 100);
|
|
4000
|
+
const material = new THREE2__namespace.MeshStandardMaterial({
|
|
3490
4001
|
color: "#ffffff",
|
|
3491
|
-
side:
|
|
4002
|
+
side: THREE2__namespace.DoubleSide
|
|
3492
4003
|
});
|
|
3493
|
-
const mesh = new
|
|
4004
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
3494
4005
|
const entityId = createBaseEntity(
|
|
3495
4006
|
world,
|
|
3496
4007
|
mesh,
|
|
@@ -3526,7 +4037,7 @@ function createScriptObject({
|
|
|
3526
4037
|
scene,
|
|
3527
4038
|
payload
|
|
3528
4039
|
}) {
|
|
3529
|
-
const object = new
|
|
4040
|
+
const object = new THREE2__namespace.Group();
|
|
3530
4041
|
const entityId = createBaseEntity(world, object, {
|
|
3531
4042
|
label: payload.name ?? "Script Object",
|
|
3532
4043
|
entityType: "scriptObject",
|
|
@@ -3551,15 +4062,15 @@ function createTeleportArea({
|
|
|
3551
4062
|
const options = payload.options ?? {};
|
|
3552
4063
|
const width = typeof options.width === "number" ? options.width : 10;
|
|
3553
4064
|
const depth = typeof options.depth === "number" ? options.depth : 10;
|
|
3554
|
-
const geometry = new
|
|
3555
|
-
const material = new
|
|
4065
|
+
const geometry = new THREE2__namespace.PlaneGeometry(width, depth);
|
|
4066
|
+
const material = new THREE2__namespace.MeshBasicMaterial({
|
|
3556
4067
|
color: "#4da3ff",
|
|
3557
4068
|
transparent: true,
|
|
3558
4069
|
opacity: 0.18,
|
|
3559
|
-
side:
|
|
4070
|
+
side: THREE2__namespace.DoubleSide,
|
|
3560
4071
|
depthWrite: false
|
|
3561
4072
|
});
|
|
3562
|
-
const object = new
|
|
4073
|
+
const object = new THREE2__namespace.Mesh(geometry, material);
|
|
3563
4074
|
const entityId = createBaseEntity(world, object, {
|
|
3564
4075
|
label: payload.name ?? "Teleport Area",
|
|
3565
4076
|
entityType: "teleportArea",
|
|
@@ -3587,7 +4098,7 @@ function createXRInteractor({
|
|
|
3587
4098
|
scene,
|
|
3588
4099
|
payload
|
|
3589
4100
|
}) {
|
|
3590
|
-
const root = new
|
|
4101
|
+
const root = new THREE2__namespace.Group();
|
|
3591
4102
|
const options = payload.options ?? {};
|
|
3592
4103
|
const entityId = createBaseEntity(world, root, {
|
|
3593
4104
|
label: payload.name ?? "XR Interactor",
|
|
@@ -3600,7 +4111,7 @@ function createXRInteractor({
|
|
|
3600
4111
|
return entityId;
|
|
3601
4112
|
}
|
|
3602
4113
|
for (const side of ["left", "right"]) {
|
|
3603
|
-
const slot = new
|
|
4114
|
+
const slot = new THREE2__namespace.Group();
|
|
3604
4115
|
const label = side === "left" ? "Left Interactor" : "Right Interactor";
|
|
3605
4116
|
const slotEntityId = createBaseEntity(world, slot, {
|
|
3606
4117
|
label,
|
|
@@ -3618,7 +4129,7 @@ function createUIButton({
|
|
|
3618
4129
|
scene,
|
|
3619
4130
|
payload
|
|
3620
4131
|
}) {
|
|
3621
|
-
const object = new
|
|
4132
|
+
const object = new THREE2__namespace.Group();
|
|
3622
4133
|
const entityId = createBaseEntity(world, object, {
|
|
3623
4134
|
label: payload.name ?? "UI Button",
|
|
3624
4135
|
entityType: "uiButton",
|
|
@@ -3643,7 +4154,7 @@ function createUIPanel({
|
|
|
3643
4154
|
scene,
|
|
3644
4155
|
payload
|
|
3645
4156
|
}) {
|
|
3646
|
-
const object = new
|
|
4157
|
+
const object = new THREE2__namespace.Group();
|
|
3647
4158
|
const entityId = createBaseEntity(world, object, {
|
|
3648
4159
|
label: payload.name ?? "UI Panel",
|
|
3649
4160
|
entityType: "uiPanel",
|
|
@@ -3660,7 +4171,7 @@ function createUISlider({
|
|
|
3660
4171
|
scene,
|
|
3661
4172
|
payload
|
|
3662
4173
|
}) {
|
|
3663
|
-
const object = new
|
|
4174
|
+
const object = new THREE2__namespace.Group();
|
|
3664
4175
|
const entityId = createBaseEntity(world, object, {
|
|
3665
4176
|
label: payload.name ?? "UI Slider",
|
|
3666
4177
|
entityType: "uiSlider",
|
|
@@ -3685,7 +4196,7 @@ function createUIText({
|
|
|
3685
4196
|
scene,
|
|
3686
4197
|
payload
|
|
3687
4198
|
}) {
|
|
3688
|
-
const object = new
|
|
4199
|
+
const object = new THREE2__namespace.Group();
|
|
3689
4200
|
const entityId = createBaseEntity(world, object, {
|
|
3690
4201
|
label: payload.name ?? "UI Text",
|
|
3691
4202
|
entityType: "uiText",
|
|
@@ -3702,7 +4213,7 @@ function createUIToggle({
|
|
|
3702
4213
|
scene,
|
|
3703
4214
|
payload
|
|
3704
4215
|
}) {
|
|
3705
|
-
const object = new
|
|
4216
|
+
const object = new THREE2__namespace.Group();
|
|
3706
4217
|
const entityId = createBaseEntity(world, object, {
|
|
3707
4218
|
label: payload.name ?? "UI Toggle",
|
|
3708
4219
|
entityType: "uiToggle",
|
|
@@ -3727,7 +4238,7 @@ function createXRRig({
|
|
|
3727
4238
|
scene,
|
|
3728
4239
|
payload
|
|
3729
4240
|
}) {
|
|
3730
|
-
const object = new
|
|
4241
|
+
const object = new THREE2__namespace.Group();
|
|
3731
4242
|
const entityId = createBaseEntity(world, object, {
|
|
3732
4243
|
label: payload.name ?? "XR Rig",
|
|
3733
4244
|
entityType: "xrRig",
|
|
@@ -3740,7 +4251,7 @@ function createXRRig({
|
|
|
3740
4251
|
}
|
|
3741
4252
|
__name(createXRRig, "createXRRig");
|
|
3742
4253
|
function createSprite({ world, scene, payload }) {
|
|
3743
|
-
const anchor = new
|
|
4254
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3744
4255
|
const imagePath = payload.path ?? "";
|
|
3745
4256
|
const entityId = createBaseEntity(world, anchor, {
|
|
3746
4257
|
label: payload.name ?? "Sprite",
|
|
@@ -3752,7 +4263,7 @@ function createSprite({ world, scene, payload }) {
|
|
|
3752
4263
|
if (!imagePath) {
|
|
3753
4264
|
return entityId;
|
|
3754
4265
|
}
|
|
3755
|
-
const loader = new
|
|
4266
|
+
const loader = new THREE2__namespace.TextureLoader();
|
|
3756
4267
|
loader.load(
|
|
3757
4268
|
imagePath,
|
|
3758
4269
|
(texture) => {
|
|
@@ -3760,11 +4271,11 @@ function createSprite({ world, scene, payload }) {
|
|
|
3760
4271
|
texture.dispose();
|
|
3761
4272
|
return;
|
|
3762
4273
|
}
|
|
3763
|
-
const material = new
|
|
4274
|
+
const material = new THREE2__namespace.SpriteMaterial({
|
|
3764
4275
|
map: texture,
|
|
3765
4276
|
transparent: true
|
|
3766
4277
|
});
|
|
3767
|
-
const sprite = new
|
|
4278
|
+
const sprite = new THREE2__namespace.Sprite(material);
|
|
3768
4279
|
sprite.userData.entityId = entityId;
|
|
3769
4280
|
const textureImage = texture.image;
|
|
3770
4281
|
spriteComponent.width = textureImage?.width ?? 1;
|
|
@@ -3782,9 +4293,9 @@ function createSprite({ world, scene, payload }) {
|
|
|
3782
4293
|
}
|
|
3783
4294
|
__name(createSprite, "createSprite");
|
|
3784
4295
|
function createSphere({ world, scene, payload }) {
|
|
3785
|
-
const geometry = new
|
|
3786
|
-
const material = new
|
|
3787
|
-
const mesh = new
|
|
4296
|
+
const geometry = new THREE2__namespace.SphereGeometry(0.5, 24, 24);
|
|
4297
|
+
const material = new THREE2__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
4298
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
3788
4299
|
const entityId = createBaseEntity(world, mesh, {
|
|
3789
4300
|
label: payload.name ?? "Sphere",
|
|
3790
4301
|
entityType: "sphere",
|
|
@@ -3804,10 +4315,10 @@ function createSphere({ world, scene, payload }) {
|
|
|
3804
4315
|
__name(createSphere, "createSphere");
|
|
3805
4316
|
function getOrCreateListener2(camera) {
|
|
3806
4317
|
const existing = camera.userData.ecsAudioListener;
|
|
3807
|
-
if (existing instanceof
|
|
4318
|
+
if (existing instanceof THREE2__namespace.AudioListener) {
|
|
3808
4319
|
return existing;
|
|
3809
4320
|
}
|
|
3810
|
-
const listener = new
|
|
4321
|
+
const listener = new THREE2__namespace.AudioListener();
|
|
3811
4322
|
camera.add(listener);
|
|
3812
4323
|
camera.userData.ecsAudioListener = listener;
|
|
3813
4324
|
return listener;
|
|
@@ -3856,58 +4367,23 @@ function normalizeOptions(input) {
|
|
|
3856
4367
|
};
|
|
3857
4368
|
}
|
|
3858
4369
|
__name(normalizeOptions, "normalizeOptions");
|
|
3859
|
-
function createChromaMaterial(texture, options) {
|
|
3860
|
-
return new THREE37__namespace.ShaderMaterial({
|
|
3861
|
-
uniforms: {
|
|
3862
|
-
tex: { value: texture },
|
|
3863
|
-
keyColor: { value: new THREE37__namespace.Color(options.backgroundColor) },
|
|
3864
|
-
similarity: { value: options.similarity },
|
|
3865
|
-
smoothness: { value: options.smoothness },
|
|
3866
|
-
spill: { value: options.spill }
|
|
3867
|
-
},
|
|
3868
|
-
vertexShader: `
|
|
3869
|
-
varying vec2 vUv;
|
|
3870
|
-
void main() {
|
|
3871
|
-
vUv = uv;
|
|
3872
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
3873
|
-
}
|
|
3874
|
-
`,
|
|
3875
|
-
fragmentShader: `
|
|
3876
|
-
uniform sampler2D tex;
|
|
3877
|
-
uniform vec3 keyColor;
|
|
3878
|
-
uniform float similarity;
|
|
3879
|
-
uniform float smoothness;
|
|
3880
|
-
uniform float spill;
|
|
3881
|
-
varying vec2 vUv;
|
|
3882
|
-
|
|
3883
|
-
void main() {
|
|
3884
|
-
vec4 texel = texture2D(tex, vUv);
|
|
3885
|
-
float chromaDist = distance(texel.rgb, keyColor);
|
|
3886
|
-
float alpha = smoothstep(similarity, similarity + smoothness, chromaDist);
|
|
3887
|
-
|
|
3888
|
-
float spillFactor = smoothstep(similarity, similarity + spill + smoothness, chromaDist);
|
|
3889
|
-
vec3 despilled = mix(vec3(dot(texel.rgb, vec3(0.299, 0.587, 0.114))), texel.rgb, spillFactor);
|
|
3890
|
-
|
|
3891
|
-
gl_FragColor = vec4(despilled, texel.a * alpha);
|
|
3892
|
-
}
|
|
3893
|
-
`,
|
|
3894
|
-
transparent: true,
|
|
3895
|
-
side: THREE37__namespace.DoubleSide
|
|
3896
|
-
});
|
|
3897
|
-
}
|
|
3898
|
-
__name(createChromaMaterial, "createChromaMaterial");
|
|
3899
4370
|
function createStandardMaterial(texture) {
|
|
3900
|
-
return new
|
|
4371
|
+
return new THREE2__namespace.MeshBasicMaterial({
|
|
3901
4372
|
map: texture,
|
|
3902
4373
|
transparent: true,
|
|
3903
|
-
side:
|
|
4374
|
+
side: THREE2__namespace.DoubleSide
|
|
3904
4375
|
});
|
|
3905
4376
|
}
|
|
3906
4377
|
__name(createStandardMaterial, "createStandardMaterial");
|
|
3907
|
-
function createVideoMesh(entityId, texture, options) {
|
|
3908
|
-
const geometry = new
|
|
3909
|
-
const material = options.isGreenScreen ?
|
|
3910
|
-
|
|
4378
|
+
function createVideoMesh(entityId, texture, options, backend) {
|
|
4379
|
+
const geometry = new THREE2__namespace.PlaneGeometry(1, 1);
|
|
4380
|
+
const material = options.isGreenScreen ? backend.createChromaKeyMaterial(texture, {
|
|
4381
|
+
keyColor: options.backgroundColor,
|
|
4382
|
+
similarity: options.similarity,
|
|
4383
|
+
smoothness: options.smoothness,
|
|
4384
|
+
spill: options.spill
|
|
4385
|
+
}) : createStandardMaterial(texture);
|
|
4386
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
3911
4387
|
mesh.userData.entityId = entityId;
|
|
3912
4388
|
mesh.scale.set(options.width, options.height, 1);
|
|
3913
4389
|
return { mesh, material };
|
|
@@ -3942,7 +4418,7 @@ function createVideo({
|
|
|
3942
4418
|
payload,
|
|
3943
4419
|
isEditor
|
|
3944
4420
|
}) {
|
|
3945
|
-
const anchor = new
|
|
4421
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3946
4422
|
const path = payload.path ?? "";
|
|
3947
4423
|
const options = normalizeOptions(payload.options);
|
|
3948
4424
|
const entityId = createBaseEntity(world, anchor, {
|
|
@@ -3957,10 +4433,15 @@ function createVideo({
|
|
|
3957
4433
|
return entityId;
|
|
3958
4434
|
}
|
|
3959
4435
|
const video = createVideoElement(path, options);
|
|
3960
|
-
const texture = new
|
|
3961
|
-
texture.colorSpace =
|
|
4436
|
+
const texture = new THREE2__namespace.VideoTexture(video);
|
|
4437
|
+
texture.colorSpace = THREE2__namespace.SRGBColorSpace;
|
|
3962
4438
|
texture.needsUpdate = true;
|
|
3963
|
-
const { mesh, material } = createVideoMesh(
|
|
4439
|
+
const { mesh, material } = createVideoMesh(
|
|
4440
|
+
entityId,
|
|
4441
|
+
texture,
|
|
4442
|
+
options,
|
|
4443
|
+
readWorldRenderBackend(world)
|
|
4444
|
+
);
|
|
3964
4445
|
anchor.add(mesh);
|
|
3965
4446
|
videoComponent.videoElement = video;
|
|
3966
4447
|
videoComponent.texture = texture;
|
|
@@ -3974,7 +4455,7 @@ function createVideo({
|
|
|
3974
4455
|
});
|
|
3975
4456
|
if (!isEditor && options.positional) {
|
|
3976
4457
|
const listener = getOrCreateListener2(camera);
|
|
3977
|
-
const audioNode = new
|
|
4458
|
+
const audioNode = new THREE2__namespace.PositionalAudio(listener);
|
|
3978
4459
|
audioNode.setVolume(options.volume);
|
|
3979
4460
|
audioNode.setRefDistance(options.refDistance);
|
|
3980
4461
|
audioNode.setDistanceModel(normalizeDistanceModel2(options.distanceModel));
|
|
@@ -4028,9 +4509,11 @@ __name(registerDefaultFactories, "registerDefaultFactories");
|
|
|
4028
4509
|
|
|
4029
4510
|
exports.createAnimationComponent = createAnimationComponent;
|
|
4030
4511
|
exports.createAudioComponent = createAudioComponent;
|
|
4512
|
+
exports.createBoneAttachmentComponent = createBoneAttachmentComponent;
|
|
4031
4513
|
exports.createCameraComponent = createCameraComponent;
|
|
4032
4514
|
exports.createEntityTypeComponent = createEntityTypeComponent;
|
|
4033
4515
|
exports.createEnvironmentComponent = createEnvironmentComponent;
|
|
4516
|
+
exports.createIKComponent = createIKComponent;
|
|
4034
4517
|
exports.createImageComponent = createImageComponent;
|
|
4035
4518
|
exports.createImageTargetAnchorComponent = createImageTargetAnchorComponent;
|
|
4036
4519
|
exports.createImageTargetComponent = createImageTargetComponent;
|
|
@@ -4042,6 +4525,10 @@ exports.createMeshComponent = createMeshComponent;
|
|
|
4042
4525
|
exports.createMeshGeometryComponent = createMeshGeometryComponent;
|
|
4043
4526
|
exports.createModelComponent = createModelComponent;
|
|
4044
4527
|
exports.createNameComponent = createNameComponent;
|
|
4528
|
+
exports.createNetworkIdentityComponent = createNetworkIdentityComponent;
|
|
4529
|
+
exports.createNetworkSpawnerComponent = createNetworkSpawnerComponent;
|
|
4530
|
+
exports.createNetworkTransformComponent = createNetworkTransformComponent;
|
|
4531
|
+
exports.createNetworkedPropsComponent = createNetworkedPropsComponent;
|
|
4045
4532
|
exports.createObject3DRefComponent = createObject3DRefComponent;
|
|
4046
4533
|
exports.createParentIdComponent = createParentIdComponent;
|
|
4047
4534
|
exports.createPhysicsComponent = createPhysicsComponent;
|