@needle-tools/engine 2.54.2-pre → 2.55.1-pre

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 (94) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/needle-engine.d.ts +39 -14
  3. package/dist/needle-engine.js +355 -355
  4. package/dist/needle-engine.js.map +4 -4
  5. package/dist/needle-engine.min.js +35 -35
  6. package/dist/needle-engine.min.js.map +4 -4
  7. package/dist/needle-engine.tsbuildinfo +1 -1
  8. package/lib/engine/engine_lightdata.js +1 -1
  9. package/lib/engine/engine_lightdata.js.map +1 -1
  10. package/lib/engine/engine_mainloop_utils.js +8 -0
  11. package/lib/engine/engine_mainloop_utils.js.map +1 -1
  12. package/lib/engine/engine_physics.d.ts +1 -1
  13. package/lib/engine/engine_physics.js +44 -3
  14. package/lib/engine/engine_physics.js.map +1 -1
  15. package/lib/engine/engine_physics.types.d.ts +13 -0
  16. package/lib/engine/engine_physics.types.js +7 -0
  17. package/lib/engine/engine_physics.types.js.map +1 -1
  18. package/lib/engine/engine_serialization_core.js +20 -10
  19. package/lib/engine/engine_serialization_core.js.map +1 -1
  20. package/lib/engine/engine_setup.js +2 -2
  21. package/lib/engine/engine_setup.js.map +1 -1
  22. package/lib/engine/engine_time.d.ts +1 -0
  23. package/lib/engine/engine_time.js +7 -0
  24. package/lib/engine/engine_time.js.map +1 -1
  25. package/lib/engine/engine_types.d.ts +4 -1
  26. package/lib/engine/engine_types.js.map +1 -1
  27. package/lib/engine/engine_utils.d.ts +1 -0
  28. package/lib/engine/engine_utils.js +3 -0
  29. package/lib/engine/engine_utils.js.map +1 -1
  30. package/lib/engine/extensions/NEEDLE_lightmaps.js +3 -1
  31. package/lib/engine/extensions/NEEDLE_lightmaps.js.map +1 -1
  32. package/lib/engine-components/Camera.d.ts +1 -2
  33. package/lib/engine-components/Camera.js +8 -10
  34. package/lib/engine-components/Camera.js.map +1 -1
  35. package/lib/engine-components/Collider.d.ts +2 -0
  36. package/lib/engine-components/Collider.js +4 -0
  37. package/lib/engine-components/Collider.js.map +1 -1
  38. package/lib/engine-components/LODGroup.js +9 -0
  39. package/lib/engine-components/LODGroup.js.map +1 -1
  40. package/lib/engine-components/OrbitControls.d.ts +8 -7
  41. package/lib/engine-components/OrbitControls.js +38 -7
  42. package/lib/engine-components/OrbitControls.js.map +1 -1
  43. package/lib/engine-components/ParticleSystem.d.ts +1 -0
  44. package/lib/engine-components/ParticleSystem.js +17 -6
  45. package/lib/engine-components/ParticleSystem.js.map +1 -1
  46. package/lib/engine-components/ParticleSystemModules.d.ts +2 -2
  47. package/lib/engine-components/ParticleSystemModules.js +27 -21
  48. package/lib/engine-components/ParticleSystemModules.js.map +1 -1
  49. package/lib/engine-components/Renderer.d.ts +1 -0
  50. package/lib/engine-components/Renderer.js +21 -2
  51. package/lib/engine-components/Renderer.js.map +1 -1
  52. package/lib/engine-components/RigidBody.js +1 -19
  53. package/lib/engine-components/RigidBody.js.map +1 -1
  54. package/lib/engine-components/SyncedTransform.js +1 -3
  55. package/lib/engine-components/SyncedTransform.js.map +1 -1
  56. package/lib/engine-components/VideoPlayer.d.ts +2 -1
  57. package/lib/engine-components/VideoPlayer.js +54 -51
  58. package/lib/engine-components/VideoPlayer.js.map +1 -1
  59. package/lib/engine-components/WebARSessionRoot.js +5 -0
  60. package/lib/engine-components/WebARSessionRoot.js.map +1 -1
  61. package/lib/engine-components/WebXR.js +13 -13
  62. package/lib/engine-components/WebXR.js.map +1 -1
  63. package/lib/engine-components/WebXRController.js +1 -2
  64. package/lib/engine-components/WebXRController.js.map +1 -1
  65. package/lib/engine-components/js-extensions/RGBAColor.d.ts +2 -0
  66. package/lib/engine-components/js-extensions/RGBAColor.js +2 -0
  67. package/lib/engine-components/js-extensions/RGBAColor.js.map +1 -1
  68. package/lib/tsconfig.tsbuildinfo +1 -1
  69. package/package.json +1 -1
  70. package/src/engine/codegen/register_types.js +2 -2
  71. package/src/engine/engine_lightdata.ts +1 -1
  72. package/src/engine/engine_mainloop_utils.ts +6 -0
  73. package/src/engine/engine_physics.ts +47 -5
  74. package/src/engine/engine_physics.types.ts +17 -0
  75. package/src/engine/engine_serialization_core.ts +25 -13
  76. package/src/engine/engine_setup.ts +2 -2
  77. package/src/engine/engine_time.ts +7 -1
  78. package/src/engine/engine_types.ts +5 -2
  79. package/src/engine/engine_utils.ts +4 -0
  80. package/src/engine/extensions/NEEDLE_lightmaps.ts +3 -1
  81. package/src/engine-components/Camera.ts +10 -15
  82. package/src/engine-components/Collider.ts +3 -0
  83. package/src/engine-components/LODGroup.ts +9 -0
  84. package/src/engine-components/OrbitControls.ts +58 -19
  85. package/src/engine-components/ParticleSystem.ts +18 -6
  86. package/src/engine-components/ParticleSystemModules.ts +29 -22
  87. package/src/engine-components/Renderer.ts +25 -2
  88. package/src/engine-components/RigidBody.ts +1 -20
  89. package/src/engine-components/SyncedTransform.ts +1 -3
  90. package/src/engine-components/VideoPlayer.ts +55 -51
  91. package/src/engine-components/WebARSessionRoot.ts +5 -0
  92. package/src/engine-components/WebXR.ts +15 -13
  93. package/src/engine-components/WebXRController.ts +1 -2
  94. package/src/engine-components/js-extensions/RGBAColor.ts +3 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.55.1-pre] - 2022-12-30
