@relu-interactives/spatial-ecs 0.5.3 → 0.9.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-CWSrsnYN.d.ts} +236 -3
- package/dist/{XRHandPose-CQTLGxFC.d.cts → XRHandPose-Dn2yiALk.d.cts} +236 -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-GSWC6LLD.js +241 -0
- package/dist/chunk-GSWC6LLD.js.map +1 -0
- package/dist/chunk-JEPUCLZX.js +1237 -0
- package/dist/chunk-JEPUCLZX.js.map +1 -0
- package/dist/{chunk-BUEKOSR5.js → chunk-JNYPJB55.js} +435 -14
- package/dist/chunk-JNYPJB55.js.map +1 -0
- package/dist/{chunk-RXBLOO5B.js → chunk-NXASMBDS.js} +105 -715
- package/dist/chunk-NXASMBDS.js.map +1 -0
- package/dist/chunk-OHCNPPMX.js +334 -0
- package/dist/chunk-OHCNPPMX.js.map +1 -0
- package/dist/{chunk-DF5SSRN6.js → chunk-VYIWOXAY.js} +2574 -3381
- package/dist/chunk-VYIWOXAY.js.map +1 -0
- package/dist/chunk-WWP46AEF.js +2878 -0
- package/dist/chunk-WWP46AEF.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 +334 -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/spatial-ui.md +83 -7
- 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 +921 -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-C3ik3sA1.d.ts → index-CAZHrh0q.d.cts} +28 -3
- package/dist/{index-Dlr-7-4m.d.cts → index-CLtSMf2M.d.ts} +28 -3
- package/dist/{index-D2Jt_JzH.d.ts → index-D5MmJNyj.d.ts} +161 -43
- package/dist/{index-DaG03vyN.d.cts → index-DiIjV2lm.d.cts} +161 -43
- package/dist/index.cjs +4959 -1414
- 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 +5069 -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 +5319 -1957
- 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) {
|
|
@@ -2460,6 +2680,127 @@ function createXRInteractorSideComponent(world, entityId, ...args) {
|
|
|
2460
2680
|
}
|
|
2461
2681
|
__name(createXRInteractorSideComponent, "createXRInteractorSideComponent");
|
|
2462
2682
|
|
|
2683
|
+
// core/ui/uiStyle.ts
|
|
2684
|
+
var isRecord = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
|
2685
|
+
var finite = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value), "finite");
|
|
2686
|
+
var nonEmpty = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length > 0, "nonEmpty");
|
|
2687
|
+
function normalizeStops(value) {
|
|
2688
|
+
if (!Array.isArray(value)) return null;
|
|
2689
|
+
const stops = [];
|
|
2690
|
+
for (const stop of value) {
|
|
2691
|
+
if (isRecord(stop) && finite(stop.at) && nonEmpty(stop.color)) {
|
|
2692
|
+
stops.push({ at: Math.min(1, Math.max(0, stop.at)), color: stop.color });
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
return stops.length >= 2 ? stops : null;
|
|
2696
|
+
}
|
|
2697
|
+
__name(normalizeStops, "normalizeStops");
|
|
2698
|
+
function normalizePaint(value) {
|
|
2699
|
+
if (!isRecord(value)) return void 0;
|
|
2700
|
+
if (value.kind === "solid" && nonEmpty(value.color)) {
|
|
2701
|
+
return { kind: "solid", color: value.color };
|
|
2702
|
+
}
|
|
2703
|
+
if (value.kind === "linear") {
|
|
2704
|
+
const stops = normalizeStops(value.stops);
|
|
2705
|
+
if (stops) {
|
|
2706
|
+
return {
|
|
2707
|
+
kind: "linear",
|
|
2708
|
+
angle: finite(value.angle) ? value.angle : 180,
|
|
2709
|
+
stops
|
|
2710
|
+
};
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
if (value.kind === "radial") {
|
|
2714
|
+
const stops = normalizeStops(value.stops);
|
|
2715
|
+
if (stops) return { kind: "radial", stops };
|
|
2716
|
+
}
|
|
2717
|
+
if (value.kind === "image" && nonEmpty(value.src)) {
|
|
2718
|
+
const fit = value.fit === "contain" || value.fit === "fill" ? value.fit : "cover";
|
|
2719
|
+
return {
|
|
2720
|
+
kind: "image",
|
|
2721
|
+
src: value.src,
|
|
2722
|
+
fit,
|
|
2723
|
+
...nonEmpty(value.tint) ? { tint: value.tint } : {}
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
return void 0;
|
|
2727
|
+
}
|
|
2728
|
+
__name(normalizePaint, "normalizePaint");
|
|
2729
|
+
function normalizeShadow(value) {
|
|
2730
|
+
if (!isRecord(value) || !nonEmpty(value.color)) return void 0;
|
|
2731
|
+
return {
|
|
2732
|
+
x: finite(value.x) ? value.x : 0,
|
|
2733
|
+
y: finite(value.y) ? value.y : 0,
|
|
2734
|
+
blur: finite(value.blur) ? Math.max(0, value.blur) : 0,
|
|
2735
|
+
color: value.color
|
|
2736
|
+
};
|
|
2737
|
+
}
|
|
2738
|
+
__name(normalizeShadow, "normalizeShadow");
|
|
2739
|
+
function normalizeText(value) {
|
|
2740
|
+
if (!isRecord(value)) return void 0;
|
|
2741
|
+
const text = {};
|
|
2742
|
+
if (nonEmpty(value.font)) text.font = value.font;
|
|
2743
|
+
if (finite(value.weight)) text.weight = value.weight;
|
|
2744
|
+
if (finite(value.tracking)) text.tracking = value.tracking;
|
|
2745
|
+
if (value.transform === "upper" || value.transform === "lower") {
|
|
2746
|
+
text.transform = value.transform;
|
|
2747
|
+
}
|
|
2748
|
+
const paint = normalizePaint(value.paint);
|
|
2749
|
+
if (paint) text.paint = paint;
|
|
2750
|
+
if (finite(value.maxLines) && value.maxLines >= 1) {
|
|
2751
|
+
text.maxLines = Math.floor(value.maxLines);
|
|
2752
|
+
}
|
|
2753
|
+
const shadow = normalizeShadow(value.shadow);
|
|
2754
|
+
if (shadow) text.shadow = shadow;
|
|
2755
|
+
return Object.keys(text).length > 0 ? text : void 0;
|
|
2756
|
+
}
|
|
2757
|
+
__name(normalizeText, "normalizeText");
|
|
2758
|
+
function normalizeUiStyle(value) {
|
|
2759
|
+
if (!isRecord(value)) return void 0;
|
|
2760
|
+
const style = {};
|
|
2761
|
+
const fill = normalizePaint(value.fill);
|
|
2762
|
+
if (fill) style.fill = fill;
|
|
2763
|
+
if (isRecord(value.border) && finite(value.border.width)) {
|
|
2764
|
+
const paint = normalizePaint(value.border.paint);
|
|
2765
|
+
if (paint) {
|
|
2766
|
+
style.border = { width: Math.max(0, value.border.width), paint };
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
if (finite(value.radius)) {
|
|
2770
|
+
style.radius = Math.max(0, value.radius);
|
|
2771
|
+
} else if (Array.isArray(value.radius) && value.radius.length === 4 && value.radius.every(finite)) {
|
|
2772
|
+
style.radius = value.radius.map((r) => Math.max(0, r));
|
|
2773
|
+
}
|
|
2774
|
+
if (Array.isArray(value.shadows)) {
|
|
2775
|
+
const shadows = value.shadows.map(normalizeShadow).filter((s) => !!s);
|
|
2776
|
+
if (shadows.length > 0) style.shadows = shadows;
|
|
2777
|
+
}
|
|
2778
|
+
if (isRecord(value.edge) && finite(value.edge.width) && nonEmpty(value.edge.color)) {
|
|
2779
|
+
style.edge = {
|
|
2780
|
+
width: Math.max(0, value.edge.width),
|
|
2781
|
+
color: value.edge.color
|
|
2782
|
+
};
|
|
2783
|
+
}
|
|
2784
|
+
if (finite(value.opacity)) {
|
|
2785
|
+
style.opacity = Math.min(1, Math.max(0, value.opacity));
|
|
2786
|
+
}
|
|
2787
|
+
const text = normalizeText(value.text);
|
|
2788
|
+
if (text) style.text = text;
|
|
2789
|
+
return Object.keys(style).length > 0 ? style : void 0;
|
|
2790
|
+
}
|
|
2791
|
+
__name(normalizeUiStyle, "normalizeUiStyle");
|
|
2792
|
+
function normalizeUiTokens(value) {
|
|
2793
|
+
if (!isRecord(value)) return void 0;
|
|
2794
|
+
const tokens = {};
|
|
2795
|
+
for (const [key, token] of Object.entries(value)) {
|
|
2796
|
+
if (nonEmpty(token) && key.length > 0 && !key.includes("/")) {
|
|
2797
|
+
tokens[key] = token;
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
return Object.keys(tokens).length > 0 ? tokens : void 0;
|
|
2801
|
+
}
|
|
2802
|
+
__name(normalizeUiTokens, "normalizeUiTokens");
|
|
2803
|
+
|
|
2463
2804
|
// core/components/UIButton.ts
|
|
2464
2805
|
var _UIButtonComponent = class _UIButtonComponent extends Component {
|
|
2465
2806
|
constructor(options) {
|
|
@@ -2476,6 +2817,13 @@ var _UIButtonComponent = class _UIButtonComponent extends Component {
|
|
|
2476
2817
|
this.cornerRadius = options?.cornerRadius ?? 0.02;
|
|
2477
2818
|
this.borderWidth = options?.borderWidth ?? 2e-3;
|
|
2478
2819
|
this.borderColor = options?.borderColor ?? "#3a3a3a";
|
|
2820
|
+
if (options?.pixelDensity !== void 0) {
|
|
2821
|
+
this.pixelDensity = options.pixelDensity;
|
|
2822
|
+
}
|
|
2823
|
+
const style = normalizeUiStyle(options?.style);
|
|
2824
|
+
if (style) this.style = style;
|
|
2825
|
+
if (options?.icon) this.icon = options.icon;
|
|
2826
|
+
if (options?.iconPosition) this.iconPosition = options.iconPosition;
|
|
2479
2827
|
}
|
|
2480
2828
|
};
|
|
2481
2829
|
__name(_UIButtonComponent, "UIButtonComponent");
|
|
@@ -2502,6 +2850,10 @@ var _UIPanelComponent = class _UIPanelComponent extends Component {
|
|
|
2502
2850
|
this.borderColor = options?.borderColor ?? "#333333";
|
|
2503
2851
|
this.pixelDensity = options?.pixelDensity ?? 1024;
|
|
2504
2852
|
this.follow = options?.follow ?? "world";
|
|
2853
|
+
const style = normalizeUiStyle(options?.style);
|
|
2854
|
+
if (style) this.style = style;
|
|
2855
|
+
const tokens = normalizeUiTokens(options?.tokens);
|
|
2856
|
+
if (tokens) this.tokens = tokens;
|
|
2505
2857
|
}
|
|
2506
2858
|
};
|
|
2507
2859
|
__name(_UIPanelComponent, "UIPanelComponent");
|
|
@@ -2530,6 +2882,14 @@ var _UISliderComponent = class _UISliderComponent extends Component {
|
|
|
2530
2882
|
this.trackColor = options?.trackColor ?? "#2a2a2a";
|
|
2531
2883
|
this.accentColor = options?.accentColor ?? "#ff6b35";
|
|
2532
2884
|
this.knobColor = options?.knobColor ?? "#ffffff";
|
|
2885
|
+
if (options?.pixelDensity !== void 0) {
|
|
2886
|
+
this.pixelDensity = options.pixelDensity;
|
|
2887
|
+
}
|
|
2888
|
+
const style = normalizeUiStyle(options?.style);
|
|
2889
|
+
if (style) this.style = style;
|
|
2890
|
+
if (options?.variant) this.variant = options.variant;
|
|
2891
|
+
if (options?.step !== void 0) this.step = options.step;
|
|
2892
|
+
if (options?.readOnly !== void 0) this.readOnly = options.readOnly;
|
|
2533
2893
|
}
|
|
2534
2894
|
};
|
|
2535
2895
|
__name(_UISliderComponent, "UISliderComponent");
|
|
@@ -2557,6 +2917,11 @@ var _UITextComponent = class _UITextComponent extends Component {
|
|
|
2557
2917
|
this.valign = options?.valign ?? "middle";
|
|
2558
2918
|
this.lineHeight = options?.lineHeight ?? 1.25;
|
|
2559
2919
|
this.padding = options?.padding ?? 0.01;
|
|
2920
|
+
if (options?.pixelDensity !== void 0) {
|
|
2921
|
+
this.pixelDensity = options.pixelDensity;
|
|
2922
|
+
}
|
|
2923
|
+
const style = normalizeUiStyle(options?.style);
|
|
2924
|
+
if (style) this.style = style;
|
|
2560
2925
|
}
|
|
2561
2926
|
};
|
|
2562
2927
|
__name(_UITextComponent, "UITextComponent");
|
|
@@ -2581,6 +2946,12 @@ var _UIToggleComponent = class _UIToggleComponent extends Component {
|
|
|
2581
2946
|
this.trackColor = options?.trackColor ?? "#2a2a2a";
|
|
2582
2947
|
this.accentColor = options?.accentColor ?? "#ff6b35";
|
|
2583
2948
|
this.knobColor = options?.knobColor ?? "#ffffff";
|
|
2949
|
+
if (options?.pixelDensity !== void 0) {
|
|
2950
|
+
this.pixelDensity = options.pixelDensity;
|
|
2951
|
+
}
|
|
2952
|
+
const style = normalizeUiStyle(options?.style);
|
|
2953
|
+
if (style) this.style = style;
|
|
2954
|
+
if (options?.variant) this.variant = options.variant;
|
|
2584
2955
|
}
|
|
2585
2956
|
};
|
|
2586
2957
|
__name(_UIToggleComponent, "UIToggleComponent");
|
|
@@ -2607,6 +2978,12 @@ function registerDefaultComponentFactories(objectManagementSystem) {
|
|
|
2607
2978
|
objectManagementSystem.registerComponentFactory("vrTeleportArea", createVRTeleportAreaComponent);
|
|
2608
2979
|
objectManagementSystem.registerComponentFactory("xrHandPose", createXRHandPoseComponent);
|
|
2609
2980
|
objectManagementSystem.registerComponentFactory("xrAnchor", createXRAnchorComponent);
|
|
2981
|
+
objectManagementSystem.registerComponentFactory("boneAttachment", createBoneAttachmentComponent);
|
|
2982
|
+
objectManagementSystem.registerComponentFactory("ik", createIKComponent);
|
|
2983
|
+
objectManagementSystem.registerComponentFactory("networkIdentity", createNetworkIdentityComponent);
|
|
2984
|
+
objectManagementSystem.registerComponentFactory("networkTransform", createNetworkTransformComponent);
|
|
2985
|
+
objectManagementSystem.registerComponentFactory("networkedProps", createNetworkedPropsComponent);
|
|
2986
|
+
objectManagementSystem.registerComponentFactory("networkSpawner", createNetworkSpawnerComponent);
|
|
2610
2987
|
objectManagementSystem.registerComponentFactory("uiPanel", createUIPanelComponent);
|
|
2611
2988
|
objectManagementSystem.registerComponentFactory("uiText", createUITextComponent);
|
|
2612
2989
|
objectManagementSystem.registerComponentFactory("uiButton", createUIButtonComponent);
|
|
@@ -2654,11 +3031,49 @@ function registerDefaultComponentFactories(objectManagementSystem) {
|
|
|
2654
3031
|
objectManagementSystem.registerComponentFactory("instancedMesh", createInstancedMeshComponent);
|
|
2655
3032
|
}
|
|
2656
3033
|
__name(registerDefaultComponentFactories, "registerDefaultComponentFactories");
|
|
3034
|
+
|
|
3035
|
+
// core/utils/dracoDecoderPath.ts
|
|
3036
|
+
var LOCAL_DRACO_DECODER_RELATIVE_PATH = "./assets/draco/";
|
|
3037
|
+
var DRACO_DECODER_CDN_PATH = "https://www.gstatic.com/draco/versioned/decoders/1.5.7/";
|
|
3038
|
+
function isBlockedBrowserFileUrl(url) {
|
|
3039
|
+
return url.startsWith("file://");
|
|
3040
|
+
}
|
|
3041
|
+
__name(isBlockedBrowserFileUrl, "isBlockedBrowserFileUrl");
|
|
3042
|
+
function resolveDracoDecoderPath() {
|
|
3043
|
+
try {
|
|
3044
|
+
const resolvedPath = new URL(
|
|
3045
|
+
LOCAL_DRACO_DECODER_RELATIVE_PATH,
|
|
3046
|
+
(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))
|
|
3047
|
+
).toString();
|
|
3048
|
+
if (isBlockedBrowserFileUrl(resolvedPath)) {
|
|
3049
|
+
return DRACO_DECODER_CDN_PATH;
|
|
3050
|
+
}
|
|
3051
|
+
return resolvedPath;
|
|
3052
|
+
} catch {
|
|
3053
|
+
return DRACO_DECODER_CDN_PATH;
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
__name(resolveDracoDecoderPath, "resolveDracoDecoderPath");
|
|
3057
|
+
|
|
3058
|
+
// core/utils/gltfLoader.ts
|
|
3059
|
+
function createGLTFLoader() {
|
|
3060
|
+
const loader = new GLTFLoader_js.GLTFLoader();
|
|
3061
|
+
try {
|
|
3062
|
+
const dracoLoader = new DRACOLoader_js.DRACOLoader();
|
|
3063
|
+
dracoLoader.setDecoderPath(resolveDracoDecoderPath());
|
|
3064
|
+
loader.setDRACOLoader(dracoLoader);
|
|
3065
|
+
} catch (error) {
|
|
3066
|
+
console.warn("DRACOLoader could not be configured. Loading non-Draco models only.", error);
|
|
3067
|
+
}
|
|
3068
|
+
loader.setMeshoptDecoder(meshopt_decoder_module_js.MeshoptDecoder);
|
|
3069
|
+
return loader;
|
|
3070
|
+
}
|
|
3071
|
+
__name(createGLTFLoader, "createGLTFLoader");
|
|
2657
3072
|
var SHARED_MODEL_RESOURCE_FLAG = "spatialEcsSharedModelResource";
|
|
2658
3073
|
var modelCache = /* @__PURE__ */ new Map();
|
|
2659
3074
|
function markSharedResources(root) {
|
|
2660
3075
|
root.traverse((child) => {
|
|
2661
|
-
if (!(child instanceof
|
|
3076
|
+
if (!(child instanceof THREE2__namespace.Mesh)) {
|
|
2662
3077
|
return;
|
|
2663
3078
|
}
|
|
2664
3079
|
if (child.geometry) {
|
|
@@ -2693,7 +3108,108 @@ function cloneModelScene(scene) {
|
|
|
2693
3108
|
}
|
|
2694
3109
|
__name(cloneModelScene, "cloneModelScene");
|
|
2695
3110
|
|
|
3111
|
+
// core/factories/objects/ModelFactory.ts
|
|
3112
|
+
function getModelFileName(path) {
|
|
3113
|
+
const segments = path.split(/[\\/]/).filter(Boolean);
|
|
3114
|
+
return segments[segments.length - 1] ?? "";
|
|
3115
|
+
}
|
|
3116
|
+
__name(getModelFileName, "getModelFileName");
|
|
3117
|
+
function createModelLoader() {
|
|
3118
|
+
return createGLTFLoader();
|
|
3119
|
+
}
|
|
3120
|
+
__name(createModelLoader, "createModelLoader");
|
|
3121
|
+
function createModel({
|
|
3122
|
+
world,
|
|
3123
|
+
scene,
|
|
3124
|
+
payload,
|
|
3125
|
+
isEditor
|
|
3126
|
+
}) {
|
|
3127
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3128
|
+
const modelPath = payload.path ?? "";
|
|
3129
|
+
const entityId = createBaseEntity(world, anchor, {
|
|
3130
|
+
label: payload.name ?? "Model",
|
|
3131
|
+
entityType: "model",
|
|
3132
|
+
transformInput: payload.transform
|
|
3133
|
+
});
|
|
3134
|
+
const model = createModelComponent(world, entityId, modelPath);
|
|
3135
|
+
createMeshGeometryComponent(world, entityId, "model", anchor, {}, {
|
|
3136
|
+
modelName: getModelFileName(modelPath),
|
|
3137
|
+
castShadow: false,
|
|
3138
|
+
receiveShadow: false
|
|
3139
|
+
});
|
|
3140
|
+
model.object = anchor;
|
|
3141
|
+
scene.add(anchor);
|
|
3142
|
+
if (!modelPath) {
|
|
3143
|
+
return entityId;
|
|
3144
|
+
}
|
|
3145
|
+
setModelLoadState(model, "loading");
|
|
3146
|
+
loadModelInto({ world, entityId, anchor, modelPath, isEditor: Boolean(isEditor) });
|
|
3147
|
+
return entityId;
|
|
3148
|
+
}
|
|
3149
|
+
__name(createModel, "createModel");
|
|
3150
|
+
function loadModelInto({
|
|
3151
|
+
world,
|
|
3152
|
+
entityId,
|
|
3153
|
+
anchor,
|
|
3154
|
+
modelPath,
|
|
3155
|
+
isEditor
|
|
3156
|
+
}) {
|
|
3157
|
+
const model = world.getComponent(entityId, ModelComponent);
|
|
3158
|
+
const meshGeometry = world.getComponent(entityId, MeshGeometryComponent);
|
|
3159
|
+
if (!model) return;
|
|
3160
|
+
const attachLoadedModel = /* @__PURE__ */ __name((gltf, object) => {
|
|
3161
|
+
if (!world.hasEntity(entityId) || world.getComponent(entityId, ModelComponent) !== model) {
|
|
3162
|
+
return;
|
|
3163
|
+
}
|
|
3164
|
+
object.userData.entityId = entityId;
|
|
3165
|
+
object.traverse((child) => {
|
|
3166
|
+
child.userData.entityId = entityId;
|
|
3167
|
+
});
|
|
3168
|
+
anchor.add(object);
|
|
3169
|
+
model.object = object;
|
|
3170
|
+
if (meshGeometry) meshGeometry.object = object;
|
|
3171
|
+
if (gltf.animations.length > 0) {
|
|
3172
|
+
let animation = world.getComponent(entityId, AnimationComponent);
|
|
3173
|
+
if (!animation) {
|
|
3174
|
+
animation = createAnimationComponent(world, entityId, {
|
|
3175
|
+
clips: gltf.animations,
|
|
3176
|
+
externalClipSources: [],
|
|
3177
|
+
paused: false,
|
|
3178
|
+
reverse: false,
|
|
3179
|
+
timeScale: 1,
|
|
3180
|
+
crossFadeDuration: 0
|
|
3181
|
+
});
|
|
3182
|
+
}
|
|
3183
|
+
animation.setModelClips(gltf.animations);
|
|
3184
|
+
}
|
|
3185
|
+
setModelLoadState(model, "loaded");
|
|
3186
|
+
}, "attachLoadedModel");
|
|
3187
|
+
const onLoadError = /* @__PURE__ */ __name((error) => {
|
|
3188
|
+
const message = error instanceof Error && error.message ? error.message : typeof error === "string" && error ? error : `Failed to load model: ${modelPath}`;
|
|
3189
|
+
setModelLoadState(model, "error", message);
|
|
3190
|
+
console.error(`Failed to load model: ${modelPath}`, error);
|
|
3191
|
+
}, "onLoadError");
|
|
3192
|
+
if (isEditor) {
|
|
3193
|
+
createModelLoader().load(
|
|
3194
|
+
modelPath,
|
|
3195
|
+
(gltf) => attachLoadedModel(gltf, gltf.scene),
|
|
3196
|
+
void 0,
|
|
3197
|
+
onLoadError
|
|
3198
|
+
);
|
|
3199
|
+
} else {
|
|
3200
|
+
loadSharedGltf(
|
|
3201
|
+
modelPath,
|
|
3202
|
+
() => new Promise((resolve, reject) => {
|
|
3203
|
+
createModelLoader().load(modelPath, resolve, void 0, reject);
|
|
3204
|
+
})
|
|
3205
|
+
).then((gltf) => attachLoadedModel(gltf, cloneModelScene(gltf.scene))).catch(onLoadError);
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
__name(loadModelInto, "loadModelInto");
|
|
3209
|
+
|
|
2696
3210
|
// core/systems/ObjectManagementSystem.ts
|
|
3211
|
+
new THREE2__namespace.Vector3();
|
|
3212
|
+
new THREE2__namespace.Vector3();
|
|
2697
3213
|
function createTransform(input) {
|
|
2698
3214
|
return new TransformComponent(input);
|
|
2699
3215
|
}
|
|
@@ -2732,10 +3248,10 @@ __name(createBaseEntity, "createBaseEntity");
|
|
|
2732
3248
|
// core/factories/objects/AudioFactory.ts
|
|
2733
3249
|
function getOrCreateListener(camera) {
|
|
2734
3250
|
const existing = camera.userData.ecsAudioListener;
|
|
2735
|
-
if (existing instanceof
|
|
3251
|
+
if (existing instanceof THREE2__namespace.AudioListener) {
|
|
2736
3252
|
return existing;
|
|
2737
3253
|
}
|
|
2738
|
-
const listener = new
|
|
3254
|
+
const listener = new THREE2__namespace.AudioListener();
|
|
2739
3255
|
camera.add(listener);
|
|
2740
3256
|
camera.userData.ecsAudioListener = listener;
|
|
2741
3257
|
return listener;
|
|
@@ -2748,7 +3264,7 @@ function createAudio({
|
|
|
2748
3264
|
payload,
|
|
2749
3265
|
isEditor
|
|
2750
3266
|
}) {
|
|
2751
|
-
const anchor = new
|
|
3267
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
2752
3268
|
const entityId = createBaseEntity(world, anchor, {
|
|
2753
3269
|
label: payload.name ?? "Audio",
|
|
2754
3270
|
entityType: "audio",
|
|
@@ -2770,7 +3286,7 @@ function createAudio({
|
|
|
2770
3286
|
return entityId;
|
|
2771
3287
|
}
|
|
2772
3288
|
if (!isEditor) {
|
|
2773
|
-
const loader = new
|
|
3289
|
+
const loader = new THREE2__namespace.AudioLoader();
|
|
2774
3290
|
loader.load(
|
|
2775
3291
|
audio.path,
|
|
2776
3292
|
(buffer) => {
|
|
@@ -2845,7 +3361,7 @@ function applyCameraSettings(camera, options) {
|
|
|
2845
3361
|
const near = typeof options.near === "number" ? options.near : DEFAULT_NEAR2;
|
|
2846
3362
|
const far = typeof options.far === "number" ? options.far : DEFAULT_FAR2;
|
|
2847
3363
|
const projection = options.projection;
|
|
2848
|
-
if (camera instanceof
|
|
3364
|
+
if (camera instanceof THREE2__namespace.PerspectiveCamera) {
|
|
2849
3365
|
if (!projection || projection === "perspective") {
|
|
2850
3366
|
camera.fov = typeof options.fov === "number" ? options.fov : DEFAULT_FOV2;
|
|
2851
3367
|
}
|
|
@@ -2855,7 +3371,7 @@ function applyCameraSettings(camera, options) {
|
|
|
2855
3371
|
camera.updateProjectionMatrix();
|
|
2856
3372
|
return;
|
|
2857
3373
|
}
|
|
2858
|
-
if (camera instanceof
|
|
3374
|
+
if (camera instanceof THREE2__namespace.OrthographicCamera) {
|
|
2859
3375
|
camera.left = typeof options.left === "number" ? options.left : -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2860
3376
|
camera.right = typeof options.right === "number" ? options.right : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2861
3377
|
camera.top = typeof options.top === "number" ? options.top : DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
@@ -2876,7 +3392,7 @@ function createCameraObject(options) {
|
|
|
2876
3392
|
const bottom = options.bottom ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2877
3393
|
const left = options.left ?? -DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2878
3394
|
const right = options.right ?? DEFAULT_ORTHOGRAPHIC_HALF_HEIGHT;
|
|
2879
|
-
const camera = new
|
|
3395
|
+
const camera = new THREE2__namespace.OrthographicCamera(
|
|
2880
3396
|
left,
|
|
2881
3397
|
right,
|
|
2882
3398
|
top,
|
|
@@ -2888,7 +3404,7 @@ function createCameraObject(options) {
|
|
|
2888
3404
|
camera.updateProjectionMatrix();
|
|
2889
3405
|
return camera;
|
|
2890
3406
|
}
|
|
2891
|
-
return new
|
|
3407
|
+
return new THREE2__namespace.PerspectiveCamera(
|
|
2892
3408
|
options.fov ?? DEFAULT_FOV2,
|
|
2893
3409
|
readViewportAspect(),
|
|
2894
3410
|
near,
|
|
@@ -2906,7 +3422,7 @@ function createCamera({ world, scene, camera, payload, isEditor }) {
|
|
|
2906
3422
|
transformInput: payload.transform
|
|
2907
3423
|
});
|
|
2908
3424
|
const objectRef = world.getComponent(entityId, Object3DRef);
|
|
2909
|
-
if (objectRef?.object instanceof
|
|
3425
|
+
if (objectRef?.object instanceof THREE2__namespace.Camera) {
|
|
2910
3426
|
objectRef.object.userData.entityId = entityId;
|
|
2911
3427
|
}
|
|
2912
3428
|
const componentOptions = {
|
|
@@ -2938,9 +3454,9 @@ function createCapsule({
|
|
|
2938
3454
|
scene,
|
|
2939
3455
|
payload
|
|
2940
3456
|
}) {
|
|
2941
|
-
const geometry = new
|
|
2942
|
-
const material = new
|
|
2943
|
-
const mesh = new
|
|
3457
|
+
const geometry = new THREE2__namespace.CapsuleGeometry(0.5, 1, 4, 8);
|
|
3458
|
+
const material = new THREE2__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
3459
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
2944
3460
|
const entityId = createBaseEntity(world, mesh, {
|
|
2945
3461
|
label: payload.name ?? "Capsule",
|
|
2946
3462
|
entityType: "capsule",
|
|
@@ -2960,9 +3476,9 @@ function createCapsule({
|
|
|
2960
3476
|
}
|
|
2961
3477
|
__name(createCapsule, "createCapsule");
|
|
2962
3478
|
function createCube({ world, scene, payload }) {
|
|
2963
|
-
const geometry = new
|
|
2964
|
-
const material = new
|
|
2965
|
-
const mesh = new
|
|
3479
|
+
const geometry = new THREE2__namespace.BoxGeometry(1, 1, 1);
|
|
3480
|
+
const material = new THREE2__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
3481
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
2966
3482
|
const entityId = createBaseEntity(world, mesh, {
|
|
2967
3483
|
label: payload.name ?? "Cube",
|
|
2968
3484
|
entityType: "cube",
|
|
@@ -2987,9 +3503,9 @@ function createCylinder({
|
|
|
2987
3503
|
scene,
|
|
2988
3504
|
payload
|
|
2989
3505
|
}) {
|
|
2990
|
-
const geometry = new
|
|
2991
|
-
const material = new
|
|
2992
|
-
const mesh = new
|
|
3506
|
+
const geometry = new THREE2__namespace.CylinderGeometry(0.5, 0.5, 1, 20);
|
|
3507
|
+
const material = new THREE2__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
3508
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
2993
3509
|
const entityId = createBaseEntity(world, mesh, {
|
|
2994
3510
|
label: payload.name ?? "Cylinder",
|
|
2995
3511
|
entityType: "cylinder",
|
|
@@ -3009,7 +3525,7 @@ function createCylinder({
|
|
|
3009
3525
|
}
|
|
3010
3526
|
__name(createCylinder, "createCylinder");
|
|
3011
3527
|
function createEmpty({ world, scene, payload, isEditor }) {
|
|
3012
|
-
const object = new
|
|
3528
|
+
const object = new THREE2__namespace.Group();
|
|
3013
3529
|
const entityId = createBaseEntity(world, object, {
|
|
3014
3530
|
label: payload.name ?? "Empty",
|
|
3015
3531
|
entityType: "empty",
|
|
@@ -3020,7 +3536,7 @@ function createEmpty({ world, scene, payload, isEditor }) {
|
|
|
3020
3536
|
}
|
|
3021
3537
|
__name(createEmpty, "createEmpty");
|
|
3022
3538
|
function createImage({ world, scene, payload }) {
|
|
3023
|
-
const anchor = new
|
|
3539
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3024
3540
|
const imagePath = payload.path ?? "";
|
|
3025
3541
|
const entityId = createBaseEntity(world, anchor, {
|
|
3026
3542
|
label: payload.name ?? "Image",
|
|
@@ -3033,7 +3549,7 @@ function createImage({ world, scene, payload }) {
|
|
|
3033
3549
|
if (!imagePath) {
|
|
3034
3550
|
return entityId;
|
|
3035
3551
|
}
|
|
3036
|
-
const loader = new
|
|
3552
|
+
const loader = new THREE2__namespace.TextureLoader();
|
|
3037
3553
|
loader.load(
|
|
3038
3554
|
imagePath,
|
|
3039
3555
|
(texture) => {
|
|
@@ -3041,13 +3557,13 @@ function createImage({ world, scene, payload }) {
|
|
|
3041
3557
|
texture.dispose();
|
|
3042
3558
|
return;
|
|
3043
3559
|
}
|
|
3044
|
-
const material = new
|
|
3560
|
+
const material = new THREE2__namespace.MeshBasicMaterial({
|
|
3045
3561
|
map: texture,
|
|
3046
3562
|
transparent: true,
|
|
3047
|
-
side:
|
|
3563
|
+
side: THREE2__namespace.DoubleSide
|
|
3048
3564
|
});
|
|
3049
|
-
const geometry = new
|
|
3050
|
-
const plane = new
|
|
3565
|
+
const geometry = new THREE2__namespace.PlaneGeometry(1, 1);
|
|
3566
|
+
const plane = new THREE2__namespace.Mesh(geometry, material);
|
|
3051
3567
|
plane.userData.entityId = entityId;
|
|
3052
3568
|
const textureImage = texture.image;
|
|
3053
3569
|
const width = textureImage?.width ?? 1;
|
|
@@ -3093,7 +3609,7 @@ function createImageTarget({
|
|
|
3093
3609
|
payload,
|
|
3094
3610
|
isEditor
|
|
3095
3611
|
}) {
|
|
3096
|
-
const anchor = new
|
|
3612
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3097
3613
|
const imagePath = payload.path ?? "";
|
|
3098
3614
|
const entityId = createBaseEntity(world, anchor, {
|
|
3099
3615
|
label: payload.name ?? "Image Target",
|
|
@@ -3110,7 +3626,7 @@ function createImageTarget({
|
|
|
3110
3626
|
if (!isEditor || !imagePath) {
|
|
3111
3627
|
return entityId;
|
|
3112
3628
|
}
|
|
3113
|
-
const loader = new
|
|
3629
|
+
const loader = new THREE2__namespace.TextureLoader();
|
|
3114
3630
|
loader.load(
|
|
3115
3631
|
imagePath,
|
|
3116
3632
|
(texture) => {
|
|
@@ -3118,13 +3634,13 @@ function createImageTarget({
|
|
|
3118
3634
|
texture.dispose();
|
|
3119
3635
|
return;
|
|
3120
3636
|
}
|
|
3121
|
-
const material = new
|
|
3637
|
+
const material = new THREE2__namespace.MeshBasicMaterial({
|
|
3122
3638
|
map: texture,
|
|
3123
3639
|
transparent: true,
|
|
3124
|
-
side:
|
|
3640
|
+
side: THREE2__namespace.DoubleSide
|
|
3125
3641
|
});
|
|
3126
|
-
const geometry = new
|
|
3127
|
-
const plane = new
|
|
3642
|
+
const geometry = new THREE2__namespace.PlaneGeometry(1, 1);
|
|
3643
|
+
const plane = new THREE2__namespace.Mesh(geometry, material);
|
|
3128
3644
|
plane.userData.entityId = entityId;
|
|
3129
3645
|
const textureImage = texture.image;
|
|
3130
3646
|
const width = textureImage?.width ?? 1;
|
|
@@ -3175,7 +3691,7 @@ function createInstancedMesh({
|
|
|
3175
3691
|
scene,
|
|
3176
3692
|
payload
|
|
3177
3693
|
}) {
|
|
3178
|
-
const anchor = new
|
|
3694
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3179
3695
|
const opts = payload.options ?? {};
|
|
3180
3696
|
const meshKind = isInstancedMeshKind(opts.meshKind) ? opts.meshKind : "cube";
|
|
3181
3697
|
const meshParameters = opts.meshParameters && typeof opts.meshParameters === "object" ? opts.meshParameters : void 0;
|
|
@@ -3246,7 +3762,7 @@ function createAmbientLight({
|
|
|
3246
3762
|
scene,
|
|
3247
3763
|
payload
|
|
3248
3764
|
}) {
|
|
3249
|
-
const light = new
|
|
3765
|
+
const light = new THREE2__namespace.AmbientLight("#ffffff", 0.6);
|
|
3250
3766
|
const entityId = createBaseEntity(world, light, {
|
|
3251
3767
|
label: payload.name ?? "Ambient Light",
|
|
3252
3768
|
entityType: "ambientLight",
|
|
@@ -3257,13 +3773,272 @@ function createAmbientLight({
|
|
|
3257
3773
|
return entityId;
|
|
3258
3774
|
}
|
|
3259
3775
|
__name(createAmbientLight, "createAmbientLight");
|
|
3776
|
+
var PixelationShader = {
|
|
3777
|
+
name: "PixelationShader",
|
|
3778
|
+
uniforms: {
|
|
3779
|
+
tDiffuse: { value: null },
|
|
3780
|
+
resolution: { value: new THREE2__namespace.Vector2(1, 1) },
|
|
3781
|
+
pixelSize: { value: 6 }
|
|
3782
|
+
},
|
|
3783
|
+
vertexShader: (
|
|
3784
|
+
/* glsl */
|
|
3785
|
+
`
|
|
3786
|
+
varying vec2 vUv;
|
|
3787
|
+
void main() {
|
|
3788
|
+
vUv = uv;
|
|
3789
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
3790
|
+
}
|
|
3791
|
+
`
|
|
3792
|
+
),
|
|
3793
|
+
fragmentShader: (
|
|
3794
|
+
/* glsl */
|
|
3795
|
+
`
|
|
3796
|
+
uniform sampler2D tDiffuse;
|
|
3797
|
+
uniform vec2 resolution;
|
|
3798
|
+
uniform float pixelSize;
|
|
3799
|
+
varying vec2 vUv;
|
|
3800
|
+
void main() {
|
|
3801
|
+
vec2 block = max(pixelSize, 1.0) / resolution;
|
|
3802
|
+
vec2 coord = block * (floor(vUv / block) + 0.5);
|
|
3803
|
+
gl_FragColor = texture2D(tDiffuse, coord);
|
|
3804
|
+
}
|
|
3805
|
+
`
|
|
3806
|
+
)
|
|
3807
|
+
};
|
|
3808
|
+
var _PixelationPass = class _PixelationPass extends ShaderPass_js.ShaderPass {
|
|
3809
|
+
constructor(granularity, getPixelRatio) {
|
|
3810
|
+
super(PixelationShader);
|
|
3811
|
+
this.granularity = Math.max(1, granularity);
|
|
3812
|
+
this.getPixelRatio = getPixelRatio;
|
|
3813
|
+
this.updatePixelSize();
|
|
3814
|
+
}
|
|
3815
|
+
updatePixelSize() {
|
|
3816
|
+
const uniform = this.uniforms.pixelSize;
|
|
3817
|
+
if (uniform) {
|
|
3818
|
+
uniform.value = this.granularity * Math.max(1, this.getPixelRatio());
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
setSize(width, height) {
|
|
3822
|
+
const resolution = this.uniforms.resolution;
|
|
3823
|
+
if (resolution) {
|
|
3824
|
+
resolution.value.set(Math.max(1, width), Math.max(1, height));
|
|
3825
|
+
}
|
|
3826
|
+
this.updatePixelSize();
|
|
3827
|
+
}
|
|
3828
|
+
};
|
|
3829
|
+
__name(_PixelationPass, "PixelationPass");
|
|
3830
|
+
var PixelationPass = _PixelationPass;
|
|
3831
|
+
function createWebglPostprocessing({
|
|
3832
|
+
renderer: rendererInput,
|
|
3833
|
+
scene,
|
|
3834
|
+
camera,
|
|
3835
|
+
values
|
|
3836
|
+
}) {
|
|
3837
|
+
const renderer = rendererInput;
|
|
3838
|
+
const composer = new EffectComposer_js.EffectComposer(renderer);
|
|
3839
|
+
composer.addPass(new RenderPass_js.RenderPass(scene, camera));
|
|
3840
|
+
if (values.dof.enabled) {
|
|
3841
|
+
composer.addPass(
|
|
3842
|
+
new BokehPass_js.BokehPass(scene, camera, {
|
|
3843
|
+
focus: values.dof.focusDistance,
|
|
3844
|
+
aperture: Math.max(0, values.dof.focalLength),
|
|
3845
|
+
maxblur: Math.max(0, values.dof.bokehScale)
|
|
3846
|
+
})
|
|
3847
|
+
);
|
|
3848
|
+
}
|
|
3849
|
+
if (values.bloom.enabled) {
|
|
3850
|
+
const size = renderer.getSize(new THREE2__namespace.Vector2());
|
|
3851
|
+
composer.addPass(
|
|
3852
|
+
new UnrealBloomPass_js.UnrealBloomPass(
|
|
3853
|
+
new THREE2__namespace.Vector2(size.width, size.height),
|
|
3854
|
+
values.bloom.intensity,
|
|
3855
|
+
values.bloom.radius,
|
|
3856
|
+
values.bloom.threshold
|
|
3857
|
+
)
|
|
3858
|
+
);
|
|
3859
|
+
}
|
|
3860
|
+
if (values.vignette.enabled) {
|
|
3861
|
+
const pass = new ShaderPass_js.ShaderPass(VignetteShader_js.VignetteShader);
|
|
3862
|
+
const offset = pass.uniforms.offset;
|
|
3863
|
+
const darkness = pass.uniforms.darkness;
|
|
3864
|
+
if (offset) {
|
|
3865
|
+
offset.value = values.vignette.offset;
|
|
3866
|
+
}
|
|
3867
|
+
if (darkness) {
|
|
3868
|
+
darkness.value = values.vignette.darkness;
|
|
3869
|
+
}
|
|
3870
|
+
composer.addPass(pass);
|
|
3871
|
+
}
|
|
3872
|
+
if (values.hueSaturation.enabled) {
|
|
3873
|
+
const pass = new ShaderPass_js.ShaderPass(HueSaturationShader_js.HueSaturationShader);
|
|
3874
|
+
const hue = pass.uniforms.hue;
|
|
3875
|
+
const saturation = pass.uniforms.saturation;
|
|
3876
|
+
if (hue) {
|
|
3877
|
+
hue.value = values.hueSaturation.hue;
|
|
3878
|
+
}
|
|
3879
|
+
if (saturation) {
|
|
3880
|
+
saturation.value = values.hueSaturation.saturation;
|
|
3881
|
+
}
|
|
3882
|
+
composer.addPass(pass);
|
|
3883
|
+
}
|
|
3884
|
+
if (values.sepia.enabled) {
|
|
3885
|
+
const pass = new ShaderPass_js.ShaderPass(SepiaShader_js.SepiaShader);
|
|
3886
|
+
const amount = pass.uniforms.amount;
|
|
3887
|
+
if (amount) {
|
|
3888
|
+
amount.value = values.sepia.intensity;
|
|
3889
|
+
}
|
|
3890
|
+
composer.addPass(pass);
|
|
3891
|
+
}
|
|
3892
|
+
if (values.noise.enabled) {
|
|
3893
|
+
composer.addPass(new FilmPass_js.FilmPass(values.noise.opacity));
|
|
3894
|
+
}
|
|
3895
|
+
if (values.dotScreen.enabled) {
|
|
3896
|
+
composer.addPass(
|
|
3897
|
+
new DotScreenPass_js.DotScreenPass(
|
|
3898
|
+
new THREE2__namespace.Vector2(0, 0),
|
|
3899
|
+
values.dotScreen.angle ?? values.dotScreen.dotScreenAngle,
|
|
3900
|
+
values.dotScreen.scale ?? values.dotScreen.dotScreenScale
|
|
3901
|
+
)
|
|
3902
|
+
);
|
|
3903
|
+
}
|
|
3904
|
+
if (values.ssao.enabled) {
|
|
3905
|
+
const pass = new SSAOPass_js.SSAOPass(scene, camera);
|
|
3906
|
+
pass.kernelRadius = values.ssao.radius;
|
|
3907
|
+
pass.minDistance = 1e-3;
|
|
3908
|
+
pass.maxDistance = Math.max(0.01, values.ssao.intensity);
|
|
3909
|
+
composer.addPass(pass);
|
|
3910
|
+
}
|
|
3911
|
+
if (values.glitch.enabled) {
|
|
3912
|
+
const pass = new GlitchPass_js.GlitchPass();
|
|
3913
|
+
pass.enabled = true;
|
|
3914
|
+
pass.goWild = Boolean(values.glitch.active);
|
|
3915
|
+
composer.addPass(pass);
|
|
3916
|
+
}
|
|
3917
|
+
if (values.chromAberration.enabled) {
|
|
3918
|
+
const pass = new ShaderPass_js.ShaderPass(RGBShiftShader_js.RGBShiftShader);
|
|
3919
|
+
const { offsetX, offsetY } = values.chromAberration;
|
|
3920
|
+
const amount = pass.uniforms.amount;
|
|
3921
|
+
const angle = pass.uniforms.angle;
|
|
3922
|
+
if (amount) {
|
|
3923
|
+
amount.value = Math.hypot(offsetX, offsetY);
|
|
3924
|
+
}
|
|
3925
|
+
if (angle) {
|
|
3926
|
+
angle.value = Math.atan2(offsetY, offsetX);
|
|
3927
|
+
}
|
|
3928
|
+
composer.addPass(pass);
|
|
3929
|
+
}
|
|
3930
|
+
if (values.pixelation.enabled) {
|
|
3931
|
+
composer.addPass(
|
|
3932
|
+
new PixelationPass(
|
|
3933
|
+
values.pixelation.granularity,
|
|
3934
|
+
() => typeof renderer.getPixelRatio === "function" ? renderer.getPixelRatio() : 1
|
|
3935
|
+
)
|
|
3936
|
+
);
|
|
3937
|
+
}
|
|
3938
|
+
if (values.smaa.enabled) {
|
|
3939
|
+
composer.addPass(new SMAAPass_js.SMAAPass());
|
|
3940
|
+
}
|
|
3941
|
+
composer.addPass(new OutputPass_js.OutputPass());
|
|
3942
|
+
return composer;
|
|
3943
|
+
}
|
|
3944
|
+
__name(createWebglPostprocessing, "createWebglPostprocessing");
|
|
3945
|
+
var CHROMA_KEY_FLAG = "ecsChromaKey";
|
|
3946
|
+
function createWebglChromaKeyMaterial(texture, options) {
|
|
3947
|
+
const material = new THREE2__namespace.ShaderMaterial({
|
|
3948
|
+
uniforms: {
|
|
3949
|
+
tex: { value: texture },
|
|
3950
|
+
keyColor: { value: new THREE2__namespace.Color(options.keyColor) },
|
|
3951
|
+
similarity: { value: options.similarity },
|
|
3952
|
+
smoothness: { value: options.smoothness },
|
|
3953
|
+
spill: { value: options.spill }
|
|
3954
|
+
},
|
|
3955
|
+
vertexShader: `
|
|
3956
|
+
varying vec2 vUv;
|
|
3957
|
+
void main() {
|
|
3958
|
+
vUv = uv;
|
|
3959
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
3960
|
+
}
|
|
3961
|
+
`,
|
|
3962
|
+
fragmentShader: `
|
|
3963
|
+
uniform sampler2D tex;
|
|
3964
|
+
uniform vec3 keyColor;
|
|
3965
|
+
uniform float similarity;
|
|
3966
|
+
uniform float smoothness;
|
|
3967
|
+
uniform float spill;
|
|
3968
|
+
varying vec2 vUv;
|
|
3969
|
+
|
|
3970
|
+
void main() {
|
|
3971
|
+
vec4 texel = texture2D(tex, vUv);
|
|
3972
|
+
float chromaDist = distance(texel.rgb, keyColor);
|
|
3973
|
+
float alpha = smoothstep(similarity, similarity + smoothness, chromaDist);
|
|
3974
|
+
|
|
3975
|
+
float spillFactor = smoothstep(similarity, similarity + spill + smoothness, chromaDist);
|
|
3976
|
+
vec3 despilled = mix(vec3(dot(texel.rgb, vec3(0.299, 0.587, 0.114))), texel.rgb, spillFactor);
|
|
3977
|
+
|
|
3978
|
+
gl_FragColor = vec4(despilled, texel.a * alpha);
|
|
3979
|
+
}
|
|
3980
|
+
`,
|
|
3981
|
+
transparent: true,
|
|
3982
|
+
side: THREE2__namespace.DoubleSide
|
|
3983
|
+
});
|
|
3984
|
+
material.userData[CHROMA_KEY_FLAG] = true;
|
|
3985
|
+
return material;
|
|
3986
|
+
}
|
|
3987
|
+
__name(createWebglChromaKeyMaterial, "createWebglChromaKeyMaterial");
|
|
3988
|
+
function updateWebglChromaKeyMaterial(material, options) {
|
|
3989
|
+
if (!(material instanceof THREE2__namespace.ShaderMaterial)) return false;
|
|
3990
|
+
const { keyColor, similarity, smoothness, spill } = material.uniforms;
|
|
3991
|
+
if (!keyColor || !similarity || !smoothness || !spill) return false;
|
|
3992
|
+
keyColor.value.set(options.keyColor);
|
|
3993
|
+
similarity.value = options.similarity;
|
|
3994
|
+
smoothness.value = options.smoothness;
|
|
3995
|
+
spill.value = options.spill;
|
|
3996
|
+
return true;
|
|
3997
|
+
}
|
|
3998
|
+
__name(updateWebglChromaKeyMaterial, "updateWebglChromaKeyMaterial");
|
|
3999
|
+
var areaLightTablesRequested = false;
|
|
4000
|
+
function prepareWebglAreaLights() {
|
|
4001
|
+
if (areaLightTablesRequested) return;
|
|
4002
|
+
areaLightTablesRequested = true;
|
|
4003
|
+
import('three/examples/jsm/lights/RectAreaLightUniformsLib.js').then(
|
|
4004
|
+
({ RectAreaLightUniformsLib }) => {
|
|
4005
|
+
RectAreaLightUniformsLib.init();
|
|
4006
|
+
},
|
|
4007
|
+
(error) => {
|
|
4008
|
+
areaLightTablesRequested = false;
|
|
4009
|
+
console.warn("[spatial-ecs] Could not load the area light tables.", error);
|
|
4010
|
+
}
|
|
4011
|
+
);
|
|
4012
|
+
}
|
|
4013
|
+
__name(prepareWebglAreaLights, "prepareWebglAreaLights");
|
|
4014
|
+
var webglBackend = {
|
|
4015
|
+
kind: "webgl",
|
|
4016
|
+
prepareAreaLights: prepareWebglAreaLights,
|
|
4017
|
+
createPostprocessing: createWebglPostprocessing,
|
|
4018
|
+
createChromaKeyMaterial: createWebglChromaKeyMaterial,
|
|
4019
|
+
updateChromaKeyMaterial: updateWebglChromaKeyMaterial
|
|
4020
|
+
};
|
|
4021
|
+
|
|
4022
|
+
// core/render/resolveBackend.ts
|
|
4023
|
+
function readWorldRenderBackend(world) {
|
|
4024
|
+
const getter = world?.getRenderBackend;
|
|
4025
|
+
if (typeof getter === "function") {
|
|
4026
|
+
const backend = getter.call(world);
|
|
4027
|
+
if (backend) return backend;
|
|
4028
|
+
}
|
|
4029
|
+
return webglBackend;
|
|
4030
|
+
}
|
|
4031
|
+
__name(readWorldRenderBackend, "readWorldRenderBackend");
|
|
4032
|
+
|
|
4033
|
+
// core/factories/objects/lights/AreaLightFactory.ts
|
|
3260
4034
|
function createAreaLight({
|
|
3261
4035
|
world,
|
|
3262
4036
|
scene,
|
|
3263
4037
|
payload,
|
|
3264
4038
|
isEditor
|
|
3265
4039
|
}) {
|
|
3266
|
-
|
|
4040
|
+
readWorldRenderBackend(world).prepareAreaLights?.(world);
|
|
4041
|
+
const light = new THREE2__namespace.RectAreaLight("#ffffff", 5, 4, 4);
|
|
3267
4042
|
light.lookAt(0, 0, 0);
|
|
3268
4043
|
const entityId = createBaseEntity(world, light, {
|
|
3269
4044
|
label: payload.name ?? "Area Light",
|
|
@@ -3292,7 +4067,7 @@ function createDirectionalLight({
|
|
|
3292
4067
|
payload,
|
|
3293
4068
|
isEditor
|
|
3294
4069
|
}) {
|
|
3295
|
-
const light = new
|
|
4070
|
+
const light = new THREE2__namespace.DirectionalLight("#ffffff", 1.5);
|
|
3296
4071
|
light.castShadow = true;
|
|
3297
4072
|
const entityId = createBaseEntity(world, light, {
|
|
3298
4073
|
label: payload.name ?? "Directional Light",
|
|
@@ -3303,7 +4078,7 @@ function createDirectionalLight({
|
|
|
3303
4078
|
});
|
|
3304
4079
|
createLightComponent(world, entityId, light);
|
|
3305
4080
|
if (isEditor) {
|
|
3306
|
-
const helper = new
|
|
4081
|
+
const helper = new THREE2__namespace.DirectionalLightHelper(light, 1.8, "#38bdf8");
|
|
3307
4082
|
helper.onBeforeRender = () => {
|
|
3308
4083
|
helper.update();
|
|
3309
4084
|
};
|
|
@@ -3321,7 +4096,7 @@ function createPointLight({
|
|
|
3321
4096
|
payload,
|
|
3322
4097
|
isEditor
|
|
3323
4098
|
}) {
|
|
3324
|
-
const light = new
|
|
4099
|
+
const light = new THREE2__namespace.PointLight("#ffffff", 1, 10);
|
|
3325
4100
|
const entityId = createBaseEntity(world, light, {
|
|
3326
4101
|
label: payload.name ?? "Point Light",
|
|
3327
4102
|
entityType: "pointLight",
|
|
@@ -3331,7 +4106,7 @@ function createPointLight({
|
|
|
3331
4106
|
});
|
|
3332
4107
|
createLightComponent(world, entityId, light);
|
|
3333
4108
|
if (isEditor) {
|
|
3334
|
-
const helper = new
|
|
4109
|
+
const helper = new THREE2__namespace.PointLightHelper(light, 0.35, "#fbbf24");
|
|
3335
4110
|
helper.onBeforeRender = () => {
|
|
3336
4111
|
helper.update();
|
|
3337
4112
|
};
|
|
@@ -3349,7 +4124,7 @@ function createSpotLight({
|
|
|
3349
4124
|
payload,
|
|
3350
4125
|
isEditor
|
|
3351
4126
|
}) {
|
|
3352
|
-
const light = new
|
|
4127
|
+
const light = new THREE2__namespace.SpotLight("#ffffff", 1, 20, Math.PI / 6, 0.1, 1);
|
|
3353
4128
|
const entityId = createBaseEntity(world, light, {
|
|
3354
4129
|
label: payload.name ?? "Spot Light",
|
|
3355
4130
|
entityType: "spotLight",
|
|
@@ -3359,7 +4134,7 @@ function createSpotLight({
|
|
|
3359
4134
|
});
|
|
3360
4135
|
createLightComponent(world, entityId, light);
|
|
3361
4136
|
if (isEditor) {
|
|
3362
|
-
const helper = new
|
|
4137
|
+
const helper = new THREE2__namespace.SpotLightHelper(light, "#f59e0b");
|
|
3363
4138
|
helper.onBeforeRender = () => {
|
|
3364
4139
|
helper.update();
|
|
3365
4140
|
};
|
|
@@ -3371,126 +4146,13 @@ function createSpotLight({
|
|
|
3371
4146
|
return entityId;
|
|
3372
4147
|
}
|
|
3373
4148
|
__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
4149
|
function createPlane({ world, scene, payload }) {
|
|
3488
|
-
const geometry = new
|
|
3489
|
-
const material = new
|
|
4150
|
+
const geometry = new THREE2__namespace.PlaneGeometry(100, 100);
|
|
4151
|
+
const material = new THREE2__namespace.MeshStandardMaterial({
|
|
3490
4152
|
color: "#ffffff",
|
|
3491
|
-
side:
|
|
4153
|
+
side: THREE2__namespace.DoubleSide
|
|
3492
4154
|
});
|
|
3493
|
-
const mesh = new
|
|
4155
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
3494
4156
|
const entityId = createBaseEntity(
|
|
3495
4157
|
world,
|
|
3496
4158
|
mesh,
|
|
@@ -3526,7 +4188,7 @@ function createScriptObject({
|
|
|
3526
4188
|
scene,
|
|
3527
4189
|
payload
|
|
3528
4190
|
}) {
|
|
3529
|
-
const object = new
|
|
4191
|
+
const object = new THREE2__namespace.Group();
|
|
3530
4192
|
const entityId = createBaseEntity(world, object, {
|
|
3531
4193
|
label: payload.name ?? "Script Object",
|
|
3532
4194
|
entityType: "scriptObject",
|
|
@@ -3551,15 +4213,15 @@ function createTeleportArea({
|
|
|
3551
4213
|
const options = payload.options ?? {};
|
|
3552
4214
|
const width = typeof options.width === "number" ? options.width : 10;
|
|
3553
4215
|
const depth = typeof options.depth === "number" ? options.depth : 10;
|
|
3554
|
-
const geometry = new
|
|
3555
|
-
const material = new
|
|
4216
|
+
const geometry = new THREE2__namespace.PlaneGeometry(width, depth);
|
|
4217
|
+
const material = new THREE2__namespace.MeshBasicMaterial({
|
|
3556
4218
|
color: "#4da3ff",
|
|
3557
4219
|
transparent: true,
|
|
3558
4220
|
opacity: 0.18,
|
|
3559
|
-
side:
|
|
4221
|
+
side: THREE2__namespace.DoubleSide,
|
|
3560
4222
|
depthWrite: false
|
|
3561
4223
|
});
|
|
3562
|
-
const object = new
|
|
4224
|
+
const object = new THREE2__namespace.Mesh(geometry, material);
|
|
3563
4225
|
const entityId = createBaseEntity(world, object, {
|
|
3564
4226
|
label: payload.name ?? "Teleport Area",
|
|
3565
4227
|
entityType: "teleportArea",
|
|
@@ -3587,7 +4249,7 @@ function createXRInteractor({
|
|
|
3587
4249
|
scene,
|
|
3588
4250
|
payload
|
|
3589
4251
|
}) {
|
|
3590
|
-
const root = new
|
|
4252
|
+
const root = new THREE2__namespace.Group();
|
|
3591
4253
|
const options = payload.options ?? {};
|
|
3592
4254
|
const entityId = createBaseEntity(world, root, {
|
|
3593
4255
|
label: payload.name ?? "XR Interactor",
|
|
@@ -3600,7 +4262,7 @@ function createXRInteractor({
|
|
|
3600
4262
|
return entityId;
|
|
3601
4263
|
}
|
|
3602
4264
|
for (const side of ["left", "right"]) {
|
|
3603
|
-
const slot = new
|
|
4265
|
+
const slot = new THREE2__namespace.Group();
|
|
3604
4266
|
const label = side === "left" ? "Left Interactor" : "Right Interactor";
|
|
3605
4267
|
const slotEntityId = createBaseEntity(world, slot, {
|
|
3606
4268
|
label,
|
|
@@ -3618,7 +4280,7 @@ function createUIButton({
|
|
|
3618
4280
|
scene,
|
|
3619
4281
|
payload
|
|
3620
4282
|
}) {
|
|
3621
|
-
const object = new
|
|
4283
|
+
const object = new THREE2__namespace.Group();
|
|
3622
4284
|
const entityId = createBaseEntity(world, object, {
|
|
3623
4285
|
label: payload.name ?? "UI Button",
|
|
3624
4286
|
entityType: "uiButton",
|
|
@@ -3643,7 +4305,7 @@ function createUIPanel({
|
|
|
3643
4305
|
scene,
|
|
3644
4306
|
payload
|
|
3645
4307
|
}) {
|
|
3646
|
-
const object = new
|
|
4308
|
+
const object = new THREE2__namespace.Group();
|
|
3647
4309
|
const entityId = createBaseEntity(world, object, {
|
|
3648
4310
|
label: payload.name ?? "UI Panel",
|
|
3649
4311
|
entityType: "uiPanel",
|
|
@@ -3660,7 +4322,7 @@ function createUISlider({
|
|
|
3660
4322
|
scene,
|
|
3661
4323
|
payload
|
|
3662
4324
|
}) {
|
|
3663
|
-
const object = new
|
|
4325
|
+
const object = new THREE2__namespace.Group();
|
|
3664
4326
|
const entityId = createBaseEntity(world, object, {
|
|
3665
4327
|
label: payload.name ?? "UI Slider",
|
|
3666
4328
|
entityType: "uiSlider",
|
|
@@ -3685,7 +4347,7 @@ function createUIText({
|
|
|
3685
4347
|
scene,
|
|
3686
4348
|
payload
|
|
3687
4349
|
}) {
|
|
3688
|
-
const object = new
|
|
4350
|
+
const object = new THREE2__namespace.Group();
|
|
3689
4351
|
const entityId = createBaseEntity(world, object, {
|
|
3690
4352
|
label: payload.name ?? "UI Text",
|
|
3691
4353
|
entityType: "uiText",
|
|
@@ -3702,7 +4364,7 @@ function createUIToggle({
|
|
|
3702
4364
|
scene,
|
|
3703
4365
|
payload
|
|
3704
4366
|
}) {
|
|
3705
|
-
const object = new
|
|
4367
|
+
const object = new THREE2__namespace.Group();
|
|
3706
4368
|
const entityId = createBaseEntity(world, object, {
|
|
3707
4369
|
label: payload.name ?? "UI Toggle",
|
|
3708
4370
|
entityType: "uiToggle",
|
|
@@ -3727,7 +4389,7 @@ function createXRRig({
|
|
|
3727
4389
|
scene,
|
|
3728
4390
|
payload
|
|
3729
4391
|
}) {
|
|
3730
|
-
const object = new
|
|
4392
|
+
const object = new THREE2__namespace.Group();
|
|
3731
4393
|
const entityId = createBaseEntity(world, object, {
|
|
3732
4394
|
label: payload.name ?? "XR Rig",
|
|
3733
4395
|
entityType: "xrRig",
|
|
@@ -3740,7 +4402,7 @@ function createXRRig({
|
|
|
3740
4402
|
}
|
|
3741
4403
|
__name(createXRRig, "createXRRig");
|
|
3742
4404
|
function createSprite({ world, scene, payload }) {
|
|
3743
|
-
const anchor = new
|
|
4405
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3744
4406
|
const imagePath = payload.path ?? "";
|
|
3745
4407
|
const entityId = createBaseEntity(world, anchor, {
|
|
3746
4408
|
label: payload.name ?? "Sprite",
|
|
@@ -3752,7 +4414,7 @@ function createSprite({ world, scene, payload }) {
|
|
|
3752
4414
|
if (!imagePath) {
|
|
3753
4415
|
return entityId;
|
|
3754
4416
|
}
|
|
3755
|
-
const loader = new
|
|
4417
|
+
const loader = new THREE2__namespace.TextureLoader();
|
|
3756
4418
|
loader.load(
|
|
3757
4419
|
imagePath,
|
|
3758
4420
|
(texture) => {
|
|
@@ -3760,11 +4422,11 @@ function createSprite({ world, scene, payload }) {
|
|
|
3760
4422
|
texture.dispose();
|
|
3761
4423
|
return;
|
|
3762
4424
|
}
|
|
3763
|
-
const material = new
|
|
4425
|
+
const material = new THREE2__namespace.SpriteMaterial({
|
|
3764
4426
|
map: texture,
|
|
3765
4427
|
transparent: true
|
|
3766
4428
|
});
|
|
3767
|
-
const sprite = new
|
|
4429
|
+
const sprite = new THREE2__namespace.Sprite(material);
|
|
3768
4430
|
sprite.userData.entityId = entityId;
|
|
3769
4431
|
const textureImage = texture.image;
|
|
3770
4432
|
spriteComponent.width = textureImage?.width ?? 1;
|
|
@@ -3782,9 +4444,9 @@ function createSprite({ world, scene, payload }) {
|
|
|
3782
4444
|
}
|
|
3783
4445
|
__name(createSprite, "createSprite");
|
|
3784
4446
|
function createSphere({ world, scene, payload }) {
|
|
3785
|
-
const geometry = new
|
|
3786
|
-
const material = new
|
|
3787
|
-
const mesh = new
|
|
4447
|
+
const geometry = new THREE2__namespace.SphereGeometry(0.5, 24, 24);
|
|
4448
|
+
const material = new THREE2__namespace.MeshStandardMaterial({ color: "#ffffff" });
|
|
4449
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
3788
4450
|
const entityId = createBaseEntity(world, mesh, {
|
|
3789
4451
|
label: payload.name ?? "Sphere",
|
|
3790
4452
|
entityType: "sphere",
|
|
@@ -3804,10 +4466,10 @@ function createSphere({ world, scene, payload }) {
|
|
|
3804
4466
|
__name(createSphere, "createSphere");
|
|
3805
4467
|
function getOrCreateListener2(camera) {
|
|
3806
4468
|
const existing = camera.userData.ecsAudioListener;
|
|
3807
|
-
if (existing instanceof
|
|
4469
|
+
if (existing instanceof THREE2__namespace.AudioListener) {
|
|
3808
4470
|
return existing;
|
|
3809
4471
|
}
|
|
3810
|
-
const listener = new
|
|
4472
|
+
const listener = new THREE2__namespace.AudioListener();
|
|
3811
4473
|
camera.add(listener);
|
|
3812
4474
|
camera.userData.ecsAudioListener = listener;
|
|
3813
4475
|
return listener;
|
|
@@ -3856,58 +4518,23 @@ function normalizeOptions(input) {
|
|
|
3856
4518
|
};
|
|
3857
4519
|
}
|
|
3858
4520
|
__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
4521
|
function createStandardMaterial(texture) {
|
|
3900
|
-
return new
|
|
4522
|
+
return new THREE2__namespace.MeshBasicMaterial({
|
|
3901
4523
|
map: texture,
|
|
3902
4524
|
transparent: true,
|
|
3903
|
-
side:
|
|
4525
|
+
side: THREE2__namespace.DoubleSide
|
|
3904
4526
|
});
|
|
3905
4527
|
}
|
|
3906
4528
|
__name(createStandardMaterial, "createStandardMaterial");
|
|
3907
|
-
function createVideoMesh(entityId, texture, options) {
|
|
3908
|
-
const geometry = new
|
|
3909
|
-
const material = options.isGreenScreen ?
|
|
3910
|
-
|
|
4529
|
+
function createVideoMesh(entityId, texture, options, backend) {
|
|
4530
|
+
const geometry = new THREE2__namespace.PlaneGeometry(1, 1);
|
|
4531
|
+
const material = options.isGreenScreen ? backend.createChromaKeyMaterial(texture, {
|
|
4532
|
+
keyColor: options.backgroundColor,
|
|
4533
|
+
similarity: options.similarity,
|
|
4534
|
+
smoothness: options.smoothness,
|
|
4535
|
+
spill: options.spill
|
|
4536
|
+
}) : createStandardMaterial(texture);
|
|
4537
|
+
const mesh = new THREE2__namespace.Mesh(geometry, material);
|
|
3911
4538
|
mesh.userData.entityId = entityId;
|
|
3912
4539
|
mesh.scale.set(options.width, options.height, 1);
|
|
3913
4540
|
return { mesh, material };
|
|
@@ -3942,7 +4569,7 @@ function createVideo({
|
|
|
3942
4569
|
payload,
|
|
3943
4570
|
isEditor
|
|
3944
4571
|
}) {
|
|
3945
|
-
const anchor = new
|
|
4572
|
+
const anchor = new THREE2__namespace.Object3D();
|
|
3946
4573
|
const path = payload.path ?? "";
|
|
3947
4574
|
const options = normalizeOptions(payload.options);
|
|
3948
4575
|
const entityId = createBaseEntity(world, anchor, {
|
|
@@ -3957,10 +4584,15 @@ function createVideo({
|
|
|
3957
4584
|
return entityId;
|
|
3958
4585
|
}
|
|
3959
4586
|
const video = createVideoElement(path, options);
|
|
3960
|
-
const texture = new
|
|
3961
|
-
texture.colorSpace =
|
|
4587
|
+
const texture = new THREE2__namespace.VideoTexture(video);
|
|
4588
|
+
texture.colorSpace = THREE2__namespace.SRGBColorSpace;
|
|
3962
4589
|
texture.needsUpdate = true;
|
|
3963
|
-
const { mesh, material } = createVideoMesh(
|
|
4590
|
+
const { mesh, material } = createVideoMesh(
|
|
4591
|
+
entityId,
|
|
4592
|
+
texture,
|
|
4593
|
+
options,
|
|
4594
|
+
readWorldRenderBackend(world)
|
|
4595
|
+
);
|
|
3964
4596
|
anchor.add(mesh);
|
|
3965
4597
|
videoComponent.videoElement = video;
|
|
3966
4598
|
videoComponent.texture = texture;
|
|
@@ -3974,7 +4606,7 @@ function createVideo({
|
|
|
3974
4606
|
});
|
|
3975
4607
|
if (!isEditor && options.positional) {
|
|
3976
4608
|
const listener = getOrCreateListener2(camera);
|
|
3977
|
-
const audioNode = new
|
|
4609
|
+
const audioNode = new THREE2__namespace.PositionalAudio(listener);
|
|
3978
4610
|
audioNode.setVolume(options.volume);
|
|
3979
4611
|
audioNode.setRefDistance(options.refDistance);
|
|
3980
4612
|
audioNode.setDistanceModel(normalizeDistanceModel2(options.distanceModel));
|
|
@@ -4028,9 +4660,11 @@ __name(registerDefaultFactories, "registerDefaultFactories");
|
|
|
4028
4660
|
|
|
4029
4661
|
exports.createAnimationComponent = createAnimationComponent;
|
|
4030
4662
|
exports.createAudioComponent = createAudioComponent;
|
|
4663
|
+
exports.createBoneAttachmentComponent = createBoneAttachmentComponent;
|
|
4031
4664
|
exports.createCameraComponent = createCameraComponent;
|
|
4032
4665
|
exports.createEntityTypeComponent = createEntityTypeComponent;
|
|
4033
4666
|
exports.createEnvironmentComponent = createEnvironmentComponent;
|
|
4667
|
+
exports.createIKComponent = createIKComponent;
|
|
4034
4668
|
exports.createImageComponent = createImageComponent;
|
|
4035
4669
|
exports.createImageTargetAnchorComponent = createImageTargetAnchorComponent;
|
|
4036
4670
|
exports.createImageTargetComponent = createImageTargetComponent;
|
|
@@ -4042,6 +4676,10 @@ exports.createMeshComponent = createMeshComponent;
|
|
|
4042
4676
|
exports.createMeshGeometryComponent = createMeshGeometryComponent;
|
|
4043
4677
|
exports.createModelComponent = createModelComponent;
|
|
4044
4678
|
exports.createNameComponent = createNameComponent;
|
|
4679
|
+
exports.createNetworkIdentityComponent = createNetworkIdentityComponent;
|
|
4680
|
+
exports.createNetworkSpawnerComponent = createNetworkSpawnerComponent;
|
|
4681
|
+
exports.createNetworkTransformComponent = createNetworkTransformComponent;
|
|
4682
|
+
exports.createNetworkedPropsComponent = createNetworkedPropsComponent;
|
|
4045
4683
|
exports.createObject3DRefComponent = createObject3DRefComponent;
|
|
4046
4684
|
exports.createParentIdComponent = createParentIdComponent;
|
|
4047
4685
|
exports.createPhysicsComponent = createPhysicsComponent;
|