@needle-tools/engine 2.41.0-pre → 2.42.0-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.
- package/CHANGELOG.md +11 -0
- package/dist/needle-engine.d.ts +100 -40
- package/dist/needle-engine.js +367 -367
- package/dist/needle-engine.js.map +3 -3
- package/dist/needle-engine.min.js +37 -37
- package/dist/needle-engine.min.js.map +3 -3
- package/lib/engine/engine_element.js +1 -1
- package/lib/engine/engine_element.js.map +1 -1
- package/lib/engine/engine_element_loading.js +6 -1
- package/lib/engine/engine_element_loading.js.map +1 -1
- package/lib/engine/engine_gizmos.d.ts +8 -22
- package/lib/engine/engine_gizmos.js +37 -3
- package/lib/engine/engine_gizmos.js.map +1 -1
- package/lib/engine/engine_setup.d.ts +3 -0
- package/lib/engine/engine_setup.js +15 -0
- package/lib/engine/engine_setup.js.map +1 -1
- package/lib/engine/engine_three_utils.d.ts +16 -1
- package/lib/engine/engine_three_utils.js +94 -54
- package/lib/engine/engine_three_utils.js.map +1 -1
- package/lib/engine/engine_types.d.ts +6 -0
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine-components/AnimationCurve.js +2 -2
- package/lib/engine-components/AnimationCurve.js.map +1 -1
- package/lib/engine-components/BoxHelperComponent.js +9 -10
- package/lib/engine-components/BoxHelperComponent.js.map +1 -1
- package/lib/engine-components/ParticleSystem.d.ts +24 -10
- package/lib/engine-components/ParticleSystem.js +136 -41
- package/lib/engine-components/ParticleSystem.js.map +1 -1
- package/lib/engine-components/ParticleSystemModules.d.ts +40 -6
- package/lib/engine-components/ParticleSystemModules.js +103 -21
- package/lib/engine-components/ParticleSystemModules.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.js +29 -11
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/Renderer.d.ts +1 -0
- package/lib/engine-components/Renderer.js +4 -2
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +1 -0
- package/lib/engine-components/codegen/components.js +1 -0
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/package.json +2 -2
- package/src/engine/codegen/register_types.js +4 -0
- package/src/engine/dist/engine_three_utils.js +279 -0
- package/src/engine/engine_element.ts +1 -1
- package/src/engine/engine_element_loading.ts +5 -1
- package/src/engine/engine_gizmos.ts +45 -8
- package/src/engine/engine_setup.ts +25 -2
- package/src/engine/engine_three_utils.ts +103 -62
- package/src/engine/engine_types.ts +8 -1
- package/src/engine-components/AnimationCurve.ts +2 -2
- package/src/engine-components/BoxHelperComponent.ts +12 -15
- package/src/engine-components/ParticleSystem.ts +151 -75
- package/src/engine-components/ParticleSystemModules.ts +127 -24
- package/src/engine-components/ReflectionProbe.ts +37 -13
- package/src/engine-components/Renderer.ts +4 -2
- package/src/engine-components/codegen/components.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ 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.42.0-pre] - 2022-11-09
|
|
8
|
+
- add ``Graphics.copyTexture``
|
|
9
|
+
- add ``Renderer.allowProgressiveLoad``
|
|
10
|
+
- add ``Gizmos.DrawBox`` and ``DrawBox3``
|
|
11
|
+
- add particles burst emission
|
|
12
|
+
- add particles color interpolation between two gradients
|
|
13
|
+
- fix: reflection probe material caching for when material is being changed at certain times outside of animation loop and cache applied wrong material
|
|
14
|
+
- fix: AnimationCurve evaluation when time and keyframe are both exactly 0
|
|
15
|
+
- change: reflection probe now requires anchor override
|
|
16
|
+
- change: bump threejs dependency
|
|
17
|
+
|
|
7
18
|
## [2.41.0-pre] - 2022-11-07
|
|
8
19
|
- Add: start adding particle systems support again
|
|
9
20
|
- Change: update dependency version to needle gltf-transform-extensions package
|
package/dist/needle-engine.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ declare module "engine/engine_physics.types" {
|
|
|
53
53
|
}
|
|
54
54
|
declare module "engine/engine_three_utils" {
|
|
55
55
|
import * as THREE from "three";
|
|
56
|
-
import { Vector3 } from "three";
|
|
56
|
+
import { Vector3, Texture, ShaderMaterial } from "three";
|
|
57
57
|
export function lookAtInverse(obj: THREE.Object3D, target: Vector3): void;
|
|
58
58
|
export function getWorldPosition(obj: THREE.Object3D, vec?: THREE.Vector3 | null, updateParents?: boolean): THREE.Vector3;
|
|
59
59
|
export function setWorldPosition(obj: THREE.Object3D, val: THREE.Vector3): void;
|
|
@@ -70,7 +70,22 @@ declare module "engine/engine_three_utils" {
|
|
|
70
70
|
export function setWorldRotation(obj: THREE.Object3D, val: THREE.Vector3): void;
|
|
71
71
|
export function setWorldRotationXYZ(obj: THREE.Object3D, x: number, y: number, z: number, degrees?: boolean): void;
|
|
72
72
|
export function logHierarchy(root: THREE.Object3D | null | undefined, collapsible?: boolean): void;
|
|
73
|
+
export class Graphics {
|
|
74
|
+
private static planeGeometry;
|
|
75
|
+
private static renderer;
|
|
76
|
+
private static perspectiveCam;
|
|
77
|
+
private static scene;
|
|
78
|
+
private static readonly vertex;
|
|
79
|
+
private static readonly fragment;
|
|
80
|
+
private static readonly blipMaterial;
|
|
81
|
+
static createBlitMaterial(fragment: string): ShaderMaterial;
|
|
82
|
+
private static readonly mesh;
|
|
83
|
+
static copyTexture(texture: Texture, blitMaterial?: ShaderMaterial): THREE.Texture;
|
|
84
|
+
static textureToCanvas(texture: Texture, force: boolean): HTMLCanvasElement | null;
|
|
85
|
+
}
|
|
86
|
+
/**@obsolete use Graphics.copyTexture */
|
|
73
87
|
export function copyTexture(texture: THREE.Texture): THREE.Texture;
|
|
88
|
+
/**@obsolete use Graphics.textureToCanvas */
|
|
74
89
|
export function textureToCanvas(texture: THREE.Texture, force?: boolean): HTMLCanvasElement | null;
|
|
75
90
|
}
|
|
76
91
|
declare module "engine/engine_types" {
|
|
@@ -194,6 +209,12 @@ declare module "engine/engine_types" {
|
|
|
194
209
|
y: number;
|
|
195
210
|
z: number;
|
|
196
211
|
};
|
|
212
|
+
export type Vec4 = {
|
|
213
|
+
x: number;
|
|
214
|
+
y: number;
|
|
215
|
+
z: number;
|
|
216
|
+
w: number;
|
|
217
|
+
};
|
|
197
218
|
export class ContactPoint {
|
|
198
219
|
private readonly _point;
|
|
199
220
|
private readonly _normal;
|
|
@@ -768,30 +789,16 @@ declare module "engine/engine_gameobject" {
|
|
|
768
789
|
}
|
|
769
790
|
declare module "engine/engine_gizmos" {
|
|
770
791
|
import * as THREE from 'three';
|
|
771
|
-
import { ColorRepresentation } from 'three';
|
|
772
|
-
import { Vec3 } from "engine/engine_types";
|
|
792
|
+
import { ColorRepresentation, Box3 } from 'three';
|
|
793
|
+
import { Vec3, Vec4 } from "engine/engine_types";
|
|
773
794
|
export class Gizmos {
|
|
774
795
|
static DrawRay(origin: Vec3, dir: Vec3, color?: ColorRepresentation, duration?: number, depthTest?: boolean): void;
|
|
775
|
-
static DrawDirection(pt: Vec3, direction: Vec3, color?: ColorRepresentation, duration?: number, depthTest?: boolean, lengthFactor?: number): void;
|
|
776
|
-
static DrawLine(pt0:
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
x: number;
|
|
782
|
-
y: number;
|
|
783
|
-
z: number;
|
|
784
|
-
}, color?: ColorRepresentation, duration?: number, depthTest?: boolean): void;
|
|
785
|
-
static DrawWireSphere(center: {
|
|
786
|
-
x: number;
|
|
787
|
-
y: number;
|
|
788
|
-
z: number;
|
|
789
|
-
}, radius: number, color?: ColorRepresentation, duration?: number, depthTest?: boolean): void;
|
|
790
|
-
static DrawSphere(center: {
|
|
791
|
-
x: number;
|
|
792
|
-
y: number;
|
|
793
|
-
z: number;
|
|
794
|
-
}, radius: number, color?: ColorRepresentation, duration?: number, depthTest?: boolean): void;
|
|
796
|
+
static DrawDirection(pt: Vec3, direction: Vec3 | Vec4, color?: ColorRepresentation, duration?: number, depthTest?: boolean, lengthFactor?: number): void;
|
|
797
|
+
static DrawLine(pt0: Vec3, pt1: Vec3, color?: ColorRepresentation, duration?: number, depthTest?: boolean): void;
|
|
798
|
+
static DrawWireSphere(center: Vec3, radius: number, color?: ColorRepresentation, duration?: number, depthTest?: boolean): void;
|
|
799
|
+
static DrawSphere(center: Vec3, radius: number, color?: ColorRepresentation, duration?: number, depthTest?: boolean): void;
|
|
800
|
+
static DrawBox(center: Vec3, size: Vec3, color?: ColorRepresentation, duration?: number, depthTest?: boolean): void;
|
|
801
|
+
static DrawBox3(box: Box3, color?: ColorRepresentation, duration?: number, depthTest?: boolean): void;
|
|
795
802
|
}
|
|
796
803
|
export function CreateWireCube(col?: THREE.ColorRepresentation | null): THREE.LineSegments;
|
|
797
804
|
}
|
|
@@ -1824,6 +1831,9 @@ declare module "engine/engine_setup" {
|
|
|
1824
1831
|
get isInAR(): boolean;
|
|
1825
1832
|
get xrSession(): THREE.XRSession | null;
|
|
1826
1833
|
get arOverlayElement(): HTMLElement;
|
|
1834
|
+
/** Current event of the update cycle */
|
|
1835
|
+
get currentFrameEvent(): FrameEvent;
|
|
1836
|
+
private _currentFrameEvent;
|
|
1827
1837
|
scene: THREE.Scene;
|
|
1828
1838
|
renderer: THREE.WebGLRenderer;
|
|
1829
1839
|
composer: EffectComposer | null;
|
|
@@ -3471,6 +3481,7 @@ declare module "engine-components/Renderer" {
|
|
|
3471
3481
|
get lightmap(): Texture | null;
|
|
3472
3482
|
set lightmap(tex: Texture | null | undefined);
|
|
3473
3483
|
get hasLightmap(): boolean;
|
|
3484
|
+
allowProgressiveLoading: boolean;
|
|
3474
3485
|
awake(): void;
|
|
3475
3486
|
private _isInstancingEnabled;
|
|
3476
3487
|
private handles;
|
|
@@ -4176,6 +4187,17 @@ declare module "engine-components/ParticleSystemModules" {
|
|
|
4176
4187
|
time: number;
|
|
4177
4188
|
alpha: number;
|
|
4178
4189
|
};
|
|
4190
|
+
export interface IParticleSystem {
|
|
4191
|
+
get currentParticles(): number;
|
|
4192
|
+
get maxParticles(): number;
|
|
4193
|
+
get time(): number;
|
|
4194
|
+
get duration(): number;
|
|
4195
|
+
readonly main: MainModule;
|
|
4196
|
+
}
|
|
4197
|
+
export enum ParticleSystemRenderMode {
|
|
4198
|
+
Billboard = 0,
|
|
4199
|
+
Mesh = 4
|
|
4200
|
+
}
|
|
4179
4201
|
export class Gradient {
|
|
4180
4202
|
alphaKeys: Array<AlphaKey>;
|
|
4181
4203
|
colorKeys: Array<ColorKey>;
|
|
@@ -4242,7 +4264,8 @@ declare module "engine-components/ParticleSystemModules" {
|
|
|
4242
4264
|
gradient: Gradient;
|
|
4243
4265
|
gradientMin: Gradient;
|
|
4244
4266
|
gradientMax: Gradient;
|
|
4245
|
-
private _temp;
|
|
4267
|
+
private static _temp;
|
|
4268
|
+
private static _temp2;
|
|
4246
4269
|
evaluate(t01: number, lerpFactor?: number): RGBAColor;
|
|
4247
4270
|
}
|
|
4248
4271
|
type ParticleSystemScalingMode = {
|
|
@@ -4297,16 +4320,38 @@ declare module "engine-components/ParticleSystemModules" {
|
|
|
4297
4320
|
stopAction: number;
|
|
4298
4321
|
useUnscaledTime: boolean;
|
|
4299
4322
|
}
|
|
4323
|
+
export class ParticleBurst {
|
|
4324
|
+
cycleCount: number;
|
|
4325
|
+
maxCount: number;
|
|
4326
|
+
minCount: number;
|
|
4327
|
+
probability: number;
|
|
4328
|
+
repeatInterval: number;
|
|
4329
|
+
time: number;
|
|
4330
|
+
count: {
|
|
4331
|
+
constant: number;
|
|
4332
|
+
constantMax: number;
|
|
4333
|
+
constantMin: number;
|
|
4334
|
+
curve?: AnimationCurve;
|
|
4335
|
+
curveMax?: AnimationCurve;
|
|
4336
|
+
curveMin?: AnimationCurve;
|
|
4337
|
+
curveMultiplier?: number;
|
|
4338
|
+
mode: ParticleSystemCurveMode;
|
|
4339
|
+
};
|
|
4340
|
+
private _performed;
|
|
4341
|
+
reset(): void;
|
|
4342
|
+
run(time: number): number;
|
|
4343
|
+
}
|
|
4300
4344
|
export class EmissionModule {
|
|
4301
|
-
burstCount: number;
|
|
4302
4345
|
enabled: boolean;
|
|
4346
|
+
get burstCount(): number;
|
|
4347
|
+
bursts: ParticleBurst[];
|
|
4303
4348
|
rateOverTime: MinMaxCurve;
|
|
4304
4349
|
rateOverTimeMultiplier: number;
|
|
4305
4350
|
rateOverDistance: MinMaxCurve;
|
|
4306
4351
|
rateOverDistanceMultiplier: number;
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4352
|
+
/** set from system */
|
|
4353
|
+
system: IParticleSystem;
|
|
4354
|
+
get time(): number;
|
|
4310
4355
|
private _summed;
|
|
4311
4356
|
/** called by nebula */
|
|
4312
4357
|
init(): void;
|
|
@@ -4357,7 +4402,7 @@ declare module "engine-components/ParticleSystemModules" {
|
|
|
4357
4402
|
/** called by nebula */
|
|
4358
4403
|
getPosition(): void;
|
|
4359
4404
|
private _dir;
|
|
4360
|
-
getDirection(position: any):
|
|
4405
|
+
getDirection(position: any): Vector3;
|
|
4361
4406
|
}
|
|
4362
4407
|
import { Context } from "engine/engine_setup";
|
|
4363
4408
|
export class NoiseModule {
|
|
@@ -4397,22 +4442,36 @@ declare module "engine-components/ParticleSystemModules" {
|
|
|
4397
4442
|
}
|
|
4398
4443
|
declare module "engine-components/ParticleSystem" {
|
|
4399
4444
|
import { Behaviour } from "engine-components/Component";
|
|
4400
|
-
import
|
|
4401
|
-
import {
|
|
4445
|
+
import * as THREE from "three";
|
|
4446
|
+
import { MainModule, EmissionModule, ShapeModule, ColorOverLifetimeModule, SizeOverLifetimeModule, NoiseModule, IParticleSystem, ParticleSystemRenderMode } from "engine-components/ParticleSystemModules";
|
|
4447
|
+
import { Mesh, SpriteMaterial } from "three";
|
|
4402
4448
|
export class ParticleSystemRenderer extends Behaviour {
|
|
4449
|
+
renderMode?: ParticleSystemRenderMode;
|
|
4403
4450
|
particleMaterial?: SpriteMaterial;
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4451
|
+
particleMesh?: Mesh | string;
|
|
4452
|
+
getMesh(): THREE.Mesh<THREE.BufferGeometry, THREE.SpriteMaterial>;
|
|
4453
|
+
}
|
|
4454
|
+
export class ParticleSystem extends Behaviour implements IParticleSystem {
|
|
4455
|
+
readonly colorOverLifetime: ColorOverLifetimeModule;
|
|
4456
|
+
readonly main: MainModule;
|
|
4457
|
+
readonly emission: EmissionModule;
|
|
4458
|
+
readonly sizeOverLifetime: SizeOverLifetimeModule;
|
|
4459
|
+
readonly shape: ShapeModule;
|
|
4460
|
+
readonly noise: NoiseModule;
|
|
4461
|
+
get renderer(): ParticleSystemRenderer;
|
|
4462
|
+
get currentParticles(): any;
|
|
4463
|
+
get maxParticles(): number;
|
|
4464
|
+
get time(): number;
|
|
4465
|
+
get duration(): number;
|
|
4466
|
+
private _renderer;
|
|
4413
4467
|
private _system;
|
|
4414
4468
|
private _emitter;
|
|
4415
4469
|
private _size;
|
|
4470
|
+
private _container?;
|
|
4471
|
+
private _time;
|
|
4472
|
+
/** called from deserialization */
|
|
4473
|
+
private set bursts(value);
|
|
4474
|
+
private _bursts?;
|
|
4416
4475
|
awake(): void;
|
|
4417
4476
|
onEnable(): void;
|
|
4418
4477
|
onDisable(): void;
|
|
@@ -5700,6 +5759,7 @@ declare module "engine-components/codegen/components" {
|
|
|
5700
5759
|
export { MinMaxCurve } from "engine-components/ParticleSystemModules";
|
|
5701
5760
|
export { MinMaxGradient } from "engine-components/ParticleSystemModules";
|
|
5702
5761
|
export { MainModule } from "engine-components/ParticleSystemModules";
|
|
5762
|
+
export { ParticleBurst } from "engine-components/ParticleSystemModules";
|
|
5703
5763
|
export { EmissionModule } from "engine-components/ParticleSystemModules";
|
|
5704
5764
|
export { ColorOverLifetimeModule } from "engine-components/ParticleSystemModules";
|
|
5705
5765
|
export { SizeOverLifetimeModule } from "engine-components/ParticleSystemModules";
|