@woosh/meep-engine 2.111.6 → 2.111.8

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 (56) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +45 -43
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +45 -43
  5. package/package.json +1 -1
  6. package/src/core/collection/array/typed/compute_binary_data_type_from_typed_array.d.ts +8 -0
  7. package/src/core/collection/array/typed/compute_binary_data_type_from_typed_array.d.ts.map +1 -0
  8. package/src/core/collection/array/typed/compute_binary_data_type_from_typed_array.js +39 -0
  9. package/src/core/collection/array/typed/isTypedArray.d.ts +4 -3
  10. package/src/core/collection/array/typed/isTypedArray.d.ts.map +1 -1
  11. package/src/core/collection/array/typed/isTypedArray.js +4 -5
  12. package/src/core/collection/array/typed/typedArrayToDataType.d.ts +3 -5
  13. package/src/core/collection/array/typed/typedArrayToDataType.d.ts.map +1 -1
  14. package/src/core/collection/array/typed/typedArrayToDataType.js +3 -31
  15. package/src/core/collection/array/typed/uint_array_for_count.d.ts +3 -3
  16. package/src/core/collection/array/typed/uint_array_for_count.d.ts.map +1 -1
  17. package/src/core/collection/array/typed/uint_array_for_count.js +7 -7
  18. package/src/core/geom/3d/topology/expandConnectivityByLocality.d.ts.map +1 -1
  19. package/src/core/geom/3d/topology/expandConnectivityByLocality.js +3 -2
  20. package/src/core/geom/3d/topology/isEdgeConnectedToOutline.d.ts.map +1 -1
  21. package/src/core/geom/3d/topology/isEdgeConnectedToOutline.js +2 -1
  22. package/src/core/geom/3d/topology/isVertexConnectedToOutline.d.ts.map +1 -1
  23. package/src/core/geom/3d/topology/isVertexConnectedToOutline.js +3 -1
  24. package/src/core/geom/3d/topology/query/query_edge_other_vertex.d.ts.map +1 -1
  25. package/src/core/geom/3d/topology/query/query_edge_other_vertex.js +3 -0
  26. package/src/core/geom/3d/topology/util/mesh_flood_fill.d.ts +1 -2
  27. package/src/core/geom/3d/topology/util/mesh_flood_fill.d.ts.map +1 -1
  28. package/src/core/geom/3d/topology/util/mesh_flood_fill.js +0 -2
  29. package/src/engine/ecs/terrain/tiles/TileBuildWorker.js +2 -2
  30. package/src/engine/graphics/geometry/AttributeSpec.d.ts.map +1 -1
  31. package/src/engine/graphics/geometry/AttributeSpec.js +52 -33
  32. package/src/engine/graphics/geometry/VertexDataSpec.d.ts.map +1 -1
  33. package/src/engine/graphics/geometry/VertexDataSpec.js +13 -6
  34. package/src/engine/graphics/geometry/computeBoundingSphereFromVertexData.d.ts +2 -2
  35. package/src/engine/graphics/geometry/computeBoundingSphereFromVertexData.d.ts.map +1 -1
  36. package/src/engine/graphics/geometry/computeBoundingSphereFromVertexData.js +4 -4
  37. package/src/engine/graphics/geometry/optimization/geometry_optimize_uv_tension.d.ts +10 -0
  38. package/src/engine/graphics/geometry/optimization/geometry_optimize_uv_tension.d.ts.map +1 -0
  39. package/src/engine/{ecs/terrain/util/tensionOptimizeUV.js → graphics/geometry/optimization/geometry_optimize_uv_tension.js} +14 -7
  40. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.d.ts +1 -2
  41. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.d.ts.map +1 -1
  42. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -2
  43. package/src/engine/graphics/geometry/skining/computeSkinnedMeshVertices.d.ts +1 -1
  44. package/src/engine/graphics/geometry/skining/computeSkinnedMeshVertices.js +1 -1
  45. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.d.ts.map +1 -1
  46. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +4 -2
  47. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  48. package/src/engine/graphics/texture/sampler/Sampler2D.js +4 -2
  49. package/src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.d.ts.map +1 -1
  50. package/src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.js +6 -4
  51. package/src/engine/ecs/terrain/util/tensionOptimizeUV.d.ts +0 -10
  52. package/src/engine/ecs/terrain/util/tensionOptimizeUV.d.ts.map +0 -1
  53. package/src/engine/graphics/geometry/BufferGeometryWrap.js +0 -23
  54. package/src/engine/graphics/geometry/clipping/ClippedGeometry.d.ts +0 -55
  55. package/src/engine/graphics/geometry/clipping/ClippedGeometry.d.ts.map +0 -1
  56. package/src/engine/graphics/geometry/clipping/ClippedGeometry.js +0 -144
