@hology/core 0.0.191 → 0.0.192
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/dist/effects/sequence/sequence-actor.d.ts +4 -0
- package/dist/effects/sequence/sequence-actor.js +1 -1
- package/dist/effects/sequence/sequence-data.d.ts +5 -0
- package/dist/effects/sequence/sequence-data.js +1 -1
- package/dist/effects/sequence/sequence-player.d.ts +3 -0
- package/dist/effects/sequence/sequence-player.js +1 -1
- package/dist/effects/vfx/behaviours.d.ts +7 -0
- package/dist/effects/vfx/behaviours.js +1 -1
- package/dist/effects/vfx/index.d.ts +2 -0
- package/dist/effects/vfx/index.js +1 -1
- package/dist/effects/vfx/initializsers.d.ts +6 -4
- package/dist/effects/vfx/initializsers.js +1 -1
- package/dist/effects/vfx/vfx-actor.d.ts +10 -1
- package/dist/effects/vfx/vfx-actor.js +1 -1
- package/dist/effects/vfx/vfx-asset.d.ts +12 -0
- package/dist/effects/vfx/vfx-asset.js +1 -1
- package/dist/effects/vfx/vfx-binding-runtime.d.ts +42 -0
- package/dist/effects/vfx/vfx-binding-runtime.js +4 -0
- package/dist/effects/vfx/vfx-defs.d.ts +58 -3
- package/dist/effects/vfx/vfx-defs.js +1 -1
- package/dist/effects/vfx/vfx-input-runtime.d.ts +17 -0
- package/dist/effects/vfx/vfx-input-runtime.js +4 -0
- package/dist/effects/vfx/vfx-materializer.d.ts +2 -1
- package/dist/effects/vfx/vfx-materializer.js +1 -1
- package/dist/effects/vfx/vfx-param.d.ts +3 -1
- package/dist/effects/vfx/vfx-param.js +1 -1
- package/dist/effects/vfx/vfx-service.d.ts +6 -2
- package/dist/effects/vfx/vfx-service.js +1 -1
- package/dist/gameplay/actors/builtin/components/character/character-animation.d.ts +3 -0
- package/dist/gameplay/actors/builtin/components/character/character-animation.js +1 -1
- package/dist/gameplay/actors/builtin/navmesh-actor.js +1 -1
- package/dist/gameplay/services/asset-loader.d.ts +3 -0
- package/dist/gameplay/services/asset-loader.js +1 -1
- package/dist/gameplay/services/physics/physics-system.js +1 -1
- package/dist/gameplay/services/render.d.ts +12 -0
- package/dist/gameplay/services/render.js +1 -1
- package/dist/rendering.d.ts +2 -0
- package/dist/rendering.js +1 -1
- package/dist/scene/asset-resource-loader.d.ts +1 -0
- package/dist/scene/asset-resource-loader.js +1 -1
- package/dist/scene/collision/collision-shape-import.js +1 -1
- package/dist/scene/collision/collision-shape.d.ts +5 -4
- package/dist/scene/collision/collision-shape.js +1 -1
- package/dist/scene/materializer.d.ts +4 -0
- package/dist/scene/materializer.js +1 -1
- package/dist/scene/model.d.ts +53 -2
- package/dist/scene/storage/storage.d.ts +6 -1
- package/dist/scene/storage/storage.js +1 -1
- package/dist/shader/builtin/decal-standard-shader.d.ts +1 -1
- package/dist/shader/builtin/lambert-shader.js +1 -1
- package/dist/shader/builtin/standard-shader.d.ts +8 -6
- package/dist/shader/builtin/standard-shader.js +1 -1
- package/dist/shader/builtin/toon-shader.js +1 -1
- package/dist/shader/parameter.d.ts +6 -0
- package/dist/shader-nodes/time.d.ts +1 -0
- package/dist/shader-nodes/time.js +1 -1
- package/dist/test/collision-shape-import.test.d.ts +2 -0
- package/dist/test/collision-shape-import.test.js +4 -0
- package/dist/test/vfx-input-bindings.test.d.ts +2 -0
- package/dist/test/vfx-input-bindings.test.js +4 -0
- package/dist/utils/obb-utils.d.ts +12 -0
- package/dist/utils/obb-utils.js +4 -0
- package/package.json +2 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { AnimationClip, Vector2, Vector3 } from "three";
|
|
2
|
-
import { Behaviour, Initializer } from "@hology/nebula";
|
|
2
|
+
import { Alpha, Attraction, Behaviour, Color as ChangeColor, Force, Gravity, Initializer, Life, Mass, Position, RadialVelocity, RandomDrift, Repulsion, Rotate } from "@hology/nebula";
|
|
3
|
+
import { Disperse, FollowParent, LinearDamping, MoveOverLife, RotatePosition, Scale, ScaleComponents } from './behaviours.js';
|
|
4
|
+
import { AdditiveVelocity, InitialScale, InitialScaleComponents, RandomDirection, RandomScale, Rotation } from './initializsers.js';
|
|
3
5
|
import { Curve2 } from "../../utils/curve.js";
|
|
6
|
+
import { VfxBindingAdapter, VfxBindingMode, VfxBoundBehaviourDefinition, VfxBoundInitializerDefinition } from "./vfx-binding-runtime.js";
|
|
4
7
|
type HexColor = `#${string}`;
|
|
5
8
|
export type ShapeParameterDef<T = boolean | number | string | Vector3 | Vector2 | HexColor | Curve2 | AnimationClip> = {
|
|
6
9
|
type: T extends number ? 'number' : T extends HexColor ? 'color' : T extends string ? 'string' | 'select' : T extends Vector2 ? 'vec2' : T extends Vector3 ? 'vec3' : T extends Curve2 ? 'curve' : T extends AnimationClip ? 'animationclip' : T extends boolean ? 'boolean' : never;
|
|
7
10
|
default: T;
|
|
8
11
|
requires?: Record<string, unknown>;
|
|
12
|
+
bindable?: VfxBindingMode;
|
|
9
13
|
};
|
|
10
14
|
type FloatParameterDef = ShapeParameterDef<number> & {
|
|
11
15
|
float: boolean;
|
|
@@ -16,21 +20,25 @@ export type SelectParameterDef<T> = ShapeParameterDef<T> & {
|
|
|
16
20
|
type: 'select';
|
|
17
21
|
opts: Readonly<T[]>;
|
|
18
22
|
};
|
|
19
|
-
interface InitializerDefinition {
|
|
23
|
+
interface InitializerDefinition extends VfxBoundInitializerDefinition<Initializer> {
|
|
20
24
|
build(params?: any): Initializer;
|
|
21
25
|
parameters?: Record<string, ShapeParameterDef>;
|
|
26
|
+
bindingAdapter?: VfxBindingAdapter<Initializer>;
|
|
22
27
|
}
|
|
23
|
-
interface BehaviourDefinition {
|
|
28
|
+
interface BehaviourDefinition extends VfxBoundBehaviourDefinition<Behaviour> {
|
|
24
29
|
build(params?: any): Behaviour;
|
|
25
30
|
parameters?: Record<string, ShapeParameterDef>;
|
|
31
|
+
bindingAdapter?: VfxBindingAdapter<Behaviour>;
|
|
26
32
|
}
|
|
27
33
|
declare abstract class BaseBevDef<T extends DefBuilder> implements BehaviourDefinition {
|
|
28
34
|
abstract parameters: any;
|
|
35
|
+
bindingAdapter?: VfxBindingAdapter<Behaviour>;
|
|
29
36
|
build(params?: ParamsType<T>): Behaviour;
|
|
30
37
|
abstract make(params: ParamsType<T>): Behaviour;
|
|
31
38
|
}
|
|
32
39
|
declare abstract class BaseIniDef<T extends DefBuilder> implements InitializerDefinition {
|
|
33
40
|
abstract parameters: any;
|
|
41
|
+
bindingAdapter?: VfxBindingAdapter<Initializer>;
|
|
34
42
|
build(params?: ParamsType<T>): Initializer;
|
|
35
43
|
abstract make(params: ParamsType<T>): Initializer;
|
|
36
44
|
}
|
|
@@ -44,6 +52,7 @@ declare class LifetimeDef extends BaseIniDef<LifetimeDef> {
|
|
|
44
52
|
parameters: {
|
|
45
53
|
duration: FloatParameterDef;
|
|
46
54
|
};
|
|
55
|
+
bindingAdapter: VfxBindingAdapter<Life>;
|
|
47
56
|
make(params?: ParamsType<this>): Initializer;
|
|
48
57
|
}
|
|
49
58
|
declare class RandomLifetimeDef extends BaseIniDef<RandomLifetimeDef> {
|
|
@@ -51,12 +60,16 @@ declare class RandomLifetimeDef extends BaseIniDef<RandomLifetimeDef> {
|
|
|
51
60
|
minDuration: FloatParameterDef;
|
|
52
61
|
maxDuration: FloatParameterDef;
|
|
53
62
|
};
|
|
63
|
+
bindingAdapter: VfxBindingAdapter<Life>;
|
|
54
64
|
make(params?: ParamsType<this>): Initializer;
|
|
55
65
|
}
|
|
56
66
|
declare class VelocityDef extends BaseIniDef<VelocityDef> {
|
|
57
67
|
parameters: {
|
|
58
68
|
velocity: ShapeParameterDef<Vector3>;
|
|
59
69
|
};
|
|
70
|
+
bindingAdapter: {
|
|
71
|
+
buildBound: (context: any) => AdditiveVelocity;
|
|
72
|
+
};
|
|
60
73
|
make(params?: ParamsType<this>): Initializer;
|
|
61
74
|
}
|
|
62
75
|
declare class RandomVelocityDef extends BaseIniDef<RandomVelocityDef> {
|
|
@@ -64,12 +77,16 @@ declare class RandomVelocityDef extends BaseIniDef<RandomVelocityDef> {
|
|
|
64
77
|
min: ShapeParameterDef<Vector3>;
|
|
65
78
|
max: ShapeParameterDef<Vector3>;
|
|
66
79
|
};
|
|
80
|
+
bindingAdapter: {
|
|
81
|
+
buildBound: (context: any) => AdditiveVelocity;
|
|
82
|
+
};
|
|
67
83
|
make(params?: ParamsType<this>): Initializer;
|
|
68
84
|
}
|
|
69
85
|
declare class PositionPointDef extends BaseIniDef<PositionPointDef> {
|
|
70
86
|
parameters: {
|
|
71
87
|
position: ShapeParameterDef<Vector3>;
|
|
72
88
|
};
|
|
89
|
+
bindingAdapter: VfxBindingAdapter<Position>;
|
|
73
90
|
make(params?: ParamsType<this>): Initializer;
|
|
74
91
|
}
|
|
75
92
|
declare class PositionBoxDef extends BaseIniDef<PositionBoxDef> {
|
|
@@ -77,6 +94,7 @@ declare class PositionBoxDef extends BaseIniDef<PositionBoxDef> {
|
|
|
77
94
|
position: ShapeParameterDef<Vector3>;
|
|
78
95
|
dimensions: ShapeParameterDef<Vector3>;
|
|
79
96
|
};
|
|
97
|
+
bindingAdapter: VfxBindingAdapter<Position>;
|
|
80
98
|
make(params?: ParamsType<this>): Initializer;
|
|
81
99
|
}
|
|
82
100
|
declare class PositionSphereDef extends BaseIniDef<PositionBoxDef> {
|
|
@@ -84,6 +102,7 @@ declare class PositionSphereDef extends BaseIniDef<PositionBoxDef> {
|
|
|
84
102
|
position: ShapeParameterDef<Vector3>;
|
|
85
103
|
radius: FloatParameterDef;
|
|
86
104
|
};
|
|
105
|
+
bindingAdapter: VfxBindingAdapter<Position>;
|
|
87
106
|
make(params?: ParamsType<this>): Initializer;
|
|
88
107
|
}
|
|
89
108
|
declare class PositionLineDef extends BaseIniDef<PositionLineDef> {
|
|
@@ -91,6 +110,7 @@ declare class PositionLineDef extends BaseIniDef<PositionLineDef> {
|
|
|
91
110
|
a: ShapeParameterDef<Vector3>;
|
|
92
111
|
b: ShapeParameterDef<Vector3>;
|
|
93
112
|
};
|
|
113
|
+
bindingAdapter: VfxBindingAdapter<Position>;
|
|
94
114
|
make(params?: ParamsType<this>): Initializer;
|
|
95
115
|
}
|
|
96
116
|
declare class PositionCircleDef extends BaseIniDef<PositionCircleDef> {
|
|
@@ -99,6 +119,7 @@ declare class PositionCircleDef extends BaseIniDef<PositionCircleDef> {
|
|
|
99
119
|
rotation: ShapeParameterDef<Vector3>;
|
|
100
120
|
radius: FloatParameterDef;
|
|
101
121
|
};
|
|
122
|
+
bindingAdapter: VfxBindingAdapter<Position>;
|
|
102
123
|
make(params?: ParamsType<this>): Initializer;
|
|
103
124
|
}
|
|
104
125
|
declare class PositionRingDef extends BaseIniDef<PositionRingDef> {
|
|
@@ -108,6 +129,7 @@ declare class PositionRingDef extends BaseIniDef<PositionRingDef> {
|
|
|
108
129
|
radius: FloatParameterDef;
|
|
109
130
|
thickness: FloatParameterDef;
|
|
110
131
|
};
|
|
132
|
+
bindingAdapter: VfxBindingAdapter<Position>;
|
|
111
133
|
make(params?: ParamsType<this>): Initializer;
|
|
112
134
|
}
|
|
113
135
|
declare class RadialVelocityDef extends BaseIniDef<RadialVelocityDef> {
|
|
@@ -116,24 +138,28 @@ declare class RadialVelocityDef extends BaseIniDef<RadialVelocityDef> {
|
|
|
116
138
|
direction: ShapeParameterDef<Vector3>;
|
|
117
139
|
spread: FloatParameterDef;
|
|
118
140
|
};
|
|
141
|
+
bindingAdapter: VfxBindingAdapter<RadialVelocity>;
|
|
119
142
|
make(params?: ParamsType<this>): Initializer;
|
|
120
143
|
}
|
|
121
144
|
declare class RandomDirectionDef extends BaseIniDef<RandomDirectionDef> {
|
|
122
145
|
parameters: {
|
|
123
146
|
speed: FloatParameterDef;
|
|
124
147
|
};
|
|
148
|
+
bindingAdapter: VfxBindingAdapter<RandomDirection>;
|
|
125
149
|
make(params?: ParamsType<this>): Initializer;
|
|
126
150
|
}
|
|
127
151
|
declare class MassDef extends BaseIniDef<MassDef> {
|
|
128
152
|
parameters: {
|
|
129
153
|
min: FloatParameterDef;
|
|
130
154
|
};
|
|
155
|
+
bindingAdapter: VfxBindingAdapter<Mass>;
|
|
131
156
|
make(params?: ParamsType<this>): Initializer;
|
|
132
157
|
}
|
|
133
158
|
declare class RotationDef extends BaseIniDef<RotationDef> {
|
|
134
159
|
parameters: {
|
|
135
160
|
rotation: ShapeParameterDef<Vector3>;
|
|
136
161
|
};
|
|
162
|
+
bindingAdapter: VfxBindingAdapter<Rotation>;
|
|
137
163
|
make(params?: ParamsType<this>): Initializer;
|
|
138
164
|
}
|
|
139
165
|
declare class RandomRotationDef extends BaseIniDef<RandomRotationDef> {
|
|
@@ -146,6 +172,7 @@ declare class InitialScaleDef extends BaseIniDef<InitialScaleDef> {
|
|
|
146
172
|
parameters: {
|
|
147
173
|
scale: FloatParameterDef;
|
|
148
174
|
};
|
|
175
|
+
bindingAdapter: VfxBindingAdapter<InitialScale>;
|
|
149
176
|
make(params?: ParamsType<this>): Initializer;
|
|
150
177
|
}
|
|
151
178
|
declare class RandomScaleDef extends BaseIniDef<RandomScaleDef> {
|
|
@@ -153,12 +180,14 @@ declare class RandomScaleDef extends BaseIniDef<RandomScaleDef> {
|
|
|
153
180
|
min: FloatParameterDef;
|
|
154
181
|
max: FloatParameterDef;
|
|
155
182
|
};
|
|
183
|
+
bindingAdapter: VfxBindingAdapter<RandomScale>;
|
|
156
184
|
make(params?: ParamsType<this>): Initializer;
|
|
157
185
|
}
|
|
158
186
|
declare class InitialScaleComponentsDef extends BaseIniDef<InitialScaleComponentsDef> {
|
|
159
187
|
parameters: {
|
|
160
188
|
scale: ShapeParameterDef<Vector3>;
|
|
161
189
|
};
|
|
190
|
+
bindingAdapter: VfxBindingAdapter<InitialScaleComponents>;
|
|
162
191
|
make(params?: ParamsType<this>): Initializer;
|
|
163
192
|
}
|
|
164
193
|
declare class ForceDef extends BaseBevDef<ForceDef> {
|
|
@@ -166,6 +195,7 @@ declare class ForceDef extends BaseBevDef<ForceDef> {
|
|
|
166
195
|
force: ShapeParameterDef<Vector3>;
|
|
167
196
|
ease: ShapeParameterDef<Curve2>;
|
|
168
197
|
};
|
|
198
|
+
bindingAdapter: VfxBindingAdapter<Force>;
|
|
169
199
|
make(params?: ParamsType<this>): Behaviour;
|
|
170
200
|
}
|
|
171
201
|
declare class GravityDef extends BaseBevDef<GravityDef> {
|
|
@@ -173,6 +203,7 @@ declare class GravityDef extends BaseBevDef<GravityDef> {
|
|
|
173
203
|
gravity: FloatParameterDef;
|
|
174
204
|
easing: ShapeParameterDef<Curve2>;
|
|
175
205
|
};
|
|
206
|
+
bindingAdapter: VfxBindingAdapter<Gravity>;
|
|
176
207
|
make(params?: ParamsType<this>): Behaviour;
|
|
177
208
|
}
|
|
178
209
|
declare class ScaleDef extends BaseBevDef<ScaleDef> {
|
|
@@ -181,6 +212,7 @@ declare class ScaleDef extends BaseBevDef<ScaleDef> {
|
|
|
181
212
|
b: FloatParameterDef;
|
|
182
213
|
ease: ShapeParameterDef<Curve2>;
|
|
183
214
|
};
|
|
215
|
+
bindingAdapter: VfxBindingAdapter<Scale>;
|
|
184
216
|
make(params?: ParamsType<this>): Behaviour;
|
|
185
217
|
}
|
|
186
218
|
declare class ScaleComponentsDef extends BaseBevDef<ScaleComponentsDef> {
|
|
@@ -189,6 +221,7 @@ declare class ScaleComponentsDef extends BaseBevDef<ScaleComponentsDef> {
|
|
|
189
221
|
b: ShapeParameterDef<Vector3>;
|
|
190
222
|
ease: ShapeParameterDef<Curve2>;
|
|
191
223
|
};
|
|
224
|
+
bindingAdapter: VfxBindingAdapter<ScaleComponents>;
|
|
192
225
|
make(params?: ParamsType<this>): Behaviour;
|
|
193
226
|
}
|
|
194
227
|
declare class RandomDriftDef extends BaseBevDef<RandomDriftDef> {
|
|
@@ -197,6 +230,16 @@ declare class RandomDriftDef extends BaseBevDef<RandomDriftDef> {
|
|
|
197
230
|
delay: FloatParameterDef;
|
|
198
231
|
ease: ShapeParameterDef<Curve2>;
|
|
199
232
|
};
|
|
233
|
+
bindingAdapter: VfxBindingAdapter<RandomDrift>;
|
|
234
|
+
make(params?: ParamsType<this>): Behaviour;
|
|
235
|
+
}
|
|
236
|
+
declare class DisperseDef extends BaseBevDef<DisperseDef> {
|
|
237
|
+
parameters: {
|
|
238
|
+
distance: FloatParameterDef;
|
|
239
|
+
axis: SelectParameterDef<string>;
|
|
240
|
+
ease: ShapeParameterDef<Curve2>;
|
|
241
|
+
};
|
|
242
|
+
bindingAdapter: VfxBindingAdapter<Disperse>;
|
|
200
243
|
make(params?: ParamsType<this>): Behaviour;
|
|
201
244
|
}
|
|
202
245
|
declare class RotateDef extends BaseBevDef<RotateDef> {
|
|
@@ -204,18 +247,21 @@ declare class RotateDef extends BaseBevDef<RotateDef> {
|
|
|
204
247
|
rotation: ShapeParameterDef<Vector3>;
|
|
205
248
|
ease: ShapeParameterDef<Curve2>;
|
|
206
249
|
};
|
|
250
|
+
bindingAdapter: VfxBindingAdapter<Rotate>;
|
|
207
251
|
make(params?: ParamsType<this>): Behaviour;
|
|
208
252
|
}
|
|
209
253
|
declare class RotateAddDef extends BaseBevDef<RotateDef> {
|
|
210
254
|
parameters: {
|
|
211
255
|
rotation: ShapeParameterDef<Vector3>;
|
|
212
256
|
};
|
|
257
|
+
bindingAdapter: VfxBindingAdapter<Rotate>;
|
|
213
258
|
make(params?: ParamsType<this>): Behaviour;
|
|
214
259
|
}
|
|
215
260
|
declare class FollowParentDef extends BaseBevDef<FollowParentDef> {
|
|
216
261
|
parameters: {
|
|
217
262
|
speed: FloatParameterDef;
|
|
218
263
|
};
|
|
264
|
+
bindingAdapter: VfxBindingAdapter<FollowParent>;
|
|
219
265
|
make(params?: ParamsType<this>): Behaviour;
|
|
220
266
|
}
|
|
221
267
|
declare class ChangeColorDef extends BaseBevDef<ChangeColorDef> {
|
|
@@ -224,6 +270,7 @@ declare class ChangeColorDef extends BaseBevDef<ChangeColorDef> {
|
|
|
224
270
|
b: ShapeParameterDef<`#${string}`>;
|
|
225
271
|
ease: ShapeParameterDef<Curve2>;
|
|
226
272
|
};
|
|
273
|
+
bindingAdapter: VfxBindingAdapter<ChangeColor>;
|
|
227
274
|
make(params?: ParamsType<this>): Behaviour;
|
|
228
275
|
}
|
|
229
276
|
declare class ChangeOpacityDef extends BaseBevDef<ChangeOpacityDef> {
|
|
@@ -232,6 +279,7 @@ declare class ChangeOpacityDef extends BaseBevDef<ChangeOpacityDef> {
|
|
|
232
279
|
b: FloatParameterDef;
|
|
233
280
|
ease: ShapeParameterDef<Curve2>;
|
|
234
281
|
};
|
|
282
|
+
bindingAdapter: VfxBindingAdapter<Alpha>;
|
|
235
283
|
make(params?: ParamsType<this>): Behaviour;
|
|
236
284
|
}
|
|
237
285
|
declare class VortexDef extends BaseBevDef<VortexDef> {
|
|
@@ -239,6 +287,7 @@ declare class VortexDef extends BaseBevDef<VortexDef> {
|
|
|
239
287
|
axis: ShapeParameterDef<Vector3>;
|
|
240
288
|
amount: FloatParameterDef;
|
|
241
289
|
};
|
|
290
|
+
bindingAdapter: VfxBindingAdapter<RotatePosition>;
|
|
242
291
|
make(params?: ParamsType<this>): Behaviour;
|
|
243
292
|
}
|
|
244
293
|
declare class RepulsionDef extends BaseBevDef<RepulsionDef> {
|
|
@@ -248,6 +297,7 @@ declare class RepulsionDef extends BaseBevDef<RepulsionDef> {
|
|
|
248
297
|
radius: FloatParameterDef;
|
|
249
298
|
easing: ShapeParameterDef<Curve2>;
|
|
250
299
|
};
|
|
300
|
+
bindingAdapter: VfxBindingAdapter<Repulsion>;
|
|
251
301
|
make(params?: ParamsType<this>): Behaviour;
|
|
252
302
|
}
|
|
253
303
|
declare class AttractionDef extends BaseBevDef<AttractionDef> {
|
|
@@ -257,6 +307,7 @@ declare class AttractionDef extends BaseBevDef<AttractionDef> {
|
|
|
257
307
|
radius: FloatParameterDef;
|
|
258
308
|
easing: ShapeParameterDef<Curve2>;
|
|
259
309
|
};
|
|
310
|
+
bindingAdapter: VfxBindingAdapter<Attraction>;
|
|
260
311
|
make(params?: ParamsType<this>): Behaviour;
|
|
261
312
|
}
|
|
262
313
|
declare class MoveToDef extends BaseBevDef<MoveToDef> {
|
|
@@ -264,12 +315,14 @@ declare class MoveToDef extends BaseBevDef<MoveToDef> {
|
|
|
264
315
|
target: ShapeParameterDef<Vector3>;
|
|
265
316
|
ease: ShapeParameterDef<Curve2>;
|
|
266
317
|
};
|
|
318
|
+
bindingAdapter: VfxBindingAdapter<MoveOverLife>;
|
|
267
319
|
make(params?: ParamsType<this>): Behaviour;
|
|
268
320
|
}
|
|
269
321
|
declare class LinearDampingDef extends BaseBevDef<LinearDampingDef> {
|
|
270
322
|
parameters: {
|
|
271
323
|
factor: FloatParameterDef;
|
|
272
324
|
};
|
|
325
|
+
bindingAdapter: VfxBindingAdapter<LinearDamping>;
|
|
273
326
|
make(params?: ParamsType<this>): Behaviour;
|
|
274
327
|
}
|
|
275
328
|
declare class WorldCollisionDef extends BaseBevDef<WorldCollisionDef> {
|
|
@@ -292,6 +345,7 @@ declare class AnimationBehaviorDef extends BaseBevDef<AnimationBehaviorDef> {
|
|
|
292
345
|
};
|
|
293
346
|
type: "boolean";
|
|
294
347
|
default: boolean;
|
|
348
|
+
bindable?: VfxBindingMode;
|
|
295
349
|
};
|
|
296
350
|
};
|
|
297
351
|
make(params?: ParamsType<this>): Behaviour;
|
|
@@ -324,6 +378,7 @@ declare const vfxBehaviours: {
|
|
|
324
378
|
scale: ScaleDef;
|
|
325
379
|
scaleComponents: ScaleComponentsDef;
|
|
326
380
|
randomDrift: RandomDriftDef;
|
|
381
|
+
disperse: DisperseDef;
|
|
327
382
|
rotate: RotateDef;
|
|
328
383
|
rotateAdd: RotateAddDef;
|
|
329
384
|
changeColor: ChangeColorDef;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{LoopOnce as e,LoopPingPong as t,LoopRepeat as r,MathUtils as s,Vector2 as n,Vector3 as a}from"three";import{Alpha as o,Attraction as i,BoxZone as c,CircleZone as u,Color as p,ease as d,Force as m,Gravity as l,Life as w,LineZone as x,Mass as f,Position as h,RadialVelocity as y,RandomDrift as g,Repulsion as k,Rotate as b,Vector3D as v}from"@hology/nebula";import{AnimationBehavior as z,AxisDirection as R,AxisPlane as T,Disperse as L,FollowParent as V,LinearDamping as j,MoveOverLife as D,OrientAlongVelocity as C,RotatePosition as O,Scale as P,ScaleComponents as B}from"./behaviours.js";import{AdditiveVelocity as S,InitialScale as I,InitialScaleComponents as A,RandomDirection as F,RandomRotation as K,randomRotationAxis as W,RandomScale as Y,Rotation as q}from"./initializsers.js";import{PointZone as M,SphereZone as X}from"./zones.js";import{WorldCollisionBehaviour as Z}from"./vfx-collision-behaviour.js";import{Curve2 as E}from"../../utils/curve.js";class G{build(e={}){const t=_(e,this.parameters);return this.make(t)}}class H{build(e={}){const t=_(e,this.parameters);return this.make(t)}}function J(e,t,r){return{type:"number",default:e,float:!0,min:t,max:r}}function N(e){return{type:"vec3",default:(new a).fromArray(e)}}function Q(e){return{type:"color",default:e}}function U(e,t){return{type:"select",opts:e,default:t}}function $(){return{type:"curve",default:E.linear()}}function _(e,t){const r={};for(let s in t)null==e[s]?r[s]=t[s].default:r[s]=e[s];return r}function ee(e){return t=>e.getY(t)}const te={lifetime:new class extends H{constructor(){super(...arguments),this.parameters={duration:J(1,0,1e5)}}make(e={}){return new w(e.duration)}},randomLifetime:new class extends H{constructor(){super(...arguments),this.parameters={minDuration:J(1,0,1e5),maxDuration:J(2,0,1e5)}}make(e={}){return new w(e.minDuration,e.maxDuration)}},positionPoint:new class extends H{constructor(){super(...arguments),this.parameters={position:N([0,0,0])}}make(e={}){const{x:t,y:r,z:s}=e.position;return new h(new M(t,r,s))}},positionBox:new class extends H{constructor(){super(...arguments),this.parameters={position:N([0,0,0]),dimensions:N([0,0,0])}}make(e={}){const{x:t,y:r,z:s}=e.position,{x:n,y:a,z:o}=e.dimensions;return new h(new c(t,r,s,n,a,o))}},positionSphere:new class extends H{constructor(){super(...arguments),this.parameters={position:N([0,0,0]),radius:J(1)}}make(e={}){const{x:t,y:r,z:s}=e.position;return new h(new X(t,r,s,e.radius))}},positionLine:new class extends H{constructor(){super(...arguments),this.parameters={a:N([0,0,0]),b:N([0,0,1])}}make(e={}){const{x:t,y:r,z:s}=e.a,{x:n,y:a,z:o}=e.b;return new h(new x(t,r,s,n,a,o))}},positionCircle:new class extends H{constructor(){super(...arguments),this.parameters={position:N([0,0,0]),rotation:N([0,0,0]),radius:J(1,0,1e4)}}make(e={}){const{x:t,y:r,z:n}=e.position,{x:a,y:o,z:i}=e.rotation;return new h(new u(t,r,n,e.radius,0,s.degToRad(a),s.degToRad(o),s.degToRad(i)))}},positionRing:new class extends H{constructor(){super(...arguments),this.parameters={position:N([0,0,0]),rotation:N([0,0,0]),radius:J(1,0,1e4),thickness:J(.2,0,1e4)}}make(e={}){const{x:t,y:r,z:n}=e.position,{x:a,y:o,z:i}=e.rotation;return new h(new u(t,r,n,e.radius,Math.max(e.thickness,1e-4),s.degToRad(a),s.degToRad(o),s.degToRad(i)))}},rotation:new class extends H{constructor(){super(...arguments),this.parameters={rotation:N([0,0,0])}}make(e={}){const{x:t,y:r,z:n}=e.rotation;return new q(new a(s.degToRad(t),s.degToRad(r),s.degToRad(n)))}},randomRotation:new class extends H{constructor(){super(...arguments),this.parameters={axis:U(W,"XYZ")}}make(e={}){return new K(e.axis)}},scale:new class extends H{constructor(){super(...arguments),this.parameters={scale:J(1)}}make(e={}){return new I(e.scale)}},scaleComponents:new class extends H{constructor(){super(...arguments),this.parameters={scale:N([1,1,1])}}make(e={}){return new A(e.scale)}},randomScale:new class extends H{constructor(){super(...arguments),this.parameters={min:J(1),max:J(1)}}make(e={}){return new Y(e.min,e.max)}},mass:new class extends H{constructor(){super(...arguments),this.parameters={min:J(1)}}make(e={}){return new f(e.min)}},velocity:new class extends H{constructor(){super(...arguments),this.parameters={velocity:N([0,0,0])}}make(e={}){const{x:t,y:r,z:s}=e.velocity;return new S(new a(t,r,s))}},randomVelocity:new class extends H{constructor(){super(...arguments),this.parameters={min:N([0,0,0]),max:N([0,0,0])}}make(e={}){return new S(e.min,e.max)}},radialVelocity:new class extends H{constructor(){super(...arguments),this.parameters={speed:J(1),direction:N([0,1,0]),spread:J(0)}}make(e={}){return new y(e.speed,new v(e.direction.x,e.direction.y,e.direction.z),e.spread)}},randomDirection:new class extends H{constructor(){super(...arguments),this.parameters={speed:J(1)}}make(e={}){return new F(e.speed)}}},re={force:new class extends G{constructor(){super(...arguments),this.parameters={force:N([0,0,0]),ease:$()}}make(e={}){return new m(e.force.x,e.force.y,e.force.z,void 0,ee(e.ease))}},gravity:new class extends G{constructor(){super(...arguments),this.parameters={gravity:J(8),easing:$()}}make(e={}){return new l(e.gravity,void 0,ee(e.easing))}},repulsion:new class extends G{constructor(){super(...arguments),this.parameters={target:N([0,0,0]),force:J(1),radius:J(1),easing:$()}}make(e={}){const t=new v(e.target.x,e.target.y,e.target.z);return new k(t,e.force,e.radius,void 0,ee(e.easing))}},attraction:new class extends G{constructor(){super(...arguments),this.parameters={target:N([0,0,0]),force:J(1),radius:J(1),easing:$()}}make(e={}){const t=new v(e.target.x,e.target.y,e.target.z);return new i(t,e.force,e.radius,void 0,ee(e.easing))}},scale:new class extends G{constructor(){super(...arguments),this.parameters={a:J(1),b:J(1),ease:$()}}make(e={}){return new P(e.a,e.b,ee(e.ease))}},scaleComponents:new class extends G{constructor(){super(...arguments),this.parameters={a:N([1,1,1]),b:N([1,1,1]),ease:$()}}make(e={}){return new B(e.a,e.b,ee(e.ease))}},randomDrift:new class extends G{constructor(){super(...arguments),this.parameters={drift:N([1,1,1]),delay:J(0),ease:$()}}make(e={}){return new g(e.drift.x,e.drift.y,e.drift.z,e.delay,void 0,ee(e.ease))}},rotate:new class extends G{constructor(){super(...arguments),this.parameters={rotation:N([0,0,0]),ease:$()}}make(e={}){const{x:t,y:r,z:n}=e.rotation;return new b(s.degToRad(t),s.degToRad(r),s.degToRad(n),void 0,ee(e.ease))}},rotateAdd:new class extends G{constructor(){super(...arguments),this.parameters={rotation:N([0,0,0])}}make(e={}){const{x:t,y:r,z:n}=e.rotation,a=new b(s.degToRad(t),s.degToRad(r),s.degToRad(n),void 0);return a.rotationType="add",a}},changeColor:new class extends G{constructor(){super(...arguments),this.parameters={a:Q("#ffffff"),b:Q("#ffffff"),ease:$()}}make(e={}){return new p(e.a,e.b,void 0,ee(e.ease))}},changeOpacity:new class extends G{constructor(){super(...arguments),this.parameters={a:J(1,0,1),b:J(0,0,1),ease:$()}}make(e={}){return new o(e.a,e.b,void 0,ee(e.ease))}},vortex:new class extends G{constructor(){super(...arguments),this.parameters={axis:N([0,1,0]),amount:J(1)}}make(e={}){return new O(e.axis,e.amount)}},moveTo:new class extends G{constructor(){super(...arguments),this.parameters={target:N([0,1,0]),ease:$()}}make(e={}){return new D(e.target.x,e.target.y,e.target.z,ee(e.ease))}},linearDamping:new class extends G{constructor(){super(...arguments),this.parameters={factor:J(.1,0,1e3)}}make(e={}){return new j(e.factor)}},followParent:new class extends G{constructor(){super(...arguments),this.parameters={speed:J(0)}}make(e={}){return new V(e.speed)}},worldCollision:new class extends G{constructor(){super(...arguments),this.parameters={friction:J(1,0,1),bounce:J(1,0,1),lifeLoss:J(0,0)}}make(e={}){return new Z(null,e.bounce,e.friction,e.lifeLoss)}},animation:new class extends G{constructor(){var e;super(...arguments),this.parameters={clip:{type:"animationclip",default:null},timeScale:J(1,0,10),weight:J(1,0,1),loop:U(["Once","Repeat","PingPong"],"Once"),clampWhenFinished:{...(e=!0,{type:"boolean",default:e}),requires:{loop:"Once"}}}}make(s={}){let n=e;return"Repeat"===s.loop?n=r:"PingPong"===s.loop&&(n=t),new z(s.clip,s.timeScale,s.weight,n,s.clampWhenFinished,d.easeLinear)}}};export const VfxInitializserLibrary=te;export const VfxInitializserLibraryKeys=Object.keys(VfxInitializserLibrary);export const VfxBehaviourLibrary=re;export const VfxBehaviourLibraryKeys=Object.keys(VfxBehaviourLibrary);/*
|
|
1
|
+
import{LoopOnce as e,LoopPingPong as t,LoopRepeat as s,MathUtils as n,Vector2 as r,Vector3 as a}from"three";import{Alpha as i,Attraction as o,BoxZone as c,CircleZone as p,Color as d,ease as u,Force as m,Gravity as l,Life as w,LineZone as h,Mass as x,Position as f,RadialVelocity as g,RandomDrift as b,Repulsion as y,Rotate as v,Vector3D as k}from"@hology/nebula";import{AnimationBehavior as A,AxisDirection as z,AxisPlane as R,Disperse as L,FollowParent as D,LinearDamping as S,MoveOverLife as C,OrientAlongVelocity as T,RotatePosition as V,Scale as j,ScaleComponents as B}from"./behaviours.js";import{AdditiveVelocity as O,InitialScale as P,InitialScaleComponents as Y,RandomDirection as F,RandomRotation as X,randomRotationAxis as Z,RandomScale as I,Rotation as M}from"./initializsers.js";import{PointZone as K,SphereZone as W}from"./zones.js";import{WorldCollisionBehaviour as q}from"./vfx-collision-behaviour.js";import{Curve2 as E}from"../../utils/curve.js";import{liveBindingAdapter as G,spawnBindingAdapter as H}from"./vfx-binding-runtime.js";class J{build(e={}){const t=re(e,this.parameters);return this.make(t)}}class N{build(e={}){const t=re(e,this.parameters);return this.make(t)}}function Q(e,t,s){return{type:"number",default:e,float:!0,min:t,max:s}}function U(e,t,s,n){return{...Q(e,s,n),bindable:t}}function $(e){return{type:"vec3",default:(new a).fromArray(e)}}function _(e,t){return{...$(e),bindable:t}}function ee(e){return{type:"color",default:e}}function te(e,t){return{...ee(e),bindable:t}}function se(e,t){return{type:"select",opts:e,default:t}}function ne(){return{type:"curve",default:E.linear()}}function re(e,t){const s={};for(let n in t)null==e[n]?s[n]=t[n].default:s[n]=e[n];return s}function ae(e){return new k(e.x,e.y,e.z)}function ie(e){return new a(n.degToRad(e.x),n.degToRad(e.y),n.degToRad(e.z))}function oe(e){const{x:t,y:s,z:n}=e;return new K(t,s,n)}function ce(e,t){const{x:s,y:n,z:r}=e,{x:a,y:i,z:o}=t;return new c(s,n,r,a,i,o)}function pe(e,t){const{x:s,y:n,z:r}=e;return new W(s,n,r,t)}function de(e,t){return new h(e.x,e.y,e.z,t.x,t.y,t.z)}function ue(e,t,s,r=0){return new p(e.x,e.y,e.z,s,r,n.degToRad(t.x),n.degToRad(t.y),n.degToRad(t.z))}function me(e){return t=>e.getY(t)}const le={lifetime:new class extends N{constructor(){super(...arguments),this.parameters={duration:U(1,"spawn",0,1e5)},this.bindingAdapter=H((e,t)=>{e.resetLife(t.duration)})}make(e={}){return new w(e.duration)}},randomLifetime:new class extends N{constructor(){super(...arguments),this.parameters={minDuration:U(1,"spawn",0,1e5),maxDuration:U(2,"spawn",0,1e5)},this.bindingAdapter=H((e,t)=>{e.resetLife(t.minDuration,t.maxDuration)})}make(e={}){return new w(e.minDuration,e.maxDuration)}},positionPoint:new class extends N{constructor(){super(...arguments),this.parameters={position:_([0,0,0],"spawn")},this.bindingAdapter=H((e,t)=>{e.reset(oe(t.position))})}make(e={}){return new f(oe(e.position))}},positionBox:new class extends N{constructor(){super(...arguments),this.parameters={position:_([0,0,0],"spawn"),dimensions:_([0,0,0],"spawn")},this.bindingAdapter=H((e,t)=>{e.reset(ce(t.position,t.dimensions))})}make(e={}){return new f(ce(e.position,e.dimensions))}},positionSphere:new class extends N{constructor(){super(...arguments),this.parameters={position:_([0,0,0],"spawn"),radius:U(1,"spawn")},this.bindingAdapter=H((e,t)=>{e.reset(pe(t.position,t.radius))})}make(e={}){return new f(pe(e.position,e.radius))}},positionLine:new class extends N{constructor(){super(...arguments),this.parameters={a:_([0,0,0],"spawn"),b:_([0,0,1],"spawn")},this.bindingAdapter=H((e,t)=>{e.reset(de(t.a,t.b))})}make(e={}){return new f(de(e.a,e.b))}},positionCircle:new class extends N{constructor(){super(...arguments),this.parameters={position:_([0,0,0],"spawn"),rotation:_([0,0,0],"spawn"),radius:U(1,"spawn",0,1e4)},this.bindingAdapter=H((e,t)=>{e.reset(ue(t.position,t.rotation,t.radius))})}make(e={}){return new f(ue(e.position,e.rotation,e.radius))}},positionRing:new class extends N{constructor(){super(...arguments),this.parameters={position:_([0,0,0],"spawn"),rotation:_([0,0,0],"spawn"),radius:U(1,"spawn",0,1e4),thickness:U(.2,"spawn",0,1e4)},this.bindingAdapter=H((e,t)=>{e.reset(ue(t.position,t.rotation,t.radius,Math.max(t.thickness,1e-4)))})}make(e={}){return new f(ue(e.position,e.rotation,e.radius,Math.max(e.thickness,1e-4)))}},rotation:new class extends N{constructor(){super(...arguments),this.parameters={rotation:_([0,0,0],"spawn")},this.bindingAdapter=H((e,t)=>{e.setRotation(ie(t.rotation))})}make(e={}){return new M(ie(e.rotation))}},randomRotation:new class extends N{constructor(){super(...arguments),this.parameters={axis:se(Z,"XYZ")}}make(e={}){return new X(e.axis)}},scale:new class extends N{constructor(){super(...arguments),this.parameters={scale:U(1,"spawn")},this.bindingAdapter=H((e,t)=>{e.setScale(t.scale)})}make(e={}){return new P(e.scale)}},scaleComponents:new class extends N{constructor(){super(...arguments),this.parameters={scale:_([1,1,1],"spawn")},this.bindingAdapter=H((e,t)=>{e.setScaleComponents(t.scale)})}make(e={}){return new Y(e.scale)}},randomScale:new class extends N{constructor(){super(...arguments),this.parameters={min:U(1,"spawn"),max:U(1,"spawn")},this.bindingAdapter=H((e,t)=>{e.setRange(t.min,t.max)})}make(e={}){return new I(e.min,e.max)}},mass:new class extends N{constructor(){super(...arguments),this.parameters={min:U(1,"spawn")},this.bindingAdapter=H((e,t)=>{e.resetMass(t.min)})}make(e={}){return new x(e.min)}},velocity:new class extends N{constructor(){super(...arguments),this.parameters={velocity:_([0,0,0],"spawn")},this.bindingAdapter={buildBound:e=>new O(()=>e.get("velocity"))}}make(e={}){const{x:t,y:s,z:n}=e.velocity;return new O(new a(t,s,n))}},randomVelocity:new class extends N{constructor(){super(...arguments),this.parameters={min:_([0,0,0],"spawn"),max:_([0,0,0],"spawn")},this.bindingAdapter={buildBound:e=>new O(()=>e.get("min"),()=>e.get("max"))}}make(e={}){return new O(e.min,e.max)}},radialVelocity:new class extends N{constructor(){super(...arguments),this.parameters={speed:U(1,"spawn"),direction:_([0,1,0],"spawn"),spread:U(0,"spawn")},this.bindingAdapter=H((e,t)=>{e.resetRadialVelocity(t.speed,ae(t.direction),t.spread)})}make(e={}){return new g(e.speed,ae(e.direction),e.spread)}},randomDirection:new class extends N{constructor(){super(...arguments),this.parameters={speed:U(1,"spawn")},this.bindingAdapter=H((e,t)=>{e.setSpeed(t.speed)})}make(e={}){return new F(e.speed)}}},we={force:new class extends J{constructor(){super(...arguments),this.parameters={force:_([0,0,0],"live"),ease:ne()},this.bindingAdapter=G((e,t)=>{const s=t.force;e.setForce(s.x,s.y,s.z)})}make(e={}){return new m(e.force.x,e.force.y,e.force.z,void 0,me(e.ease))}},gravity:new class extends J{constructor(){super(...arguments),this.parameters={gravity:U(8,"live"),easing:ne()},this.bindingAdapter=G((e,t)=>{e.setForce(0,-t.gravity,0)})}make(e={}){return new l(e.gravity,void 0,me(e.easing))}},repulsion:new class extends J{constructor(){super(...arguments),this.parameters={target:_([0,0,0],"live"),force:U(1,"live"),radius:U(1,"live"),easing:ne()},this.bindingAdapter=G((e,t)=>{e.resetAttraction(ae(t.target),t.force,t.radius)})}make(e={}){const t=ae(e.target);return new y(t,e.force,e.radius,void 0,me(e.easing))}},attraction:new class extends J{constructor(){super(...arguments),this.parameters={target:_([0,0,0],"live"),force:U(1,"live"),radius:U(1,"live"),easing:ne()},this.bindingAdapter=G((e,t)=>{e.resetAttraction(ae(t.target),t.force,t.radius)})}make(e={}){const t=ae(e.target);return new o(t,e.force,e.radius,void 0,me(e.easing))}},scale:new class extends J{constructor(){super(...arguments),this.parameters={a:U(1,"spawn"),b:U(1,"spawn"),ease:ne()},this.bindingAdapter=H((e,t)=>{e.setScaleRange(t.a,t.b)})}make(e={}){return new j(e.a,e.b,me(e.ease))}},scaleComponents:new class extends J{constructor(){super(...arguments),this.parameters={a:_([1,1,1],"spawn"),b:_([1,1,1],"spawn"),ease:ne()},this.bindingAdapter=H((e,t)=>{e.setScaleRange(t.a,t.b)})}make(e={}){return new B(e.a,e.b,me(e.ease))}},randomDrift:new class extends J{constructor(){super(...arguments),this.parameters={drift:_([1,1,1],"live"),delay:U(0,"live"),ease:ne()},this.bindingAdapter=G((e,t)=>{const s=t.drift;e.setDrift(s.x,s.y,s.z,t.delay)})}make(e={}){return new b(e.drift.x,e.drift.y,e.drift.z,e.delay,void 0,me(e.ease))}},disperse:new class extends J{constructor(){super(...arguments),this.parameters={distance:U(1,"spawn"),axis:se(["XYZ","XZ","XY","YZ"],"XYZ"),ease:ne()},this.bindingAdapter=H((e,t)=>{e.setDistance(t.distance)})}make(e={}){return new L(e.distance,R[e.axis.toLowerCase()],me(e.ease))}},rotate:new class extends J{constructor(){super(...arguments),this.parameters={rotation:_([0,0,0],"spawn"),ease:ne()},this.bindingAdapter=H((e,t)=>{const s=ie(t.rotation);e.resetRotation(s.x,s.y,s.z)})}make(e={}){const t=ie(e.rotation);return new v(t.x,t.y,t.z,void 0,me(e.ease))}},rotateAdd:new class extends J{constructor(){super(...arguments),this.parameters={rotation:_([0,0,0],"spawn")},this.bindingAdapter=H((e,t)=>{const s=ie(t.rotation);e.resetRotation(s.x,s.y,s.z)})}make(e={}){const t=ie(e.rotation),s=new v(t.x,t.y,t.z,void 0);return s.rotationType="add",s}},changeColor:new class extends J{constructor(){super(...arguments),this.parameters={a:te("#ffffff","spawn"),b:te("#ffffff","spawn"),ease:ne()},this.bindingAdapter=H((e,t)=>{e.resetColor(t.a,t.b)})}make(e={}){return new d(e.a,e.b,void 0,me(e.ease))}},changeOpacity:new class extends J{constructor(){super(...arguments),this.parameters={a:U(1,"spawn",0,1),b:U(0,"spawn",0,1),ease:ne()},this.bindingAdapter=H((e,t)=>{e.resetAlpha(t.a,t.b)})}make(e={}){return new i(e.a,e.b,void 0,me(e.ease))}},vortex:new class extends J{constructor(){super(...arguments),this.parameters={axis:_([0,1,0],"live"),amount:U(1,"live")},this.bindingAdapter=G((e,t)=>{e.setAxisAngle(t.axis,t.amount)})}make(e={}){return new V(e.axis,e.amount)}},moveTo:new class extends J{constructor(){super(...arguments),this.parameters={target:_([0,1,0],"live"),ease:ne()},this.bindingAdapter=G((e,t)=>{const s=t.target;e.setTarget(s.x,s.y,s.z)})}make(e={}){return new C(e.target.x,e.target.y,e.target.z,me(e.ease))}},linearDamping:new class extends J{constructor(){super(...arguments),this.parameters={factor:U(.1,"live",0,1e3)},this.bindingAdapter=G((e,t)=>{e.setFactor(t.factor)})}make(e={}){return new S(e.factor)}},followParent:new class extends J{constructor(){super(...arguments),this.parameters={speed:U(0,"live")},this.bindingAdapter=G((e,t)=>{e.setSpeed(t.speed)})}make(e={}){return new D(e.speed)}},worldCollision:new class extends J{constructor(){super(...arguments),this.parameters={friction:Q(1,0,1),bounce:Q(1,0,1),lifeLoss:Q(0,0)}}make(e={}){return new q(null,e.bounce,e.friction,e.lifeLoss)}},animation:new class extends J{constructor(){var e;super(...arguments),this.parameters={clip:{type:"animationclip",default:null},timeScale:Q(1,0,10),weight:Q(1,0,1),loop:se(["Once","Repeat","PingPong"],"Once"),clampWhenFinished:{...(e=!0,{type:"boolean",default:e}),requires:{loop:"Once"}}}}make(n={}){let r=e;return"Repeat"===n.loop?r=s:"PingPong"===n.loop&&(r=t),new A(n.clip,n.timeScale,n.weight,r,n.clampWhenFinished,u.easeLinear)}}};export const VfxInitializserLibrary=le;export const VfxInitializserLibraryKeys=Object.keys(VfxInitializserLibrary);export const VfxBehaviourLibrary=we;export const VfxBehaviourLibraryKeys=Object.keys(VfxBehaviourLibrary);/*
|
|
2
2
|
* Copyright (©) 2026 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { VfxEffectInputDefinition } from './vfx-asset.js';
|
|
3
|
+
export declare class VfxInputRuntime {
|
|
4
|
+
private readonly definitions;
|
|
5
|
+
private readonly inputIdsByName;
|
|
6
|
+
private readonly values;
|
|
7
|
+
constructor(definitions?: VfxEffectInputDefinition[]);
|
|
8
|
+
setDefinitions(definitions?: VfxEffectInputDefinition[]): void;
|
|
9
|
+
getDefinitions(): VfxEffectInputDefinition[];
|
|
10
|
+
getDefinition(inputNameOrId: string): VfxEffectInputDefinition | undefined;
|
|
11
|
+
setInput(inputNameOrId: string, value: unknown): void;
|
|
12
|
+
getNumber(inputNameOrId: string, fallback?: number): number;
|
|
13
|
+
getVector3(inputNameOrId: string, fallback?: THREE.Vector3): THREE.Vector3;
|
|
14
|
+
getColor(inputNameOrId: string, fallback?: THREE.Color): THREE.Color;
|
|
15
|
+
private getValue;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=vfx-input-runtime.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import*as e from"three";export class VfxInputRuntime{constructor(e=[]){this.definitions=new Map,this.inputIdsByName=new Map,this.values=new Map,this.setDefinitions(e)}setDefinitions(e=[]){this.definitions.clear(),this.inputIdsByName.clear(),this.values.clear();for(const n of e)this.definitions.set(n.id,n),this.inputIdsByName.set(n.name,n.id),this.values.set(n.id,t(n.type,n.defaultValue,n.defaultValue))}getDefinitions(){return Array.from(this.definitions.values())}getDefinition(e){const t=this.definitions.has(e)?e:this.inputIdsByName.get(e);return null!=t?this.definitions.get(t):void 0}setInput(e,n){const i=this.getDefinition(e);null!=i&&this.values.set(i.id,t(i.type,n,i.defaultValue))}getNumber(e,t=0){const n=this.getValue(e);return"number"==typeof n?n:t}getVector3(t,n=new e.Vector3){const i=this.getValue(t);return i instanceof e.Vector3?i:n}getColor(t,n=new e.Color("#ffffff")){const i=this.getValue(t);return i instanceof e.Color?i:n}getValue(e){const t=this.getDefinition(e);return null!=t?this.values.get(t.id):void 0}}function t(t,i,r){switch(t){case"number":return n(i,r);case"vec3":return function(t,i){if(t instanceof e.Vector3)return t.clone();if(Array.isArray(t)&&t.length>=3)return new e.Vector3(n(t[0]),n(t[1]),n(t[2]));if(i instanceof e.Vector3)return i.clone();if(Array.isArray(i)&&i.length>=3)return new e.Vector3(n(i[0]),n(i[1]),n(i[2]));return new e.Vector3}(i,r);case"color":return function(t,n){if(t instanceof e.Color)return t.clone();if("string"==typeof t||"number"==typeof t)return new e.Color(t);if(n instanceof e.Color)return n.clone();if("string"==typeof n||"number"==typeof n)return new e.Color(n);return new e.Color("#ffffff")}(i,r)}}function n(e,t){if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){const t=parseFloat(e);if(Number.isFinite(t))return t}return"number"==typeof t?t:0}/*
|
|
2
|
+
* Copyright (©) 2026 Hology Interactive AB. All rights reserved.
|
|
3
|
+
* See the LICENSE.md file for details.
|
|
4
|
+
*/
|
|
@@ -7,13 +7,14 @@ import { Asset, VfxAsset } from '../../scene/model.js';
|
|
|
7
7
|
import { ShaderProvider } from "../../gameplay/services/shader-provider.js";
|
|
8
8
|
import { AssetResourceLoader } from "../../scene/asset-resource-loader.js";
|
|
9
9
|
import { AssetsProvider } from "../../scene/assets-provider.js";
|
|
10
|
+
import { VfxInputRuntime } from "./vfx-input-runtime.js";
|
|
10
11
|
export type VfxAssetProvider = {
|
|
11
12
|
getAsset(assetId: string): Promise<Asset>;
|
|
12
13
|
getTexture(assetId: string): Promise<THREE.Texture>;
|
|
13
14
|
getMesh(assetId: string): Promise<THREE.Object3D>;
|
|
14
15
|
getMaterial(assetId: string): Promise<THREE.Material>;
|
|
15
16
|
};
|
|
16
|
-
export declare function materializeVfx(asset: VfxAsset, target: Object3D, assetProvider: VfxAssetProvider, view: ViewController, physics: PhysicsSystem, shaderProvider: ShaderProvider, assetsService: AssetsProvider, assetManagerService: AssetResourceLoader): Promise<{
|
|
17
|
+
export declare function materializeVfx(asset: VfxAsset, target: Object3D, assetProvider: VfxAssetProvider, view: ViewController, physics: PhysicsSystem, shaderProvider: ShaderProvider, assetsService: AssetsProvider, assetManagerService: AssetResourceLoader, inputRuntime?: VfxInputRuntime): Promise<{
|
|
17
18
|
container: THREE.Object3D<THREE.Object3DEventMap, Event>;
|
|
18
19
|
system: System;
|
|
19
20
|
dispose: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{Behaviour as t,Body as a,Emitter as s,Rate as n}from"@hology/nebula";import*as i from"three";import{Object3D as r}from"three";import{AttributeVec3Node as o,AttributeVec4Node as l,NodeShaderMaterial as c,RgbNode as u,UniformFloatNode as p,UniformVec3Node as m,Vec3ExpressionNode as h,Vec4Node as d,attributeFloat as f,attributeVec3 as y,attributeVec4 as w,attributes as g,clamp as b,float as v,glslFunction as A,lambertMaterial as E,log as M,pow as x,rgb as I,rgba as T,smoothstep as P,standardMaterial as S,textureSampler2d as B,uniformFloat as C,uniforms as R,varying as k,varyingAttributes as j,varyingVec3 as D,varyingVec4 as z}from"three-shader-graph";import{prepareClassParameters as V,prepareShapeParameters as F}from"../../scene/materializer.js";import{SerializedParamType as L}from"../../scene/model.js";import{ShapeLibrary as O}from"../../scene/objects/shapes.js";import{fragmentLinearEyeDepth as Q,linearEyeDepth as W}from"../../shader-nodes/depth.js";import{particleEnergyUniformName as H,particleTimeUniformName as U,particleUniforms as q,particleVelcoityUniformName as G}from"../../shader-nodes/particle.js";import{sampleFlipbook as J}from"../../shader-nodes/texture-sequence.js";import{DefaultInitializer as N}from"./initializsers.js";import{DelayRate as K,OnceRate as Y}from"./rates.js";import{StretchedSprite as X}from"./stretched-sprite.js";import{ThreeBlendingMode as Z}from"./vfx-asset.js";import{VfxBehaviourLibrary as _,VfxInitializserLibrary as $}from"./vfx-defs.js";import{MultiRenderer as ee}from"./vfx-renderers.js";import{WorldCollisionBehaviour as te}from"./vfx-collision-behaviour.js";import{getSpritePosition as ae,SpriteNodeShaderMaterial as se}from"../../shader/sprite-shader.js";import{DecalUnlitShader as ne}from"../../shader/builtin/decal-unlit-shader.js";import{DecalStandardShader as ie}from"../../shader/builtin/decal-standard-shader.js";export async function materializeVfx(t,a,s,n,o,l,c,u){let p=a;for(;null!=p.parent;)p=p.parent;const m=new r;m.name="particle system local",a.add(m);const h=new r;h.name="particle system world";const d=new ee(h,m,i,n),f=new e;return(await Promise.all(t.vfx.emitters.slice().sort((e,t)=>(t.output.renderOrder??0)-(e.output.renderOrder??0)).map(async e=>{const t=await re(e,s,c,u,f,o,l);return t.setParentRecursive(f),t.emit()}))).forEach(e=>f.addEmitter(e)),f.addRenderer(d).emit({onEnd:()=>{}}),{container:h,system:f,dispose:()=>{h.removeFromParent(),m.removeFromParent(),d.dispose()}}}async function re(e,t,s,u,v,x,I){const S=function(e){let t;switch(e.rate.type){case"continuous":t=new K(e.rate.delay??0,e.rate.count,e.rate.time,e.rate.duration);break;case"once":t=new Y(e.rate.delay??0,e.rate.count);break;default:console.warn(`Failed to configure rate for emitter: ${JSON.stringify(e)}`),t=new n(0,1/0)}return t}(e);let D;switch(e.output.type){case"decal":D=new a(await async function(e,t){const a=!1!==e.unlit?new ne:new ie;a.color=new i.Color(e.color),a instanceof ne?a.intensity=e.intensity??1:a.emissiveIntensity=e.intensity??1;if(e.colorMap){const s=await t.getTexture(e.colorMap);a.colorMap=s}if(e.alphaMap){const s=await t.getTexture(e.alphaMap);a.alphaMap=s}const s=a.build();s.blending=Z[e.blendingMode]??i.NormalBlending,s.transparent=!0,s.side=i.BackSide,s.depthTest=!1,null!=s&&!0===e.bloom&&(s.userData.hasBloom=!0);s.defines.IS_PARTICLE="";const n=new i.BoxGeometry(1,1,1),r=new i.Mesh(n,s);null!=e.renderOrder&&(r.renderOrder=e.renderOrder);return r}(e.output,t));break;case"sprite":D=new a(await async function(e,t,a){let s=null;s=null!=e.shader?await le(e,t,a):await async function(e,t){const a=null!=e.texture?await t.getTexture(e.texture):oe,s=B(a);let n=s.sample(j.uv);e.flipbook?.enabled&&(n=J(s,g.uv,e.flipbook.columns,e.flipbook.rows,q.time,e.flipbook.fps,e.flipbook.mode));const r=new p("rotation",0),o=new m("color").rgb,l=C("opacity",1),c=W.subtract(Q).divide(W);let u=l;switch(e.opacityChannel??"red"){case"none":break;case"red":u=u.multiply(n.r);break;case"alpha":u=u.multiply(n.a)}if("number"==typeof e.softness&&e.softness>0){const t=b(c,0,1e3);u=u.multiply(P(0,.2*e.softness,t))}const h=ae(r),d=T(o.multiply(n.rgb).multiplyScalar(e.intensity??1),u);var f=new se({color:d,emissive:d.rgb.multiplyScalar(u),transparent:!0,position:h,alphaTest:1e-4,uniforms:{color:{value:new i.Color(e.color)}}});f.alphaHash=!0,null!=f&&!0===e.bloom&&(f.userData.hasBloom=!0);return f.blending=Z[e.blendingMode]??i.NormalBlending,f}(e,t);s instanceof i.ShaderMaterial&&!0===e.lockY&&(s.defines.LOCK_Y_AXIS="");const n=new i.Mesh(new i.PlaneGeometry(1,1),s);return n.name="sprite",n}(e.output,t,I));break;case"stretchedSprite":D=new a(await async function(e,t){const a=null!=e.texture?await t.getTexture(e.texture):oe,s=B(a).sample(j.uv),n=z(new l("color")),r=n.rgb.multiply(s.rgb);let o=n.w;switch(e.opacityChannel??"red"){case"none":break;case"red":o=o.multiply(s.r);break;case"alpha":o=o.multiply(s.a)}if("number"==typeof e.softness&&e.softness>0){const t=W.subtract(Q).divide(M(W)),a=b(t,0,1e3);o=o.multiply(P(0,.2*e.softness,a))}const c=A(d,{position:g.position,offset:y("offset"),modelViewMatrix:R.modelViewMatrix,velocity:w("velocity"),size:y("size"),rotation:f("rotation")},"\n float lengthFactor = velocity.w;\n float avgSize = (size.x + size.y) * 0.5;\n\n vec4 mvPosition = modelViewMatrix * vec4( offset , 1.0 );\n vec3 viewVelocity = normalMatrix * velocity.xyz;\n float vlength = length(viewVelocity); \n mvPosition.xyz += position.y * normalize(cross(mvPosition.xyz, viewVelocity)) * avgSize; \n mvPosition.xyz -= (position.x + 0.5) * viewVelocity * (1.0 + lengthFactor / vlength) * avgSize;\n return projectionMatrix * mvPosition;\n ");var u=new se({color:T(r.multiplyScalar(e.intensity??1),o),alphaTest:.1,transparent:!0,position:c,uniforms:{color:{value:new i.Color(e.color)}}});null!=u&&!0===e.bloom&&(u.userData.hasBloom=!0);u.blending=Z[e.blendingMode]??i.NormalBlending;const p=new X(new i.PlaneGeometry(1,1),u);return p.scaleFactor=e.scale,p}(e.output,t));break;case"shape":D=new a(await async function(e,t,a){if(null==e.shape)return console.log("Shape is null"),new r;const s=O[e.shape];if(null==s)return console.error(`No shape with type ${e.shape}`),new r;const n=F(e.params??{}),l=s.geometry(n);let u=null;u=null!=e.shader?await le(e,t,a):null!=e.material?ce(await t.getMaterial(e.material)):function(){const e=k(new h("instanceColor")).rgb,t=k(new o("particleData")).x;return new c({color:E({color:e}).rgb.rgba(t),opacity:t,transparent:!0})}();null!=u&&!0===e.bloom&&(u.userData.hasBloom=!0);return new i.Mesh(l,u)}(e.output,t,I));break;case"mesh":D=new a(await async function(e,t,a){if(null==e.assetId)return console.warn("Can't use mesh as particle without asset id"),new r;const s=await t.getMesh(e.assetId),n=await t.getAsset(e.assetId);if(null!=e.shader||null!=e.material){let n;n=null!=e.shader?await le(e,t,a):ce(await t.getMaterial(e.material)),null!=n&&!0===e.bloom&&(n.userData.hasBloom=!0),null!=n&&!0===e.bloom&&(n.userData.hasBloom=!0),s.traverse(e=>{e instanceof i.Mesh&&(e.material=n)})}else{const e=[];if(null!=n.materialAssignments)for(const a of n.materialAssignments)s.traverse(s=>{s instanceof i.Mesh&&s.material instanceof i.Material&&s.material.color instanceof i.Color&&(s.material.name!=a.name&&null!=a.name||"#"+s.material.color.getHexString()!==a.color||e.push(t.getMaterial(a.materialId).then(e=>s.material=e)))});await Promise.all(e)}const o=[];if(s.traverse(e=>{e instanceof i.Mesh&&o.push(e)}),1===o.length){const e=o[0];return e.updateWorldMatrix(!0,!0),e.updateMatrixWorld(),e.matrix.copy(e.matrixWorld),e.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.removeFromParent(),e}return s}(e.output,t,I));break;case"trail":D=new a({type:"trail",taper:e.output.taper,headGeometry:null,dragTexture:!1,texture:null!=e.output.texture?await t.getTexture(e.output.texture):null,opacityChannel:e.output.opacityChannel,color:e.output.color,colorEnd:e.output.colorEnd,intensity:e.output.intensity??1,intensityEnd:e.output.intensityEnd??1,length:e.output.length,opacityStart:e.output.opacityStart,opacityEnd:e.output.opacityEnd,bloom:e.output.bloom,scrollSpeed:e.output.scrollSpeed,width:e.output.width,billboard:e.output.billboard??!1});break;default:console.error("Failed to create particly system body: "+JSON.stringify(e))}const V=new pe;V.parent=v,V.setRate(S),V._space=e.output.space;const H=await Promise.all(e.initializers.filter(e=>!1!==e.enabled).filter(e=>null!=$[e.type]).map(async e=>{const t=$[e.type],a=await F(e.params??{});return t.build(a)}));H.push(D,new N),V.addInitializers(H);const U=await Promise.all(e.behaviours.filter(e=>!1!==e.enabled).filter(e=>null!=_[e.type]).map(async e=>{const t=_[e.type];for(const[a,s]of Object.entries(e.params))t.parameters&&null!=t.parameters[a]&&"curve"===t.parameters[a].type&&s.type!==L.Curve&&(s.type=L.Curve);const a=await F(e.params??{},s,u);return t.build(a)}).sort((e,t)=>e instanceof te?1:0));U.push(new ue);for(const e of U)e instanceof te&&(e.physics=x);V.addBehaviours(U);for(const a of e.children){const e=await re(a,t,s,u,v,x,I),n=new EmitterPool(()=>{const t=e.clone();return t.onExpired=()=>{const e=V.childEmitters.findIndex(e=>e.id===t.id);-1!=e&&V.childEmitters.splice(e,1),n.release(t)},t}),i=V.eventDispatcher,r=new Map;V.bindEmitterEvent=!0,i.addEventListener("PARTICLE_DEAD",e=>{const t=r.get(e.id);if(null!=t){const e=V.childEmitters.findIndex(e=>e.id===t.id);null!=e&&(t.stopEmit(),V.childEmitters.splice(e,1))}});let o="PARTICLE_CREATED";if("spawnEvent"in a)switch(a.spawnEvent){case"collision":o="PARTICLE_COLLISION";break;case"start":o="PARTICLE_CREATED"}i.addEventListener(o,e=>{const t=n.get();t.age=0,t.totalEmitTimes=-1,t.particles.length=0,t.currentEmitTime=0,t.cID=0,t.eventDispatcher.removeAllEventListeners(),V.childEmitters.push(t),r.set(e.id,t),t.parentParticle=e,t.system=V.system,t.emit()})}return V}const oe=(new i.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJkSURBVHjaxJeJbusgEEW94S1L//83X18M2MSuLd2pbqc4wZGqRLrKBsyZhQHny7Jk73xVL8xpVhWrcmiB5lX+6GJ5YgQ2owbAm8oIwH1VgKZUmGcRqKGGPgtEQQAzGR8hQ59fAmhJHSAagigJ4E7GPWRXOYC6owAd1JM6wDQPADyMWUqZRMqmAojHp1Vn6EQQEgUNMJLnUjMyJsM49wygBkAPw9dVFwXRkncCIIW3GRgoTQUZn6HxCMAFEFd8TwEQ78X4rHbILoAUmeT+RFG4UhQ6MiIAE4W/UsYFjuVjAIa2nIY4q1R0GFtQWG3E84lqw2GO2QOoCKBVu0BAPgDSU0eUDjjQenNkV/AW/pWChhpMTelo1a64AOKM30vk18GzTHXCNtI/Knz3DFBgsUqBGIjTInXRY1yA9xkVoqW5tVq3pDR9A0hfF5BSARmVnh7RMDCaIdcNgbPBkgzn1Bu+SfIEFSpSBmkxyrMicb0fAEuCZrWnN89veA/4XcakrPcjBWzkTuLjlbfTQPOlBhz+HwkqqPXmPQDdrQItxE1moGof1S74j/8txk8EHhTQrAE8qlwfqS5yukm1x/rAJ9Jiaa6nyATqD78aUVBhFo8b1V4DdTXdCW+IxA1zB4JhiOhZMEWO1HqnvdoHZ4FAMIhV9REF8FiUm0jsYPEJx/Fm/N8OhH90HI9YRHesWbXXZwAShU8qThe7H8YAuJmw5yOd989uRINKRTJAhoF8jbqrHKfeCYdIISZfSq26bk/K+yO3YvfKrVgiwQBHnwt8ynPB25+M8hceTt/ybPhnryJ78+tLgAEAuCFyiQgQB30AAAAASUVORK5CYII=");async function le(e,t,a){const s=a.get(e.shader);if(null==s)return console.error("No shader exists with name "+e.shader),new i.Material;const n=new s.type,r=await V(e.shaderParams,s.type,t,{getTexture:e=>t.getTexture(e.id),getMaterial:e=>t.getMaterial(e.id),getMesh:e=>t.getMesh(e.id)},void 0,void 0,void 0,void 0);return Object.assign(n,r),n.build()}function ce(e){const t=k(new h("instanceColor")).rgb;let a,s=k(new o("particleData")).x;if(e instanceof i.MeshStandardMaterial||e instanceof i.MeshLambertMaterial||e instanceof i.MeshBasicMaterial){let n=t.multiply(I(e.color));null!=e.map&&(n=n.multiply(B(e.map).sample(j.uv).rgb)),null!=e.alphaMap&&(s=s.multiply(B(e.alphaMap).sample(j.uv).r)),e instanceof i.MeshStandardMaterial?a=new c({color:S({color:n,emissive:I(e.emissive),emissiveIntensity:v(e.emissiveIntensity),roughness:e.roughness,metalness:e.metalness}).rgb.rgba(s),emissive:I(e.emissive).multiplyScalar(e.emissiveIntensity),transparent:e.transparent,opacity:s,alphaTest:e.alphaTest}):e instanceof i.MeshLambertMaterial?a=new c({color:E({color:n}).rgb.rgba(s),emissive:I(e.emissive).multiplyScalar(e.emissiveIntensity),transparent:e.transparent,opacity:s,alphaTest:e.alphaTest}):e instanceof i.MeshBasicMaterial&&(a=new c({color:n.rgb.rgba(s),emissive:n.rgb,transparent:e.transparent,opacity:s,alphaTest:e.alphaTest}))}else e instanceof c&&(a=e.clone(),a.defines.IS_PARTICLE="");return null!=a&&(!0===e.userData?.hasBloom&&null!=a&&(a.userData.hasBloom=!0),a.side=e.side,a.transparent=e.transparent),a??e}class ue extends t{initialize(e){e.body instanceof i.Object3D&&e.body.traverse(e=>{if(e instanceof i.Mesh){const t=e.material;t instanceof c&&(null!=t.uniforms[H]||null!=t.uniforms[U]||t.uniforms[G])}})}mutate(e,t,a){this.energize(e,t),e.target instanceof r&&e.target.traverse(t=>{if(t instanceof i.Mesh){const a=t.material;a instanceof c&&(null!=a.uniforms[H]&&(a.uniforms[H].value=this.energy),null!=a.uniforms[U]&&(a.uniforms[U].value=e.age),null!=a.uniforms[G]&&(a.uniforms[G].value=e.velocity))}})}}class pe extends s{constructor(){super(...arguments),this.childEmitters=[],this.bindEmitterEvent=!1,this.onExpired=()=>{}}update(e){if(!this.isEmitting&&0===this.particles.length)return;this.age+=e,(this.dead||this.age>=this.life)&&this.destroy(),this.generate(e),this.integrate(e);let t=this.particles.length;for(;t--;){const e=this.particles[t];e.dead&&(this.system&&this.system.dispatch("PARTICLE_DEAD",e),this.bindEmitterEvent&&this.dispatch("PARTICLE_DEAD",e),this.system.pool.expire(e.reset()),this.particles.splice(t,1))}this.updateEmitterBehaviours(e),this.updateChildren(e),this.isEmitting||0!==this.particles.length||this.onExpired()}updateChildren(e){for(const t of this.childEmitters)null!=t.parentParticle?t.position.copy(t.parentParticle.position):t.setPosition(this.position),t.update(e)}clone(){const e=new pe;return e.setRate(this.rate.clone()),e.behaviours=this.behaviours,e.initializers=this.initializers,e._space=this._space,e.body=this.body,e.parent=this.parent,e.system=this.system,e}setParentRecursive(e){this.system=e,this.childEmitters.forEach(t=>t.setParentRecursive(e))}}export class EmitterPool{constructor(e){this.creator=e,this.instances=[]}get(){0==this.instances.length&&this.instances.push(this.creator());return this.instances.pop()}release(e){this.instances.push(e)}dispose(){this.instances.length=0}}/*
|
|
1
|
+
import e,{Behaviour as t,Body as a,Emitter as s,Rate as n}from"@hology/nebula";import*as i from"three";import{Object3D as r}from"three";import{AttributeVec3Node as o,AttributeVec4Node as l,NodeShaderMaterial as c,RgbNode as u,UniformFloatNode as p,UniformVec3Node as m,Vec3ExpressionNode as h,Vec4Node as d,attributeFloat as f,attributeVec3 as y,attributeVec4 as w,attributes as g,clamp as b,float as v,glslFunction as A,lambertMaterial as E,log as M,pow as x,rgb as I,rgba as T,smoothstep as P,standardMaterial as S,textureSampler2d as B,uniformFloat as C,uniforms as R,varying as k,varyingAttributes as j,varyingVec3 as D,varyingVec4 as z}from"three-shader-graph";import{prepareClassParameters as V,prepareShapeParameters as F}from"../../scene/materializer.js";import{SerializedParamType as L}from"../../scene/model.js";import{ShapeLibrary as O}from"../../scene/objects/shapes.js";import{fragmentLinearEyeDepth as Q,linearEyeDepth as W}from"../../shader-nodes/depth.js";import{particleEnergyUniformName as H,particleTimeUniformName as U,particleUniforms as q,particleVelcoityUniformName as G}from"../../shader-nodes/particle.js";import{sampleFlipbook as J}from"../../shader-nodes/texture-sequence.js";import{DefaultInitializer as N}from"./initializsers.js";import{DelayRate as K,OnceRate as Y}from"./rates.js";import{StretchedSprite as X}from"./stretched-sprite.js";import{ThreeBlendingMode as Z}from"./vfx-asset.js";import{VfxBehaviourLibrary as _,VfxInitializserLibrary as $}from"./vfx-defs.js";import{MultiRenderer as ee}from"./vfx-renderers.js";import{WorldCollisionBehaviour as te}from"./vfx-collision-behaviour.js";import{getSpritePosition as ae,SpriteNodeShaderMaterial as se}from"../../shader/sprite-shader.js";import{DecalUnlitShader as ne}from"../../shader/builtin/decal-unlit-shader.js";import{DecalStandardShader as ie}from"../../shader/builtin/decal-standard-shader.js";import{createBoundBehaviour as re,createBoundInitializer as oe}from"./vfx-binding-runtime.js";export async function materializeVfx(t,a,s,n,o,l,c,u,p){let m=a;for(;null!=m.parent;)m=m.parent;const h=new r;h.name="particle system local",a.add(h);const d=new r;d.name="particle system world";const f=new ee(d,h,i,n),y=new e;return(await Promise.all(t.vfx.emitters.slice().sort((e,t)=>(t.output.renderOrder??0)-(e.output.renderOrder??0)).map(async e=>{const t=await le(e,s,c,u,y,o,l,p);return t.setParentRecursive(y),t.emit()}))).forEach(e=>y.addEmitter(e)),y.addRenderer(f).emit({onEnd:()=>{}}),{container:d,system:y,dispose:()=>{d.removeFromParent(),h.removeFromParent(),f.dispose()}}}async function le(e,t,s,u,v,x,I,S){const D=function(e){let t;switch(e.rate.type){case"continuous":t=new K(e.rate.delay??0,e.rate.count,e.rate.time,e.rate.duration);break;case"once":t=new Y(e.rate.delay??0,e.rate.count);break;default:console.warn(`Failed to configure rate for emitter: ${JSON.stringify(e)}`),t=new n(0,1/0)}return t}(e);let V;switch(e.output.type){case"decal":V=new a(await async function(e,t){const a=!1!==e.unlit?new ne:new ie;a.color=new i.Color(e.color),a instanceof ne?a.intensity=e.intensity??1:a.emissiveIntensity=e.intensity??1;if(e.colorMap){const s=await t.getTexture(e.colorMap);a.colorMap=s}if(e.alphaMap){const s=await t.getTexture(e.alphaMap);a.alphaMap=s}const s=a.build();s.blending=Z[e.blendingMode]??i.NormalBlending,s.transparent=!0,s.side=i.BackSide,s.depthTest=!1,null!=s&&!0===e.bloom&&(s.userData.hasBloom=!0);s.defines.IS_PARTICLE="";const n=new i.BoxGeometry(1,1,1),r=new i.Mesh(n,s);null!=e.renderOrder&&(r.renderOrder=e.renderOrder);return r}(e.output,t));break;case"sprite":V=new a(await async function(e,t,a){let s=null;s=null!=e.shader?await ue(e,t,a):await async function(e,t){const a=null!=e.texture?await t.getTexture(e.texture):ce,s=B(a);let n=s.sample(j.uv);e.flipbook?.enabled&&(n=J(s,g.uv,e.flipbook.columns,e.flipbook.rows,q.time,e.flipbook.fps,e.flipbook.mode));const r=new p("rotation",0),o=new m("color").rgb,l=C("opacity",1),c=W.subtract(Q).divide(W);let u=l;switch(e.opacityChannel??"red"){case"none":break;case"red":u=u.multiply(n.r);break;case"alpha":u=u.multiply(n.a)}if("number"==typeof e.softness&&e.softness>0){const t=b(c,0,1e3);u=u.multiply(P(0,.2*e.softness,t))}const h=ae(r),d=T(o.multiply(n.rgb).multiplyScalar(e.intensity??1),u);var f=new se({color:d,emissive:d.rgb.multiplyScalar(u),transparent:!0,position:h,alphaTest:1e-4,uniforms:{color:{value:new i.Color(e.color)}}});f.alphaHash=!0,null!=f&&!0===e.bloom&&(f.userData.hasBloom=!0);return f.blending=Z[e.blendingMode]??i.NormalBlending,f}(e,t);s instanceof i.ShaderMaterial&&!0===e.lockY&&(s.defines.LOCK_Y_AXIS="");const n=new i.Mesh(new i.PlaneGeometry(1,1),s);return n.name="sprite",n}(e.output,t,I));break;case"stretchedSprite":V=new a(await async function(e,t){const a=null!=e.texture?await t.getTexture(e.texture):ce,s=B(a).sample(j.uv),n=z(new l("color")),r=n.rgb.multiply(s.rgb);let o=n.w;switch(e.opacityChannel??"red"){case"none":break;case"red":o=o.multiply(s.r);break;case"alpha":o=o.multiply(s.a)}if("number"==typeof e.softness&&e.softness>0){const t=W.subtract(Q).divide(M(W)),a=b(t,0,1e3);o=o.multiply(P(0,.2*e.softness,a))}const c=A(d,{position:g.position,offset:y("offset"),modelViewMatrix:R.modelViewMatrix,velocity:w("velocity"),size:y("size"),rotation:f("rotation")},"\n float lengthFactor = velocity.w;\n float avgSize = (size.x + size.y) * 0.5;\n\n vec4 mvPosition = modelViewMatrix * vec4( offset , 1.0 );\n vec3 viewVelocity = normalMatrix * velocity.xyz;\n float vlength = length(viewVelocity); \n mvPosition.xyz += position.y * normalize(cross(mvPosition.xyz, viewVelocity)) * avgSize; \n mvPosition.xyz -= (position.x + 0.5) * viewVelocity * (1.0 + lengthFactor / vlength) * avgSize;\n return projectionMatrix * mvPosition;\n ");var u=new se({color:T(r.multiplyScalar(e.intensity??1),o),alphaTest:.1,transparent:!0,position:c,uniforms:{color:{value:new i.Color(e.color)}}});null!=u&&!0===e.bloom&&(u.userData.hasBloom=!0);u.blending=Z[e.blendingMode]??i.NormalBlending;const p=new X(new i.PlaneGeometry(1,1),u);return p.scaleFactor=e.scale,p}(e.output,t));break;case"shape":V=new a(await async function(e,t,a){if(null==e.shape)return console.log("Shape is null"),new r;const s=O[e.shape];if(null==s)return console.error(`No shape with type ${e.shape}`),new r;const n=F(e.params??{}),l=s.geometry(n);let u=null;u=null!=e.shader?await ue(e,t,a):null!=e.material?pe(await t.getMaterial(e.material)):function(){const e=k(new h("instanceColor")).rgb,t=k(new o("particleData")).x;return new c({color:E({color:e}).rgb.rgba(t),opacity:t,transparent:!0})}();null!=u&&!0===e.bloom&&(u.userData.hasBloom=!0);return new i.Mesh(l,u)}(e.output,t,I));break;case"mesh":V=new a(await async function(e,t,a){if(null==e.assetId)return console.warn("Can't use mesh as particle without asset id"),new r;const s=await t.getMesh(e.assetId),n=await t.getAsset(e.assetId);if(null!=e.shader||null!=e.material){let n;n=null!=e.shader?await ue(e,t,a):pe(await t.getMaterial(e.material)),null!=n&&!0===e.bloom&&(n.userData.hasBloom=!0),null!=n&&!0===e.bloom&&(n.userData.hasBloom=!0),s.traverse(e=>{e instanceof i.Mesh&&(e.material=n)})}else{const e=[];if(null!=n.materialAssignments)for(const a of n.materialAssignments)s.traverse(s=>{s instanceof i.Mesh&&s.material instanceof i.Material&&s.material.color instanceof i.Color&&(s.material.name!=a.name&&null!=a.name||"#"+s.material.color.getHexString()!==a.color||e.push(t.getMaterial(a.materialId).then(e=>s.material=e)))});await Promise.all(e)}const o=[];if(s.traverse(e=>{e instanceof i.Mesh&&o.push(e)}),1===o.length){const e=o[0];return e.updateWorldMatrix(!0,!0),e.updateMatrixWorld(),e.matrix.copy(e.matrixWorld),e.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.removeFromParent(),e}return s}(e.output,t,I));break;case"trail":V=new a({type:"trail",taper:e.output.taper,headGeometry:null,dragTexture:!1,texture:null!=e.output.texture?await t.getTexture(e.output.texture):null,opacityChannel:e.output.opacityChannel,color:e.output.color,colorEnd:e.output.colorEnd,intensity:e.output.intensity??1,intensityEnd:e.output.intensityEnd??1,length:e.output.length,opacityStart:e.output.opacityStart,opacityEnd:e.output.opacityEnd,bloom:e.output.bloom,scrollSpeed:e.output.scrollSpeed,width:e.output.width,billboard:e.output.billboard??!1});break;default:console.error("Failed to create particly system body: "+JSON.stringify(e))}const H=new he;H.parent=v,H.setRate(D),H._space=e.output.space;const U=await Promise.all(e.initializers.filter(e=>!1!==e.enabled).filter(e=>null!=$[e.type]).map(async e=>{const t=$[e.type],a=await F(e.params??{});return oe(t,e.params??{},a,S)}));U.push(V,new N),H.addInitializers(U);const G=await Promise.all(e.behaviours.filter(e=>!1!==e.enabled).filter(e=>null!=_[e.type]).map(async e=>{const t=_[e.type];for(const[a,s]of Object.entries(e.params))t.parameters&&null!=t.parameters[a]&&"curve"===t.parameters[a].type&&s.type!==L.Curve&&(s.type=L.Curve);const a=await F(e.params??{},s,u);return re(t,e.params??{},a,S)}).sort((e,t)=>e instanceof te?1:0));G.push(new me);for(const e of G)e instanceof te&&(e.physics=x);H.addBehaviours(G);for(const a of e.children){const e=await le(a,t,s,u,v,x,I,S),n=new EmitterPool(()=>{const t=e.clone();return t.onExpired=()=>{const e=H.childEmitters.findIndex(e=>e.id===t.id);-1!=e&&H.childEmitters.splice(e,1),n.release(t)},t}),i=H.eventDispatcher,r=new Map;H.bindEmitterEvent=!0,i.addEventListener("PARTICLE_DEAD",e=>{const t=r.get(e.id);if(null!=t){const e=H.childEmitters.findIndex(e=>e.id===t.id);null!=e&&(t.stopEmit(),H.childEmitters.splice(e,1))}});let o="PARTICLE_CREATED";if("spawnEvent"in a)switch(a.spawnEvent){case"collision":o="PARTICLE_COLLISION";break;case"start":o="PARTICLE_CREATED"}i.addEventListener(o,e=>{const t=n.get();t.age=0,t.totalEmitTimes=-1,t.particles.length=0,t.currentEmitTime=0,t.cID=0,t.eventDispatcher.removeAllEventListeners(),H.childEmitters.push(t),r.set(e.id,t),t.parentParticle=e,t.system=H.system,t.emit()})}return H}const ce=(new i.TextureLoader).load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJkSURBVHjaxJeJbusgEEW94S1L//83X18M2MSuLd2pbqc4wZGqRLrKBsyZhQHny7Jk73xVL8xpVhWrcmiB5lX+6GJ5YgQ2owbAm8oIwH1VgKZUmGcRqKGGPgtEQQAzGR8hQ59fAmhJHSAagigJ4E7GPWRXOYC6owAd1JM6wDQPADyMWUqZRMqmAojHp1Vn6EQQEgUNMJLnUjMyJsM49wygBkAPw9dVFwXRkncCIIW3GRgoTQUZn6HxCMAFEFd8TwEQ78X4rHbILoAUmeT+RFG4UhQ6MiIAE4W/UsYFjuVjAIa2nIY4q1R0GFtQWG3E84lqw2GO2QOoCKBVu0BAPgDSU0eUDjjQenNkV/AW/pWChhpMTelo1a64AOKM30vk18GzTHXCNtI/Knz3DFBgsUqBGIjTInXRY1yA9xkVoqW5tVq3pDR9A0hfF5BSARmVnh7RMDCaIdcNgbPBkgzn1Bu+SfIEFSpSBmkxyrMicb0fAEuCZrWnN89veA/4XcakrPcjBWzkTuLjlbfTQPOlBhz+HwkqqPXmPQDdrQItxE1moGof1S74j/8txk8EHhTQrAE8qlwfqS5yukm1x/rAJ9Jiaa6nyATqD78aUVBhFo8b1V4DdTXdCW+IxA1zB4JhiOhZMEWO1HqnvdoHZ4FAMIhV9REF8FiUm0jsYPEJx/Fm/N8OhH90HI9YRHesWbXXZwAShU8qThe7H8YAuJmw5yOd989uRINKRTJAhoF8jbqrHKfeCYdIISZfSq26bk/K+yO3YvfKrVgiwQBHnwt8ynPB25+M8hceTt/ybPhnryJ78+tLgAEAuCFyiQgQB30AAAAASUVORK5CYII=");async function ue(e,t,a){const s=a.get(e.shader);if(null==s)return console.error("No shader exists with name "+e.shader),new i.Material;const n=new s.type,r=await V(e.shaderParams,s.type,t,{getTexture:e=>t.getTexture(e.id),getMaterial:e=>t.getMaterial(e.id),getMesh:e=>t.getMesh(e.id)},void 0,void 0,void 0,void 0);return Object.assign(n,r),n.build()}function pe(e){const t=k(new h("instanceColor")).rgb;let a,s=k(new o("particleData")).x;if(e instanceof i.MeshStandardMaterial||e instanceof i.MeshLambertMaterial||e instanceof i.MeshBasicMaterial){let n=t.multiply(I(e.color));null!=e.map&&(n=n.multiply(B(e.map).sample(j.uv).rgb)),null!=e.alphaMap&&(s=s.multiply(B(e.alphaMap).sample(j.uv).r)),e instanceof i.MeshStandardMaterial?a=new c({color:S({color:n,emissive:I(e.emissive),emissiveIntensity:v(e.emissiveIntensity),roughness:e.roughness,metalness:e.metalness}).rgb.rgba(s),emissive:I(e.emissive).multiplyScalar(e.emissiveIntensity),transparent:e.transparent,opacity:s,alphaTest:e.alphaTest}):e instanceof i.MeshLambertMaterial?a=new c({color:E({color:n}).rgb.rgba(s),emissive:I(e.emissive).multiplyScalar(e.emissiveIntensity),transparent:e.transparent,opacity:s,alphaTest:e.alphaTest}):e instanceof i.MeshBasicMaterial&&(a=new c({color:n.rgb.rgba(s),emissive:n.rgb,transparent:e.transparent,opacity:s,alphaTest:e.alphaTest}))}else e instanceof c&&(a=e.clone(),a.defines.IS_PARTICLE="");return null!=a&&(!0===e.userData?.hasBloom&&null!=a&&(a.userData.hasBloom=!0),a.side=e.side,a.transparent=e.transparent),a??e}class me extends t{initialize(e){e.body instanceof i.Object3D&&e.body.traverse(e=>{if(e instanceof i.Mesh){const t=e.material;t instanceof c&&(null!=t.uniforms[H]||null!=t.uniforms[U]||t.uniforms[G])}})}mutate(e,t,a){this.energize(e,t),e.target instanceof r&&e.target.traverse(t=>{if(t instanceof i.Mesh){const a=t.material;a instanceof c&&(null!=a.uniforms[H]&&(a.uniforms[H].value=this.energy),null!=a.uniforms[U]&&(a.uniforms[U].value=e.age),null!=a.uniforms[G]&&(a.uniforms[G].value=e.velocity))}})}}class he extends s{constructor(){super(...arguments),this.childEmitters=[],this.bindEmitterEvent=!1,this.onExpired=()=>{}}update(e){if(!this.isEmitting&&0===this.particles.length)return;this.age+=e,(this.dead||this.age>=this.life)&&this.destroy(),this.generate(e),this.integrate(e);let t=this.particles.length;for(;t--;){const e=this.particles[t];e.dead&&(this.system&&this.system.dispatch("PARTICLE_DEAD",e),this.bindEmitterEvent&&this.dispatch("PARTICLE_DEAD",e),this.system.pool.expire(e.reset()),this.particles.splice(t,1))}this.updateEmitterBehaviours(e),this.updateChildren(e),this.isEmitting||0!==this.particles.length||this.onExpired()}updateChildren(e){for(const t of this.childEmitters)null!=t.parentParticle?t.position.copy(t.parentParticle.position):t.setPosition(this.position),t.update(e)}clone(){const e=new he;return e.setRate(this.rate.clone()),e.behaviours=this.behaviours,e.initializers=this.initializers,e._space=this._space,e.body=this.body,e.parent=this.parent,e.system=this.system,e}setParentRecursive(e){this.system=e,this.childEmitters.forEach(t=>t.setParentRecursive(e))}}export class EmitterPool{constructor(e){this.creator=e,this.instances=[]}get(){0==this.instances.length&&this.instances.push(this.creator());return this.instances.pop()}release(e){this.instances.push(e)}dispose(){this.instances.length=0}}/*
|
|
2
2
|
* Copyright (©) 2026 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -14,7 +14,9 @@ export declare class VisualEffect {
|
|
|
14
14
|
* to clean up.
|
|
15
15
|
* @param parent The object that the VFX should be parented to to make particles spawn relative to its location.
|
|
16
16
|
*/
|
|
17
|
-
create(parent: Object3D | BaseActor
|
|
17
|
+
create(parent: Object3D | BaseActor, options?: {
|
|
18
|
+
inputs?: Record<string, unknown>;
|
|
19
|
+
}): Promise<VfxActor>;
|
|
18
20
|
/**
|
|
19
21
|
* Create a pool that can be used to create actors and reuse them.
|
|
20
22
|
* @param parent The object that the VFX should be parented to to make particles spawn relative to its location.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{VfxActor as t}from"./vfx-actor.js";import{BaseActor as s}from"../../gameplay/actors/actor.js";export class VisualEffect{constructor(t,s){this.actorProvider=t,this.asset=s}async create(e){const
|
|
1
|
+
import{VfxActor as t}from"./vfx-actor.js";import{BaseActor as s}from"../../gameplay/actors/actor.js";export class VisualEffect{constructor(t,s){this.actorProvider=t,this.asset=s}async create(e,a){const r=await this.actorProvider.create(t);return e instanceof s?e.object.add(r.object):e.add(r.object),await r.fromAsset(this.asset,a?.inputs),r}createPool(t){return new VfxPool(()=>this.create(t))}}export class VfxPool{constructor(t){this.creator=t,this.instances=[]}async get(){0==this.instances.length&&this.instances.push(await this.creator());const t=this.instances.shift();return t.restart(),t}release(t){t.stop(),this.instances.push(t)}dispose(){this.instances.length=0}}/*
|
|
2
2
|
* Copyright (©) 2026 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -3,14 +3,18 @@ import { BaseActor } from '../../gameplay/actors/actor.js';
|
|
|
3
3
|
import { VfxActor } from './vfx-actor.js';
|
|
4
4
|
import { Asset, AssetId } from '../../scene/model.js';
|
|
5
5
|
import { VfxPool } from './vfx-param';
|
|
6
|
+
export type VfxSpawnOptions = {
|
|
7
|
+
inputs?: Record<string, unknown>;
|
|
8
|
+
};
|
|
6
9
|
export declare class VfxService {
|
|
7
10
|
private pools;
|
|
8
11
|
private actorFactory;
|
|
9
12
|
private assetService;
|
|
10
13
|
private world;
|
|
11
|
-
createFromAssetId(assetId: AssetId, parent?: Object3D | BaseActor): Promise<VfxActor>;
|
|
12
|
-
createFromAsset(asset: Asset, parent?: Object3D | BaseActor): Promise<VfxActor>;
|
|
14
|
+
createFromAssetId(assetId: AssetId, parent?: Object3D | BaseActor, options?: VfxSpawnOptions): Promise<VfxActor>;
|
|
15
|
+
createFromAsset(asset: Asset, parent?: Object3D | BaseActor, options?: VfxSpawnOptions): Promise<VfxActor>;
|
|
13
16
|
createPoolFromAssetId(assetId: AssetId, parent?: Object3D | BaseActor): Promise<VfxPool>;
|
|
14
17
|
createPoolFromAsset(asset: Asset, parent?: Object3D | BaseActor): Promise<VfxPool<VfxActor>>;
|
|
18
|
+
clearPool(assetId: AssetId): void;
|
|
15
19
|
}
|
|
16
20
|
//# sourceMappingURL=vfx-service.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as t}from"tslib";import{ActorFactory as s}from"../../gameplay/actors/factory.js";import{AssetLoader as e}from"../../gameplay/services/asset-loader.js";import{BaseActor as
|
|
1
|
+
import{__decorate as t}from"tslib";import{ActorFactory as s}from"../../gameplay/actors/factory.js";import{AssetLoader as e}from"../../gameplay/services/asset-loader.js";import{BaseActor as o}from"../../gameplay/actors/actor.js";import{inject as r}from"../../gameplay/inject.js";import{Service as a}from"typedi";import{World as c}from"../../gameplay/services/world.js";import{VfxActor as i}from"./vfx-actor.js";import{VfxPool as m}from"./vfx-param";let l=class{constructor(){this.pools=new Map,this.actorFactory=r(s),this.assetService=r(e),this.world=r(c)}async createFromAssetId(t,s=this.world.scene,e){const o=await this.assetService.getAsset(t);return this.createFromAsset(o,s,e)}async createFromAsset(t,s=this.world.scene,e){const r=await this.actorFactory.create(i);return s instanceof o?s.object.add(r.object):s.add(r.object),await r.fromAsset(t,e?.inputs),r}async createPoolFromAssetId(t,s=this.world.scene){const e=await this.assetService.getAsset(t);return this.createPoolFromAsset(e,s)}async createPoolFromAsset(t,s=this.world.scene){let e;return this.pools.has(t.id)||(e=new m(()=>this.createFromAsset(t,s)),this.pools.set(t.id,e)),e}clearPool(t){this.pools.delete(t)}};l=t([a()],l);export{l as VfxService};/*
|
|
2
2
|
* Copyright (©) 2026 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -36,6 +36,7 @@ export declare class CharacterAnimationComponent extends ActorComponent {
|
|
|
36
36
|
private physicsSystem;
|
|
37
37
|
/** Master toggle for foot IK. Disable to use pure animation pose. */
|
|
38
38
|
footIkEnabled: boolean;
|
|
39
|
+
footIkMoving: boolean;
|
|
39
40
|
/** Ray start height above foot position, in meters. */
|
|
40
41
|
footIkRayStartHeight: number;
|
|
41
42
|
/** Raycast length used for ground probing, in meters. */
|
|
@@ -155,9 +156,11 @@ export declare class CharacterAnimationComponent extends ActorComponent {
|
|
|
155
156
|
private setDebugArrow;
|
|
156
157
|
private resetDebugVisibility;
|
|
157
158
|
private updateFootIk;
|
|
159
|
+
private resetFootIkState;
|
|
158
160
|
private updatePelvisOffset;
|
|
159
161
|
private computeFootVerticalSpeed;
|
|
160
162
|
private updateFootSample;
|
|
163
|
+
private estimateFootContactOffset;
|
|
161
164
|
private shouldPlantFoot;
|
|
162
165
|
private computeLegExtensionRatio;
|
|
163
166
|
private computeRequiredPelvisDrop;
|