@needle-tools/engine 4.11.2 → 4.11.3-next.2d2dff8
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/CHANGELOG.md +3 -0
- package/dist/{needle-engine.bundle-DxIfYnRl.js → needle-engine.bundle-Buwrv7Cc.js} +7 -7
- package/dist/{needle-engine.bundle-BaUshOzH.min.js → needle-engine.bundle-CMdUN8y6.min.js} +2 -2
- package/dist/{needle-engine.bundle-Ci2JE5sk.umd.cjs → needle-engine.bundle-GysGCdkn.umd.cjs} +3 -3
- package/dist/needle-engine.js +2 -2
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine-components/Animation.d.ts +1 -1
- package/lib/engine-components/Animation.js +1 -1
- package/lib/engine-components/AnimationCurve.d.ts +3 -0
- package/lib/engine-components/AnimationCurve.js +3 -0
- package/lib/engine-components/AnimationCurve.js.map +1 -1
- package/lib/engine-components/Animator.d.ts +2 -1
- package/lib/engine-components/Animator.js +2 -1
- package/lib/engine-components/Animator.js.map +1 -1
- package/lib/engine-components/AnimatorController.d.ts +3 -0
- package/lib/engine-components/AnimatorController.js +3 -0
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/lib/engine-components/LookAtConstraint.d.ts +4 -0
- package/lib/engine-components/LookAtConstraint.js +4 -0
- package/lib/engine-components/LookAtConstraint.js.map +1 -1
- package/lib/engine-components/NeedleMenu.d.ts +1 -0
- package/lib/engine-components/NeedleMenu.js +1 -0
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/NestedGltf.d.ts +3 -0
- package/lib/engine-components/NestedGltf.js +3 -0
- package/lib/engine-components/NestedGltf.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +4 -0
- package/lib/engine-components/ReflectionProbe.js +4 -0
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/RendererLightmap.d.ts +6 -0
- package/lib/engine-components/RendererLightmap.js +6 -3
- package/lib/engine-components/RendererLightmap.js.map +1 -1
- package/lib/engine-components/SeeThrough.d.ts +3 -0
- package/lib/engine-components/SeeThrough.js +8 -1
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/Skybox.d.ts +3 -0
- package/lib/engine-components/Skybox.js +3 -0
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/SpriteRenderer.d.ts +14 -1
- package/lib/engine-components/SpriteRenderer.js +17 -1
- package/lib/engine-components/SpriteRenderer.js.map +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -1
- package/lib/engine-components/splines/Spline.d.ts +3 -0
- package/lib/engine-components/splines/Spline.js +3 -0
- package/lib/engine-components/splines/Spline.js.map +1 -1
- package/lib/engine-components/splines/SplineUtils.d.ts +3 -0
- package/lib/engine-components/splines/SplineUtils.js +3 -0
- package/lib/engine-components/splines/SplineUtils.js.map +1 -1
- package/lib/engine-components/splines/SplineWalker.d.ts +3 -0
- package/lib/engine-components/splines/SplineWalker.js +3 -0
- package/lib/engine-components/splines/SplineWalker.js.map +1 -1
- package/lib/engine-components/timeline/SignalAsset.d.ts +11 -1
- package/lib/engine-components/timeline/SignalAsset.js +11 -1
- package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
- package/lib/engine-components/ui/Raycaster.d.ts +18 -0
- package/lib/engine-components/ui/Raycaster.js +18 -0
- package/lib/engine-components/ui/Raycaster.js.map +1 -1
- package/package.json +2 -2
- package/src/engine-components/Animation.ts +1 -1
- package/src/engine-components/AnimationCurve.ts +4 -1
- package/src/engine-components/Animator.ts +3 -2
- package/src/engine-components/AnimatorController.ts +3 -0
- package/src/engine-components/LookAtConstraint.ts +6 -1
- package/src/engine-components/NeedleMenu.ts +1 -0
- package/src/engine-components/NestedGltf.ts +3 -0
- package/src/engine-components/ReflectionProbe.ts +4 -0
- package/src/engine-components/RendererLightmap.ts +7 -3
- package/src/engine-components/SeeThrough.ts +8 -1
- package/src/engine-components/Skybox.ts +3 -0
- package/src/engine-components/SpriteRenderer.ts +18 -2
- package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +1 -1
- package/src/engine-components/splines/Spline.ts +3 -0
- package/src/engine-components/splines/SplineUtils.ts +3 -1
- package/src/engine-components/splines/SplineWalker.ts +3 -0
- package/src/engine-components/timeline/SignalAsset.ts +13 -2
- 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.
|
|
3
|
+
"version": "4.11.3-next.2d2dff8",
|
|
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
|
+
}
|
|
@@ -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
|
|
|
@@ -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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
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
|
|
|
@@ -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
|
|
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
|
/**
|