@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.
Files changed (42) hide show
  1. package/core/bvh2/traversal/__detailed_box_volume_intersection.js +10 -7
  2. package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +9 -1
  3. package/core/geom/3d/plane/plane_computeConvex3PlaneIntersection.js +13 -14
  4. package/core/geom/3d/voxel/DenseBitVolume3D.js +87 -0
  5. package/core/geom/3d/voxel/buildVolumeFromProjectedGeometry.js +23 -0
  6. package/core/geom/Plane.js +14 -9
  7. package/core/primitives/array/computeIntegerArrayHash.js +1 -1
  8. package/engine/asset/loaders/material/computeImageBitmapEquality.js +11 -0
  9. package/engine/asset/loaders/material/computeImageBitmapHash.js +22 -28
  10. package/engine/ecs/util/hideEntityGracefully.js +18 -0
  11. package/engine/graphics/GraphicsEngine.js +0 -17
  12. package/engine/graphics/camera/testClippingPlaneComputation.js +2 -2
  13. package/engine/graphics/ecs/path/testPathDisplaySystem.js +98 -98
  14. package/engine/graphics/ecs/trail2d/Trail2D.js +17 -4
  15. package/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +2 -3
  16. package/engine/graphics/ecs/trail2d/Trail2DSystem.js +34 -118
  17. package/engine/graphics/particles/particular/engine/ParticularEngine.js +4 -2
  18. package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +20 -0
  19. package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +40 -97
  20. package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +12 -2
  21. package/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +37 -0
  22. package/engine/graphics/particles/particular/engine/emitter/distance_to_camera.js +25 -0
  23. package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
  24. package/engine/graphics/render/forward_plus/LightManager.js +10 -2
  25. package/engine/graphics/render/forward_plus/computeFrustumCorners.js +14 -32
  26. package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
  27. package/engine/graphics/render/forward_plus/prototypeLightManager.js +96 -95
  28. package/engine/graphics/render/forward_plus/queryBVH_Frustum.js +17 -5
  29. package/engine/graphics/render/layers/RenderLayerUtils.js +7 -4
  30. package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
  31. package/engine/graphics/texture/atlas/AtlasPatch.js +7 -2
  32. package/engine/graphics/texture/atlas/TextureAtlas.js +2 -2
  33. package/engine/graphics/texture/sampler/Sampler2D.js +8 -7
  34. package/engine/graphics/texture/sampler/scaleSampler2D.js +7 -10
  35. package/engine/graphics/trail/x/RibbonMaterialX.js +3 -3
  36. package/engine/graphics/trail/x/RibbonX.js +17 -2
  37. package/engine/graphics/trail/x/RibbonXPlugin.js +51 -1
  38. package/engine/grid/components/GridObstacle.js +2 -9
  39. package/engine/reference/v2/Reference.js +6 -0
  40. package/generation/theme/ThemeEngine.js +1 -1
  41. package/package.json +3 -3
  42. package/view/View.js +4 -2
@@ -3,7 +3,6 @@ import List from "../../../../../../core/collection/list/List.js";
3
3
  import { lerp } from "../../../../../../core/math/lerp.js";
4
4
  import { max2 } from "../../../../../../core/math/max2.js";
5
5
  import { min2 } from "../../../../../../core/math/min2.js";
6
- import { ParticleAttributeType, ParticleDataType } from "../../group/ParticleGroup.js";
7
6
  import { Box3, BufferGeometry, Frustum, Matrix4, Points, PointsMaterial } from 'three';
8
7
  import { frustumFromCamera } from "../../../../ecs/camera/CameraSystem.js";
9
8
  import { ParticlePool } from "./ParticlePool.js";
@@ -16,8 +15,6 @@ import { ParticleParameters } from "./ParticleParameters.js";
16
15
  import { BlendingType } from "../../../../texture/sampler/BlendingType.js";
17
16
  import Quaternion from "../../../../../../core/geom/Quaternion.js";
18
17
  import { computeHashIntegerArray } from "../../../../../../core/math/MathUtils.js";
