@woosh/meep-engine 2.33.59 → 2.33.60

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 (39) hide show
  1. package/core/bvh2/aabb3/AABB3.js +4 -1
  2. package/core/bvh2/traversal/traverseBinaryNodeUsingVisitor.js +6 -6
  3. package/core/cache/Cache.js +7 -0
  4. package/core/collection/array/fastArrayEquals.js +17 -0
  5. package/core/collection/array/typed/is_typed_array_equals.js +58 -0
  6. package/core/collection/map/AbstractAsyncMap.js +30 -0
  7. package/core/collection/map/AsyncMapWrapper.js +16 -0
  8. package/core/collection/map/AsyncRemoteHashMap.js +358 -0
  9. package/core/collection/map/CachedAsyncMap.js +34 -0
  10. package/core/geom/Vector4.js +5 -5
  11. package/engine/animation/removeEntityGenericEffect.js +22 -31
  12. package/engine/asset/Asset.js +0 -45
  13. package/engine/asset/AssetDescription.js +51 -0
  14. package/engine/asset/AssetManager.d.ts +7 -0
  15. package/engine/asset/AssetManager.js +98 -2
  16. package/engine/asset/AssetTransformer.d.ts +5 -0
  17. package/engine/asset/AssetTransformer.js +15 -0
  18. package/engine/asset/loaders/GLTFAssetLoader.js +27 -25
  19. package/engine/asset/loaders/material/computeImageBitmapEquality.js +2 -2
  20. package/engine/asset/loaders/material/computeTextureEquality.js +2 -2
  21. package/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +60 -45
  22. package/engine/ecs/storage/binary/BinaryClassUpgrader.js +1 -0
  23. package/engine/ecs/util/removeComponentsExcept.js +3 -3
  24. package/engine/graphics/GraphicsEngine.js +3 -3
  25. package/engine/graphics/ecs/mesh/Mesh.js +5 -5
  26. package/engine/graphics/ecs/mesh/MeshSystem.js +12 -20
  27. package/engine/graphics/ecs/trail2d/Trail2D.js +35 -1
  28. package/engine/graphics/ecs/trail2d/Trail2DSystem.js +26 -19
  29. package/engine/graphics/ecs/trail2d/makeGradientTrail.js +68 -0
  30. package/engine/graphics/micron/convert_three_object_to_micron.js +24 -7
  31. package/engine/graphics/micron/plugin/MicronRenderPlugin.js +107 -4
  32. package/engine/graphics/micron/plugin/serialization/BufferGeometrySerializationAdapter.js +176 -0
  33. package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -2
  34. package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +3 -1
  35. package/engine/graphics/shadows/ShadowMapRenderer.js +10 -4
  36. package/engine/graphics/texture/sampler/Sampler2D.js +24 -45
  37. package/engine/intelligence/behavior/ecs/WaitForEventBehavior.js +3 -0
  38. package/engine/save/storage/IndexedDBStorage.js +8 -1
  39. package/package.json +1 -1
