@woosh/meep-engine 2.61.0 → 2.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/build/meep.cjs +234 -212
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +234 -212
  4. package/package.json +1 -1
  5. package/src/core/bvh2/BinaryNode.js +16 -13
  6. package/src/core/bvh2/LeafNode.js +6 -3
  7. package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_sphere.js +81 -0
  8. package/src/core/geom/3d/aabb/AABB3.js +24 -36
  9. package/src/core/geom/3d/aabb/aabb3_array_compute_from_sphere.js +22 -0
  10. package/src/core/geom/3d/aabb/aabb3_array_intersects_sphere.js +22 -0
  11. package/src/core/geom/3d/aabb/aabb3_array_intersects_sphere_array.js +11 -0
  12. package/src/core/geom/3d/aabb/aabb3_signed_distance_to_aabb3.js +28 -0
  13. package/src/core/geom/3d/aabb/serializeAABB3Quantized16Uint.js +19 -10
  14. package/src/core/geom/3d/tetrahedra/delaunay/Cavity.js +3 -4
  15. package/src/engine/ecs/foliage/ecs/Foliage2System.js +3 -0
  16. package/src/engine/ecs/foliage/ecs/InstancedMeshComponent.js +4 -1
  17. package/src/engine/ecs/foliage/ecs/convertInstancedMeshComponents2Entities.js +64 -0
  18. package/src/engine/ecs/foliage/ecs/{InstancedMeshUtils.js → optimizeIndividualMeshesEntitiesToInstances.js} +11 -70
  19. package/src/engine/graphics/camera/testClippingPlaneComputation.js +25 -27
  20. package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +49 -52
  21. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +40 -42
  22. package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.js +43 -25
  23. package/src/engine/graphics/particles/particular/engine/ParticularEngine.js +10 -6
  24. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +37 -41
  25. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +44 -46
  26. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +24 -26
  27. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +40 -42
  28. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +36 -38
  29. package/src/engine/graphics/shadows/testShadowMapRendering.js +19 -19
  30. package/src/engine/sound/dB2Volume.js +8 -0
  31. package/src/engine/sound/ecs/emitter/SoundEmitter.js +125 -99
  32. package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.js +4 -42
  33. package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +31 -121
  34. package/src/engine/sound/volume2dB.js +8 -0
  35. package/src/generation/theme/ThemeEngine.js +19 -53
  36. package/src/engine/graphics/geometry/bvh/buffered/BVHFromBufferGeometry.js +0 -133
@@ -3,43 +3,25 @@
3
3
  */
4
4
 
5
5
 
6
+ import {EBBVHLeafProxy} from "../../../../core/bvh2/bvh3/EBBVHLeafProxy.js";
7
+ import {computeHashIntegerArray} from "../../../../core/collection/array/computeHashIntegerArray.js";
6
8
  import List from '../../../../core/collection/list/List.js';
9
+ import {aabb3_array_compute_from_sphere} from "../../../../core/geom/3d/aabb/aabb3_array_compute_from_sphere.js";
7
10
  import Vector1 from "../../../../core/geom/Vector1.js";
8
- import { SoundTrack } from "./SoundTrack.js";
9
- import { SoundEmitterFlags } from "./SoundEmitterFlags.js";
10
- import { SoundAttenuationFunction } from "./SoundAttenuationFunction.js";
11
- import {
12
- interpolate_irradiance_linear
13
- } from "../../../../core/math/physics/irradiance/interpolate_irradiance_linear.js";
11
+ import {interpolate_irradiance_linear} from "../../../../core/math/physics/irradiance/interpolate_irradiance_linear.js";
14
12
  import {
15
13
  interpolate_irradiance_lograrithmic
16
14
  } from "../../../../core/math/physics/irradiance/interpolate_irradiance_lograrithmic.js";