19
- import { ParticleSpecification } from "../../group/ParticleSpecification.js";
20
- import { ParticleAttribute } from "../../group/ParticleAttribute.js";
21
18
  import { ParticleEmitterFlag } from "./ParticleEmitterFlag.js";
22
19
  import { AABB3 } from "../../../../../../core/bvh2/aabb3/AABB3.js";
23
20
  import {
@@ -34,14 +31,10 @@ import {
34
31
  PARTICLE_ATTRIBUTE_VELOCITY
35
32
  } from "./PARTICLE_ATTRIBUTES.js";
36
33
  import { composeMatrix4 } from "../../../../util/composeMatrix4.js";
37
- import { randomPointInPoint } from "../../../../../../core/geom/random/randomPointInPoint.js";
38
- import { randomPointInSphere } from "../../../../../../core/geom/random/randomPointInSphere.js";
39
- import { randomPointOnSphere } from "../../../../../../core/geom/random/randomPointOnSphere.js";
40
- import { randomPointInBox } from "../../../../../../core/geom/random/randomPointInBox.js";
41
- import { randomPointOnBox } from "../../../../../../core/geom/random/randomPointOnBox.js";
42
- import { EmissionFromType } from "./EmissionFromType.js";
43
- import { EmissionShapeType } from "./EmissionShapeType.js";
44
34
  import { update_parameters } from "../simulator/update_parameters.js";
35
+ import { distance_to_camera } from "./distance_to_camera.js";
36
+ import { computeEmissionFunction } from "./computeEmissionFunction.js";
37
+ import { PARTICULAR_PARTICLE_SPECIFICATION } from "./PARTICULAR_PARTICLE_SPECIFICATION.js";
45
38
 
46
39
  const EMPTY_GEOMETRY = new BufferGeometry();
47
40
 
@@ -66,60 +59,6 @@ const corners = new Float64Array(24);
66
59
  */
67
60
  const scratch_array = [];
68
61
 
69
- /**
70
- *
71
- * @param {EmissionFromType} emissionType
72
- * @param {EmissionShapeType} emissionShape
73
- * @returns {function(random: function, result:Vector3):void}
74
- */
75
- function computeEmissionFunction(emissionType, emissionShape) {
76
- if (emissionShape === EmissionShapeType.Point) {
77
- return randomPointInPoint;
78
- } else if (emissionShape === EmissionShapeType.Sphere) {
79
- if (emissionType === EmissionFromType.Volume) {
80
- return randomPointInSphere;
81
- } else if (emissionType === EmissionFromType.Shell) {
82
- return randomPointOnSphere;
83
- } else {
84
- throw new TypeError(`Unsupported EmissionFrom Type`);
85
- }
86
- } else if (emissionShape === EmissionShapeType.Box) {
87
- if (emissionType === EmissionFromType.Volume) {
88
- return randomPointInBox;
89
- } else if (emissionType === EmissionFromType.Shell) {
90
- return randomPointOnBox;
91
- } else {
92
- throw new TypeError(`Unsupported EmissionFrom Type`);
93
- }
94
- }
95
- }
96
-
97
- /**
98
- *
99
- * @param {number} index
100
- * @param {number[]|Float32Array} positionArray
101
- * @param {Vector3} planeNormal
102
- * @return {number}
103
- */
104
- function distanceToCamera(index, positionArray, planeNormal) {
105
- const address = index * 3;
106
-
107
- // extract position components of the particle
108
- const x = positionArray[address];
109
- const y = positionArray[address + 1];
110
- const z = positionArray[address + 2];
111
-
112
- const planeNormalX = planeNormal.x;
113
- const planeNormalY = planeNormal.y;
114
- const planeNormalZ = planeNormal.z;
115
-
116
- // compute dot product
117
- const dot = x * planeNormalX + y * planeNormalY + z * planeNormalZ;
118
-
119
- // use dot product instead of the actual distance to save computation. Difference is going to be constant
120
- return dot;
121
- }
122
-
123
62
  /**
124
63
  *
125
64
  * @param {ParameterSet} parameters
@@ -411,7 +350,12 @@ export class ParticleEmitter {
411
350
 
412
351
  let removeCount = 0;
413
352
 
414
- for (let i = occupancy.nextSetBit(0); i !== -1; i = occupancy.nextSetBit(i + 1)) {
353
+ for (
354
+ let i = occupancy.nextSetBit(0);
355
+ i !== -1;
356
+ i = occupancy.nextSetBit(i + 1)
357
+ ) {
358
+
415
359
  const layerPosition = particles.readAttributeScalar(i, PARTICLE_ATTRIBUTE_LAYER_POSITION);
416
360
 
417
361
  const layerIndex = Math.round(layerPosition * numLayers);
@@ -425,6 +369,7 @@ export class ParticleEmitter {
425
369
  occupancy.set(i, false);
426
370
 
427
371
  removeCount++;
372
+
428
373
  }
429
374
 
430
375
  if (removeCount > 0) {
@@ -489,7 +434,10 @@ export class ParticleEmitter {
489
434
  }
490
435
  }
491
436
 
492
- this.emisionBounds.setBounds(bounds_x0, bounds_y0, bounds_z0, bounds_x1, bounds_y1, bounds_z1);
437
+ this.emisionBounds.setBounds(
438
+ bounds_x0, bounds_y0, bounds_z0,
439
+ bounds_x1, bounds_y1, bounds_z1
440
+ );
493
441
 
494
442
  this.clearFlag(ParticleEmitterFlag.BaseBoundsNeedUpdate);
495
443
  }
@@ -708,8 +656,8 @@ export class ParticleEmitter {
708
656
  }
709
657
 
710
658
  computeHash() {
711
- const parametersHash = this.parameters.hash();
712
- const layersHash = this.layers.hash();
659
+ const parameters_hash = this.parameters.hash();
660
+ const layers_hash = this.layers.hash();
713
661
 
714
662
  /**
715
663
  * Extract relevant flags
@@ -717,7 +665,12 @@ export class ParticleEmitter {
717
665
  */
718
666
  const flags = this.flags & (SERIALIZABLE_FLAGS);
719
667
 
720
- return computeHashIntegerArray(parametersHash, layersHash, this.blendingMode, flags);
668
+ return computeHashIntegerArray(
669
+ parameters_hash,
670
+ layers_hash,
671
+ this.blendingMode,
672
+ flags
673
+ );
721
674
  }
