@hology/core 0.0.53 → 0.0.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. package/LICENSE.md +4 -4
  2. package/dist/effects/vfx/behaviours.d.ts +16 -0
  3. package/dist/effects/vfx/behaviours.js +1 -1
  4. package/dist/effects/vfx/index.d.ts +2 -0
  5. package/dist/effects/vfx/index.js +1 -1
  6. package/dist/effects/vfx/initializsers.d.ts +7 -0
  7. package/dist/effects/vfx/initializsers.js +1 -1
  8. package/dist/effects/vfx/rates.d.ts +6 -0
  9. package/dist/effects/vfx/rates.js +1 -1
  10. package/dist/effects/vfx/stretched-sprite.d.ts +4 -0
  11. package/dist/effects/vfx/stretched-sprite.js +5 -0
  12. package/dist/effects/vfx/trail-renderer.d.ts +91 -0
  13. package/dist/effects/vfx/trail-renderer.js +5 -0
  14. package/dist/effects/vfx/vfx-actor.d.ts +15 -2
  15. package/dist/effects/vfx/vfx-actor.js +1 -1
  16. package/dist/effects/vfx/vfx-asset.d.ts +29 -4
  17. package/dist/effects/vfx/vfx-asset.js +1 -1
  18. package/dist/effects/vfx/vfx-defs.d.ts +46 -15
  19. package/dist/effects/vfx/vfx-defs.js +1 -1
  20. package/dist/effects/vfx/vfx-materializer.d.ts +22 -10
  21. package/dist/effects/vfx/vfx-materializer.js +1 -1
  22. package/dist/effects/vfx/vfx-old-materializer.d.ts +11 -0
  23. package/dist/effects/vfx/vfx-old-materializer.js +5 -0
  24. package/dist/effects/vfx/vfx-param.d.ts +2 -3
  25. package/dist/effects/vfx/vfx-param.js +1 -1
  26. package/dist/effects/vfx/vfx-renderers.d.ts +58 -3
  27. package/dist/effects/vfx/vfx-renderers.js +1 -1
  28. package/dist/effects/vfx/vfx-service.d.ts +14 -0
  29. package/dist/effects/vfx/vfx-service.js +5 -0
  30. package/dist/gameplay/actors/builtin/components/character/character-animation.js +1 -1
  31. package/dist/gameplay/actors/builtin/components/mesh-component.d.ts +1 -0
  32. package/dist/gameplay/actors/builtin/components/mesh-component.js +1 -1
  33. package/dist/gameplay/index.d.ts +1 -0
  34. package/dist/gameplay/index.js +1 -1
  35. package/dist/gameplay/services/physics/physics-system.d.ts +8 -0
  36. package/dist/gameplay/services/physics/physics-system.js +1 -1
  37. package/dist/gameplay/services/world.js +1 -1
  38. package/dist/rendering.js +1 -1
  39. package/dist/scene/asset-resource-loader.d.ts +1 -0
  40. package/dist/scene/asset-resource-loader.js +1 -1
  41. package/dist/scene/landscape/landscape-manager.d.ts +1 -0
  42. package/dist/scene/landscape/landscape-manager.js +1 -1
  43. package/dist/scene/materializer.d.ts +2 -0
  44. package/dist/scene/materializer.js +1 -1
  45. package/dist/scene/model.d.ts +1 -0
  46. package/dist/scene/storage/storage.d.ts +33 -2
  47. package/dist/scene/storage/storage.js +1 -1
  48. package/dist/shader/builtin/lambert-shader.d.ts +1 -1
  49. package/dist/shader/builtin/lambert-shader.js +1 -1
  50. package/dist/shader/builtin/standard-shader.js +1 -1
  51. package/dist/utils/math.js +1 -1
  52. package/dist/utils/three/transform-controls.d.ts +4 -2
  53. package/dist/utils/three/transform-controls.js +1 -1
  54. package/package.json +3 -2
  55. package/tsconfig.tsbuildinfo +1 -1
package/LICENSE.md CHANGED
@@ -1,14 +1,14 @@
1
- # Hology Engine Limited License
1
+ # Hology Interactive AB Limited License
2
2
 
3
- This software package, including all associated files and documentation (the "Software"), is licensed to you (the "Licensee") by Hology Engine for use exclusively with the product "Hology Engine."
3
+ This software package, including all associated files and documentation (the "Software"), is licensed to you (the "Licensee") by Hology Interactive AB for use exclusively with the product "Hology Engine."
4
4
 
5
5
  By using, copying, modifying, or distributing the Software, Licensee agrees to be bound by the terms of this license.
6
6
 
7
- 1. License Grant: Hology Engine grants Licensee a limited, non-exclusive, non-transferable license to use the Software solely for the purpose of developing and running software developed with "Hology Engine."
7
+ 1. License Grant: Hology Interactive AB grants Licensee a limited, non-exclusive, non-transferable license to use the Software solely for the purpose of developing and running software developed with "Hology Engine."
8
8
 
9
9
  2. Restrictions: Licensee may not use, copy, modify, or distribute the Software for any other purpose, including but not limited to the creation of derivative works, standalone applications, or any products not directly associated with "Hology Engine."
10
10
 
11
- 3. Ownership: Hology Engine retains all intellectual property rights to the Software. This license does not transfer ownership of the Software to Licensee.
11
+ 3. Ownership: Hology Interactive AB retains all intellectual property rights to the Software. This license does not transfer ownership of the Software to Licensee.
12
12
 
13
13
  4. Warranty Disclaimer: THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE CREATOR OF THIS PACKAGE BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE.
14
14
 
@@ -24,6 +24,22 @@ export declare class OrientAlongVelocity extends Behaviour {
24
24
  initialize(particle: Particle): void;
25
25
  mutate(target: Particle | Emitter, time: number, index: number): void;
26
26
  }
