@needle-tools/engine 5.1.13 → 5.1.14

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.
Files changed (108) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/dist/{materialx-BBv-42Th.min.js → materialx-D3ZU4CP6.min.js} +1 -1
  3. package/dist/{materialx-0m1xlF5m.js → materialx-FhjQQgNu.js} +1 -1
  4. package/dist/{materialx-8OpPwNc7.umd.cjs → materialx-RxB3AN7d.umd.cjs} +2 -2
  5. package/dist/{needle-engine.bundle-DTvJ1zCJ.js → needle-engine.bundle-BEa7CABw.js} +2765 -2748
  6. package/dist/{needle-engine.bundle-DR967VjU.min.js → needle-engine.bundle-mkmiuKZB.min.js} +112 -112
  7. package/dist/{needle-engine.bundle-B_ZctaDt.umd.cjs → needle-engine.bundle-y1_E7Ovt.umd.cjs} +117 -117
  8. package/dist/needle-engine.d.ts +23 -23
  9. package/dist/needle-engine.js +64 -64
  10. package/dist/needle-engine.min.js +1 -1
  11. package/dist/needle-engine.umd.cjs +1 -1
  12. package/dist/{vendor-DiDMDryv.js → vendor-BVzQovzJ.js} +5161 -5161
  13. package/dist/{vendor-DE_m5MvL.umd.cjs → vendor-C5YVRzxf.umd.cjs} +5 -5
  14. package/dist/{vendor-B7IfFLrR.min.js → vendor-rvNvQ-IU.min.js} +5 -5
  15. package/lib/engine/api.d.ts +1 -1
  16. package/lib/engine/api.js +1 -1
  17. package/lib/engine/api.js.map +1 -1
  18. package/lib/engine/engine_gameobject.js +1 -1
  19. package/lib/engine/engine_gameobject.js.map +1 -1
  20. package/lib/engine/engine_gltf_builtin_components.js +1 -1
  21. package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
  22. package/lib/engine/engine_init.js +2 -2
  23. package/lib/engine/engine_init.js.map +1 -1
  24. package/lib/engine/engine_instantiate_resolve.js.map +1 -1
  25. package/lib/engine/engine_license.d.ts +7 -7
  26. package/lib/engine/engine_license.js +75 -75
  27. package/lib/engine/engine_license.js.map +1 -1
  28. package/lib/engine/engine_materialpropertyblock.js +18 -0
  29. package/lib/engine/engine_materialpropertyblock.js.map +1 -1
  30. package/lib/engine/engine_networking.d.ts +1 -1
  31. package/lib/engine/engine_networking.js +1 -1
  32. package/lib/engine/engine_networking.js.map +1 -1
  33. package/lib/engine/engine_networking_blob.js +3 -3
  34. package/lib/engine/engine_networking_blob.js.map +1 -1
  35. package/lib/engine/engine_utils_qrcode.js +2 -2
  36. package/lib/engine/engine_utils_qrcode.js.map +1 -1
  37. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  38. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
  39. package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
  40. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  41. package/lib/engine/webcomponents/needle-engine.js +2 -2
  42. package/lib/engine/webcomponents/needle-engine.js.map +1 -1
  43. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  44. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  45. package/lib/engine/xr/NeedleXRSession.js +11 -10
  46. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  47. package/lib/engine/xr/TempXRContext.js +2 -2
  48. package/lib/engine/xr/TempXRContext.js.map +1 -1
  49. package/lib/engine-components/AnimationBuilder.d.ts +1 -1
  50. package/lib/engine-components/AnimationBuilder.js.map +1 -1
  51. package/lib/engine-components/AnimatorController.builder.d.ts +2 -2
  52. package/lib/engine-components/AnimatorController.builder.js +2 -2
  53. package/lib/engine-components/AnimatorController.builder.js.map +1 -1
  54. package/lib/engine-components/Component.d.ts +1 -1
  55. package/lib/engine-components/Component.js +1 -1
  56. package/lib/engine-components/Component.js.map +1 -1
  57. package/lib/engine-components/DragControls.d.ts +2 -2
  58. package/lib/engine-components/DragControls.js +2 -2
  59. package/lib/engine-components/DragControls.js.map +1 -1
  60. package/lib/engine-components/DragControlsConstraints.js.map +1 -1
  61. package/lib/engine-components/Light.js +1 -1
  62. package/lib/engine-components/Light.js.map +1 -1
  63. package/lib/engine-components/api.d.ts +2 -2
  64. package/lib/engine-components/api.js +1 -1
  65. package/lib/engine-components/api.js.map +1 -1
  66. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  67. package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
  68. package/lib/engine-components/postprocessing/index.d.ts +1 -1
  69. package/lib/engine-components/postprocessing/index.js +1 -1
  70. package/lib/engine-components/postprocessing/index.js.map +1 -1
  71. package/lib/engine-components/timeline/TimelineBuilder.d.ts +4 -4
  72. package/lib/engine-components/timeline/TimelineBuilder.js +2 -2
  73. package/lib/engine-components/timeline/TimelineBuilder.js.map +1 -1
  74. package/lib/engine-components/timeline/TimelineTracks.js +24 -15
  75. package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
  76. package/lib/engine-components/webxr/WebXRImageTracking.utils.js.map +1 -1
  77. package/package.json +1 -1
  78. package/plugins/common/license.js +4 -4
  79. package/plugins/vite/license.js +4 -4
  80. package/src/engine/api.ts +1 -1
  81. package/src/engine/engine_gameobject.ts +2 -2
  82. package/src/engine/engine_gltf_builtin_components.ts +1 -1
  83. package/src/engine/engine_init.ts +2 -2
  84. package/src/engine/engine_instantiate_resolve.ts +1 -1
  85. package/src/engine/engine_license.ts +72 -72
  86. package/src/engine/engine_materialpropertyblock.ts +21 -0
  87. package/src/engine/engine_networking.ts +2 -2
  88. package/src/engine/engine_networking_blob.ts +3 -3
  89. package/src/engine/engine_utils_qrcode.ts +2 -2
  90. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  91. package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
  92. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  93. package/src/engine/webcomponents/needle-engine.ts +2 -2
  94. package/src/engine/xr/NeedleXRSession.ts +11 -10
  95. package/src/engine/xr/TempXRContext.ts +2 -2
  96. package/src/engine-components/AnimationBuilder.ts +1 -1
  97. package/src/engine-components/AnimatorController.builder.ts +4 -4
  98. package/src/engine-components/Component.ts +1 -1
  99. package/src/engine-components/DragControls.ts +2 -3
  100. package/src/engine-components/DragControlsConstraints.ts +1 -2
  101. package/src/engine-components/Light.ts +1 -1
  102. package/src/engine-components/api.ts +2 -2
  103. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  104. package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +1 -1
  105. package/src/engine-components/postprocessing/index.ts +1 -1
  106. package/src/engine-components/timeline/TimelineBuilder.ts +5 -5
  107. package/src/engine-components/timeline/TimelineTracks.ts +25 -17
  108. package/src/engine-components/webxr/WebXRImageTracking.utils.ts +0 -1