8
+ - Add: Warning when serialized component field name is starting with uppercase letter
9
+ - Change: bump component compiler dependency
10
+ - Fix: Particle rotation over lifetime
11
+ - Fix: Particles should not emit when emission module is disabled
12
+ - Fix: LODGroup breaking rendering when used with multi-material objects or added on mesh to be culled directly
13
+
14
+ ## [2.55.0-pre] - 2022-12-21
15
+ - Add: PhysicsMaterial support
16
+ - Add: ``Time.timesScale`` factor
17
+ - Change: VideoPlayer exposes underlying HTML video element
18
+ - Change: EffectComposer check if ``setPixelRatio`` method exists before calling
19
+ - Change: WebARSessionRoot and Rig rotation
20
+ - Fix: WebXRController raycast line not being visible in Quest AR
21
+ - Fix: Renderer that is disabled initially now hides object
22
+ - Fix: Some ParticleSystem worldspace settings when calling emit directly
23
+
7
24
  ## [2.54.2-pre] - 2022-12-19
8
25
  - Change: debug parameter can now take ``=0`` for disabling them (e.g. ``freecam=0``)
9
26
  - Fix: InputField opens keyboard on iOS
@@ -21,6 +21,8 @@ declare module "engine-components/js-extensions/RGBAColor" {
21
21
  export class RGBAColor extends Color {
22
22
  alpha: number;
23
23
  get isRGBAColor(): boolean;
24
+ set a(val: number);
25
+ get a(): number;
24
26
  constructor(r: number, g: number, b: number, a: number);
25
27
  clone(): this;
26
28
  copy(col: RGBAColor | Color): this;
@@ -30,6 +32,19 @@ declare module "engine-components/js-extensions/RGBAColor" {
30
32
  }
31
33
  }
32
34
  declare module "engine/engine_physics.types" {
35
+ export enum PhysicsMaterialCombine {
36
+ Average = 0,
37
+ Multiply = 1,
38
+ Minimum = 2,
39
+ Maximum = 3
40
+ }
41
+ export type PhysicsMaterial = {
42
+ bounceCombine: PhysicsMaterialCombine;
43
+ bounciness: number;
44
+ frictionCombine: PhysicsMaterialCombine;
45
+ dynamicFriction: number;
46
+ staticFriction: number;
47
+ };
33
48
  export enum CollisionDetectionMode {
34
49
  Discrete = 0,
35
50
  Continuous = 1
@@ -96,7 +111,7 @@ declare module "engine/engine_three_utils" {
96
111
  declare module "engine/engine_types" {
97
112
  import { Camera, Color, Material, Object3D, Vector3, Quaternion, Ray } from "three";
98
113
  import { RGBAColor } from "engine-components/js-extensions/RGBAColor";
99
- import { CollisionDetectionMode, RigidbodyConstraints } from "engine/engine_physics.types";
114
+ import { CollisionDetectionMode, PhysicsMaterial, RigidbodyConstraints } from "engine/engine_physics.types";
100
115
  /** used to find data registered via gltf files e.g. find lightmaps for a Renderer component that were shipped inside a gltf */
101
116
  export type SourceIdentifier = string;
102
117
  export type Constructor<T> = abstract new (...args: any[]) => T;
@@ -145,6 +160,8 @@ declare module "engine/engine_types" {
145
160
  __internalDisable(): any;
146
161
  __internalDestroy(): any;
147
162
  resolveGuids?(guidsMap: GuidsMap): void;
163
+ /** experimental, called when the script is registered for the first time, this is called even if the component is not enabled. */
164
+ registering?(): any;
148
165
  awake(): any;
149
166
  onEnable(): any;
150
167
  onDisable(): any;
@@ -201,6 +218,7 @@ declare module "engine/engine_types" {
201
218
  get isCollider(): any;
202
219
  attachedRigidbody: IRigidbody | null;
203
220
  isTrigger: boolean;
221
+ sharedMaterial?: PhysicsMaterial;
204
222
  }
205
223
  export interface IRigidbody extends IComponent {
206
224
  constraints: RigidbodyConstraints;
@@ -310,6 +328,7 @@ declare module "engine/engine_utils" {
310
328
  export function isMozillaXR(): boolean;
311
329
  export function isiOS(): boolean;
312
330
  export function isSafari(): boolean;
331
+ export function isQuest(): boolean;
313
332
  }
314
333
  declare module "engine/engine_networking_utils" {
315
334
  export function isLocalNetwork(hostname?: string): boolean;
@@ -903,7 +922,7 @@ declare module "engine/engine_physics" {
903
922
  internal_getRigidbody(rb: IRigidbody): RigidBody | null;
904
923
  private internalUpdateProperties;
905
924
  private lines?;
906
- step(_deltaTime?: number): void;
925
+ step(dt?: number): void;
907
926
  private updateDebugRendering;
908
927
  postStep(): void;
909
928
  /** sync rendered objects with physics world (except for colliders without rigidbody) */
@@ -930,6 +949,7 @@ declare module "engine/engine_time" {
930
949
  export class Time {
931
950
  deltaTime: number;
932
951
  time: number;
952
+ timeScale: number;
933
953
  /** same as frameCount */
934
954
  frame: number;
935
955
  get realtimeSinceStartup(): number;
@@ -2803,10 +2823,9 @@ declare module "engine-components/AudioSource" {
2803
2823
  }
2804
2824
  declare module "engine-components/Camera" {
2805
2825
  import { Behaviour } from "engine-components/Component";
2806
- import * as THREE from "three";
2807
2826
  import { RGBAColor } from "engine-components/js-extensions/RGBAColor";
2808
- import { Ray } from "three";
2809
2827
  import { ICamera } from "engine/engine_types";
2828
+ import { Ray } from "three";
2810
2829
  export enum ClearFlags {
2811
2830
  Skybox = 1,
2812
2831
  SolidColor = 2,
@@ -3729,12 +3748,12 @@ declare module "engine-components/LookAtConstraint" {
3729
3748
  }
3730
3749
  declare module "engine-components/OrbitControls" {
3731
3750
  import { Behaviour } from "engine-components/Component";
3732
- import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls";
3733
3751
  import { LookAtConstraint } from "engine-components/LookAtConstraint";
3734
- import * as THREE from "three";
3752
+ import { Object3D, Vector3 } from "three";
3753
+ import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls";
3735
3754
  export class OrbitControls extends Behaviour {
3736
3755
  get controls(): ThreeOrbitControls | null;
3737
- get controllerObject(): THREE.Object3D | null;
3756
+ get controllerObject(): Object3D | null;
3738
3757
  onStartInteraction(func: Function): void;
3739
3758
  autoRotate: boolean;
3740
3759
  autoRotateSpeed: number;
@@ -3768,12 +3787,13 @@ declare module "engine-components/OrbitControls" {
3768
3787
  start(): void;
3769
3788
  private startRaycastDelayed;
3770
3789
  onBeforeRender(): void;
3771
- setCameraTarget(position?: THREE.Vector3 | null, immediate?: boolean): void;
3790
+ setCameraTarget(position?: Vector3 | null, immediate?: boolean): void;
3772
3791
  setFromTargetPosition(index?: number, t?: number): boolean;
3773
- setTarget(position?: THREE.Vector3 | null, immediate?: boolean): void;
3774
- lerpTarget(position: THREE.Vector3, delta: number): void;
3775
- distanceToTarget(position: THREE.Vector3): number;
3792
+ setTarget(position?: Vector3 | null, immediate?: boolean): void;
3793
+ lerpTarget(position: Vector3, delta: number): void;
3794
+ distanceToTarget(position: Vector3): number;
3776
3795
  private setTargetFromRaycast;
3796
+ fitCameraToObjects(objects: Array<Object3D>, fitOffset?: number): void;
3777
3797
  }
3778
3798
  }
3779
3799
  declare module "engine-components/ui/Raycaster" {
@@ -3990,6 +4010,7 @@ declare module "engine-components/Renderer" {
3990
4010
  set lightmap(tex: Texture | null | undefined);
3991
4011
  get hasLightmap(): boolean;
3992
4012
  allowProgressiveLoading: boolean;
4013
+ registering(): void;
3993
4014
  awake(): void;
3994
4015
  private _isInstancingEnabled;
3995
4016
  private handles;
@@ -4293,10 +4314,12 @@ declare module "engine-components/Collider" {
4293
4314
  import { Rigidbody } from "engine-components/RigidBody";
4294
4315
  import { Mesh, Vector3 } from "three";
4295
4316
  import { ICollider } from "engine/engine_types";
4317
+ import { PhysicsMaterial } from "engine/engine_physics.types";
4296
4318
  export class Collider extends Behaviour implements ICollider {
4297
4319
  get isCollider(): any;
4298
4320
  attachedRigidbody: Rigidbody | null;
4299
4321
  isTrigger: boolean;
4322
+ sharedMaterial?: PhysicsMaterial;
4300
4323
  awake(): void;
4301
4324
  start(): void;
4302
4325
  onEnable(): void;
@@ -4895,7 +4918,7 @@ declare module "engine-components/ParticleSystemModules" {
4895
4918
  get vector(): Vector3;
4896
4919
  getPosition(): void;
4897
4920
  private _dir;
4898
- getDirection(position: any): Vector3;
4921
+ getDirection(pos: Vec3): Vector3;
4899
4922
  private static _randomQuat;
4900
4923
  private static _tempVec;
4901
4924
  private randomizePosition;
@@ -5032,7 +5055,7 @@ declare module "engine-components/ParticleSystemModules" {
5032
5055
  yMultiplier: number;
5033
5056
  z: MinMaxCurve;
5034
5057
  zMultiplier: number;
5035
- evaluate(t01: number): number;
5058
+ evaluate(t01: number, t: number): number;
5036
5059
  }
5037
5060
  export class RotationBySpeedModule {
5038
5061
  enabled: boolean;
@@ -5748,6 +5771,7 @@ declare module "engine-components/ParticleSystem" {
5748
5771
  onEnable(): void;
5749
5772
  onDisable(): void;
5750
5773
  onBeforeRender(): void;
5774
+ private onUpdate;
5751
5775
  private addSubParticleSystems;
5752
5776
  }
5753
5777
  }
@@ -5875,12 +5899,13 @@ declare module "engine-components/VideoPlayer" {
5875
5899
  get crossOrigin(): string | null;
5876
5900
  set crossOrigin(val: string | null);
5877
5901
  get videoTexture(): THREE.VideoTexture | null;
5902
+ get videoElement(): HTMLVideoElement | null;
5878
5903
  private _crossOrigin;
5879
5904
  private audioOutputMode;
5880
5905
  private source;
5881
5906
  private clip?;
5882
5907
  private url?;
5883
- private videoElement;
5908
+ private _videoElement;
5884
5909
  private _videoTexture;
5885
5910
  private videoMaterial;
5886
5911
  private _isPlaying;