27
+ export declare class FollowParent extends Behaviour {
28
+ private speed;
29
+ constructor(speed: number);
30
+ initialize(particle: Particle): void;
31
+ mutate(target: Particle | Emitter, time: number, index: number): void;
32
+ }
33
+ export declare class Scale extends Behaviour {
34
+ private scaleA;
35
+ private scaleB;
36
+ constructor(scaleA: number, scaleB: number, easing: EasingFunction);
37
+ /**
38
+ * Set the behaviour's initial properties on the particle.
39
+ */
40
+ initialize(particle: Particle): void;
41
+ mutate(target: Particle | Emitter, time: number, index: number): void;
42
+ }
27
43
  export declare class LinearDamping extends Behaviour {
28
44
  private factor;
29
45
  constructor(factor: number);
@@ -1,4 +1,4 @@
1
- import{Behaviour as i,Vector3D as t,ease as s}from"three-nebula";import*as e from"three";export class RotatePosition extends i{constructor(i,s){super(),this.axis=i,this.angle=s,this.axis3D=new t(this.axis.x,this.axis.y,this.axis.z)}mutate(i,t,s){this.energize(i,t),i.position.sub(i.parent.position),i.position.applyAxisAngle(this.axis3D,this.angle*t),i.position.add(i.parent.position)}}export var AxisDirection;!function(i){i[i.x=0]="x",i[i.y=1]="y",i[i.z=2]="z",i[i.mx=3]="mx",i[i.my=4]="my",i[i.mz=5]="mz"}(AxisDirection||(AxisDirection={}));export class OrientAlongVelocity extends i{constructor(i){super(),this.axisDirection=i}initialize(i){i.transform.orientAlongVelocity=!0}mutate(i,t,s){i.target,e.Object3D}}export class LinearDamping extends i{constructor(i){super(),this.factor=i}mutate(i,t,s){this.energize(i,t);const e=n.copy(i.velocity).multiplyScalar(-this.factor*t);i.velocity.add(e)}}const n=new t;export var AxisPlane;!function(i){i[i.xy=0]="xy",i[i.xz=1]="xz",i[i.yz=2]="yz",i[i.xyz=3]="xyz"}(AxisPlane||(AxisPlane={}));export class Disperse extends i{constructor(i,t,e=s.easeLinear){super(void 0,e,void 0,!0),this.distance=i,this.plane=t}initialize(i){i.transform.initialPos=i.position.clone();const t=o.copy(i.transform.initialPos).sub(i.parent.position).normalize();switch(this.plane){case AxisPlane.xy:t.setComponent(2,0);break;case AxisPlane.xz:t.setComponent(1,0);break;case AxisPlane.yz:t.setComponent(0,0)}i.transform.displacement=t.clone().multiplyScalar(this.distance),i.transform.prevEnergy=1}mutate(i,t,s){this.energize(i,t);i.transform.initialPos;const e=i.transform.displacement,n=i.transform.prevEnergy-this.energy;i.transform.prevEnergy=this.energy;i.position.x+=e.x*n,i.position.y+=e.y*n,i.position.z+=e.z*n}}export class MoveOverLife extends i{constructor(i,t,e,n=s.easeLinear){super(void 0,n,void 0,!0),this.x=i,this.y=t,this.z=e}initialize(i){i.transform.initialPos=i.position.clone()}mutate(i,t,s){this.energize(i,t);const e=i.transform.initialPos,n=1-this.energy;i.position.x=e.x+this.x*n,i.position.y=e.y+this.y*n,i.position.z=e.z+this.z*n}}const o=new t;
1
+ import{Behaviour as t,Vector3D as s,ease as i}from"three-nebula";import*as e from"three";export class RotatePosition extends t{constructor(t,i){super(),this.axis=t,this.angle=i,this.axis3D=new s(this.axis.x,this.axis.y,this.axis.z)}mutate(t,s,i){this.energize(t,s),t.position.sub(t.parent.position),t.position.applyAxisAngle(this.axis3D,this.angle*s),t.position.add(t.parent.position)}}export var AxisDirection;!function(t){t[t.x=0]="x",t[t.y=1]="y",t[t.z=2]="z",t[t.mx=3]="mx",t[t.my=4]="my",t[t.mz=5]="mz"}(AxisDirection||(AxisDirection={}));export class OrientAlongVelocity extends t{constructor(t){super(),this.axisDirection=t}initialize(t){t.transform.orientAlongVelocity=!0}mutate(t,s,i){t.target,e.Object3D}}export class FollowParent extends t{constructor(t){super(),this.speed=t}initialize(t){}mutate(t,s,i){const e=t.parent.parentParticle??t.parent,a=o.copy(e.position).sub(t.position),r=(a.length(),a.normalize());n.copy(r).multiplyScalar(this.speed),t.velocity.copy(n)}}export class Scale extends t{constructor(t,s,i){super(void 0,i),this.scaleA=t,this.scaleB=s}initialize(t){t.transform.scaleA=t.scale*this.scaleA,t.transform.scaleB=t.scale*this.scaleB,t.transform.oldRadius=t.radius}mutate(t,s,i){this.energize(t,s),t.scale=e.MathUtils.lerp(t.transform.scaleA,t.transform.scaleB,this.energy),t.scale<5e-4&&(t.scale=0),t.radius=t.transform.oldRadius*t.scale}}export class LinearDamping extends t{constructor(t){super(),this.factor=t}mutate(t,s,i){this.energize(t,s);const e=o.copy(t.velocity).multiplyScalar(-this.factor*s);t.velocity.add(e)}}const o=new s,n=new s;export var AxisPlane;!function(t){t[t.xy=0]="xy",t[t.xz=1]="xz",t[t.yz=2]="yz",t[t.xyz=3]="xyz"}(AxisPlane||(AxisPlane={}));export class Disperse extends t{constructor(t,s,e=i.easeLinear){super(void 0,e,void 0,!0),this.distance=t,this.plane=s}initialize(t){t.transform.initialPos=t.position.clone();const s=a.copy(t.transform.initialPos).sub(t.parent.position).normalize();switch(this.plane){case AxisPlane.xy:s.setComponent(2,0);break;case AxisPlane.xz:s.setComponent(1,0);break;case AxisPlane.yz:s.setComponent(0,0)}t.transform.displacement=s.clone().multiplyScalar(this.distance),t.transform.prevEnergy=1}mutate(t,s,i){this.energize(t,s);t.transform.initialPos;const e=t.transform.displacement,o=t.transform.prevEnergy-this.energy;t.transform.prevEnergy=this.energy;t.position.x+=e.x*o,t.position.y+=e.y*o,t.position.z+=e.z*o}}export class MoveOverLife extends t{constructor(t,s,e,o=i.easeLinear){super(void 0,o,void 0,!0),this.x=t,this.y=s,this.z=e}initialize(t){t.transform.initialPos=t.position.clone()}mutate(t,s,i){this.energize(t,s);const e=t.transform.initialPos,o=1-this.energy;t.position.x=e.x+this.x*o,t.position.y=e.y+this.y*o,t.position.z=e.z+this.z*o}}const a=new s;
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
@@ -1,2 +1,4 @@
1
1
  export * from './vfx-asset.js';
2
2
  export * from './vfx-materializer.js';
3
+ export * from './vfx-actor.js';
4
+ export * from './vfx-service.js';
@@ -1,4 +1,4 @@
1
- export*from"./vfx-asset.js";export*from"./vfx-materializer.js";
1
+ export*from"./vfx-asset.js";export*from"./vfx-materializer.js";export*from"./vfx-actor.js";export*from"./vfx-service.js";
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
@@ -22,6 +22,13 @@ export declare class InitialScale extends InitialScale_base {
22
22
  constructor(scale: number);
23
23
  init(emitter: Emitter, particle: Particle): void;
24
24
  }
25
+ declare const RandomScale_base: any;
26
+ export declare class RandomScale extends RandomScale_base {
27
+ private min;
28
+ private max;
29
+ constructor(min: number, max: number);
30
+ init(emitter: Emitter, particle: Particle): void;
31
+ }
25
32
  declare const InitialScaleComponents_base: any;
26
33
  export declare class InitialScaleComponents extends InitialScaleComponents_base {
27
34
  private scale;
@@ -1,4 +1,4 @@
1
- import{Vector3 as t}from"three";import{Span as e,Position as i}from"three-nebula";export class DefaultInitializer extends(Object.getPrototypeOf(i)){init(t,e){e.parent=t}}export class Rotation extends(Object.getPrototypeOf(i)){constructor(t){super(),this.rotation=t}init(t,e){"number"!=typeof e.rotation&&e.rotation.copy(this.rotation)}}export class RandomRotation extends(Object.getPrototypeOf(i)){constructor(){super()}init(t,e){e.rotation.set(this.randomAngle(),this.randomAngle(),this.randomAngle())}randomAngle(){return 2*Math.PI*Math.random()}}export class InitialScale extends(Object.getPrototypeOf(i)){constructor(t){super(),this.scale=t}init(t,e){e.scale=this.scale}}export class InitialScaleComponents extends(Object.getPrototypeOf(i)){constructor(t){super(),this.scale=t}init(t,e){e.transform.initialScale=this.scale}}export class AdditiveVelocity extends(Object.getPrototypeOf(i)){constructor(t){super(),this.velocity=t}init(t,e){e.velocity.x+=this.velocity.x,e.velocity.y+=this.velocity.y,e.velocity.z+=this.velocity.z}}export class RandomDirection extends(Object.getPrototypeOf(i)){constructor(t){super(),this.speed=t}init(t,e){s.set(2*Math.random()-1,2*Math.random()-1,2*Math.random()-1).normalize().multiplyScalar(this.speed),e.velocity.x+=s.x,e.velocity.y+=s.y,e.velocity.z+=s.z}}export class RandomComponentsDirection extends(Object.getPrototypeOf(i)){constructor(t,i,s){super(),this.speed=t,this.min=i,this.max=s,this.x=new e(this.min.x,this.max.x),this.y=new e(this.min.y,this.max.y),this.z=new e(this.min.z,this.max.z)}init(t,e){s.set(this.x.getValue(),this.y.getValue(),this.z.getValue()).normalize().multiplyScalar(this.speed),e.velocity.x+=s.x,e.velocity.y+=s.y,e.velocity.z+=s.z}}export class RandomVelocity extends(Object.getPrototypeOf(i)){constructor(t,i){super(),this.min=t,this.max=i,this.x=new e(this.min.x,this.max.x),this.y=new e(this.min.y,this.max.y),this.z=new e(this.min.z,this.max.z)}init(t,e){e.velocity.x+=this.x.getValue(),e.velocity.y+=this.y.getValue(),e.velocity.z+=this.z.getValue()}}const s=new t;
1
+ import{Vector3 as t}from"three";import{Span as e,Position as i}from"three-nebula";export class DefaultInitializer extends(Object.getPrototypeOf(i)){init(t,e){e.parent=t}}export class Rotation extends(Object.getPrototypeOf(i)){constructor(t){super(),this.rotation=t}init(t,e){"number"!=typeof e.rotation&&e.rotation.copy(this.rotation)}}export class RandomRotation extends(Object.getPrototypeOf(i)){constructor(){super()}init(t,e){e.rotation.set(this.randomAngle(),this.randomAngle(),this.randomAngle())}randomAngle(){return 2*Math.PI*Math.random()}}export class InitialScale extends(Object.getPrototypeOf(i)){constructor(t){super(),this.scale=t}init(t,e){e.scale=this.scale}}export class RandomScale extends(Object.getPrototypeOf(i)){constructor(t,e){super(),this.min=t,this.max=e}init(t,e){var i,s;e.scale=(i=this.min,s=this.max,Math.random()*(s-i)+i)}}export class InitialScaleComponents extends(Object.getPrototypeOf(i)){constructor(t){super(),this.scale=t}init(t,e){e.transform.initialScale=this.scale}}export class AdditiveVelocity extends(Object.getPrototypeOf(i)){constructor(t){super(),this.velocity=t}init(t,e){e.velocity.x+=this.velocity.x,e.velocity.y+=this.velocity.y,e.velocity.z+=this.velocity.z}}export class RandomDirection extends(Object.getPrototypeOf(i)){constructor(t){super(),this.speed=t}init(t,e){s.set(2*Math.random()-1,2*Math.random()-1,2*Math.random()-1).normalize().multiplyScalar(this.speed),e.velocity.x+=s.x,e.velocity.y+=s.y,e.velocity.z+=s.z}}export class RandomComponentsDirection extends(Object.getPrototypeOf(i)){constructor(t,i,s){super(),this.speed=t,this.min=i,this.max=s,this.x=new e(this.min.x,this.max.x),this.y=new e(this.min.y,this.max.y),this.z=new e(this.min.z,this.max.z)}init(t,e){s.set(this.x.getValue(),this.y.getValue(),this.z.getValue()).normalize().multiplyScalar(this.speed),e.velocity.x+=s.x,e.velocity.y+=s.y,e.velocity.z+=s.z}}export class RandomVelocity extends(Object.getPrototypeOf(i)){constructor(t,i){super(),this.min=t,this.max=i,this.x=new e(this.min.x,this.max.x),this.y=new e(this.min.y,this.max.y),this.z=new e(this.min.z,this.max.z)}init(t,e){e.velocity.x+=this.x.getValue(),e.velocity.y+=this.y.getValue(),e.velocity.z+=this.z.getValue()}}const s=new t;
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
@@ -5,7 +5,13 @@ export declare class DelayRate extends Rate {
5
5
  readonly delay: number;
6
6
  constructor(delay?: number, numPan?: RateNumPan, timePan?: RateTimePan);
7
7
  restart(): void;
8
+ clone(): DelayRate;
8
9
  }
9
10
  export declare class OnceRate extends DelayRate {
11
+ private count;
12
+ private calls;
10
13
  constructor(delay: number, count?: number);
14
+ clone(): OnceRate;
15
+ init(): void;
16
+ getValue(time: any): number;
11
17
  }
@@ -1,4 +1,4 @@
1
- import{Rate as e}from"three-nebula";export{Rate}from"three-nebula";export class DelayRate extends e{constructor(e=0,t,s){super(t,s),this.delay=e,this.restart()}restart(){this.nextTime=0,null!=this.delay&&this.delay>0&&(this.startTime=-this.delay)}}export class OnceRate extends DelayRate{constructor(e,t=1){super(e,t,1/0)}}
1
+ import{Rate as t}from"three-nebula";export{Rate}from"three-nebula";export class DelayRate extends t{constructor(t=0,e,s){super(e,s),this.delay=t,this.restart()}restart(){this.nextTime=0,null!=this.delay&&this.delay>0&&(this.startTime=-this.delay)}clone(){return new DelayRate(this.delay,this.numPan,this.timePan)}}export class OnceRate extends DelayRate{constructor(t,e=1){super(t,e,1/0),this.count=e,this.calls=0,this.nextTime=0}clone(){return new OnceRate(this.delay,this.count)}init(){this.restart()}getValue(t){return this.calls++,this.startTime+=t,this.startTime>=this.nextTime?(this.nextTime=1/0,this.count):0}}
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
@@ -0,0 +1,4 @@
1
+ import * as THREE from 'three';
2
+ export declare class StretchedSprite extends THREE.Mesh {
3
+ scaleFactor: number;
4
+ }
@@ -0,0 +1,5 @@
1
+ import*as e from"three";export class StretchedSprite extends e.Mesh{constructor(){super(...arguments),this.scaleFactor=1}}
2
+ /*
3
+ * Copyright (©) 2023. All rights reserved.
4
+ * See the LICENSE.md file for details.
5
+ */
@@ -0,0 +1,91 @@
1
+ import * as THREE from "three";
2
+ export declare class Trail extends THREE.Object3D {
3
+ active: boolean;
4
+ orientToMovement: boolean;
5
+ scene: any;
6
+ geometry: THREE.BufferGeometry | null;
7
+ mesh: THREE.Mesh | null;
8
+ nodeCenters: Array<THREE.Vector3>;
9
+ lastNodeCenter: THREE.Vector3 | null;
10
+ currentNodeCenter: THREE.Vector3 | null;
11
+ lastOrientationDir: THREE.Vector3 | null;
12
+ nodeIDs: Array<number>;
13
+ currentLength: number;
14
+ currentEnd: number;
15
+ currentNodeID: number;
16
+ advanceFrequency: number;
17
+ advancePeriod: number;
18
+ lastAdvanceTime: number;
19
+ paused: boolean;
20
+ pauseAdvanceUpdateTimeDiff: number;
21
+ length: number;
22
+ dragTexture: number;
23
+ targetObject: THREE.Object3D;
24
+ material: THREE.ShaderMaterial;
25
+ localHeadGeometry: THREE.Vector3[];
26
+ VerticesPerNode: number;
27
+ FacesPerNode: number;
28
+ FaceIndicesPerNode: number;
29
+ vertexCount: number;
30
+ faceCount: number;
31
+ constructor(scene: THREE.Object3D, orientToMovement: boolean);
32
+ setAdvanceFrequency(advanceFrequency: any): void;
33
+ initialize(material: THREE.ShaderMaterial, length: number, dragTexture: boolean, localHeadWidth: number, localHeadGeometry: THREE.BufferGeometry, targetObject: THREE.Object3D): void;
34
+ initializeLocalHeadGeometry(localHeadWidth: any, localHeadGeometry: any): void;
35
+ initializeGeometry(): void;
36
+ zeroVertices(): void;
37
+ zeroIndices(): void;
38
+ formInitialFaces(): void;
39
+ initializeMesh(): void;
40
+ destroyMesh(): void;
41
+ reset(): void;
42
+ updateUniforms(): void;
43
+ advance: () => void;
44
+ advanceWithPositionAndOrientation(nextPosition: any, orientationTangent: any): void;
45
+ advanceWithTransform(transformMatrix: any): void;
46
+ advanceGeometry: (positionAndOrientation: any, transformMatrix: any) => void;
47
+ currentTime(): number;
48
+ pause(): void;
49
+ resume(): void;
50
+ update(): void;
51
+ updateHead: () => void;
52
+ updateNodeID(nodeIndex: any, id: any): void;
53
+ updateNodeCenter(nodeIndex: any, nodeCenter: any): void;
54
+ updateNodePositionsFromOrientationTangent: (nodeIndex: any, nodeCenter: any, orientationTangent: any) => void;
55
+ updateNodePositionsFromTransformMatrix: (nodeIndex: any, transformMatrix: any) => void;
56
+ connectNodes: (srcNodeIndex: any, destNodeIndex: any) => {
57
+ attribute: any;
58
+ offset: number;
59
+ count: number;
60
+ };
61
+ disconnectNodes: (srcNodeIndex: any) => {
62
+ attribute: any;
63
+ offset: number;
64
+ count: number;
65
+ };
66
+ deactivate(): void;
67
+ activate(): void;
68
+ static createMaterial(vertexShader: any, fragmentShader: any, customUniforms: any): THREE.ShaderMaterial;
69
+ static createBaseMaterial(customUniforms?: {}): THREE.ShaderMaterial;
70
+ static createTexturedMaterial(customUniforms: any): THREE.ShaderMaterial;
71
+ static get MaxHeadVertices(): number;
72
+ static _LocalOrientationTangent: THREE.Vector3;
73
+ static get LocalOrientationTangent(): THREE.Vector3;
74
+ static _LocalHeadOrigin: THREE.Vector3;
75
+ static get LocalHeadOrigin(): THREE.Vector3;
76
+ static get PositionComponentCount(): number;
77
+ static get UVComponentCount(): number;
78
+ static get IndicesPerFace(): number;
79
+ static get FacesPerQuad(): number;
80
+ static Shader: {
81
+ readonly BaseVertexVars: string;
82
+ readonly TexturedVertexVars: string;
83
+ BaseFragmentVars: string;
84
+ readonly TexturedFragmentVars: string;
85
+ readonly VertexShaderCore: string;
86
+ readonly BaseVertexShader: string;
87
+ readonly BaseFragmentShader: string;
88
+ readonly TexturedVertexShader: string;
89
+ readonly TexturedFragmentShader: string;
90
+ };
91
+ }
@@ -0,0 +1,5 @@
1
+ import*as e from"three";export class Trail extends e.Object3D{constructor(t,r){super(),this.nodeCenters=[],this.nodeIDs=[],this.advance=function(){const t=new e.Matrix4;return function(){this.targetObject.updateMatrixWorld(),t.copy(this.targetObject.matrixWorld),this.advanceWithTransform(t),this.updateUniforms()}}(),this.advanceGeometry=function(e,t){const r=this.currentEnd+1>=this.length?0:this.currentEnd+1;if(t?this.updateNodePositionsFromTransformMatrix(r,t):this.updateNodePositionsFromOrientationTangent(r,e.position,e.tangent),this.currentLength>=1&&(this.connectNodes(this.currentEnd,r),this.currentLength>=this.length)){const e=this.currentEnd+1>=this.length?0:this.currentEnd+1;this.disconnectNodes(e)}this.currentLength<this.length&&this.currentLength++,this.currentEnd++,this.currentEnd>=this.length&&(this.currentEnd=0),this.currentLength>=1&&(this.currentLength<this.length?this.geometry.setDrawRange(0,(this.currentLength-1)*this.FaceIndicesPerNode):this.geometry.setDrawRange(0,this.currentLength*this.FaceIndicesPerNode)),this.updateNodeID(this.currentEnd,this.currentNodeID),this.currentNodeID++},this.updateHead=function(){const t=new e.Matrix4;return function(){this.currentEnd<0||(this.targetObject.updateMatrixWorld(),t.copy(this.targetObject.matrixWorld),this.updateNodePositionsFromTransformMatrix(this.currentEnd,t))}}(),this.updateNodePositionsFromOrientationTangent=function(){const t=new e.Quaternion,r=new e.Vector3,i=[];for(let t=0;t<Trail.MaxHeadVertices;t++){const t=new e.Vector3;i.push(t)}return function(e,a,n){const s=this.geometry.getAttribute("position");this.updateNodeCenter(e,a),r.copy(a),r.sub(Trail.LocalHeadOrigin),t.setFromUnitVectors(Trail.LocalOrientationTangent,n);for(let e=0;e<this.localHeadGeometry.length;e++){const a=i[e];a.copy(this.localHeadGeometry[e]),a.applyQuaternion(t),a.add(r)}for(let t=0;t<this.localHeadGeometry.length;t++){const r=(this.VerticesPerNode*e+t)*Trail.PositionComponentCount,a=i[t];s.array[r]=a.x,s.array[r+1]=a.y,s.array[r+2]=a.z}s.needsUpdate=!0}}(),this.updateNodePositionsFromTransformMatrix=function(){const t=new e.Matrix3,r=new e.Quaternion,i=new e.Vector3,a=new e.Vector3,n=new e.Vector3,s=new e.Vector3,o=[];for(let t=0;t<Trail.MaxHeadVertices;t++){const t=new e.Vector3;o.push(t)}return function(h,c){const l=this.geometry.getAttribute("position");i.set(0,0,0),i.applyMatrix4(c),this.updateNodeCenter(h,i);for(let e=0;e<this.localHeadGeometry.length;e++){o[e].copy(this.localHeadGeometry[e])}for(let e=0;e<this.localHeadGeometry.length;e++){o[e].applyMatrix4(c)}if(this.lastNodeCenter&&this.orientToMovement&&(function(e,t){const r=t.elements;e.set(r[0],r[1],r[2],r[4],r[5],r[6],r[8],r[9],r[10])}(t,c),n.set(0,0,-1),n.applyMatrix3(t),s.copy(this.currentNodeCenter),s.sub(this.lastNodeCenter),s.normalize(),s.lengthSq()<=1e-4&&this.lastOrientationDir&&s.copy(this.lastOrientationDir),s.lengthSq()>1e-4)){this.lastOrientationDir||(this.lastOrientationDir=new e.Vector3),r.setFromUnitVectors(n,s),a.copy(this.currentNodeCenter);for(let e=0;e<this.localHeadGeometry.length;e++){const t=o[e];t.sub(a),t.applyQuaternion(r),t.add(a)}}for(let e=0;e<this.localHeadGeometry.length;e++){const t=(this.VerticesPerNode*h+e)*Trail.PositionComponentCount,r=o[e];l.array[t]=r.x,l.array[t+1]=r.y,l.array[t+2]=r.z}l.needsUpdate=!0,l.updateRange.offset=h*this.VerticesPerNode*Trail.PositionComponentCount,l.updateRange.count=this.VerticesPerNode*Trail.PositionComponentCount}}(),this.connectNodes=function(){const e={attribute:null,offset:0,count:-1};return function(t,r){const i=this.geometry.getIndex();for(let e=0;e<this.localHeadGeometry.length-1;e++){const a=this.VerticesPerNode*t+e,n=this.VerticesPerNode*r+e,s=(t*this.FacesPerNode+e*Trail.FacesPerQuad)*Trail.IndicesPerFace;i.array[s]=a,i.array[s+1]=n,i.array[s+2]=a+1,i.array[s+3]=n,i.array[s+4]=n+1,i.array[s+5]=a+1}return i.needsUpdate=!0,i.updateRange.count=-1,e.attribute=i,e.offset=t*this.FacesPerNode*Trail.IndicesPerFace,e.count=this.FacesPerNode*Trail.IndicesPerFace,e}}(),this.disconnectNodes=function(){const e={attribute:null,offset:0,count:-1};return function(t){const r=this.geometry.getIndex();for(let e=0;e<this.localHeadGeometry.length-1;e++){const i=(t*this.FacesPerNode+e*Trail.FacesPerQuad)*Trail.IndicesPerFace;r.array[i]=0,r.array[i+1]=0,r.array[i+2]=0,r.array[i+3]=0,r.array[i+4]=0,r.array[i+5]=0}return r.needsUpdate=!0,r.updateRange.count=-1,e.attribute=r,e.offset=t*this.FacesPerNode*Trail.IndicesPerFace,e.count=this.FacesPerNode*Trail.IndicesPerFace,e}}(),this.active=!1,this.orientToMovement=!1,r&&(this.orientToMovement=!0),this.scene=t,this.geometry=null,this.mesh=null,this.nodeCenters=[],this.lastNodeCenter=null,this.currentNodeCenter=null,this.lastOrientationDir=null,this.nodeIDs=[],this.currentLength=0,this.currentEnd=0,this.currentNodeID=0,this.advanceFrequency=60,this.advancePeriod=1/this.advanceFrequency,this.lastAdvanceTime=0,this.paused=!1,this.pauseAdvanceUpdateTimeDiff=0}setAdvanceFrequency(e){this.advanceFrequency=e,this.advancePeriod=1/this.advanceFrequency}initialize(t,r,i,a,n,s){this.deactivate(),this.destroyMesh(),this.length=r>0?r+1:0,this.dragTexture=i?1:0,this.targetObject=s,this.initializeLocalHeadGeometry(a,n),this.nodeIDs=[],this.nodeCenters=[];for(let t=0;t<this.length;t++)this.nodeIDs[t]=-1,this.nodeCenters[t]=new e.Vector3;this.material=t,this.initializeGeometry(),this.initializeMesh(),this.material.uniforms.trailLength.value=0,this.material.uniforms.minID.value=0,this.material.uniforms.maxID.value=0,this.material.uniforms.dragTexture.value=this.dragTexture,this.material.uniforms.maxTrailLength.value=this.length,this.material.uniforms.verticesPerNode.value=this.VerticesPerNode,this.material.uniforms.textureTileFactor.value=new e.Vector2(1,1),this.material.uniforms.scale.value=1,this.reset()}initializeLocalHeadGeometry(t,r){if(this.localHeadGeometry=[],r){this.VerticesPerNode=0;for(let t=0;t<r.length&&t<Trail.MaxHeadVertices;t++){const i=r[t];if(i&&i instanceof e.Vector3){const t=new e.Vector3;t.copy(i),this.localHeadGeometry.push(t),this.VerticesPerNode++}}}else{const r=(t||1)/2;this.localHeadGeometry.push(new e.Vector3(-r,0,0)),this.localHeadGeometry.push(new e.Vector3(r,0,0)),this.VerticesPerNode=2}this.FacesPerNode=2*(this.VerticesPerNode-1),this.FaceIndicesPerNode=3*this.FacesPerNode}initializeGeometry(){this.vertexCount=this.length*this.VerticesPerNode,this.faceCount=this.length*this.FacesPerNode;const t=new e.BufferGeometry,r=new Float32Array(this.vertexCount),i=new Float32Array(this.vertexCount*this.VerticesPerNode),a=new Float32Array(this.vertexCount*Trail.PositionComponentCount),n=new Float32Array(this.vertexCount*Trail.PositionComponentCount),s=new Float32Array(this.vertexCount*Trail.UVComponentCount),o=new Uint32Array(this.faceCount*Trail.IndicesPerFace),h=new e.BufferAttribute(r,1);h.setUsage(e.DynamicDrawUsage),t.setAttribute("nodeID",h);const c=new e.BufferAttribute(i,1);c.setUsage(e.DynamicDrawUsage),t.setAttribute("nodeVertexID",c);const l=new e.BufferAttribute(n,Trail.PositionComponentCount);l.setUsage(e.DynamicDrawUsage),t.setAttribute("nodeCenter",l);const d=new e.BufferAttribute(a,Trail.PositionComponentCount);d.setUsage(e.DynamicDrawUsage),t.setAttribute("position",d);const u=new e.BufferAttribute(s,Trail.UVComponentCount);u.setUsage(e.DynamicDrawUsage),t.setAttribute("uv",u);const m=new e.BufferAttribute(o,1);m.setUsage(e.DynamicDrawUsage),t.setIndex(m),this.geometry=t}zeroVertices(){const e=this.geometry.getAttribute("position");for(let t=0;t<this.vertexCount;t++){const r=3*t;e.array[r]=0,e.array[r+1]=0,e.array[r+2]=0}e.needsUpdate=!0}zeroIndices(){if(null==this.geometry)throw"Geometry not initialized";const e=this.geometry.getIndex();for(let t=0;t<this.faceCount;t++){const r=3*t;e.array[r]=0,e.array[r+1]=0,e.array[r+2]=0}e.needsUpdate=!0,e.addUpdateRange(0,-1)}formInitialFaces(){this.zeroIndices();const e=this.geometry.getIndex();for(let e=0;e<this.length-1;e++)this.connectNodes(e,e+1);e.needsUpdate=!0,e.addUpdateRange(0,-1)}initializeMesh(){if(null==this.geometry)throw"Geometry not initialized";this.mesh=new e.Mesh(this.geometry,this.material),this.mesh.matrixAutoUpdate=!1}destroyMesh(){this.mesh&&(this.scene.remove(this.mesh),this.mesh=null)}reset(){this.currentLength=0,this.currentEnd=-1,this.lastNodeCenter=null,this.currentNodeCenter=null,this.lastOrientationDir=null,this.currentNodeID=0,this.formInitialFaces(),this.zeroVertices(),this.geometry.setDrawRange(0,0)}updateUniforms(){this.currentLength<this.length?this.material.uniforms.minID.value=0:this.material.uniforms.minID.value=this.currentNodeID-this.length,this.material.uniforms.maxID.value=this.currentNodeID,this.material.uniforms.trailLength.value=this.currentLength,this.material.uniforms.maxTrailLength.value=this.length,this.material.uniforms.verticesPerNode.value=this.VerticesPerNode}advanceWithPositionAndOrientation(e,t){this.advanceGeometry({position:e,tangent:t},null)}advanceWithTransform(e){this.advanceGeometry(null,e)}currentTime(){return performance.now()/1e3}pause(){this.paused||(this.paused=!0,this.pauseAdvanceUpdateTimeDiff=this.currentTime()-this.lastAdvanceTime)}resume(){this.paused&&(this.paused=!1,this.lastAdvanceTime=this.currentTime()-this.pauseAdvanceUpdateTimeDiff)}update(){if(!this.paused){const e=this.currentTime();this.lastAdvanceTime||(this.lastAdvanceTime=e),e-this.lastAdvanceTime>this.advancePeriod?(this.advance(),this.lastAdvanceTime=e):this.updateHead()}}updateNodeID(e,t){this.nodeIDs[e]=t;const r=this.geometry.getAttribute("nodeID"),i=this.geometry.getAttribute("nodeVertexID");for(let a=0;a<this.VerticesPerNode;a++){const n=e*this.VerticesPerNode+a;r.array[n]=t,i.array[n]=a}r.needsUpdate=!0,i.needsUpdate=!0,r.updateRange.offset=e*this.VerticesPerNode,r.updateRange.count=this.VerticesPerNode,i.updateRange.offset=e*this.VerticesPerNode,i.updateRange.count=this.VerticesPerNode}updateNodeCenter(e,t){this.lastNodeCenter=this.currentNodeCenter,this.currentNodeCenter=this.nodeCenters[e],this.currentNodeCenter.copy(t);const r=this.geometry.getAttribute("nodeCenter");for(let i=0;i<this.VerticesPerNode;i++){const a=3*(e*this.VerticesPerNode+i);r.array[a]=t.x,r.array[a+1]=t.y,r.array[a+2]=t.z}r.needsUpdate=!0,r.updateRange.offset=e*this.VerticesPerNode*Trail.PositionComponentCount,r.updateRange.count=this.VerticesPerNode*Trail.PositionComponentCount}deactivate(){this.active&&(this.scene.remove(this.mesh),this.active=!1)}activate(){this.active||(this.scene.add(this.mesh),this.active=!0)}static createMaterial(t,r,i){return(i=i||{}).trailLength={type:"f",value:null},i.verticesPerNode={type:"f",value:null},i.minID={type:"f",value:null},i.maxID={type:"f",value:null},i.dragTexture={type:"f",value:null},i.maxTrailLength={type:"f",value:null},i.textureTileFactor={type:"v2",value:null},i.headColor={type:"v4",value:new e.Vector4},i.tailColor={type:"v4",value:new e.Vector4},i.taper={type:"bool",value:!1},i.scale={type:"f",value:1},t=t||Trail.Shader.BaseVertexShader,r=r||Trail.Shader.BaseFragmentShader,new e.ShaderMaterial({uniforms:i,vertexShader:t,fragmentShader:r,transparent:!0,alphaTest:.5,blending:e.CustomBlending,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor,blendEquation:e.AddEquation,depthTest:!0,depthWrite:!1,side:e.DoubleSide})}static createBaseMaterial(e={}){return Trail.createMaterial(Trail.Shader.BaseVertexShader,Trail.Shader.BaseFragmentShader,e)}static createTexturedMaterial(e){return(e={}).trailTexture={type:"t",value:null},Trail.createMaterial(Trail.Shader.TexturedVertexShader,Trail.Shader.TexturedFragmentShader,e)}static get MaxHeadVertices(){return 128}static{this._LocalOrientationTangent=new e.Vector3(1,0,0)}static get LocalOrientationTangent(){return Trail._LocalOrientationTangent}static{this._LocalHeadOrigin=new e.Vector3(0,0,0)}static get LocalHeadOrigin(){return Trail._LocalHeadOrigin}static get PositionComponentCount(){return 3}static get UVComponentCount(){return 2}static get IndicesPerFace(){return 3}static get FacesPerQuad(){return 2}static{this.Shader={get BaseVertexVars(){return["attribute float nodeID;","attribute float nodeVertexID;","attribute vec3 nodeCenter;","uniform float minID;","uniform float maxID;","uniform float trailLength;","uniform float maxTrailLength;","uniform float verticesPerNode;","uniform vec2 textureTileFactor;","uniform bool taper;","uniform vec4 headColor;","uniform vec4 tailColor;","varying vec4 vColor;"].join("\n")},get TexturedVertexVars(){return[this.BaseVertexVars,"varying vec2 vUV;","uniform float dragTexture;"].join("\n")},BaseFragmentVars:["varying vec4 vColor;","uniform sampler2D trailTexture;"].join("\n"),get TexturedFragmentVars(){return[this.BaseFragmentVars,"varying vec2 vUV;"].join("\n")},get VertexShaderCore(){return["float fraction = (maxID - nodeID) / (maxID - minID);","float fractionSize = taper ? fraction : 0.0;","vColor = (1.0 - fraction) * headColor + fraction * tailColor;","vec4 realPosition = vec4((1.0 - fractionSize) * position.xyz + fractionSize * nodeCenter.xyz, 1.0); "].join("\n")},get BaseVertexShader(){return[this.BaseVertexVars,"void main() { ",this.VertexShaderCore,"gl_Position = projectionMatrix * viewMatrix * realPosition;","}"].join("\n")},get BaseFragmentShader(){return[this.BaseFragmentVars,"void main() { ","gl_FragColor = vColor;","}"].join("\n")},get TexturedVertexShader(){return[this.TexturedVertexVars,"void main() { ",this.VertexShaderCore,"float s = 0.0;","float t = 0.0;","if (dragTexture == 1.0) { "," s = fraction * textureTileFactor.s; "," t = (nodeVertexID / verticesPerNode) * textureTileFactor.t;","} else { "," s = nodeID / maxTrailLength * textureTileFactor.s;"," t = (nodeVertexID / verticesPerNode) * textureTileFactor.t;","}","vUV = vec2(s, t); ","gl_Position = projectionMatrix * viewMatrix * realPosition;","}"].join("\n")},get TexturedFragmentShader(){return[this.TexturedFragmentVars,"void main() { ","vec4 textureColor = texture2D(trailTexture, vUV);","gl_FragColor = vColor * textureColor;","}"].join("\n")}}}}
2
+ /*
3
+ * Copyright (©) 2023. All rights reserved.
4
+ * See the LICENSE.md file for details.
5
+ */
@@ -1,5 +1,5 @@
1
1
  import { BaseActor } from '../../gameplay/index.js';
2
- import { VfxAsset } from '../../scene/model.js';
2
+ import { Asset } from '../../scene/model.js';
3
3
  export declare class VfxActor extends BaseActor {
4
4
  /**
5
5
  * A multiplier for the speed of the visual effect.
@@ -11,10 +11,12 @@ export declare class VfxActor extends BaseActor {
11
11
  private sourceAsset;
12
12
  private assetLoader;
13
13
  private world;
14
+ private view;
15
+ private particleSystemContainer;
14
16
  /**
15
17
  * Replace visual effect with its definition in an asset
16
18
  */
17
- fromAsset(asset: VfxAsset): Promise<void>;
19
+ fromAsset(asset: Asset): Promise<void>;
18
20
  play(): void;
19
21
  pause(): void;
20
22
  stop(): void;
@@ -22,6 +24,17 @@ export declare class VfxActor extends BaseActor {
22
24
  private _worldPos;
23
25
  private max;
24
26
  onUpdate(deltaTime: number): void;
27
+ /**
28
+ *
29
+ * use cases
30
+ *
31
+ * World space relative
32
+ * The container in scene which is static
33
+ *
34
+ * Local space relative
35
+ * The container is a child of the actor so still objects move along with the actor
36
+ *
37
+ */
25
38
  getParticleCount(): any;
26
39
  onEndPlay(): void;
27
40
  }
@@ -1,4 +1,4 @@
1
- import{__decorate as s}from"tslib";import{Actor as t,BaseActor as e,AssetLoader as i,inject as o,World as r}from"../../gameplay/index.js";import{Rate as a}from"three-nebula";import{materializeVfx as h}from"./vfx-materializer.js";import*as m from"three";import{DelayRate as d}from"./rates.js";let n=class extends e{constructor(){super(...arguments),this.timescale=1,this.paused=!1,this.assetLoader=o(i),this.world=o(r),this._worldPos=new m.Vector3,this.max=0}async fromAsset(s){null!=this.system&&(this.system.destroy(),this.system.emitters.forEach((s=>s.reset()))),this.sourceAsset=s,this.disposeSystem&&this.disposeSystem();const{system:t,dispose:e}=await h(s,this.world.scene,{getAsset:s=>this.assetLoader.getAsset(s),getMaterial:s=>this.assetLoader.getMaterialByAssetId(s),getTexture:s=>this.assetLoader.getTextureByAssetId(s),getMesh:s=>this.assetLoader.getModelByAssetId(s).then((s=>s.scene))});this.system=t,this.disposeSystem=e}play(){this.paused=!1;this.system.emitters.every((s=>s.dead))&&this.restart()}pause(){this.paused=!0}stop(){this.system.emitters.forEach((s=>{const t=s.rate;t instanceof a&&(console.log("set rate to infinity",t),t.nextTime=1/0)}))}restart(){for(const s of this.system.emitters){const t=s.rate;t instanceof d?t.restart():t.nextTime=0,s.removeAllParticles()}}onUpdate(s){this.paused||(this.object.getWorldPosition(this._worldPos),this.system?.emitters.forEach((s=>{s.setPosition(this._worldPos)})),this.system?.update(s*this.timescale))}getParticleCount(){return this.system?.getCount()??0}onEndPlay(){this.stop(),null!=this.disposeSystem&&this.disposeSystem()}};n=s([t()],n);export{n as VfxActor};
1
+ import{__decorate as s}from"tslib";import{Actor as t,BaseActor as e,AssetLoader as i,inject as o,ViewController as r,World as a}from"../../gameplay/index.js";import{Rate as h}from"three-nebula";import{materializeVfx as m}from"./vfx-materializer.js";import*as d from"three";import{DelayRate as n}from"./rates.js";let l=class extends e{constructor(){super(...arguments),this.timescale=1,this.paused=!1,this.assetLoader=o(i),this.world=o(a),this.view=o(r),this._worldPos=new d.Vector3,this.max=0}async fromAsset(s){if("vfx"!==s.type)throw"Asset must be a VFX asset but is "+s.type;null!=this.system&&(this.system.destroy(),this.system.emitters.forEach((s=>s.reset()))),this.sourceAsset=s,this.disposeSystem&&this.disposeSystem(),this.world.scene.add(this.object);const{system:t,dispose:e,container:i}=await m(this.sourceAsset,this.object,{getAsset:s=>this.assetLoader.getAsset(s),getMaterial:s=>this.assetLoader.getMaterialByAssetId(s),getTexture:s=>this.assetLoader.getTextureByAssetId(s),getMesh:s=>this.assetLoader.getModelByAssetId(s).then((s=>s.scene))},this.view);this.system=t,this.disposeSystem=e,this.particleSystemContainer=i}play(){this.paused=!1;this.system.emitters.every((s=>s.dead))&&this.restart()}pause(){this.paused=!0}stop(){this.system.emitters.forEach((s=>{const t=s.rate;t instanceof h&&(console.log("set rate to infinity",t),t.nextTime=1/0)}))}restart(){for(const s of this.system.emitters){const t=s.rate;t instanceof n?t.restart():t.nextTime=0,s.removeAllParticles()}}onUpdate(s){this.paused||(this.object.getWorldPosition(this._worldPos),this.system?.emitters.forEach((s=>{"world"===s._space&&s.setPosition(this._worldPos)})),this.system?.update(s*this.timescale))}getParticleCount(){return this.system?.getCount()??0}onEndPlay(){this.stop(),null!=this.disposeSystem&&this.disposeSystem()}};l=s([t()],l);export{l as VfxActor};
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
@@ -32,23 +32,46 @@ export declare const ThreeBlendingMode: {
32
32
  subtractive: 3;
33
33
  multiply: 4;
34
34
  };
35
+ export type CommonOutput = {
36
+ space: 'world' | 'local';
37
+ };
35
38
  export type SpriteOutput = {
36
39
  type: 'sprite';
37
40
  texture: string;
38
41
  color: string;
39
42
  blendingMode: BlendingMode;
40
- };
43
+ softness: number;
44
+ } & CommonOutput;
45
+ export type StretchedSpriteOutput = {
46
+ type: 'stretchedSprite';
47
+ texture: string;
48
+ color: string;
49
+ blendingMode: BlendingMode;
50
+ scale: number;
51
+ softness: number;
52
+ } & CommonOutput;
41
53
  export type MeshOutput = {
42
54
  type: 'mesh';
43
55
  assetId: AssetId;
44
- };
56
+ } & CommonOutput;
57
+ export type TrailOutput = {
58
+ type: 'trail';
59
+ length: number;
60
+ taper: boolean;
61
+ color: string;
62
+ colorEnd: string;
63
+ texture: string;
64
+ opacityStart: number;
65
+ opacityEnd: number;
66
+ bloom: boolean;
67
+ } & CommonOutput;
45
68
  export type ShapeOutput = {
46
69
  type: 'shape';
47
70
  shape: LibraryShapeType;
48
71
  params: Record<string, CustomParamValue>;
49
72
  material: AssetId;
50
- };
51
- export type EmitterOutput = SpriteOutput | MeshOutput | ShapeOutput;
73
+ } & CommonOutput;
74
+ export type EmitterOutput = SpriteOutput | MeshOutput | ShapeOutput | StretchedSpriteOutput | TrailOutput;
52
75
  export type EmitterData = {
53
76
  id: string;
54
77
  name: string;
@@ -97,5 +120,7 @@ export declare function EmitterDataConstructor(): {
97
120
  texture: any;
98
121
  color: string;
99
122
  blendingMode: "normal";
123
+ space: "world";
124
+ softness: number;
100
125
  };
101
126
  };
