@woosh/meep-engine 2.33.22 → 2.33.23
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/core/bvh2/traversal/__detailed_box_volume_intersection.js +10 -7
- package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +9 -1
- package/core/geom/3d/plane/plane_computeConvex3PlaneIntersection.js +13 -14
- package/core/geom/3d/voxel/DenseBitVolume3D.js +87 -0
- package/core/geom/3d/voxel/buildVolumeFromProjectedGeometry.js +23 -0
- package/core/geom/Plane.js +14 -9
- package/core/primitives/array/computeIntegerArrayHash.js +1 -1
- package/engine/asset/loaders/material/computeImageBitmapEquality.js +11 -0
- package/engine/asset/loaders/material/computeImageBitmapHash.js +22 -28
- package/engine/ecs/util/hideEntityGracefully.js +18 -0
- package/engine/graphics/GraphicsEngine.js +0 -17
- package/engine/graphics/camera/testClippingPlaneComputation.js +2 -2
- package/engine/graphics/ecs/path/testPathDisplaySystem.js +98 -98
- package/engine/graphics/ecs/trail2d/Trail2D.js +17 -4
- package/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +2 -3
- package/engine/graphics/ecs/trail2d/Trail2DSystem.js +34 -118
- package/engine/graphics/particles/particular/engine/ParticularEngine.js +4 -2
- package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +20 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +40 -97
- package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +12 -2
- package/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +37 -0
- package/engine/graphics/particles/particular/engine/emitter/distance_to_camera.js +25 -0
- package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
- package/engine/graphics/render/forward_plus/LightManager.js +10 -2
- package/engine/graphics/render/forward_plus/computeFrustumCorners.js +14 -32
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +96 -95
- package/engine/graphics/render/forward_plus/queryBVH_Frustum.js +17 -5
- package/engine/graphics/render/layers/RenderLayerUtils.js +7 -4
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
- package/engine/graphics/texture/atlas/AtlasPatch.js +7 -2
- package/engine/graphics/texture/atlas/TextureAtlas.js +2 -2
- package/engine/graphics/texture/sampler/Sampler2D.js +8 -7
- package/engine/graphics/texture/sampler/scaleSampler2D.js +7 -10
- package/engine/graphics/trail/x/RibbonMaterialX.js +3 -3
- package/engine/graphics/trail/x/RibbonX.js +17 -2
- package/engine/graphics/trail/x/RibbonXPlugin.js +51 -1
- package/engine/grid/components/GridObstacle.js +2 -9
- package/engine/reference/v2/Reference.js +6 -0
- package/generation/theme/ThemeEngine.js +1 -1
- package/package.json +3 -3
- package/view/View.js +4 -2
|
@@ -106,11 +106,11 @@ function makeConfig(engine) {
|
|
|
106
106
|
new TopDownCameraControllerSystem(graphics),
|
|
107
107
|
new TopDownCameraLanderSystem(),
|
|
108
108
|
new CameraSystem(graphics.scene, graphics),
|
|
109
|
-
new MeshSystem(
|
|
109
|
+
new MeshSystem(engine),
|
|
110
110
|
new ClingToTerrainSystem(),
|
|
111
111
|
new TerrainSystem(graphics, assetManager),
|
|
112
112
|
new WaterSystem(graphics),
|
|
113
|
-
new Trail2DSystem(
|
|
113
|
+
new Trail2DSystem(engine),
|
|
114
114
|
new Foliage2System(assetManager, graphics),
|
|
115
115
|
new ViewportPositionSystem(graphics.viewport.size),
|
|
116
116
|
new GridPosition2TransformSystem(),
|
|
@@ -179,11 +179,11 @@ function catmullRom(points) {
|
|
|
179
179
|
cv.link();
|
|
180
180
|
|
|
181
181
|
cv.css({
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
position: "absolute",
|
|
183
|
+
left: 0,
|
|
184
|
+
right: 0,
|
|
185
|
+
zIndex: 99999
|
|
186
|
+
});
|
|
187
187
|
|
|
188
188
|
const sample = [];
|
|
189
189
|
|
|
@@ -216,92 +216,92 @@ function sample_style_entity() {
|
|
|
216
216
|
const style = new EntityPathStyle();
|
|
217
217
|
style.spacing = 0.6;
|
|
218
218
|
style.marker_start = EntityPathMarkerDefinition.from({
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
219
|
+
blueprint: EntityBlueprint.from([
|
|
220
|
+
Transform.fromJSON({}),
|
|
221
|
+
Mesh.fromJSON({
|
|
222
|
+
url: "data/models/arrow-symbols/arrow4/model-green.gltf",
|
|
223
|
+
castShadow: true,
|
|
224
|
+
receiveShadow: true
|
|
225
|
+
})
|
|
226
|
+
]),
|
|
227
|
+
transform: Transform.fromJSON({
|
|
228
|
+
scale: {
|
|
229
|
+
x: 0.3,
|
|
230
|
+
y: 0.3,
|
|
231
|
+
z: 0.3
|
|
232
|
+
},
|
|
233
|
+
rotation: {
|
|
234
|
+
x: 0.5,
|
|
235
|
+
y: -0.5,
|
|
236
|
+
z: 0.5,
|
|
237
|
+
w: 0.5
|
|
238
|
+
},
|
|
239
|
+
position: {
|
|
240
|
+
x: 0,
|
|
241
|
+
y: 1,
|
|
242
|
+
z: 0
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
});
|
|
246
246
|
style.marker_end = EntityPathMarkerDefinition.from({
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
247
|
+
blueprint: EntityBlueprint.from([
|
|
248
|
+
Transform.fromJSON({}),
|
|
249
|
+
Mesh.fromJSON({
|
|
250
|
+
url: "data/models/arrow-symbols/arrow4/model-red.gltf",
|
|
251
|
+
castShadow: true,
|
|
252
|
+
receiveShadow: true
|
|
253
|
+
})
|
|
254
|
+
]),
|
|
255
|
+
transform: Transform.fromJSON({
|
|
256
|
+
scale: {
|
|
257
|
+
x: 0.3,
|
|
258
|
+
y: 0.3,
|
|
259
|
+
z: 0.3
|
|
260
|
+
},
|
|
261
|
+
rotation: {
|
|
262
|
+
x: 0.5,
|
|
263
|
+
y: -0.5,
|
|
264
|
+
z: 0.5,
|
|
265
|
+
w: 0.5
|
|
266
|
+
},
|
|
267
|
+
position: {
|
|
268
|
+
x: 0,
|
|
269
|
+
y: 1,
|
|
270
|
+
z: 0
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
});
|
|
274
274
|
style.marker_main = EntityPathMarkerDefinition.from({
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
275
|
+
blueprint: EntityBlueprint.from([
|
|
276
|
+
Transform.fromJSON({}),
|
|
277
|
+
Mesh.fromJSON({
|
|
278
|
+
url: "data/models/Barel-Roll Droid/handpainted.gltf",
|
|
279
|
+
castShadow: true,
|
|
280
|
+
receiveShadow: true
|
|
281
|
+
}),
|
|
282
|
+
Animation.fromJSON({
|
|
283
|
+
clips: [
|
|
284
|
+
{
|
|
285
|
+
name: "fly",
|
|
286
|
+
repeatCount: Infinity
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
}),
|
|
290
|
+
Highlight.fromOne(1, 0, 0, 1)
|
|
291
|
+
]),
|
|
292
|
+
transform: Transform.fromJSON({
|
|
293
|
+
scale: {
|
|
294
|
+
x: 0.2,
|
|
295
|
+
y: 0.2,
|
|
296
|
+
z: 0.2
|
|
297
|
+
},
|
|
298
|
+
position: {
|
|
299
|
+
x: 0,
|
|
300
|
+
y: 1,
|
|
301
|
+
z: 0
|
|
302
|
+
}
|
|
303
|
+
})
|
|
304
|
+
});
|
|
305
305
|
|
|
306
306
|
return style;
|
|
307
307
|
}
|
|
@@ -337,13 +337,13 @@ function main(engine) {
|
|
|
337
337
|
// ], 50));
|
|
338
338
|
|
|
339
339
|
_p.setPositionsFromVectorArray([
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
340
|
+
new Vector3(3, 1, 1),
|
|
341
|
+
new Vector3(3, 1, 3),
|
|
342
|
+
new Vector3(7, 1, 3),
|
|
343
|
+
new Vector3(7, 1, 7),
|
|
344
|
+
new Vector3(3, 1, 7),
|
|
345
|
+
new Vector3(3, 1, 8),
|
|
346
|
+
]);
|
|
347
347
|
|
|
348
348
|
|
|
349
349
|
const trailPathStyle = new RibbonPathStyle();
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
7
7
|
import Vector4 from "../../../../core/geom/Vector4.js";
|
|
8
|
+
import { RibbonXMaterialSpec } from "../../trail/x/RibbonXMaterialSpec.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @readonly
|
|
@@ -24,8 +25,6 @@ class Trail2D {
|
|
|
24
25
|
*/
|
|
25
26
|
this.maxAge = 5;
|
|
26
27
|
|
|
27
|
-
this.textureURL = null;
|
|
28
|
-
|
|
29
28
|
/**
|
|
30
29
|
* Trail width
|
|
31
30
|
* @type {number}
|
|
@@ -65,9 +64,9 @@ class Trail2D {
|
|
|
65
64
|
|
|
66
65
|
/**
|
|
67
66
|
* transient
|
|
68
|
-
* @type {
|
|
67
|
+
* @type {RibbonXMaterialSpec}
|
|
69
68
|
*/
|
|
70
|
-
this.material =
|
|
69
|
+
this.material = new RibbonXMaterialSpec();
|
|
71
70
|
|
|
72
71
|
/**
|
|
73
72
|
* transient
|
|
@@ -82,6 +81,20 @@ class Trail2D {
|
|
|
82
81
|
this.flags = Trail2DFlags.Spawning | Trail2DFlags.Aging;
|
|
83
82
|
}
|
|
84
83
|
|
|
84
|
+
dispose() {
|
|
85
|
+
if (this.ribbon !== null) {
|
|
86
|
+
this.ribbon.dispose();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get textureURL() {
|
|
91
|
+
return this.material.diffuse;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
set textureURL(v) {
|
|
95
|
+
this.material.diffuse = v;
|
|
96
|
+
}
|
|
97
|
+
|
|
85
98
|
/**
|
|
86
99
|
*
|
|
87
100
|
* @param {number|Trail2DFlags} flag
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {System} from "../../../ecs/System";
|
|
2
|
-
import
|
|
3
|
-
import {AssetManager} from "../../../asset/AssetManager";
|
|
2
|
+
import Engine from "../../../Engine";
|
|
4
3
|
|
|
5
4
|
export default class Trail2DSystem extends System {
|
|
6
|
-
constructor(
|
|
5
|
+
constructor(engine: Engine)
|
|
7
6
|
}
|
|
@@ -8,25 +8,21 @@ import { max2 } from "../../../../core/math/max2.js";
|
|
|
8
8
|
import { System } from '../../../ecs/System.js';
|
|
9
9
|
import { Transform } from '../../../ecs/transform/Transform.js';
|
|
10
10
|
import Vector3 from '../../../../core/geom/Vector3.js';
|
|
11
|
-
import { computeHashFloat, computeHashIntegerArray } from '../../../../core/math/MathUtils.js';
|
|
12
11
|
|
|
13
12
|
import Trail2D, { Trail2DFlags } from './Trail2D.js';
|
|
14
|
-
import { ClampToEdgeWrapping, DoubleSide, LinearFilter, TextureLoader } from 'three';
|
|
15
13
|
|
|
16
14
|
import { LeafNode } from '../../../../core/bvh2/LeafNode.js';
|
|
17
15
|
import ThreeFactory from '../../three/ThreeFactory.js';
|
|
18
16
|
import { GraphicsEngine } from "../../GraphicsEngine.js";
|
|
19
|
-
import { ReferenceManager } from "../../../reference/v1/ReferenceManager.js";
|
|
20
|
-
import { AssetManager } from "../../../asset/AssetManager.js";
|
|
21
|
-
import { Cache } from "../../../../core/cache/Cache.js";
|
|
22
17
|
import { RibbonXFixedPhysicsSimulator } from "../../trail/x/simulator/RibbonXFixedPhysicsSimulator.js";
|
|
23
18
|
import { RibbonX } from "../../trail/x/RibbonX.js";
|
|
24
19
|
import {
|
|
25
20
|
RIBBON_ATTRIBUTE_ADDRESS_AGE,
|
|
26
21
|
RIBBON_ATTRIBUTE_ADDRESS_UV_OFFSET
|
|
27
22
|
} from "../../trail/x/ribbon_attributes_spec.js";
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
23
|
+
import { Reference } from "../../../reference/v2/Reference.js";
|
|
24
|
+
import { RibbonXPlugin } from "../../trail/x/RibbonXPlugin.js";
|
|
25
|
+
import { assert } from "../../../../core/assert.js";
|
|
30
26
|
|
|
31
27
|
const v3Temp1 = new Vector3();
|
|
32
28
|
|
|
@@ -34,69 +30,32 @@ const v3_array = [];
|
|
|
34
30
|
|
|
35
31
|
class Trail2DSystem extends System {
|
|
36
32
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @param {GraphicsEngine} graphics
|
|
39
|
-
* @param {AssetManager} assetManager
|
|
33
|
+
* @param {Engine} engine
|
|
40
34
|
* @constructor
|
|
41
35
|
*/
|
|
42
|
-
constructor(
|
|
36
|
+
constructor(engine) {
|
|
43
37
|
super();
|
|
44
38
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
throw new Error("'renderer' must be of type GraphicsEngine");
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!(assetManager instanceof AssetManager)) {
|
|
52
|
-
throw new Error("'assetManager' must be of type AssetManager");
|
|
53
|
-
}
|
|
39
|
+
assert.defined(engine, 'engine');
|
|
40
|
+
assert.notNull(engine, 'engine');
|
|
41
|
+
assert.equal(engine.isEngine, true, 'engine.isEngine !== true');
|
|
54
42
|
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
* @type {GraphicsEngine}
|
|
58
|
-
*/
|
|
59
|
-
this.graphics = graphics;
|
|
43
|
+
this.dependencies = [Trail2D, Transform];
|
|
60
44
|
|
|
61
45
|
/**
|
|
62
46
|
*
|
|
63
|
-
* @type {
|
|
47
|
+
* @type {Engine}
|
|
48
|
+
* @private
|
|
64
49
|
*/
|
|
65
|
-
this.
|
|
66
|
-
|
|
67
|
-
function constructTexture(url) {
|
|
68
|
-
const assetPromise = assetManager.promise(url, "texture");
|
|
69
|
-
|
|
70
|
-
const texturePromise = assetPromise
|
|
71
|
-
.then(function (asset) {
|
|
72
|
-
|
|
73
|
-
const texture = asset.create();
|
|
74
|
-
|
|
75
|
-
texture.wrapS = ClampToEdgeWrapping;
|
|
76
|
-
texture.wrapT = ClampToEdgeWrapping;
|
|
77
|
-
|
|
78
|
-
texture.magFilter = LinearFilter;
|
|
79
|
-
texture.minFilter = LinearFilter;
|
|
50
|
+
this.__engine = engine;
|
|
80
51
|
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return texturePromise;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function destructTexture(url, texturePromise) {
|
|
88
|
-
texturePromise.then(function (t) {
|
|
89
|
-
//release used resourced
|
|
90
|
-
t.dispose();
|
|
91
|
-
});
|
|
92
|
-
}
|
|
52
|
+
const graphics = engine.graphics;
|
|
93
53
|
|
|
94
54
|
/**
|
|
95
55
|
*
|
|
96
|
-
* @type {
|
|
56
|
+
* @type {GraphicsEngine}
|
|
97
57
|
*/
|
|
98
|
-
this.
|
|
99
|
-
|
|
58
|
+
this.graphics = graphics;
|
|
100
59
|
|
|
101
60
|
/**
|
|
102
61
|
*
|
|
@@ -117,28 +76,11 @@ class Trail2DSystem extends System {
|
|
|
117
76
|
this.simulator = new RibbonXFixedPhysicsSimulator();
|
|
118
77
|
|
|
119
78
|
/**
|
|
79
|
+
*
|
|
80
|
+
* @type {Reference<RibbonXPlugin>}
|
|
120
81
|
* @private
|
|
121
|
-
* @readonly
|
|
122
|
-
* @type {Cache<Trail2D, Material>}
|
|
123
82
|
*/
|
|
124
|
-
this.
|
|
125
|
-
maxWeight: 100,
|
|
126
|
-
keyHashFunction(trail) {
|
|
127
|
-
return computeHashIntegerArray(
|
|
128
|
-
computeStringHash(trail.textureURL),
|
|
129
|
-
computeHashFloat(trail.width),
|
|
130
|
-
computeHashFloat(trail.maxAge),
|
|
131
|
-
trail.color.hash()
|
|
132
|
-
);
|
|
133
|
-
},
|
|
134
|
-
keyEqualityFunction(a, b) {
|
|
135
|
-
return a.textureURL === b.textureURL
|
|
136
|
-
&& a.width === b.width
|
|
137
|
-
&& a.maxAge === b.maxAge
|
|
138
|
-
&& a.color.equals(b.color)
|
|
139
|
-
;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
83
|
+
this.__ribbon_plugin = Reference.NULL;
|
|
142
84
|
|
|
143
85
|
|
|
144
86
|
/**
|
|
@@ -149,7 +91,7 @@ class Trail2DSystem extends System {
|
|
|
149
91
|
this.__timeDelta = 0;
|
|
150
92
|
}
|
|
151
93
|
|
|
152
|
-
startup(entityManager, readyCallback, errorCallback) {
|
|
94
|
+
async startup(entityManager, readyCallback, errorCallback) {
|
|
153
95
|
this.entityManager = entityManager;
|
|
154
96
|
|
|
155
97
|
this.renderLayer = this.graphics.layers.create('trail-2d-system');
|
|
@@ -161,19 +103,7 @@ class Trail2DSystem extends System {
|
|
|
161
103
|
|
|
162
104
|
this.bvh = this.renderLayer.bvh;
|
|
163
105
|
|
|
164
|
-
|
|
165
|
-
this.graphics.viewport.size.onChanged.add((x, y) => {
|
|
166
|
-
const ecd = this.entityManager.dataset;
|
|
167
|
-
|
|
168
|
-
if (ecd === null) {
|
|
169
|
-
// no dataset attached
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
ecd.traverseComponents(Trail2D, trail => {
|
|
174
|
-
trail.material.uniforms.resolution.value.set(x, y);
|
|
175
|
-
});
|
|
176
|
-
});
|
|
106
|
+
this.__ribbon_plugin = await this.__engine.plugins.acquire(RibbonXPlugin);
|
|
177
107
|
|
|
178
108
|
readyCallback();
|
|
179
109
|
}
|
|
@@ -181,32 +111,9 @@ class Trail2DSystem extends System {
|
|
|
181
111
|
shutdown(entityManager, readyCallback, errorCallback) {
|
|
182
112
|
this.graphics.layers.remove(this.renderLayer);
|
|
183
113
|
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
*
|
|
189
|
-
* @param {Trail2D} trail
|
|
190
|
-
* @returns {Material}
|
|
191
|
-
*/
|
|
192
|
-
obtainMaterial(trail) {
|
|
193
|
-
|
|
194
|
-
const material = new RibbonMaterialX({
|
|
195
|
-
transparent: true,
|
|
196
|
-
depthWrite: false,
|
|
197
|
-
wireframe: false,
|
|
198
|
-
side: DoubleSide,
|
|
199
|
-
defines: {
|
|
200
|
-
USE_TEXTURE: false
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
if (trail.textureURL !== null) {
|
|
205
|
-
material.uniforms.uDiffuse.value = new TextureLoader().load(trail.textureURL);
|
|
206
|
-
material.defines.USE_TEXTURE = true;
|
|
207
|
-
}
|
|
114
|
+
this.__ribbon_plugin.release();
|
|
208
115
|
|
|
209
|
-
|
|
116
|
+
readyCallback();
|
|
210
117
|
}
|
|
211
118
|
|
|
212
119
|
/**
|
|
@@ -231,9 +138,9 @@ class Trail2DSystem extends System {
|
|
|
231
138
|
|
|
232
139
|
const geometry = ribbon.getGeometry();
|
|
233
140
|
|
|
234
|
-
const
|
|
141
|
+
const ribbons = this.__ribbon_plugin.getValue();
|
|
235
142
|
|
|
236
|
-
material.
|
|
143
|
+
const material = ribbons.obtain_material_x(trail.material);
|
|
237
144
|
|
|
238
145
|
const mesh = ThreeFactory.createMesh(geometry, material);
|
|
239
146
|
|
|
@@ -274,12 +181,21 @@ class Trail2DSystem extends System {
|
|
|
274
181
|
);
|
|
275
182
|
|
|
276
183
|
trail.bvhLeaf = leafNode;
|
|
277
|
-
trail.material = material;
|
|
278
184
|
|
|
279
185
|
this.bvh.insertNode(leafNode);
|
|
280
186
|
}
|
|
281
187
|
|
|
188
|
+
/**
|
|
189
|
+
*
|
|
190
|
+
* @param {Trail2D} component
|
|
191
|
+
* @param {Transform} transform
|
|
192
|
+
* @param {number} entity
|
|
193
|
+
*/
|
|
282
194
|
unlink(component, transform, entity) {
|
|
195
|
+
|
|
196
|
+
// release resources
|
|
197
|
+
component.dispose();
|
|
198
|
+
|
|
283
199
|
component.bvhLeaf.disconnect();
|
|
284
200
|
}
|
|
285
201
|
|
|
@@ -63,10 +63,12 @@ ParticularEngine.prototype.add = function (emitter) {
|
|
|
63
63
|
* @param {ParticleEmitter} emitter
|
|
64
64
|
*/
|
|
65
65
|
ParticularEngine.prototype.remove = function (emitter) {
|
|
66
|
-
const
|
|
66
|
+
const emitters = this.emitters;
|
|
67
|
+
|
|
68
|
+
const i = emitters.indexOf(emitter);
|
|
67
69
|
|
|
68
70
|
if (i !== -1) {
|
|
69
|
-
|
|
71
|
+
emitters.remove(i);
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
this.shaderManager.deregister(emitter);
|
package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//build particle spec
|
|
2
|
+
import { ParticleSpecification } from "../../group/ParticleSpecification.js";
|
|
3
|
+
import { ParticleAttribute } from "../../group/ParticleAttribute.js";
|
|
4
|
+
import { ParticleAttributeType, ParticleDataType } from "../../group/ParticleGroup.js";
|
|
5
|
+
|
|
6
|
+
export const PARTICULAR_PARTICLE_SPECIFICATION = new ParticleSpecification();
|
|
7
|
+
|
|
8
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('position', ParticleAttributeType.Vector3, ParticleDataType.Float32));
|
|
9
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('age', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
10
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('deathAge', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
11
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('atlasPatch', ParticleAttributeType.Vector4, ParticleDataType.Float32));
|
|
12
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('size', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
13
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('layerPosition', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
14
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('velocity', ParticleAttributeType.Vector3, ParticleDataType.Float32));
|
|
15
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('rotation', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
16
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('rotationSpeed', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
17
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('color', ParticleAttributeType.Vector4, ParticleDataType.Float32));
|
|
18
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('blending', ParticleAttributeType.Scalar, ParticleDataType.Uint8));
|
|
19
|
+
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('size_initial', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
20
|
+
|