@woosh/meep-engine 2.33.25 → 2.33.29

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 (65) hide show
  1. package/core/binary/BitSet.js +151 -167
  2. package/core/binary/BitSet.spec.js +99 -1
  3. package/core/binary/ValidatingBitSetWrapper.js +81 -0
  4. package/core/bvh2/aabb3/AABB3.js +3 -10
  5. package/core/cache/Cache.d.ts +4 -2
  6. package/core/cache/Cache.js +5 -2
  7. package/core/collection/HashMap.d.ts +9 -2
  8. package/core/collection/HashSet.d.ts +7 -2
  9. package/core/collection/HashSet.js +7 -2
  10. package/core/collection/array/typed/typed_array_copy.js +1 -1
  11. package/core/geom/3d/frustum/array_setFromProjectionMatrix.js +3 -3
  12. package/core/geom/3d/shape/AbstractShape3D.js +28 -1
  13. package/core/geom/3d/shape/TransformedShape3D.js +65 -10
  14. package/core/geom/3d/shape/TransformedShape3D.spec.js +33 -0
  15. package/core/geom/3d/shape/{CompositeShape.js → UnionShape3D.js} +27 -12
  16. package/core/geom/3d/shape/UnitCubeShape3D.js +77 -0
  17. package/core/geom/3d/shape/UnitCubeShape3D.spec.js +42 -0
  18. package/core/geom/3d/shape/UnitSphereShape3D.js +32 -1
  19. package/core/geom/3d/shape/util/compute_signed_distance_gradient_by_sampling.js +48 -0
  20. package/core/geom/3d/shape/util/shape_to_visual_entity.js +3 -3
  21. package/core/model/ObservedBoolean.d.ts +2 -0
  22. package/core/parser/simple/Token.d.ts +13 -0
  23. package/core/parser/simple/Token.js +61 -27
  24. package/editor/tools/FoliagePaintTool.js +4 -4
  25. package/engine/asset/loaders/GLTFAssetLoader.js +52 -1
  26. package/engine/asset/loaders/image/ImageDecoderWorker.js +4 -3
  27. package/engine/asset/loaders/image/ImageRGBADataAsset.js +3 -2
  28. package/engine/asset/loaders/image/ImageRGBADataLoader.js +3 -3
  29. package/engine/asset/loaders/image/codec/NativeImageDecoder.js +2 -1
  30. package/engine/asset/loaders/image/png/PNG.js +113 -6
  31. package/engine/asset/loaders/image/png/PNGReader.js +5 -0
  32. package/engine/asset/loaders/material/bitmap2sampler_gl.js +1 -1
  33. package/engine/asset/loaders/material/computeImageBitmapEquality.js +6 -1
  34. package/engine/asset/loaders/material/computeTextureEquality.js +40 -49
  35. package/engine/ecs/EntityComponentDataset.js +1 -1
  36. package/engine/ecs/foliage/InstancedFoliage.js +277 -266
  37. package/engine/ecs/foliage/ecs/Foliage2System.js +7 -7
  38. package/engine/ecs/foliage/ecs/InstancedMeshComponent.js +37 -0
  39. package/engine/ecs/foliage/ecs/{Foliage2.js → InstancedMeshLayer.js} +3 -45
  40. package/engine/ecs/foliage/ecs/InstancedMeshSerializationAdapter.js +6 -5
  41. package/engine/ecs/foliage/ecs/InstancedMeshUtils.js +7 -6
  42. package/engine/ecs/storage/binary/BinarySerializationRegistry.js +1 -1
  43. package/engine/ecs/terrain/ecs/layers/TerrainLayer.js +12 -16
  44. package/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +2 -2
  45. package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +14 -72
  46. package/engine/graphics/geometry/instancing/rewriteMaterial.js +70 -0
  47. package/engine/graphics/material/manager/MaterialManager.js +2 -1
  48. package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +6 -4
  49. package/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +0 -2
  50. package/engine/graphics/particles/particular/engine/shader/ShaderManager.js +1 -2
  51. package/engine/graphics/particles/particular/engine/shader/debugAtlas.js +1 -1
  52. package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +12 -9
  53. package/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +3 -4
  54. package/engine/graphics/render/forward_plus/materials/FPlusDebugMaterial.js +3 -3
  55. package/engine/graphics/render/forward_plus/materials/ForwardPlusThreeMaterial.js +1 -1
  56. package/engine/graphics/render/forward_plus/prototypeLightManager.js +4 -4
  57. package/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +10 -9
  58. package/engine/graphics/shadows/ShadowMapRenderer.js +8 -2
  59. package/engine/graphics/texture/atlas/ManagedTextureAtlas.js +12 -1
  60. package/engine/graphics/texture/sampler/Sampler2D.js +3 -1
  61. package/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +1 -1
  62. package/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js +66 -0
  63. package/engine/input/devices/KeyCodes.d.ts +1 -0
  64. package/package.json +1 -1
  65. package/view/minimap/gl/MinimapWorldGL.js +12 -5