@@ -1,11 +1,11 @@
1
- import { AnimationClip, Object3D } from "three";
2
1
  import type { Light, Material, PerspectiveCamera } from "three";
2
+ import { AnimationClip, Object3D } from "three";
3
3
 
4
- import { AnimatorConditionMode, AnimatorControllerParameterType } from "../engine/extensions/NEEDLE_animator_controller_model.js";
5
- import type { AnimatorControllerModel, Condition, Parameter, State, Transition } from "../engine/extensions/NEEDLE_animator_controller_model.js";
6
4
  import { InstantiateIdProvider } from "../engine/engine_networking_instantiate.js";
5
+ import type { AnimatorControllerModel, Condition, Parameter, State, Transition } from "../engine/extensions/NEEDLE_animator_controller_model.js";
6
+ import { AnimatorConditionMode, AnimatorControllerParameterType } from "../engine/extensions/NEEDLE_animator_controller_model.js";
7
+ import { type AnimationKeyframe, type ColorValue,type EulerValue, type QuatValue, resolveClipSource, track as trackFn, type TrackDescriptor, type TrackOptions, type Tween, type Vec3Value } from "./AnimationBuilder.js";
7
8
  import { AnimatorController } from "./AnimatorController.js";
8
- import { resolveClipSource, track as trackFn, type TrackDescriptor, type TrackOptions, type AnimationKeyframe, type Tween, type Vec3Value, type QuatValue, type EulerValue, type ColorValue } from "./AnimationBuilder.js";
9
9
 
