@needle-tools/engine 4.11.2 → 4.11.3-next.35d1b4d

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 (85) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/{needle-engine.bundle-Ci2JE5sk.umd.cjs → needle-engine.bundle-BTf7HHet.umd.cjs} +121 -121
  3. package/dist/{needle-engine.bundle-DxIfYnRl.js → needle-engine.bundle-COMN0eJQ.js} +4112 -4088
  4. package/dist/{needle-engine.bundle-BaUshOzH.min.js → needle-engine.bundle-_QBUSIl2.min.js} +134 -134
  5. package/dist/needle-engine.js +2 -2
  6. package/dist/needle-engine.min.js +1 -1
  7. package/dist/needle-engine.umd.cjs +1 -1
  8. package/lib/engine/engine_utils.d.ts +1 -1
  9. package/lib/engine/engine_utils.js +36 -11
  10. package/lib/engine/engine_utils.js.map +1 -1
  11. package/lib/engine/engine_utils_attributes.d.ts +48 -0
  12. package/lib/engine/engine_utils_attributes.js +70 -0
  13. package/lib/engine/engine_utils_attributes.js.map +1 -0
  14. package/lib/engine-components/Animation.d.ts +1 -1
  15. package/lib/engine-components/Animation.js +1 -1
  16. package/lib/engine-components/AnimationCurve.d.ts +3 -0
  17. package/lib/engine-components/AnimationCurve.js +3 -0
  18. package/lib/engine-components/AnimationCurve.js.map +1 -1
  19. package/lib/engine-components/Animator.d.ts +2 -1
  20. package/lib/engine-components/Animator.js +2 -1
  21. package/lib/engine-components/Animator.js.map +1 -1
  22. package/lib/engine-components/AnimatorController.d.ts +3 -0
  23. package/lib/engine-components/AnimatorController.js +3 -0
  24. package/lib/engine-components/AnimatorController.js.map +1 -1
  25. package/lib/engine-components/LookAtConstraint.d.ts +4 -0
  26. package/lib/engine-components/LookAtConstraint.js +4 -0
  27. package/lib/engine-components/LookAtConstraint.js.map +1 -1
  28. package/lib/engine-components/NeedleMenu.d.ts +1 -0
  29. package/lib/engine-components/NeedleMenu.js +1 -0
  30. package/lib/engine-components/NeedleMenu.js.map +1 -1
  31. package/lib/engine-components/NestedGltf.d.ts +3 -0
  32. package/lib/engine-components/NestedGltf.js +3 -0
  33. package/lib/engine-components/NestedGltf.js.map +1 -1
  34. package/lib/engine-components/ReflectionProbe.d.ts +4 -0
  35. package/lib/engine-components/ReflectionProbe.js +4 -0
  36. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  37. package/lib/engine-components/RendererLightmap.d.ts +6 -0
  38. package/lib/engine-components/RendererLightmap.js +6 -3
  39. package/lib/engine-components/RendererLightmap.js.map +1 -1
  40. package/lib/engine-components/SeeThrough.d.ts +3 -0
  41. package/lib/engine-components/SeeThrough.js +8 -1
  42. package/lib/engine-components/SeeThrough.js.map +1 -1
  43. package/lib/engine-components/Skybox.d.ts +3 -0
  44. package/lib/engine-components/Skybox.js +3 -0
  45. package/lib/engine-components/Skybox.js.map +1 -1
  46. package/lib/engine-components/SpriteRenderer.d.ts +14 -1
  47. package/lib/engine-components/SpriteRenderer.js +17 -1
  48. package/lib/engine-components/SpriteRenderer.js.map +1 -1
  49. package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -1
  50. package/lib/engine-components/splines/Spline.d.ts +3 -0
  51. package/lib/engine-components/splines/Spline.js +3 -0
  52. package/lib/engine-components/splines/Spline.js.map +1 -1
  53. package/lib/engine-components/splines/SplineUtils.d.ts +3 -0
  54. package/lib/engine-components/splines/SplineUtils.js +3 -0
  55. package/lib/engine-components/splines/SplineUtils.js.map +1 -1
  56. package/lib/engine-components/splines/SplineWalker.d.ts +3 -0
  57. package/lib/engine-components/splines/SplineWalker.js +3 -0
  58. package/lib/engine-components/splines/SplineWalker.js.map +1 -1
  59. package/lib/engine-components/timeline/SignalAsset.d.ts +11 -1
  60. package/lib/engine-components/timeline/SignalAsset.js +11 -1
  61. package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
  62. package/lib/engine-components/ui/Raycaster.d.ts +18 -0
  63. package/lib/engine-components/ui/Raycaster.js +18 -0
  64. package/lib/engine-components/ui/Raycaster.js.map +1 -1
  65. package/package.json +2 -2
  66. package/src/engine/engine_utils.ts +38 -14
  67. package/src/engine/engine_utils_attributes.ts +72 -0
  68. package/src/engine-components/Animation.ts +1 -1
  69. package/src/engine-components/AnimationCurve.ts +4 -1
  70. package/src/engine-components/Animator.ts +3 -2
  71. package/src/engine-components/AnimatorController.ts +3 -0
  72. package/src/engine-components/LookAtConstraint.ts +6 -1
  73. package/src/engine-components/NeedleMenu.ts +1 -0
  74. package/src/engine-components/NestedGltf.ts +3 -0
  75. package/src/engine-components/ReflectionProbe.ts +4 -0
  76. package/src/engine-components/RendererLightmap.ts +7 -3
  77. package/src/engine-components/SeeThrough.ts +8 -1
  78. package/src/engine-components/Skybox.ts +3 -0
  79. package/src/engine-components/SpriteRenderer.ts +18 -2
  80. package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +1 -1
  81. package/src/engine-components/splines/Spline.ts +3 -0
  82. package/src/engine-components/splines/SplineUtils.ts +3 -1
  83. package/src/engine-components/splines/SplineWalker.ts +3 -0
  84. package/src/engine-components/timeline/SignalAsset.ts +13 -2
  85. package/src/engine-components/ui/Raycaster.ts +19 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "4.11.2",