17
- import { SoundPanningModelType } from "./SoundPanningModelType.js";
18
- import { interpolate_irradiance_smith } from "../../../../core/math/physics/irradiance/interpolate_irradiance_smith.js";
19
- import { objectKeyByValue } from "../../../../core/model/object/objectKeyByValue.js";
20
- import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
21
- import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
22
- import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
23
- import { compareStrings } from "../../../../core/primitives/strings/compareStrings.js";
24
- import { number_compare_ascending } from "../../../../core/primitives/numbers/number_compare_ascending.js";
25
-
26
- /**
27
- * Convert decibel to percentage volume
28
- * @param {number} dB
29
- * @returns {number}
30
- */
31
- function dB2Volume(dB) {
32
- return Math.pow(10, 0.05 * dB);
33
- }
34
-
35
- /**
36
- * Convert percentage volume to decibel
37
- * @param {number} volume
38
- * @returns {number}
39
- */
40
- function volume2dB(volume) {
41
- return 20 * Math.log10(volume);
42
- }
15
+ import {interpolate_irradiance_smith} from "../../../../core/math/physics/irradiance/interpolate_irradiance_smith.js";
16
+ import {objectKeyByValue} from "../../../../core/model/object/objectKeyByValue.js";
17
+ import {computeHashFloat} from "../../../../core/primitives/numbers/computeHashFloat.js";
18
+ import {number_compare_ascending} from "../../../../core/primitives/numbers/number_compare_ascending.js";
19
+ import {compareStrings} from "../../../../core/primitives/strings/compareStrings.js";
20
+ import {computeStringHash} from "../../../../core/primitives/strings/computeStringHash.js";
21
+ import {SoundAttenuationFunction} from "./SoundAttenuationFunction.js";
22
+ import {SoundEmitterFlags} from "./SoundEmitterFlags.js";
23
+ import {SoundPanningModelType} from "./SoundPanningModelType.js";
24
+ import {SoundTrack} from "./SoundTrack.js";
43
25
 
44
26
  const DEFAULT_DISTANCE_MIN = 1;
45
27
  const DEFAULT_DISTANCE_MAX = 10000;
@@ -50,92 +32,105 @@ const DEFAULT_CHANNEL = null;
50
32
  * @class
51
33
  */
