@woosh/meep-engine 2.113.16 → 2.115.0

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 (138) hide show
  1. package/build/meep.cjs +96 -55
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +96 -55
  4. package/editor/ecs/component/editors/Sampler2DEditor.js +3 -3
  5. package/package.json +1 -1
  6. package/src/core/binary/clz32.d.ts +7 -0
  7. package/src/core/binary/clz32.d.ts.map +1 -0
  8. package/src/core/binary/clz32.js +37 -0
  9. package/src/core/binary/is_data_url.d.ts.map +1 -1
  10. package/src/core/binary/is_data_url.js +1 -0
  11. package/src/core/binary/makeArrayBuffer.d.ts.map +1 -1
  12. package/src/core/binary/makeArrayBuffer.js +1 -0
  13. package/src/core/binary/msb_32.d.ts +7 -1
  14. package/src/core/binary/msb_32.d.ts.map +1 -1
  15. package/src/core/binary/msb_32.js +3 -12
  16. package/src/core/collection/RingBuffer.d.ts +1 -1
  17. package/src/core/collection/RingBuffer.js +1 -1
  18. package/src/core/collection/array/array_filter_by_multiple.d.ts +2 -0
  19. package/src/core/collection/array/array_filter_by_multiple.d.ts.map +1 -1
  20. package/src/core/collection/array/array_filter_by_multiple.js +11 -4
  21. package/src/core/collection/array/array_group_by.d.ts +10 -0
  22. package/src/core/collection/array/array_group_by.d.ts.map +1 -0
  23. package/src/core/collection/array/{groupArrayBy.js → array_group_by.js} +3 -3
  24. package/src/core/collection/array/array_sort_quick.d.ts +13 -0
  25. package/src/core/collection/array/array_sort_quick.d.ts.map +1 -0
  26. package/src/core/collection/array/{arrayQuickSort.js → array_sort_quick.js} +5 -1
  27. package/src/core/collection/array/combine_hash.js +1 -1
  28. package/src/core/{primitives → collection}/array/compareArrays.d.ts.map +1 -1
  29. package/src/core/{primitives → collection}/array/computeIntegerArrayHash.d.ts.map +1 -1
  30. package/src/core/{primitives → collection}/array/computeStridedArrayHash.d.ts.map +1 -1
  31. package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.d.ts.map +1 -1
  32. package/src/core/collection/array/randomMultipleFromArray.d.ts +6 -6
  33. package/src/core/collection/array/randomMultipleFromArray.d.ts.map +1 -1
  34. package/src/core/collection/array/randomMultipleFromArray.js +5 -5
  35. package/src/core/collection/array/typed/sparse_typed_array_hash.js +1 -1
  36. package/src/core/collection/array/typed/typedArrayConstructorByInstance.d.ts.map +1 -0
  37. package/src/core/geom/2d/Rectangle.d.ts.map +1 -1
  38. package/src/core/geom/2d/Rectangle.js +18 -5
  39. package/src/core/geom/2d/aabb/aabb2_overlap_exists.d.ts.map +1 -1
  40. package/src/core/geom/2d/aabb/aabb2_overlap_exists.js +4 -1
  41. package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.d.ts +3 -3
  42. package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.d.ts.map +1 -1
  43. package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +11 -4
  44. package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +2 -2
  45. package/src/core/geom/2d/convex-hull/orientation3_array.js +2 -2
  46. package/src/core/geom/2d/intersect_ray_2d.d.ts.map +1 -1
  47. package/src/core/geom/2d/intersect_ray_2d.js +5 -5
  48. package/src/core/geom/2d/{compute_triangle_area_2d.d.ts → triangle2d_compute_area.d.ts} +2 -2
  49. package/src/core/geom/2d/triangle2d_compute_area.d.ts.map +1 -0
  50. package/src/core/geom/2d/{compute_triangle_area_2d.js → triangle2d_compute_area.js} +1 -1
  51. package/src/core/geom/2d/triangle2d_contains_point.d.ts +14 -0
  52. package/src/core/geom/2d/triangle2d_contains_point.d.ts.map +1 -0
  53. package/src/core/geom/2d/triangle2d_contains_point.js +39 -0
  54. package/src/core/geom/2d/triangle2d_get_barycentric.d.ts +2 -2
  55. package/src/core/geom/2d/triangle2d_get_barycentric.d.ts.map +1 -1
  56. package/src/core/geom/2d/triangle2d_get_barycentric.js +1 -1
  57. package/src/core/geom/Vector2.d.ts.map +1 -1
  58. package/src/core/geom/Vector2.js +2 -2
  59. package/src/core/math/bessel_3.d.ts +1 -1
  60. package/src/core/math/bessel_3.js +1 -1
  61. package/src/core/math/computeWholeDivisorLow.d.ts +1 -1
  62. package/src/core/math/computeWholeDivisorLow.d.ts.map +1 -1
  63. package/src/core/math/computeWholeDivisorLow.js +8 -5
  64. package/src/core/math/interval/separation1D.d.ts.map +1 -0
  65. package/src/core/math/{separation1D.js → interval/separation1D.js} +3 -3
  66. package/src/core/math/solveQuadratic.d.ts.map +1 -1
  67. package/src/core/math/solveQuadratic.js +10 -0
  68. package/src/core/model/object/compareValues.js +3 -3
  69. package/src/engine/EntityCreator.d.ts +11 -11
  70. package/src/engine/EntityCreator.d.ts.map +1 -1
  71. package/src/engine/EntityCreator.js +2 -4
  72. package/src/engine/ecs/grid/HeightMap2NormalMap.js +2 -2
  73. package/src/engine/ecs/grid/NormalMap2AOMap.js +3 -3
  74. package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts +2 -2
  75. package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts.map +1 -1
  76. package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +5 -55
  77. package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.d.ts +9 -0
  78. package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.d.ts.map +1 -0
  79. package/src/engine/graphics/impostors/octahedral/util/sampler2d_build_cutout.js +64 -0
  80. package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
  81. package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +2 -2
  82. package/src/engine/graphics/sh3/path_tracer/sorting/sort_bvh_nodes_by_distance_to_point.js +2 -2
  83. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  84. package/src/engine/graphics/texture/sampler/Sampler2D.js +4 -2
  85. package/src/engine/graphics/texture/sampler/filter/kaiser_bessel_window.js +1 -1
  86. package/src/engine/graphics/texture/sampler/filter/sampler2d_scale_down_generic.js +1 -1
  87. package/src/engine/graphics/texture/sampler/sampler2d_multiply_vector.d.ts +8 -0
  88. package/src/engine/graphics/texture/sampler/sampler2d_multiply_vector.d.ts.map +1 -0
  89. package/src/engine/graphics/texture/sampler/{sampler_multiply_vector.js → sampler2d_multiply_vector.js} +1 -1
  90. package/src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.d.ts +8 -0
  91. package/src/engine/graphics/texture/sampler/sampler2d_to_float32_texture.d.ts.map +1 -0
  92. package/src/engine/graphics/texture/sampler/{sampler2DToFloat32Texture.js → sampler2d_to_float32_texture.js} +2 -2
  93. package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.d.ts.map +1 -1
  94. package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.js +3 -1
  95. package/src/engine/graphics/texture/virtual/VirtualTextureTileLoader.js +2 -2
  96. package/src/engine/grid/obstacle/GridObstacle.d.ts.map +1 -1
  97. package/src/engine/grid/obstacle/GridObstacle.js +1 -1
  98. package/src/engine/physics/computeInterceptPoint.js +20 -6
  99. package/src/engine/physics/mls-mpm/MLS_MPM.d.ts.map +1 -1
  100. package/src/engine/physics/mls-mpm/MLS_MPM.js +14 -17
  101. package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +2 -2
  102. package/src/core/UUID.d.ts +0 -6
  103. package/src/core/UUID.d.ts.map +0 -1
  104. package/src/core/UUID.js +0 -21
  105. package/src/core/collection/array/arrayQuickSort.d.ts +0 -12
  106. package/src/core/collection/array/arrayQuickSort.d.ts.map +0 -1
  107. package/src/core/collection/array/array_remove_element.d.ts +0 -11
  108. package/src/core/collection/array/array_remove_element.d.ts.map +0 -1
  109. package/src/core/collection/array/array_remove_element.js +0 -16
  110. package/src/core/collection/array/groupArrayBy.d.ts +0 -10
  111. package/src/core/collection/array/groupArrayBy.d.ts.map +0 -1
  112. package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +0 -1
  113. package/src/core/geom/2d/convex-hull/orientation3.d.ts +0 -12
  114. package/src/core/geom/2d/convex-hull/orientation3.d.ts.map +0 -1
  115. package/src/core/geom/2d/convex-hull/orientation3.js +0 -489
  116. package/src/core/geom/2d/convex-hull/orientation3_v2.d.ts +0 -9
  117. package/src/core/geom/2d/convex-hull/orientation3_v2.d.ts.map +0 -1
  118. package/src/core/geom/2d/convex-hull/orientation3_v2.js +0 -12
  119. package/src/core/math/separation1D.d.ts.map +0 -1
  120. package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.d.ts +0 -8
  121. package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.d.ts.map +0 -1
  122. package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts +0 -8
  123. package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts.map +0 -1
  124. package/src/engine/graphics/texture/sampler/typedArrayConstructorByInstance.d.ts.map +0 -1
  125. package/src/engine/save/storage/InMemoryLocalStorage.d.ts +0 -6
  126. package/src/engine/save/storage/InMemoryLocalStorage.d.ts.map +0 -1
  127. package/src/engine/save/storage/InMemoryLocalStorage.js +0 -13
  128. /package/src/core/{primitives → collection}/array/compareArrays.d.ts +0 -0
  129. /package/src/core/{primitives → collection}/array/compareArrays.js +0 -0
  130. /package/src/core/{primitives → collection}/array/computeIntegerArrayHash.d.ts +0 -0
  131. /package/src/core/{primitives → collection}/array/computeIntegerArrayHash.js +0 -0
  132. /package/src/core/{primitives → collection}/array/computeStridedArrayHash.d.ts +0 -0
  133. /package/src/core/{primitives → collection}/array/computeStridedArrayHash.js +0 -0
  134. /package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.d.ts +0 -0
  135. /package/src/core/{primitives → collection}/array/computeStridedIntegerArrayHash.js +0 -0
  136. /package/src/{engine/graphics/texture/sampler → core/collection/array/typed}/typedArrayConstructorByInstance.d.ts +0 -0
  137. /package/src/{engine/graphics/texture/sampler → core/collection/array/typed}/typedArrayConstructorByInstance.js +0 -0
  138. /package/src/core/math/{separation1D.d.ts → interval/separation1D.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { min2 } from "../../../math/min2.js";
2
- import { computeStridedArrayHash } from "../../../primitives/array/computeStridedArrayHash.js";
3
2
  import { computeHashFloat } from "../../../primitives/numbers/computeHashFloat.js";
3
+ import { computeStridedArrayHash } from "../computeStridedArrayHash.js";
4
4
 
5
5
  /**
6
6
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typedArrayConstructorByInstance.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/typedArrayConstructorByInstance.js"],"names":[],"mappings":"AAAA,8SAwBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Rectangle.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/Rectangle.js"],"names":[],"mappings":";AAMA;IACI;;;;;;;OAOG;IACH,gBANW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,EAgBhB;IAXG;;;OAGG;IACH,mBAFU,OAAO,CAEgB;IAEjC;;;OAGG;IACH,eAFU,OAAO,CAEqB;IAG1C;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,iBAEC;IAED;;;;;;OAMG;IACH,OALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QAKhB;IAED;;;OAGG;IACH,SAFa,SAAS,CAUrB;IAED;;;OAGG;IACH,YAFW,SAAS,QAKnB;IAED;;;;;;;OAOG;IACH,gBANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAUnB;IAED;;;;OAIG;IACH,kBAHW,SAAS,GACP,OAAO,CAQnB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAUnB;IAED;;;;OAIG;IACH,gBAHW,SAAS,GACP,OAAO,CAQnB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAyBhB;IAED;;;OAGG;IACH,mBAFW,SAAS,QASnB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAYnB;IAED;;;;OAIG;IACH,gBAHW,SAAS,GACP,OAAO,CASnB;IAED;;;OAGG;IACH,sBAFW,OAAO,QAUjB;IAED;;;OAGG;IACH,eAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,gBAHW,MAAO,MAAM,CAAC,GAAC,YAAY,GAAC,YAAY,GAAC,UAAU,iBACnD,MAAM,QAOhB;IAED;;;MAKC;IAED,0BAGC;IAGL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;oBAvRmB,eAAe"}
1
+ {"version":3,"file":"Rectangle.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/Rectangle.js"],"names":[],"mappings":";AAOA;IACI;;;;;;;OAOG;IACH,gBANW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,EAgBhB;IAXG;;;OAGG;IACH,mBAFU,OAAO,CAEgB;IAEjC;;;OAGG;IACH,eAFU,OAAO,CAEqB;IAG1C;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,iBAEC;IAED;;;OAGG;IACH,iBAEC;IAED;;;;;;OAMG;IACH,OALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QAKhB;IAED;;;OAGG;IACH,SAFa,SAAS,CAUrB;IAED;;;OAGG;IACH,YAFW,SAAS,QAKnB;IAED;;;;;;;OAOG;IACH,gBANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAUnB;IAED;;;;OAIG;IACH,kBAHW,SAAS,GACP,OAAO,CAQnB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAenB;IAED;;;;OAIG;IACH,gBAHW,SAAS,GACP,OAAO,CASnB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAyBhB;IAED;;;OAGG;IACH,mBAFW,SAAS,QASnB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAiBnB;IAED;;;;OAIG;IACH,gBAHW,SAAS,GACP,OAAO,CAUnB;IAED;;;OAGG;IACH,sBAFW,OAAO,QAUjB;IAED;;;OAGG;IACH,eAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,gBAHW,MAAO,MAAM,CAAC,GAAC,YAAY,GAAC,YAAY,GAAC,UAAU,iBACnD,MAAM,QAOhB;IAED;;;MAKC;IAED,0BAGC;IAGL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;oBArSmB,eAAe"}
@@ -1,8 +1,9 @@
1
1
  import { intersects1D } from "../../math/interval/intersects1D.js";
2
- import { overlap1D } from "../../math/interval/overlap1D.js";
3
2
  import { max2 } from "../../math/max2.js";
4
3
  import { min2 } from "../../math/min2.js";
5
4
  import Vector2 from "../Vector2.js";
5
+ import { aabb2_contains } from "./aabb/aabb2_contains.js";
6
+ import { aabb2_overlap_exists } from "./aabb/aabb2_overlap_exists.js";
6
7
 
7
8
  class Rectangle {
8
9
  /**
@@ -140,8 +141,13 @@ class Rectangle {
140
141
 
141
142
  const _x0 = p.x;
142
143
  const _y0 = p.y;
144
+ const _x1 = s.x + _x0;
145
+ const _y1 = _y0 + s.y;
143
146
 
144
- return overlap1D(x0, x1, _x0, s.x + _x0) && overlap1D(y0, y1, _y0, _y0 + s.y);
147
+ return aabb2_overlap_exists(
148
+ _x0, _y0, _x1, _y1,
149
+ x0, y0, x1, y1
150
+ );
145
151
  }
146
152
 
147
153
  /**
@@ -154,6 +160,7 @@ class Rectangle {
154
160
  const y0 = other.position.y;
155
161
  const y1 = other.size.y + y0;
156
162
  const x1 = other.size.x + x0;
163
+
157
164
  return this._overlaps(x0, y0, x1, y1);
158
165
  }
159
166
 
@@ -213,13 +220,18 @@ class Rectangle {
213
220
  _contains(x0, y0, x1, y1) {
214
221
  const size = this.size;
215
222
 
216
- const _x0 = this.position.x;
217
- const _y0 = this.position.y;
223
+ const position = this.position;
224
+
225
+ const _x0 = position.x;
226
+ const _y0 = position.y;
218
227
 
219
228
  const _y1 = size.y + _y0;
220
229
  const _x1 = size.x + _x0;
221
230
 
222
- return x0 >= _x0 && x1 <= _x1 && y0 >= _y0 && y1 <= _y1;
231
+ return aabb2_contains(
232
+ _x0, _y0, _x1, _y1,
233
+ x0, y0, x1, y1
234
+ );
223
235
  }
224
236
 
225
237
  /**
@@ -230,6 +242,7 @@ class Rectangle {
230
242
  contains(other) {
231
243
  const x0 = other.position.x;
232
244
  const y0 = other.position.y;
245
+
233
246
  const y1 = other.size.y + y0;
234
247
  const x1 = other.size.x + x0;
235
248
 
@@ -1 +1 @@
1
- {"version":3,"file":"aabb2_overlap_exists.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/aabb/aabb2_overlap_exists.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,0CAVW,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,GACJ,OAAO,CAKnB"}
1
+ {"version":3,"file":"aabb2_overlap_exists.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/aabb/aabb2_overlap_exists.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,0CAVW,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,GACJ,OAAO,CAQnB"}
@@ -12,7 +12,10 @@ import { overlap1D } from "../../../math/interval/overlap1D.js";
12
12
  * @param {number} by1
13
13
  * @returns {boolean} true if overlap exists, false if no overlap
14
14
  */
15
- export function aabb2_overlap_exists(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1) {
15
+ export function aabb2_overlap_exists(
16
+ ax0, ay0, ax1, ay1,
17
+ bx0, by0, bx1, by1
18
+ ) {
16
19
  return overlap1D(ax0, ax1, bx0, bx1)
17
20
  && overlap1D(ay0, ay1, by0, by1);
18
21
  }
@@ -6,12 +6,12 @@
6
6
  * @param {number[]|Float32Array} output result will be written here
7
7
  * @param {number} output_offset offset into output array where to write the result
8
8
  * @param {number} output_point_count number of points to comprise bounding polygon
9
- * @param {number[]} input_points Points to be bounded, must be an ordered loop
9
+ * @param {number[]} input_points Points to be bounded, must be an ordered loop. Must form a convex hull
10
10
  * @param {number} input_point_count number of points in the input to consider
11
- * @returns {boolean} whether or not a valid result could be found
11
+ * @returns {number} number of points added to the output
12
12
  *
13
13
  * @see 2014 "Implementation of linear minimum area enclosing triangle algorithm" Ovidiu Pârvu & David Gilbert
14
14
  * @see https://github.com/MagnusTiberius/humus3/blob/9d43412d6e6be869e224817f0a966fe48a1af40f/Util/ConvexHull.cpp#L281
15
15
  */
16
- export function fixed_convex_hull_humus(output: number[] | Float32Array, output_offset: number, output_point_count: number, input_points: number[], input_point_count: number): boolean;
16
+ export function fixed_convex_hull_humus(output: number[] | Float32Array, output_offset: number, output_point_count: number, input_points: number[], input_point_count: number): number;
17
17
  //# sourceMappingURL=fixed_convex_hull_humus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fixed_convex_hull_humus.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,gDAVW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,sBACN,MAAM,gBACN,MAAM,EAAE,qBACR,MAAM,GACJ,OAAO,CAmInB"}
1
+ {"version":3,"file":"fixed_convex_hull_humus.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,gDAVW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,sBACN,MAAM,gBACN,MAAM,EAAE,qBACR,MAAM,GACJ,MAAM,CA0IlB"}
@@ -13,9 +13,9 @@ import { intersect_ray_2d } from "../intersect_ray_2d.js";
13
13
  * @param {number[]|Float32Array} output result will be written here
14
14
  * @param {number} output_offset offset into output array where to write the result
15
15
  * @param {number} output_point_count number of points to comprise bounding polygon
16
- * @param {number[]} input_points Points to be bounded, must be an ordered loop
16
+ * @param {number[]} input_points Points to be bounded, must be an ordered loop. Must form a convex hull
17
17
  * @param {number} input_point_count number of points in the input to consider
18
- * @returns {boolean} whether or not a valid result could be found
18
+ * @returns {number} number of points added to the output
19
19
  *
20
20
  * @see 2014 "Implementation of linear minimum area enclosing triangle algorithm" Ovidiu Pârvu & David Gilbert
21
21
  * @see https://github.com/MagnusTiberius/humus3/blob/9d43412d6e6be869e224817f0a966fe48a1af40f/Util/ConvexHull.cpp#L281
@@ -24,9 +24,11 @@ export function fixed_convex_hull_humus(
24
24
  output, output_offset, output_point_count,
25
25
  input_points, input_point_count
26
26
  ) {
27
+
27
28
  if (output_point_count >= input_point_count) {
28
29
  // special case, input polygon is smaller or equal to in cardinality to what's desired
29
30
  array_copy(input_points, 0, output, output_offset, input_point_count * 2);
31
+
30
32
  return input_point_count;
31
33
  }
32
34
 
@@ -61,6 +63,7 @@ export function fixed_convex_hull_humus(
61
63
  combos++;
62
64
 
63
65
  for (let i = 0; i < k; i++) {
66
+ // pick point indices to represent a line
64
67
  const i0 = subset[i];
65
68
  const i1 = subset[(i + 1) % k];
66
69
 
@@ -143,7 +146,11 @@ export function fixed_convex_hull_humus(
143
146
  process_combination(s);
144
147
  }
145
148
 
146
- console.log(`combinations: ${combos}, valid: ${combos_valid} (${(combos_valid * 100 / combos).toFixed(2)}%)`);
149
+ // console.log(`combinations: ${combos}, valid: ${combos_valid} (${(combos_valid * 100 / combos).toFixed(2)}%)`);
150
+ if(combos_valid === 0){
151
+ // no valid combinations
152
+ return 0;
153
+ }
147
154
 
148
- return combos_valid > 0;
155
+ return output_point_count;
149
156
  }
@@ -1,7 +1,7 @@
1
1
  import { array_copy } from "../../../collection/array/array_copy.js";
2
2
  import { Uint32Heap } from "../../../collection/heap/Uint32Heap.js";
3
3
  import { intersect_ray_2d } from "../intersect_ray_2d.js";
4
- import { compute_triangle_area_2d } from "../compute_triangle_area_2d.js";
4
+ import { triangle2d_compute_area } from "../triangle2d_compute_area.js";
5
5
 
6
6
 
7
7
  const v2_temp = new Float32Array(2);
@@ -158,7 +158,7 @@ function compute_collapse_cost(edge, vertex_buffer) {
158
158
  const v1x = vertex_buffer[edge.v1 * 2];
159
159
  const v1y = vertex_buffer[edge.v1 * 2 + 1];
160
160
 
161
- const area = compute_triangle_area_2d(
161
+ const area = triangle2d_compute_area(
162
162
  v0x, v0y, v2_temp[0], v2_temp[1], v1x, v1y
163
163
  );
164
164
 
@@ -1,4 +1,4 @@
1
- import { orientation3 } from "./orientation3.js";
1
+ import { orient2d } from "robust-predicates";
2
2
 
3
3
  /**
4
4
  *
@@ -18,5 +18,5 @@ export function orientation3_array(points, a, b, c) {
18
18
  const cx = points[c * 2];
19
19
  const cy = points[c * 2 + 1];
20
20
 
21
- return orientation3(ax, ay, bx, by, cx, cy);
21
+ return orient2d(ax, ay, bx, by, cx, cy);
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"intersect_ray_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/intersect_ray_2d.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,sCAZW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,cAClC,MAAM,cACN,MAAM,cACN,MAAM,iBACN,MAAM,iBACN,MAAM,cACN,MAAM,cACN,MAAM,iBACN,MAAM,iBACN,MAAM,GACJ,OAAO,CAkCnB"}
1
+ {"version":3,"file":"intersect_ray_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/intersect_ray_2d.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,sCAZW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,cAClC,MAAM,cACN,MAAM,cACN,MAAM,iBACN,MAAM,iBACN,MAAM,cACN,MAAM,cACN,MAAM,iBACN,MAAM,iBACN,MAAM,GACJ,OAAO,CAoCnB"}
@@ -1,5 +1,3 @@
1
- import { fabsf } from "../../math/fabsf.js";
2
-
3
1
  /**
4
2
  * NOTE: that direction must not be normalized for correct results and instead derived from line length
5
3
  * @param {number[]|Float32Array|Float64Array} out
@@ -20,15 +18,17 @@ export function intersect_ray_2d(
20
18
  origin_b_x, origin_b_y, direction_b_x, direction_b_y
21
19
  ) {
22
20
 
23
- const d = (direction_a_x * direction_b_y - direction_a_y * direction_b_x);
21
+ const denominator = (direction_a_x * direction_b_y - direction_a_y * direction_b_x);
24
22
 
25
- if (fabsf(d) < 0.000000000001) // Parallel lines
23
+ if (Math.abs(denominator) < 1e-7){
24
+ // Parallel lines
26
25
  return false;
26
+ }
27
27
 
28
28
  const oab_y = origin_a_y - origin_b_y;
29
29
  const oab_x = origin_a_x - origin_b_x;
30
30
 
31
- const t = (direction_b_x * oab_y - direction_b_y * oab_x) / d;
31
+ const t = (direction_b_x * oab_y - direction_b_y * oab_x) / denominator;
32
32
 
33
33
  if (t < 0.5) // Intersects on the wrong side
34
34
  return false;
@@ -8,5 +8,5 @@
8
8
  * @param {number} y2
9
9
  * @returns {number}
10
10
  */
11
- export function compute_triangle_area_2d(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): number;
12
- //# sourceMappingURL=compute_triangle_area_2d.d.ts.map
11
+ export function triangle2d_compute_area(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): number;
12
+ //# sourceMappingURL=triangle2d_compute_area.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triangle2d_compute_area.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/triangle2d_compute_area.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,4CARW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAclB"}
@@ -8,7 +8,7 @@
8
8
  * @param {number} y2
9
9
  * @returns {number}
10
10
  */
11
- export function compute_triangle_area_2d(
11
+ export function triangle2d_compute_area(
12
12
  x0, y0,
13
13
  x1, y1,
14
14
  x2, y2
@@ -0,0 +1,14 @@
1
+ /**
2
+ *
3
+ * @param {number} ax
4
+ * @param {number} ay
5
+ * @param {number} bx
6
+ * @param {number} by
7
+ * @param {number} cx
8
+ * @param {number} cy
9
+ * @param {number} px reference point X
10
+ * @param {number} py reference point Y
11
+ * @returns {boolean}
12
+ */
13
+ export function triangle2d_contains_point(ax: number, ay: number, bx: number, by: number, cx: number, cy: number, px: number, py: number): boolean;
14
+ //# sourceMappingURL=triangle2d_contains_point.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triangle2d_contains_point.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/triangle2d_contains_point.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,8CAVW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAwBnB"}
@@ -0,0 +1,39 @@
1
+ import { triangle2d_get_barycentric } from "./triangle2d_get_barycentric.js";
2
+
3
+ const scratch = new Float32Array(3);
4
+
5
+ /**
6
+ *
7
+ * @param {number} ax
8
+ * @param {number} ay
9
+ * @param {number} bx
10
+ * @param {number} by
11
+ * @param {number} cx
12
+ * @param {number} cy
13
+ * @param {number} px reference point X
14
+ * @param {number} py reference point Y
15
+ * @returns {boolean}
16
+ */
17
+ export function triangle2d_contains_point(
18
+ ax, ay,
19
+ bx, by,
20
+ cx, cy,
21
+ px, py
22
+ ) {
23
+ triangle2d_get_barycentric(
24
+ scratch, 0,
25
+ ax, ay,
26
+ bx, by,
27
+ cx, cy,
28
+ px, py
29
+ );
30
+
31
+ const u = scratch[0];
32
+ const v = scratch[1];
33
+ const w = scratch[2];
34
+
35
+ return u >= 0
36
+ && v >= 0
37
+ && w >= 0
38
+ && Math.abs(1 - u - v - w) < 1e-7;
39
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  *
3
- * @param {number[]} output
3
+ * @param {number[]|TypedArray|Float32Array} output
4
4
  * @param {number} output_offset
5
5
  * @param {number} ax
6
6
  * @param {number} ay
@@ -11,5 +11,5 @@
11
11
  * @param {number} px reference point X
12
12
  * @param {number} py reference point Y
13
13
  */
14
- export function triangle2d_get_barycentric(output: number[], output_offset: number, ax: number, ay: number, bx: number, by: number, cx: number, cy: number, px: number, py: number): void;
14
+ export function triangle2d_get_barycentric(output: number[] | TypedArray | Float32Array, output_offset: number, ax: number, ay: number, bx: number, by: number, cx: number, cy: number, px: number, py: number): void;
15
15
  //# sourceMappingURL=triangle2d_get_barycentric.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"triangle2d_get_barycentric.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/triangle2d_get_barycentric.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,mDAXW,MAAM,EAAE,iBACR,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAkChB"}
1
+ {"version":3,"file":"triangle2d_get_barycentric.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/triangle2d_get_barycentric.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,mDAXW,MAAM,EAAE,gBAAY,YAAY,iBAChC,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAkChB"}
@@ -2,7 +2,7 @@ import { v2_dot } from "../vec2/v2_dot.js";
2
2
 
3
3
  /**
4
4
  *
5
- * @param {number[]} output
5
+ * @param {number[]|TypedArray|Float32Array} output
6
6
  * @param {number} output_offset
7
7
  * @param {number} ax
8
8
  * @param {number} ay
@@ -1 +1 @@
1
- {"version":3,"file":"Vector2.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector2.js"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"Vector2.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector2.js"],"names":[],"mappings":"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"}
@@ -48,7 +48,7 @@ class Vector2 {
48
48
 
49
49
  /**
50
50
  *
51
- * @param {number[]} array
51
+ * @param {number[]|Float32Array} array
52
52
  * @param {number} offset
53
53
  */
54
54
  fromArray(array, offset = 0) {
@@ -60,7 +60,7 @@ class Vector2 {
60
60
 
61
61
  /**
62
62
  *
63
- * @param {number[]} array
63
+ * @param {number[]|Float32Array} array
64
64
  * @param {number} offset
65
65
  */
66
66
  toArray(array, offset = 0) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Kaiser Bessel Function of third kind
2
+ * Kaiser Bessel Function of third kind (BesselJ(3,x))
3
3
  * NOTE: this is an approximation, if input value is sufficiently large - results will be way off
4
4
  * This is a Tylor series approximation
5
5
  * @see https://www.shadertoy.com/view/wlf3RH
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Kaiser Bessel Function of third kind
2
+ * Kaiser Bessel Function of third kind (BesselJ(3,x))
3
3
  * NOTE: this is an approximation, if input value is sufficiently large - results will be way off
4
4
  * This is a Tylor series approximation
5
5
  * @see https://www.shadertoy.com/view/wlf3RH
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Compute lowest positive integer divisor of a given "product" value
2
+ * Compute the largest positive integer divisor of a given "product" value
3
3
  * @param {number} product
4
4
  * @param {number} limit
5
5
  * @returns {number}
@@ -1 +1 @@
1
- {"version":3,"file":"computeWholeDivisorLow.d.ts","sourceRoot":"","sources":["../../../../src/core/math/computeWholeDivisorLow.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,gDAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAuBlB"}
1
+ {"version":3,"file":"computeWholeDivisorLow.d.ts","sourceRoot":"","sources":["../../../../src/core/math/computeWholeDivisorLow.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,gDAJW,MAAM,SACN,MAAM,GACJ,MAAM,CA0BlB"}
@@ -1,18 +1,21 @@
1
1
  import { assert } from "../assert.js";
2
2
 
3
3
  /**
4
- * Compute lowest positive integer divisor of a given "product" value
4
+ * Compute the largest positive integer divisor of a given "product" value
5
5
  * @param {number} product
6
6
  * @param {number} limit
7
7
  * @returns {number}
8
8
  */
9
9
  export function computeWholeDivisorLow(product, limit) {
10
- assert.typeOf(product, 'number', 'product');
11
- assert.typeOf(limit, 'number', 'limit');
12
10
 
11
+ assert.isNumber(product, 'product');
12
+ assert.isInteger(product, 'product');
13
13
 
14
- assert.ok(Number.isInteger(product), `expected product to be an integer, instead got '${product}'`);
15
- assert.ok(Number.isInteger(limit), `expected limit to be an integer, instead got '${limit}'`);
14
+ assert.isNumber(limit, 'limit');
15
+ assert.isInteger(limit, 'limit');
16
+
17
+ assert.isFiniteNumber(limit,'limit');
18
+ assert.isFiniteNumber(product,'product');
16
19
 
17
20
  let i = limit;
18
21
 
@@ -0,0 +1 @@
1
+ {"version":3,"file":"separation1D.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/interval/separation1D.js"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,iCANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CASlB"}
@@ -1,6 +1,6 @@
1
- import { assert } from "../assert.js";
2
- import { max2 } from "./max2.js";
3
- import { min2 } from "./min2.js";
1
+ import { assert } from "../../assert.js";
2
+ import { max2 } from "../max2.js";
3
+ import { min2 } from "../min2.js";
4
4
 
5
5
  /**
6
6
  * Returns a number representing overlap distance between two 1D line segments.
@@ -1 +1 @@
1
- {"version":3,"file":"solveQuadratic.d.ts","sourceRoot":"","sources":["../../../../src/core/math/solveQuadratic.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,uCAJW,MAAM,EAAE,iBACR,MAAM,KAJN,MAAM,KACN,MAAM,KACN,MAAM,GAGJ,MAAM,CAuClB"}
1
+ {"version":3,"file":"solveQuadratic.d.ts","sourceRoot":"","sources":["../../../../src/core/math/solveQuadratic.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,uCAJW,MAAM,EAAE,iBACR,MAAM,KAJN,MAAM,KACN,MAAM,KACN,MAAM,GAGJ,MAAM,CAgDlB"}
@@ -1,3 +1,4 @@
1
+ import { assert } from "../assert.js";
1
2
  import { EPSILON } from "./EPSILON.js";
2
3
 
3
4
  /**
@@ -10,10 +11,17 @@ import { EPSILON } from "./EPSILON.js";
10
11
  * @returns {number} number of found solutions (roots)
11
12
  */
12
13
  export function solveQuadratic(result, result_offset, a, b, c) {
14
+ assert.isNumber(a, 'a');
15
+ assert.isNumber(b, 'b');
16
+ assert.isNumber(c, 'c');
17
+
13
18
 
14
19
  if (Math.abs(a) < EPSILON) {
20
+
15
21
  if (Math.abs(b) < EPSILON) {
22
+
16
23
  if (Math.abs(c) < EPSILON) {
24
+ // special case, all variables are close to 0
17
25
 
18
26
  result[result_offset] = 0;
19
27
  result[result_offset + 1] = 0;
@@ -21,12 +29,14 @@ export function solveQuadratic(result, result_offset, a, b, c) {
21
29
  return 2;
22
30
 
23
31
  }
32
+
24
33
  } else {
25
34
  result[result_offset] = -c / b;
26
35
  result[result_offset + 1] = -c / b;
27
36
 
28
37
  return 2;
29
38
  }
39
+
30
40
  } else {
31
41
  // 2 root solution
32
42
 
@@ -1,8 +1,8 @@
1
- import { compareStrings } from "../../primitives/strings/compareStrings.js";
2
- import { compareBooleans } from "../../primitives/boolean/compareBooleans.js";
1
+ import { compareArrays } from "../../collection/array/compareArrays.js";
3
2
  import { extractFunctionBody } from "../../function/extractFunctionBody.js";
4
- import { compareArrays } from "../../primitives/array/compareArrays.js";
3
+ import { compareBooleans } from "../../primitives/boolean/compareBooleans.js";
5
4
  import { number_compare_ascending } from "../../primitives/numbers/number_compare_ascending.js";
5
+ import { compareStrings } from "../../primitives/strings/compareStrings.js";
6
6
 
7
7
  /**
8
8
  *
@@ -1,14 +1,3 @@
1
- /**
2
- *
3
- * @param timeout
4
- * @param action
5
- * @returns {Entity}
6
- */
7
- export function createTimer({ timeout, action }: {
8
- timeout: any;
9
- action: any;
10
- }): Entity;
11
- import Entity from './ecs/Entity.js';
12
1
  /**
13
2
  *
14
3
  * @param {Vector3} [position]
@@ -21,5 +10,16 @@ import Entity from './ecs/Entity.js';
21
10
  * @returns {Entity}
22
11
  */
23
12
  export function createSound({ position, timeout, url, track, positioned, channel, volume }?: Vector3): Entity;
13
+ /**
14
+ *
15
+ * @param timeout
16
+ * @param action
17
+ * @returns {Entity}
18
+ */
19
+ export function createTimer({ timeout, action }: {
20
+ timeout: any;
21
+ action: any;
22
+ }): Entity;
24
23
  import Vector3 from "../core/geom/Vector3.js";
24
+ import Entity from './ecs/Entity.js';
25
25
  //# sourceMappingURL=EntityCreator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntityCreator.d.ts","sourceRoot":"","sources":["../../../src/engine/EntityCreator.js"],"names":[],"mappings":"AAwEA;;;;;GAKG;AACH;;;IAFa,MAAM,CAkBlB;mBA3FkB,iBAAiB;AASpC;;;;;;;;;;GAUG;AACH,6FATW,OAAO,GAOL,MAAM,CAiDlB;oBAtEmB,yBAAyB"}
1
+ {"version":3,"file":"EntityCreator.d.ts","sourceRoot":"","sources":["../../../src/engine/EntityCreator.js"],"names":[],"mappings":"AAYA;;;;;;;;;;GAUG;AACH,6FATW,OAAO,GAOL,MAAM,CAiDlB;AAED;;;;;GAKG;AACH;;;IAFa,MAAM,CAkBlB;oBA9FmB,yBAAyB;mBAG1B,iBAAiB"}
@@ -21,7 +21,7 @@ import { SoundEmitterChannels } from "./sound/ecs/emitter/SoundEmitterSystem.js"
21
21
  * @param {number} [volume]
22
22
  * @returns {Entity}
23
23
  */
24
- function createSound(
24
+ export function createSound(
25
25
  {
26
26
  position = Vector3.zero,
27
27
  timeout = 60,
@@ -92,6 +92,4 @@ export function createTimer({ timeout, action }) {
92
92
  }));
93
93
 
94
94
  return builder;
95
- }
96
-
97
- export { createSound };
95
+ }
@@ -1,7 +1,7 @@
1
1
  import ImageFilter from '../../graphics/filter/ImageFilter.js';
2
2
  import NormalMapShader from '../../graphics/shaders/NormalMapShader2.js';
3
3
  import { Sampler2D } from '../../graphics/texture/sampler/Sampler2D.js';
4
- import { sampler2DtoFloat32Texture } from "../../graphics/texture/sampler/sampler2DToFloat32Texture.js";
4
+ import { sampler2d_to_float32_texture } from "../../graphics/texture/sampler/sampler2d_to_float32_texture.js";
5
5
 
6
6
 
7
7
  function convertChannel(v) {
@@ -51,7 +51,7 @@ function heightMap2NormalMap(renderer, sampler) {
51
51
  const width = sampler.width;
52
52
  const height = sampler.height;
53
53
 
54
- const texture = sampler2DtoFloat32Texture(sampler);
54
+ const texture = sampler2d_to_float32_texture(sampler);
55
55
 
56
56
  //construct shader
57
57
  const shader = new NormalMapShader();
@@ -3,7 +3,7 @@ import ImageFilter from '../../graphics/filter/ImageFilter.js';
3
3
  import AmbientOcclusionShader from '../../graphics/shaders/AmbientOcclusionShader.js';
4
4
  import { DenoiseShader } from "../../graphics/shaders/DenoiseShader.js";
5
5
  import { Sampler2D } from '../../graphics/texture/sampler/Sampler2D.js';
6
- import { sampler2DtoFloat32Texture } from "../../graphics/texture/sampler/sampler2DToFloat32Texture.js";
6
+ import { sampler2d_to_float32_texture } from "../../graphics/texture/sampler/sampler2d_to_float32_texture.js";
7
7
 
8
8
  function filterResult2Texture(data, width, height) {
9
9
  const result = new DataTexture();
@@ -46,9 +46,9 @@ function normalMap2OcclusionMap(
46
46
  const width = resultSize.x;
47
47
  const height = resultSize.y;
48
48
  //
49
- const normalTexture = sampler2DtoFloat32Texture(normalMap);
49
+ const normalTexture = sampler2d_to_float32_texture(normalMap);
50
50
 
51
- const heightTexture = sampler2DtoFloat32Texture(heightMap);
51
+ const heightTexture = sampler2d_to_float32_texture(heightMap);
52
52
 
53
53
 
54
54
  //construct shader
@@ -4,7 +4,7 @@
4
4
  * @param {ImpostorDescription} impostor
5
5
  * @param {THREE.WebGLRenderer} renderer
6
6
  * @param {number} vertex_limit how many vertices to use for the billboard, more vertices will provide better fit and lower area reducing overdraw at the cost of extra triangles. Prefer values between 4 and 16
7
- * @returns {number[]}
7
+ * @returns {Float32Array}
8
8
  */
9
- export function build_cutout_from_atlas_by_alpha({ impostor, renderer, vertex_limit }: ImpostorDescription): number[];
9
+ export function build_cutout_from_atlas_by_alpha({ impostor, renderer, vertex_limit }: ImpostorDescription): Float32Array;
10
10
  //# sourceMappingURL=build_cutout_from_atlas_by_alpha.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build_cutout_from_atlas_by_alpha.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,6GAFa,MAAM,EAAE,CAqHpB"}
1
+ {"version":3,"file":"build_cutout_from_atlas_by_alpha.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,6GAFa,YAAY,CA0ExB"}