10
10
  /** Keyframe array or tween shorthand */
11
11
  type KF<V> = AnimationKeyframe<V>[] | Tween<V>;
@@ -4,6 +4,7 @@ import { isDevEnvironment } from "../engine/debug/index.js";
4
4
  import { type AssetReference } from "../engine/engine_addressables.js";
5
5
  import { addComponent, destroyComponentInstance, findObjectOfType, findObjectsOfType, getComponent, getComponentInChildren, getComponentInParent, getComponents, getComponentsInChildren, getComponentsInParent, getOrAddComponent, removeComponent } from "../engine/engine_components.js";
6
6
  import { activeInHierarchyFieldName } from "../engine/engine_constants.js";
7
+ import { DisposableStore, type DisposeFn,type IDisposable } from "../engine/engine_disposable.js";
7
8
  import { destroy, findByGuid, foreachComponent, type IInstantiateOptions, instantiate, isActiveInHierarchy, isActiveSelf, isDestroyed, isUsingInstancing, markAsInstancedRendered, setActive } from "../engine/engine_gameobject.js";
8
9
  import { isHotReloadEnabled, registerHotReloadType, unregisterHotReloadType } from "../engine/engine_hot_reload.js";
9
10
  import * as main from "../engine/engine_mainloop_utils.js";
@@ -13,7 +14,6 @@ import * as threeutils from "../engine/engine_three_utils.js";
13
14
  import { $componentName, type Collision, type ComponentInit, type Constructor, type ConstructorConcrete, type ICollider, type IComponent, type IGameObject, type SourceIdentifier } from "../engine/engine_types.js";
14
15
  import { TypeStore } from "../engine/engine_typestore.js";
15
16
  import type { INeedleXRSessionEventReceiver, NeedleXRControllerEventArgs, NeedleXREventArgs } from "../engine/engine_xr.js";
16
- import { DisposableStore, type IDisposable, type DisposeFn } from "../engine/engine_disposable.js";
17
17
  import { type IPointerEventHandler, PointerEventData } from "./ui/PointerEvents.js";
18
18
 
19
19
 
@@ -1,9 +1,7 @@
1
1
  import { AxesHelper, Box3, Euler, Matrix4, Object3D, Plane, Quaternion, Ray, Vector3 } from "three";
2
2
 
3
3
  export type { IDragConstraint, IDragConstraintContext } from "./DragControlsConstraints.js";
4
- export { AxisRotationConstraint, GridSnapConstraint, GrabPointPlaneConstraint, KeepRotationConstraint, KeepScaleConstraint, ScaleLimitConstraint, RotationAxis, FixedRotationAxesConstraint, PlaneHeightLockConstraint, SnapToSurfaceConstraint, applyFollowObjectConstraints } from "./DragControlsConstraints.js";
5
- import { IDragConstraint, IDragConstraintContext, AxisRotationConstraint, GridSnapConstraint, GrabPointPlaneConstraint, KeepRotationConstraint, ScaleLimitConstraint, FixedRotationAxesConstraint, PlaneHeightLockConstraint, SnapToSurfaceConstraint, applyFollowObjectConstraints } from "./DragControlsConstraints.js";
6
-
4
+ export { applyFollowObjectConstraints,AxisRotationConstraint, FixedRotationAxesConstraint, GrabPointPlaneConstraint, GridSnapConstraint, KeepRotationConstraint, KeepScaleConstraint, PlaneHeightLockConstraint, RotationAxis, ScaleLimitConstraint, SnapToSurfaceConstraint } from "./DragControlsConstraints.js";
7
5
  import { Gizmos } from "../engine/engine_gizmos.js";