52
34
  export class SoundEmitter {
35
+
36
+
37
+ /**
38
+ * @readonly
39
+ * @type {List<SoundTrack>}
40
+ */
41
+ tracks = new List();
42
+
53
43
  /**
54
44
  *
55
- * @constructor
45
+ * @type {String|SoundEmitterChannels|null}
56
46
  */
57
- constructor() {
47
+ channel = DEFAULT_CHANNEL;
58
48
 
59
- /**
60
- *
61
- * @type {List<SoundTrack>}
62
- */
63
- this.tracks = new List();
49
+ /**
50
+ *
51
+ * @type {number}
52
+ * @private
53
+ */
54
+ __distanceMin = 1;
64
55
 
65
- /**
66
- *
67
- * @type {String|SoundEmitterChannels|null}
68
- */
69
- this.channel = DEFAULT_CHANNEL;
56
+ /**
57
+ *
58
+ * @type {number}
59
+ * @private
60
+ */
61
+ __distanceMax = 10000;
70
62
 
71
- /**
72
- *
73
- * @type {number}
74
- * @private
75
- */
76
- this.__distanceMin = 1;
63
+ /**
64
+ * @deprecated
65
+ * @type {number}
66
+ * @private
67
+ */
68
+ __distanceRolloff = 1;
77
69
 
78
- /**
79
- *
80
- * @type {number}
81
- * @private
82
- */
83
- this.__distanceMax = 10000;
70
+ /**
71
+ * TODO add to binary serialization
72
+ * @type {SoundPanningModelType}
73
+ */
74
+ panningModel = SoundPanningModelType.HRTF;
75
+
76
+ /**
77
+ * Type of attenuation used for sound fall-off, this is only used if Attenuation flag is set
78
+ * @type {SoundAttenuationFunction|number}
79
+ */
80
+ attenuation = SoundAttenuationFunction.Smith;
81
+
82
+ /**
83
+ *
84
+ * @type {number|SoundEmitterFlags}
85
+ */
86
+ flags = 0;
84
87
 
88
+ /**
89
+ * @readonly
90
+ */
91
+ nodes = {
85
92
  /**
86
- * @deprecated
87
- * @type {number}
88
- * @private
93
+ * @type {GainNode}
89
94
  */
90
- this.__distanceRolloff = 1;
91
-
95
+ volume: null,
92
96
  /**
93
- * TODO add to binary serialization
94
- * @type {SoundPanningModelType}
97
+ * @type {PannerNode}
95
98
  */
96
- this.panningModel = SoundPanningModelType.HRTF;
97
-
99
+ panner: null,
98
100
  /**
99
- * Type of attenuation used for sound fall-off, this is only used if Attenuation flag is set
100
- * @type {SoundAttenuationFunction|number}
101
+ * @type {GainNode}
101
102
  */
102
- this.attenuation = SoundAttenuationFunction.Smith;
103
-
103
+ attenuation: null,
104
104
  /**
105
- *
106
- * @type {number|SoundEmitterFlags}
105
+ * One of the other nodes, depending on the configuration
106
+ * @type {AudioNode}
107
107
  */
108
- this.flags = 0;
108
+ endpoint: null
109
+ };
109
110
 
110
- const nodes = this.nodes = {
111
- /**
112
- * @type {GainNode}
113
- */
114
- volume: null,
115
- /**
116
- * @type {PannerNode}
117
- */
118
- panner: null,
119
- /**
120
- * @type {GainNode}
121
- */
122
- attenuation: null,
123
- /**
124
- * One of the other nodes, depending on the configuration
125
- * @type {AudioNode}
126
- */
127
- endpoint: null
128
- };
111
+ /**
112
+ *
113
+ * @type {Vector1}
114
+ */
115
+ volume = new Vector1(1);
129
116
 
130
- /**
131
- *
132
- * @type {Vector1}
133
- */
134
- this.volume = new Vector1(1);
117
+ /**
118
+ * @readonly
119
+ * @type {EBBVHLeafProxy}
120
+ */
121
+ bvh = new EBBVHLeafProxy();
135
122
 
136
- this.volume.onChanged.add(function (value) {
137
- if (nodes.volume !== null) {
138
- nodes.volume.gain.setValueAtTime(value, 0);
123
+ /**
124
+ *
125
+ * @constructor
126
+ */
127
+ constructor() {
128
+
129
+ this.volume.onChanged.add((value) => {
130
+ const volume_node = this.nodes.volume;
131
+
132
+ if (volume_node !== null) {
133
+ volume_node.gain.setValueAtTime(value, 0);
139
134
  }
140
135
  });
141
136
 
@@ -437,6 +432,37 @@ export class SoundEmitter {
437
432
  }
438
433
  }
439
434
 
435
+ /**
436
+ *
437
+ * @param {number} x
438
+ * @param {number} y
439
+ * @param {number} z
440
+ */
441
+ updatePosition(x, y, z) {
442
+ if (this.getFlag(SoundEmitterFlags.Spatialization)) {
443
+ //update position of the panner node
444
+ const nodes = this.nodes;
445
+
446
+ /**
447
+ *
448
+ * @type {PannerNode}
449
+ */
450
+ const panner = nodes.panner;
451
+
452
+ if (panner !== null) {
453
+ panner.setPosition(x, y, z);
454
+ }
455
+ }
456
+
457
+ const distanceMax = this.distanceMax;
458
+
459
+ const bounds = this.bvh.bounds;
460
+
461
+ aabb3_array_compute_from_sphere(bounds, 0, x, y, z, distanceMax);
462
+
463
+ this.bvh.write_bounds();
464
+ }
465
+
440
466
  /**
441
467
  *
442
468
  * @param {number} [duration] fade duration in seconds
@@ -1,8 +1,6 @@
1
- import { LeafNode } from "../../../../core/bvh2/LeafNode.js";
2
- import { SoundTrackNodes } from "./SoundTrackNodes.js";
3
- import { SoundEmitterFlags } from "./SoundEmitterFlags.js";
4
- import { SoundTrackFlags } from "./SoundTrackFlags.js";
5
- import { loadSoundTrackAsset } from "./loadSoundTrackAsset.js";
1
+ import {loadSoundTrackAsset} from "./loadSoundTrackAsset.js";
2
+ import {SoundTrackFlags} from "./SoundTrackFlags.js";
3
+ import {SoundTrackNodes} from "./SoundTrackNodes.js";
6
4
 
7
5
  export class SoundEmitterComponentContext {
8
6
  constructor() {
@@ -31,12 +29,6 @@ export class SoundEmitterComponentContext {
31
29
  */
32
30
  this.targetNode = null;
33
31
 
34
- /**
35
- *
36
- * @type {LeafNode}
37
- */
38
- this.leaf = new LeafNode(this, 0, 0, 0, 0, 0, 0);
39
-
40
32
  /**
41
33
  *
42
34
  * @type {boolean}
@@ -67,37 +59,7 @@ export class SoundEmitterComponentContext {
67
59
  const y = position.y;
68
60
  const z = position.z;
69
61
 
70
- if (emitter.getFlag(SoundEmitterFlags.Spatialization)) {
71
- //update position of the panner node
72
- const nodes = emitter.nodes;
73
-
74
- /**
75
- *
76
- * @type {PannerNode}
77
- */
78
- const panner = nodes.panner;
79
-
80
- if (panner !== null) {
81
- panner.setPosition(x, y, z);
82
- }
83
- }
84
-
85
- /**
86
- *
87
- * @type {LeafNode}
88
- */
89
- const bvhLeaf = this.leaf;
90
-
91
- const distanceMax = emitter.distanceMax;
92
-
93
- bvhLeaf.resize(
94
- x - distanceMax,
95
- y - distanceMax,
96
- z - distanceMax,
97
- x + distanceMax,
98
- y + distanceMax,
99
- z + distanceMax
100
- );
62
+ emitter.updatePosition(x, y, z);
101
63
  }
102
64
 
103
65
  /**
@@ -5,23 +5,24 @@
5
5
  */
6
6
 
7
7
 
8
- import { System } from '../../../ecs/System.js';
9
- import { SoundEmitter } from './SoundEmitter.js';
10
- import { Transform } from '../../../ecs/transform/Transform.js';
11
- import { SoundAssetLoader } from "../../../asset/loaders/SoundAssetLoader.js";
12
- import { GameAssetType } from "../../../asset/GameAssetType.js";
13
- import { BinaryNode } from "../../../../core/bvh2/BinaryNode.js";
14
- import SoundListener from "../SoundListener.js";
15
- import { IncrementalDeltaSet } from "../../../graphics/render/visibility/IncrementalDeltaSet.js";
16
8
  import {
17
- queryBinaryNode_SphereIntersections_Data
18
- } from "../../../../core/bvh2/traversal/queryBinaryNode_SphereIntersections.js";
19
- import { SoundEmitterComponentContext } from "./SoundEmitterComponentContext.js";
20
- import { SoundEmitterFlags } from "./SoundEmitterFlags.js";
21
- import { SoundEmitterChannel } from "./SoundEmitterChannel.js";
22
- import { invokeObjectCompare } from "../../../../core/model/object/invokeObjectCompare.js";
23
- import { tryRotateSingleNode } from "../../../../core/bvh2/transform/tryRotateSingleNode.js";
24
- import { SoundTrackFlags } from "./SoundTrackFlags.js";
9
+ ExplicitBinaryBoundingVolumeHierarchy
10
+ } from "../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
11
+ import {
12
+ bvh_query_user_data_overlaps_sphere
13
+ } from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_sphere.js";
14
+ import {invokeObjectCompare} from "../../../../core/model/object/invokeObjectCompare.js";
15
+ import {GameAssetType} from "../../../asset/GameAssetType.js";
16
+ import {SoundAssetLoader} from "../../../asset/loaders/SoundAssetLoader.js";
17
+ import {System} from '../../../ecs/System.js';
18
+ import {Transform} from '../../../ecs/transform/Transform.js';
19
+ import {IncrementalDeltaSet} from "../../../graphics/render/visibility/IncrementalDeltaSet.js";
20
+ import SoundListener from "../SoundListener.js";
21
+ import {SoundEmitter} from './SoundEmitter.js';
22
+ import {SoundEmitterChannel} from "./SoundEmitterChannel.js";
23
+ import {SoundEmitterComponentContext} from "./SoundEmitterComponentContext.js";
24
+ import {SoundEmitterFlags} from "./SoundEmitterFlags.js";
25
+ import {SoundTrackFlags} from "./SoundTrackFlags.js";
25
26
 
26
27
  /**
27
28
  * @readonly
@@ -35,21 +36,9 @@ export const SoundEmitterChannels = {
35
36
 
36
37
  /**
37
38
  *
38
- * @type {Map<NodeDescription, number>}
39
- */
40
- const leafCount = new Map();
41
-
42
- /**
43
- *
44
- * @type {SoundEmitterComponentContext[]}
39
+ * @type {number[]}
45
40
  */
46
- const positionalNodes = [];
47
-
48
- /**
49
- *
50
- * @type {number}
51
- */
52
- const OPTIMIZATION_LOOP_LIMIT = 10000;
41
+ const scratch_array = [];
53
42
 
54
43
  export class SoundEmitterSystem extends System {
55
44
  /**
@@ -103,17 +92,10 @@ export class SoundEmitterSystem extends System {
103
92
 
104
93
  /**
105
94
  * Spatial index
106
- * @type {BinaryNode}
107
- * @private
108
- */
109
- this.__bvh = new BinaryNode();
110
-
111
- /**
112
- *
113
- * @type {number}
95
+ * @type {ExplicitBinaryBoundingVolumeHierarchy}
114
96
  * @private
115
97
  */
116
- this.__optimizationPointer = 0;
98
+ this.__bvh = new ExplicitBinaryBoundingVolumeHierarchy();
117
99
 
118
100
  /**
119
101
  * Number of currently linked entities
@@ -226,6 +208,8 @@ export class SoundEmitterSystem extends System {
226
208
  emitter.buildNodes(context);
227
209
  }
228
210
 
211
+ emitter.bvh.link(this.__bvh, entity);
212
+
229
213
  const ctx = new SoundEmitterComponentContext();
230
214
 
231
215
  ctx.system = this;
@@ -240,11 +224,6 @@ export class SoundEmitterSystem extends System {
240
224
 
241
225
  this.data[entity] = ctx;
242
226
 
243
- //attach bvh
244
- this.__bvh.insertNode(ctx.leaf);
245
-
246
- leafCount.clear();
247
-
248
227
  this.__linkedCount++;
249
228
  }
250
229
 
@@ -266,12 +245,9 @@ export class SoundEmitterSystem extends System {
266
245
 
267
246
  ctx.unlink();
268
247
 
269
- ctx.leaf.disconnect();
270
-
271
248
  }
272
249
 
273
-
274
- leafCount.clear();
250
+ emitter.bvh.unlink();
275
251
 
276
252
  this.__linkedCount--;
277
253
  }
@@ -296,13 +272,18 @@ export class SoundEmitterSystem extends System {
296
272
 
297
273
  const listenerPosition = listenerTransform.position;
298
274
 
299
- const matchCount = queryBinaryNode_SphereIntersections_Data(positionalNodes, 0, this.__bvh, listenerPosition.x, listenerPosition.y, listenerPosition.z, 0);
275
+ const matchCount = bvh_query_user_data_overlaps_sphere(
276
+ scratch_array, 0,
277
+ this.__bvh, [listenerPosition.x, listenerPosition.y, listenerPosition.z, 0]
278
+ );
300
279
 
301
280
  for (let i = 0; i < matchCount; i++) {
281
+ const entity = scratch_array[i];
282
+
302
283
  /**
303
284
  * @type {SoundEmitterComponentContext}
304
285
  */
305
- const ctx = positionalNodes[i];
286
+ const ctx = this.data[entity];
306
287
 
307
288
  const emitter = ctx.emitter;
308
289
 
@@ -378,79 +359,8 @@ export class SoundEmitterSystem extends System {
378
359
  }
379
360
 
380
361
  activeSet.finalizeUpdate();
381
-
382
- this.optimize(1, 50);
383
362
  }
384
363
 
385
- /**
386
- *
387
- * @param {number} timeout In milliseconds
388
- * @param {number} iterations Maximum number of steps the optimizer can take
389
- */
390
- optimize(timeout, iterations) {
391
- let ctx;
392
-
393
- let i = 0;
394
- let j = 0;
395
-
396
- if (this.__linkedCount <= 0) {
397
- //nothing to optimize
398
- return;
399
- }
400
-
401
- const data = this.data;
402
- const length = data.length;
403
-
404
- const t0 = performance.now();
405
-
406
-
407
- LOOP_MAIN: while (j < OPTIMIZATION_LOOP_LIMIT) {
408
-
409
- j++;
410
-
411
- //find next entity
412
- while (((ctx = data[this.__optimizationPointer]) === undefined)) {
413
-
414
- this.__optimizationPointer++;
415
-
416
- j++;
417
-
418
- if (this.__optimizationPointer >= length) {
419
- this.__optimizationPointer = 0;
420
-
421
- continue LOOP_MAIN;
422
- }
423
-
424
- }
425
-
426
- let n = ctx.leaf.parentNode;
427
-
428
- while (n !== null) {
429
-
430
- tryRotateSingleNode(n, leafCount);
431
-
432
- i++
433
-
434
- if (Math.random() < 0.5) {
435
- //random exit
436
- break;
437
- }
438
-
439
- n = n.parentNode;
440
- }
441
-
442
- this.__optimizationPointer++;
443
-
444
- const t1 = performance.now();
445
-
446
- const time = t1 - t0;
447
-
448
- if (time > timeout || i > iterations) {
449
-
450
- break;
451
- }
452
- }
453
- }
454
364
 
455
365
 
456
366
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Convert percentage volume to decibel
3
+ * @param {number} volume
4
+ * @returns {number}
5
+ */
6
+ function volume2dB(volume) {
7
+ return 20 * Math.log10(volume);
8
+ }
@@ -1,25 +1,23 @@
1
- import { QuadTreeNode } from "../../core/geom/2d/quad-tree/QuadTreeNode.js";
2
- import { assert } from "../../core/assert.js";
3
- import { seededRandom } from "../../core/math/random/seededRandom.js";
4
- import { TerrainLayerRuleAggregator } from "./TerrainLayerRuleAggregator.js";
5
- import { Sampler2D } from "../../engine/graphics/texture/sampler/Sampler2D.js";
1
+ import {assert} from "../../core/assert.js";
2
+ import {binarySearchLowIndex} from "../../core/collection/array/binarySearchLowIndex.js";
3
+ import {HashMap} from "../../core/collection/map/HashMap.js";
4
+ import {QuadTreeNode} from "../../core/geom/2d/quad-tree/QuadTreeNode.js";
5
+ import {randomFloatBetween} from "../../core/math/random/randomFloatBetween.js";
6
+ import {seededRandom} from "../../core/math/random/seededRandom.js";
7
+ import {number_compare_ascending} from "../../core/primitives/numbers/number_compare_ascending.js";
8
+ import Future from "../../core/process/Future.js";
6
9
  import Task from "../../core/process/task/Task.js";
7
- import { TaskSignal } from "../../core/process/task/TaskSignal.js";
8
10
  import TaskGroup from "../../core/process/task/TaskGroup.js";
9
- import Future from "../../core/process/Future.js";
10
- import { optimizeIndividualMeshesEntitiesToInstances } from "../../engine/ecs/foliage/ecs/InstancedMeshUtils.js";
11
- import TaskState from "../../core/process/task/TaskState.js";
12
- import { HashMap } from "../../core/collection/map/HashMap.js";
13
- import { TerrainLayer } from "../../engine/ecs/terrain/ecs/layers/TerrainLayer.js";
14
- import { TerrainFlags } from "../../engine/ecs/terrain/ecs/TerrainFlags.js";
15
- import { binarySearchLowIndex } from "../../core/collection/array/binarySearchLowIndex.js";
16
- import { randomFloatBetween } from "../../core/math/random/randomFloatBetween.js";
17
- import { obtainTerrain } from "../../engine/ecs/terrain/util/obtainTerrain.js";
18
- import { actionTask } from "../../core/process/task/util/actionTask.js";
19
- import { countTask } from "../../core/process/task/util/countTask.js";
20
- import { emptyTask } from "../../core/process/task/util/emptyTask.js";
21
- import { futureTask } from "../../core/process/task/util/futureTask.js";
22
- import { number_compare_ascending } from "../../core/primitives/numbers/number_compare_ascending.js";
11
+ import {TaskSignal} from "../../core/process/task/TaskSignal.js";
12
+ import {actionTask} from "../../core/process/task/util/actionTask.js";
13
+ import {countTask} from "../../core/process/task/util/countTask.js";
14
+ import {emptyTask} from "../../core/process/task/util/emptyTask.js";
15
+ import {futureTask} from "../../core/process/task/util/futureTask.js";
16
+ import {TerrainLayer} from "../../engine/ecs/terrain/ecs/layers/TerrainLayer.js";
17
+ import {TerrainFlags} from "../../engine/ecs/terrain/ecs/TerrainFlags.js";
18
+ import {obtainTerrain} from "../../engine/ecs/terrain/util/obtainTerrain.js";
19
+ import {Sampler2D} from "../../engine/graphics/texture/sampler/Sampler2D.js";
20
+ import {TerrainLayerRuleAggregator} from "./TerrainLayerRuleAggregator.js";
23
21
 
24
22
  /**
25
23
  *
@@ -530,39 +528,7 @@ export class ThemeEngine {
530
528
  terrain.buildLightMap().then(resolve, reject);
531
529
  }), 'Building Lightmap');
532
530
 
533
- const optimization_task = new TaskGroup([]);
534
-
535
- const tOptimizeMeshes = new Task({
536
- name: 'Mesh optimization',
537
- initializer(task, executor) {
538
-
539
- const o = optimizeIndividualMeshesEntitiesToInstances(ecd, 10);
540
-
541
- optimization_task.addChildren(o.tasks);
542
-
543
- executor.runGroup(optimization_task);
544
- },
545
- cycleFunction() {
546
- const state = optimization_task.state.getValue();
547
-
548
- if (state === TaskState.RUNNING) {
549
- return TaskSignal.Yield;
550
- } else if (state === TaskState.FAILED) {
551
- return TaskSignal.EndFailure;
552
- } else if (state === TaskState.SUCCEEDED) {
553
- return TaskSignal.EndSuccess;
554
- } else {
555
- return TaskSignal.Continue;
556
- }
557
- },
558
- computeProgress() {
559
- return optimization_task.computeProgress();
560
- }
561
- });
562
-
563
- tOptimizeMeshes.estimatedDuration = 5;
564
-
565
- return new TaskGroup([tLightMap, tOptimizeMeshes]);
531
+ return new TaskGroup([tLightMap]);
566
532
  }
567
533
 
568
534
  /**