722
675
 
723
676
  hash() {
@@ -799,14 +752,19 @@ export class ParticleEmitter {
799
752
 
800
753
  const pivotIndex = (left + right) >> 1;
801
754
 
802
- const pivot = distanceToCamera(pivotIndex, positionArray, nearPlaneNormal);
755
+ const pivot = distance_to_camera(pivotIndex, positionArray, nearPlaneNormal);
803
756
 
804
757
  /* partition */
805
758
  while (i <= j) {
806
- while (distanceToCamera(i, positionArray, nearPlaneNormal) > pivot)
759
+
760
+ while (distance_to_camera(i, positionArray, nearPlaneNormal) > pivot) {
807
761
  i++;
808
- while (distanceToCamera(j, positionArray, nearPlaneNormal) < pivot)
762
+ }
763
+
764
+ while (distance_to_camera(j, positionArray, nearPlaneNormal) < pivot) {
809
765
  j--;
766
+ }
767
+
810
768
  if (i <= j) {
811
769
 
812
770
  if (i !== j) {
@@ -1032,7 +990,7 @@ export class ParticleEmitter {
1032
990
 
1033
991
  update_parameters(ref, particles, layer, initialAge / deathAge);
1034
992
 
1035
- particles.writeAttributeScalar(ref,PARTICLE_ATTRIBUTE_BLEND,this.blendingMode);
993
+ particles.writeAttributeScalar(ref, PARTICLE_ATTRIBUTE_BLEND, this.blendingMode);
1036
994
  }
1037
995
 
1038
996
  //update time buffer
@@ -1051,9 +1009,11 @@ export class ParticleEmitter {
1051
1009
  return;
1052
1010
  }
1053
1011
 
1054
- assert.ok(layerIndex < this.layers.length && layerIndex >= 0, `layerIndex[=${layerIndex}] is out of bounds`);
1012
+ const layers = this.layers;
1055
1013
 
1056
- const layer = this.layers.get(layerIndex);
1014
+ assert.ok(layerIndex < layers.length && layerIndex >= 0, `layerIndex[=${layerIndex}] is out of bounds`);
1015
+
1016
+ const layer = layers.get(layerIndex);
1057
1017
 
1058
1018
  const random = Math.random;
1059
1019
 
@@ -1065,7 +1025,7 @@ export class ParticleEmitter {
1065
1025
 
1066
1026
  const emissionFunction = computeEmissionFunction(layer.emissionFrom, layer.emissionShape);
1067
1027
 
1068
- const layerPosition = layerIndex / this.layers.length;
1028
+ const layerPosition = layerIndex / layers.length;
1069
1029
 
1070
1030
  //compute transform matrix of the emitter
1071
1031
  composeMatrix4(matrix4, this.position, this.rotation, this.scale);
@@ -1159,7 +1119,7 @@ export class ParticleEmitter {
1159
1119
 
1160
1120
  update_parameters(ref, particles, layer, initialAge / deathAge);
1161
1121
 
1162
- particles.writeAttributeScalar(ref,PARTICLE_ATTRIBUTE_BLEND,this.blendingMode);
1122
+ particles.writeAttributeScalar(ref, PARTICLE_ATTRIBUTE_BLEND, this.blendingMode);
1163
1123
  }
1164
1124
 
1165
1125
  if (spritesNeedUpdate) {
@@ -1197,7 +1157,9 @@ export class ParticleEmitter {
1197
1157
  continue;
1198
1158
  }
1199
1159
 
1200
- const averageLifetime = (layer.particleLife.max + layer.particleLife.min) / 2;
1160
+ const particleLife = layer.particleLife;
1161
+
1162
+ const averageLifetime = (particleLife.max + particleLife.min) / 2;
1201
1163
 
1202
1164
  //emitting more than averageLifetime lifetime is unproductive, so we'll crop the emission
1203
1165
  let emissionDelta;
@@ -1260,27 +1222,8 @@ const matrix4 = new Matrix4();
1260
1222
 
1261
1223
  const defaultPointsMaterial = new PointsMaterial({ color: 0xFFFFFF });
1262
1224
 
1263
-
1264
- //build particle spec
1265
- export const PARTICULAR_PARTICLE_SPECIFICATION = new ParticleSpecification();
1266
-
1267
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('position', ParticleAttributeType.Vector3, ParticleDataType.Float32));
1268
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('age', ParticleAttributeType.Scalar, ParticleDataType.Float32));
1269
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('deathAge', ParticleAttributeType.Scalar, ParticleDataType.Float32));
1270
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('atlasPatch', ParticleAttributeType.Vector4, ParticleDataType.Float32));
1271
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('size', ParticleAttributeType.Scalar, ParticleDataType.Float32));
1272
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('layerPosition', ParticleAttributeType.Scalar, ParticleDataType.Float32));
1273
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('velocity', ParticleAttributeType.Vector3, ParticleDataType.Float32));
1274
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('rotation', ParticleAttributeType.Scalar, ParticleDataType.Float32));
1275
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('rotationSpeed', ParticleAttributeType.Scalar, ParticleDataType.Float32));
1276
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('color', ParticleAttributeType.Vector4, ParticleDataType.Float32));
1277
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('blending', ParticleAttributeType.Scalar, ParticleDataType.Uint8));
1278
- PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('size_initial', ParticleAttributeType.Scalar, ParticleDataType.Float32));
1279
-
1280
-
1281
1225
  const frustum = new Frustum();
