@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
@@ -1,15 +1,18 @@
1
1
  import { EnginePlugin } from "../../../plugin/EnginePlugin.js";
2
2
  import { RibbonMaterialX } from "./RibbonMaterialX.js";
3
- import { DoubleSide } from "three";
3
+ import { DoubleSide, Vector2 } from "three";
4
4
  import { GameAssetType } from "../../../asset/GameAssetType.js";
5
5
  import { Cache } from "../../../../core/cache/Cache.js";
6
6
  import { invokeObjectEquals } from "../../../../core/model/object/invokeObjectEquals.js";
7
7
  import { invokeObjectHash } from "../../../../core/model/object/invokeObjectHash.js";
8
+ import { MaterialManager } from "../../material/manager/MaterialManager.js";
8
9
 
9
10
  export class RibbonXPlugin extends EnginePlugin {
10
11
  initialize(engine) {
11
12
  super.initialize(engine);
12
13
 
14
+ this.id = 'ribbon-x-plugin';
15
+
13
16
  /**
14
17
  * @private
15
18
  * @readonly
@@ -21,6 +24,51 @@ export class RibbonXPlugin extends EnginePlugin {
21
24
  keyHashFunction: invokeObjectHash,
22
25
  keyEqualityFunction: invokeObjectEquals
23
26
  });
27
+
28
+ this.__shared_uniforms = {
29
+ resolution: {
30
+ value: new Vector2(1, 1)
31
+ }
32
+ };
33
+
34
+ /**
35
+ *
36
+ * @type {MaterialManager}
37
+ * @private
38
+ */
39
+ this.__materials = new MaterialManager();
40
+ }
41
+
42
+ __handle_viewport_size_change() {
43
+ const s = this.engine.graphics.viewport.size;
44
+
45
+ this.__shared_uniforms.resolution.value.set(s.x, s.y);
46
+ }
47
+
48
+ async startup() {
49
+ this.__handle_viewport_size_change();
50
+
51
+ this.engine.graphics.viewport.size.onChanged.add(this.__handle_viewport_size_change, this);
52
+
53
+ return super.startup();
54
+ }
55
+
56
+ async shutdown() {
57
+
58
+ this.engine.graphics.viewport.size.onChanged.remove(this.__handle_viewport_size_change, this);
59
+
60
+ return super.shutdown();
61
+ }
62
+
63
+ /**
64
+ *
65
+ * @param {RibbonXMaterialSpec} spec
66
+ * @return {Reference<Material>}
67
+ */
68
+ obtain_material_reference(spec) {
69
+ const mm = this.obtain_material_x(spec);
70
+
71
+ return this.__materials.obtain(mm);
24
72
  }
25
73
 
26
74
  /**
@@ -62,6 +110,8 @@ export class RibbonXPlugin extends EnginePlugin {
62
110
  }
63
111
  });
64
112
 
113
+ material.uniforms.resolution = this.__shared_uniforms.resolution;
114
+
65
115
  if (spec.diffuse !== null) {
66
116
  const am = this.engine.assetManager;
67
117
 
@@ -8,6 +8,7 @@ import { computeHashIntegerArray } from "../../../core/math/MathUtils.js";
8
8
  import { assert } from "../../../core/assert.js";
9
9
  import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
10
10
  import { computeIntegerArrayHash } from "../../../core/primitives/array/computeIntegerArrayHash.js";
11
+ import { isArrayEqualStrict } from "../../../core/collection/array/isArrayEqualStrict.js";
11
12
 
12
13
  class GridObstacle {
13
14
  constructor() {
@@ -236,15 +237,7 @@ class GridObstacle {
236
237
  return false;
237
238
  }
238
239
 
239
- const dataSize = this.size.x * this.size.y;
240
-
241
- for (let i = 0; i < dataSize; i++) {
242
- if (this.data[i] !== other.data[i]) {
243
- return false;
244
- }
245
- }
246
-
247
- return true;
240
+ return isArrayEqualStrict(this.data, other.data);
248
241
  }
249
242
  }
250
243
 
@@ -81,3 +81,9 @@ export class Reference {
81
81
  this.__onReleased.send1(this);
82
82
  }
83
83
  }
84
+
85
+ /**
86
+ * @readonly
87
+ * @type {Readonly<Reference>}
88
+ */
89
+ Reference.NULL = Object.freeze(new Reference());
@@ -337,7 +337,7 @@ export class ThemeEngine {
337
337
  const source_x = u * weights.width;
338
338
 
339
339
 
340
- weights.sampleBilinear(source_x, source_y, weightSample);
340
+ weights.sampleBilinear(source_x, source_y, weightSample, 0);
341
341
 
342
342
  for (let i = 0; i < layer_count; i++) {
343
343
  const targetAddress = (y * splatWidth + x) + i * splatLayerSize;
package/package.json CHANGED
@@ -4,15 +4,15 @@
4
4
  "productName": "Meep",
5
5
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
6
6
  "author": "Alexander Goldring",
7
- "version": "2.33.22",
7
+ "version": "2.33.23",
8
8
  "dependencies": {
9
9
  "fast-levenshtein": "2.0.6",
10
10
  "opentype.js": "1.3.3",
11
11
  "simplex-noise": "2.4.0",
12
- "three": "0.132.2"
12
+ "three": "^0.132.2"
13
13
  },
14
14
  "devDependencies": {
15
15
  "babel-jest": "^26.6.3",
16
- "@types/three": "0.132.2"
16
+ "@types/three": "^0.132.2"
17
17
  }
18
18
  }
package/view/View.js CHANGED
@@ -677,10 +677,12 @@ class View {
677
677
 
678
678
  const classesToRemove = [];
679
679
 
680
- for (let i = 0; i < classList.length; i++) {
680
+ const initial_class_count = classList.length;
681
+
682
+ for (let i = 0; i < initial_class_count; i++) {
681
683
  const className = classList[i];
682
684
 
683
- if (className.startsWith('locale-')) {
685
+ if (className.search(rx) !== -1) {
684
686
  classesToRemove.push(className);
685
687
  }
686
688
  }