8
6
  import { InstancingUtil } from "../engine/engine_instancing.js";
9
7
  import { Mathf } from "../engine/engine_math.js";
@@ -14,6 +12,7 @@ import { type IGameObject } from "../engine/engine_types.js";
14
12
  import { getParam } from "../engine/engine_utils.js";
15
13
  import { NeedleXRSession } from "../engine/engine_xr.js";
16
14
  import { Behaviour, GameObject } from "./Component.js";
15
+ import { applyFollowObjectConstraints,AxisRotationConstraint, FixedRotationAxesConstraint, GrabPointPlaneConstraint, GridSnapConstraint, IDragConstraint, IDragConstraintContext, KeepRotationConstraint, PlaneHeightLockConstraint, ScaleLimitConstraint, SnapToSurfaceConstraint } from "./DragControlsConstraints.js";
17
16
  import { EventList } from "./EventList.js";
18
17
  import { UsageMarker } from "./Interactable.js";
19
18
  import { Rigidbody } from "./RigidBody.js";
@@ -1,9 +1,8 @@
1
1
  import { Box3, Euler, Object3D, Plane, Quaternion, Ray, Vector3 } from "three";
2
2
 
3
3
  import type { Context } from "../engine/engine_setup.js";
4
-
5
- import { GameObject } from "./Component.js";
6
4
  import type { IGameObject } from "../engine/engine_types.js";
5
+ import { GameObject } from "./Component.js";
7
6
 
8
7
  // #region Interfaces
9
8
  /**
@@ -1,12 +1,12 @@
1
1
  import { CameraHelper, Color, DirectionalLight, DirectionalLightHelper, Light as ThreeLight, OrthographicCamera, PointLight, SpotLight, Vector3 } from "three";
2
2
 
3
+ import { isDevEnvironment } from "../engine/debug/index.js";
3
4
  import { serializable } from "../engine/engine_serialization_decorator.js";
4
5
  import { setWorldPositionXYZ } from "../engine/engine_three_utils.js";
5
6
  import type { ILight } from "../engine/engine_types.js";
6
7
  import { getParam } from "../engine/engine_utils.js";
7
8
  import type { NeedleXREventArgs } from "../engine/xr/api.js";
8
9
  import { Behaviour, GameObject } from "./Component.js";
9
- import { isDevEnvironment } from "../engine/debug/index.js";
10
10
 
11
11
  // https://threejs.org/examples/webgl_shadowmap_csm.html
12
12
 
@@ -34,7 +34,7 @@
34
34
  * @module Built-in Components
35
35
  */
36
36
 
37
- export { AnimationBuilder, type AnimationKeyframe, type Tween, type AnimationInterpolation } from "./AnimationBuilder.js";
37
+ export { AnimationBuilder, type AnimationInterpolation,type AnimationKeyframe, type Tween } from "./AnimationBuilder.js";
38
38
  export { AnimatorControllerBuilder, type ConditionMode, type StateOptions, type TransitionOptions } from "./AnimatorController.builder.js";
39
39
  export * from "./codegen/components.js";
40
40
  export { Collider } from "./Collider.js"; // export abstract type
@@ -44,11 +44,11 @@ export { Behaviour, Component, GameObject } from "./Component.js";
44
44
  export { AudioRolloffMode } from "./AudioSource.js";
45
45
  export { ClearFlags } from "./Camera.js"
46
46
  export { DragMode } from "./DragControls.js";
47
- export { ShadowCastingMode, ReflectionProbeUsage } from "./Renderer.js";
48
47
  export type { DropListenerNetworkEventArguments, DropListenerOnDropArguments } from "./DropListener.js";
49
48
  export * from "./export/index.js"
50
49
  export * from "./particlesystem/api.js"
51
50
  export * from "./postprocessing/index.js"
51
+ export { ReflectionProbeUsage,ShadowCastingMode } from "./Renderer.js";
52
52
  export { type ISceneEventListener } from "./SceneSwitcher.js";