1282
1226
 
1283
- const velocity = [];
1284
1227
  const position = [];
1285
1228
 
1286
1229
  const v3position = new Vector3();
@@ -68,6 +68,7 @@ function ParticleLayer() {
68
68
  * @type {number}
69
69
  */
70
70
  this.emissionRate = 1;
71
+
71
72
  /**
72
73
  * When layer is added - it will immediately emit this number of particles
73
74
  * @type {number}
@@ -97,6 +98,11 @@ function ParticleLayer() {
97
98
  * @type {ConicRay}
98
99
  */
99
100
  this.particleVelocityDirection = new ConicRay();
101
+
102
+ /**
103
+ *
104
+ * @type {NumericInterval}
105
+ */
100
106
  this.particleSpeed = new NumericInterval(0, 0);
101
107
 
102
108
  /**
@@ -111,7 +117,6 @@ function ParticleLayer() {
111
117
  */
112
118
  this.isEmitting = true;
113
119
 
114
-
115
120
  /**
116
121
  * Simulation steps that are to be applied
117
122
  * @type {List<SimulationStepDefinition>}
@@ -173,7 +178,12 @@ ParticleLayer.prototype.computePointBoundingBox = function (result) {
173
178
  //displace by current position
174
179
  const position = this.position;
175
180
 
176
- computeConeBoundingBox(aabb3, position.x, position.y, position.z, direction.x, direction.y, direction.z, particleVelocityDirection.angle, maxDisplacement);
181
+ computeConeBoundingBox(
182
+ aabb3,
183
+ position.x, position.y, position.z,
184
+ direction.x, direction.y, direction.z,
185
+ particleVelocityDirection.angle, maxDisplacement
186
+ );
177
187
 
178
188
  x0 = aabb3.x0;
179
189
  y0 = aabb3.y0;
@@ -0,0 +1,37 @@
1
+ import { EmissionShapeType } from "./EmissionShapeType.js";
2
+ import { randomPointInPoint } from "../../../../../../core/geom/random/randomPointInPoint.js";
3
+ import { EmissionFromType } from "./EmissionFromType.js";
4
+ import { randomPointInSphere } from "../../../../../../core/geom/random/randomPointInSphere.js";
5
+ import { randomPointOnSphere } from "../../../../../../core/geom/random/randomPointOnSphere.js";
6
+ import { randomPointInBox } from "../../../../../../core/geom/random/randomPointInBox.js";
7
+ import { randomPointOnBox } from "../../../../../../core/geom/random/randomPointOnBox.js";
8
+
9
+ /**
10
+ *
11
+ * @param {EmissionFromType} emissionType
12
+ * @param {EmissionShapeType} emissionShape
13
+ * @returns {function(random: function, result:Vector3):void}
14
+ */
15
+ export function computeEmissionFunction(emissionType, emissionShape) {
16
+ if (emissionShape === EmissionShapeType.Point) {
17
+ return randomPointInPoint;
18
+ } else if (emissionShape === EmissionShapeType.Sphere) {
19
+ if (emissionType === EmissionFromType.Volume) {
20
+ return randomPointInSphere;
21
+ } else if (emissionType === EmissionFromType.Shell) {
22
+ return randomPointOnSphere;
23
+ } else {
24
+ throw new TypeError('Unsupported EmissionFrom Type');
25
+ }
26
+ } else if (emissionShape === EmissionShapeType.Box) {
27
+ if (emissionType === EmissionFromType.Volume) {
28
+ return randomPointInBox;
29
+ } else if (emissionType === EmissionFromType.Shell) {
30
+ return randomPointOnBox;
31
+ } else {
32
+ throw new TypeError('Unsupported EmissionFrom Type');
33
+ }
34
+ } else {
35
+ throw new TypeError('Unsupported emission shape');
36
+ }
37
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ *
3
+ * @param {number} index
4
+ * @param {number[]|Float32Array} positionArray
5
+ * @param {Vector3} planeNormal
6
+ * @return {number}
7
+ */
8
+ export function distance_to_camera(index, positionArray, planeNormal) {
9
+ const address = index * 3;
10
+
11
+ // extract position components of the particle
12
+ const x = positionArray[address];
13
+ const y = positionArray[address + 1];
14
+ const z = positionArray[address + 2];
15
+
16
+ const planeNormalX = planeNormal.x;
17
+ const planeNormalY = planeNormal.y;
18
+ const planeNormalZ = planeNormal.z;
19
+
20
+ // compute dot product
21
+ const dot = x * planeNormalX + y * planeNormalY + z * planeNormalZ;
22
+
23
+ // use dot product instead of the actual distance to save computation. Difference is going to be constant
24
+ return dot;
25
+ }
@@ -108,7 +108,7 @@ function makeConfig(engine) {
108
108
  new ClingToTerrainSystem(),
109
109
  new TerrainSystem(graphics, assetManager),
110
110
  new WaterSystem(graphics),
111
- new Trail2DSystem(graphics, assetManager),
111
+ new Trail2DSystem(engine),
112
112
  new Foliage2System(assetManager, graphics),
113
113
  new ViewportPositionSystem(graphics.viewport.size),
114
114
  new GridPosition2TransformSystem(),
@@ -326,7 +326,7 @@ function main(engine) {
326
326
  position: {
327
327
  x: 60 + i * 10,
328
328
  y: 0,
329
- z: 30 + j*10
329
+ z: 30 + j * 10
330
330
  },
331
331
  scale: {
332
332
  x: 1,
@@ -508,6 +508,7 @@ export class LightManager {
508
508
  let lookup_address_offset = 0;
509
509
  let i_x_0, i_y_0, i_z_0;
510
510
 
511
+ // clear cache
511
512
  LOOKUP_CACHE.fill(0xFFFFFFFF);
512
513
 
513
514
  for (i_z_0 = 0; i_z_0 < tr_z; i_z_0++) {
@@ -529,7 +530,6 @@ export class LightManager {
529
530
  read_plane_pair(cluster_planes, y_plane_index_offset_0, scratch_frustum_planes, 8);
530
531
 
531
532
  for (i_x_0 = 0; i_x_0 < tr_x; i_x_0++) {
532
- const i_x_1 = i_x_0 + 1;
533
533
 
534
534
  // construct x planes
535
535
 
@@ -551,6 +551,8 @@ export class LightManager {
551
551
  const frustum_point_index_011 = i_z_1 * tr_xy_1 + i_y_1 * tr_x_1 + i_x_0;
552
552
  read_frustum_corner(cluster_frustum_points, frustum_point_index_011, scratch_corners, 9);
553
553
 
554
+ const i_x_1 = i_x_0 + 1;
555
+
554
556
  const frustum_point_index_100 = i_z_0 * tr_xy_1 + i_y_0 * tr_x_1 + i_x_1;
555
557
  read_frustum_corner(cluster_frustum_points, frustum_point_index_100, scratch_corners, 12);
556
558
 
@@ -565,7 +567,13 @@ export class LightManager {
565
567
 
566
568
 
567
569
  // at this point we have a fully constructed cluster, we can query lights within the cluster
568
- const match_count = queryBVH_Frustum(scratch_light_nodes, 0, bvh, scratch_frustum_planes, scratch_corners);
570
+ const match_count = queryBVH_Frustum(
571
+ scratch_light_nodes,
572
+ 0,
573
+ bvh,
574
+ scratch_frustum_planes,
575
+ scratch_corners
576
+ );
569
577
 
570
578
  const tile_index = (i_z_0 * tile_slice_size) + (i_y_0 * tr_x) + (tr_x - i_x_1);
571
579
 
@@ -1,15 +1,5 @@
1
- import Vector3 from "../../../../core/geom/Vector3.js";
2
1
  import { plane_three_computeConvex3PlaneIntersection } from "../../../../core/geom/3d/plane/plane_computeConvex3PlaneIntersection.js";
3
2
 
4
- const v_000 = new Vector3();
5
- const v_001 = new Vector3();
6
- const v_010 = new Vector3();
7
- const v_011 = new Vector3();
8
- const v_100 = new Vector3();
9
- const v_101 = new Vector3();
10
- const v_110 = new Vector3();
11
- const v_111 = new Vector3();
12
-
13
3
  /**
14
4
  *
15
5
  * @param {Float32Array|number[]} result
@@ -18,68 +8,60 @@ const v_111 = new Vector3();
18
8
  export function computeFrustumCorners(result, planes) {
19
9
 
20
10
  const plane_x0 = planes[0];
21
- const plane_x1 = planes[1];
22
-
23
11
  const plane_y0 = planes[2];
24
- const plane_y1 = planes[3];
25
-
26
12
  const plane_z0 = planes[4];
27
- const plane_z1 = planes[5];
28
13
 
29
- plane_three_computeConvex3PlaneIntersection(v_000,
14
+ plane_three_computeConvex3PlaneIntersection(result, 0,
30
15
  plane_x0,
31
16
  plane_y0,
32
17
  plane_z0
33
18
  );
34
19
 
35
- plane_three_computeConvex3PlaneIntersection(v_001,
20
+ const plane_z1 = planes[5];
21
+
22
+ plane_three_computeConvex3PlaneIntersection(result, 3,
36
23
  plane_x0,
37
24
  plane_y0,
38
25
  plane_z1
39
26
  );
40
27
 
41
- plane_three_computeConvex3PlaneIntersection(v_010,
28
+ const plane_y1 = planes[3];
29
+
30
+ plane_three_computeConvex3PlaneIntersection(result, 6,
42
31
  plane_x0,
43
32
  plane_y1,
44
33
  plane_z0
45
34
  );
46
35
 
47
- plane_three_computeConvex3PlaneIntersection(v_011,
36
+ plane_three_computeConvex3PlaneIntersection(result, 9,
48
37
  plane_x0,
49
38
  plane_y1,
50
39
  plane_z1
51
40
  );
52
41
 
53
- plane_three_computeConvex3PlaneIntersection(v_100,
42
+ const plane_x1 = planes[1];
43
+
44
+ plane_three_computeConvex3PlaneIntersection(result, 12,
54
45
  plane_x1,
55
46
  plane_y0,
56
47
  plane_z0
57
48
  );
58
49
 
59
- plane_three_computeConvex3PlaneIntersection(v_101,
50
+ plane_three_computeConvex3PlaneIntersection(result, 15,
60
51
  plane_x1,
61
52
  plane_y0,
62
53
  plane_z1
63
54
  );
64
55
 
65
- plane_three_computeConvex3PlaneIntersection(v_110,
56
+ plane_three_computeConvex3PlaneIntersection(result, 18,
66
57
  plane_x1,
67
58
  plane_y1,
68
59
  plane_z0
69
60
  );
70
61
 
71
- plane_three_computeConvex3PlaneIntersection(v_111,
62
+ plane_three_computeConvex3PlaneIntersection(result, 21,
72
63
  plane_x1,
73
64
  plane_y1,
74
65
  plane_z1
75
66
  );
76
-
77
- v_000.writeToArray(result, 0);
78
- v_001.writeToArray(result, 3);
79
- v_010.writeToArray(result, 6);
80
- v_011.writeToArray(result, 9);
81
- v_100.writeToArray(result, 12);
82
- v_101.writeToArray(result, 15);
83
- v_110.writeToArray(result, 18);
84
- v_111.writeToArray(result, 21);
85
67
  }
@@ -125,7 +125,7 @@ function makeConfig(engine) {
125
125
  new ClingToTerrainSystem(),
126
126
  new TerrainSystem(graphics, assetManager),
127
127
  new WaterSystem(graphics),
128
- new Trail2DSystem(graphics, assetManager),
128
+ new Trail2DSystem(engine),
129
129
  new Foliage2System(assetManager, graphics),
130
130
  new ViewportPositionSystem(graphics.viewport.size),
131
131
  new GridPosition2TransformSystem(),