3
+ "version": "4.11.3-next.35d1b4d",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.",
5
5
  "main": "dist/needle-engine.min.js",
6
6
  "exports": {
@@ -169,4 +169,4 @@
169
169
  "module": "lib/needle-engine.js",
170
170
  "typings": "lib/needle-engine.d.ts",
171
171
  "types": "lib/needle-engine.d.ts"
172
- }
172
+ }
@@ -4,9 +4,11 @@ import { Quaternion, Vector2, Vector3, Vector4 } from "three";
4
4
  declare type Vector = Vector2 | Vector3 | Vector4 | Quaternion;
5
5
 
6
6
  import { needleLogoOnlySVG } from "./assets/index.js";
7
+ import { isDevEnvironment } from "./debug/debug.js";
7
8
  import type { Context } from "./engine_context.js";
8
9
  import { ContextRegistry } from "./engine_context_registry.js";
9
10
  import { type SourceIdentifier } from "./engine_types.js";
11
+ import { InternalAttributeUtils } from "./engine_utils_attributes.js";
10
12
  import type { NeedleEngineWebComponent } from "./webcomponents/needle-engine.js";
11
13
 
12
14
  // https://schneidenbach.gitbooks.io/typescript-cookbook/content/nameof-operator.html
@@ -908,7 +910,7 @@ export async function PromiseAllWithErrors<T>(promise: Promise<T>[]): Promise<{
908
910
  * @param args.colorDark The color of the dark squares
909
911
  * @param args.colorLight The color of the light squares
910
912
  * @param args.correctLevel The error correction level to use
911
- * @param args.showLogo If true, the same logo as for the Needle loading screen will be drawn in the center of the QR code
913
+ * @param args.showLogo If true, the logo will be shown in the center of the QR code. By default the Needle Logo will be used. You can override which logo is being used by setting the `needle-engine` web component's `qr-logo-src` attribute. The logo can also be disabled by setting that attribute to a falsey value (e.g. "0" or "false")
912
914
  * @param args.showUrl If true, the URL will be shown below the QR code
913
915
  * @param args.domElement The dom element to append the QR code to. If not provided a new div will be created and returned
914
916
  * @returns The dom element containing the QR code
@@ -946,16 +948,16 @@ export async function generateQRCode(args: { domElement?: HTMLElement, text: str
946
948
  // Number of rows/columns of the generated QR code
947
949
  const moduleCount = qrCode?._oQRCode.moduleCount || 0;
948
950
  const canvas = qrCode?._oDrawing?._elCanvas as HTMLCanvasElement;
949
-
951
+
950
952
  let sizePercentage = 0.25;
951
953
  if (moduleCount < 40)
952
954
  sizePercentage = Math.floor(moduleCount / 4) / moduleCount;
953
955
  else
954
956
  sizePercentage = Math.floor(moduleCount / 6) / moduleCount;
955
-
957
+
956
958
  const paddingPercentage = Math.floor(moduleCount / 20) / moduleCount;
957
959
  try {
958
- const img = await addOverlays(canvas, { showLogo: args.showLogo, logoSize: sizePercentage, logoPadding: paddingPercentage }).catch(_e => { /** ignore */ });
960
+ const img = await internalRenderQRCodeOverlays(canvas, { showLogo: args.showLogo, logoSize: sizePercentage, logoPadding: paddingPercentage }).catch(_e => { /** ignore */ });
959
961
  if (img) {
960
962
  target.innerHTML = "";
961
963
  target.append(img);
@@ -1002,7 +1004,8 @@ export async function generateQRCode(args: { domElement?: HTMLElement, text: str
1002
1004
  return target;
1003
1005
  }
1004
1006
 
1005
- async function addOverlays(canvas: HTMLCanvasElement, args: { showLogo?: boolean, logoSize?: number, logoPadding?: number }): Promise<HTMLImageElement | void> {
1007
+
1008
+ async function internalRenderQRCodeOverlays(canvas: HTMLCanvasElement, args: { showLogo?: boolean, logoSize?: number, logoPadding?: number }): Promise<HTMLImageElement | void> {
1006
1009
  if (!canvas) return;
1007
1010
 
1008
1011
  // Internal settings
@@ -1019,18 +1022,38 @@ async function addOverlays(canvas: HTMLCanvasElement, args: { showLogo?: boolean
1019
1022
  const rectangleRadius = 0;
1020
1023
 
1021
1024
  // Draw the website's icon in the center of the QR code
1022
- const faviconImage = new Image();
1025
+ const image = new Image();
1023
1026
  const element = document.querySelector("needle-engine") as NeedleEngineWebComponent;
1024
- const logoSrc = element?.getAttribute("loading-logo-src") || needleLogoOnlySVG;
1027
+ if (!element) {
1028
+ console.debug("[QR Code] No web component found")
1029
+ }
1030
+
1031
+ // Query logo src from needle-engine attribute.
1032
+ // For any supported attribute it's possible to use "falsey" values (e.g. "0" or "false" to disable the logo in the QR code)
1033
+ let logoSrc: false | string | null = null;
1034
+ logoSrc = InternalAttributeUtils.getAttributeAndCheckFalsey(element, "qrcode-logo-src");
1035
+ if (args.showLogo !== true && logoSrc === false) return; // Explictly disabled
1036
+ logoSrc ||= InternalAttributeUtils.getAttributeAndCheckFalsey(element, "logo-src");
1037
+ if (args.showLogo !== true && logoSrc === false) return; // Explicitly disabled
1038
+ logoSrc ||= InternalAttributeUtils.getAttributeAndCheckFalsey(element, "loading-logo-src", {
1039
+ onAttribute: () => {
1040
+ if (isDevEnvironment()) console.warn("[QR Code] 'loading-logo-src' is deprecated, please use 'logo-src' or 'qrcode-logo-src' instead.");
1041
+ else console.debug("[QR Code] 'loading-logo-src' is deprecated.");
1042
+ }
1043
+ });
1044
+ if (args.showLogo !== true && logoSrc === false) return; // Explicitly disabled
1045
+
1046
+ logoSrc ||= needleLogoOnlySVG;
1025
1047
  if (!logoSrc) return;
1026
1048
 
1027
1049
  let haveLogo = false;
1028
1050
  if (args.showLogo !== false) {
1029
- faviconImage.src = logoSrc;
1051
+ image.src = logoSrc;
1030
1052
  haveLogo = await new Promise((resolve, _reject) => {
1031
- faviconImage.onload = () => resolve(true);
1032
- faviconImage.onerror = (err) => {
1033
- console.error("Error loading favicon image for QR code", err);
1053
+ image.onload = () => resolve(true);
1054
+ image.onerror = (err) => {
1055
+ let errorUrl = logoSrc !== needleLogoOnlySVG ? "'" + logoSrc + "'" : null;
1056
+ console.error("[QR Code] Error loading logo image for QR code", errorUrl, isDevEnvironment() ? err : "");
1034
1057
  resolve(false);
1035
1058
  };
1036
1059
  });
@@ -1073,7 +1096,7 @@ async function addOverlays(canvas: HTMLCanvasElement, args: { showLogo?: boolean
1073
1096
 
1074
1097
  if (haveLogo) {
1075
1098
  // Get aspect of image
1076
- const aspect = faviconImage.width / faviconImage.height;
1099
+ const aspect = image.width / image.height;
1077
1100
  if (aspect > 1) sizeY = sizeX / aspect;
1078
1101
  else sizeX = sizeY * aspect;
1079
1102
 
@@ -1114,7 +1137,7 @@ async function addOverlays(canvas: HTMLCanvasElement, args: { showLogo?: boolean
1114
1137
  paddedContext.shadowColor = "transparent";
1115
1138
  const logoX = (paddedCanvas.width - sizeX) / 2;
1116
1139
  const logoY = (paddedCanvas.height - sizeY) / 2;
1117
- paddedContext.drawImage(faviconImage, logoX, logoY, sizeX, sizeY);
1140
+ paddedContext.drawImage(image, logoX, logoY, sizeX, sizeY);
1118
1141
  }
1119
1142
 
1120
1143
  // Replace the canvas with the padded one
@@ -1125,4 +1148,5 @@ async function addOverlays(canvas: HTMLCanvasElement, args: { showLogo?: boolean
1125
1148
  img.style.height = "auto";
1126
1149
 
1127
1150
  return img;
1128
- }
1151
+ }
1152
+
@@ -0,0 +1,72 @@
1
+
2
+
3
+ /**
4
+ * @internal
5
+ */
6
+ export namespace InternalAttributeUtils {
7
+
8
+ /**
9
+ * Checks if the given value is considered "falsey" in the context of HTML attributes.
10
+ * A value is considered falsey if it is "0" or "false" (case-insensitive).
11
+ *
12
+ * @param value - The attribute value to check.
13
+ * @returns True if the value is falsey, otherwise false.
14
+ */
15
+ export function isFalsey(value: string | null): boolean {
16
+ return value === "0" || value?.toLowerCase() === "false";
17
+ }
18
+
19
+ /**
20
+ * Retrieves the value of the specified attribute from the given element.
21
+ * If the attribute value is considered falsey, it returns null.
22
+ * @returns The attribute value or null if falsey.
23
+ */
24
+ export function getAttributeValueIfNotFalsey(element: Element, attributeName: string, opts?: { onAttribute: (value: string) => void }): string | null {
25
+ const attrValue = element.getAttribute(attributeName);
26
+ if (isFalsey(attrValue)) {
27
+ return null;
28
+ }
29
+ opts?.onAttribute?.call(null, attrValue!);
30
+ return attrValue;
31
+ }
32
+
33
+ /**
34
+ * Retrieves the value of the specified attribute from the given element.
35
+ * If the attribute value is considered falsey, it returns false.
36
+ * If the attribute is not set at all, it returns null.
37
+ * @returns The attribute value, false if falsey, or null if not set.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const result = HTMLAttributeUtils.getAttributeAndCheckFalsey(element, 'data-example', {
42
+ * onAttribute: (value, falsey) => {
43
+ * console.log(`Attribute value: ${value}
44
+ * , Is falsey: ${falsey}`);
45
+ * }
46
+ * });
47
+ *
48
+ * if (result === false) {
49
+ * console.log('The attribute is set to a falsey value.');
50
+ * } else if (result === null) {
51
+ * console.log('The attribute is not set.');
52
+ * } else {
53
+ * console.log(`The attribute value is: ${result}`);
54
+ * }
55
+ * ```
56
+ */
57
+ export function getAttributeAndCheckFalsey(element: Element, attributeName: string, opts?: { onAttribute: (value: string, falsey:boolean) => void }): false | string | null {
58
+ const attrValue = element.getAttribute(attributeName);
59
+ // If the attribute is not set at all we just return
60
+ if(attrValue === null) {
61
+ return null;
62
+ }
63
+ if (isFalsey(attrValue)) {
64
+ opts?.onAttribute?.call(null, attrValue!, true);
65
+ return false;
66
+ }
67
+ opts?.onAttribute?.call(null, attrValue!, false);
68
+ return attrValue;
69
+ }
70
+
71
+ }
72
+
@@ -58,7 +58,7 @@ declare type AnimationIdentifier = AnimationClip | number | string | undefined;
58
58
  class Vec2 { x!: number; y!: number }
59
59
 
60
60
  /**
61
- * Animation component to play animations on a GameObject
61
+ * Animation component to play animations on a GameObject.
62
62
  * @category Animation and Sequencing
63
63
  * @group Components
64
64
  */
@@ -27,7 +27,10 @@ export class Keyframe {
27
27
  }
28
28
 
29
29
  /**
30
- * AnimationCurve is a representation of a curve that can be used to animate values over time.
30
+ * AnimationCurve is a representation of a curve that can be used to animate values over time.
31
+ *
32
+ * @category Animation
33
+ * @group Utilities
31
34
  */
32
35
  export class AnimationCurve {
33
36
 
@@ -39,8 +39,9 @@ export declare class PlayOptions {
39
39
 
40
40
  /**
41
41
  * The Animator component plays and manages animations on a GameObject.
42
- * It works with an AnimatorController to handle state transitions and animation blending.
43
- * A new AnimatorController can be created from code via `AnimatorController.createFromClips`.
42
+ * It works with an {@link AnimatorController} to handle state transitions and animation blending.
43
+ * A new AnimatorController can be created from code via `AnimatorController.createFromClips`.
44
+ *
44
45
  * @category Animation and Sequencing
45
46
  * @group Components
46
47
  */
@@ -51,6 +51,9 @@ declare type CreateAnimatorControllerOptions = {
51
51
  *
52
52
  * Use the static method {@link AnimatorController.createFromClips} to create
53
53
  * an animator controller from a set of animation clips.
54
+ *
55
+ * @category Animation and Sequencing
56
+ * @group Utilities
54
57
  */
55
58
  export class AnimatorController {
56
59
 
@@ -2,9 +2,14 @@ import { Object3D, Vector3 } from "three";
2
2
 
3
3
  import { serializable } from "../engine/engine_serialization_decorator.js";
4
4
  import { Behaviour } from "./Component.js";
5
+ import type { OrbitControls } from "./OrbitControls.js";
5
6
 
6
7
  /**
7
- * A LookAtConstraint is used by OrbitControls to make the camera look at a target.
8
+ * A LookAtConstraint is used by OrbitControls to make the camera look at a target.
9
+ * This component is used by {@link OrbitControls} internally.
10
+ *
11
+ * @category Camera Controls
12
+ * @group Components
8
13
  */
9
14
  export class LookAtConstraint extends Behaviour {
10
15
 
@@ -9,6 +9,7 @@ import { Behaviour } from './Component.js';
9
9
  *
10
10
  * Controls display options, button visibility, and menu positioning.
11
11
  * From code, you can access the menu via {@link Context.menu}.
12
+ *
12
13
  * @category User Interface
13
14
  * @group Components
14
15
  **/
@@ -10,6 +10,9 @@ const debug = getParam("debugnestedgltf");
10
10
 
11
11
  /** The nested gltf is a component that is used to load a gltf file when the component becomes active (start)
12
12
  * It will load the gltf file and instantiate it as a child of the parent of the GameObject that has this component
13
+ *
14
+ * @category Asset Management
15
+ * @group Components
13
16
  */
14
17
  export class NestedGltf extends Behaviour {
15
18
 
@@ -15,6 +15,10 @@ const $reflectionProbeKey = Symbol("reflectionProbeKey");
15
15
  const $originalMaterial = Symbol("original material");
16
16
 
17
17
  /**
18
+ * A ReflectionProbe provides reflection data to materials within its defined area.
19
+ *
20
+ * - Sample: http://samples.needle.tools/reflection-probes
21
+ *
18
22
  * @category Rendering
19
23
  * @group Components
20
24
  */
@@ -9,9 +9,13 @@ const debug = getParam("debuglightmaps");
9
9
 
10
10
  declare type MaterialWithLightmap = Material & { lightMap?: Texture | null };
11
11
 
12
- // this component is automatically added by the Renderer if the object has lightmap uvs AND we have a lightmap
13
- // for multimaterial objects GLTF exports a "Group" with the renderer component
14
- // and every child mesh is a material from unity
12
+
13
+ /**
14
+ * This component is automatically added by the {@link Renderer} component if the object has lightmap uvs AND we have a lightmap.
15
+ *
16
+ * @category Rendering
17
+ * @group Components
18
+ */
15
19
  export class RendererLightmap {
16
20
 
17
21
  get lightmap(): Texture | null {
@@ -39,6 +39,9 @@ let i = 0;
39
39
  * Requires a Renderer component on the same object or a child object.
40
40
  *
41
41
  * - Example https://see-through-walls-z23hmxbz1kjfjn.needle.run/
42
+ *
43
+ * @category Rendering
44
+ * @group Components
42
45
  */
43
46
  export class SeeThrough extends Behaviour {
44
47
 
@@ -241,6 +244,7 @@ export class SeeThrough extends Behaviour {
241
244
 
242
245
  const wasTransparent = mat.transparent;
243
246
  const wasAlphaHash = mat.alphaHash;
247
+ const previousOpacity = mat.opacity;
244
248
 
245
249
  mat.alphaHash = this.useAlphaHash;
246
250
 
@@ -253,7 +257,10 @@ export class SeeThrough extends Behaviour {
253
257
  mat.transparent = mat.opacity >= 1 ? false : !this.useAlphaHash;
254
258
  }
255
259
 
256
- if (wasTransparent != mat.transparent || wasAlphaHash != mat.alphaHash) {
260
+ if (wasTransparent !== mat.transparent
261
+ || wasAlphaHash !== mat.alphaHash
262
+ || mat.opacity !== previousOpacity // MeshPhysicsMaterial needs that and maybe other materials too...
263
+ ) {
257
264
  mat.needsUpdate = true;
258
265
  }
259
266
  }
@@ -120,6 +120,9 @@ ContextRegistry.registerCallback(ContextEvent.ContextCreationStart, () => {
120
120
  * ```ts
121
121
  * skybox.setSkybox("https://example.com/skybox.hdr");
122
122
  * ```
123
+ *
124
+ * @category Rendering
125
+ * @group Components
123
126
  */
124
127
  export class RemoteSkybox extends Behaviour {
125
128
 
@@ -9,6 +9,9 @@ import { Behaviour } from "./Component.js";
9
9
  const debug = getParam("debugspriterenderer");
10
10
  const showWireframe = getParam("wireframe");
11
11
 
12
+ /**
13
+ * @internal
14
+ */
12
15
  class SpriteUtils {
13
16
 
14
17
  static cache: { [key: string]: BufferGeometry } = {};
@@ -82,7 +85,7 @@ function updateTextureIfNecessary(tex: Texture) {
82
85
  }
83
86
 
84
87
  /**
85
- * A sprite is a mesh that represents a 2D image
88
+ * A sprite is a mesh that represents a 2D image. Used by the {@link SpriteRenderer} to render 2D images in the scene.
86
89
  * @category Rendering
87
90
  * @group Components
88
91
  */
@@ -152,6 +155,9 @@ export class Sprite {
152
155
 
153
156
  const $spriteTexOwner = Symbol("spriteOwner");
154
157
 
158
+ /**
159
+ * @category Sprites
160
+ */
155
161
  export class SpriteSheet {
156
162
 
157
163
  @serializable(Sprite)
@@ -162,6 +168,11 @@ export class SpriteSheet {
162
168
  }
163
169
  }
164
170
 
171
+ /**
172
+ * Used by the {@link SpriteRenderer} to hold the sprite sheet and the currently active sprite index.
173
+ *
174
+ * @category Sprites
175
+ */
165
176
  export class SpriteData {
166
177
 
167
178
  static create() {
@@ -246,7 +257,12 @@ export class SpriteData {
246
257
  }
247
258
 
248
259
  /**
249
- * The sprite renderer renders a sprite on a GameObject using an assigned spritesheet ({@link SpriteData}).
260
+ * The sprite renderer renders a sprite on a GameObject using an assigned spritesheet ({@link SpriteData}).
261
+ *
262
+ * - Example: https://engine.needle.tools/samples/spritesheet-animation
263
+ *
264
+ * @category Sprites
265
+ * @group Components
250
266
  */
251
267
  export class SpriteRenderer extends Behaviour {
252
268
 
@@ -42,9 +42,9 @@ import { Progress } from '../../../engine/engine_time_utils.js';
42
42
  // import { BehaviorExtension } from '../../api.js';
43
43
  import type { IUSDExporterExtension } from './Extension.js';
44
44
  import type { AnimationExtension } from './extensions/Animation.js';
45
+ import { BehaviorExtension } from './extensions/behavior/Behaviour.js';
45
46
  import type { PhysicsExtension } from './extensions/behavior/PhysicsExtension.js';
46
47
  import {buildNodeMaterial} from './extensions/NodeMaterialConverter.js';
47
- import { BehaviorExtension } from './extensions/behavior/Behaviour.js';
48
48
 
49
49
  type MeshPhysicalNodeMaterial = import("three/src/materials/nodes/MeshPhysicalNodeMaterial.js").default;
50
50
 
@@ -36,6 +36,9 @@ export class SplineData {
36
36
  * The spline is defined by an array of knots (SplineData) which define position, rotation and tangents.
37
37
  *
38
38
  * You can create a SplineContainer from an array of points using the static method 'createFromPoints'.
39
+ *
40
+ * @category Splines
41
+ * @group Components
39
42
  */
40
43
  export class SplineContainer extends Behaviour {
41
44
 
@@ -3,7 +3,9 @@ import { Vector3 } from "three";
3
3
  import { Mathf } from "../../engine/engine_math.js";
4
4
  import { SplineContainer, SplineData } from "./Spline.js";
5
5
 
6
-
6
+ /**
7
+ * @category Splines
8
+ */
7
9
  export namespace SplineUtils {
8
10
 
9
11
  /**
@@ -11,6 +11,9 @@ import { SplineContainer } from "./Spline.js";
11
11
  * Use this with a SplineContainer component.
12
12
  *
13
13
  * - Example http://samples.needle.tools/splines
14
+ *
15
+ * @category Splines
16
+ * @group Components
14
17
  */
15
18
  export class SplineWalker extends Behaviour {
16
19
 
@@ -2,15 +2,23 @@ import { serializable } from "../../engine/engine_serialization_decorator.js";
2
2
  import { getParam } from "../../engine/engine_utils.js";
3
3
  import { Behaviour } from "../Component.js";
4
4
  import { EventList } from "../EventList.js";
5
+ import type { PlayableDirector } from "./PlayableDirector.js";
5
6
 
6
7
  const debug = getParam("debugsignals")
7
8
 
8
9
 
10
+ /**
11
+ * Used to reference a signal asset in a SignalReceiver. This is internally used by the {@link SignalReceiverEvent}.
12
+ */
9
13
  export class SignalAsset {
10
14
  @serializable()
11
15
  guid!: string;
12
16
  }
13
17
 
18
+ /**
19
+ * An event that links a signal to a reaction.
20
+ * Used internally by {@link SignalReceiver}.
21
+ */
14
22
  export class SignalReceiverEvent {
15
23
  @serializable(SignalAsset)
16
24
  signal!: SignalAsset;
@@ -19,7 +27,10 @@ export class SignalReceiverEvent {
19
27
  }
20
28
 
21
29
  /** SignalReceiver is a component that listens for signals and invokes a reaction when a signal is received.
22
- * Signals can be added to a signal track on a timeline
30
+ * Signals can be added to a signal track on a {@link PlayableDirector}
31
+ *
32
+ * @category Sequencing and Timelines
33
+ * @group Components
23
34
  */
24
35
  export class SignalReceiver extends Behaviour {
25
36
 
@@ -41,7 +52,7 @@ export class SignalReceiver extends Behaviour {
41
52
 
42
53
  /** @internal */
43
54
  awake(): void {
44
- if(debug) console.log("SignalReceiver awake", this);
55
+ if (debug) console.log("SignalReceiver awake", this);
45
56
  }
46
57
 
47
58
  /** @internal */
@@ -28,6 +28,12 @@ export abstract class Raycaster extends Behaviour {
28
28
  }
29
29
 
30
30
 
31
+ /**
32
+ * A Raycaster that performs raycasting against its own GameObject.
33
+ *
34
+ * @category Interaction
35
+ * @group Components
36
+ */
31
37
  export class ObjectRaycaster extends Raycaster {
32
38
  private targets: Object3D[] | null = null;
33
39
  private raycastHits: Intersection[] = [];
@@ -65,6 +71,13 @@ export class ObjectRaycaster extends Raycaster {
65
71
  }
66
72
  }
67
73
 
74
+
75
+ /**
76
+ * A Raycaster that performs raycasting against UI elements (objects with a CanvasRenderer component).
77
+ *
78
+ * @category UI
79
+ * @group Components
80
+ */
68
81
  export class GraphicRaycaster extends ObjectRaycaster {
69
82
  // eventCamera: Camera | null = null;
70
83
  // ignoreReversedGraphics: boolean = false;
@@ -76,6 +89,12 @@ export class GraphicRaycaster extends ObjectRaycaster {
76
89
  }
77
90
  }
78
91
 
92
+ /**
93
+ * A Raycaster that performs sphere overlap raycasting for spatial grab interactions in XR.
94
+ *
95
+ * @category XR
96
+ * @group Components
97
+ */
79
98
  export class SpatialGrabRaycaster extends Raycaster {
80
99
 
81
100
  /**