53
53
  export * from "./splines/index.js";
54
54
  export * from "./timeline/index.js"
@@ -3,7 +3,7 @@ import { Euler, Material, Matrix4, Mesh, Object3D, Quaternion, Vector3 } from "t
3
3
 
4
4
  import { isDevEnvironment, showBalloonMessage, showBalloonWarning } from "../../../engine/debug/index.js";
5
5
  import { findObjectOfType } from "../../../engine/engine_components.js";
6
- import { __csRKN } from "../../../engine/engine_license.js";
6
+ import { _$xBhfh } from "../../../engine/engine_license.js";
7
7
  import { serializable } from "../../../engine/engine_serialization.js";
8
8
  import { getFormattedDate, Progress } from "../../../engine/engine_time_utils.js";
9
9
  import { DeviceUtilities, getParam } from "../../../engine/engine_utils.js";
@@ -277,7 +277,7 @@ export class USDZExporter extends Behaviour {
277
277
  let name = this.exportFileName ?? this.objectToExport?.name ?? this.name;
278
278
  name += "-" + getFormattedDate(); // seems iOS caches the file in some cases, this ensures we always have a fresh file
279
279
 
280
- if (!__csRKN()) {
280
+ if (!_$xBhfh()) {
281
281
  if (name !== "") name += "-";
282
282
  name += "MadeWithNeedle";
283
283
  }
@@ -682,7 +682,7 @@ export class USDZExporter extends Behaviour {
682
682
  if (debug)
683
683
  showBalloonMessage("Quicklook url: " + callToActionURL);
684
684
  if (callToActionURL) {
685
- if (!__csRKN()) {
685
+ if (!_$xBhfh()) {
686
686
  console.warn("Quicklook closed: custom redirects require a Needle Engine Pro license: https://needle.tools/pricing", callToActionURL)
687
687
  }
688
688
  else {
@@ -697,7 +697,7 @@ export class USDZExporter extends Behaviour {
697
697
  private buildQuicklookOverlay(): CustomBranding {
698
698
  const obj: CustomBranding = {};
699
699
  if (this.customBranding) Object.assign(obj, this.customBranding);
700
- if (!__csRKN()) {
700
+ if (!_$xBhfh()) {
701
701
  console.log("Custom Quicklook banner text requires pro license: https://needle.tools/pricing");
702
702
  obj.callToAction = "Close";
703
703
  obj.checkoutTitle = "🌵 Made with Needle";
@@ -3,6 +3,7 @@ import { AnimationClip, Material, Matrix4, Mesh, Object3D, Quaternion, Vector3 }
3
3
  import { isDevEnvironment, showBalloonWarning } from "../../../../../engine/debug/index.js";
4
4
  import { serializable } from "../../../../../engine/engine_serialization_decorator.js";
5
5
  import { getWorldPosition, getWorldQuaternion, getWorldScale, setWorldPosition, setWorldQuaternion, setWorldScale } from "../../../../../engine/engine_three_utils.js";
6
+ import type { ComponentInit } from "../../../../../engine/engine_types.js";
6
7
  import { getParam } from "../../../../../engine/engine_utils.js";
7
8
  import { compareAssociation } from "../../../../../engine/extensions/extension_utils.js";
8
9
  import type { State } from "../../../../../engine/extensions/NEEDLE_animator_controller_model.js";
@@ -11,7 +12,6 @@ import { Animation } from "../../../../Animation.js";
11
12
  import { Animator } from "../../../../Animator.js";
12
13
  import { AudioSource } from "../../../../AudioSource.js";
13
14
  import { Behaviour, GameObject } from "../../../../Component.js";
14
- import type { ComponentInit } from "../../../../../engine/engine_types.js";
15
15
  import { Rigidbody } from "../../../../RigidBody.js";
16
16
  import type { IPointerClickHandler, PointerEventData } from "../../../../ui/PointerEvents.js";
17
17
  import { makeNameSafeForUSD, USDDocument, USDObject, USDZExporterContext } from "../../ThreeUSDZExporter.js";
@@ -4,8 +4,8 @@ export { PostProcessingEffectOrder } from "./utils.js";
4
4
  /* Effect option enums. The effect components themselves are exported from
5
5
  codegen/components.ts, but these were unreachable: `DepthOfField.mode`
6
6
  could not be set to a named value from outside the package. */
7
- export { DepthOfFieldMode } from "./Effects/DepthOfField.js";
8
7
  export { QualityLevel } from "./Effects/Antialiasing.js";
8
+ export { DepthOfFieldMode } from "./Effects/DepthOfField.js";
9
9
  export { ScreenSpaceAmbientOcclusionN8QualityMode } from "./Effects/ScreenspaceAmbientOcclusionN8.js";
10
10
  export { NEToneMappingMode } from "./Effects/Tonemapping.utils.js";
11
11
  export { PostProcessingManager } from "./Volume.js"
@@ -1,19 +1,19 @@
1
- import { AnimationClip, Object3D } from "three";
2
1
  import type { Light, Material, PerspectiveCamera } from "three";
2
+ import { AnimationClip, Object3D } from "three";
3
3
 
4
+ import { InstantiateIdProvider } from "../../engine/engine_networking_instantiate.js";
5
+ import { type AnimationKeyframe, type ColorValue,type EulerValue, isTrackDescriptor, type QuatValue, resolveToClip, track as trackFn, type TrackDescriptor, type TrackOptions, type Tween, type Vec3Value } from "../AnimationBuilder.js";
4
6
  import type { Animator } from "../Animator.js";
5
7
  import type { AudioSource } from "../AudioSource.js";
6
8
  import { GameObject } from "../Component.js";
7
- import { InstantiateIdProvider } from "../../engine/engine_networking_instantiate.js";
8
9
  import { EventList } from "../EventList.js";
9
- import { isTrackDescriptor, resolveToClip, track as trackFn, type TrackDescriptor, type TrackOptions, type AnimationKeyframe, type Tween, type Vec3Value, type QuatValue, type EulerValue, type ColorValue } from "../AnimationBuilder.js";
10
10
 
11
11
  /** Keyframe array or tween shorthand */
12
12
  type KF<V> = AnimationKeyframe<V>[] | Tween<V>;
13
- import { SignalAsset, SignalReceiver, SignalReceiverEvent } from "./SignalAsset.js";
14
13
  import type { PlayableDirector } from "./PlayableDirector.js";
14
+ import { SignalAsset, SignalReceiver, SignalReceiverEvent } from "./SignalAsset.js";
15
+ import type { AnimationClipModel, AudioClipModel, ClipModel, ControlClipModel, MarkerModel, SignalMarkerModel, TimelineAssetModel, TrackModel, TrackOffset } from "./TimelineModels.js";
15
16
  import { ClipExtrapolation, TrackType } from "./TimelineModels.js";
16
- import type { TimelineAssetModel, TrackModel, ClipModel, AnimationClipModel, AudioClipModel, ControlClipModel, MarkerModel, SignalMarkerModel, TrackOffset } from "./TimelineModels.js";
17
17
  import { MarkerType } from "./TimelineModels.js";
18
18
 
19
19
  /**
@@ -1,6 +1,7 @@
1
1
  import { AnimationAction, AnimationClip, AnimationMixer, Audio, AudioListener, AudioLoader, Euler, Object3D, Quaternion, QuaternionKeyframeTrack, Vector3, VectorKeyframeTrack } from "three";
2
2
 
3
3
  import { isDevEnvironment } from "../../engine/debug/index.js";
4
+ import { AnimationUtils } from "../../engine/engine_animation.js";
4
5
  import { Context } from "../../engine/engine_setup.js";
5
6
  import type { Constructor } from "../../engine/engine_types.js";
6
7
  import { getParam, resolveUrl } from "../../engine/engine_utils.js";
@@ -9,9 +10,8 @@ import { AudioSource } from "../AudioSource.js";
9
10
  import { GameObject } from "../Component.js";
10
11
  import type { PlayableDirector } from "./PlayableDirector.js";
11
12
  import { SignalReceiver } from "./SignalAsset.js";
12
- import * as Models from "./TimelineModels.js";
13
13
  import type { TimelineBuilder } from "./TimelineBuilder.js";
14
- import { AnimationUtils } from "../../engine/engine_animation.js";
14
+ import * as Models from "./TimelineModels.js";
15
15
 
16
16
  const debug = getParam("debugtimeline");
17
17
 
@@ -722,6 +722,20 @@ export class TimelineAudioTrack extends TimelineTrackHandler {
722
722
  audio.playbackRate = this.director.context.time.timeScale * this.director.speed;
723
723
  audio.loop = asset.loop;
724
724
  if (time >= model.start && time <= model.end && time < this.director.duration) {
725
+ let vol = asset.volume as number;
726
+ if (this.track.volume !== undefined)
727
+ vol *= this.track.volume;
728
+ if (isMuted) vol = 0;
729
+ if (model.easeInDuration > 0) {
730
+ const easeIn = Math.min((time - model.start) / model.easeInDuration, 1);
731
+ vol *= easeIn;
732
+ }
733
+ if (model.easeOutDuration > 0) {
734
+ const easeOut = Math.min((model.end - time) / model.easeOutDuration, 1);
735
+ vol *= easeOut;
736
+ }
737
+ vol *= this.director.weight;
738
+
725
739
  if (!audio.isPlaying || !this.director.isPlaying) {
726
740
  // if the timeline is paused we trigger the audio clip once when the model is entered
727
741
  // we dont playback the audio clip if we scroll back in time
@@ -733,6 +747,11 @@ export class TimelineAudioTrack extends TimelineTrackHandler {
733
747
  audio.offset = model.clipIn + (time - model.start) * model.timeScale;
734
748
  else audio.offset = 0;
735
749
  if (debug) console.log("Timeline Audio (" + this.track.name + ") play with offset " + audio.offset + " - " + model.asset.clip);
750
+ // Audio.setVolume() fades over 10 ms. Set the initial gain immediately
751
+ // before starting the source so short muted clips cannot be heard.
752
+ const gain = audio.gain.gain;
753
+ gain.cancelScheduledValues(audio.context.currentTime);
754
+ gain.setValueAtTime(vol, audio.context.currentTime);
736
755
  audio.play(playTimeOffset);
737
756
  model._didTriggerPlay = true;
738
757
  }
@@ -750,24 +769,13 @@ export class TimelineAudioTrack extends TimelineTrackHandler {
750
769
  if (diff > 0.3) {
751
770
  audio.offset = targetOffset;
752
771
  audio.stop();
772
+ const gain = audio.gain.gain;
773
+ gain.cancelScheduledValues(audio.context.currentTime);
774
+ gain.setValueAtTime(vol, audio.context.currentTime);
753
775
  audio.play(playTimeOffset);
754
776
  }
755
777
  }
756
- let vol = asset.volume as number;
757
-
758
- if (this.track.volume !== undefined)
759
- vol *= this.track.volume;
760
-
761
- if (isMuted) vol = 0;
762
- if (model.easeInDuration > 0) {
763
- const easeIn = Math.min((time - model.start) / model.easeInDuration, 1);
764
- vol *= easeIn;
765
- }
766
- if (model.easeOutDuration > 0) {
767
- const easeOut = Math.min((model.end - time) / model.easeOutDuration, 1);
768
- vol *= easeOut;
769
- }
770
- audio.setVolume(vol * this.director.weight);
778
+ audio.setVolume(vol);
771
779
  }
772
780
  else {
773
781
  model._didTriggerPlay = false;
@@ -1,6 +1,5 @@
1
1
  import { isDevEnvironment } from "../../engine/debug/index.js";
2
2
  import { getParam } from "../../engine/engine_utils.js";
3
-
4
3
  import type { WebXRImageTrackingModel } from "./WebXRImageTracking.js";
5
4
 
6
5
  // Kept in a dedicated module (with only lightweight imports) so the marker-loading logic can be unit