@@ -25,8 +25,9 @@ function isArrayEqualStrict(a, b) {
25
25
  }
26
26
 
27
27
  /**
28
- *
29
- * @param o
28
+ * Checks whether supplied argument is a TypedArray instance, such as Flaot32Array
29
+ * @template T
30
+ * @param {T} o
30
31
  * @returns {boolean}
31
32
  */
32
33
  function isTypedArray(o) {
@@ -48926,6 +48927,40 @@ function compute_typed_array_constructor_from_data_type(dt) {
48926
48927
  return r;
48927
48928
  }
48928
48929
 
48930
+ /**
48931
+ *
48932
+ * @param {*} array
48933
+ * @returns {BinaryDataType}
48934
+ */
48935
+ function compute_binary_data_type_from_typed_array(array) {
48936
+
48937
+ const ctor = Object.getPrototypeOf(array).constructor;
48938
+
48939
+ switch (ctor) {
48940
+ case Uint8Array:
48941
+ case Uint8ClampedArray:
48942
+ return BinaryDataType.Uint8;
48943
+ case Uint16Array:
48944
+ return BinaryDataType.Uint16;
48945
+ case Uint32Array:
48946
+ return BinaryDataType.Uint32;
48947
+
48948
+ case Int8Array:
48949
+ return BinaryDataType.Int8;
48950
+ case Int16Array:
48951
+ return BinaryDataType.Int16;
48952
+ case Int32Array:
48953
+ return BinaryDataType.Int32;
48954
+
48955
+ case Float32Array:
48956
+ return BinaryDataType.Float32;
48957
+ case Float64Array:
48958
+ return BinaryDataType.Float64;
48959
+ default:
48960
+ throw new Error(`unsupported constructor type ${ctor.name}`);
48961
+ }
48962
+ }
48963
+
48929
48964
  //
48930
48965
 
48931
48966
  /**
@@ -49000,39 +49035,6 @@ function is_typed_array_equals(a, b) {
49000
49035
  return isArrayEqualStrict(a_proxy, b_proxy);
49001
49036
  }
49002
49037
 
49003
- /**
49004
- *
49005
- * @param {*} v
49006
- * @returns {BinaryDataType}
49007
- */
49008
- function typedArrayToDataType(v) {
49009
- const ctor = Object.getPrototypeOf(v).constructor;
49010
-
49011
- switch (ctor) {
49012
- case Uint8Array:
49013
- case Uint8ClampedArray:
49014
- return BinaryDataType.Uint8;
49015
- case Uint16Array:
49016
- return BinaryDataType.Uint16;
49017
- case Uint32Array:
49018
- return BinaryDataType.Uint32;
49019
-
49020
- case Int8Array:
49021
- return BinaryDataType.Int8;
49022
- case Int16Array:
49023
- return BinaryDataType.Int16;
49024
- case Int32Array:
49025
- return BinaryDataType.Int32;
49026
-
49027
- case Float32Array:
49028
- return BinaryDataType.Float32;
49029
- case Float64Array:
49030
- return BinaryDataType.Float64;
49031
- default:
49032
- throw new Error('unsupported constructor type');
49033
- }
49034
- }
49035
-
49036
49038
  /**
49037
49039
  * Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
49038
49040
  * @param {number} t ratio
@@ -49999,7 +50001,7 @@ class Sampler2D {
49999
50001
  height: this.height,
50000
50002
  width: this.width,
50001
50003
  itemSize: this.itemSize,
50002
- type: typedArrayToDataType(this.data),
50004
+ type: compute_binary_data_type_from_typed_array(this.data),
50003
50005
  data: encoded
50004
50006
  }
50005
50007
  }
@@ -59791,19 +59793,19 @@ function array_swap_one(array, index0, index1) {
59791
59793
 
59792
59794
  /**
59793
59795
  *
59794
- * @param {number} count
59795
- * @returns {function}
59796
+ * @param {number} max_value maximum value to be contained in the array
59797
+ * @returns {function} constructor
59796
59798
  */
59797
- function UintArrayForCount(count) {
59799
+ function UintArrayForCount(max_value) {
59798
59800
 
59799
- if (count <= 256) {
59801
+ if (max_value <= 256) {
59800
59802
  return Uint8Array;
59801
- } else if (count <= 65536) {
59803
+ } else if (max_value <= 65536) {
59802
59804
  return Uint16Array;
59803
- } else if (count <= 4294967295) {
59805
+ } else if (max_value <= 4294967295) {
59804
59806
  return Uint32Array;
59805
59807
  } else {
59806
- throw new Error(`Unsupported size ${count}`)
59808
+ throw new Error(`Unsupported size ${max_value}`)
59807
59809
  }
59808
59810
  }
59809
59811
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.111.6",
8
+ "version": "2.111.8",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {*} array
4
+ * @returns {BinaryDataType}
5
+ */
6
+ export function compute_binary_data_type_from_typed_array(array: any): BinaryDataType;
7
+ import { BinaryDataType } from "../../../binary/type/BinaryDataType.js";
8
+ //# sourceMappingURL=compute_binary_data_type_from_typed_array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute_binary_data_type_from_typed_array.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/compute_binary_data_type_from_typed_array.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,uEAFa,cAAc,CAgC1B;+BArC8B,wCAAwC"}
@@ -0,0 +1,39 @@
1
+ import { assert } from "../../../assert.js";
2
+ import { BinaryDataType } from "../../../binary/type/BinaryDataType.js";
3
+
4
+ /**
5
+ *
6
+ * @param {*} array
7
+ * @returns {BinaryDataType}
8
+ */
9
+ export function compute_binary_data_type_from_typed_array(array) {
10
+ assert.notNull(array, 'array');
11
+ assert.isObject(array, 'array');
12
+ assert.isArrayLike(array, 'array');
13
+
14
+ const ctor = Object.getPrototypeOf(array).constructor;
15
+
16
+ switch (ctor) {
17
+ case Uint8Array:
18
+ case Uint8ClampedArray:
19
+ return BinaryDataType.Uint8;
20
+ case Uint16Array:
21
+ return BinaryDataType.Uint16;
22
+ case Uint32Array:
23
+ return BinaryDataType.Uint32;
24
+
25
+ case Int8Array:
26
+ return BinaryDataType.Int8;
27
+ case Int16Array:
28
+ return BinaryDataType.Int16;
29
+ case Int32Array:
30
+ return BinaryDataType.Int32;
31
+
32
+ case Float32Array:
33
+ return BinaryDataType.Float32;
34
+ case Float64Array:
35
+ return BinaryDataType.Float64;
36
+ default:
37
+ throw new Error(`unsupported constructor type ${ctor.name}`);
38
+ }
39
+ }
@@ -1,7 +1,8 @@
1
1
  /**
2
- *
3
- * @param o
2
+ * Checks whether supplied argument is a TypedArray instance, such as Flaot32Array
3
+ * @template T
4
+ * @param {T} o
4
5
  * @returns {boolean}
5
6
  */
6
- export function isTypedArray(o: any): boolean;
7
+ export function isTypedArray<T>(o: T): boolean;
7
8
  //# sourceMappingURL=isTypedArray.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isTypedArray.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/isTypedArray.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,sCAFa,OAAO,CAcnB"}
1
+ {"version":3,"file":"isTypedArray.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/isTypedArray.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,uCAFa,OAAO,CAcnB"}
@@ -1,9 +1,10 @@
1
1
  /**
2
- *
3
- * @param o
2
+ * Checks whether supplied argument is a TypedArray instance, such as Flaot32Array
3
+ * @template T
4
+ * @param {T} o
4
5
  * @returns {boolean}
5
6
  */
6
- function isTypedArray(o) {
7
+ export function isTypedArray(o) {
7
8
  return (
8
9
  o instanceof Int8Array ||
9
10
  o instanceof Uint8Array ||
@@ -16,5 +17,3 @@ function isTypedArray(o) {
16
17
  o instanceof Float64Array
17
18
  );
18
19
  }
19
-
20
- export { isTypedArray };
@@ -1,8 +1,6 @@
1
1
  /**
2
- *
3
- * @param {*} v
4
- * @returns {BinaryDataType}
2
+ * @deprecated renamed to {@link compute_binary_data_type_from_typed_array}
5
3
  */
6
- export function typedArrayToDataType(v: any): BinaryDataType;
7
- import { BinaryDataType } from "../../../binary/type/BinaryDataType.js";
4
+ export const typedArrayToDataType: typeof compute_binary_data_type_from_typed_array;
5
+ import { compute_binary_data_type_from_typed_array } from "./compute_binary_data_type_from_typed_array.js";
8
6
  //# sourceMappingURL=typedArrayToDataType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typedArrayToDataType.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/typedArrayToDataType.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,8CAFa,cAAc,CA4B1B;+BAjC8B,wCAAwC"}
1
+ {"version":3,"file":"typedArrayToDataType.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/typedArrayToDataType.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,oFAA6E;0DALnB,gDAAgD"}
@@ -1,34 +1,6 @@
1
- import { BinaryDataType } from "../../../binary/type/BinaryDataType.js";
1
+ import { compute_binary_data_type_from_typed_array } from "./compute_binary_data_type_from_typed_array.js";
2
2
 
3
3
  /**
4
- *
5
- * @param {*} v
6
- * @returns {BinaryDataType}
4
+ * @deprecated renamed to {@link compute_binary_data_type_from_typed_array}
7
5
  */
8
- export function typedArrayToDataType(v) {
9
- const ctor = Object.getPrototypeOf(v).constructor;
10
-
11
- switch (ctor) {
12
- case Uint8Array:
13
- case Uint8ClampedArray:
14
- return BinaryDataType.Uint8;
15
- case Uint16Array:
16
- return BinaryDataType.Uint16;
17
- case Uint32Array:
18
- return BinaryDataType.Uint32;
19
-
20
- case Int8Array:
21
- return BinaryDataType.Int8;
22
- case Int16Array:
23
- return BinaryDataType.Int16;
24
- case Int32Array:
25
- return BinaryDataType.Int32;
26
-
27
- case Float32Array:
28
- return BinaryDataType.Float32;
29
- case Float64Array:
30
- return BinaryDataType.Float64;
31
- default:
32
- throw new Error('unsupported constructor type');
33
- }
34
- }
6
+ export const typedArrayToDataType = compute_binary_data_type_from_typed_array
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  *
3
- * @param {number} count
4
- * @returns {function}
3
+ * @param {number} max_value maximum value to be contained in the array
4
+ * @returns {function} constructor
5
5
  */
6
- export function UintArrayForCount(count: number): Function;
6
+ export function UintArrayForCount(max_value: number): Function;
7
7
  //# sourceMappingURL=uint_array_for_count.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uint_array_for_count.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/uint_array_for_count.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,yCAHW,MAAM,YAchB"}
1
+ {"version":3,"file":"uint_array_for_count.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/uint_array_for_count.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,6CAHW,MAAM,YAchB"}
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  *
3
- * @param {number} count
4
- * @returns {function}
3
+ * @param {number} max_value maximum value to be contained in the array
4
+ * @returns {function} constructor
5
5
  */
6
- export function UintArrayForCount(count) {
6
+ export function UintArrayForCount(max_value) {
7
7
 
8
- if (count <= 256) {
8
+ if (max_value <= 256) {
9
9
  return Uint8Array;
10
- } else if (count <= 65536) {
10
+ } else if (max_value <= 65536) {
11
11
  return Uint16Array;
12
- } else if (count <= 4294967295) {
12
+ } else if (max_value <= 4294967295) {
13
13
  return Uint32Array;
14
14
  } else {
15
- throw new Error(`Unsupported size ${count}`)
15
+ throw new Error(`Unsupported size ${max_value}`)
16
16
  }
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"expandConnectivityByLocality.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/topology/expandConnectivityByLocality.js"],"names":[],"mappings":"AA+DA;;;;GAIG;AACH,gFAkCC"}
1
+ {"version":3,"file":"expandConnectivityByLocality.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/topology/expandConnectivityByLocality.js"],"names":[],"mappings":"AAgEA;;;;GAIG;AACH,gFAkCC"}
@@ -1,7 +1,8 @@
1
1
  import { array_copy } from "../../../collection/array/array_copy.js";
2
- import { computeTopoMeshVertexDuplicates } from "./computeTopoMeshVertexDuplicates.js";
3
2
  import { arraySetSortingDiff } from "../../../collection/array/arraySetSortingDiff.js";
4
3
  import { compareFaces } from "./compareFaces.js";
4
+ import { computeTopoMeshVertexDuplicates } from "./computeTopoMeshVertexDuplicates.js";
5
+ import { query_edge_other_vertex } from "./query/query_edge_other_vertex.js";
5
6
 
6
7
  /**
7
8
  *
@@ -25,7 +26,7 @@ function findCommonDuplicateEdges(result, source_a, source_b) {
25
26
  for (j = 0; j < edge_count_a; j++) {
26
27
  const topoEdge = edges_a[j];
27
28
 
28
- const other_vertex_a = topoEdge.getOtherVertex(v_a);
29
+ const other_vertex_a = query_edge_other_vertex(topoEdge, v_a);
29
30
 
30
31
  if (source_b.includes(other_vertex_a)) {
31
32
  const existing_result_place = result.indexOf(topoEdge);
@@ -1 +1 @@
1
- {"version":3,"file":"isEdgeConnectedToOutline.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/topology/isEdgeConnectedToOutline.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,0DAFa,OAAO,CAMnB"}
1
+ {"version":3,"file":"isEdgeConnectedToOutline.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/topology/isEdgeConnectedToOutline.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,0DAFa,OAAO,CAMnB"}
@@ -1,4 +1,5 @@
1
1
  import { isVertexConnectedToOutline } from "./isVertexConnectedToOutline.js";
2
+ import { query_edge_is_boundary } from "./query/query_edge_is_boundary.js";
2
3
 
3
4
  /**
4
5
  * Determines whether the given edge is part of the topology outline (outer edge)
@@ -6,7 +7,7 @@ import { isVertexConnectedToOutline } from "./isVertexConnectedToOutline.js";
6
7
  * @returns {boolean}
7
8
  */
8
9
  export function isEdgeConnectedToOutline(edge) {
9
- return edge.isTopologyBorder()
10
+ return query_edge_is_boundary(edge)
10
11
  || isVertexConnectedToOutline(edge.v0)
11
12
  || isVertexConnectedToOutline(edge.v1);
12
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"isVertexConnectedToOutline.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/topology/isVertexConnectedToOutline.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,gEAFa,OAAO,CAenB"}
1
+ {"version":3,"file":"isVertexConnectedToOutline.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/topology/isVertexConnectedToOutline.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,gEAFa,OAAO,CAenB"}
@@ -1,3 +1,5 @@
1
+ import { query_edge_is_boundary } from "./query/query_edge_is_boundary.js";
2
+
1
3
  /**
2
4
  * Determines whether vertex is part of the topology outline (outer edge)
3
5
  * @param {TopoVertex} vertex
@@ -10,7 +12,7 @@ export function isVertexConnectedToOutline(vertex) {
10
12
  for (let i = 0; i < n; i++) {
11
13
  const edge = edges[i];
12
14
 
13
- if (edge.isTopologyBorder()) {
15
+ if (query_edge_is_boundary(edge)) {
14
16
  return true;
15
17
  }
16
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"query_edge_other_vertex.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/query/query_edge_other_vertex.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wEAFa,aAAW,IAAI,CAa3B"}
1
+ {"version":3,"file":"query_edge_other_vertex.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/query/query_edge_other_vertex.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wEAFa,aAAW,IAAI,CAgB3B"}
@@ -10,6 +10,9 @@ export function query_edge_other_vertex(edge, v) {
10
10
  assert.notNull(edge, 'edge');
11
11
  assert.notNull(v, 'v');
12
12
 
13
+ assert.equal(edge.isTopoEdge,true,'edge.isTopoEdge !== true');
14
+ assert.equal(v.isTopoVertex,true,'v.isTopoVertex !== true');
15
+
13
16
  if (edge.v0 === v) {
14
17
  return edge.v1;
15
18
  } else if (edge.v1 === v) {
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  *
3
- * @param {TopoMesh} mesh
4
3
  * @param {TopoTriangle[]} initial_set indices of triangles that make up initial set, these are triangles that we start from, they will also be included in the resulting set
5
4
  * @param {function(tri:TopoTriangle, prev:TopoTriangle):boolean} filter decides whether a triangle should be included or not
6
5
  * @returns {TopoTriangle[]} set of selected triangles, will include initial set as well
7
6
  */
8
- export function mesh_flood_fill({ mesh, initial_set, filter }: TopoMesh): TopoTriangle[];
7
+ export function mesh_flood_fill({ initial_set, filter }: TopoTriangle[]): TopoTriangle[];
9
8
  //# sourceMappingURL=mesh_flood_fill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mesh_flood_fill.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/util/mesh_flood_fill.js"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,0EAFa,cAAc,CA+C1B"}
1
+ {"version":3,"file":"mesh_flood_fill.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/util/mesh_flood_fill.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,yDAJW,cAAc,GAEZ,cAAc,CA8C1B"}
@@ -8,13 +8,11 @@ const neighbours = [];
8
8
 
9
9
  /**
10
10
  *
11
- * @param {TopoMesh} mesh
12
11
  * @param {TopoTriangle[]} initial_set indices of triangles that make up initial set, these are triangles that we start from, they will also be included in the resulting set
13
12
  * @param {function(tri:TopoTriangle, prev:TopoTriangle):boolean} filter decides whether a triangle should be included or not
14
13
  * @returns {TopoTriangle[]} set of selected triangles, will include initial set as well
15
14
  */
16
15
  export function mesh_flood_fill({
17
- mesh,
18
16
  initial_set,
19
17
  filter
20
18
  }) {
@@ -1,10 +1,10 @@
1
1
  import { BinaryUint32BVH } from "../../../../core/bvh2/binary/2/BinaryUint32BVH.js";
2
2
  import { bvh32_from_indexed_geometry } from "../../../graphics/geometry/bvh/buffered/bvh32_from_indexed_geometry.js";
3
+ import { geometry_optimize_uv_tension } from "../../../graphics/geometry/optimization/geometry_optimize_uv_tension.js";
3
4
  import { Sampler2D } from '../../../graphics/texture/sampler/Sampler2D.js';
4
5
  import { sampler2d_channel_compute_max } from "../../../graphics/texture/sampler/sampler2d_channel_compute_max.js";
5
6
  import { sampler2d_channel_compute_min } from "../../../graphics/texture/sampler/sampler2d_channel_compute_min.js";
6
7
  import BufferedGeometryArraysBuilder from '../BufferedGeometryArraysBuilder.js';
7
- import { tensionOptimizeUV } from "../util/tensionOptimizeUV.js";
8
8
 
9
9
  self.Lib = {
10
10
  /**
@@ -21,7 +21,7 @@ self.Lib = {
21
21
  },
22
22
  Sampler2D,
23
23
  BufferedGeometryArraysBuilder,
24
- tensionOptimizeUV,
24
+ tensionOptimizeUV: geometry_optimize_uv_tension,
25
25
  sampler2d_channel_compute_min,
26
26
  sampler2d_channel_compute_max
27
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AttributeSpec.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/geometry/AttributeSpec.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH;IA+BI,uCAMC;IA0DD;;;;;OAKG;IACH,iBAJW,aAAa,KACb,aAAa,GACZ,MAAM,CAIjB;IArGG;;;OAGG;IACH,MAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,MAFU,cAAc,CAEU;IAElC;;;;;OAKG;IACH,UAFU,MAAM,CAEC;IAEjB;;;;;OAKG;IACH,YAFU,OAAO,CAEM;IAW3B;;;;;aAoBC;IAED;;;;;MAOC;IAED,eAEC;IAED;;;;OAIG;IACH,cAHW,aAAa,GACX,OAAO,CAQnB;IAED;;;OAGG;IACH,eAFa,MAAM,CAIlB;IAaL;;;OAGG;IACH,0BAFU,OAAO,CAEsB;CANtC;+BAjH8B,6CAA6C"}
1
+ {"version":3,"file":"AttributeSpec.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/geometry/AttributeSpec.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH;IA+BI,uCAMC;IA6ED;;;;;OAKG;IACH,iBAJW,aAAa,KACb,aAAa,GACZ,MAAM,CAIjB;IAxHD;;;OAGG;IACH,MAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,MAFU,cAAc,CAEM;IAE9B;;;;;OAKG;IACH,UAFU,MAAM,CAEH;IAEb;;;;;OAKG;IACH,YAFU,OAAO,CAEE;IAWnB;;;;;aAoBC;IAED;;;;;MAOC;IAED,eAEC;IAED;;;;OAIG;IACH,cAHW,aAAa,GACX,OAAO,CAQnB;IAED;;;OAGG;IACH,YAFW,aAAa,QAOvB;IAED,uBAMC;IAED;;;OAGG;IACH,eAFa,MAAM,CAIlB;IAaL;;;OAGG;IACH,0BAFU,OAAO,CAEsB;CANtC;+BAnI8B,6CAA6C"}
@@ -1,42 +1,42 @@
1
+ import { assert } from "../../../core/assert.js";
1
2
  import { BinaryDataType } from "../../../core/binary/type/BinaryDataType.js";
2
- import { computeStringHash } from "../../../core/primitives/strings/computeStringHash.js";
3
3
  import { DataTypeByteSizes } from "../../../core/binary/type/DataTypeByteSizes.js";
4
- import { assert } from "../../../core/assert.js";
4
+ import { computeStringHash } from "../../../core/primitives/strings/computeStringHash.js";
5
5
 
6
6
  /**
7
7
  * Describes data structure of a single data attribute, such as a scalar, or a vector
8
8
  * This structure is designed to map well to GPU shader formats and is intended for larger datasets, such as meshes or particle clouds
9
9
  */
10
10
  export class AttributeSpec {
11
- constructor() {
12
- /**
13
- * Typically unique within a given set, used to identify the attribute
14
- * @type {string}
15
- */
16
- this.name = "";
17
-
18
- /**
19
- * How the attribute is stored in memory and interpreted
20
- * @type {BinaryDataType}
21
- */
22
- this.type = BinaryDataType.Float32;
23
-
24
- /**
25
- * How many elements the attribute uses. This is cardinality of a vector.
26
- * 1 means the attribute is a scalar
27
- * must be greater or equal to 1
28
- * @type {number}
29
- */
30
- this.itemSize = 1;
31
-
32
- /**
33
- * Normalized values will be automatically converted to float32 in the shader
34
- * This gives good optimization opportunities for things like normal vectors
35
- * Applies to integer types only
36
- * @type {boolean}
37
- */
38
- this.normalized = false;
39
- }
11
+
12
+ /**
13
+ * Typically unique within a given set, used to identify the attribute
14
+ * @type {string}
15
+ */
16
+ name = "";
17
+
18
+ /**
19
+ * How the attribute is stored in memory and interpreted
20
+ * @type {BinaryDataType}
21
+ */
22
+ type = BinaryDataType.Float32;
23
+
24
+ /**
25
+ * How many elements the attribute uses. This is cardinality of a vector.
26
+ * 1 means the attribute is a scalar
27
+ * must be greater or equal to 1
28
+ * @type {number}
29
+ */
30
+ itemSize = 1;
31
+
32
+ /**
33
+ * Normalized values will be automatically converted to float32 in the shader
34
+ * This gives good optimization opportunities for things like normal vectors
35
+ * Applies to integer types only
36
+ * @type {boolean}
37
+ */
38
+ normalized = false;
39
+
40
40
 
41
41
  static fromJSON(j) {
42
42
  const r = new AttributeSpec();
@@ -96,14 +96,33 @@ export class AttributeSpec {
96
96
 
97
97
  /**
98
98
  *
99
- * @returns {number}
99
+ * @param {AttributeSpec} other
100
+ */
101
+ copy(other) {
102
+ this.type = other.type;
103
+ this.name = other.name;
104
+ this.itemSize = other.itemSize;
105
+ this.normalized = other.normalized;
106
+ }
107
+
108
+ clone() {
109
+ const r = new AttributeSpec();
110
+
111
+ r.copy(this);
112
+
113
+ return r;
114
+ }
115
+
116
+ /**
117
+ * How much space a single attribute value takes up
118
+ * @returns {number} in bytes
100
119
  */
101
120
  getByteSize() {
102
121
  return this.itemSize * DataTypeByteSizes[this.type];
103
122
  }
104
123
 
105
124
  /**
106
- *
125
+ * Sorting comparator
107
126
  * @param {AttributeSpec} a
108
127
  * @param {AttributeSpec} b
109
128
  * @return {number}
@@ -1 +1 @@
1
- {"version":3,"file":"VertexDataSpec.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/geometry/VertexDataSpec.js"],"names":[],"mappings":"AAYA;;;GAGG;AACH;IAeI;;;;OAIG;IACH,2BAHW,aAAa,GACX,cAAc,CAQ1B;IAxBD;;;OAGG;IACH,YAFU,aAAa,EAAE,CAET;IAsBhB;;;;OAIG;IACH,yBAHW,MAAM,GACL,aAAa,GAAC,SAAS,CAgBlC;IAED;;;OAGG;IACH,8BAFW,MAAM,GADJ,MAAM,CAiBlB;IAED;;;OAGG;IACH,oBAFW,aAAa,EAAE,QAOzB;IAED;;;;OAIG;IACH,eAHW,aAAa,GACZ,cAAc,CAkBzB;IAED;;;OAGG;IACH,0BAFW,aAAa,EAAE,QAQzB;IAED,cAMC;IAED;;;;OAIG;IACH,cAHW,cAAc,GACZ,OAAO,CAQnB;IAED,sBAEC;IAED,eAMC;IAED;;MAIC;IAED;;aAkBC;IAED;;;OAGG;IACH,eAFa,MAAM,CAelB;IAIL;;;OAGG;IACH,2BAFU,OAAO,CAEwB;;CAPxC;8BA5M6B,oBAAoB"}
1
+ {"version":3,"file":"VertexDataSpec.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/geometry/VertexDataSpec.js"],"names":[],"mappings":"AAYA;;;GAGG;AACH;IAeI;;;;OAIG;IACH,2BAHW,aAAa,GACX,cAAc,CAQ1B;IAxBD;;;OAGG;IACH,YAFU,aAAa,EAAE,CAET;IAsBhB;;;;OAIG;IACH,yBAHW,MAAM,GACL,aAAa,GAAC,SAAS,CAgBlC;IAED;;;OAGG;IACH,8BAFW,MAAM,GADJ,MAAM,CAiBlB;IAED;;;OAGG;IACH,oBAFW,aAAa,EAAE,QAOzB;IAED;;;;OAIG;IACH,eAHW,aAAa,GACZ,cAAc,CAkBzB;IAED;;;OAGG;IACH,0BAFW,aAAa,EAAE,QAQzB;IAED,cAMC;IAED;;;;OAIG;IACH,cAHW,cAAc,GACZ,OAAO,CAQnB;IAED,sBASC;IAED,eAMC;IAED;;MAIC;IAED;;aAkBC;IAED;;;OAGG;IACH,eAFa,MAAM,CAelB;IAIL;;;OAGG;IACH,2BAFU,OAAO,CAEwB;;CAPxC;8BAnN6B,oBAAoB"}
@@ -8,7 +8,7 @@ import { AttributeSpec } from "./AttributeSpec.js";
8
8
  * @readonly
9
9
  * @type {number}
10
10
  */
11
- const DEFAULT_HASH = 1234567;
11
+ const RESERVED_HASH = 1234567;
12
12
 
13
13
  /**
14
14
  * Describes a set of data attributes. A good analogy would be "all data associated with geometry vertex"
@@ -27,7 +27,7 @@ export class VertexDataSpec {
27
27
  * @type {number}
28
28
  * @private
29
29
  */
30
- #hash = DEFAULT_HASH;
30
+ #hash = RESERVED_HASH;
31
31
 
32
32
  /**
33
33
  *
@@ -111,7 +111,7 @@ export class VertexDataSpec {
111
111
  this.attributes.push(attribute);
112
112
 
113
113
  // reset hash
114
- this.#hash = DEFAULT_HASH;
114
+ this.#hash = RESERVED_HASH;
115
115
 
116
116
  //for chaining, return self
117
117
  return this;
@@ -134,7 +134,7 @@ export class VertexDataSpec {
134
134
  this.attributes.splice(0, count);
135
135
 
136
136
  // reset hash to trigger hash update
137
- this.#hash = DEFAULT_HASH;
137
+ this.#hash = RESERVED_HASH;
138
138
  }
139
139
 
140
140
  /**
@@ -151,11 +151,18 @@ export class VertexDataSpec {
151
151
  }
152
152
 
153
153
  computeHash() {
154
- return computeHashArray(this.attributes, invokeObjectHash);
154
+ const hash_value = computeHashArray(this.attributes, invokeObjectHash);
155
+
156
+ if (hash_value === RESERVED_HASH) {
157
+ // collision with reserved hash, replace
158
+ return 0;
159
+ }
160
+
161
+ return hash_value;
155
162
  }
156
163
 
157
164
  hash() {
158
- if (this.#hash === DEFAULT_HASH) {
165
+ if (this.#hash === RESERVED_HASH) {
159
166
  this.#hash = this.computeHash();
160
167
  }
161
168