@@ -1,4 +1,4 @@
1
- import{SerializedParamType as t}from"../../scene/model.js";import*as e from"three";import{randomString as i}from"../../utils/math.js";export const BlendingModes=["additive","subtractive","multiply","normal"];export const ThreeBlendingMode={normal:e.NormalBlending,additive:e.AdditiveBlending,subtractive:e.SubtractiveBlending,multiply:e.MultiplyBlending};export function EmitterDataConstructor(){return{id:i(),name:"Emitter",rate:{type:"continuous",count:1,time:.5,delay:0},position:[0,0,0],rotation:[0,0,0],initializers:[{id:i(),type:"lifetime",params:{duration:{type:t.Number,value:1}}}],behaviours:[],children:[],output:{type:"sprite",texture:null,color:"#ffffff",blendingMode:"normal"}}}
1
+ import{SerializedParamType as t}from"../../scene/model.js";import*as e from"three";import{randomString as i}from"../../utils/math.js";export const BlendingModes=["additive","subtractive","multiply","normal"];export const ThreeBlendingMode={normal:e.NormalBlending,additive:e.AdditiveBlending,subtractive:e.SubtractiveBlending,multiply:e.MultiplyBlending};export function EmitterDataConstructor(){return{id:i(),name:"Emitter",rate:{type:"continuous",count:1,time:.5,delay:0},position:[0,0,0],rotation:[0,0,0],initializers:[{id:i(),type:"lifetime",params:{duration:{type:t.Number,value:1}}}],behaviours:[],children:[],output:{type:"sprite",texture:null,color:"#ffffff",blendingMode:"normal",space:"world",softness:0}}}
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
@@ -44,7 +44,7 @@ type ParamsType<T extends DefBuilder> = Partial<{
44
44
  }>;