@@ -1,4 +1,5 @@
1
1
  import { computeImageBitmapEquality } from "./computeImageBitmapEquality.js";
2
+ import { isArrayEqualStrict } from "../../../../core/collection/array/isArrayEqualStrict.js";
2
3
 
3
4
  //
4
5
 
@@ -50,20 +51,10 @@ export function computeTextureEquality(a, b) {
50
51
  const aMipmaps = a.mipmaps;
51
52
  const bMipmaps = b.mipmaps;
52
53
 
53
- const n = aMipmaps.length;
54
-
55
- if (n !== bMipmaps.length) {
54
+ if (!textureMipChainEqual(aMipmaps, bMipmaps)) {
56
55
  return false;
57
56
  }
58
57
 
59
- for (let i = 0; i < n; i++) {
60
- const aMipmap = aMipmaps[i];
61
- const bMipmap = bMipmaps[i];
62
-
63
- if (!textureMipmapEqual(aMipmap, bMipmap)) {
64
- return false;
65
- }
66
- }
67
58
  }
68
59
 
69
60
  //TODO implement support for other texture types
@@ -119,47 +110,52 @@ export function textureImagesEqual(a, b) {
119
110
  const bMipmaps = bi.mipmaps;
120
111
 
121
112
  //TODO should we ignore mipmaps if they are absent?
122
- if (aMipmaps === undefined) {
123
- if (bMipmaps === undefined) {
124
- continue;
125
- } else {
126
- return false;
127
- }
128
- } else if (bMipmaps === undefined) {
113
+ if (!textureMipChainEqual(aMipmaps, bMipmaps)) {
129
114
  return false;
130
115
  }
116
+ }
117
+
118
+ }
131
119
 
132
- for (let j = 0; j < aMipmaps.length; j++) {
133
- const aMipmap = aMipmaps[j];
134
- const bMipmap = bMipmaps[j];
120
+ // assume equivalent
121
+ return true;
122
+ }
123
+
124
+ /**
125
+ *
126
+ * @param {[]} a
127
+ * @param {[]} b
128
+ * @returns {boolean}
129
+ */
130
+ function textureMipChainEqual(a, b) {
131
+ if (a === undefined) {
132
+ if (b === undefined) {
133
+ return true;
134
+ } else {
135
+ return false;
136
+ }
137
+ } else if (b === undefined) {
138
+ return false;
139
+ }
135
140
 
136
- /**
137
- * @type {Uint8Array}
138
- */
139
- const aData = aMipmap.data;
141
+ const a_length = a.length;
140
142
 
141
- /**
142
- * @type {Uint8Array}
143
- */
144
- const bData = bMipmap.data;
143
+ if (a_length !== b.length) {
144
+ // different mip chain length
145
+ return false;
146
+ }
145
147
 
146
- const dataLength = aData.length;
147
- if (dataLength !== bData.length) {
148
- return false;
149
- }
148
+ for (let j = a_length - 1; j >= 0; j--) { //traverse chain top to bottom, starting from smallest mip for faster rejection
150
149
 
150
+ const aMipmap = a[j];
151
+ const bMipmap = b[j];
151
152
 
152
- for (let k = 0; k < dataLength; k++) {
153
- if (aData[k] !== bData[k]) {
154
- return false;
155
- }
156
- }
157
- }
153
+ if (!textureMipmapEqual(aMipmap, bMipmap)) {
154
+ return false;
158
155
  }
159
156
 
160
157
  }
161
158
 
162
- // assume equivalent
163
159
  return true;
164
160
  }
165
161
 
@@ -182,16 +178,11 @@ function textureMipmapEqual(a, b) {
182
178
  const aData = a.data;
183
179
  const bData = b.data;
184
180
 
185
- const n = aData.length;
186
- if (bData.length !== n) {
187
- return false;
188
- }
189
181
 
190
- for (let i = 0; i < n; i++) {
191
- if (aData[i] !== bData[i]) {
192
- return false;
193
- }
182
+ if (aData === bData) {
183
+ // special case
184
+ return true;
194
185
  }
195
186
 
196
- return true;
187
+ return isArrayEqualStrict(aData, bData);
197
188
  }
@@ -1212,7 +1212,7 @@ export class EntityComponentDataset {
1212
1212
 
1213
1213
  if (!ENV_PRODUCTION) {
1214
1214
  assert.isNumber(componentTypeIndex, "componentTypeIndex");
1215
- assert.typeOf(visitor, "function", "visitor");
1215
+ assert.isFunction(visitor, "visitor");
1216
1216
  }
1217
1217
 
1218
1218