@@ -132,6 +132,7 @@ function makeConfig(engine) {
132
132
 
133
133
  // Plugins
134
134
  config.addPlugin(MicronRenderPlugin);
135
+ config.addPlugin(AmbientOcclusionPostProcessEffect);
135
136
 
136
137
 
137
138
  // Knowledge
@@ -159,8 +160,6 @@ async function init(harness) {
159
160
  await engine.graphics.loadEnvironmentMap(buildCubeURLs('data/textures/cubemaps/hip_miramar/32/', '.png'));
160
161
 
161
162
 
162
- await engine.plugins.acquire(AmbientOcclusionPostProcessEffect);
163
-
164
163
  await harness.initialize();
165
164
 
166
165
  main(engine);
@@ -116,14 +116,16 @@ export function query_bvh_frustum_from_texture(
116
116
  const radius = source_data[light_address + 3];
117
117
 
118
118
  if (!point_light_inside_volume(light_x, light_y, light_z, radius, points, planes)) {
119
+ // cull
119
120
  continue;
120
121
  }
122
+
121
123
  } else if (light_type === 3) {
122
124
  // decal
123
125
  debugger;
124
126
 
125
127
  } else {
126
- throw new Error('Unsupported light type');
128
+ throw new Error(`Unsupported light type ${light_type}`);
127
129
  }
128
130
 
129
131
  // write to output
@@ -95,12 +95,18 @@ export class ShadowMapRenderer {
95
95
 
96
96
  this.onBeforeRender.send3(renderer, shadow_camera, scene);
97
97
 
98
- renderer.render(scene, shadow_camera);
99
-
100
- if (renderer.shadowMap.type === VSMShadowMap) {
101
- this.__do_vsm_pass(shadow);
98
+ if (target.width <= 0 || target.height <= 0) {
99
+ // no point in rendering
100
+ } else {
101
+ // do the draw
102
+ renderer.render(scene, shadow_camera);
103
+
104
+ if (renderer.shadowMap.type === VSMShadowMap) {
105
+ this.__do_vsm_pass(shadow);
106
+ }
102
107
  }
103
108
 
109
+
104
110
  // restore state
105
111
  renderer.setRenderTarget(__rt, __acf, __aml);
106
112
  renderer.setScissorTest(__scissor);
@@ -570,6 +570,10 @@ Sampler2D.prototype.sampleChannelBicubic = function (x, y, channel) {
570
570
  const x1 = clamp(x, 0, x_max) | 0;
571
571
  const y1 = clamp(y, 0, y_max) | 0;
572
572
 
573
+ // fractional texel position (from the nearest low texel)
574
+ const xd = x - x1;
575
+ const yd = y - y1;
576
+
573
577
  const x0 = max2(0, x1 - 1);
574
578
  const y0 = max2(0, y1 - 1);
575
579
 
@@ -595,61 +599,36 @@ Sampler2D.prototype.sampleChannelBicubic = function (x, y, channel) {
595
599
  const col2_offset = x2 * itemSize;
596
600
  const col3_offset = x3 * itemSize;
597
601
 
598
- // compute sample addresses
599
- const i0 = row0_address + col0_offset;
600
- const i1 = row0_address + col1_offset;
601
- const i2 = row0_address + col2_offset;
602
- const i3 = row0_address + col3_offset;
603
-
604
- const j0 = row1_address + col0_offset;
605
- const j1 = row1_address + col1_offset;
606
- const j2 = row1_address + col2_offset;
607
- const j3 = row1_address + col3_offset;
602
+ // read samples
603
+ const vi0 = data[row0_address + col0_offset];
604
+ const vi1 = data[row0_address + col1_offset];
605
+ const vi2 = data[row0_address + col2_offset];
606
+ const vi3 = data[row0_address + col3_offset];
608
607
 
609
- const k0 = row2_address + col0_offset;
610
- const k1 = row2_address + col1_offset;
611
- const k2 = row2_address + col2_offset;
612
- const k3 = row2_address + col3_offset;
608
+ const vj0 = data[row1_address + col0_offset];
609
+ const vj1 = data[row1_address + col1_offset];
610
+ const vj2 = data[row1_address + col2_offset];
611
+ const vj3 = data[row1_address + col3_offset];
613
612
 
614
- const l0 = row3_address + col0_offset;
615
- const l1 = row3_address + col1_offset;
616
- const l2 = row3_address + col2_offset;
617
- const l3 = row3_address + col3_offset;
613
+ const vk0 = data[row2_address + col0_offset];
614
+ const vk1 = data[row2_address + col1_offset];
615
+ const vk2 = data[row2_address + col2_offset];
616
+ const vk3 = data[row2_address + col3_offset];
618
617
 
619
- // read samples
620
- const vi0 = data[i0];
621
- const vi1 = data[i1];
622
- const vi2 = data[i2];
623
- const vi3 = data[i3];
624
-
625
- const vj0 = data[j0];
626
- const vj1 = data[j1];
627
- const vj2 = data[j2];
628
- const vj3 = data[j3];
629
-
630
- const vk0 = data[k0];
631
- const vk1 = data[k1];
632
- const vk2 = data[k2];
633
- const vk3 = data[k3];
634
-
635
- const vl0 = data[l0];
636
- const vl1 = data[l1];
637
- const vl2 = data[l2];
638
- const vl3 = data[l3];
618
+ const vl0 = data[row3_address + col0_offset];
619
+ const vl1 = data[row3_address + col1_offset];
620
+ const vl2 = data[row3_address + col2_offset];
621
+ const vl3 = data[row3_address + col3_offset];
639
622
 
640
- const xd = x - x1;
641
- const yd = y - y1;
642
623
 
643
- // perform filtering in X
624
+ // perform filtering in X (rows)
644
625
  const s0 = bicubic_terp(xd, vi0, vi1, vi2, vi3);
645
626
  const s1 = bicubic_terp(xd, vj0, vj1, vj2, vj3);
646
627
  const s2 = bicubic_terp(xd, vk0, vk1, vk2, vk3);
647
628
  const s3 = bicubic_terp(xd, vl0, vl1, vl2, vl3);
648
629
 
649
- // filter in Y
650
- const result = bicubic_terp(yd, s0, s1, s2, s3);
651
-
652
- return result;
630
+ // filter in Y (columns)
631
+ return bicubic_terp(yd, s0, s1, s2, s3);
653
632
  };
654
633
 
655
634
  /**
@@ -1,6 +1,7 @@
1
1
  import { EntityBehavior } from "./EntityBehavior.js";
2
2
  import { BehaviorStatus } from "../BehaviorStatus.js";
3
3
  import { BinaryClassSerializationAdapter } from "../../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
4
+ import { assert } from "../../../../core/assert.js";
4
5
 
5
6
  export class WaitForEventBehavior extends EntityBehavior {
6
7
  constructor() {
@@ -26,6 +27,8 @@ export class WaitForEventBehavior extends EntityBehavior {
26
27
  }
27
28
 
28
29
  fromJSON({ event, target = -1 }) {
30
+ assert.isString(event, 'event');
31
+
29
32
  this.event = event;
30
33
  this.target = target;
31
34
  }
@@ -1,12 +1,18 @@
1
1
  import Storage from "../Storage.js";
2
2
  import { IndexedDBTransactionMode } from "./IndexedDBTransactionMode.js";
3
+ import { assert } from "../../../core/assert.js";
3
4
 
4
5
  const MAIN_STORE_NAME = 'main';
5
6
 
7
+ /**
8
+ * TODO add QuotaExceededError handling
9
+ */
6
10
  export class IndexedDBStorage extends Storage {
7
11
  constructor(name) {
8
12
  super();
9
13
 
14
+ assert.isString(name, 'name');
15
+
10
16
  /**
11
17
  *
12
18
  * @param {IDBDatabase} database
@@ -43,7 +49,7 @@ export class IndexedDBStorage extends Storage {
43
49
 
44
50
  const objectStore = transaction.objectStore(MAIN_STORE_NAME);
45
51
 
46
- const idbRequest = objectStore.delete( key);
52
+ const idbRequest = objectStore.delete(key);
47
53
 
48
54
  if (typeof resolve === "function") {
49
55
 
@@ -60,6 +66,7 @@ export class IndexedDBStorage extends Storage {
60
66
  });
61
67
 
62
68
  }
69
+
63
70
  });
64
71
 
65
72
  if (typeof reject === "function") {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "productName": "Meep",
6
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.33.59",
8
+ "version": "2.33.60",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",