45
45
  declare class LifetimeDef extends BaseIniDef<LifetimeDef> {
46
46
  parameters: {
47
- duration: ShapeParameterDef<number>;
47
+ duration: FloatParameterDef;
48
48
  };
49
49
  make(params?: ParamsType<this>): Initializer;
50
50
  }
@@ -81,6 +81,14 @@ declare class PositionLineDef extends BaseIniDef<PositionLineDef> {
81
81
  };
82
82
  make(params?: ParamsType<this>): Initializer;
83
83
  }
84
+ declare class RadialVelocityDef extends BaseIniDef<RadialVelocityDef> {
85
+ parameters: {
86
+ speed: FloatParameterDef;
87
+ direction: ShapeParameterDef<Vector3>;
88
+ spread: FloatParameterDef;
89
+ };
90
+ make(params?: ParamsType<this>): Initializer;
91
+ }
84
92
  declare class RandomDirectionDef extends BaseIniDef<RandomDirectionDef> {
85
93
  parameters: {
86
94
  speed: FloatParameterDef;
@@ -109,6 +117,13 @@ declare class InitialScaleDef extends BaseIniDef<InitialScaleDef> {
109
117
  };
110
118
  make(params?: ParamsType<this>): Initializer;
111
119
  }
120
+ declare class RandomScaleDef extends BaseIniDef<RandomScaleDef> {
121
+ parameters: {
122
+ min: FloatParameterDef;
123
+ max: FloatParameterDef;
124
+ };
125
+ make(params?: ParamsType<this>): Initializer;
126
+ }
112
127
  declare class InitialScaleComponentsDef extends BaseIniDef<InitialScaleComponentsDef> {
113
128
  parameters: {
114
129
  scale: ShapeParameterDef<Vector3>;
@@ -125,6 +140,7 @@ declare class ForceDef extends BaseBevDef<ForceDef> {
125
140
  declare class GravityDef extends BaseBevDef<GravityDef> {
126
141
  parameters: {
127
142
  gravity: FloatParameterDef;
143
+ easing: SelectParameterDef<string>;
128
144
  };
129
145
  make(params?: ParamsType<this>): Behaviour;
130
146
  }
@@ -144,14 +160,6 @@ declare class RandomDriftDef extends BaseBevDef<RandomDriftDef> {
144
160
  };
145
161
  make(params?: ParamsType<this>): Behaviour;
146
162
  }
147
- declare class DisperseDef extends BaseBevDef<DisperseDef> {
148
- parameters: {
149
- distance: FloatParameterDef;
150
- axis: SelectParameterDef<string>;
151
- ease: SelectParameterDef<string>;
152
- };
153
- make(params?: ParamsType<this>): Behaviour;
154
- }
155
163
  declare class RotateDef extends BaseBevDef<RotateDef> {
156
164
  parameters: {
157
165
  rotation: ShapeParameterDef<Vector3>;
@@ -159,8 +167,10 @@ declare class RotateDef extends BaseBevDef<RotateDef> {
159
167
  };
160
168
  make(params?: ParamsType<this>): Behaviour;
161
169
  }
162
- declare class OrientAlongVelocityDef extends BaseBevDef<OrientAlongVelocityDef> {
163
- parameters: {};
170
+ declare class FollowParentDef extends BaseBevDef<FollowParentDef> {
171
+ parameters: {
172
+ speed: FloatParameterDef;
173
+ };
164
174
  make(params?: ParamsType<this>): Behaviour;
165
175
  }
166
176
  declare class ChangeColorDef extends BaseBevDef<ChangeColorDef> {
@@ -186,6 +196,24 @@ declare class VortexDef extends BaseBevDef<VortexDef> {
186
196
  };
187
197
  make(params?: ParamsType<this>): Behaviour;
188
198
  }
199
+ declare class RepulsionDef extends BaseBevDef<RepulsionDef> {
200
+ parameters: {
201
+ target: ShapeParameterDef<Vector3>;
202
+ force: FloatParameterDef;
203
+ radius: FloatParameterDef;
204
+ easing: SelectParameterDef<string>;
205
+ };
206
+ make(params?: ParamsType<this>): Behaviour;
207
+ }
208
+ declare class AttractionDef extends BaseBevDef<AttractionDef> {
209
+ parameters: {
210
+ target: ShapeParameterDef<Vector3>;
211
+ force: FloatParameterDef;
212
+ radius: FloatParameterDef;
213
+ easing: SelectParameterDef<string>;
214
+ };
215
+ make(params?: ParamsType<this>): Behaviour;
216
+ }
189
217
  declare class MoveToDef extends BaseBevDef<MoveToDef> {
190
218
  parameters: {
191
219
  target: ShapeParameterDef<Vector3>;
@@ -209,28 +237,31 @@ declare const vfxInitializsers: {
209
237
  randomRotation: RandomRotationDef;
210
238
  scale: InitialScaleDef;
211
239
  scaleComponents: InitialScaleComponentsDef;
240
+ randomScale: RandomScaleDef;
212
241
  mass: MassDef;
213
242
  velocity: VelocityDef;
243
+ radialVelocity: RadialVelocityDef;
214
244
  randomDirection: RandomDirectionDef;
215
245
  };
216
246
  declare const vfxBehaviours: {
217
247
  force: ForceDef;
218
248
  gravity: GravityDef;
249
+ repulsion: RepulsionDef;
250
+ attraction: AttractionDef;
219
251
  scale: ScaleDef;
220
252
  randomDrift: RandomDriftDef;
221
- disperse: DisperseDef;
222
253
  rotate: RotateDef;
223
- orientAlongVelocity: OrientAlongVelocityDef;
224
254
  changeColor: ChangeColorDef;
225
255
  changeOpacity: ChangeOpacityDef;
226
256
  vortex: VortexDef;
227
257
  moveTo: MoveToDef;
228
258
  linearDamping: LinearDampingDef;
259
+ followParent: FollowParentDef;
229
260
  };
230
261
  export type LibraryVfxInitalizerType = keyof typeof vfxInitializsers;
231
262
  export declare const VfxInitializserLibrary: Record<LibraryVfxInitalizerType, InitializerDefinition>;
232
- export declare const VfxInitializserLibraryKeys: ("rotation" | "mass" | "scale" | "velocity" | "lifetime" | "positionPoint" | "positionBox" | "positionSphere" | "positionLine" | "randomRotation" | "scaleComponents" | "randomDirection")[];
263
+ export declare const VfxInitializserLibraryKeys: ("rotation" | "mass" | "scale" | "velocity" | "lifetime" | "positionPoint" | "positionBox" | "positionSphere" | "positionLine" | "randomRotation" | "scaleComponents" | "randomScale" | "radialVelocity" | "randomDirection")[];
233
264
  export type LibraryVfxBehaviourType = keyof typeof vfxBehaviours;
234
265
  export declare const VfxBehaviourLibrary: Record<LibraryVfxBehaviourType, BehaviourDefinition>;
235
- export declare const VfxBehaviourLibraryKeys: ("scale" | "orientAlongVelocity" | "force" | "gravity" | "randomDrift" | "disperse" | "rotate" | "changeColor" | "changeOpacity" | "vortex" | "moveTo" | "linearDamping")[];
266
+ export declare const VfxBehaviourLibraryKeys: ("scale" | "force" | "gravity" | "repulsion" | "attraction" | "randomDrift" | "rotate" | "changeColor" | "changeOpacity" | "vortex" | "moveTo" | "linearDamping" | "followParent")[];
236
267
  export {};
@@ -1,4 +1,4 @@
1
- import{Color as e,MathUtils as r,Vector2 as t,Vector3 as s}from"three";import{Life as n,Force as a,Gravity as o,Scale as i,RandomDrift as c,Color as u,Alpha as p,Rotate as m,Mass as l,ease as d,Position as w,BoxZone as f,LineZone as x}from"three-nebula";import{AxisDirection as y,AxisPlane as h,Disperse as k,LinearDamping as b,MoveOverLife as v,OrientAlongVelocity as z,RotatePosition as g}from"./behaviours.js";import{AdditiveVelocity as L,InitialScale as j,InitialScaleComponents as V,RandomDirection as O,RandomRotation as B,Rotation as C}from"./initializsers.js";import{SphereZone as R,PointZone as T}from"./zones.js";Object.getPrototypeOf(n);class X{build(e={}){const r=P(e,this.parameters);return this.make(r)}}class Y{build(e={}){const r=P(e,this.parameters);return this.make(r)}}function Z(e,r,t){return{type:"number",default:e,float:!0,min:r,max:t}}function A(e){return{type:"vec3",default:(new s).fromArray(e)}}function D(e){return{type:"color",default:e}}function I(e,r){return{type:"select",opts:e,default:r}}function K(){return I(Array.from(Object.keys(d)).map((e=>e.substring(4))),"Linear")}function P(e,r){const t={};for(let s in r)null==e[s]?t[s]=r[s].default:t[s]=e[s];return t}function S(e){return null!=e?d["ease"+e]:d.easeLinear}const q={lifetime:new class extends Y{constructor(){var e;super(...arguments),this.parameters={duration:(e=1,{type:"number",default:e})}}make(e={}){return new n(e.duration)}},positionPoint:new class extends Y{constructor(){super(...arguments),this.parameters={position:A([0,0,0])}}make(e={}){const{x:r,y:t,z:s}=e.position;return new w(new T(r,t,s))}},positionBox:new class extends Y{constructor(){super(...arguments),this.parameters={position:A([0,0,0]),dimensions:A([0,0,0])}}make(e={}){const{x:r,y:t,z:s}=e.position,{x:n,y:a,z:o}=e.dimensions;return new w(new f(r,t,s,n,a,o))}},positionSphere:new class extends Y{constructor(){super(...arguments),this.parameters={position:A([0,0,0]),radius:Z(1)}}make(e={}){const{x:r,y:t,z:s}=e.position;return new w(new R(r,t,s,e.radius))}},positionLine:new class extends Y{constructor(){super(...arguments),this.parameters={a:A([0,0,0]),b:A([0,0,1])}}make(e={}){const{x:r,y:t,z:s}=e.a,{x:n,y:a,z:o}=e.b;return new w(new x(r,t,s,n,a,o))}},rotation:new class extends Y{constructor(){super(...arguments),this.parameters={rotation:A([0,0,0])}}make(e={}){const{x:r,y:t,z:n}=e.rotation;return new C(new s(r,t,n))}},randomRotation:new class extends Y{constructor(){super(...arguments),this.parameters={}}make(e={}){return new B}},scale:new class extends Y{constructor(){super(...arguments),this.parameters={scale:Z(1)}}make(e={}){return new j(e.scale)}},scaleComponents:new class extends Y{constructor(){super(...arguments),this.parameters={scale:A([1,1,1])}}make(e={}){return new V(e.scale)}},mass:new class extends Y{constructor(){super(...arguments),this.parameters={min:Z(1)}}make(e={}){return new l(e.min)}},velocity:new class extends Y{constructor(){super(...arguments),this.parameters={velocity:A([0,0,0])}}make(e={}){const{x:r,y:t,z:n}=e.velocity;return new L(new s(r,t,n))}},randomDirection:new class extends Y{constructor(){super(...arguments),this.parameters={speed:Z(1)}}make(e={}){return new O(e.speed)}}},E={force:new class extends X{constructor(){super(...arguments),this.parameters={force:A([0,0,0]),ease:K()}}make(e={}){return new a(e.force.x,e.force.y,e.force.z,void 0,S(e.ease))}},gravity:new class extends X{constructor(){super(...arguments),this.parameters={gravity:Z(8)}}make(e={}){return new o(e.gravity)}},scale:new class extends X{constructor(){super(...arguments),this.parameters={a:Z(1),b:Z(1),ease:K()}}make(e={}){return new i(e.a,e.b,void 0,S(e.ease))}},randomDrift:new class extends X{constructor(){super(...arguments),this.parameters={drift:A([1,1,1]),delay:Z(0),ease:K()}}make(e={}){return new c(e.drift.x,e.drift.y,e.drift.z,e.delay,void 0,S(e.ease))}},disperse:new class extends X{constructor(){super(...arguments),this.parameters={distance:Z(1),axis:I(["XYZ","XZ","XY","YZ"],"XYZ"),ease:K()}}make(e={}){return new k(e.distance,h[e.axis.toLowerCase()],S(e.ease))}},rotate:new class extends X{constructor(){super(...arguments),this.parameters={rotation:A([0,0,0]),ease:K()}}make(e={}){const{x:t,y:s,z:n}=e.rotation;return new m(r.degToRad(t),r.degToRad(s),r.degToRad(n),void 0,S(e.ease))}},orientAlongVelocity:new class extends X{constructor(){super(...arguments),this.parameters={}}make(e={}){return new z(y.z)}},changeColor:new class extends X{constructor(){super(...arguments),this.parameters={a:D("#ffffff"),b:D("#ffffff"),ease:K()}}make(r={}){return new u(new e(r.a),new e(r.b),void 0,S(r.ease))}},changeOpacity:new class extends X{constructor(){super(...arguments),this.parameters={a:Z(1,0,1),b:Z(0,0,1),ease:K()}}make(e={}){return new p(e.a,e.b,void 0,S(e.ease))}},vortex:new class extends X{constructor(){super(...arguments),this.parameters={axis:A([0,1,0]),amount:Z(1)}}make(e={}){return new g(e.axis,e.amount)}},moveTo:new class extends X{constructor(){super(...arguments),this.parameters={target:A([0,1,0]),ease:K()}}make(e={}){return new v(e.target.x,e.target.y,e.target.z,S(e.ease))}},linearDamping:new class extends X{constructor(){super(...arguments),this.parameters={factor:Z(.1,0,1)}}make(e={}){return new b(e.factor)}}};export const VfxInitializserLibrary=q;export const VfxInitializserLibraryKeys=Object.keys(VfxInitializserLibrary);export const VfxBehaviourLibrary=E;export const VfxBehaviourLibraryKeys=Object.keys(VfxBehaviourLibrary);
1
+ import{Color as e,MathUtils as r,Vector2 as t,Vector3 as s}from"three";import{Alpha as n,Attraction as a,BoxZone as o,Color as i,ease as c,Force as u,Gravity as p,Life as m,LineZone as d,Mass as l,Position as w,RadialVelocity as x,RandomDrift as f,Repulsion as y,Rotate as h,Vector3D as k}from"three-nebula";import{AxisDirection as g,AxisPlane as b,Disperse as v,FollowParent as z,LinearDamping as L,MoveOverLife as j,OrientAlongVelocity as V,RotatePosition as O,Scale as B}from"./behaviours.js";import{AdditiveVelocity as R,InitialScale as T,InitialScaleComponents as C,RandomDirection as D,RandomRotation as I,RandomScale as P,Rotation as A}from"./initializsers.js";import{PointZone as K,SphereZone as S}from"./zones.js";Object.getPrototypeOf(m);class q{build(e={}){const r=N(e,this.parameters);return this.make(r)}}class E{build(e={}){const r=N(e,this.parameters);return this.make(r)}}function F(e,r,t){return{type:"number",default:e,float:!0,min:r,max:t}}function G(e){return{type:"vec3",default:(new s).fromArray(e)}}function H(e){return{type:"color",default:e}}function J(e,r){return{type:"select",opts:e,default:r}}function M(){return J(Array.from(Object.keys(c)).map((e=>e.substring(4))),"Linear")}function N(e,r){const t={};for(let s in r)null==e[s]?t[s]=r[s].default:t[s]=e[s];return t}function Q(e){return null!=e?c["ease"+e]:c.easeLinear}const U={lifetime:new class extends E{constructor(){super(...arguments),this.parameters={duration:F(1,0,1e5)}}make(e={}){return new m(e.duration)}},positionPoint:new class extends E{constructor(){super(...arguments),this.parameters={position:G([0,0,0])}}make(e={}){const{x:r,y:t,z:s}=e.position;return new w(new K(r,t,s))}},positionBox:new class extends E{constructor(){super(...arguments),this.parameters={position:G([0,0,0]),dimensions:G([0,0,0])}}make(e={}){const{x:r,y:t,z:s}=e.position,{x:n,y:a,z:i}=e.dimensions;return new w(new o(r,t,s,n,a,i))}},positionSphere:new class extends E{constructor(){super(...arguments),this.parameters={position:G([0,0,0]),radius:F(1)}}make(e={}){const{x:r,y:t,z:s}=e.position;return new w(new S(r,t,s,e.radius))}},positionLine:new class extends E{constructor(){super(...arguments),this.parameters={a:G([0,0,0]),b:G([0,0,1])}}make(e={}){const{x:r,y:t,z:s}=e.a,{x:n,y:a,z:o}=e.b;return new w(new d(r,t,s,n,a,o))}},rotation:new class extends E{constructor(){super(...arguments),this.parameters={rotation:G([0,0,0])}}make(e={}){const{x:r,y:t,z:n}=e.rotation;return new A(new s(r,t,n))}},randomRotation:new class extends E{constructor(){super(...arguments),this.parameters={}}make(e={}){return new I}},scale:new class extends E{constructor(){super(...arguments),this.parameters={scale:F(1)}}make(e={}){return new T(e.scale)}},scaleComponents:new class extends E{constructor(){super(...arguments),this.parameters={scale:G([1,1,1])}}make(e={}){return new C(e.scale)}},randomScale:new class extends E{constructor(){super(...arguments),this.parameters={min:F(1),max:F(1)}}make(e={}){return new P(e.min,e.max)}},mass:new class extends E{constructor(){super(...arguments),this.parameters={min:F(1)}}make(e={}){return new l(e.min)}},velocity:new class extends E{constructor(){super(...arguments),this.parameters={velocity:G([0,0,0])}}make(e={}){const{x:r,y:t,z:n}=e.velocity;return new R(new s(r,t,n))}},radialVelocity:new class extends E{constructor(){super(...arguments),this.parameters={speed:F(1),direction:G([0,1,0]),spread:F(0)}}make(e={}){return new x(e.speed,new k(e.direction.x,e.direction.y,e.direction.z),e.spread)}},randomDirection:new class extends E{constructor(){super(...arguments),this.parameters={speed:F(1)}}make(e={}){return new D(e.speed)}}},W={force:new class extends q{constructor(){super(...arguments),this.parameters={force:G([0,0,0]),ease:M()}}make(e={}){return new u(e.force.x,e.force.y,e.force.z,void 0,Q(e.ease))}},gravity:new class extends q{constructor(){super(...arguments),this.parameters={gravity:F(8),easing:M()}}make(e={}){return new p(e.gravity,void 0,Q(e.easing))}},repulsion:new class extends q{constructor(){super(...arguments),this.parameters={target:G([0,0,0]),force:F(1),radius:F(1),easing:M()}}make(e={}){const r=new k(e.target.x,e.target.y,e.target.z);return new y(r,e.force,e.radius,void 0,Q(e.easing))}},attraction:new class extends q{constructor(){super(...arguments),this.parameters={target:G([0,0,0]),force:F(1),radius:F(1),easing:M()}}make(e={}){const r=new k(e.target.x,e.target.y,e.target.z);return new a(r,e.force,e.radius,void 0,Q(e.easing))}},scale:new class extends q{constructor(){super(...arguments),this.parameters={a:F(1),b:F(1),ease:M()}}make(e={}){return new B(e.a,e.b,Q(e.ease))}},randomDrift:new class extends q{constructor(){super(...arguments),this.parameters={drift:G([1,1,1]),delay:F(0),ease:M()}}make(e={}){return new f(e.drift.x,e.drift.y,e.drift.z,e.delay,void 0,Q(e.ease))}},rotate:new class extends q{constructor(){super(...arguments),this.parameters={rotation:G([0,0,0]),ease:M()}}make(e={}){const{x:t,y:s,z:n}=e.rotation;return new h(r.degToRad(t),r.degToRad(s),r.degToRad(n),void 0,Q(e.ease))}},changeColor:new class extends q{constructor(){super(...arguments),this.parameters={a:H("#ffffff"),b:H("#ffffff"),ease:M()}}make(r={}){return new i(new e(r.a),new e(r.b),void 0,Q(r.ease))}},changeOpacity:new class extends q{constructor(){super(...arguments),this.parameters={a:F(1,0,1),b:F(0,0,1),ease:M()}}make(e={}){return new n(e.a,e.b,void 0,Q(e.ease))}},vortex:new class extends q{constructor(){super(...arguments),this.parameters={axis:G([0,1,0]),amount:F(1)}}make(e={}){return new O(e.axis,e.amount)}},moveTo:new class extends q{constructor(){super(...arguments),this.parameters={target:G([0,1,0]),ease:M()}}make(e={}){return new j(e.target.x,e.target.y,e.target.z,Q(e.ease))}},linearDamping:new class extends q{constructor(){super(...arguments),this.parameters={factor:F(.1,0,1)}}make(e={}){return new L(e.factor)}},followParent:new class extends q{constructor(){super(...arguments),this.parameters={speed:F(1)}}make(e={}){return new z(e.speed)}}};export const VfxInitializserLibrary=U;export const VfxInitializserLibraryKeys=Object.keys(VfxInitializserLibrary);export const VfxBehaviourLibrary=W;export const VfxBehaviourLibraryKeys=Object.keys(VfxBehaviourLibrary);
2
2
  /*
3
3
  * Copyright (©) 2023. All rights reserved.
4
4
  * See the LICENSE.md file for details.
@@ -1,20 +1,32 @@
1
- import { Asset, VfxAsset } from '../../scene/model.js';
2
- import { Object3D } from "three";
3
1
  import * as THREE from 'three';
4
- import System, { MeshRenderer, Rate } from "three-nebula";
2
+ import { Object3D } from "three";
3
+ import System from "three-nebula";
4
+ import { ViewController } from '../../gameplay/index.js';
5
+ import { Asset, VfxAsset } from '../../scene/model.js';
5
6
  export type VfxAssetProvider = {
6
7
  getAsset(assetId: string): Promise<Asset>;
7
8
  getTexture(assetId: string): Promise<THREE.Texture>;
8
9
  getMesh(assetId: string): Promise<THREE.Object3D>;
9
10
  getMaterial(assetId: string): Promise<THREE.Material>;
10
11
  };
11
- export declare function materializeVfx(asset: VfxAsset, target: Object3D, assetProvider: VfxAssetProvider): Promise<{
12
+ export declare function materializeVfx(asset: VfxAsset, target: Object3D, assetProvider: VfxAssetProvider, view: ViewController): Promise<{
13
+ container: THREE.Object3D<THREE.Object3DEventMap>;
12
14
  system: System;
13
15
  dispose: () => void;
14
16
  }>;
15
- export declare function materializeVfxOld(asset: VfxAsset, target: Object3D): {
16
- system: System;
17
- rate: Rate;
18
- renderer: MeshRenderer;
19
- dispose: () => Object3D<THREE.Object3DEventMap>;
20
- };
17
+ export declare class EmitterPool<T> {
18
+ private creator;
19
+ instances: T[];
20
+ constructor(creator: () => T);
21
+ /**
22
+ * Creates a new instance of a VFX actor or
23
+ * reuses a previously released one.
24
+ */
25
+ get(): T;
26
+ /**
27
+ * Release the VFX Actor to be reusable in future
28
+ * calls to the get function.
29
+ */
30
+ release(instance: T): void;
31
+ dispose(): void;
32
+ }