@woosh/meep-engine 2.46.4 → 2.46.5

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 (3025) hide show
  1. package/package.json +2 -1
  2. package/src/__module.js +6 -0
  3. package/src/core/IdPool.js +83 -0
  4. package/src/core/IdPool.spec.js +29 -0
  5. package/src/core/NumberFormat.js +75 -0
  6. package/src/core/UUID.d.ts +3 -0
  7. package/src/core/UUID.js +21 -0
  8. package/src/core/__module.js +10 -0
  9. package/src/core/assert.js +390 -0
  10. package/src/core/binary/32BitEncoder.js +61 -0
  11. package/src/core/binary/32BitEncoder.spec.js +11 -0
  12. package/src/core/binary/Base64.js +210 -0
  13. package/src/core/binary/Base64.spec.js +14 -0
  14. package/src/core/binary/BinaryBuffer.js +1119 -0
  15. package/src/core/binary/BinaryBuffer.spec.js +196 -0
  16. package/src/core/binary/BitSet.js +619 -0
  17. package/src/core/binary/BitSet.spec.js +466 -0
  18. package/src/core/binary/ByteArrayTools.js +137 -0
  19. package/src/core/binary/EncodingBinaryBuffer.js +94 -0
  20. package/src/core/binary/NaiveBitSet.js +69 -0
  21. package/src/core/binary/ValidatingBitSetWrapper.js +81 -0
  22. package/src/core/binary/ctz32.js +40 -0
  23. package/src/core/binary/float2uint8.js +8 -0
  24. package/src/core/binary/int32_to_binary_string.js +18 -0
  25. package/src/core/binary/is_data_url.js +12 -0
  26. package/src/core/binary/objects/StandardTypeBuilder.js +126 -0
  27. package/src/core/binary/operations/bitCount.js +16 -0
  28. package/src/core/binary/operations/bitwiseAnd.js +9 -0
  29. package/src/core/binary/operations/bitwiseOr.js +9 -0
  30. package/src/core/binary/operations/ceilPowerOfTwo.js +22 -0
  31. package/src/core/binary/operations/ceilPowerOfTwo.spec.js +17 -0
  32. package/src/core/binary/serde/JsonSerializer.js +113 -0
  33. package/src/core/binary/to_half_float_uint16.js +63 -0
  34. package/src/core/binary/type/Field.js +26 -0
  35. package/src/core/binary/type/MultiplicityType.js +14 -0
  36. package/src/core/binary/type/PrimitiveTypes.js +35 -0
  37. package/src/core/binary/type/Type.js +83 -0
  38. package/src/core/binary/type/TypeBuilder.js +106 -0
  39. package/src/core/binary/type/TypeRegistry.js +53 -0
  40. package/src/core/binary/uint82float.js +8 -0
  41. package/src/core/binary/url_to_data_url.js +28 -0
  42. package/src/core/bvh2/BVHTasks.js +65 -0
  43. package/src/core/bvh2/BinaryNode.d.ts +13 -0
  44. package/src/core/bvh2/BinaryNode.js +1213 -0
  45. package/src/core/bvh2/BinaryNode.spec.js +308 -0
  46. package/src/core/bvh2/LeafNode.d.ts +7 -0
  47. package/src/core/bvh2/LeafNode.js +144 -0
  48. package/src/core/bvh2/Node.d.ts +9 -0
  49. package/src/core/bvh2/Node.js +196 -0
  50. package/src/core/bvh2/NodeValidator.js +197 -0
  51. package/src/core/bvh2/StacklessTraverser.js +154 -0
  52. package/src/core/bvh2/StacklessTraverser.spec.js +109 -0
  53. package/src/core/bvh2/aabb3/AABB3.d.ts +46 -0
  54. package/src/core/bvh2/aabb3/AABB3.js +917 -0
  55. package/src/core/bvh2/aabb3/AABB3.spec.js +227 -0
  56. package/src/core/bvh2/aabb3/aabb3_array_combine.js +20 -0
  57. package/src/core/bvh2/aabb3/aabb3_array_contains_point.js +18 -0
  58. package/src/core/bvh2/aabb3/aabb3_array_intersects_frustum_array.js +20 -0
  59. package/src/core/bvh2/aabb3/aabb3_array_intersects_frustum_degree.js +20 -0
  60. package/src/core/bvh2/aabb3/aabb3_array_intersects_ray.js +21 -0
  61. package/src/core/bvh2/aabb3/aabb3_array_intersects_ray_array.js +14 -0
  62. package/src/core/bvh2/aabb3/aabb3_box_surface_area_2.js +10 -0
  63. package/src/core/bvh2/aabb3/aabb3_combined_surface_area.js +21 -0
  64. package/src/core/bvh2/aabb3/aabb3_compute_half_surface_area.js +16 -0
  65. package/src/core/bvh2/aabb3/aabb3_compute_surface_area.js +18 -0
  66. package/src/core/bvh2/aabb3/aabb3_corner_edge_mapping.js +17 -0
  67. package/src/core/bvh2/aabb3/aabb3_corner_edge_mapping.spec.js +39 -0
  68. package/src/core/bvh2/aabb3/aabb3_detailed_volume_intersection.js +294 -0
  69. package/src/core/bvh2/aabb3/aabb3_edge_corner_mapping.js +25 -0
  70. package/src/core/bvh2/aabb3/aabb3_edge_corner_mapping.spec.js +32 -0
  71. package/src/core/bvh2/aabb3/aabb3_edge_plane_mapping.js +23 -0
  72. package/src/core/bvh2/aabb3/aabb3_expand_array.js +15 -0
  73. package/src/core/bvh2/aabb3/aabb3_from_v3_array.js +34 -0
  74. package/src/core/bvh2/aabb3/aabb3_from_v3_array_transformed.js +39 -0
  75. package/src/core/bvh2/aabb3/aabb3_intersect_aabb3.js +28 -0
  76. package/src/core/bvh2/aabb3/aabb3_intersect_ray_slab.js +73 -0
  77. package/src/core/bvh2/aabb3/aabb3_intersects_frustum_array.js +35 -0
  78. package/src/core/bvh2/aabb3/aabb3_intersects_frustum_degree.js +46 -0
  79. package/src/core/bvh2/aabb3/aabb3_intersects_line_segment.js +79 -0
  80. package/src/core/bvh2/aabb3/aabb3_intersects_ray.js +97 -0
  81. package/src/core/bvh2/aabb3/aabb3_intersects_ray.spec.js +71 -0
  82. package/src/core/bvh2/aabb3/aabb3_intersects_ray_branchless.js +52 -0
  83. package/src/core/bvh2/aabb3/aabb3_intersects_ray_fast.js +176 -0
  84. package/src/core/bvh2/aabb3/aabb3_nearest_point_on_surface.js +65 -0
  85. package/src/core/bvh2/aabb3/aabb3_score_boxes_SAH.js +43 -0
  86. package/src/core/bvh2/aabb3/aabb3_signed_distance_sqr_to_point.js +39 -0
  87. package/src/core/bvh2/aabb3/aabb_score_boxes_SAH_delta.js +37 -0
  88. package/src/core/bvh2/aabb3/deserializeAABB3.js +17 -0
  89. package/src/core/bvh2/aabb3/deserializeAABB3Encoded_v0.js +73 -0
  90. package/src/core/bvh2/aabb3/deserializeAABB3Quantized16Uint.js +36 -0
  91. package/src/core/bvh2/aabb3/serializeAABB3.js +13 -0
  92. package/src/core/bvh2/aabb3/serializeAABB3Encoded_v0.js +75 -0
  93. package/src/core/bvh2/aabb3/serializeAABB3Quantized16Uint.js +33 -0
  94. package/src/core/bvh2/binary/2/BinaryUint32BVH.js +504 -0
  95. package/src/core/bvh2/binary/2/BinaryUint32BVH.spec.js +84 -0
  96. package/src/core/bvh2/binary/BinaryBVH.js +281 -0
  97. package/src/core/bvh2/binary/IndexedBinaryBVH.js +406 -0
  98. package/src/core/bvh2/binary/IndexedBinaryBVHVisitor.js +11 -0
  99. package/src/core/bvh2/binary/NodeType.js +8 -0
  100. package/src/core/bvh2/binary/RayLeafIntersectionVisitor.js +59 -0
  101. package/src/core/bvh2/binary/tiny/TinyBVH.js +221 -0
  102. package/src/core/bvh2/bvh3/BVHNodeProxy.js +53 -0
  103. package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.d.ts +25 -0
  104. package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +1107 -0
  105. package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.spec.js +164 -0
  106. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js +34 -0
  107. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +175 -0
  108. package/src/core/bvh2/bvh3/ebvh_sort_for_traversal_depth_first.js +122 -0
  109. package/src/core/bvh2/bvh3/query/BVHQuery.js +11 -0
  110. package/src/core/bvh2/bvh3/query/BVHQueryIntersectsFrustum.js +36 -0
  111. package/src/core/bvh2/bvh3/query/BVHQueryIntersectsRay.js +36 -0
  112. package/src/core/bvh2/bvh3/query/bvh_collect_user_data.js +60 -0
  113. package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.js +79 -0
  114. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +97 -0
  115. package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.js +79 -0
  116. package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point.js +96 -0
  117. package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point.spec.js +70 -0
  118. package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js +85 -0
  119. package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +156 -0
  120. package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.spec.js +41 -0
  121. package/src/core/bvh2/sah/surfaceAreaHeuristic.js +15 -0
  122. package/src/core/bvh2/sah/surfaceAreaHeuristicFull.js +14 -0
  123. package/src/core/bvh2/serialization/deserializeBinaryNode.js +40 -0
  124. package/src/core/bvh2/serialization/deserializeBinaryNodeFromBinaryBuffer.js +90 -0
  125. package/src/core/bvh2/serialization/serializeBinaryNode.js +31 -0
  126. package/src/core/bvh2/serialization/serializeBinaryNodeToBinaryBuffer.js +86 -0
  127. package/src/core/bvh2/transform/BottomUpOptimizingRebuilder.js +144 -0
  128. package/src/core/bvh2/transform/RotationOptimizer.js +123 -0
  129. package/src/core/bvh2/transform/RotationOptimizer.spec.js +297 -0
  130. package/src/core/bvh2/transform/tryRotateSingleNode.js +260 -0
  131. package/src/core/bvh2/traversal/BVHVisitor.js +30 -0
  132. package/src/core/bvh2/traversal/RaycastBVHVisitor.js +66 -0
  133. package/src/core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js +384 -0
  134. package/src/core/bvh2/traversal/ThreeFrustumsIntersectionBVHVisitor.js +52 -0
  135. package/src/core/bvh2/traversal/__process_point_if_within_planes.js +56 -0
  136. package/src/core/bvh2/traversal/aabb3_detailed_volume_intersection_callback_based.js +63 -0
  137. package/src/core/bvh2/traversal/bvh_traverse_pre_order_using_stack.js +43 -0
  138. package/src/core/bvh2/traversal/queryBinaryNode_ClippingPlanes.d.ts +5 -0
  139. package/src/core/bvh2/traversal/queryBinaryNode_ClippingPlanes.js +66 -0
  140. package/src/core/bvh2/traversal/queryBinaryNode_CollectData.js +49 -0
  141. package/src/core/bvh2/traversal/queryBinaryNode_CollectLeaves.js +51 -0
  142. package/src/core/bvh2/traversal/queryBinaryNode_FrustumIntersections.js +77 -0
  143. package/src/core/bvh2/traversal/queryBinaryNode_SphereIntersections.js +63 -0
  144. package/src/core/bvh2/traversal/traverseBinaryNodeUsingVisitor.js +50 -0
  145. package/src/core/bvh2/traversal/traverseBinaryNodeUsingVisitor_DepthFirst_PreOrder.js +34 -0
  146. package/src/core/bvh2/util/find_least_common_ancestor.js +34 -0
  147. package/src/core/bvh2/visual/BVHGeometry.js +132 -0
  148. package/src/core/bvh2/visual/convert_bvh_to_dot_format_string.js +50 -0
  149. package/src/core/cache/Cache.d.ts +36 -0
  150. package/src/core/cache/Cache.js +449 -0
  151. package/src/core/cache/Cache.spec.js +98 -0
  152. package/src/core/cache/CacheElement.js +48 -0
  153. package/src/core/cache/CacheV2.js +237 -0
  154. package/src/core/cache/FrequencySketch.js +229 -0
  155. package/src/core/cache/PersistentCacheAdapter.js +378 -0
  156. package/src/core/codegen/LineBuilder.js +148 -0
  157. package/src/core/collection/CuckooFilter.js +526 -0
  158. package/src/core/collection/CuckooFilter.spec.js +111 -0
  159. package/src/core/collection/HashMap.d.ts +38 -0
  160. package/src/core/collection/HashMap.js +582 -0
  161. package/src/core/collection/HashMap.spec.js +50 -0
  162. package/src/core/collection/HashSet.d.ts +33 -0
  163. package/src/core/collection/HashSet.js +122 -0
  164. package/src/core/collection/IteratorUtils.js +17 -0
  165. package/src/core/collection/KeyValuePair.js +32 -0
  166. package/src/core/collection/LazyStream.js +23 -0
  167. package/src/core/collection/LazyStream.spec.js +13 -0
  168. package/src/core/collection/ObservedMap.js +75 -0
  169. package/src/core/collection/RingBuffer.js +218 -0
  170. package/src/core/collection/RingBuffer.spec.js +59 -0
  171. package/src/core/collection/Set.d.ts +26 -0
  172. package/src/core/collection/Set.js +167 -0
  173. package/src/core/collection/Stack.js +111 -0
  174. package/src/core/collection/Stack.spec.js +63 -0
  175. package/src/core/collection/array/AbstractArrayIterator.js +24 -0
  176. package/src/core/collection/array/ArrayIteratorRandom.js +54 -0
  177. package/src/core/collection/array/ArrayIteratorSequential.js +31 -0
  178. package/src/core/collection/array/arrayIndexByEquality.js +20 -0
  179. package/src/core/collection/array/arrayPickBestElement.d.ts +1 -0
  180. package/src/core/collection/array/arrayPickBestElement.js +45 -0
  181. package/src/core/collection/array/arrayPickBestElement.spec.js +7 -0
  182. package/src/core/collection/array/arrayPickBestElements.js +51 -0
  183. package/src/core/collection/array/arrayPickMinElement.js +43 -0
  184. package/src/core/collection/array/arrayQuickSort.js +142 -0
  185. package/src/core/collection/array/arraySetDiff.js +42 -0
  186. package/src/core/collection/array/arraySetSortingDiff.js +67 -0
  187. package/src/core/collection/array/arraySetSortingDiff.spec.js +74 -0
  188. package/src/core/collection/array/arraySwapElements.js +12 -0
  189. package/src/core/collection/array/array_contains_duplicates.js +21 -0
  190. package/src/core/collection/array/array_copy_unique.js +30 -0
  191. package/src/core/collection/array/array_filter_by_multiple.js +36 -0
  192. package/src/core/collection/array/array_get_index_in_range.js +16 -0
  193. package/src/core/collection/array/array_push_if_unique.js +16 -0
  194. package/src/core/collection/array/array_range_equal_strict.js +22 -0
  195. package/src/core/collection/array/array_remove_element.js +19 -0
  196. package/src/core/collection/array/array_remove_first.js +16 -0
  197. package/src/core/collection/array/array_replace_all.js +17 -0
  198. package/src/core/collection/array/array_shrink_to_size.js +14 -0
  199. package/src/core/collection/array/array_swap.js +22 -0
  200. package/src/core/collection/array/binarySearchHighIndex.js +32 -0
  201. package/src/core/collection/array/binarySearchHighIndex.spec.js +50 -0
  202. package/src/core/collection/array/binarySearchLowIndex.js +34 -0
  203. package/src/core/collection/array/computeArrayMax.js +19 -0
  204. package/src/core/collection/array/computeArrayMin.js +19 -0
  205. package/src/core/collection/array/computeHashArray.d.ts +1 -0
  206. package/src/core/collection/array/computeHashArray.js +22 -0
  207. package/src/core/collection/array/computeHashIntegerArray.d.ts +1 -0
  208. package/src/core/collection/array/computeHashIntegerArray.js +10 -0
  209. package/src/core/collection/array/copyArray.js +49 -0
  210. package/src/core/collection/array/fastArrayEquals.js +17 -0
  211. package/src/core/collection/array/groupArrayBy.js +42 -0
  212. package/src/core/collection/array/isArrayEqual.js +50 -0
  213. package/src/core/collection/array/isArrayEqualStrict.d.ts +1 -0
  214. package/src/core/collection/array/isArrayEqualStrict.js +27 -0
  215. package/src/core/collection/array/isArraysEqualWithComparator.d.ts +1 -0
  216. package/src/core/collection/array/isArraysEqualWithComparator.js +32 -0
  217. package/src/core/collection/array/randomMultipleFromArray.js +34 -0
  218. package/src/core/collection/array/randomizeArrayElementOrder.js +23 -0
  219. package/src/core/collection/array/typed/isTypedArray.js +20 -0
  220. package/src/core/collection/array/typed/is_typed_array_equals.js +58 -0
  221. package/src/core/collection/array/typed/typed_array_copy.js +18 -0
  222. package/src/core/collection/array/typed/typed_array_is_integer.js +17 -0
  223. package/src/core/collection/array/typed/uint_array_for_count.js +17 -0
  224. package/src/core/collection/array/typedArrayToDataType.js +34 -0
  225. package/src/core/collection/array/weightedRandomFromArray.js +51 -0
  226. package/src/core/collection/heap/BinaryHeap.js +153 -0
  227. package/src/core/collection/heap/FastBinaryHeap.js +273 -0
  228. package/src/core/collection/heap/FastBinaryHeap.spec.js +136 -0
  229. package/src/core/collection/heap/Uin32Heap.spec.js +59 -0
  230. package/src/core/collection/heap/Uint32Heap.js +404 -0
  231. package/src/core/collection/list/FilteredListProjection.js +187 -0
  232. package/src/core/collection/list/List.d.ts +32 -0
  233. package/src/core/collection/list/List.js +933 -0
  234. package/src/core/collection/list/List.spec.js +109 -0
  235. package/src/core/collection/list/ListForwarder.d.ts +18 -0
  236. package/src/core/collection/list/ListForwarder.js +160 -0
  237. package/src/core/collection/list/ListForwarder.spec.js +99 -0
  238. package/src/core/collection/list/SortedListProjection.js +63 -0
  239. package/src/core/collection/map/AbstractAsyncMap.js +30 -0
  240. package/src/core/collection/map/AsyncLoadingCache.js +49 -0
  241. package/src/core/collection/map/AsyncMapWrapper.js +28 -0
  242. package/src/core/collection/map/AsyncRemoteHashMap.js +358 -0
  243. package/src/core/collection/map/CachedAsyncMap.js +43 -0
  244. package/src/core/collection/map/CachedAsyncMap.spec.js +47 -0
  245. package/src/core/collection/queue/Deque.d.ts +20 -0
  246. package/src/core/collection/queue/Deque.js +308 -0
  247. package/src/core/collection/queue/Deque.spec.js +89 -0
  248. package/src/core/collection/set/compute_set_difference.js +32 -0
  249. package/src/core/collection/set/compute_set_intersection.js +22 -0
  250. package/src/core/collection/set/set_remove.js +15 -0
  251. package/src/core/collection/table/DataType.js +19 -0
  252. package/src/core/collection/table/DataType2TypedArrayConstructorMapping.js +34 -0
  253. package/src/core/collection/table/DataTypeByteSizes.js +37 -0
  254. package/src/core/collection/table/DataTypeIndices.js +17 -0
  255. package/src/core/collection/table/RowFirstTable.js +500 -0
  256. package/src/core/collection/table/RowFirstTable.spec.js +287 -0
  257. package/src/core/collection/table/RowFirstTableSpec.js +271 -0
  258. package/src/core/collection/table/computeDataTypeByIndex.js +21 -0
  259. package/src/core/collection/table/deserializeRowFirstTable.js +48 -0
  260. package/src/core/collection/table/serializeRowFirstTable.js +27 -0
  261. package/src/core/color/Color.d.ts +43 -0
  262. package/src/core/color/Color.js +640 -0
  263. package/src/core/color/Color.spec.js +55 -0
  264. package/src/core/color/ColorUtils.js +85 -0
  265. package/src/core/color/YCbCr_to_rgb_uint24.js +19 -0
  266. package/src/core/color/hsluv/HSLuv.js +187 -0
  267. package/src/core/color/hsv2rgb.js +55 -0
  268. package/src/core/color/int2rgb.js +12 -0
  269. package/src/core/color/kelvin_to_rgb.js +51 -0
  270. package/src/core/color/kelvin_to_rgb.spec.js +61 -0
  271. package/src/core/color/linear_to_sRGB.js +16 -0
  272. package/src/core/color/parseHex.js +18 -0
  273. package/src/core/color/prototype_kelvin_to_rgb.js +44 -0
  274. package/src/core/color/rgb2hex.js +16 -0
  275. package/src/core/color/rgb2hsv.js +47 -0
  276. package/src/core/color/rgb2uint24.js +19 -0
  277. package/src/core/color/rgb_to_YCbCr_uint24.js +16 -0
  278. package/src/core/color/rgb_to_kelvin.js +34 -0
  279. package/src/core/color/rgb_to_kelvin.spec.js +15 -0
  280. package/src/core/color/sRGB_to_linear.js +21 -0
  281. package/src/core/events/signal/Signal.d.ts +52 -0
  282. package/src/core/events/signal/Signal.js +753 -0
  283. package/src/core/events/signal/Signal.spec.js +165 -0
  284. package/src/core/events/signal/SignalBinding.js +76 -0
  285. package/src/core/events/signal/SignalBinding.spec.js +58 -0
  286. package/src/core/events/signal/SignalFlags.js +4 -0
  287. package/src/core/events/signal/SignalHandler.js +81 -0
  288. package/src/core/events/signal/SignalUtils.js +22 -0
  289. package/src/core/events/signal/signalAggregateByTimeWindow.js +41 -0
  290. package/src/core/font/FontAsset.js +21 -0
  291. package/src/core/font/FontAssetLoader.js +20 -0
  292. package/src/core/fsm/StateMachine.js +440 -0
  293. package/src/core/fsm/Transition.js +65 -0
  294. package/src/core/fsm/exceptions/IllegalStateException.js +11 -0
  295. package/src/core/fsm/simple/SimpleStateMachine.d.ts +27 -0
  296. package/src/core/fsm/simple/SimpleStateMachine.js +235 -0
  297. package/src/core/fsm/simple/SimpleStateMachineDescription.d.ts +21 -0
  298. package/src/core/fsm/simple/SimpleStateMachineDescription.js +208 -0
  299. package/src/core/fsm/simple/SimpleStateMachineDescription.spec.js +71 -0
  300. package/src/core/function/FunctionCompiler.js +161 -0
  301. package/src/core/function/Functions.js +122 -0
  302. package/src/core/function/extractFunctionBody.js +13 -0
  303. package/src/core/geom/2d/AABB2Math.js +40 -0
  304. package/src/core/geom/2d/AABB2Math.spec.js +17 -0
  305. package/src/core/geom/2d/Geometry2D.js +59 -0
  306. package/src/core/geom/2d/UvUtils.js +49 -0
  307. package/src/core/geom/2d/UvUtils.spec.js +55 -0
  308. package/src/core/geom/2d/bvh/BinaryNode2.js +152 -0
  309. package/src/core/geom/2d/bvh/LeafNode2.js +11 -0
  310. package/src/core/geom/2d/bvh/Node2.js +51 -0
  311. package/src/core/geom/2d/circle/Circle.js +105 -0
  312. package/src/core/geom/2d/circle/circleIntersectsCircle.js +19 -0
  313. package/src/core/geom/2d/circle/circleIntersectsPoint.js +16 -0
  314. package/src/core/geom/2d/circle/computeCircleCirclePenetrationDistance.js +30 -0
  315. package/src/core/geom/2d/compute_polygon_area_2d.js +32 -0
  316. package/src/core/geom/2d/compute_polygon_area_2d.spec.js +10 -0
  317. package/src/core/geom/2d/compute_triangle_area_2d.js +15 -0
  318. package/src/core/geom/2d/compute_triangle_area_2d.spec.js +9 -0
  319. package/src/core/geom/2d/convex-hull/convex_hull_jarvis_2d.js +64 -0
  320. package/src/core/geom/2d/convex-hull/convex_hull_jarvis_2d.spec.js +33 -0
  321. package/src/core/geom/2d/convex-hull/convex_hull_monotone_2d.js +82 -0
  322. package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +135 -0
  323. package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +282 -0
  324. package/src/core/geom/2d/convex-hull/orientation3.js +444 -0
  325. package/src/core/geom/2d/convex-hull/orientation3_array.js +22 -0
  326. package/src/core/geom/2d/convex-hull/orientation3_v2.js +12 -0
  327. package/src/core/geom/2d/intersect_ray_2d.js +56 -0
  328. package/src/core/geom/2d/quad-tree/PointQuadTree.js +465 -0
  329. package/src/core/geom/2d/quad-tree/QuadTreeDatum.js +114 -0
  330. package/src/core/geom/2d/quad-tree/QuadTreeNode.js +578 -0
  331. package/src/core/geom/2d/quad-tree/QuadTreeNode.spec.js +182 -0
  332. package/src/core/geom/2d/quad-tree/qt_collect_by_circle.js +67 -0
  333. package/src/core/geom/2d/quad-tree/qt_match_data_by_circle.js +70 -0
  334. package/src/core/geom/2d/shape/AbstractShape.js +45 -0
  335. package/src/core/geom/2d/shape/CircleShape.js +67 -0
  336. package/src/core/geom/2d/shape/PointShape.js +34 -0
  337. package/src/core/geom/2d/shape/Shape2DType.js +9 -0
  338. package/src/core/geom/3d/CircleMath.js +24 -0
  339. package/src/core/geom/3d/SurfacePoint3.d.ts +16 -0
  340. package/src/core/geom/3d/SurfacePoint3.js +98 -0
  341. package/src/core/geom/3d/aabb/aabb3_build_corners.d.ts +1 -0
  342. package/src/core/geom/3d/aabb/aabb3_build_corners.js +44 -0
  343. package/src/core/geom/3d/aabb/aabb3_build_corners.spec.js +27 -0
  344. package/src/core/geom/3d/aabb/aabb3_build_frustum.js +48 -0
  345. package/src/core/geom/3d/aabb/aabb3_computeDistanceAbovePlane_max.spec.js +8 -0
  346. package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_max.js +28 -0
  347. package/src/core/geom/3d/aabb/aabb3_compute_projected_area.js +86 -0
  348. package/src/core/geom/3d/aabb/aabb3_estimate_projected_area2.js +59 -0
  349. package/src/core/geom/3d/aabb/aabb3_from_min_max.js +15 -0
  350. package/src/core/geom/3d/aabb/aabb3_matrix4_project.js +37 -0
  351. package/src/core/geom/3d/aabb/aabb3_matrix4_project.spec.js +54 -0
  352. package/src/core/geom/3d/aabb/aabb3_matrix4_project_by_corners.js +96 -0
  353. package/src/core/geom/3d/aabb/computeAABB3PlaneSide.js +82 -0
  354. package/src/core/geom/3d/aabb/computeBoundingBoxFromVertexData.js +20 -0
  355. package/src/core/geom/3d/aabb/compute_aabb_from_points.js +29 -0
  356. package/src/core/geom/3d/apply_mat4_transform_to_v3_array.js +51 -0
  357. package/src/core/geom/3d/compose_matrix4_array.js +53 -0
  358. package/src/core/geom/3d/compute_bounding_sphere_of_2_spheres.js +74 -0
  359. package/src/core/geom/3d/compute_triangle_normal.js +76 -0
  360. package/src/core/geom/3d/cone/computeConeBoundingBox.js +54 -0
  361. package/src/core/geom/3d/cone/computeConePlaneSide.js +86 -0
  362. package/src/core/geom/3d/cone/computeConePlaneSide.spec.js +13 -0
  363. package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.js +92 -0
  364. package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.spec.js +95 -0
  365. package/src/core/geom/3d/decompose_matrix_4_array.js +67 -0
  366. package/src/core/geom/3d/eulerAnglesFromMatrix.js +115 -0
  367. package/src/core/geom/3d/frustum/array_normalize_plane.js +25 -0
  368. package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +112 -0
  369. package/src/core/geom/3d/frustum/frustum_from_projection_matrix_array.js +65 -0
  370. package/src/core/geom/3d/frustum/read_cluster_frustum_corners.js +46 -0
  371. package/src/core/geom/3d/frustum/read_frustum_planes_to_array.d.ts +3 -0
  372. package/src/core/geom/3d/frustum/read_frustum_planes_to_array.js +24 -0
  373. package/src/core/geom/3d/frustum/slice_frustum_linear_to_points.js +92 -0
  374. package/src/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js +41 -0
  375. package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.js +36 -0
  376. package/src/core/geom/3d/matrix/MATRIX_4_IDENTITY.js +9 -0
  377. package/src/core/geom/3d/matrix/m4_multiply_alphatensor.js +131 -0
  378. package/src/core/geom/3d/morton/Morton.js +6 -0
  379. package/src/core/geom/3d/morton/mortonEncode_LUT.js +143 -0
  380. package/src/core/geom/3d/morton/mortonEncode_magicbits.js +53 -0
  381. package/src/core/geom/3d/morton/reinterpret_float32_as_int32.js +13 -0
  382. package/src/core/geom/3d/morton/v3_morton_encode_transformed.js +37 -0
  383. package/src/core/geom/3d/morton/v3_morton_encode_transformed.spec.js +20 -0
  384. package/src/core/geom/3d/normal/hemioct/encode_unit3_hemioct.js +55 -0
  385. package/src/core/geom/3d/normal/hemioct/unit_hemioct.spec.js +40 -0
  386. package/src/core/geom/3d/normal/lamber_azimuth/transform.js +61 -0
  387. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +31 -0
  388. package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js +33 -0
  389. package/src/core/geom/3d/normal/octahedron/encoding.spec.js +29 -0
  390. package/src/core/geom/3d/normal/spherical/sphere_map_transform.js +77 -0
  391. package/src/core/geom/3d/plane/is_point_within_planes.js +46 -0
  392. package/src/core/geom/3d/plane/lerp_planes_to_array.js +51 -0
  393. package/src/core/geom/3d/plane/orient3d_fast.js +48 -0
  394. package/src/core/geom/3d/plane/orient3d_robust.js +41 -0
  395. package/src/core/geom/3d/plane/plane3_intersect_plane.js +62 -0
  396. package/src/core/geom/3d/plane/plane3_lerp.js +62 -0
  397. package/src/core/geom/3d/plane/plane3_lerp_v0.js +46 -0
  398. package/src/core/geom/3d/plane/plane3_projectPoint.js +24 -0
  399. package/src/core/geom/3d/plane/plane3_projectPoint.spec.js +54 -0
  400. package/src/core/geom/3d/plane/plane3_slerp.js +102 -0
  401. package/src/core/geom/3d/plane/plane3_slerp.spec.js +209 -0
  402. package/src/core/geom/3d/plane/plane_computeConvex3PlaneIntersection.js +72 -0
  403. package/src/core/geom/3d/plane/plane_three_compute_convex3_plane_intersection.js +24 -0
  404. package/src/core/geom/3d/ray/ray3_array_apply_matrix4.js +56 -0
  405. package/src/core/geom/3d/ray/ray3_array_compose.js +19 -0
  406. package/src/core/geom/3d/ray/ray3_array_compose.spec.js +14 -0
  407. package/src/core/geom/3d/ray/ray_computeNearestPointToPoint.js +37 -0
  408. package/src/core/geom/3d/ray/ray_distance_to_point.js +14 -0
  409. package/src/core/geom/3d/shape/AbstractShape3D.d.ts +3 -0
  410. package/src/core/geom/3d/shape/AbstractShape3D.js +91 -0
  411. package/src/core/geom/3d/shape/TransformedShape3D.d.ts +10 -0
  412. package/src/core/geom/3d/shape/TransformedShape3D.js +214 -0
  413. package/src/core/geom/3d/shape/TransformedShape3D.spec.js +55 -0
  414. package/src/core/geom/3d/shape/UnionShape3D.d.ts +5 -0
  415. package/src/core/geom/3d/shape/UnionShape3D.js +319 -0
  416. package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts +5 -0
  417. package/src/core/geom/3d/shape/UnitCubeShape3D.js +87 -0
  418. package/src/core/geom/3d/shape/UnitCubeShape3D.spec.js +42 -0
  419. package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts +5 -0
  420. package/src/core/geom/3d/shape/UnitSphereShape3D.js +71 -0
  421. package/src/core/geom/3d/shape/json/shape_from_json.js +19 -0
  422. package/src/core/geom/3d/shape/json/shape_to_json.js +21 -0
  423. package/src/core/geom/3d/shape/json/shape_to_type.js +23 -0
  424. package/src/core/geom/3d/shape/json/type_adapters.js +58 -0
  425. package/src/core/geom/3d/shape/util/compute_signed_distance_gradient_by_sampling.js +48 -0
  426. package/src/core/geom/3d/shape/util/shape_to_visual_entity.js +159 -0
  427. package/src/core/geom/3d/sphere/harmonics/README.md +15 -0
  428. package/src/core/geom/3d/sphere/harmonics/sh3_add.js +21 -0
  429. package/src/core/geom/3d/sphere/harmonics/sh3_basis_at.js +30 -0
  430. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +624 -0
  431. package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.js +50 -0
  432. package/src/core/geom/3d/sphere/harmonics/sh3_sample_irradiance_by_direction.js +53 -0
  433. package/src/core/geom/3d/sphere/sphereIntersectsPoint.js +26 -0
  434. package/src/core/geom/3d/sphere/sphere_array_intersects_point.js +15 -0
  435. package/src/core/geom/3d/sphere/sphere_array_intersects_ray.js +25 -0
  436. package/src/core/geom/3d/sphere/sphere_intersects_ray.js +51 -0
  437. package/src/core/geom/3d/sphere/sphere_radius_sqr_from_v3_array_transformed.js +28 -0
  438. package/src/core/geom/3d/tetrahedra/GetDepthForTetrahedronProbe.glsl +43 -0
  439. package/src/core/geom/3d/tetrahedra/README.md +16 -0
  440. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +650 -0
  441. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.spec.js +233 -0
  442. package/src/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.js +75 -0
  443. package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.js +179 -0
  444. package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.spec.js +66 -0
  445. package/src/core/geom/3d/tetrahedra/compute_circumsphere.js +271 -0
  446. package/src/core/geom/3d/tetrahedra/delaunay/Cavity.js +90 -0
  447. package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js +92 -0
  448. package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.spec.js +14 -0
  449. package/src/core/geom/3d/tetrahedra/delaunay/debug_validate_mesh.js +19 -0
  450. package/src/core/geom/3d/tetrahedra/delaunay/fill_in_a_cavity.js +191 -0
  451. package/src/core/geom/3d/tetrahedra/delaunay/push_boundary_with_validation.js +27 -0
  452. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_cavity.js +89 -0
  453. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_sub_determinant.js +77 -0
  454. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_sub_determinant.spec.js +30 -0
  455. package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_towards_containing_tetrahedron.js +58 -0
  456. package/src/core/geom/3d/tetrahedra/delaunay/validate_cavity_boundary.js +60 -0
  457. package/src/core/geom/3d/tetrahedra/in_sphere_fast.js +90 -0
  458. package/src/core/geom/3d/tetrahedra/in_sphere_robust.js +53 -0
  459. package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +107 -0
  460. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.js +83 -0
  461. package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.spec.js +24 -0
  462. package/src/core/geom/3d/tetrahedra/tetrahedron_contains_point.js +26 -0
  463. package/src/core/geom/3d/tetrahedra/tetrahedron_contains_point.spec.js +66 -0
  464. package/src/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.js +166 -0
  465. package/src/core/geom/3d/topology/bounds/computeTopoMeshBoundingSphere.js +37 -0
  466. package/src/core/geom/3d/topology/bounds/computeTopoMeshBoundiningBox.js +16 -0
  467. package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +87 -0
  468. package/src/core/geom/3d/topology/compareEdges.js +16 -0
  469. package/src/core/geom/3d/topology/compareFaces.js +9 -0
  470. package/src/core/geom/3d/topology/compareVertices.js +9 -0
  471. package/src/core/geom/3d/topology/computeTopoMeshVertexDuplicates.js +103 -0
  472. package/src/core/geom/3d/topology/debugValidateMesh.js +13 -0
  473. package/src/core/geom/3d/topology/expandConnectivityByLocality.js +103 -0
  474. package/src/core/geom/3d/topology/isEdgeConnectedToOutline.js +12 -0
  475. package/src/core/geom/3d/topology/isVertexConnectedToOutline.js +19 -0
  476. package/src/core/geom/3d/topology/query/query_edge_is_boundary.js +7 -0
  477. package/src/core/geom/3d/topology/query/query_edge_is_manifold.js +13 -0
  478. package/src/core/geom/3d/topology/query/query_edge_is_manifold_or_boundary.js +11 -0
  479. package/src/core/geom/3d/topology/query/query_edge_is_wire.js +13 -0
  480. package/src/core/geom/3d/topology/query/query_edge_other_vertex.js +20 -0
  481. package/src/core/geom/3d/topology/query/query_edge_share_vert.js +9 -0
  482. package/src/core/geom/3d/topology/query/query_face_get_other_edges.js +39 -0
  483. package/src/core/geom/3d/topology/query/query_face_next_vertex.js +19 -0
  484. package/src/core/geom/3d/topology/query/query_face_prev_vertex.js +18 -0
  485. package/src/core/geom/3d/topology/query/query_vertex_in_edge.js +14 -0
  486. package/src/core/geom/3d/topology/query/query_vertex_pair_share_face.js +24 -0
  487. package/src/core/geom/3d/topology/query/query_vertices_in_edge.js +19 -0
  488. package/src/core/geom/3d/topology/samples/sampleFloodFill.js +275 -0
  489. package/src/core/geom/3d/topology/simplify/EdgeCollapseCandidate.js +177 -0
  490. package/src/core/geom/3d/topology/simplify/build_edge_collapse_candidates.js +39 -0
  491. package/src/core/geom/3d/topology/simplify/collapseEdge.js +182 -0
  492. package/src/core/geom/3d/topology/simplify/collapseEdge.spec.js +24 -0
  493. package/src/core/geom/3d/topology/simplify/collapse_all_degenerate_edges.js +38 -0
  494. package/src/core/geom/3d/topology/simplify/collapse_degenerate_edge.js +10 -0
  495. package/src/core/geom/3d/topology/simplify/computeEdgeCollapseCost.js +82 -0
  496. package/src/core/geom/3d/topology/simplify/compute_face_normal_change_dot_product.js +81 -0
  497. package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +277 -0
  498. package/src/core/geom/3d/topology/simplify/edge_collapse_quadratic.js +126 -0
  499. package/src/core/geom/3d/topology/simplify/prototypeMeshSimplification.js +501 -0
  500. package/src/core/geom/3d/topology/simplify/quadratic/Quadratic3.js +302 -0
  501. package/src/core/geom/3d/topology/simplify/quadratic/build_vertex_quadratics.js +151 -0
  502. package/src/core/geom/3d/topology/simplify/quadratic/compute_edge_collapse_cost_quadratic.js +28 -0
  503. package/src/core/geom/3d/topology/simplify/simplifyTopoMesh.js +262 -0
  504. package/src/core/geom/3d/topology/simplify/simplifyTopoMesh2.js +119 -0
  505. package/src/core/geom/3d/topology/simplify/tm_edge_collapse_is_degenerate_flip.js +81 -0
  506. package/src/core/geom/3d/topology/struct/TopoEdge.js +346 -0
  507. package/src/core/geom/3d/topology/struct/TopoEdge.spec.js +52 -0
  508. package/src/core/geom/3d/topology/struct/TopoMesh.js +649 -0
  509. package/src/core/geom/3d/topology/struct/TopoTriangle.js +292 -0
  510. package/src/core/geom/3d/topology/struct/TopoVertex.js +328 -0
  511. package/src/core/geom/3d/topology/struct/TopoVertex.spec.js +128 -0
  512. package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.js +288 -0
  513. package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.spec.js +36 -0
  514. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.js +617 -0
  515. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.spec.js +16 -0
  516. package/src/core/geom/3d/topology/struct/binary/io/OrderedEdge.js +66 -0
  517. package/src/core/geom/3d/topology/struct/binary/io/bt_index_geometry_to_topology.js +188 -0
  518. package/src/core/geom/3d/topology/struct/binary/io/bt_index_geometry_to_topology.spec.js +84 -0
  519. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_calc_edges.js +51 -0
  520. package/src/core/geom/3d/topology/struct/binary/io/create_edge.js +106 -0
  521. package/src/core/geom/3d/topology/struct/binary/io/get_or_create_edge_map.js +26 -0
  522. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_has_vertex.js +16 -0
  523. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_has_vertex.spec.js +15 -0
  524. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_other_vertex.js +21 -0
  525. package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_other_vertex.spec.js +16 -0
  526. package/src/core/geom/3d/topology/struct/prototypeBinaryTopology.js +55 -0
  527. package/src/core/geom/3d/topology/three_buffer_geometry_to_topo_mesh.js +30 -0
  528. package/src/core/geom/3d/topology/tm_edge_kill.js +24 -0
  529. package/src/core/geom/3d/topology/tm_edge_splice.js +42 -0
  530. package/src/core/geom/3d/topology/tm_face_area.js +18 -0
  531. package/src/core/geom/3d/topology/tm_face_kill.js +12 -0
  532. package/src/core/geom/3d/topology/tm_face_normal.js +14 -0
  533. package/src/core/geom/3d/topology/tm_kill_only_edge.js +35 -0
  534. package/src/core/geom/3d/topology/tm_kill_only_face.js +12 -0
  535. package/src/core/geom/3d/topology/tm_kill_only_vert.js +14 -0
  536. package/src/core/geom/3d/topology/tm_vert_kill.js +19 -0
  537. package/src/core/geom/3d/topology/tm_vert_splice.js +64 -0
  538. package/src/core/geom/3d/topology/tm_vertex_compute_normal.js +42 -0
  539. package/src/core/geom/3d/topology/topo_mesh_to_three_buffer_geometry.js +64 -0
  540. package/src/core/geom/3d/topology/topology_find_broken_links.js +107 -0
  541. package/src/core/geom/3d/topology/update_topo_face_normals.js +23 -0
  542. package/src/core/geom/3d/topology/util/mesh_flood_fill.js +61 -0
  543. package/src/core/geom/3d/topology/weld_duplicate_vertices.js +63 -0
  544. package/src/core/geom/3d/triangle/computeTrianglePlaneSide.js +44 -0
  545. package/src/core/geom/3d/triangle/computeTriangleRayIntersection.js +327 -0
  546. package/src/core/geom/3d/util/make_justified_point_grid.js +31 -0
  547. package/src/core/geom/3d/voxel/DenseBitVolume3D.js +87 -0
  548. package/src/core/geom/3d/voxel/buildVolumeFromProjectedGeometry.js +23 -0
  549. package/src/core/geom/AABB2.d.ts +28 -0
  550. package/src/core/geom/AABB2.js +656 -0
  551. package/src/core/geom/AABB2.spec.js +53 -0
  552. package/src/core/geom/Bezier.js +24 -0
  553. package/src/core/geom/Bezier.spec.js +16 -0
  554. package/src/core/geom/ConicRay.js +200 -0
  555. package/src/core/geom/GeometryMath.js +33 -0
  556. package/src/core/geom/LineSegment.js +207 -0
  557. package/src/core/geom/LineSegment2.js +175 -0
  558. package/src/core/geom/Matrix3.js +16 -0
  559. package/src/core/geom/Matrix4.js +270 -0
  560. package/src/core/geom/Plane.js +250 -0
  561. package/src/core/geom/Quaternion.d.ts +74 -0
  562. package/src/core/geom/Quaternion.js +1857 -0
  563. package/src/core/geom/Quaternion.spec.js +262 -0
  564. package/src/core/geom/Rectangle.js +219 -0
  565. package/src/core/geom/Rectangle.spec.js +11 -0
  566. package/src/core/geom/Vector1.d.ts +35 -0
  567. package/src/core/geom/Vector1.js +306 -0
  568. package/src/core/geom/Vector1.spec.js +74 -0
  569. package/src/core/geom/Vector2.d.ts +47 -0
  570. package/src/core/geom/Vector2.js +764 -0
  571. package/src/core/geom/Vector2.spec.js +142 -0
  572. package/src/core/geom/Vector3.d.ts +114 -0
  573. package/src/core/geom/Vector3.js +1133 -0
  574. package/src/core/geom/Vector3.schema.json +16 -0
  575. package/src/core/geom/Vector3.spec.js +37 -0
  576. package/src/core/geom/Vector4.d.ts +40 -0
  577. package/src/core/geom/Vector4.js +471 -0
  578. package/src/core/geom/Vector4.spec.js +11 -0
  579. package/src/core/geom/normalize_angle_rad.js +18 -0
  580. package/src/core/geom/normalize_angle_rad.spec.js +45 -0
  581. package/src/core/geom/packing/computeBoundingSphereOfSpheres.d.ts +1 -0
  582. package/src/core/geom/packing/computeBoundingSphereOfSpheres.js +85 -0
  583. package/src/core/geom/packing/computeBoundingSphereOfSpheres.spec.js +24 -0
  584. package/src/core/geom/packing/max-rect/MaxRectangles.js +468 -0
  585. package/src/core/geom/packing/max-rect/removeRedundantBoxes.js +69 -0
  586. package/src/core/geom/packing/max-rect/removeRedundantBoxesArray.js +40 -0
  587. package/src/core/geom/packing/miniball/Miniball.js +465 -0
  588. package/src/core/geom/packing/miniball/PointSet.js +40 -0
  589. package/src/core/geom/packing/miniball/Quality.js +116 -0
  590. package/src/core/geom/packing/miniball/Subspan.js +581 -0
  591. package/src/core/geom/packing/miniball/Subspan.spec.js +51 -0
  592. package/src/core/geom/random/randomPointInBox.js +16 -0
  593. package/src/core/geom/random/randomPointInCircle.js +18 -0
  594. package/src/core/geom/random/randomPointInPoint.js +11 -0
  595. package/src/core/geom/random/randomPointInSphere.js +35 -0
  596. package/src/core/geom/random/randomPointOnBox.js +37 -0
  597. package/src/core/geom/random/randomPointOnSphere.js +30 -0
  598. package/src/core/geom/v3_angle_between.js +69 -0
  599. package/src/core/geom/v3_distance.js +16 -0
  600. package/src/core/geom/v3_distance_above_plane.js +20 -0
  601. package/src/core/geom/v3_distance_above_plane.spec.js +40 -0
  602. package/src/core/geom/v3_distance_sqr.d.ts +1 -0
  603. package/src/core/geom/v3_distance_sqr.js +17 -0
  604. package/src/core/geom/v3_dot.js +13 -0
  605. package/src/core/geom/v3_length.js +10 -0
  606. package/src/core/geom/v3_length_sqr.js +10 -0
  607. package/src/core/geom/v3_lerp.js +26 -0
  608. package/src/core/geom/v3_slerp.js +48 -0
  609. package/src/core/graph/Edge.js +115 -0
  610. package/src/core/graph/Edge.spec.js +50 -0
  611. package/src/core/graph/EdgeDirection.js +11 -0
  612. package/src/core/graph/Graph.js +564 -0
  613. package/src/core/graph/GraphElement.js +6 -0
  614. package/src/core/graph/GraphUtils.js +282 -0
  615. package/src/core/graph/MultiNode.js +39 -0
  616. package/src/core/graph/Node.js +12 -0
  617. package/src/core/graph/SquareMatrix.js +204 -0
  618. package/src/core/graph/SquareMatrix.spec.js +52 -0
  619. package/src/core/graph/WeightedEdge.js +31 -0
  620. package/src/core/graph/build_face_graph_from_mesh.js +115 -0
  621. package/src/core/graph/cluster_mesh_metis.js +213 -0
  622. package/src/core/graph/coarsen_graph.js +33 -0
  623. package/src/core/graph/coarsen_graph.spec.js +43 -0
  624. package/src/core/graph/coloring/colorizeGraph.js +257 -0
  625. package/src/core/graph/coloring/colorizeGraphGreedy.js +63 -0
  626. package/src/core/graph/coloring/colorizeGraphGreedy.spec.js +26 -0
  627. package/src/core/graph/coloring/colorizeGraphGreedyWeight.js +28 -0
  628. package/src/core/graph/coloring/colorizeGraphMCS.js +82 -0
  629. package/src/core/graph/coloring/validateGraphColoring.js +45 -0
  630. package/src/core/graph/convertGraphToDotString.js +68 -0
  631. package/src/core/graph/eigen/eigen.js +229 -0
  632. package/src/core/graph/eigen/eigen.spec.js +27 -0
  633. package/src/core/graph/eigen/eigen_values_find_spectral_gap.js +25 -0
  634. package/src/core/graph/graph_adjacency_matrix.js +21 -0
  635. package/src/core/graph/graph_compute_disconnected_clusters.js +59 -0
  636. package/src/core/graph/graph_degree_matrix.js +18 -0
  637. package/src/core/graph/graph_k_means_cluster.js +238 -0
  638. package/src/core/graph/graph_laplacian_matrix.js +22 -0
  639. package/src/core/graph/layout/BoxLayouter.js +584 -0
  640. package/src/core/graph/layout/CircleLayout.js +926 -0
  641. package/src/core/graph/layout/Connection.js +36 -0
  642. package/src/core/graph/layout/box/forceIntoBox.js +45 -0
  643. package/src/core/graph/layout/box/pullBoxTowardsPoint.js +20 -0
  644. package/src/core/graph/layout/box/resolveAABB2Overlap.js +22 -0
  645. package/src/core/graph/layout/box/resolveBoxOverlapUsingForce.js +99 -0
  646. package/src/core/graph/layout/computeDisconnectedSubGraphs.js +57 -0
  647. package/src/core/graph/metis/metis.js +35 -0
  648. package/src/core/graph/metis/metis_options.js +33 -0
  649. package/src/core/graph/mn_graph_collapse_weighted_edge.js +75 -0
  650. package/src/core/graph/v2/Graph.js +480 -0
  651. package/src/core/graph/v2/Graph.spec.js +56 -0
  652. package/src/core/graph/v2/NodeContainer.js +155 -0
  653. package/src/core/json/JsonUtils.js +101 -0
  654. package/src/core/json/objectHasProperty.js +13 -0
  655. package/src/core/json/resolvePath.js +16 -0
  656. package/src/core/json/resolvePathByArray.d.ts +1 -0
  657. package/src/core/json/resolvePathByArray.js +53 -0
  658. package/src/core/land/reactive/AbstractCachingParser.js +71 -0
  659. package/src/core/land/reactive/ReactiveLexer.js +158 -0
  660. package/src/core/land/reactive/ReactiveLexer.ts +181 -0
  661. package/src/core/land/reactive/ReactiveListener.ts +323 -0
  662. package/src/core/land/reactive/ReactiveOperatorType.js +12 -0
  663. package/src/core/land/reactive/ReactiveParser.js +1573 -0
  664. package/src/core/land/reactive/ReactiveParser.ts +1776 -0
  665. package/src/core/land/reactive/ReactiveVisitor.js +1 -0
  666. package/src/core/land/reactive/ReactiveVisitor.ts +218 -0
  667. package/src/core/land/reactive/compileReactiveExpression.js +18 -0
  668. package/src/core/land/reactive/compiler/ReactiveCompiler.js +350 -0
  669. package/src/core/land/reactive/compiler/ReactiveCompiler.spec.js +169 -0
  670. package/src/core/land/reactive/compiler/ReactiveNearlyCompiler.js +166 -0
  671. package/src/core/land/reactive/compiler/ReactiveParser.js +34 -0
  672. package/src/core/land/reactive/nearley/Reactive.ne +87 -0
  673. package/src/core/land/reactive/nearley/ReactiveNearley.js +187 -0
  674. package/src/core/land/reactive/pegjs/Reactive.peg +377 -0
  675. package/src/core/land/reactive/pegjs/ReactivePegCompiler.js +131 -0
  676. package/src/core/land/reactive/pegjs/ReactivePegParser.js +15 -0
  677. package/src/core/land/reactive/pegjs/parser.js +3458 -0
  678. package/src/core/land/reactive/validateReactiveExpression.js +11 -0
  679. package/src/core/localization/LanguageMetadata.js +48 -0
  680. package/src/core/localization/LocaleDataset.js +37 -0
  681. package/src/core/localization/Localization.js +253 -0
  682. package/src/core/math/DEG_TO_RAD.js +1 -0
  683. package/src/core/math/EPSILON.js +5 -0
  684. package/src/core/math/FLT_EPSILON_32.js +7 -0
  685. package/src/core/math/GOLDEN_RATIO.js +5 -0
  686. package/src/core/math/PI2.js +5 -0
  687. package/src/core/math/PI_HALF.js +5 -0
  688. package/src/core/math/RAD_TO_DEG.js +1 -0
  689. package/src/core/math/bell_membership_function.js +19 -0
  690. package/src/core/math/bessel_3.js +11 -0
  691. package/src/core/math/bessel_i0.js +26 -0
  692. package/src/core/math/bezierCurve.js +22 -0
  693. package/src/core/math/clamp.js +16 -0
  694. package/src/core/math/clamp.spec.js +15 -0
  695. package/src/core/math/clamp01.js +15 -0
  696. package/src/core/math/computeGreatestCommonDivisor.js +28 -0
  697. package/src/core/math/computeIsoscelesTriangleApexAngle.js +17 -0
  698. package/src/core/math/computeWholeDivisorLow.js +30 -0
  699. package/src/core/math/computeWholeDivisorLow.spec.js +9 -0
  700. package/src/core/math/copysign.js +16 -0
  701. package/src/core/math/copysign.spec.js +13 -0
  702. package/src/core/math/cubicCurve.js +34 -0
  703. package/src/core/math/cubicCurve.spec.js +13 -0
  704. package/src/core/math/epsilonEquals.d.ts +1 -0
  705. package/src/core/math/epsilonEquals.js +16 -0
  706. package/src/core/math/exp2.js +8 -0
  707. package/src/core/math/fabsf.js +8 -0
  708. package/src/core/math/fract.js +10 -0
  709. package/src/core/math/gaussian.js +9 -0
  710. package/src/core/math/hash/computeHashFloatArray.js +23 -0
  711. package/src/core/math/hash/computeHashFloatArray.spec.js +11 -0
  712. package/src/core/math/hash/computeObjectHash.js +54 -0
  713. package/src/core/math/hash/computeObjectHash.spec.js +42 -0
  714. package/src/core/math/hash/murmur3_32.js +39 -0
  715. package/src/core/math/hash/squirrel3.js +21 -0
  716. package/src/core/math/intersects1D.js +19 -0
  717. package/src/core/math/interval/NumericInterval.js +214 -0
  718. package/src/core/math/interval/NumericInterval.spec.js +80 -0
  719. package/src/core/math/inverseLerp.js +20 -0
  720. package/src/core/math/inverseLerp.spec.js +13 -0
  721. package/src/core/math/isPowerOrTwo.js +11 -0
  722. package/src/core/math/isValueBetween.js +10 -0
  723. package/src/core/math/isValueBetween.spec.js +11 -0
  724. package/src/core/math/isValueBetweenInclusive.js +10 -0
  725. package/src/core/math/isValueBetweenInclusive.spec.js +16 -0
  726. package/src/core/math/isqrt.js +28 -0
  727. package/src/core/math/isqrt.spec.js +9 -0
  728. package/src/core/math/lerp.js +10 -0
  729. package/src/core/math/lerp.spec.js +15 -0
  730. package/src/core/math/makeCubicCurve.js +15 -0
  731. package/src/core/math/makeCubicCurve.spec.js +9 -0
  732. package/src/core/math/makeSequenceLoop.js +20 -0
  733. package/src/core/math/max.spec.js +25 -0
  734. package/src/core/math/max2.js +10 -0
  735. package/src/core/math/max2.spec.js +13 -0
  736. package/src/core/math/max3.js +18 -0
  737. package/src/core/math/max3.spec.js +27 -0
  738. package/src/core/math/min2.js +9 -0
  739. package/src/core/math/min2.spec.js +37 -0
  740. package/src/core/math/min3.js +18 -0
  741. package/src/core/math/min3.spec.js +27 -0
  742. package/src/core/math/mix.js +10 -0
  743. package/src/core/math/newton_solver_1d.js +21 -0
  744. package/src/core/math/noise/curl_noise_3d.js +27 -0
  745. package/src/core/math/noise/curl_noise_3dt.js +28 -0
  746. package/src/core/math/noise/sdnoise.js +952 -0
  747. package/src/core/math/normalizeArrayVector.js +25 -0
  748. package/src/core/math/overlap1D.js +19 -0
  749. package/src/core/math/overlap1D.spec.js +10 -0
  750. package/src/core/math/physics/brdf/D_GGX.js +13 -0
  751. package/src/core/math/physics/brdf/brdf_burley.js +25 -0
  752. package/src/core/math/physics/bsdf/bsdf_schlick.js +22 -0
  753. package/src/core/math/physics/irradiance/interpolate_irradiance_linear.js +18 -0
  754. package/src/core/math/physics/irradiance/interpolate_irradiance_lograrithmic.js +28 -0
  755. package/src/core/math/physics/irradiance/interpolate_irradiance_smith.js +38 -0
  756. package/src/core/math/pingpong.js +17 -0
  757. package/src/core/math/quadraticCurve.js +11 -0
  758. package/src/core/math/quadraticCurve.spec.js +13 -0
  759. package/src/core/math/random/MersenneTwister.js +211 -0
  760. package/src/core/math/random/makeRangedRandom.js +19 -0
  761. package/src/core/math/random/randomFloatBetween.js +14 -0
  762. package/src/core/math/random/randomFromArray.js +19 -0
  763. package/src/core/math/random/randomGaussian.js +15 -0
  764. package/src/core/math/random/randomIntegerBetween.js +14 -0
  765. package/src/core/math/random/roundFair.js +15 -0
  766. package/src/core/math/random/seededRandom.js +4 -0
  767. package/src/core/math/random/seededRandomMersenneTwister.js +85 -0
  768. package/src/core/math/random/seededRandom_Mulberry32.js +31 -0
  769. package/src/core/math/random/seededRandom_sine.js +33 -0
  770. package/src/core/math/separation1D.js +21 -0
  771. package/src/core/math/sign.d.ts +1 -0
  772. package/src/core/math/sign.js +8 -0
  773. package/src/core/math/sign.spec.js +13 -0
  774. package/src/core/math/sign_not_zero.js +8 -0
  775. package/src/core/math/smoothStep.js +17 -0
  776. package/src/core/math/solveQuadratic.js +45 -0
  777. package/src/core/math/solveQuadratic.spec.js +18 -0
  778. package/src/core/math/statistics/computeSampleSize_Cochran.js +28 -0
  779. package/src/core/math/statistics/computeSampleStandardDeviation.js +28 -0
  780. package/src/core/math/statistics/computeStatisticalMean.js +24 -0
  781. package/src/core/math/statistics/computeStatisticalMedian.js +10 -0
  782. package/src/core/math/statistics/computeStatisticalPartialMedian.js +20 -0
  783. package/src/core/math/statistics/computeStatisticalPercentile.js +18 -0
  784. package/src/core/math/statistics/halton_sequence.js +26 -0
  785. package/src/core/model/BooleanVector3.d.ts +28 -0
  786. package/src/core/model/BooleanVector3.js +136 -0
  787. package/src/core/model/BooleanVector3.spec.js +51 -0
  788. package/src/core/model/BoundedValue.js +223 -0
  789. package/src/core/model/BoundedValue.spec.js +17 -0
  790. package/src/core/model/DebouncedObservedBoolean.js +117 -0
  791. package/src/core/model/LinearValue.js +130 -0
  792. package/src/core/model/ModuleRegistry.d.ts +3 -0
  793. package/src/core/model/ModuleRegistry.js +86 -0
  794. package/src/core/model/ObservedBoolean.d.ts +11 -0
  795. package/src/core/model/ObservedBoolean.js +151 -0
  796. package/src/core/model/ObservedBoolean.spec.js +81 -0
  797. package/src/core/model/ObservedEnum.d.ts +7 -0
  798. package/src/core/model/ObservedEnum.js +97 -0
  799. package/src/core/model/ObservedInteger.js +204 -0
  800. package/src/core/model/ObservedInteger.spec.js +51 -0
  801. package/src/core/model/ObservedString.d.ts +17 -0
  802. package/src/core/model/ObservedString.js +136 -0
  803. package/src/core/model/ObservedValue.js +103 -0
  804. package/src/core/model/node-graph/Connection.d.ts +12 -0
  805. package/src/core/model/node-graph/Connection.js +141 -0
  806. package/src/core/model/node-graph/Connection.spec.js +21 -0
  807. package/src/core/model/node-graph/DataType.js +75 -0
  808. package/src/core/model/node-graph/DataType.spec.js +28 -0
  809. package/src/core/model/node-graph/NodeGraph.js +397 -0
  810. package/src/core/model/node-graph/NodeGraph.spec.js +68 -0
  811. package/src/core/model/node-graph/deserializeNodeGraphFromJSON.js +62 -0
  812. package/src/core/model/node-graph/node/NodeDescription.d.ts +3 -0
  813. package/src/core/model/node-graph/node/NodeDescription.js +248 -0
  814. package/src/core/model/node-graph/node/NodeDescription.spec.js +14 -0
  815. package/src/core/model/node-graph/node/NodeInstance.d.ts +14 -0
  816. package/src/core/model/node-graph/node/NodeInstance.js +219 -0
  817. package/src/core/model/node-graph/node/NodeInstancePortReference.d.ts +3 -0
  818. package/src/core/model/node-graph/node/NodeInstancePortReference.js +128 -0
  819. package/src/core/model/node-graph/node/NodeRegistry.js +243 -0
  820. package/src/core/model/node-graph/node/NodeRegistry.spec.js +77 -0
  821. package/src/core/model/node-graph/node/Port.js +70 -0
  822. package/src/core/model/node-graph/node/PortDirection.js +9 -0
  823. package/src/core/model/node-graph/node/parameter/NodeParameterDataType.js +9 -0
  824. package/src/core/model/node-graph/node/parameter/NodeParameterDescription.js +61 -0
  825. package/src/core/model/node-graph/serializeNodeGraphToJSON.js +40 -0
  826. package/src/core/model/node-graph/visual/NodeDescriptionVisualRegistry.js +129 -0
  827. package/src/core/model/node-graph/visual/NodeGraphVisualData.js +257 -0
  828. package/src/core/model/node-graph/visual/NodeVisualData.js +70 -0
  829. package/src/core/model/node-graph/visual/PortVisualData.js +47 -0
  830. package/src/core/model/node-graph/visual/PortVisualData.spec.js +16 -0
  831. package/src/core/model/node-graph/visual/layout/BoxLayoutSpec.js +19 -0
  832. package/src/core/model/node-graph/visual/layout/ConnectedBoxLayouter.js +243 -0
  833. package/src/core/model/node-graph/visual/layout/ConnectionEndpointLayoutSpec.js +42 -0
  834. package/src/core/model/node-graph/visual/layout/ConnectionLayoutSpec.js +32 -0
  835. package/src/core/model/object/ImmutableObjectPool.js +147 -0
  836. package/src/core/model/object/ObjectPoolFactory.js +93 -0
  837. package/src/core/model/object/ObjectPoolFactory.spec.js +54 -0
  838. package/src/core/model/object/SimpleObjectPoolFactory.js +42 -0
  839. package/src/core/model/object/compareObjectsByNumericId.js +9 -0
  840. package/src/core/model/object/compareValues.js +67 -0
  841. package/src/core/model/object/invokeObjectClone.js +10 -0
  842. package/src/core/model/object/invokeObjectCompare.js +9 -0
  843. package/src/core/model/object/invokeObjectEquals.d.ts +5 -0
  844. package/src/core/model/object/invokeObjectEquals.js +10 -0
  845. package/src/core/model/object/invokeObjectHash.d.ts +5 -0
  846. package/src/core/model/object/invokeObjectHash.js +8 -0
  847. package/src/core/model/object/objectDeepEquals.d.ts +1 -0
  848. package/src/core/model/object/objectDeepEquals.js +35 -0
  849. package/src/core/model/object/objectDeepEquals.spec.js +14 -0
  850. package/src/core/model/object/objectKeyByValue.d.ts +1 -0
  851. package/src/core/model/object/objectKeyByValue.js +15 -0
  852. package/src/core/model/object/objectShallowCopyByOwnKeys.js +17 -0
  853. package/src/core/model/object/read_property.d.ts +1 -0
  854. package/src/core/model/object/read_property.js +37 -0
  855. package/src/core/model/object/validatedObjectValueByKey.js +21 -0
  856. package/src/core/model/object/write_property.d.ts +1 -0
  857. package/src/core/model/object/write_property.js +52 -0
  858. package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +486 -0
  859. package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.spec.js +117 -0
  860. package/src/core/model/reactive/js/compileReactiveToJS.js +130 -0
  861. package/src/core/model/reactive/model/ReactiveBinaryExpression.js +179 -0
  862. package/src/core/model/reactive/model/ReactiveExpression.d.ts +10 -0
  863. package/src/core/model/reactive/model/ReactiveExpression.js +104 -0
  864. package/src/core/model/reactive/model/ReactiveUnaryExpression.js +92 -0
  865. package/src/core/model/reactive/model/arithmetic/ReactiveAdd.js +68 -0
  866. package/src/core/model/reactive/model/arithmetic/ReactiveDivide.js +64 -0
  867. package/src/core/model/reactive/model/arithmetic/ReactiveMultiply.js +68 -0
  868. package/src/core/model/reactive/model/arithmetic/ReactiveNegate.js +63 -0
  869. package/src/core/model/reactive/model/arithmetic/ReactiveSubtract.js +67 -0
  870. package/src/core/model/reactive/model/comparative/ReactiveEquals.js +68 -0
  871. package/src/core/model/reactive/model/comparative/ReactiveGreaterThan.js +64 -0
  872. package/src/core/model/reactive/model/comparative/ReactiveGreaterThanOrEqual.js +60 -0
  873. package/src/core/model/reactive/model/comparative/ReactiveLessThan.js +60 -0
  874. package/src/core/model/reactive/model/comparative/ReactiveLessThanOrEqual.js +59 -0
  875. package/src/core/model/reactive/model/comparative/ReactiveNotEquals.js +68 -0
  876. package/src/core/model/reactive/model/logic/ReactiveAnd.d.ts +5 -0
  877. package/src/core/model/reactive/model/logic/ReactiveAnd.js +78 -0
  878. package/src/core/model/reactive/model/logic/ReactiveAnd.spec.js +21 -0
  879. package/src/core/model/reactive/model/logic/ReactiveNot.js +49 -0
  880. package/src/core/model/reactive/model/logic/ReactiveOr.js +78 -0
  881. package/src/core/model/reactive/model/terminal/ReactiveLiteralBoolean.js +101 -0
  882. package/src/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +100 -0
  883. package/src/core/model/reactive/model/terminal/ReactiveLiteralString.js +88 -0
  884. package/src/core/model/reactive/model/terminal/ReactiveReference.d.ts +11 -0
  885. package/src/core/model/reactive/model/terminal/ReactiveReference.js +154 -0
  886. package/src/core/model/reactive/model/terminal/ReactiveReference.spec.js +26 -0
  887. package/src/core/model/reactive/model/util/createRandomReactiveExpression.js +173 -0
  888. package/src/core/model/reactive/transform/ReactiveTypeInferrence.js +54 -0
  889. package/src/core/model/reactive/trigger/BlackboardTrigger.js +105 -0
  890. package/src/core/model/reactive/trigger/ReactiveTrigger.js +79 -0
  891. package/src/core/model/reactive/trigger/ReactiveTrigger.spec.js +5 -0
  892. package/src/core/model/scheme/Schema.js +70 -0
  893. package/src/core/model/scheme/SchemeRegistry.js +53 -0
  894. package/src/core/model/stat/LinearModifier.d.ts +24 -0
  895. package/src/core/model/stat/LinearModifier.js +134 -0
  896. package/src/core/model/stat/LinearModifier.spec.js +35 -0
  897. package/src/core/model/stat/Stat.d.ts +29 -0
  898. package/src/core/model/stat/Stat.js +297 -0
  899. package/src/core/model/stat/Stat.spec.js +75 -0
  900. package/src/core/parser/STRING_TEMPLATE_VARIABLE_REGEX.js +1 -0
  901. package/src/core/parser/seedVariablesIntoTemplateString.js +22 -0
  902. package/src/core/parser/simple/DataType.d.ts +5 -0
  903. package/src/core/parser/simple/DataType.js +15 -0
  904. package/src/core/parser/simple/ParserError.js +7 -0
  905. package/src/core/parser/simple/SimpleParser.js +464 -0
  906. package/src/core/parser/simple/SimpleParser.spec.js +105 -0
  907. package/src/core/parser/simple/Token.d.ts +13 -0
  908. package/src/core/parser/simple/Token.js +65 -0
  909. package/src/core/parser/simple/TokenType.js +12 -0
  910. package/src/core/parser/simple/computeDataTypeFromValue.js +25 -0
  911. package/src/core/parser/simple/readUnsignedInteger.js +66 -0
  912. package/src/core/parser/simple/skipWhitespace.js +21 -0
  913. package/src/core/path/PATH_SEPARATOR.js +1 -0
  914. package/src/core/path/computeFileExtension.js +24 -0
  915. package/src/core/path/computeFileExtension.spec.js +13 -0
  916. package/src/core/path/computePathBase.js +21 -0
  917. package/src/core/path/computePathBase.spec.js +13 -0
  918. package/src/core/path/computePathDirectory.js +25 -0
  919. package/src/core/primitives/array/compareArrays.js +30 -0
  920. package/src/core/primitives/array/computeIntegerArrayHash.js +24 -0
  921. package/src/core/primitives/boolean/compareBooleans.js +17 -0
  922. package/src/core/primitives/numbers/compareNumbers.js +9 -0
  923. package/src/core/primitives/numbers/computeHashFloat.js +17 -0
  924. package/src/core/primitives/numbers/computeHashFloat.spec.js +7 -0
  925. package/src/core/primitives/strings/StringUtils.js +105 -0
  926. package/src/core/primitives/strings/StringUtils.spec.js +42 -0
  927. package/src/core/primitives/strings/compareStrings.js +52 -0
  928. package/src/core/primitives/strings/computeStringHash.d.ts +1 -0
  929. package/src/core/primitives/strings/computeStringHash.js +27 -0
  930. package/src/core/primitives/strings/computeStringHash.spec.js +13 -0
  931. package/src/core/primitives/strings/insert_after.js +21 -0
  932. package/src/core/primitives/strings/insert_after_or_replace.js +27 -0
  933. package/src/core/primitives/strings/insert_before.js +19 -0
  934. package/src/core/primitives/strings/insert_before_or_replace.js +27 -0
  935. package/src/core/primitives/strings/prefixTree/PrefixTree.js +225 -0
  936. package/src/core/primitives/strings/prefixTree/PrefixTree.spec.js +39 -0
  937. package/src/core/primitives/strings/prefixTree/PrefixTreeLeaf.js +25 -0
  938. package/src/core/primitives/strings/prefixTree/PrefixTreeNode.js +16 -0
  939. package/src/core/process/BaseProcess.js +63 -0
  940. package/src/core/process/CompositeProcess.js +47 -0
  941. package/src/core/process/Future.js +138 -0
  942. package/src/core/process/IntervalExecutor.js +78 -0
  943. package/src/core/process/ProcessState.js +19 -0
  944. package/src/core/process/PromiseWatcher.js +49 -0
  945. package/src/core/process/PromiseWatcher.spec.js +65 -0
  946. package/src/core/process/SimpleLifecycle.js +88 -0
  947. package/src/core/process/WatchDog.js +96 -0
  948. package/src/core/process/action/AsynchronousAction.js +100 -0
  949. package/src/core/process/action/AsynchronousActionSequence.js +140 -0
  950. package/src/core/process/action/AsynchronousDelayAction.js +52 -0
  951. package/src/core/process/action/PromiseAsynchronousAction.js +48 -0
  952. package/src/core/process/action/SynchronousAction.js +38 -0
  953. package/src/core/process/buildPromiseChain.js +41 -0
  954. package/src/core/process/delay.js +5 -0
  955. package/src/core/process/executor/ConcurrentExecutor.d.ts +16 -0
  956. package/src/core/process/executor/ConcurrentExecutor.js +640 -0
  957. package/src/core/process/executor/ConcurrentExecutor.spec.js +135 -0
  958. package/src/core/process/executor/profile/ConcurrentExecutorProfiler.js +111 -0
  959. package/src/core/process/executor/profile/Profile.js +39 -0
  960. package/src/core/process/executor/profile/TraceEvent.js +85 -0
  961. package/src/core/process/filter/CollectionParticipationKind.js +8 -0
  962. package/src/core/process/filter/MutableFilter.js +22 -0
  963. package/src/core/process/filter/MutableFilterCollection.js +82 -0
  964. package/src/core/process/matcher/Matchers.js +145 -0
  965. package/src/core/process/task/ITask.d.ts +18 -0
  966. package/src/core/process/task/RemainingTimeEstimator.js +49 -0
  967. package/src/core/process/task/Task.d.ts +15 -0
  968. package/src/core/process/task/Task.js +289 -0
  969. package/src/core/process/task/TaskGroup.d.ts +5 -0
  970. package/src/core/process/task/TaskGroup.js +261 -0
  971. package/src/core/process/task/TaskSignal.d.ts +6 -0
  972. package/src/core/process/task/TaskSignal.js +15 -0
  973. package/src/core/process/task/TaskState.js +19 -0
  974. package/src/core/process/task/util/actionTask.js +19 -0
  975. package/src/core/process/task/util/countTask.js +62 -0
  976. package/src/core/process/task/util/delayTask.js +45 -0
  977. package/src/core/process/task/util/emptyTask.js +19 -0
  978. package/src/core/process/task/util/failingTask.js +17 -0
  979. package/src/core/process/task/util/futureTask.js +48 -0
  980. package/src/core/process/task/util/iteratorTask.js +29 -0
  981. package/src/core/process/task/util/promiseTask.js +42 -0
  982. package/src/core/process/task/util/randomCountTask.js +64 -0
  983. package/src/core/process/task/util/wrapTaskIgnoreFailure.js +47 -0
  984. package/src/core/process/undo/Action.d.ts +9 -0
  985. package/src/core/process/undo/Action.js +41 -0
  986. package/src/core/process/undo/ActionGroup.d.ts +5 -0
  987. package/src/core/process/undo/ActionGroup.js +64 -0
  988. package/src/core/process/undo/ActionProcessor.d.ts +27 -0
  989. package/src/core/process/undo/ActionProcessor.js +508 -0
  990. package/src/core/process/undo/ActionProcessor.spec.js +64 -0
  991. package/src/core/process/undo/Mark.js +31 -0
  992. package/src/core/process/worker/OnDemandWorkerManager.js +125 -0
  993. package/src/core/process/worker/WorkerBuilder.js +197 -0
  994. package/src/core/process/worker/WorkerProxy.js +278 -0
  995. package/src/core/process/worker/extractTransferables.js +23 -0
  996. package/src/ecs/grid/pick.js +44 -0
  997. package/src/engine/Clock.js +133 -0
  998. package/src/engine/Engine.d.ts +36 -0
  999. package/src/engine/Engine.js +522 -0
  1000. package/src/engine/EngineBootstrapper.js +61 -0
  1001. package/src/engine/EngineConfiguration.d.ts +20 -0
  1002. package/src/engine/EngineConfiguration.js +169 -0
  1003. package/src/engine/EngineHarness.js +510 -0
  1004. package/src/engine/EntityCreator.js +100 -0
  1005. package/src/engine/InputEngine.js +82 -0
  1006. package/src/engine/MeepSettings.js +9 -0
  1007. package/src/engine/Platform.js +46 -0
  1008. package/src/engine/PointerLock.js +60 -0
  1009. package/src/engine/User.js +28 -0
  1010. package/src/engine/UserController.js +273 -0
  1011. package/src/engine/__module.js +17 -0
  1012. package/src/engine/achievements/Achievement.js +59 -0
  1013. package/src/engine/achievements/AchievementGateway.d.ts +5 -0
  1014. package/src/engine/achievements/AchievementGateway.js +27 -0
  1015. package/src/engine/achievements/AchievementManager.js +435 -0
  1016. package/src/engine/achievements/gateway/StorageAchievementGateway.js +70 -0
  1017. package/src/engine/animation/AnimatedActions.js +86 -0
  1018. package/src/engine/animation/AnimationUtils.js +251 -0
  1019. package/src/engine/animation/Animations.js +134 -0
  1020. package/src/engine/animation/EntityAnimation.js +134 -0
  1021. package/src/engine/animation/TransitionFunctions.js +61 -0
  1022. package/src/engine/animation/Tween.js +66 -0
  1023. package/src/engine/animation/behavior/animateProperty.js +45 -0
  1024. package/src/engine/animation/curve/AnimationCurve.js +111 -0
  1025. package/src/engine/animation/curve/Keyframe.js +46 -0
  1026. package/src/engine/animation/curve/compression/animation_curve_to_float_array.js +35 -0
  1027. package/src/engine/animation/curve/compression/downsample_float_array.js +50 -0
  1028. package/src/engine/animation/curve/compression/downsample_float_array_curve_by_error.js +147 -0
  1029. package/src/engine/animation/curve/compression/downsample_float_array_curve_by_error.spec.js +47 -0
  1030. package/src/engine/animation/curve/compression/prototypeCurveCompression.js +154 -0
  1031. package/src/engine/animation/curve/draw/build_curve_editor.js +316 -0
  1032. package/src/engine/animation/curve/draw/build_plot_entity_from_array.js +47 -0
  1033. package/src/engine/animation/curve/draw/build_tangent_editor.js +115 -0
  1034. package/src/engine/animation/curve/draw/draw_grid.js +27 -0
  1035. package/src/engine/animation/curve/draw/draw_label.js +17 -0
  1036. package/src/engine/animation/curve/draw/plot_array.js +76 -0
  1037. package/src/engine/animation/curve/draw/plot_data.js +49 -0
  1038. package/src/engine/animation/keyed2/AnimationTrack.js +189 -0
  1039. package/src/engine/animation/keyed2/AnimationTrackPlayback.js +231 -0
  1040. package/src/engine/animation/keyed2/AnimationTrackPlayback.spec.js +94 -0
  1041. package/src/engine/animation/keyed2/behavior/AnimationBehavior.js +33 -0
  1042. package/src/engine/animation/playAnimationTrack.js +29 -0
  1043. package/src/engine/animation/playTrackRealTime.js +35 -0
  1044. package/src/engine/animation/removeEntityGenericEffect.js +159 -0
  1045. package/src/engine/animation/removeEntityWithMeshParticlesEffect.js +203 -0
  1046. package/src/engine/asset/Asset.d.ts +7 -0
  1047. package/src/engine/asset/Asset.js +51 -0
  1048. package/src/engine/asset/AssetDescription.js +51 -0
  1049. package/src/engine/asset/AssetDescription.spec.js +27 -0
  1050. package/src/engine/asset/AssetManager.d.ts +33 -0
  1051. package/src/engine/asset/AssetManager.js +877 -0
  1052. package/src/engine/asset/AssetManager.spec.js +42 -0
  1053. package/src/engine/asset/AssetRequest.js +89 -0
  1054. package/src/engine/asset/AssetTransformer.d.ts +5 -0
  1055. package/src/engine/asset/AssetTransformer.js +16 -0
  1056. package/src/engine/asset/CORS/CrossOriginConfig.d.ts +5 -0
  1057. package/src/engine/asset/CORS/CrossOriginConfig.js +11 -0
  1058. package/src/engine/asset/CORS/CrossOriginKind.d.ts +4 -0
  1059. package/src/engine/asset/CORS/CrossOriginKind.js +4 -0
  1060. package/src/engine/asset/GameAssetType.js +24 -0
  1061. package/src/engine/asset/guessAssetType.js +48 -0
  1062. package/src/engine/asset/loadAssetAliasList.js +25 -0
  1063. package/src/engine/asset/loaders/ArrayBufferLoader.js +134 -0
  1064. package/src/engine/asset/loaders/AssetLoader.d.ts +5 -0
  1065. package/src/engine/asset/loaders/AssetLoader.js +43 -0
  1066. package/src/engine/asset/loaders/GLTFAssetLoader.d.ts +6 -0
  1067. package/src/engine/asset/loaders/GLTFAssetLoader.js +439 -0
  1068. package/src/engine/asset/loaders/JavascriptAssetLoader.js +42 -0
  1069. package/src/engine/asset/loaders/JsonAssetLoader.js +27 -0
  1070. package/src/engine/asset/loaders/LegacyThreeJSONAssetLoader.js +102 -0
  1071. package/src/engine/asset/loaders/SVGAssetLoader.js +31 -0
  1072. package/src/engine/asset/loaders/SoundAssetLoader.js +51 -0
  1073. package/src/engine/asset/loaders/TextAssetLoader.js +15 -0
  1074. package/src/engine/asset/loaders/async_traverse_three_object.js +24 -0
  1075. package/src/engine/asset/loaders/gltf/GLTFAssetTransformMikkTSpaceTangents.js +27 -0
  1076. package/src/engine/asset/loaders/gltf/computeObjectBoundingSphere.js +70 -0
  1077. package/src/engine/asset/loaders/gltf/extensions/MSFT_texture_dds.js +46 -0
  1078. package/src/engine/asset/loaders/gltf/isMesh.js +8 -0
  1079. package/src/engine/asset/loaders/image/ImageDecoderWorker.js +56 -0
  1080. package/src/engine/asset/loaders/image/ImageRGBADataAsset.js +45 -0
  1081. package/src/engine/asset/loaders/image/ImageRGBADataLoader.js +107 -0
  1082. package/src/engine/asset/loaders/image/codec/Codec.js +19 -0
  1083. package/src/engine/asset/loaders/image/codec/CodecWithFallback.js +73 -0
  1084. package/src/engine/asset/loaders/image/codec/NativeImageDecoder.js +55 -0
  1085. package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.js +42 -0
  1086. package/src/engine/asset/loaders/image/png/PNG.js +431 -0
  1087. package/src/engine/asset/loaders/image/png/PNGReader.js +542 -0
  1088. package/src/engine/asset/loaders/image/png/PNG_HEADER_BYTES.js +1 -0
  1089. package/src/engine/asset/loaders/image/png/crc.js +66 -0
  1090. package/src/engine/asset/loaders/image/png/prototypePNG.js +28 -0
  1091. package/src/engine/asset/loaders/material/StaticMaterialCache.d.ts +7 -0
  1092. package/src/engine/asset/loaders/material/StaticMaterialCache.js +106 -0
  1093. package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.js +131 -0
  1094. package/src/engine/asset/loaders/material/TextureAttachment.js +25 -0
  1095. package/src/engine/asset/loaders/material/bitmap2sampler_gl.js +25 -0
  1096. package/src/engine/asset/loaders/material/computeHashColor.js +7 -0
  1097. package/src/engine/asset/loaders/material/computeImageBitmapEquality.js +118 -0
  1098. package/src/engine/asset/loaders/material/computeImageBitmapHash.js +41 -0
  1099. package/src/engine/asset/loaders/material/computeMaterialEquality.d.ts +3 -0
  1100. package/src/engine/asset/loaders/material/computeMaterialEquality.js +131 -0
  1101. package/src/engine/asset/loaders/material/computeMaterialHash.d.ts +3 -0
  1102. package/src/engine/asset/loaders/material/computeMaterialHash.js +72 -0
  1103. package/src/engine/asset/loaders/material/computeTextureEquality.js +191 -0
  1104. package/src/engine/asset/loaders/material/computeTextureEqualityById.js +22 -0
  1105. package/src/engine/asset/loaders/material/computeTextureHash.js +141 -0
  1106. package/src/engine/asset/loaders/material/planeHash.js +10 -0
  1107. package/src/engine/asset/loaders/material/planesEqual.js +9 -0
  1108. package/src/engine/asset/loaders/material/textureHashById.js +12 -0
  1109. package/src/engine/asset/loaders/material/traverseMaterialTextures.d.ts +3 -0
  1110. package/src/engine/asset/loaders/material/traverseMaterialTextures.js +37 -0
  1111. package/src/engine/asset/loaders/texture/TextureAssetLoader.d.ts +6 -0
  1112. package/src/engine/asset/loaders/texture/TextureAssetLoader.js +40 -0
  1113. package/src/engine/asset/loaders/texture/cloneTexture.js +13 -0
  1114. package/src/engine/asset/loaders/texture/loadDDSTexture.js +37 -0
  1115. package/src/engine/asset/loaders/texture/loadStandardImageTexture.js +38 -0
  1116. package/src/engine/asset/preloader/AssetLevel.js +10 -0
  1117. package/src/engine/asset/preloader/Preloader.js +189 -0
  1118. package/src/engine/asset/preloader/extractAssetListFromManager.js +55 -0
  1119. package/src/engine/compression/CompressionService.js +144 -0
  1120. package/src/engine/computeStridedIntegerArrayHash.js +19 -0
  1121. package/src/engine/control/ControlContext.js +161 -0
  1122. package/src/engine/control/ControlContext.spec.js +81 -0
  1123. package/src/engine/control/ControlContextState.js +10 -0
  1124. package/src/engine/control/StatefulController.js +43 -0
  1125. package/src/engine/development/performance/AbstractMetric.js +30 -0
  1126. package/src/engine/development/performance/MetricCollection.js +60 -0
  1127. package/src/engine/development/performance/MetricStatistics.js +8 -0
  1128. package/src/engine/development/performance/RingBufferMetric.js +73 -0
  1129. package/src/engine/development/performance/monitor/PeriodicConsolePrinter.js +37 -0
  1130. package/src/engine/ecs/Blueprint.js +129 -0
  1131. package/src/engine/ecs/EntityBlueprint.d.ts +3 -0
  1132. package/src/engine/ecs/EntityBlueprint.js +161 -0
  1133. package/src/engine/ecs/EntityBuilder.d.ts +33 -0
  1134. package/src/engine/ecs/EntityBuilder.js +466 -0
  1135. package/src/engine/ecs/EntityBuilder.spec.js +64 -0
  1136. package/src/engine/ecs/EntityBuilderUtils.js +21 -0
  1137. package/src/engine/ecs/EntityComponentDataset.d.ts +45 -0
  1138. package/src/engine/ecs/EntityComponentDataset.js +1919 -0
  1139. package/src/engine/ecs/EntityComponentDataset.spec.js +818 -0
  1140. package/src/engine/ecs/EntityFactory.js +207 -0
  1141. package/src/engine/ecs/EntityManager.d.ts +34 -0
  1142. package/src/engine/ecs/EntityManager.js +894 -0
  1143. package/src/engine/ecs/EntityManager.spec.js +99 -0
  1144. package/src/engine/ecs/EntityObserver.d.ts +13 -0
  1145. package/src/engine/ecs/EntityObserver.js +121 -0
  1146. package/src/engine/ecs/EntityObserver.spec.js +184 -0
  1147. package/src/engine/ecs/System.d.ts +30 -0
  1148. package/src/engine/ecs/System.js +121 -0
  1149. package/src/engine/ecs/animation/Animation.js +355 -0
  1150. package/src/engine/ecs/animation/AnimationOptimizer.js +132 -0
  1151. package/src/engine/ecs/animation/IKMath.js +29 -0
  1152. package/src/engine/ecs/animation/IKProblem.js +30 -0
  1153. package/src/engine/ecs/animation/IKSolver.js +9 -0
  1154. package/src/engine/ecs/animation/InverseKinematics.js +278 -0
  1155. package/src/engine/ecs/animation/InverseKinematicsSystem.js +143 -0
  1156. package/src/engine/ecs/animation/OneBoneSurfaceAlignmentSolver.js +213 -0
  1157. package/src/engine/ecs/animation/TwoBoneInverseKinematicsSolver.js +325 -0
  1158. package/src/engine/ecs/attachment/Attachment.js +55 -0
  1159. package/src/engine/ecs/attachment/AttachmentBinding.js +44 -0
  1160. package/src/engine/ecs/attachment/AttachmentSystem.js +312 -0
  1161. package/src/engine/ecs/attachment/BoneAttachmentBinding.js +53 -0
  1162. package/src/engine/ecs/attachment/TransformAttachmentBinding.js +43 -0
  1163. package/src/engine/ecs/binding/ComponentPropertyBinding.js +57 -0
  1164. package/src/engine/ecs/binding/ComponentPropertyPath.js +15 -0
  1165. package/src/engine/ecs/binding/EntityProxyScope.js +95 -0
  1166. package/src/engine/ecs/components/AABB.js +33 -0
  1167. package/src/engine/ecs/components/AABBCollider.js +15 -0
  1168. package/src/engine/ecs/components/AimController.js +18 -0
  1169. package/src/engine/ecs/components/AlignToVelocity.js +9 -0
  1170. package/src/engine/ecs/components/AreaOfEffect.js +12 -0
  1171. package/src/engine/ecs/components/Attacker.js +13 -0
  1172. package/src/engine/ecs/components/CharacterController.js +25 -0
  1173. package/src/engine/ecs/components/ClingToHeightMap.js +19 -0
  1174. package/src/engine/ecs/components/GeometryBVH.js +44 -0
  1175. package/src/engine/ecs/components/MeshCollider.js +10 -0
  1176. package/src/engine/ecs/components/MonsterAI.js +10 -0
  1177. package/src/engine/ecs/components/Mortality.js +27 -0
  1178. package/src/engine/ecs/components/Motion.js +61 -0
  1179. package/src/engine/ecs/components/PhysicalBody.js +51 -0
  1180. package/src/engine/ecs/components/PropertySet.js +140 -0
  1181. package/src/engine/ecs/components/RangedAttack.js +12 -0
  1182. package/src/engine/ecs/components/Renderable.d.ts +14 -0
  1183. package/src/engine/ecs/components/Renderable.js +244 -0
  1184. package/src/engine/ecs/components/RenderableFlags.js +6 -0
  1185. package/src/engine/ecs/components/Script.js +26 -0
  1186. package/src/engine/ecs/components/SerializationMetadata.js +97 -0
  1187. package/src/engine/ecs/components/Steering.js +146 -0
  1188. package/src/engine/ecs/components/SynchronizePosition.js +15 -0
  1189. package/src/engine/ecs/components/Tag.d.ts +27 -0
  1190. package/src/engine/ecs/components/Tag.js +391 -0
  1191. package/src/engine/ecs/components/TagEditor.js +15 -0
  1192. package/src/engine/ecs/components/TargetAI.js +11 -0
  1193. package/src/engine/ecs/components/Timer.js +85 -0
  1194. package/src/engine/ecs/components/ViewportMeshProjection.js +18 -0
  1195. package/src/engine/ecs/dynamic_actions/DynamicActor.js +22 -0
  1196. package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +606 -0
  1197. package/src/engine/ecs/dynamic_actions/DynamicRuleDescriptionTable.spec.js +126 -0
  1198. package/src/engine/ecs/dynamic_actions/RuleExecution.js +16 -0
  1199. package/src/engine/ecs/dynamic_actions/actions/definition/AbstractActionDescription.js +22 -0
  1200. package/src/engine/ecs/dynamic_actions/actions/definition/ActionSequenceDescription.js +22 -0
  1201. package/src/engine/ecs/dynamic_actions/actions/definition/DelayActionDescription.js +23 -0
  1202. package/src/engine/ecs/dynamic_actions/actions/definition/NoopActionDescription.js +14 -0
  1203. package/src/engine/ecs/dynamic_actions/actions/definition/SendRequestActionDescription.js +104 -0
  1204. package/src/engine/ecs/dynamic_actions/actions/definition/SpeakLineActionDescription.js +81 -0
  1205. package/src/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +53 -0
  1206. package/src/engine/ecs/dynamic_actions/actions/definition/WhiteToBlackboardActionDescription.js +58 -0
  1207. package/src/engine/ecs/dynamic_actions/actions/definition/deserializeActionFromJSON.js +81 -0
  1208. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleCooldownDescription.js +34 -0
  1209. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +132 -0
  1210. package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.js +178 -0
  1211. package/src/engine/ecs/dynamic_actions/rules/computeContextualDynamicRuleDebugString.js +27 -0
  1212. package/src/engine/ecs/evaluation/PointFitnessBinary.js +36 -0
  1213. package/src/engine/ecs/evaluation/PointFitnessConstant.js +31 -0
  1214. package/src/engine/ecs/evaluation/PointFitnessFunction.js +20 -0
  1215. package/src/engine/ecs/evaluation/arithmetic/PointFitnessAdd.js +27 -0
  1216. package/src/engine/ecs/evaluation/arithmetic/PointFitnessMultiply.js +28 -0
  1217. package/src/engine/ecs/evaluation/complex/PointFitnessGaussianBlur.js +125 -0
  1218. package/src/engine/ecs/evaluation/json/deserializeFromJSON_PointFitnessFunction.js +68 -0
  1219. package/src/engine/ecs/evaluation/json/serializeToJSON_PointFitnessFunction.js +89 -0
  1220. package/src/engine/ecs/evaluation/world/ReadTerrainLayerWeightPointFitness.js +64 -0
  1221. package/src/engine/ecs/foliage/Foliage.js +151 -0
  1222. package/src/engine/ecs/foliage/FoliageLoader.js +39 -0
  1223. package/src/engine/ecs/foliage/FoliageVisibilitySetBuilder.js +27 -0
  1224. package/src/engine/ecs/foliage/ImpostorFoliage.js +106 -0
  1225. package/src/engine/ecs/foliage/InstancedFoliage.js +386 -0
  1226. package/src/engine/ecs/foliage/ViewState.js +181 -0
  1227. package/src/engine/ecs/foliage/ecs/Foliage2System.js +328 -0
  1228. package/src/engine/ecs/foliage/ecs/InstancedMeshComponent.js +67 -0
  1229. package/src/engine/ecs/foliage/ecs/InstancedMeshLayer.js +138 -0
  1230. package/src/engine/ecs/foliage/ecs/InstancedMeshSerializationAdapter.js +31 -0
  1231. package/src/engine/ecs/foliage/ecs/InstancedMeshUtils.js +279 -0
  1232. package/src/engine/ecs/fow/FogOfWar.js +607 -0
  1233. package/src/engine/ecs/fow/FogOfWar.spec.js +14 -0
  1234. package/src/engine/ecs/fow/FogOfWarEditor.js +13 -0
  1235. package/src/engine/ecs/fow/FogOfWarRevealer.js +56 -0
  1236. package/src/engine/ecs/fow/FogOfWarRevealerSystem.js +142 -0
  1237. package/src/engine/ecs/fow/FogOfWarSystem.js +266 -0
  1238. package/src/engine/ecs/fow/FogOfWarVisibilityPredicate.js +52 -0
  1239. package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.js +80 -0
  1240. package/src/engine/ecs/fow/serialization/FogOfWarSerializationUpdater_0_1.js +50 -0
  1241. package/src/engine/ecs/fow/shader/FogOfWarRenderer.js +145 -0
  1242. package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js +151 -0
  1243. package/src/engine/ecs/grid/HeightMap2NormalMap.js +76 -0
  1244. package/src/engine/ecs/grid/HeightSampler2NormalSamplerSoft.js +68 -0
  1245. package/src/engine/ecs/grid/NormalMap2AOMap.js +87 -0
  1246. package/src/engine/ecs/grid/Sampler2DDecoder.js +57 -0
  1247. package/src/engine/ecs/grid/makeTerrainGeometry.js +110 -0
  1248. package/src/engine/ecs/gui/GUIElement.d.ts +5 -0
  1249. package/src/engine/ecs/gui/GUIElement.js +239 -0
  1250. package/src/engine/ecs/gui/GUIElementEvent.js +8 -0
  1251. package/src/engine/ecs/gui/GUIElementSerializationAdapter.js +108 -0
  1252. package/src/engine/ecs/gui/GUIElementSystem.d.ts +8 -0
  1253. package/src/engine/ecs/gui/GUIElementSystem.js +289 -0
  1254. package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +118 -0
  1255. package/src/engine/ecs/gui/hud/HeadsUpDisplayFlag.js +16 -0
  1256. package/src/engine/ecs/gui/hud/HeadsUpDisplaySerializationAdapter.js +31 -0
  1257. package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.d.ts +6 -0
  1258. package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +210 -0
  1259. package/src/engine/ecs/gui/menu/radial/AnimateAppearance.js +21 -0
  1260. package/src/engine/ecs/gui/menu/radial/AnimateDisappearance.js +21 -0
  1261. package/src/engine/ecs/gui/menu/radial/RadialContextMenu.d.ts +22 -0
  1262. package/src/engine/ecs/gui/menu/radial/RadialContextMenu.js +246 -0
  1263. package/src/engine/ecs/gui/menu/radial/RadialMenuSettings.js +11 -0
  1264. package/src/engine/ecs/gui/menu/radial/playAnimation.js +20 -0
  1265. package/src/engine/ecs/gui/menu/radial/updateAnimationState.js +14 -0
  1266. package/src/engine/ecs/gui/parallax/GuiElementParallax.js +15 -0
  1267. package/src/engine/ecs/gui/parallax/GuiElementParallaxSystem.js +91 -0
  1268. package/src/engine/ecs/gui/position/ViewportPosition.js +194 -0
  1269. package/src/engine/ecs/gui/position/ViewportPositionSystem.js +262 -0
  1270. package/src/engine/ecs/gui/view/ButtonViewEntity.js +108 -0
  1271. package/src/engine/ecs/gui/view/LocalizedLabelViewEntity.js +52 -0
  1272. package/src/engine/ecs/gui/view/ViewEntity.js +32 -0
  1273. package/src/engine/ecs/parent/ChildEntities.d.ts +3 -0
  1274. package/src/engine/ecs/parent/ChildEntities.js +41 -0
  1275. package/src/engine/ecs/parent/EntityNode.d.ts +24 -0
  1276. package/src/engine/ecs/parent/EntityNode.js +430 -0
  1277. package/src/engine/ecs/parent/EntityNodeFlags.js +8 -0
  1278. package/src/engine/ecs/parent/FaceEditor.js +137 -0
  1279. package/src/engine/ecs/parent/ParentEntity.d.ts +11 -0
  1280. package/src/engine/ecs/parent/ParentEntity.js +50 -0
  1281. package/src/engine/ecs/parent/ParentEntitySystem.d.ts +11 -0
  1282. package/src/engine/ecs/parent/ParentEntitySystem.js +222 -0
  1283. package/src/engine/ecs/parent/entity_node_compute_bounding_box.js +41 -0
  1284. package/src/engine/ecs/parent/testCompositionEntityNode.js +153 -0
  1285. package/src/engine/ecs/parent/testHuDPerf.js +123 -0
  1286. package/src/engine/ecs/sockets/AttachmentSocket.js +62 -0
  1287. package/src/engine/ecs/sockets/AttachmentSocketType.js +8 -0
  1288. package/src/engine/ecs/sockets/AttachmentSockets.js +132 -0
  1289. package/src/engine/ecs/sockets/BoneAttachmentSocket.js +60 -0
  1290. package/src/engine/ecs/sockets/serialization/AttachmentSocketsAssetLoader.js +22 -0
  1291. package/src/engine/ecs/speaker/SpeechBubbleView.js +11 -0
  1292. package/src/engine/ecs/speaker/Voice.js +58 -0
  1293. package/src/engine/ecs/speaker/VoiceEvents.js +10 -0
  1294. package/src/engine/ecs/speaker/VoiceFlags.js +10 -0
  1295. package/src/engine/ecs/speaker/VoiceSystem.js +455 -0
  1296. package/src/engine/ecs/speaker/lines/LineDescription.js +45 -0
  1297. package/src/engine/ecs/speaker/lines/LineDescriptionTable.js +15 -0
  1298. package/src/engine/ecs/speaker/lines/sets/LineSetDescription.js +74 -0
  1299. package/src/engine/ecs/speaker/lines/sets/LineSetDescriptionTable.js +103 -0
  1300. package/src/engine/ecs/storage/BinaryBufferDeSerializer.js +201 -0
  1301. package/src/engine/ecs/storage/BinaryBufferSerializer.js +181 -0
  1302. package/src/engine/ecs/storage/COMPONENT_SERIALIZATION_TRANSIENT_FIELD.js +7 -0
  1303. package/src/engine/ecs/storage/JSONDeSerializer.js +148 -0
  1304. package/src/engine/ecs/storage/JSONSerializer.js +132 -0
  1305. package/src/engine/ecs/storage/binary/BinaryClassSerializationAdapter.js +66 -0
  1306. package/src/engine/ecs/storage/binary/BinaryClassUpgrader.js +90 -0
  1307. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +204 -0
  1308. package/src/engine/ecs/storage/binary/BinarySerializationRegistry.spec.js +139 -0
  1309. package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +341 -0
  1310. package/src/engine/ecs/storage/binary/collection/BinaryCollectionHeaderCodec.js +12 -0
  1311. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerialization.spec.js +259 -0
  1312. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +274 -0
  1313. package/src/engine/ecs/storage/binary/object/BinaryObjectSerializationAdapter.js +130 -0
  1314. package/src/engine/ecs/storage/binary/object/BinaryObjectSerializationAdapter.spec.js +59 -0
  1315. package/src/engine/ecs/storage/binary/object/ObjectBasedClassSerializationAdapter.js +21 -0
  1316. package/src/engine/ecs/system/AbstractContextSystem.js +119 -0
  1317. package/src/engine/ecs/system/SystemEntityContext.js +50 -0
  1318. package/src/engine/ecs/systems/AABBColliderSystem.js +61 -0
  1319. package/src/engine/ecs/systems/AABBSystem.js +89 -0
  1320. package/src/engine/ecs/systems/AimControllerSystem.js +63 -0
  1321. package/src/engine/ecs/systems/AlignToVelocitySystem.js +51 -0
  1322. package/src/engine/ecs/systems/AnimationSystem.d.ts +6 -0
  1323. package/src/engine/ecs/systems/AnimationSystem.js +388 -0
  1324. package/src/engine/ecs/systems/AreaOfEffectSystem.js +48 -0
  1325. package/src/engine/ecs/systems/AttackerSystem.js +67 -0
  1326. package/src/engine/ecs/systems/CharacterControlSystem.js +134 -0
  1327. package/src/engine/ecs/systems/ClingToHeightMapSystem.js +170 -0
  1328. package/src/engine/ecs/systems/GeometryBVHSystem.js +36 -0
  1329. package/src/engine/ecs/systems/MeshColliderSystem.js +47 -0
  1330. package/src/engine/ecs/systems/MonsterAISystem.js +163 -0
  1331. package/src/engine/ecs/systems/MortalitySystem.js +46 -0
  1332. package/src/engine/ecs/systems/MotionSystem.js +28 -0
  1333. package/src/engine/ecs/systems/PhysicsSystem.js +89 -0
  1334. package/src/engine/ecs/systems/PropertySetSystem.js +18 -0
  1335. package/src/engine/ecs/systems/RangedAttackSystem.js +132 -0
  1336. package/src/engine/ecs/systems/RenderSystem.d.ts +7 -0
  1337. package/src/engine/ecs/systems/RenderSystem.js +267 -0
  1338. package/src/engine/ecs/systems/ScriptSystem.d.ts +5 -0
  1339. package/src/engine/ecs/systems/ScriptSystem.js +48 -0
  1340. package/src/engine/ecs/systems/SerializationMetadataSystem.js +10 -0
  1341. package/src/engine/ecs/systems/SteeringSystem.js +171 -0
  1342. package/src/engine/ecs/systems/SynchronizePositionSystem.js +37 -0
  1343. package/src/engine/ecs/systems/TagSystem.d.ts +5 -0
  1344. package/src/engine/ecs/systems/TagSystem.js +36 -0
  1345. package/src/engine/ecs/systems/TargetAISystem.js +107 -0
  1346. package/src/engine/ecs/systems/TimerSystem.js +71 -0
  1347. package/src/engine/ecs/systems/ViewportMeshProjectionSystem.js +68 -0
  1348. package/src/engine/ecs/team/Team.js +82 -0
  1349. package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.js +126 -0
  1350. package/src/engine/ecs/terrain/TerrainClouds.js +177 -0
  1351. package/src/engine/ecs/terrain/TerrainGeometryBuilder.js +152 -0
  1352. package/src/engine/ecs/terrain/TerrainPreview.js +66 -0
  1353. package/src/engine/ecs/terrain/ecs/BuildLightTexture.js +106 -0
  1354. package/src/engine/ecs/terrain/ecs/GridTransformKind.js +4 -0
  1355. package/src/engine/ecs/terrain/ecs/OffsetScaleTransform2D.d.ts +6 -0
  1356. package/src/engine/ecs/terrain/ecs/OffsetScaleTransform2D.js +9 -0
  1357. package/src/engine/ecs/terrain/ecs/PromiseSamplerHeight.js +59 -0
  1358. package/src/engine/ecs/terrain/ecs/Terrain.d.ts +17 -0
  1359. package/src/engine/ecs/terrain/ecs/Terrain.js +1060 -0
  1360. package/src/engine/ecs/terrain/ecs/TerrainClassifier.js +125 -0
  1361. package/src/engine/ecs/terrain/ecs/TerrainFlags.js +8 -0
  1362. package/src/engine/ecs/terrain/ecs/TerrainSystem.d.ts +8 -0
  1363. package/src/engine/ecs/terrain/ecs/TerrainSystem.js +232 -0
  1364. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +68 -0
  1365. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationAdapter.js +31 -0
  1366. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js +348 -0
  1367. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.spec.js +38 -0
  1368. package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +165 -0
  1369. package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +459 -0
  1370. package/src/engine/ecs/terrain/ecs/layers/loadLegacyTerrainLayers.js +99 -0
  1371. package/src/engine/ecs/terrain/ecs/makeTerrainWorkerProxy.js +82 -0
  1372. package/src/engine/ecs/terrain/ecs/splat/SplatMapMaterialPatch.js +461 -0
  1373. package/src/engine/ecs/terrain/ecs/splat/SplatMapOptimizer.js +622 -0
  1374. package/src/engine/ecs/terrain/ecs/splat/SplatMapOptimizerDebugger.js +383 -0
  1375. package/src/engine/ecs/terrain/ecs/splat/SplatMapping.js +528 -0
  1376. package/src/engine/ecs/terrain/ecs/splat/loadLegacyTerrainSplats.js +73 -0
  1377. package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +324 -0
  1378. package/src/engine/ecs/terrain/serialization/TerrainSerializationAdapter.js +206 -0
  1379. package/src/engine/ecs/terrain/serialization/TerrainSerializationUpgrader_0_1.js +92 -0
  1380. package/src/engine/ecs/terrain/serialization/TerrainSerializationUpgrader_1_2.js +81 -0
  1381. package/src/engine/ecs/terrain/tiles/FirstRayIntersectionTerrainBVHVisitor.js +74 -0
  1382. package/src/engine/ecs/terrain/tiles/TerrainTile.js +585 -0
  1383. package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +692 -0
  1384. package/src/engine/ecs/terrain/tiles/TileBuildWorker.js +17 -0
  1385. package/src/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +112 -0
  1386. package/src/engine/ecs/terrain/util/obtainTerrain.js +23 -0
  1387. package/src/engine/ecs/terrain/util/paintTerrainOverlayViaLookupTable.js +67 -0
  1388. package/src/engine/ecs/terrain/util/tensionOptimizeUV.js +76 -0
  1389. package/src/engine/ecs/tooltip/TooltipComponent.js +45 -0
  1390. package/src/engine/ecs/tooltip/TooltipComponentSerializationAdapter.js +29 -0
  1391. package/src/engine/ecs/tooltip/TooltipComponentSystem.js +234 -0
  1392. package/src/engine/ecs/tooltip/testTooltipComponentSystem.js +119 -0
  1393. package/src/engine/ecs/transform/Transform.d.ts +38 -0
  1394. package/src/engine/ecs/transform/Transform.editor.schema.json +16 -0
  1395. package/src/engine/ecs/transform/Transform.js +357 -0
  1396. package/src/engine/ecs/transform/TransformFlags.js +11 -0
  1397. package/src/engine/ecs/transform/TransformSerializationAdapter.js +54 -0
  1398. package/src/engine/ecs/transform/TransformSerializationUpgrader_0_1.js +69 -0
  1399. package/src/engine/ecs/transform/copy_three_transform.js +15 -0
  1400. package/src/engine/ecs/transform-attachment/TransformAttachment.d.ts +3 -0
  1401. package/src/engine/ecs/transform-attachment/TransformAttachment.js +101 -0
  1402. package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.d.ts +6 -0
  1403. package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.js +226 -0
  1404. package/src/engine/ecs/util/hideEntityGracefully.js +202 -0
  1405. package/src/engine/ecs/util/removeComponentsExcept.js +32 -0
  1406. package/src/engine/google/gapi.js +29 -0
  1407. package/src/engine/graphics/CanvasBlur.js +599 -0
  1408. package/src/engine/graphics/FULL_SCREEN_QUAD_VERTEX_SHADER.js +10 -0
  1409. package/src/engine/graphics/FrameRunner.js +88 -0
  1410. package/src/engine/graphics/FrameThrottle.js +29 -0
  1411. package/src/engine/graphics/GraphicsEngine.d.ts +38 -0
  1412. package/src/engine/graphics/GraphicsEngine.js +684 -0
  1413. package/src/engine/graphics/StandardFrameBuffers.js +9 -0
  1414. package/src/engine/graphics/WHITE_PIXEL_DATA_URL.js +1 -0
  1415. package/src/engine/graphics/camera/CameraShake.js +198 -0
  1416. package/src/engine/graphics/camera/camera_compute_distance_to_fit_length.d.ts +1 -0
  1417. package/src/engine/graphics/camera/camera_compute_distance_to_fit_length.js +22 -0
  1418. package/src/engine/graphics/camera/makeOrbitalCameraController.js +108 -0
  1419. package/src/engine/graphics/camera/makeScreenScissorFrustum.d.ts +4 -0
  1420. package/src/engine/graphics/camera/makeScreenScissorFrustum.js +60 -0
  1421. package/src/engine/graphics/camera/testClippingPlaneComputation.js +434 -0
  1422. package/src/engine/graphics/clouds/MaterialTransformer.js +0 -0
  1423. package/src/engine/graphics/clouds/TerrainCloudsPlugin.js +0 -0
  1424. package/src/engine/graphics/clouds/cs_build_fragment_shader.js +0 -0
  1425. package/src/engine/graphics/clouds/cs_build_vertex_shader.js +0 -0
  1426. package/src/engine/graphics/composit/CompositLayer.js +254 -0
  1427. package/src/engine/graphics/composit/CompositingStages.js +8 -0
  1428. package/src/engine/graphics/composit/LayerCompositer.js +240 -0
  1429. package/src/engine/graphics/debug/VisualSymbolLine.js +112 -0
  1430. package/src/engine/graphics/debug/createDebugLabel.js +36 -0
  1431. package/src/engine/graphics/ecs/animation/AnimationController.js +152 -0
  1432. package/src/engine/graphics/ecs/animation/AnimationControllerSystem.js +80 -0
  1433. package/src/engine/graphics/ecs/animation/animator/AnimationClip.js +227 -0
  1434. package/src/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +117 -0
  1435. package/src/engine/graphics/ecs/animation/animator/AnimationClipFlag.js +10 -0
  1436. package/src/engine/graphics/ecs/animation/animator/AnimationEventTypes.js +7 -0
  1437. package/src/engine/graphics/ecs/animation/animator/AnimationGraphSystem.js +322 -0
  1438. package/src/engine/graphics/ecs/animation/animator/AnimationNotification.js +43 -0
  1439. package/src/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +44 -0
  1440. package/src/engine/graphics/ecs/animation/animator/blending/BlendSpace.js +15 -0
  1441. package/src/engine/graphics/ecs/animation/animator/blending/BlendSpaceDefinition.js +9 -0
  1442. package/src/engine/graphics/ecs/animation/animator/blending/BlendSpacePoint.js +15 -0
  1443. package/src/engine/graphics/ecs/animation/animator/blending/BlendState.js +9 -0
  1444. package/src/engine/graphics/ecs/animation/animator/blending/BlendStateDatabase.js +76 -0
  1445. package/src/engine/graphics/ecs/animation/animator/blending/BlendStateMatrix.js +103 -0
  1446. package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +727 -0
  1447. package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraphFlag.js +8 -0
  1448. package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraphSerializationAdapter.js +64 -0
  1449. package/src/engine/graphics/ecs/animation/animator/graph/AnimationState.js +210 -0
  1450. package/src/engine/graphics/ecs/animation/animator/graph/AnimationStateType.js +5 -0
  1451. package/src/engine/graphics/ecs/animation/animator/graph/AnimationTransition.js +153 -0
  1452. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +194 -0
  1453. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +92 -0
  1454. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +61 -0
  1455. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionAssetLoader.js +29 -0
  1456. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionSerializationAdapter.js +301 -0
  1457. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.js +135 -0
  1458. package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.js +100 -0
  1459. package/src/engine/graphics/ecs/camera/Camera.d.ts +18 -0
  1460. package/src/engine/graphics/ecs/camera/Camera.js +262 -0
  1461. package/src/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +138 -0
  1462. package/src/engine/graphics/ecs/camera/CameraSystem.d.ts +11 -0
  1463. package/src/engine/graphics/ecs/camera/CameraSystem.js +311 -0
  1464. package/src/engine/graphics/ecs/camera/FrustumProjector.js +242 -0
  1465. package/src/engine/graphics/ecs/camera/InvertQuaternionOrientation.js +26 -0
  1466. package/src/engine/graphics/ecs/camera/ProjectionType.js +9 -0
  1467. package/src/engine/graphics/ecs/camera/TiltCameraController.js +69 -0
  1468. package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.js +32 -0
  1469. package/src/engine/graphics/ecs/camera/build_three_camera_object.js +29 -0
  1470. package/src/engine/graphics/ecs/camera/compute_perspective_camera_focal_position.js +27 -0
  1471. package/src/engine/graphics/ecs/camera/frustum_from_camera.js +20 -0
  1472. package/src/engine/graphics/ecs/camera/is_valid_distance_value.js +11 -0
  1473. package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.js +35 -0
  1474. package/src/engine/graphics/ecs/camera/set_camera_aspect_ratio.js +46 -0
  1475. package/src/engine/graphics/ecs/camera/topdown/ComputeCameraFacingVector.js +21 -0
  1476. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.d.ts +33 -0
  1477. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.js +264 -0
  1478. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.spec.js +94 -0
  1479. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.js +53 -0
  1480. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationUpgrader_0_1.js +30 -0
  1481. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts +5 -0
  1482. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +104 -0
  1483. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLander.js +26 -0
  1484. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLanderSystem.js +153 -0
  1485. package/src/engine/graphics/ecs/camera/unprojectPoint.js +14 -0
  1486. package/src/engine/graphics/ecs/camera/update_camera_transform.js +17 -0
  1487. package/src/engine/graphics/ecs/compileAllMaterials.js +139 -0
  1488. package/src/engine/graphics/ecs/decal/Decal.js +10 -0
  1489. package/src/engine/graphics/ecs/decal/DecalSystem.js +117 -0
  1490. package/src/engine/graphics/ecs/decal/threejs/DecalGeometry.js +298 -0
  1491. package/src/engine/graphics/ecs/decal/v2/Decal.d.ts +11 -0
  1492. package/src/engine/graphics/ecs/decal/v2/Decal.js +50 -0
  1493. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.d.ts +8 -0
  1494. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +226 -0
  1495. package/src/engine/graphics/ecs/decal/v2/prototypeDecalEditor.js +138 -0
  1496. package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +496 -0
  1497. package/src/engine/graphics/ecs/highlight/Highlight.d.ts +16 -0
  1498. package/src/engine/graphics/ecs/highlight/Highlight.js +188 -0
  1499. package/src/engine/graphics/ecs/highlight/HighlightDefinition.d.ts +16 -0
  1500. package/src/engine/graphics/ecs/highlight/HighlightDefinition.js +86 -0
  1501. package/src/engine/graphics/ecs/highlight/HighlightEditor.js +17 -0
  1502. package/src/engine/graphics/ecs/highlight/HighlightSerializationAdapter.js +87 -0
  1503. package/src/engine/graphics/ecs/highlight/HighlightSerializationUpgrader_0_1.js +28 -0
  1504. package/src/engine/graphics/ecs/highlight/plugin/HighlightRenderElementSource.js +12 -0
  1505. package/src/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +193 -0
  1506. package/src/engine/graphics/ecs/highlight/renderer/HighlightDecodeShader.js +67 -0
  1507. package/src/engine/graphics/ecs/highlight/renderer/HighlightRenderElement.js +47 -0
  1508. package/src/engine/graphics/ecs/highlight/renderer/HighlightRenderGroup.js +31 -0
  1509. package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.js +634 -0
  1510. package/src/engine/graphics/ecs/highlight/renderer/makeBlurShader_9.js +49 -0
  1511. package/src/engine/graphics/ecs/highlight/renderer/makeDilationShader.js +92 -0
  1512. package/src/engine/graphics/ecs/highlight/renderer/makeGaussianBlurShader.js +61 -0
  1513. package/src/engine/graphics/ecs/highlight/renderer/traverseThreeObject.js +18 -0
  1514. package/src/engine/graphics/ecs/highlight/system/MeshHighlightSystem.d.ts +8 -0
  1515. package/src/engine/graphics/ecs/highlight/system/MeshHighlightSystem.js +180 -0
  1516. package/src/engine/graphics/ecs/highlight/system/RenderableHighlightSystem.d.ts +8 -0
  1517. package/src/engine/graphics/ecs/highlight/system/RenderableHighlightSystem.js +176 -0
  1518. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.d.ts +8 -0
  1519. package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.js +185 -0
  1520. package/src/engine/graphics/ecs/light/Light.d.ts +19 -0
  1521. package/src/engine/graphics/ecs/light/Light.js +167 -0
  1522. package/src/engine/graphics/ecs/light/LightContext.js +69 -0
  1523. package/src/engine/graphics/ecs/light/LightSerializationAdapter.js +50 -0
  1524. package/src/engine/graphics/ecs/light/LightSystem.d.ts +11 -0
  1525. package/src/engine/graphics/ecs/light/LightSystem.js +344 -0
  1526. package/src/engine/graphics/ecs/light/LightType.d.ts +6 -0
  1527. package/src/engine/graphics/ecs/light/LightType.js +11 -0
  1528. package/src/engine/graphics/ecs/light/binding/LightBinding.js +118 -0
  1529. package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.js +61 -0
  1530. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +348 -0
  1531. package/src/engine/graphics/ecs/light/binding/three/applyRotation.js +24 -0
  1532. package/src/engine/graphics/ecs/light/binding/three/threeEnsureLightObject.js +12 -0
  1533. package/src/engine/graphics/ecs/light/binding/three/threeMakeLight.js +41 -0
  1534. package/src/engine/graphics/ecs/light/shadow/ShadowManager.js +54 -0
  1535. package/src/engine/graphics/ecs/light/shadow/ShadowMap.js +11 -0
  1536. package/src/engine/graphics/ecs/light/shadow/setShadowCameraDimensionsDiscrete.js +43 -0
  1537. package/src/engine/graphics/ecs/light/three/ThreeLightCache.js +250 -0
  1538. package/src/engine/graphics/ecs/light/three/light2type.js +20 -0
  1539. package/src/engine/graphics/ecs/mesh/Mesh.d.ts +35 -0
  1540. package/src/engine/graphics/ecs/mesh/Mesh.js +448 -0
  1541. package/src/engine/graphics/ecs/mesh/MeshEditor.js +28 -0
  1542. package/src/engine/graphics/ecs/mesh/MeshEvents.d.ts +12 -0
  1543. package/src/engine/graphics/ecs/mesh/MeshEvents.js +16 -0
  1544. package/src/engine/graphics/ecs/mesh/MeshSystem.d.ts +7 -0
  1545. package/src/engine/graphics/ecs/mesh/MeshSystem.js +467 -0
  1546. package/src/engine/graphics/ecs/mesh/SkeletonUtils.js +284 -0
  1547. package/src/engine/graphics/ecs/mesh/applyTransformToThreeObject.js +14 -0
  1548. package/src/engine/graphics/ecs/mesh/assetTypeByPath.js +28 -0
  1549. package/src/engine/graphics/ecs/mesh/commonObject3DFastMatrixUpdate.js +37 -0
  1550. package/src/engine/graphics/ecs/mesh/copyToVector3.js +18 -0
  1551. package/src/engine/graphics/ecs/mesh/createTaskWaitForMeshesToLoad.js +158 -0
  1552. package/src/engine/graphics/ecs/mesh/object3DFastMatrixUpdate.js +18 -0
  1553. package/src/engine/graphics/ecs/mesh/rootObject3DFastMatrixUpdate.js +14 -0
  1554. package/src/engine/graphics/ecs/mesh/serialization/MeshSerializationAdapter.js +43 -0
  1555. package/src/engine/graphics/ecs/mesh/setMesh.js +55 -0
  1556. package/src/engine/graphics/ecs/mesh/setThreeObjectRotation.js +11 -0
  1557. package/src/engine/graphics/ecs/mesh/skeleton/BoneMapping.js +101 -0
  1558. package/src/engine/graphics/ecs/mesh/skeleton/HumanoidBoneType.js +29 -0
  1559. package/src/engine/graphics/ecs/mesh/updateMeshTransform.js +15 -0
  1560. package/src/engine/graphics/ecs/mesh/updateNodeByTransformAndBBB.js +54 -0
  1561. package/src/engine/graphics/ecs/mesh-v2/DrawMode.d.ts +6 -0
  1562. package/src/engine/graphics/ecs/mesh-v2/DrawMode.js +10 -0
  1563. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +20 -0
  1564. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +370 -0
  1565. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometryFlags.js +20 -0
  1566. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +32 -0
  1567. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +538 -0
  1568. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.d.ts +14 -0
  1569. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.js +179 -0
  1570. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshEvents.d.ts +12 -0
  1571. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshEvents.js +12 -0
  1572. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshHighlightSystem.d.ts +7 -0
  1573. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshHighlightSystem.js +90 -0
  1574. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.d.ts +8 -0
  1575. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.js +294 -0
  1576. package/src/engine/graphics/ecs/mesh-v2/aggregate/prototypeSGMesh.js +174 -0
  1577. package/src/engine/graphics/ecs/mesh-v2/allocate_transform_m4.js +51 -0
  1578. package/src/engine/graphics/ecs/mesh-v2/allocate_v3.js +37 -0
  1579. package/src/engine/graphics/ecs/mesh-v2/build_three_object.js +45 -0
  1580. package/src/engine/graphics/ecs/mesh-v2/render/SGThreeObjectCache.js +38 -0
  1581. package/src/engine/graphics/ecs/mesh-v2/render/ShadedGeometryRendererContext.js +171 -0
  1582. package/src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.js +131 -0
  1583. package/src/engine/graphics/ecs/mesh-v2/render/adapters/GenericRendererAdapter.js +43 -0
  1584. package/src/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +151 -0
  1585. package/src/engine/graphics/ecs/mesh-v2/render/optimization/RuntimeDrawMethodOptimizer.js +126 -0
  1586. package/src/engine/graphics/ecs/mesh-v2/sample/load_gltf.js +130 -0
  1587. package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +173 -0
  1588. package/src/engine/graphics/ecs/mesh-v2/sample/prototype_sg_raycast.js +214 -0
  1589. package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.d.ts +4 -0
  1590. package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.js +31 -0
  1591. package/src/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.d.ts +4 -0
  1592. package/src/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.js +49 -0
  1593. package/src/engine/graphics/ecs/path/PathDisplay.d.ts +9 -0
  1594. package/src/engine/graphics/ecs/path/PathDisplay.js +30 -0
  1595. package/src/engine/graphics/ecs/path/PathDisplayEvents.d.ts +3 -0
  1596. package/src/engine/graphics/ecs/path/PathDisplayEvents.js +8 -0
  1597. package/src/engine/graphics/ecs/path/PathDisplaySpec.d.ts +11 -0
  1598. package/src/engine/graphics/ecs/path/PathDisplaySpec.js +70 -0
  1599. package/src/engine/graphics/ecs/path/PathDisplaySystem.d.ts +10 -0
  1600. package/src/engine/graphics/ecs/path/PathDisplaySystem.js +354 -0
  1601. package/src/engine/graphics/ecs/path/PathDisplayType.d.ts +6 -0
  1602. package/src/engine/graphics/ecs/path/PathDisplayType.js +10 -0
  1603. package/src/engine/graphics/ecs/path/entity/EntityPath.js +235 -0
  1604. package/src/engine/graphics/ecs/path/entity/EntityPathMarker.js +29 -0
  1605. package/src/engine/graphics/ecs/path/entity/EntityPathMarkerDefinition.d.ts +8 -0
  1606. package/src/engine/graphics/ecs/path/entity/EntityPathMarkerDefinition.js +65 -0
  1607. package/src/engine/graphics/ecs/path/entity/EntityPathStyle.d.ts +12 -0
  1608. package/src/engine/graphics/ecs/path/entity/EntityPathStyle.js +46 -0
  1609. package/src/engine/graphics/ecs/path/entity/testEntityPath.js +148 -0
  1610. package/src/engine/graphics/ecs/path/highlight/PathDisplayHighlightSystem.d.ts +7 -0
  1611. package/src/engine/graphics/ecs/path/highlight/PathDisplayHighlightSystem.js +141 -0
  1612. package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js +149 -0
  1613. package/src/engine/graphics/ecs/path/ribbon/RibbonPathStyle.d.ts +7 -0
  1614. package/src/engine/graphics/ecs/path/ribbon/RibbonPathStyle.js +29 -0
  1615. package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +459 -0
  1616. package/src/engine/graphics/ecs/path/tube/BasicMaterialDefinition.d.ts +3 -0
  1617. package/src/engine/graphics/ecs/path/tube/BasicMaterialDefinition.js +8 -0
  1618. package/src/engine/graphics/ecs/path/tube/CapType.d.ts +5 -0
  1619. package/src/engine/graphics/ecs/path/tube/CapType.js +9 -0
  1620. package/src/engine/graphics/ecs/path/tube/MatcapMaterialDefinition.d.ts +3 -0
  1621. package/src/engine/graphics/ecs/path/tube/MatcapMaterialDefinition.js +17 -0
  1622. package/src/engine/graphics/ecs/path/tube/PathNormalType.d.ts +4 -0
  1623. package/src/engine/graphics/ecs/path/tube/PathNormalType.js +11 -0
  1624. package/src/engine/graphics/ecs/path/tube/StandardMaterialDefinition.d.ts +4 -0
  1625. package/src/engine/graphics/ecs/path/tube/StandardMaterialDefinition.js +15 -0
  1626. package/src/engine/graphics/ecs/path/tube/TubeMaterialType.d.ts +6 -0
  1627. package/src/engine/graphics/ecs/path/tube/TubeMaterialType.js +6 -0
  1628. package/src/engine/graphics/ecs/path/tube/TubePathStyle.d.ts +35 -0
  1629. package/src/engine/graphics/ecs/path/tube/TubePathStyle.js +235 -0
  1630. package/src/engine/graphics/ecs/path/tube/TubePathStyle.spec.js +5 -0
  1631. package/src/engine/graphics/ecs/path/tube/build/StreamGeometryBuilder.js +90 -0
  1632. package/src/engine/graphics/ecs/path/tube/build/TubePathBuilder.js +203 -0
  1633. package/src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.js +75 -0
  1634. package/src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.spec.js +32 -0
  1635. package/src/engine/graphics/ecs/path/tube/build/build_geometry_linear.js +70 -0
  1636. package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +191 -0
  1637. package/src/engine/graphics/ecs/path/tube/build/compute_smooth_profile_normals.js +41 -0
  1638. package/src/engine/graphics/ecs/path/tube/build/estimatePathLength.js +17 -0
  1639. package/src/engine/graphics/ecs/path/tube/build/estimatePathViaIterativeIntegral.js +37 -0
  1640. package/src/engine/graphics/ecs/path/tube/build/fix_shape_normal_order.js +45 -0
  1641. package/src/engine/graphics/ecs/path/tube/build/makeTubeGeometry.js +201 -0
  1642. package/src/engine/graphics/ecs/path/tube/build/make_cap.js +274 -0
  1643. package/src/engine/graphics/ecs/path/tube/build/make_ring_faces.js +40 -0
  1644. package/src/engine/graphics/ecs/path/tube/build/make_ring_vertices.js +152 -0
  1645. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +392 -0
  1646. package/src/engine/graphics/ecs/sprite/Sprite.js +11 -0
  1647. package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +133 -0
  1648. package/src/engine/graphics/ecs/sprite/prototypeSpriteSystem.js +1570 -0
  1649. package/src/engine/graphics/ecs/trail/Trail.js +83 -0
  1650. package/src/engine/graphics/ecs/trail/TrailMaterial.js +67 -0
  1651. package/src/engine/graphics/ecs/trail/TrailMaterial2.js +73 -0
  1652. package/src/engine/graphics/ecs/trail/TrailSystem.js +162 -0
  1653. package/src/engine/graphics/ecs/trail2d/Trail2D.js +230 -0
  1654. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +6 -0
  1655. package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +287 -0
  1656. package/src/engine/graphics/ecs/trail2d/makeGradientTrail.js +68 -0
  1657. package/src/engine/graphics/ecs/water/Water.js +178 -0
  1658. package/src/engine/graphics/ecs/water/WaterSerializationAdapter.js +65 -0
  1659. package/src/engine/graphics/ecs/water/WaterSerializationUpgrader_0_1.js +48 -0
  1660. package/src/engine/graphics/ecs/water/WaterSystem.js +338 -0
  1661. package/src/engine/graphics/ecs/water2/NodeWaterShader1.js +213 -0
  1662. package/src/engine/graphics/ecs/water2/shader/AlexWaterShader.js +243 -0
  1663. package/src/engine/graphics/ecs/water2/shader/JBWaterShader.js +315 -0
  1664. package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +161 -0
  1665. package/src/engine/graphics/filter/FlipArrayInPlace.js +30 -0
  1666. package/src/engine/graphics/filter/FlipArrayViaCanvas.js +13 -0
  1667. package/src/engine/graphics/filter/ImageFilter.js +84 -0
  1668. package/src/engine/graphics/geometry/AttributeSpec.d.ts +8 -0
  1669. package/src/engine/graphics/geometry/AttributeSpec.js +120 -0
  1670. package/src/engine/graphics/geometry/BufferGeometryWrap.js +25 -0
  1671. package/src/engine/graphics/geometry/FULL_SCREEN_TRIANGLE_GEOMETRY.js +18 -0
  1672. package/src/engine/graphics/geometry/MikkT/AddTriToGroup.js +10 -0
  1673. package/src/engine/graphics/geometry/MikkT/AssignRecur.js +84 -0
  1674. package/src/engine/graphics/geometry/MikkT/AvgTSpace.js +38 -0
  1675. package/src/engine/graphics/geometry/MikkT/Build4RuleGroups.js +96 -0
  1676. package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +137 -0
  1677. package/src/engine/graphics/geometry/MikkT/CalcTexArea.js +31 -0
  1678. package/src/engine/graphics/geometry/MikkT/CompareSubGroups.js +26 -0
  1679. package/src/engine/graphics/geometry/MikkT/DegenEpilogue.js +220 -0
  1680. package/src/engine/graphics/geometry/MikkT/DegenPrologue.js +115 -0
  1681. package/src/engine/graphics/geometry/MikkT/EvalTspace.js +128 -0
  1682. package/src/engine/graphics/geometry/MikkT/GenerateInitialVerticesIndexList.js +48 -0
  1683. package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +184 -0
  1684. package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +226 -0
  1685. package/src/engine/graphics/geometry/MikkT/GetEdge.js +45 -0
  1686. package/src/engine/graphics/geometry/MikkT/GetNormal.js +16 -0
  1687. package/src/engine/graphics/geometry/MikkT/GetPosition.js +25 -0
  1688. package/src/engine/graphics/geometry/MikkT/GetTexCoord.js +18 -0
  1689. package/src/engine/graphics/geometry/MikkT/InitTriInfo.js +180 -0
  1690. package/src/engine/graphics/geometry/MikkT/Length.js +10 -0
  1691. package/src/engine/graphics/geometry/MikkT/MakeIndex.js +18 -0
  1692. package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +339 -0
  1693. package/src/engine/graphics/geometry/MikkT/MikkTSpace.spec.js +28 -0
  1694. package/src/engine/graphics/geometry/MikkT/NormalizeSafe.js +21 -0
  1695. package/src/engine/graphics/geometry/MikkT/NotZero.js +10 -0
  1696. package/src/engine/graphics/geometry/MikkT/QuickSort.js +54 -0
  1697. package/src/engine/graphics/geometry/MikkT/QuickSortEdges.js +71 -0
  1698. package/src/engine/graphics/geometry/MikkT/SSubGroup.js +15 -0
  1699. package/src/engine/graphics/geometry/MikkT/STSpace.js +36 -0
  1700. package/src/engine/graphics/geometry/MikkT/buffer_geometry_ensure_tangents.js +34 -0
  1701. package/src/engine/graphics/geometry/MikkT/buffer_geometry_generate_tangents.js +28 -0
  1702. package/src/engine/graphics/geometry/MikkT/constants/GROUP_WITH_ANY.js +1 -0
  1703. package/src/engine/graphics/geometry/MikkT/constants/INTERNAL_RND_SORT_SEED.js +1 -0
  1704. package/src/engine/graphics/geometry/MikkT/constants/MARK_DEGENERATE.js +1 -0
  1705. package/src/engine/graphics/geometry/MikkT/constants/ORIENT_PRESERVING.js +1 -0
  1706. package/src/engine/graphics/geometry/MikkT/constants/QUAD_ONE_DEGEN_TRI.js +1 -0
  1707. package/src/engine/graphics/geometry/MikkT/m_getNormal.js +16 -0
  1708. package/src/engine/graphics/geometry/MikkT/m_getNumFaces.js +8 -0
  1709. package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.js +11 -0
  1710. package/src/engine/graphics/geometry/MikkT/m_getPosition.js +20 -0
  1711. package/src/engine/graphics/geometry/MikkT/m_getTexCoord.js +16 -0
  1712. package/src/engine/graphics/geometry/MikkT/m_setTSpace.js +35 -0
  1713. package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.js +22 -0
  1714. package/src/engine/graphics/geometry/MikkT/malloc.js +16 -0
  1715. package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.js +52 -0
  1716. package/src/engine/graphics/geometry/QuadGeometry.js +13 -0
  1717. package/src/engine/graphics/geometry/VertexDataSpec.d.ts +15 -0
  1718. package/src/engine/graphics/geometry/VertexDataSpec.js +220 -0
  1719. package/src/engine/graphics/geometry/aabb3_to_buffer_geometry.js +30 -0
  1720. package/src/engine/graphics/geometry/buffered/ComputeNormals.js +101 -0
  1721. package/src/engine/graphics/geometry/buffered/computeBufferAttributeHash.js +27 -0
  1722. package/src/engine/graphics/geometry/buffered/computeGeometryBoundingSphereMiniball.js +17 -0
  1723. package/src/engine/graphics/geometry/buffered/computeGeometryEquality.js +56 -0
  1724. package/src/engine/graphics/geometry/buffered/computeGeometryHash.js +26 -0
  1725. package/src/engine/graphics/geometry/buffered/compute_buffer_geometry_byte_size.js +16 -0
  1726. package/src/engine/graphics/geometry/buffered/deinterleaveBufferAttribute.js +40 -0
  1727. package/src/engine/graphics/geometry/buffered/deinterleaveBufferGeometry.js +50 -0
  1728. package/src/engine/graphics/geometry/buffered/ensureGeometryBoundingSphere.js +19 -0
  1729. package/src/engine/graphics/geometry/buffered/makeGeometryIndexed.js +24 -0
  1730. package/src/engine/graphics/geometry/buffered/query/ClippingPlaneContainmentComputingVisitor.js +195 -0
  1731. package/src/engine/graphics/geometry/buffered/query/GeometrySpatialQueryAccelerator.d.ts +25 -0
  1732. package/src/engine/graphics/geometry/buffered/query/GeometrySpatialQueryAccelerator.js +219 -0
  1733. package/src/engine/graphics/geometry/buffered/query/GeometryVisitor.js +87 -0
  1734. package/src/engine/graphics/geometry/buffered/query/RaycastNearestHitComputingVisitor.js +206 -0
  1735. package/src/engine/graphics/geometry/bvh/BVHFromGeometry.js +72 -0
  1736. package/src/engine/graphics/geometry/bvh/buffered/BVHFromBufferGeometry.js +133 -0
  1737. package/src/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +234 -0
  1738. package/src/engine/graphics/geometry/bvh/buffered/BinaryBVHFromBufferGeometry.js +123 -0
  1739. package/src/engine/graphics/geometry/bvh/buffered/IndexedTraingleBoundsComputer.js +43 -0
  1740. package/src/engine/graphics/geometry/clipping/ClippedGeometry.js +144 -0
  1741. package/src/engine/graphics/geometry/computeBoundingSphereFromVertexData.js +29 -0
  1742. package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +88 -0
  1743. package/src/engine/graphics/geometry/compute_geometry_polycount.js +21 -0
  1744. package/src/engine/graphics/geometry/decimation/SimplifyModifier.js +971 -0
  1745. package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +570 -0
  1746. package/src/engine/graphics/geometry/instancing/rewriteMaterial.js +53 -0
  1747. package/src/engine/graphics/geometry/optimization/VertexCacheOptimizer.js +437 -0
  1748. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +327 -0
  1749. package/src/engine/graphics/geometry/optimization/merge/prototypeGeometryMerge.js +176 -0
  1750. package/src/engine/graphics/geometry/ribbon/Quad.js +213 -0
  1751. package/src/engine/graphics/geometry/ribbon/Ribbon.js +256 -0
  1752. package/src/engine/graphics/geometry/ribbon/copyAttributeV3.js +12 -0
  1753. package/src/engine/graphics/geometry/ribbon/copyAttributeValue.js +17 -0
  1754. package/src/engine/graphics/geometry/ribbon/createRibbon.js +66 -0
  1755. package/src/engine/graphics/geometry/ribbon/equalAttributeV3.js +13 -0
  1756. package/src/engine/graphics/geometry/ribbon/equalAttributeValue.js +24 -0
  1757. package/src/engine/graphics/geometry/ribbon/rotateRibbon.js +37 -0
  1758. package/src/engine/graphics/geometry/ribbon/updateTipPosition.js +52 -0
  1759. package/src/engine/graphics/geometry/scaleGeometryToBox.js +23 -0
  1760. package/src/engine/graphics/geometry/skining/computeSkinnedMeshBoundingVolumes.js +33 -0
  1761. package/src/engine/graphics/geometry/skining/computeSkinnedMeshVertices.js +140 -0
  1762. package/src/engine/graphics/impostors/card_cluster/FacePlaneAssignment.js +30 -0
  1763. package/src/engine/graphics/impostors/card_cluster/README.md +13 -0
  1764. package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +349 -0
  1765. package/src/engine/graphics/impostors/octahedral/ImpostorCaptureType.js +10 -0
  1766. package/src/engine/graphics/impostors/octahedral/ImpostorDescription.js +87 -0
  1767. package/src/engine/graphics/impostors/octahedral/README.md +34 -0
  1768. package/src/engine/graphics/impostors/octahedral/bake/compute_bounding_sphere.js +45 -0
  1769. package/src/engine/graphics/impostors/octahedral/bake/compute_bounding_sphere_radius_only.js +37 -0
  1770. package/src/engine/graphics/impostors/octahedral/bake/prepare_bake_material.js +132 -0
  1771. package/src/engine/graphics/impostors/octahedral/grid/HemiOctahedralUvEncoder.js +20 -0
  1772. package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js +25 -0
  1773. package/src/engine/graphics/impostors/octahedral/grid/UvEncoder.js +21 -0
  1774. package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +225 -0
  1775. package/src/engine/graphics/impostors/octahedral/shader/BakeShaderStandard.js +196 -0
  1776. package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderStandard.js +306 -0
  1777. package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderV0.js +365 -0
  1778. package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderV1.js +74 -0
  1779. package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderWireframeV0.js +134 -0
  1780. package/src/engine/graphics/impostors/octahedral/shader/glsl/common.glsl +206 -0
  1781. package/src/engine/graphics/impostors/octahedral/shader/glsl/v1/common.glsl +209 -0
  1782. package/src/engine/graphics/impostors/octahedral/shader/glsl/v1/flagment.glsl +80 -0
  1783. package/src/engine/graphics/impostors/octahedral/shader/glsl/v1/vertex.glsl +350 -0
  1784. package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +128 -0
  1785. package/src/engine/graphics/impostors/octahedral/util/build_geometry_from_cutout_shape.js +32 -0
  1786. package/src/engine/graphics/impostors/octahedral/util/load_mesh_for_bake.js +31 -0
  1787. package/src/engine/graphics/impostors/octahedral/util/makeImpostorAtlasPreview.js +107 -0
  1788. package/src/engine/graphics/loadCubeTexture.js +32 -0
  1789. package/src/engine/graphics/loader/threejs/GLTFLoader.js +3179 -0
  1790. package/src/engine/graphics/loader/threejs/LegacyJSONLoader.js +845 -0
  1791. package/src/engine/graphics/makeModelView.js +47 -0
  1792. package/src/engine/graphics/material/LoadMaterial.js +199 -0
  1793. package/src/engine/graphics/material/SplatMaterial.js +170 -0
  1794. package/src/engine/graphics/material/WaterMaterial.js +73 -0
  1795. package/src/engine/graphics/material/composeCompile.js +37 -0
  1796. package/src/engine/graphics/material/getTextureImmediate.js +19 -0
  1797. package/src/engine/graphics/material/manager/AbstractMaterialTransformer.js +10 -0
  1798. package/src/engine/graphics/material/manager/ManagedMaterial.js +78 -0
  1799. package/src/engine/graphics/material/manager/ManagedTexture.js +3 -0
  1800. package/src/engine/graphics/material/manager/MaterialManager.js +169 -0
  1801. package/src/engine/graphics/material/manager/TextureManager.js +3 -0
  1802. package/src/engine/graphics/material/manager/compilers/CoalesceTextures.js +70 -0
  1803. package/src/engine/graphics/material/optimization/BUFFER_GEOMETRY_UVS.js +10 -0
  1804. package/src/engine/graphics/material/optimization/MaterialDescriptor.js +46 -0
  1805. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +871 -0
  1806. package/src/engine/graphics/material/optimization/UvContext.js +18 -0
  1807. package/src/engine/graphics/material/optimization/is_compliant_mesh.js +71 -0
  1808. package/src/engine/graphics/material/optimization/prepare_atlas_texture.js +23 -0
  1809. package/src/engine/graphics/material/optimization/prototypeMaterialOptimizer.js +129 -0
  1810. package/src/engine/graphics/micron/MICRON_GEOMETRY_FIELD.js +1 -0
  1811. package/src/engine/graphics/micron/MICRON_URI_FIELD.js +1 -0
  1812. package/src/engine/graphics/micron/build/MICRON_PATCH_SIZE_MAX.js +5 -0
  1813. package/src/engine/graphics/micron/build/PatchRepresentation.js +424 -0
  1814. package/src/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +311 -0
  1815. package/src/engine/graphics/micron/build/build_geometry_info.js +21 -0
  1816. package/src/engine/graphics/micron/build/clustering/assignInitialPatchNeighbours.js +63 -0
  1817. package/src/engine/graphics/micron/build/clustering/assign_patch_neighbours_from_topology.js +46 -0
  1818. package/src/engine/graphics/micron/build/clustering/build_clustering_2.js +37 -0
  1819. package/src/engine/graphics/micron/build/clustering/build_leaf_patches.js +326 -0
  1820. package/src/engine/graphics/micron/build/clustering/build_leaf_patches_metis.js +76 -0
  1821. package/src/engine/graphics/micron/build/clustering/computeBorderLengthChange.js +59 -0
  1822. package/src/engine/graphics/micron/build/clustering/computeFaceCurvatureScore.js +57 -0
  1823. package/src/engine/graphics/micron/build/clustering/computeOpenFaceFreedom.js +35 -0
  1824. package/src/engine/graphics/micron/build/clustering/compute_face_connection_weight.js +35 -0
  1825. package/src/engine/graphics/micron/build/clustering/populateOpenFaceNeighboursForPatch.js +56 -0
  1826. package/src/engine/graphics/micron/build/clustering/validate_leaf_patch_connectivity.js +44 -0
  1827. package/src/engine/graphics/micron/build/compute_micron_buffer_array_constructor.js +24 -0
  1828. package/src/engine/graphics/micron/build/compute_vertex_remap_cost.js +29 -0
  1829. package/src/engine/graphics/micron/build/debug/build_clustering_info.js +58 -0
  1830. package/src/engine/graphics/micron/build/debug/build_graph_info.js +59 -0
  1831. package/src/engine/graphics/micron/build/fill_patch_geometry_data.js +270 -0
  1832. package/src/engine/graphics/micron/build/hierarchy/buildAbstractPatchHierarchy.js +196 -0
  1833. package/src/engine/graphics/micron/build/hierarchy/build_intermediate_patch_topology.js +162 -0
  1834. package/src/engine/graphics/micron/build/hierarchy/build_merge_graph.js +89 -0
  1835. package/src/engine/graphics/micron/build/hierarchy/computePatchMergeScore.js +146 -0
  1836. package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertex_count.js +32 -0
  1837. package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertices.js +34 -0
  1838. package/src/engine/graphics/micron/build/hierarchy/merge_patches.js +581 -0
  1839. package/src/engine/graphics/micron/build/hierarchy/metis_cluster_clusters.js +53 -0
  1840. package/src/engine/graphics/micron/build/hierarchy/optimize_graph_partitioning_balance.js +515 -0
  1841. package/src/engine/graphics/micron/build/hierarchy/patch_combine.js +180 -0
  1842. package/src/engine/graphics/micron/build/hierarchy/patch_fill_holes_by_uncollapse.js +60 -0
  1843. package/src/engine/graphics/micron/build/hierarchy/patch_stitch_parent_border.js +320 -0
  1844. package/src/engine/graphics/micron/build/hierarchy/qvdr_build_simplified_clusters.js +547 -0
  1845. package/src/engine/graphics/micron/build/hierarchy/qvdr_build_tree.js +140 -0
  1846. package/src/engine/graphics/micron/buildPatchwork.js +68 -0
  1847. package/src/engine/graphics/micron/convert_three_object_to_micron.js +179 -0
  1848. package/src/engine/graphics/micron/debug/VirtualGeometryStats.js +42 -0
  1849. package/src/engine/graphics/micron/format/MICRON_GEOMETRY_PROPERTY_NAME.js +1 -0
  1850. package/src/engine/graphics/micron/format/MicronGeometry.d.ts +21 -0
  1851. package/src/engine/graphics/micron/format/MicronGeometry.js +334 -0
  1852. package/src/engine/graphics/micron/format/MicronGeometryPatch.d.ts +3 -0
  1853. package/src/engine/graphics/micron/format/MicronGeometryPatch.js +205 -0
  1854. package/src/engine/graphics/micron/format/MicronGeometryPatchOccurance.js +50 -0
  1855. package/src/engine/graphics/micron/format/ThreeMicronMesh.d.ts +10 -0
  1856. package/src/engine/graphics/micron/format/ThreeMicronMesh.js +45 -0
  1857. package/src/engine/graphics/micron/format/VirtualGeometry.js +158 -0
  1858. package/src/engine/graphics/micron/format/micron_build_proxy_geometry.js +205 -0
  1859. package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +123 -0
  1860. package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.spec.js +63 -0
  1861. package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +83 -0
  1862. package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.spec.js +51 -0
  1863. package/src/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +25 -0
  1864. package/src/engine/graphics/micron/format/serialization/deserialize_patch.js +106 -0
  1865. package/src/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +18 -0
  1866. package/src/engine/graphics/micron/format/serialization/serialize_patch.js +84 -0
  1867. package/src/engine/graphics/micron/format/validate_patch_bounds.js +69 -0
  1868. package/src/engine/graphics/micron/plugin/GLTFAssetTransformer.js +265 -0
  1869. package/src/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +5 -0
  1870. package/src/engine/graphics/micron/plugin/MicronRenderPlugin.d.ts +8 -0
  1871. package/src/engine/graphics/micron/plugin/MicronRenderPlugin.js +150 -0
  1872. package/src/engine/graphics/micron/plugin/serialization/BufferGeometrySerializationAdapter.js +176 -0
  1873. package/src/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +216 -0
  1874. package/src/engine/graphics/micron/prototypeMicronProxyBuild.js +227 -0
  1875. package/src/engine/graphics/micron/prototypeVirtualGeometry.js +911 -0
  1876. package/src/engine/graphics/micron/render/PatchCacheKey.js +79 -0
  1877. package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.d.ts +1 -0
  1878. package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.js +1 -0
  1879. package/src/engine/graphics/micron/render/VirtualGeometryBuilder.js +207 -0
  1880. package/src/engine/graphics/micron/render/approximateTriangleArea.js +25 -0
  1881. package/src/engine/graphics/micron/render/culling/PatchCullingSystem.js +129 -0
  1882. package/src/engine/graphics/micron/render/instanced/AttributeDataTexture.js +294 -0
  1883. package/src/engine/graphics/micron/render/instanced/PatchDataTextures.js +325 -0
  1884. package/src/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +175 -0
  1885. package/src/engine/graphics/micron/render/instanced/shader/constants.js +3 -0
  1886. package/src/engine/graphics/micron/render/instanced/shader/gen_micron_vertex_attribute_texture_name.js +8 -0
  1887. package/src/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +250 -0
  1888. package/src/engine/graphics/micron/render/makeThreeMeshFromVirtualGeometry.js +37 -0
  1889. package/src/engine/graphics/micron/render/refinement/ActivePatchFlags.js +8 -0
  1890. package/src/engine/graphics/micron/render/refinement/ActivePatchList.js +241 -0
  1891. package/src/engine/graphics/micron/render/refinement/ActivePatchRecord.js +154 -0
  1892. package/src/engine/graphics/micron/render/refinement/RefinementSpec.js +84 -0
  1893. package/src/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +133 -0
  1894. package/src/engine/graphics/micron/render/refinement/is_patch_facing_back.js +43 -0
  1895. package/src/engine/graphics/micron/render/refinement/is_patch_visible.js +37 -0
  1896. package/src/engine/graphics/micron/render/v1/MaterialContext.js +150 -0
  1897. package/src/engine/graphics/micron/render/v1/MaterialVertexSpec.js +115 -0
  1898. package/src/engine/graphics/micron/render/v1/MicronRenderContext.js +145 -0
  1899. package/src/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +255 -0
  1900. package/src/engine/graphics/micron/render/v1/VGThreeRenderer.js +142 -0
  1901. package/src/engine/graphics/micron/render/v1/getTransformedPositionsCached.js +54 -0
  1902. package/src/engine/graphics/micron/simplifyGeometry.js +26 -0
  1903. package/src/engine/graphics/micron/util/patchToBufferGeometry.js +19 -0
  1904. package/src/engine/graphics/particles/ParticleEmitterLibrary.js +87 -0
  1905. package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.d.ts +7 -0
  1906. package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.js +261 -0
  1907. package/src/engine/graphics/particles/node-based/codegen/CodeContext.js +50 -0
  1908. package/src/engine/graphics/particles/node-based/codegen/CodeGenerator.js +19 -0
  1909. package/src/engine/graphics/particles/node-based/codegen/glsl/GLSLCodeGenerator.js +249 -0
  1910. package/src/engine/graphics/particles/node-based/codegen/glsl/genAttributeInputName.js +8 -0
  1911. package/src/engine/graphics/particles/node-based/codegen/glsl/genAttributeOutputName.js +8 -0
  1912. package/src/engine/graphics/particles/node-based/codegen/glsl/getTypeByteSize.js +21 -0
  1913. package/src/engine/graphics/particles/node-based/codegen/glsl/modules/noise/curl/glslm_curlNoise.js +58 -0
  1914. package/src/engine/graphics/particles/node-based/codegen/glsl/modules/noise/curl/glslm_snoiseVector3.js +44 -0
  1915. package/src/engine/graphics/particles/node-based/codegen/glsl/modules/noise/simplex/3d/glslm_mod289_v3.js +28 -0
  1916. package/src/engine/graphics/particles/node-based/codegen/glsl/modules/noise/simplex/3d/glslm_mod289_v4.js +28 -0
  1917. package/src/engine/graphics/particles/node-based/codegen/glsl/modules/noise/simplex/3d/glslm_permute.js +39 -0
  1918. package/src/engine/graphics/particles/node-based/codegen/glsl/modules/noise/simplex/3d/glslm_snoise.js +124 -0
  1919. package/src/engine/graphics/particles/node-based/codegen/glsl/modules/noise/simplex/3d/glslm_tylorInvSqrt.js +30 -0
  1920. package/src/engine/graphics/particles/node-based/codegen/modules/FunctionModule.js +125 -0
  1921. package/src/engine/graphics/particles/node-based/codegen/modules/FunctionModuleReference.js +64 -0
  1922. package/src/engine/graphics/particles/node-based/codegen/modules/FunctionModuleRegistry.js +275 -0
  1923. package/src/engine/graphics/particles/node-based/codegen/modules/FunctionParameterSpecification.js +59 -0
  1924. package/src/engine/graphics/particles/node-based/codegen/modules/FunctionSignature.js +57 -0
  1925. package/src/engine/graphics/particles/node-based/editor/ParticleSpecificationEditorView.js +176 -0
  1926. package/src/engine/graphics/particles/node-based/nodes/FloatConstant.js +31 -0
  1927. package/src/engine/graphics/particles/node-based/nodes/ParticleDataTypes.js +13 -0
  1928. package/src/engine/graphics/particles/node-based/nodes/ReadFloatUniform.js +26 -0
  1929. package/src/engine/graphics/particles/node-based/nodes/ReadPosition.js +5 -0
  1930. package/src/engine/graphics/particles/node-based/nodes/ReadVelocity.js +14 -0
  1931. package/src/engine/graphics/particles/node-based/nodes/ShaderNode.js +73 -0
  1932. package/src/engine/graphics/particles/node-based/nodes/Vector3Constant.js +30 -0
  1933. package/src/engine/graphics/particles/node-based/nodes/Vector3Merge.js +30 -0
  1934. package/src/engine/graphics/particles/node-based/nodes/Vector3Split.js +32 -0
  1935. package/src/engine/graphics/particles/node-based/nodes/WriteVelocity.js +15 -0
  1936. package/src/engine/graphics/particles/node-based/nodes/attribute/ReadVector3Attribute.js +27 -0
  1937. package/src/engine/graphics/particles/node-based/nodes/attribute/WriteVector3Attribute.js +25 -0
  1938. package/src/engine/graphics/particles/node-based/nodes/math/AddFloatNode.js +26 -0
  1939. package/src/engine/graphics/particles/node-based/nodes/math/Vector3Add.js +25 -0
  1940. package/src/engine/graphics/particles/node-based/nodes/math/Vector3Divide.js +25 -0
  1941. package/src/engine/graphics/particles/node-based/nodes/math/Vector3Multiply.js +25 -0
  1942. package/src/engine/graphics/particles/node-based/nodes/math/Vector3Subtract.js +25 -0
  1943. package/src/engine/graphics/particles/node-based/nodes/noise/CurlNoiseNode.js +39 -0
  1944. package/src/engine/graphics/particles/node-based/particle/GeometryAttributes.js +10 -0
  1945. package/src/engine/graphics/particles/node-based/particle/ParticleAttributeBinding.js +14 -0
  1946. package/src/engine/graphics/particles/node-based/particle/ParticleAttributeSpecification.js +60 -0
  1947. package/src/engine/graphics/particles/node-based/particle/ParticleSpecification.js +95 -0
  1948. package/src/engine/graphics/particles/node-based/populateFunctionModuleRegistry.js +23 -0
  1949. package/src/engine/graphics/particles/node-based/populateNodeRegistry.js +48 -0
  1950. package/src/engine/graphics/particles/node-based/rendering/AbstractParticleRenderer.js +37 -0
  1951. package/src/engine/graphics/particles/node-based/rendering/ParticleRenderCommand.js +37 -0
  1952. package/src/engine/graphics/particles/node-based/rendering/ParticleRenderSpecification.js +19 -0
  1953. package/src/engine/graphics/particles/node-based/rendering/billboard/BillboardParticleRenderer.js +170 -0
  1954. package/src/engine/graphics/particles/node-based/rendering/billboard/ParticleBillboardShader.js +150 -0
  1955. package/src/engine/graphics/particles/node-based/simulation/EmitterAttributeData.js +107 -0
  1956. package/src/engine/graphics/particles/node-based/simulation/GLDataBuffer.js +105 -0
  1957. package/src/engine/graphics/particles/node-based/simulation/GLSLParticleSimulator.js +6 -0
  1958. package/src/engine/graphics/particles/node-based/simulation/GLSLSimulationShader.js +192 -0
  1959. package/src/engine/graphics/particles/node-based/simulation/TransformFeedback.js +418 -0
  1960. package/src/engine/graphics/particles/particular/engine/MovingBoundingBox.js +157 -0
  1961. package/src/engine/graphics/particles/particular/engine/MovingBoundingBox.spec.js +70 -0
  1962. package/src/engine/graphics/particles/particular/engine/ParticularEngine.js +267 -0
  1963. package/src/engine/graphics/particles/particular/engine/TF.js +250 -0
  1964. package/src/engine/graphics/particles/particular/engine/emitter/EmissionFromType.js +8 -0
  1965. package/src/engine/graphics/particles/particular/engine/emitter/EmissionShapeType.js +9 -0
  1966. package/src/engine/graphics/particles/particular/engine/emitter/PARTICLE_ATTRIBUTES.js +12 -0
  1967. package/src/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +84 -0
  1968. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts +2 -0
  1969. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +1224 -0
  1970. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.spec.js +47 -0
  1971. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js +67 -0
  1972. package/src/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +400 -0
  1973. package/src/engine/graphics/particles/particular/engine/emitter/ParticleLayer.spec.js +75 -0
  1974. package/src/engine/graphics/particles/particular/engine/emitter/ParticleParameters.js +4 -0
  1975. package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +606 -0
  1976. package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +188 -0
  1977. package/src/engine/graphics/particles/particular/engine/emitter/ParticleRenderProfile.js +18 -0
  1978. package/src/engine/graphics/particles/particular/engine/emitter/ParticleRendererType.js +10 -0
  1979. package/src/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +37 -0
  1980. package/src/engine/graphics/particles/particular/engine/emitter/distance_to_camera.js +25 -0
  1981. package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +105 -0
  1982. package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationAdapter.js +165 -0
  1983. package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationUpgrader_0_1.js +107 -0
  1984. package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.d.ts +15 -0
  1985. package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +452 -0
  1986. package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.spec.js +215 -0
  1987. package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTableFlags.js +6 -0
  1988. package/src/engine/graphics/particles/particular/engine/parameter/ParameterSet.js +133 -0
  1989. package/src/engine/graphics/particles/particular/engine/parameter/ParameterSet.spec.js +75 -0
  1990. package/src/engine/graphics/particles/particular/engine/parameter/ParameterSheet.js +274 -0
  1991. package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrack.js +77 -0
  1992. package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrackSet.js +97 -0
  1993. package/src/engine/graphics/particles/particular/engine/parameter/ParticleParameter.js +232 -0
  1994. package/src/engine/graphics/particles/particular/engine/parameter/sample/RGBA_LUT_HEATMAP_IR.js +11 -0
  1995. package/src/engine/graphics/particles/particular/engine/renderers/ParticleRenderer.js +28 -0
  1996. package/src/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +24 -0
  1997. package/src/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +496 -0
  1998. package/src/engine/graphics/particles/particular/engine/renderers/billboard/SoftBillboardParticlePool.js +27 -0
  1999. package/src/engine/graphics/particles/particular/engine/renderers/billboard/SoftBillboardParticleRenderer.js +80 -0
  2000. package/src/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +164 -0
  2001. package/src/engine/graphics/particles/particular/engine/shader/MaterialRecord.js +43 -0
  2002. package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.js +462 -0
  2003. package/src/engine/graphics/particles/particular/engine/shader/debugAtlas.js +14 -0
  2004. package/src/engine/graphics/particles/particular/engine/simulator/AbstractSimulationStep.js +61 -0
  2005. package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.js +56 -0
  2006. package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.js +84 -0
  2007. package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.js +79 -0
  2008. package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepDefinition.js +44 -0
  2009. package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +104 -0
  2010. package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepType.js +11 -0
  2011. package/src/engine/graphics/particles/particular/engine/simulator/update_parameters.js +41 -0
  2012. package/src/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.js +234 -0
  2013. package/src/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +188 -0
  2014. package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.d.ts +16 -0
  2015. package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +201 -0
  2016. package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.d.ts +29 -0
  2017. package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +625 -0
  2018. package/src/engine/graphics/particles/particular/engine/utils/volume/SamplingFunctionKind.d.ts +4 -0
  2019. package/src/engine/graphics/particles/particular/engine/utils/volume/SamplingFunctionKind.js +8 -0
  2020. package/src/engine/graphics/particles/particular/engine/utils/volume/lut_to_sampler.js +27 -0
  2021. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1240 -0
  2022. package/src/engine/graphics/particles/particular/group/Operation.js +18 -0
  2023. package/src/engine/graphics/particles/particular/group/OperationType.js +9 -0
  2024. package/src/engine/graphics/particles/particular/group/ParticleAttribute.js +25 -0
  2025. package/src/engine/graphics/particles/particular/group/ParticleAttributeType.js +11 -0
  2026. package/src/engine/graphics/particles/particular/group/ParticleDataType.js +10 -0
  2027. package/src/engine/graphics/particles/particular/group/ParticleGroup.js +637 -0
  2028. package/src/engine/graphics/particles/particular/group/ParticleGroup.spec.js +270 -0
  2029. package/src/engine/graphics/particles/particular/group/ParticleSpecification.js +48 -0
  2030. package/src/engine/graphics/particles/particular/group/itemSizeFromAttributeType.js +20 -0
  2031. package/src/engine/graphics/particles/particular/group/optimizeCommandQueue.js +162 -0
  2032. package/src/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.js +19 -0
  2033. package/src/engine/graphics/postprocess/Postprocess.js +284 -0
  2034. package/src/engine/graphics/postprocess/threejs/Mirror.js +330 -0
  2035. package/src/engine/graphics/postprocess/threejs/WaterShader.js +306 -0
  2036. package/src/engine/graphics/postprocess/threejs/postprocessing/AdaptiveToneMappingPass.js +338 -0
  2037. package/src/engine/graphics/postprocess/threejs/postprocessing/BloomPass.js +132 -0
  2038. package/src/engine/graphics/postprocess/threejs/postprocessing/BokehPass.js +115 -0
  2039. package/src/engine/graphics/postprocess/threejs/postprocessing/ClearMaskPass.js +23 -0
  2040. package/src/engine/graphics/postprocess/threejs/postprocessing/DotScreenPass.js +60 -0
  2041. package/src/engine/graphics/postprocess/threejs/postprocessing/EffectComposer.js +150 -0
  2042. package/src/engine/graphics/postprocess/threejs/postprocessing/FilmPass.js +61 -0
  2043. package/src/engine/graphics/postprocess/threejs/postprocessing/GlitchPass.js +117 -0
  2044. package/src/engine/graphics/postprocess/threejs/postprocessing/MaskPass.js +69 -0
  2045. package/src/engine/graphics/postprocess/threejs/postprocessing/RenderPass.js +63 -0
  2046. package/src/engine/graphics/postprocess/threejs/postprocessing/SMAAPass.js +187 -0
  2047. package/src/engine/graphics/postprocess/threejs/postprocessing/SavePass.js +67 -0
  2048. package/src/engine/graphics/postprocess/threejs/postprocessing/ShaderPass.js +89 -0
  2049. package/src/engine/graphics/postprocess/threejs/postprocessing/TexturePass.js +50 -0
  2050. package/src/engine/graphics/postprocess/threejs/shaders/BokehShader.js +117 -0
  2051. package/src/engine/graphics/postprocess/threejs/shaders/ConvolutionShader.js +106 -0
  2052. package/src/engine/graphics/postprocess/threejs/shaders/CopyShader.js +47 -0
  2053. package/src/engine/graphics/postprocess/threejs/shaders/FXAAShader.js +90 -0
  2054. package/src/engine/graphics/postprocess/threejs/shaders/GammaCorrectionShader.js +52 -0
  2055. package/src/engine/graphics/postprocess/threejs/shaders/LuminosityShader.js +51 -0
  2056. package/src/engine/graphics/postprocess/threejs/shaders/SMAAShader.js +468 -0
  2057. package/src/engine/graphics/postprocess/threejs/shaders/SSAOShader.js +230 -0
  2058. package/src/engine/graphics/postprocess/threejs/shaders/ToneMapShader.js +76 -0
  2059. package/src/engine/graphics/render/Lines.js +122 -0
  2060. package/src/engine/graphics/render/RenderPassType.js +8 -0
  2061. package/src/engine/graphics/render/RendererPool.js +48 -0
  2062. package/src/engine/graphics/render/buffer/FrameBuffer.js +103 -0
  2063. package/src/engine/graphics/render/buffer/FrameBufferManager.js +228 -0
  2064. package/src/engine/graphics/render/buffer/RenderGraph.js +177 -0
  2065. package/src/engine/graphics/render/buffer/RenderGraphUtils.js +32 -0
  2066. package/src/engine/graphics/render/buffer/buffers/ColorAndDepthFrameBuffer.js +62 -0
  2067. package/src/engine/graphics/render/buffer/buffers/DepthFrameBuffer.js +101 -0
  2068. package/src/engine/graphics/render/buffer/buffers/NormalFrameBuffer.js +143 -0
  2069. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +396 -0
  2070. package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnection.js +43 -0
  2071. package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnectionEndpoint.js +39 -0
  2072. package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnectionValidator.js +30 -0
  2073. package/src/engine/graphics/render/buffer/executor/FrameBufferPool.js +127 -0
  2074. package/src/engine/graphics/render/buffer/executor/RenderGraphExecutor.js +261 -0
  2075. package/src/engine/graphics/render/buffer/executor/RenderProgramCommandType.js +5 -0
  2076. package/src/engine/graphics/render/buffer/node/DeferredRenderProgramDefinition.js +142 -0
  2077. package/src/engine/graphics/render/buffer/node/RenderProgramDefinition.js +21 -0
  2078. package/src/engine/graphics/render/buffer/node/RenderProgramInstance.js +30 -0
  2079. package/src/engine/graphics/render/buffer/node/ScreenSpaceRenderProgramDefinition.js +118 -0
  2080. package/src/engine/graphics/render/buffer/simple-fx/DepthLimitedBlur.js +191 -0
  2081. package/src/engine/graphics/render/buffer/simple-fx/SimplePostProcessEffect.js +10 -0
  2082. package/src/engine/graphics/render/buffer/simple-fx/SimplePostProcessEffectsManager.js +27 -0
  2083. package/src/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.d.ts +8 -0
  2084. package/src/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +384 -0
  2085. package/src/engine/graphics/render/buffer/simple-fx/ao/SAOShader.js +186 -0
  2086. package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +95 -0
  2087. package/src/engine/graphics/render/buffer/simple-fx/taa/prototypeTAA.js +61 -0
  2088. package/src/engine/graphics/render/buffer/slot/ProgramSlotValue.js +35 -0
  2089. package/src/engine/graphics/render/buffer/slot/ProgramValueDirectionKind.js +7 -0
  2090. package/src/engine/graphics/render/buffer/slot/ProgramValueSlotDefinition.js +33 -0
  2091. package/src/engine/graphics/render/buffer/slot/ProgramValueType.js +11 -0
  2092. package/src/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +61 -0
  2093. package/src/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.spec.js +21 -0
  2094. package/src/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterSet.js +44 -0
  2095. package/src/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterType.js +12 -0
  2096. package/src/engine/graphics/render/buffer/slot/parameter/RenderTargetParameters.js +9 -0
  2097. package/src/engine/graphics/render/forward_plus/LightManager.js +1157 -0
  2098. package/src/engine/graphics/render/forward_plus/LightManager.spec.js +94 -0
  2099. package/src/engine/graphics/render/forward_plus/PointLightData.js +57 -0
  2100. package/src/engine/graphics/render/forward_plus/SPECIFICATION.md +155 -0
  2101. package/src/engine/graphics/render/forward_plus/assign_cluster.js +125 -0
  2102. package/src/engine/graphics/render/forward_plus/cluster/compute_cluster_planes_from_points.js +98 -0
  2103. package/src/engine/graphics/render/forward_plus/cluster/compute_light_data_hash.js +17 -0
  2104. package/src/engine/graphics/render/forward_plus/cluster/compute_light_data_hash_0.js +17 -0
  2105. package/src/engine/graphics/render/forward_plus/cluster/read_plane_pair.js +29 -0
  2106. package/src/engine/graphics/render/forward_plus/cluster/write_cluster_planes.js +43 -0
  2107. package/src/engine/graphics/render/forward_plus/cluster/write_cluster_planes.spec.js +79 -0
  2108. package/src/engine/graphics/render/forward_plus/computeFrustumCorners.js +69 -0
  2109. package/src/engine/graphics/render/forward_plus/data/NumericType.js +9 -0
  2110. package/src/engine/graphics/render/forward_plus/data/TextureBackedMemoryRegion.js +279 -0
  2111. package/src/engine/graphics/render/forward_plus/data/channelCountToThreIntegerTextureType.js +16 -0
  2112. package/src/engine/graphics/render/forward_plus/data/computeDataType.js +36 -0
  2113. package/src/engine/graphics/render/forward_plus/data/computeThreeTextureFormat.js +18 -0
  2114. package/src/engine/graphics/render/forward_plus/data/computeThreeTextureInternalFormatFromDataType.js +63 -0
  2115. package/src/engine/graphics/render/forward_plus/data/computeThreeTextureTypeFromDataType.js +41 -0
  2116. package/src/engine/graphics/render/forward_plus/debug/LightClusterVolumeMaterial.js +99 -0
  2117. package/src/engine/graphics/render/forward_plus/debug/buildLightClusterWidget.js +67 -0
  2118. package/src/engine/graphics/render/forward_plus/debug/createLayerSwitcher.js +46 -0
  2119. package/src/engine/graphics/render/forward_plus/debug/createScreenGrid.js +327 -0
  2120. package/src/engine/graphics/render/forward_plus/materials/FP_INJECTION_POINT_ACCUMULATION.js +1 -0
  2121. package/src/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +40 -0
  2122. package/src/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_APPLY_DECALS.js +70 -0
  2123. package/src/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_DECODE_PARS.js +55 -0
  2124. package/src/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_LOAD_METADATA.js +11 -0
  2125. package/src/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_PREAMBLE.js +34 -0
  2126. package/src/engine/graphics/render/forward_plus/materials/FPlusDebugMaterial.js +173 -0
  2127. package/src/engine/graphics/render/forward_plus/materials/FPlusStandardMaterial.js +393 -0
  2128. package/src/engine/graphics/render/forward_plus/materials/ForwardPlusThreeMaterial.js +146 -0
  2129. package/src/engine/graphics/render/forward_plus/materials/ForwardPlusThreeShaderMaterial.js +31 -0
  2130. package/src/engine/graphics/render/forward_plus/materials/fp_build_fragment_shader.js +60 -0
  2131. package/src/engine/graphics/render/forward_plus/materials/fp_build_vertex_lighting_shared.js +38 -0
  2132. package/src/engine/graphics/render/forward_plus/materials/fp_build_vertex_shader.js +30 -0
  2133. package/src/engine/graphics/render/forward_plus/model/AbstractLight.js +70 -0
  2134. package/src/engine/graphics/render/forward_plus/model/Decal.js +117 -0
  2135. package/src/engine/graphics/render/forward_plus/model/DirectionalLight.js +40 -0
  2136. package/src/engine/graphics/render/forward_plus/model/PointLight.js +105 -0
  2137. package/src/engine/graphics/render/forward_plus/model/SpotLight.js +143 -0
  2138. package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.d.ts +5 -0
  2139. package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +91 -0
  2140. package/src/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +130 -0
  2141. package/src/engine/graphics/render/forward_plus/plugin/isLitMaterial.js +8 -0
  2142. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1203 -0
  2143. package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +1643 -0
  2144. package/src/engine/graphics/render/forward_plus/query/analytical_triplanar_corner_mapping.js +8 -0
  2145. package/src/engine/graphics/render/forward_plus/query/cube_mapping.js +38 -0
  2146. package/src/engine/graphics/render/forward_plus/query/detailed_sphere_frustum_intersection_test.js +88 -0
  2147. package/src/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +74 -0
  2148. package/src/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_objects.js +133 -0
  2149. package/src/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +166 -0
  2150. package/src/engine/graphics/render/forward_plus/query/spot_light_inside_volume.js +33 -0
  2151. package/src/engine/graphics/render/forward_plus/read_frustum_corner.js +14 -0
  2152. package/src/engine/graphics/render/forward_plus/sort_decal_data.js +102 -0
  2153. package/src/engine/graphics/render/forward_plus/testClusterEquality.js +22 -0
  2154. package/src/engine/graphics/render/frame_graph/GraphNode.js +22 -0
  2155. package/src/engine/graphics/render/frame_graph/IRenderContext.js +8 -0
  2156. package/src/engine/graphics/render/frame_graph/RenderGraph.js +409 -0
  2157. package/src/engine/graphics/render/frame_graph/RenderGraphBuilder.js +77 -0
  2158. package/src/engine/graphics/render/frame_graph/RenderPass.js +50 -0
  2159. package/src/engine/graphics/render/frame_graph/RenderPassFlags.js +6 -0
  2160. package/src/engine/graphics/render/frame_graph/RenderPassNode.js +103 -0
  2161. package/src/engine/graphics/render/frame_graph/RenderPassResources.js +65 -0
  2162. package/src/engine/graphics/render/frame_graph/ResourceEntry.js +77 -0
  2163. package/src/engine/graphics/render/frame_graph/ResourceNode.js +23 -0
  2164. package/src/engine/graphics/render/frame_graph/TextureDescriptor.js +64 -0
  2165. package/src/engine/graphics/render/frame_graph/sample/deferred/GBufferDrawPass.js +33 -0
  2166. package/src/engine/graphics/render/frame_graph/sample/deferred/LightingPass.js +24 -0
  2167. package/src/engine/graphics/render/frame_graph/sample/deferred/run.js +31 -0
  2168. package/src/engine/graphics/render/frame_graph/sample/meep-v1/ColorDepthPass.js +38 -0
  2169. package/src/engine/graphics/render/frame_graph/sample/meep-v1/OutlinePass.js +9 -0
  2170. package/src/engine/graphics/render/frame_graph/sample/meep-v1/SSAOPass.js +5 -0
  2171. package/src/engine/graphics/render/frame_graph/sample/meep-v1/render.js +7 -0
  2172. package/src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.js +5 -0
  2173. package/src/engine/graphics/render/gizmo/Gizmo.d.ts +3 -0
  2174. package/src/engine/graphics/render/gizmo/Gizmo.js +3 -0
  2175. package/src/engine/graphics/render/gizmo/GizmoRenderingPlugin.d.ts +5 -0
  2176. package/src/engine/graphics/render/gizmo/GizmoRenderingPlugin.js +25 -0
  2177. package/src/engine/graphics/render/gizmo/GizmoShapeRenderingInterface.d.ts +13 -0
  2178. package/src/engine/graphics/render/gizmo/GizmoShapeRenderingInterface.js +176 -0
  2179. package/src/engine/graphics/render/gizmo/prototypeGizmo.js +29 -0
  2180. package/src/engine/graphics/render/layers/RenderLayer.d.ts +19 -0
  2181. package/src/engine/graphics/render/layers/RenderLayer.js +160 -0
  2182. package/src/engine/graphics/render/layers/RenderLayerManager.d.ts +17 -0
  2183. package/src/engine/graphics/render/layers/RenderLayerManager.js +162 -0
  2184. package/src/engine/graphics/render/layers/RenderLayerManagerState.js +52 -0
  2185. package/src/engine/graphics/render/layers/RenderLayerState.d.ts +3 -0
  2186. package/src/engine/graphics/render/layers/RenderLayerState.js +29 -0
  2187. package/src/engine/graphics/render/layers/RenderLayerUtils.js +105 -0
  2188. package/src/engine/graphics/render/staged/PostProcessingEffect.js +32 -0
  2189. package/src/engine/graphics/render/staged/PostProcessingEffectInputCoupling.js +41 -0
  2190. package/src/engine/graphics/render/staged/PostProcessingStack.js +29 -0
  2191. package/src/engine/graphics/render/staged/StagedRenderer.js +161 -0
  2192. package/src/engine/graphics/render/staged/StandardRenderOutputs.js +20 -0
  2193. package/src/engine/graphics/render/utils/ThreeBypassRenderer.js +136 -0
  2194. package/src/engine/graphics/render/utils/renderScreenSpace.js +32 -0
  2195. package/src/engine/graphics/render/utils/renderTextureToScreenQuad.js +29 -0
  2196. package/src/engine/graphics/render/view/CameraView.js +196 -0
  2197. package/src/engine/graphics/render/view/CameraViewFlags.js +9 -0
  2198. package/src/engine/graphics/render/view/CameraViewManager.js +116 -0
  2199. package/src/engine/graphics/render/visibility/IncrementalDeltaSet.d.ts +24 -0
  2200. package/src/engine/graphics/render/visibility/IncrementalDeltaSet.js +305 -0
  2201. package/src/engine/graphics/render/visibility/IncrementalDeltaSet.spec.js +101 -0
  2202. package/src/engine/graphics/render/visibility/VisibilityComputer.js +118 -0
  2203. package/src/engine/graphics/render/visibility/VisibilityFilter.js +36 -0
  2204. package/src/engine/graphics/render/visibility/hiz/buffer/HierarchicalZBuffer.js +202 -0
  2205. package/src/engine/graphics/render/visibility/hiz/buffer/ReductionShader.js +51 -0
  2206. package/src/engine/graphics/render/visibility/hiz/buildCanvasViewFromTexture.js +258 -0
  2207. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +444 -0
  2208. package/src/engine/graphics/render/visibility/hiz/query/BatchOcclusionQuery.js +174 -0
  2209. package/src/engine/graphics/render/visibility/hiz/query/QueryShader.js +173 -0
  2210. package/src/engine/graphics/render/webgpu/sample/MeshInstance.js +108 -0
  2211. package/src/engine/graphics/render/webgpu/sample/fragmentDeferredRendering.wgsl +71 -0
  2212. package/src/engine/graphics/render/webgpu/sample/fragmentGBuffersDebugView.wgsl +39 -0
  2213. package/src/engine/graphics/render/webgpu/sample/fragmentWriteGBuffers.wgsl +21 -0
  2214. package/src/engine/graphics/render/webgpu/sample/lightUpdate.wgsl +41 -0
  2215. package/src/engine/graphics/render/webgpu/sample/main.js +604 -0
  2216. package/src/engine/graphics/render/webgpu/sample/vertexTextureQuad.wgsl +9 -0
  2217. package/src/engine/graphics/render/webgpu/sample/vertexWriteGBuffers.wgsl +30 -0
  2218. package/src/engine/graphics/sh3/LightProbeVolume.js +588 -0
  2219. package/src/engine/graphics/sh3/README.md +7 -0
  2220. package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +80 -0
  2221. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +265 -0
  2222. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +89 -0
  2223. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +576 -0
  2224. package/src/engine/graphics/sh3/path_tracer/apply_texture_clamping_to_coordinate.js +22 -0
  2225. package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.js +36 -0
  2226. package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.js +55 -0
  2227. package/src/engine/graphics/sh3/path_tracer/make_one_vector3.js +7 -0
  2228. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +44 -0
  2229. package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.js +17 -0
  2230. package/src/engine/graphics/sh3/path_tracer/make_zero_vector3.js +7 -0
  2231. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +669 -0
  2232. package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.js +39 -0
  2233. package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.js +57 -0
  2234. package/src/engine/graphics/sh3/path_tracer/ray_reflect.js +27 -0
  2235. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js +35 -0
  2236. package/src/engine/graphics/sh3/path_tracer/vec3_uint8_to_float.js +12 -0
  2237. package/src/engine/graphics/sh3/prototypeSH3Probe.js +432 -0
  2238. package/src/engine/graphics/sh3/sky/hosek/README.md +4 -0
  2239. package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +71 -0
  2240. package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +4171 -0
  2241. package/src/engine/graphics/sh3/visualise_probe.js +40 -0
  2242. package/src/engine/graphics/shaders/AlphaBlendShader.js +44 -0
  2243. package/src/engine/graphics/shaders/AmbientOcclusionShader.js +131 -0
  2244. package/src/engine/graphics/shaders/ClearShader.js +30 -0
  2245. package/src/engine/graphics/shaders/CopyShader.js +50 -0
  2246. package/src/engine/graphics/shaders/DenoiseShader.js +119 -0
  2247. package/src/engine/graphics/shaders/GaussianBlurShader.js +79 -0
  2248. package/src/engine/graphics/shaders/GaussianGlowShader.js +83 -0
  2249. package/src/engine/graphics/shaders/NormalMapShader.js +62 -0
  2250. package/src/engine/graphics/shaders/NormalMapShader2.js +93 -0
  2251. package/src/engine/graphics/shaders/ScreenSpaceQuadShader.js +38 -0
  2252. package/src/engine/graphics/shaders/ScreenSpaceShader.js +102 -0
  2253. package/src/engine/graphics/shaders/SoftOutlineShader.js +113 -0
  2254. package/src/engine/graphics/shaders/TerrainShader.js +397 -0
  2255. package/src/engine/graphics/shaders/WaterShader.js +152 -0
  2256. package/src/engine/graphics/shaders/glsl_gen_swizzled_read.js +39 -0
  2257. package/src/engine/graphics/shaders/lib/ShaderChunks.js +66 -0
  2258. package/src/engine/graphics/shadows/README.md +6 -0
  2259. package/src/engine/graphics/shadows/ShadowMapRenderer.js +220 -0
  2260. package/src/engine/graphics/shadows/testShadowMapRendering.js +192 -0
  2261. package/src/engine/graphics/shadows/vsm.glsl.js +41 -0
  2262. package/src/engine/graphics/texture/Canvas2Sampler2D.js +40 -0
  2263. package/src/engine/graphics/texture/CanvasClone.js +24 -0
  2264. package/src/engine/graphics/texture/CheckersTexture.js +28 -0
  2265. package/src/engine/graphics/texture/CheckersTextureURI.js +5 -0
  2266. package/src/engine/graphics/texture/ExportCanvasAsPNG.js +7 -0
  2267. package/src/engine/graphics/texture/ImageLoader.js +33 -0
  2268. package/src/engine/graphics/texture/atlas/AbstractTextureAtlas.js +31 -0
  2269. package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +86 -0
  2270. package/src/engine/graphics/texture/atlas/AtlasPatch.js +157 -0
  2271. package/src/engine/graphics/texture/atlas/AtlasPatchFlag.js +7 -0
  2272. package/src/engine/graphics/texture/atlas/CachingTextureAtlas.js +303 -0
  2273. package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.js +222 -0
  2274. package/src/engine/graphics/texture/atlas/ReferencedTextureAtlas.js +83 -0
  2275. package/src/engine/graphics/texture/atlas/TextureAtlas.js +562 -0
  2276. package/src/engine/graphics/texture/atlas/TextureAtlas.spec.js +273 -0
  2277. package/src/engine/graphics/texture/atlas/TextureAtlasDebugger.js +129 -0
  2278. package/src/engine/graphics/texture/atlas/gpu/WebGLTextureAtlas.js +181 -0
  2279. package/src/engine/graphics/texture/channelCountToThreeTextureFormat.js +21 -0
  2280. package/src/engine/graphics/texture/cubemap/buildCubeURLs.js +13 -0
  2281. package/src/engine/graphics/texture/cubemap/load_environment_map.d.ts +8 -0
  2282. package/src/engine/graphics/texture/cubemap/load_environment_map.js +163 -0
  2283. package/src/engine/graphics/texture/formatToChannelCount.js +21 -0
  2284. package/src/engine/graphics/texture/noise_octaves.js +33 -0
  2285. package/src/engine/graphics/texture/normalized_internal_format.js +48 -0
  2286. package/src/engine/graphics/texture/sampler/BlendingType.js +12 -0
  2287. package/src/engine/graphics/texture/sampler/HarmonicDiffusionGrid.js +145 -0
  2288. package/src/engine/graphics/texture/sampler/HarmonicDiffusionGrid.spec.js +99 -0
  2289. package/src/engine/graphics/texture/sampler/SampleTraverser.js +165 -0
  2290. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts +28 -0
  2291. package/src/engine/graphics/texture/sampler/Sampler2D.js +1683 -0
  2292. package/src/engine/graphics/texture/sampler/Sampler2D.spec.js +292 -0
  2293. package/src/engine/graphics/texture/sampler/Sampler2D2Canvas.js +93 -0
  2294. package/src/engine/graphics/texture/sampler/Sampler2D2Texture.js +53 -0
  2295. package/src/engine/graphics/texture/sampler/TextureBinaryBufferSerializer.js +168 -0
  2296. package/src/engine/graphics/texture/sampler/TextureBinaryBufferSerializer.spec.js +38 -0
  2297. package/src/engine/graphics/texture/sampler/bicubic.js +59 -0
  2298. package/src/engine/graphics/texture/sampler/blendingType2Three.js +28 -0
  2299. package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.js +24 -0
  2300. package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +84 -0
  2301. package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js +73 -0
  2302. package/src/engine/graphics/texture/sampler/differenceSampler.js +31 -0
  2303. package/src/engine/graphics/texture/sampler/distanceField.js +411 -0
  2304. package/src/engine/graphics/texture/sampler/distanceField.spec.js +184 -0
  2305. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js +15 -0
  2306. package/src/engine/graphics/texture/sampler/downsampleSample2D.spec.js +17 -0
  2307. package/src/engine/graphics/texture/sampler/filter/box.js +16 -0
  2308. package/src/engine/graphics/texture/sampler/filter/cubic2.js +32 -0
  2309. package/src/engine/graphics/texture/sampler/filter/gaussian.js +16 -0
  2310. package/src/engine/graphics/texture/sampler/filter/kaiser_1.js +19 -0
  2311. package/src/engine/graphics/texture/sampler/filter/kaiser_bessel_window.js +19 -0
  2312. package/src/engine/graphics/texture/sampler/filter/mitchell.js +55 -0
  2313. package/src/engine/graphics/texture/sampler/filter/sampler2d_scale_down_generic.js +109 -0
  2314. package/src/engine/graphics/texture/sampler/filter/triangle.js +19 -0
  2315. package/src/engine/graphics/texture/sampler/genericResampleSampler2D.js +65 -0
  2316. package/src/engine/graphics/texture/sampler/loadSampler2D.js +36 -0
  2317. package/src/engine/graphics/texture/sampler/mergeSampler2D.js +96 -0
  2318. package/src/engine/graphics/texture/sampler/prototypeSamplerFiltering.js +353 -0
  2319. package/src/engine/graphics/texture/sampler/resize/sampler2d_downsample_mipmap.js +66 -0
  2320. package/src/engine/graphics/texture/sampler/rgbaData2valueSampler2D.js +38 -0
  2321. package/src/engine/graphics/texture/sampler/sample2d_write_to_canvas_raw.js +38 -0
  2322. package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.js +39 -0
  2323. package/src/engine/graphics/texture/sampler/sampler2D_scale_down_linear.js +84 -0
  2324. package/src/engine/graphics/texture/sampler/sampler2_d_scale_down_lanczos.js +192 -0
  2325. package/src/engine/graphics/texture/sampler/sampler2d_channel_linear_transform.js +68 -0
  2326. package/src/engine/graphics/texture/sampler/sampler2d_combine.js +67 -0
  2327. package/src/engine/graphics/texture/sampler/sampler2d_compute_texel_value_conversion_scale_to_uint8.js +47 -0
  2328. package/src/engine/graphics/texture/sampler/sampler2d_copy_channel_data.js +25 -0
  2329. package/src/engine/graphics/texture/sampler/sampler2d_to_uint8_RGBA.js +97 -0
  2330. package/src/engine/graphics/texture/sampler/sampler2d_to_uint8_RGBA.spec.js +52 -0
  2331. package/src/engine/graphics/texture/sampler/saturated_value_by_constructor.js +28 -0
  2332. package/src/engine/graphics/texture/sampler/scaleSampler2D.js +44 -0
  2333. package/src/engine/graphics/texture/sampler/search/make_edge_condition_channel_threshold.js +34 -0
  2334. package/src/engine/graphics/texture/sampler/search/sampler2d_find_pixels.js +24 -0
  2335. package/src/engine/graphics/texture/sampler/serialization/Sampler2DSerializationAdapter.js +67 -0
  2336. package/src/engine/graphics/texture/sampler/typedArrayConstructorByInstance.js +25 -0
  2337. package/src/engine/graphics/texture/sampler/upsampleSampler2D.js +47 -0
  2338. package/src/engine/graphics/texture/sampler/util/bitSet2Sampler2D.js +41 -0
  2339. package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.js +43 -0
  2340. package/src/engine/graphics/texture/sampler/writeSampler2DDataToDataTexture.js +39 -0
  2341. package/src/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +212 -0
  2342. package/src/engine/graphics/texture/texture_array_2d_copy.js +45 -0
  2343. package/src/engine/graphics/texture/virtual/TileOperation.js +13 -0
  2344. package/src/engine/graphics/texture/virtual/TileTree.js +150 -0
  2345. package/src/engine/graphics/texture/virtual/TileTree.spec.js +58 -0
  2346. package/src/engine/graphics/texture/virtual/TileUsage.js +137 -0
  2347. package/src/engine/graphics/texture/virtual/VirtualTexture.js +229 -0
  2348. package/src/engine/graphics/texture/virtual/VirtualTexture.spec.js +38 -0
  2349. package/src/engine/graphics/texture/virtual/page/TilePage.js +148 -0
  2350. package/src/engine/graphics/texture/virtual/page/TilePageSlot.js +36 -0
  2351. package/src/engine/graphics/texture/virtual/tile/Tile.js +44 -0
  2352. package/src/engine/graphics/texture/virtual/tile/Tile.spec.js +11 -0
  2353. package/src/engine/graphics/texture/virtual/tile/TileAddress.js +63 -0
  2354. package/src/engine/graphics/texture/virtual/tile/TileAddress.spec.js +30 -0
  2355. package/src/engine/graphics/texture/virtual/tile/TileLoader.js +173 -0
  2356. package/src/engine/graphics/texture/virtual/tile/TileRequest.js +40 -0
  2357. package/src/engine/graphics/texture/virtual/tile/TileStatus.js +10 -0
  2358. package/src/engine/graphics/texture/virtual/v2/ShaderUsage.js +48 -0
  2359. package/src/engine/graphics/texture/virtual/v2/prototype.js +101 -0
  2360. package/src/engine/graphics/three/DDSLoader.js +286 -0
  2361. package/src/engine/graphics/three/OrbitControls.js +1045 -0
  2362. package/src/engine/graphics/three/Reflector.js +281 -0
  2363. package/src/engine/graphics/three/Refractor.js +352 -0
  2364. package/src/engine/graphics/three/ThreeFactory.js +75 -0
  2365. package/src/engine/graphics/three/TransfromControls.js +1496 -0
  2366. package/src/engine/graphics/three/Water2.js +343 -0
  2367. package/src/engine/graphics/three/cloneObject3D.d.ts +3 -0
  2368. package/src/engine/graphics/three/cloneObject3D.js +70 -0
  2369. package/src/engine/graphics/three/compare_three_objects.js +8 -0
  2370. package/src/engine/graphics/trail/CodeflowTrailMaterial.js +134 -0
  2371. package/src/engine/graphics/trail/TemporalPath.js +160 -0
  2372. package/src/engine/graphics/trail/x/RibbonMaterialX.js +131 -0
  2373. package/src/engine/graphics/trail/x/RibbonX.js +549 -0
  2374. package/src/engine/graphics/trail/x/RibbonXMaterialSpec.d.ts +3 -0
  2375. package/src/engine/graphics/trail/x/RibbonXMaterialSpec.js +23 -0
  2376. package/src/engine/graphics/trail/x/RibbonXPlugin.js +128 -0
  2377. package/src/engine/graphics/trail/x/ribbon_attributes_spec.js +52 -0
  2378. package/src/engine/graphics/trail/x/simulator/RibbonState.js +10 -0
  2379. package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.js +35 -0
  2380. package/src/engine/graphics/util/ScaleObject3ToBox.js +38 -0
  2381. package/src/engine/graphics/util/composeMatrix4.js +13 -0
  2382. package/src/engine/graphics/util/composeMatrix4RotationScale.js +14 -0
  2383. package/src/engine/graphics/util/ensureGeometryBoundingBox.js +15 -0
  2384. package/src/engine/graphics/util/launchElementIntoFullscreen.js +16 -0
  2385. package/src/engine/graphics/util/makeMeshPreviewScene.js +100 -0
  2386. package/src/engine/graphics/util/modelHitTest.js +63 -0
  2387. package/src/engine/graphics/util/projectSphere.js +103 -0
  2388. package/src/engine/graphics/util/promiseMaterialLoaded.d.ts +3 -0
  2389. package/src/engine/graphics/util/promiseMaterialLoaded.js +28 -0
  2390. package/src/engine/graphics/util/promiseTextureLoaded.js +31 -0
  2391. package/src/engine/graphics/util/renderObjectToSampler2D.js +83 -0
  2392. package/src/engine/graphics/util/threeUpdateMatrix.js +14 -0
  2393. package/src/engine/graphics/util/threeUpdateTransform.js +16 -0
  2394. package/src/engine/grid/Grid.js +131 -0
  2395. package/src/engine/grid/area/AreaTrigger.js +21 -0
  2396. package/src/engine/grid/area/TriggerAction.js +8 -0
  2397. package/src/engine/grid/area/TriggerActionType.js +5 -0
  2398. package/src/engine/grid/components/GridObstacle.js +246 -0
  2399. package/src/engine/grid/components/GridObstacle.spec.js +46 -0
  2400. package/src/engine/grid/components/GridObstacleSerializationAdapter.js +46 -0
  2401. package/src/engine/grid/components/GridPosition.js +51 -0
  2402. package/src/engine/grid/components/GridPosition2Transform.js +232 -0
  2403. package/src/engine/grid/components/GridPosition2TransformFlags.js +10 -0
  2404. package/src/engine/grid/components/GridPositionSerializationAdapter.js +58 -0
  2405. package/src/engine/grid/components/GridPositionSerializationUpdater_0_1.js +37 -0
  2406. package/src/engine/grid/components/ViewportGridProjection.js +20 -0
  2407. package/src/engine/grid/systems/GridObstacleSystem.js +58 -0
  2408. package/src/engine/grid/systems/GridPosition2TransformSystem.js +118 -0
  2409. package/src/engine/grid/systems/GridPositionSystem.js +108 -0
  2410. package/src/engine/grid/systems/ViewportGridProjectionSystem.js +105 -0
  2411. package/src/engine/grid/transform2grid/Transform2GridPosition.js +73 -0
  2412. package/src/engine/grid/transform2grid/Transform2GridPositionFlags.js +2 -0
  2413. package/src/engine/grid/transform2grid/Transform2GridPositionMode.js +10 -0
  2414. package/src/engine/grid/transform2grid/Transform2GridPositionSystem.js +133 -0
  2415. package/src/engine/input/devices/InputDeviceButton.d.ts +7 -0
  2416. package/src/engine/input/devices/InputDeviceButton.js +22 -0
  2417. package/src/engine/input/devices/KeyCodes.d.ts +1 -0
  2418. package/src/engine/input/devices/KeyCodes.js +107 -0
  2419. package/src/engine/input/devices/KeyValues.js +36 -0
  2420. package/src/engine/input/devices/KeyboardDevice.d.ts +14 -0
  2421. package/src/engine/input/devices/KeyboardDevice.js +134 -0
  2422. package/src/engine/input/devices/PointerDevice.d.ts +25 -0
  2423. package/src/engine/input/devices/PointerDevice.js +588 -0
  2424. package/src/engine/input/devices/events/DragEvents.js +38 -0
  2425. package/src/engine/input/devices/events/KeyboardEvents.d.ts +4 -0
  2426. package/src/engine/input/devices/events/KeyboardEvents.js +4 -0
  2427. package/src/engine/input/devices/events/MouseEvents.d.ts +12 -0
  2428. package/src/engine/input/devices/events/MouseEvents.js +18 -0
  2429. package/src/engine/input/devices/events/TouchEvents.d.ts +6 -0
  2430. package/src/engine/input/devices/events/TouchEvents.js +12 -0
  2431. package/src/engine/input/ecs/InputBinding.js +30 -0
  2432. package/src/engine/input/ecs/components/Input.d.ts +6 -0
  2433. package/src/engine/input/ecs/components/Input.js +80 -0
  2434. package/src/engine/input/ecs/components/InputController.d.ts +3 -0
  2435. package/src/engine/input/ecs/components/InputController.js +54 -0
  2436. package/src/engine/input/ecs/controllers/KeyboardCameraController.js +125 -0
  2437. package/src/engine/input/ecs/ism/InputBinding.d.ts +4 -0
  2438. package/src/engine/input/ecs/ism/InputBinding.js +47 -0
  2439. package/src/engine/input/ecs/systems/InputControllerSystem.d.ts +6 -0
  2440. package/src/engine/input/ecs/systems/InputControllerSystem.js +256 -0
  2441. package/src/engine/input/ecs/systems/InputSystem.d.ts +6 -0
  2442. package/src/engine/input/ecs/systems/InputSystem.js +156 -0
  2443. package/src/engine/input/ecs/util/TerrainCameraTargetSampler.js +26 -0
  2444. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.js +84 -0
  2445. package/src/engine/intelligence/behavior/Behavior.d.ts +11 -0
  2446. package/src/engine/intelligence/behavior/Behavior.js +47 -0
  2447. package/src/engine/intelligence/behavior/BehaviorStatus.d.ts +8 -0
  2448. package/src/engine/intelligence/behavior/BehaviorStatus.js +12 -0
  2449. package/src/engine/intelligence/behavior/SelectorBehavior.js +87 -0
  2450. package/src/engine/intelligence/behavior/behavior_to_dot.js +251 -0
  2451. package/src/engine/intelligence/behavior/behavior_to_dot.prototype.js +55 -0
  2452. package/src/engine/intelligence/behavior/composite/CompositeBehavior.js +62 -0
  2453. package/src/engine/intelligence/behavior/composite/ParallelBehavior.js +240 -0
  2454. package/src/engine/intelligence/behavior/composite/ParallelBehavior.spec.js +165 -0
  2455. package/src/engine/intelligence/behavior/composite/ParallelBehaviorSerializationAdapter.js +63 -0
  2456. package/src/engine/intelligence/behavior/composite/SequenceBehavior.js +122 -0
  2457. package/src/engine/intelligence/behavior/composite/SequenceBehaviorSerializationAdapter.js +52 -0
  2458. package/src/engine/intelligence/behavior/decorator/AbstractDecoratorBehavior.js +46 -0
  2459. package/src/engine/intelligence/behavior/decorator/IgnoreFailureBehavior.js +27 -0
  2460. package/src/engine/intelligence/behavior/decorator/InverterBehavior.js +75 -0
  2461. package/src/engine/intelligence/behavior/decorator/RepeatBehavior.js +86 -0
  2462. package/src/engine/intelligence/behavior/decorator/RepeatBehavior.spec.js +32 -0
  2463. package/src/engine/intelligence/behavior/decorator/RepeatBehaviorSerializationAdapter.js +37 -0
  2464. package/src/engine/intelligence/behavior/decorator/RepeatUntilFailureBehavior.js +70 -0
  2465. package/src/engine/intelligence/behavior/decorator/RepeatUntilSuccessBehavior.js +72 -0
  2466. package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts +3 -0
  2467. package/src/engine/intelligence/behavior/ecs/BehaviorComponent.js +158 -0
  2468. package/src/engine/intelligence/behavior/ecs/BehaviorComponentFlag.js +7 -0
  2469. package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.js +83 -0
  2470. package/src/engine/intelligence/behavior/ecs/BehaviorSystem.d.ts +7 -0
  2471. package/src/engine/intelligence/behavior/ecs/BehaviorSystem.js +139 -0
  2472. package/src/engine/intelligence/behavior/ecs/BehaviorSystem.spec.js +75 -0
  2473. package/src/engine/intelligence/behavior/ecs/ClockChannelType.js +15 -0
  2474. package/src/engine/intelligence/behavior/ecs/DieBehavior.js +26 -0
  2475. package/src/engine/intelligence/behavior/ecs/EntityBehavior.js +36 -0
  2476. package/src/engine/intelligence/behavior/ecs/WaitForEventBehavior.js +90 -0
  2477. package/src/engine/intelligence/behavior/ecs/WaitForEventBehaviorSerializationAdapter.js +29 -0
  2478. package/src/engine/intelligence/behavior/primitive/ActionBehavior.js +35 -0
  2479. package/src/engine/intelligence/behavior/primitive/FailingBehavior.js +24 -0
  2480. package/src/engine/intelligence/behavior/primitive/FailingBehaviorSerializationAdapter.js +29 -0
  2481. package/src/engine/intelligence/behavior/primitive/PromiseBehavior.js +43 -0
  2482. package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.js +38 -0
  2483. package/src/engine/intelligence/behavior/primitive/SucceedingBehaviorSerializationAdapter.js +29 -0
  2484. package/src/engine/intelligence/behavior/selector/WeightedElement.js +76 -0
  2485. package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.js +110 -0
  2486. package/src/engine/intelligence/behavior/util/ConditionBehavior.js +27 -0
  2487. package/src/engine/intelligence/behavior/util/ConditionBehavior.spec.js +24 -0
  2488. package/src/engine/intelligence/behavior/util/ConditionalBehavior.js +73 -0
  2489. package/src/engine/intelligence/behavior/util/DelayBehavior.js +67 -0
  2490. package/src/engine/intelligence/behavior/util/FilterBehavior.js +43 -0
  2491. package/src/engine/intelligence/behavior/util/LogMessageBehavior.js +29 -0
  2492. package/src/engine/intelligence/behavior/util/RotationBehavior.js +69 -0
  2493. package/src/engine/intelligence/behavior/util/SelectorBehavior.js +83 -0
  2494. package/src/engine/intelligence/blackboard/AbstractBlackboard.d.ts +15 -0
  2495. package/src/engine/intelligence/blackboard/AbstractBlackboard.js +93 -0
  2496. package/src/engine/intelligence/blackboard/Blackboard.d.ts +5 -0
  2497. package/src/engine/intelligence/blackboard/Blackboard.js +221 -0
  2498. package/src/engine/intelligence/blackboard/Blackboard.spec.js +62 -0
  2499. package/src/engine/intelligence/blackboard/BlackboardDynamicStorageAdapter.js +249 -0
  2500. package/src/engine/intelligence/blackboard/BlackboardSerializationAdapter.js +94 -0
  2501. package/src/engine/intelligence/blackboard/BlackboardSerializationAdapter.spec.js +28 -0
  2502. package/src/engine/intelligence/blackboard/BlackboardStack.js +127 -0
  2503. package/src/engine/intelligence/blackboard/BlackboardValue.js +50 -0
  2504. package/src/engine/intelligence/blackboard/make_blackboard_proxy.js +47 -0
  2505. package/src/engine/intelligence/blackboard/make_blackboard_proxy.spec.js +23 -0
  2506. package/src/engine/intelligence/controller/graph/StateGraph.js +19 -0
  2507. package/src/engine/intelligence/controller/graph/StateGraphDescription.js +32 -0
  2508. package/src/engine/intelligence/controller/graph/StateGraphSystem.js +19 -0
  2509. package/src/engine/intelligence/mcts/MonteCarlo.js +292 -0
  2510. package/src/engine/intelligence/mcts/MonteCarlo.spec.js +242 -0
  2511. package/src/engine/intelligence/mcts/MoveEdge.js +43 -0
  2512. package/src/engine/intelligence/mcts/README.md +7 -0
  2513. package/src/engine/intelligence/mcts/StateNode.js +340 -0
  2514. package/src/engine/intelligence/mcts/StateNode.spec.js +49 -0
  2515. package/src/engine/intelligence/optimization/OptimizationTask.js +49 -0
  2516. package/src/engine/intelligence/optimization/RandomOptimizer.js +147 -0
  2517. package/src/engine/intelligence/optimization/RandomOptimizer.spec.js +57 -0
  2518. package/src/engine/intelligence/resource/ActionSequence.js +46 -0
  2519. package/src/engine/intelligence/resource/Resource.js +57 -0
  2520. package/src/engine/intelligence/resource/ResourceAllocation.js +13 -0
  2521. package/src/engine/intelligence/resource/ResourceAllocationBid.js +44 -0
  2522. package/src/engine/intelligence/resource/ResourceAllocationSolver.js +164 -0
  2523. package/src/engine/intelligence/resource/ResourceAllocationSolver.spec.js +104 -0
  2524. package/src/engine/intelligence/resource/StrategicResourceAllocator.js +129 -0
  2525. package/src/engine/intelligence/resource/StrategicResourceAllocator.spec.js +46 -0
  2526. package/src/engine/intelligence/resource/TacticalModule.js +21 -0
  2527. package/src/engine/knowledge/database/DATABASE_SERIALIZATION_IGNORE_PROPERTY.js +1 -0
  2528. package/src/engine/knowledge/database/StaticKnowledgeDataTable.d.ts +3 -0
  2529. package/src/engine/knowledge/database/StaticKnowledgeDataTable.js +497 -0
  2530. package/src/engine/knowledge/database/StaticKnowledgeDataTableDescriptor.d.ts +7 -0
  2531. package/src/engine/knowledge/database/StaticKnowledgeDataTableDescriptor.js +50 -0
  2532. package/src/engine/knowledge/database/StaticKnowledgeDatabase.js +298 -0
  2533. package/src/engine/logging/ConsoleLoggerBackend.js +37 -0
  2534. package/src/engine/logging/GlobalLogger.js +3 -0
  2535. package/src/engine/logging/LogLevel.js +11 -0
  2536. package/src/engine/logging/Logger.js +80 -0
  2537. package/src/engine/logging/LoggerBackend.js +38 -0
  2538. package/src/engine/logging/elastic/ElasticSearchLogger.js +153 -0
  2539. package/src/engine/metrics/GlobalMetrics.js +7 -0
  2540. package/src/engine/metrics/GoogleAnalyticsMetrics.js +63 -0
  2541. package/src/engine/metrics/MetricsCategory.js +12 -0
  2542. package/src/engine/metrics/MetricsGateway.js +14 -0
  2543. package/src/engine/metrics/NullMetricsGateway.js +9 -0
  2544. package/src/engine/metrics/ProxyMetricsGateway.js +34 -0
  2545. package/src/engine/navigation/PathFinder.js +172 -0
  2546. package/src/engine/navigation/PathWorker.js +78 -0
  2547. package/src/engine/navigation/ecs/components/InterpolationType.d.ts +4 -0
  2548. package/src/engine/navigation/ecs/components/InterpolationType.js +10 -0
  2549. package/src/engine/navigation/ecs/components/Path.d.ts +45 -0
  2550. package/src/engine/navigation/ecs/components/Path.js +726 -0
  2551. package/src/engine/navigation/ecs/components/Path.spec.js +181 -0
  2552. package/src/engine/navigation/ecs/components/PathEvents.d.ts +6 -0
  2553. package/src/engine/navigation/ecs/components/PathEvents.js +10 -0
  2554. package/src/engine/navigation/ecs/components/PathFinder.js +11 -0
  2555. package/src/engine/navigation/ecs/components/PathSerializationAdapter.js +64 -0
  2556. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_0_1.js +31 -0
  2557. package/src/engine/navigation/ecs/components/PathSerializationUpgrader_1_2.js +33 -0
  2558. package/src/engine/navigation/ecs/components/computeCatmullRomSpline.js +75 -0
  2559. package/src/engine/navigation/ecs/components/computeCatmullRomSplineUniformDistance.js +126 -0
  2560. package/src/engine/navigation/ecs/components/computeNonuniformCatmullRomSplineSample.js +242 -0
  2561. package/src/engine/navigation/ecs/path_following/PathFollower.d.ts +45 -0
  2562. package/src/engine/navigation/ecs/path_following/PathFollower.js +219 -0
  2563. package/src/engine/navigation/ecs/path_following/PathFollowerEventType.d.ts +3 -0
  2564. package/src/engine/navigation/ecs/path_following/PathFollowerEventType.js +7 -0
  2565. package/src/engine/navigation/ecs/path_following/PathFollowerFlags.d.ts +20 -0
  2566. package/src/engine/navigation/ecs/path_following/PathFollowerFlags.js +27 -0
  2567. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationAdapter.js +39 -0
  2568. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationUpgrader_0_1.js +27 -0
  2569. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationUpgrader_1_2.js +22 -0
  2570. package/src/engine/navigation/ecs/path_following/PathFollowerSerializationUpgrader_2_3.js +24 -0
  2571. package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts +6 -0
  2572. package/src/engine/navigation/ecs/path_following/PathFollowingSystem.js +185 -0
  2573. package/src/engine/navigation/ecs/systems/PathFinderSystem.js +63 -0
  2574. package/src/engine/navigation/ecs/systems/PathSystem.js +19 -0
  2575. package/src/engine/navigation/funnel/Funnel.js +196 -0
  2576. package/src/engine/navigation/grid/AStar.js +223 -0
  2577. package/src/engine/navigation/grid/GridField.js +328 -0
  2578. package/src/engine/network/DataChannel.js +1208 -0
  2579. package/src/engine/network/PriorityFetch.js +192 -0
  2580. package/src/engine/network/RemoteController.js +138 -0
  2581. package/src/engine/network/convertPathToURL.js +90 -0
  2582. package/src/engine/network/remoteEditor.js +36 -0
  2583. package/src/engine/network/xhr.js +26 -0
  2584. package/src/engine/notify/Notification.js +39 -0
  2585. package/src/engine/notify/NotificationLog.js +59 -0
  2586. package/src/engine/notify/NotificationLog.spec.js +17 -0
  2587. package/src/engine/options/Option.js +74 -0
  2588. package/src/engine/options/OptionAbstract.js +38 -0
  2589. package/src/engine/options/OptionGroup.js +185 -0
  2590. package/src/engine/options/OptionsView.js +233 -0
  2591. package/src/engine/physics/ammo/Body.js +106 -0
  2592. package/src/engine/physics/ammo/PhysicsWorker.js +439 -0
  2593. package/src/engine/physics/ammo/World.js +337 -0
  2594. package/src/engine/physics/ammo/shapes/BoxShape.js +14 -0
  2595. package/src/engine/physics/ammo/shapes/CapsuleShape.js +13 -0
  2596. package/src/engine/physics/ammo/shapes/MeshShape.js +12 -0
  2597. package/src/engine/physics/ammo/shapes/PlaneShape.js +17 -0
  2598. package/src/engine/physics/ammo/shapes/Shape.js +11 -0
  2599. package/src/engine/physics/ammo/shapes/SphereShape.js +12 -0
  2600. package/src/engine/physics/cannon/CannonJSPhysicsSystem.js +199 -0
  2601. package/src/engine/physics/cannon/cannon.min.js +27 -0
  2602. package/src/engine/physics/fluid/FluidField.js +9 -0
  2603. package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +6 -0
  2604. package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +12 -0
  2605. package/src/engine/physics/fluid/effector/WakeFluidEffector.js +8 -0
  2606. package/src/engine/physics/mls-mpm/MLS_MPM.js +652 -0
  2607. package/src/engine/physics/mls-mpm/testMLS_MPM.js +65 -0
  2608. package/src/engine/physics/spring/Spring.js +9 -0
  2609. package/src/engine/platform/EnginePlatform.d.ts +14 -0
  2610. package/src/engine/platform/EnginePlatform.js +42 -0
  2611. package/src/engine/platform/GetURLHash.js +27 -0
  2612. package/src/engine/platform/WebEnginePlatform.d.ts +5 -0
  2613. package/src/engine/platform/WebEnginePlatform.js +99 -0
  2614. package/src/engine/plugin/EnginePlugin.d.ts +3 -0
  2615. package/src/engine/plugin/EnginePlugin.js +83 -0
  2616. package/src/engine/plugin/EnginePluginManager.d.ts +9 -0
  2617. package/src/engine/plugin/EnginePluginManager.js +323 -0
  2618. package/src/engine/plugin/PluginReferenceContext.js +271 -0
  2619. package/src/engine/plugin/isSubclassOf.js +19 -0
  2620. package/src/engine/reference/v1/ReferenceManager.js +121 -0
  2621. package/src/engine/reference/v2/Reference.d.ts +11 -0
  2622. package/src/engine/reference/v2/Reference.js +91 -0
  2623. package/src/engine/save/GameStateLoader.js +175 -0
  2624. package/src/engine/save/Storage.d.ts +15 -0
  2625. package/src/engine/save/Storage.js +128 -0
  2626. package/src/engine/save/StorageBackedList.js +145 -0
  2627. package/src/engine/save/storage/GooglePlayStorage.js +47 -0
  2628. package/src/engine/save/storage/InMemoryLocalStorage.js +13 -0
  2629. package/src/engine/save/storage/IndexedDBStorage.js +149 -0
  2630. package/src/engine/save/storage/IndexedDBTransactionMode.js +8 -0
  2631. package/src/engine/save/storage/JsonStringCodec.js +24 -0
  2632. package/src/engine/save/storage/LocalStorage.js +147 -0
  2633. package/src/engine/save/storage/MsgPackCodec.js +22 -0
  2634. package/src/engine/scene/Scene.d.ts +5 -0
  2635. package/src/engine/scene/Scene.js +100 -0
  2636. package/src/engine/scene/SceneManager.d.ts +21 -0
  2637. package/src/engine/scene/SceneManager.js +314 -0
  2638. package/src/engine/scene/SerializedScene.js +82 -0
  2639. package/src/engine/scene/transitionToScene.js +130 -0
  2640. package/src/engine/simulation/DormandPrince.js +242 -0
  2641. package/src/engine/simulation/Ticker.d.ts +5 -0
  2642. package/src/engine/simulation/Ticker.js +147 -0
  2643. package/src/engine/sound/SoundEngine.d.ts +3 -0
  2644. package/src/engine/sound/SoundEngine.js +96 -0
  2645. package/src/engine/sound/asset/SoundAssetPlaybackSpec.js +136 -0
  2646. package/src/engine/sound/asset/SoundAssetPlaybackSpecFlags.js +10 -0
  2647. package/src/engine/sound/ecs/SoundController.js +173 -0
  2648. package/src/engine/sound/ecs/SoundControllerSystem.js +109 -0
  2649. package/src/engine/sound/ecs/SoundListener.js +67 -0
  2650. package/src/engine/sound/ecs/SoundListenerSystem.js +260 -0
  2651. package/src/engine/sound/ecs/emitter/SoundAttenuationFunction.js +9 -0
  2652. package/src/engine/sound/ecs/emitter/SoundEmitter.js +564 -0
  2653. package/src/engine/sound/ecs/emitter/SoundEmitter.spec.js +49 -0
  2654. package/src/engine/sound/ecs/emitter/SoundEmitterChannel.js +32 -0
  2655. package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.js +239 -0
  2656. package/src/engine/sound/ecs/emitter/SoundEmitterFlags.js +8 -0
  2657. package/src/engine/sound/ecs/emitter/SoundEmitterSerializationAdapter.js +84 -0
  2658. package/src/engine/sound/ecs/emitter/SoundEmitterSerializationUpgrader_0_1.js +73 -0
  2659. package/src/engine/sound/ecs/emitter/SoundEmitterSerializationUpgrader_1_2.js +30 -0
  2660. package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +444 -0
  2661. package/src/engine/sound/ecs/emitter/SoundPanningModelType.js +15 -0
  2662. package/src/engine/sound/ecs/emitter/SoundTrack.js +353 -0
  2663. package/src/engine/sound/ecs/emitter/SoundTrackFlags.js +13 -0
  2664. package/src/engine/sound/ecs/emitter/SoundTrackNodes.js +20 -0
  2665. package/src/engine/sound/ecs/emitter/loadSoundTrackAsset.js +42 -0
  2666. package/src/engine/sound/material/AbstractSoundMaterialDefinition.js +15 -0
  2667. package/src/engine/sound/material/SoundMaterialInteractionType.js +7 -0
  2668. package/src/engine/sound/material/concrete/RandomSoundMaterial.js +35 -0
  2669. package/src/engine/sound/material/concrete/SilentSoundMaterial.js +20 -0
  2670. package/src/engine/sound/material/concrete/SingleSoundMaterial.js +37 -0
  2671. package/src/engine/sound/material/concrete/SoundMaterialComposition.js +111 -0
  2672. package/src/engine/sound/material/concrete/json/deserializeSoundMaterialFromJSON.js +31 -0
  2673. package/src/engine/sound/material/concrete/json/serializeSoundMaterialToJSON.js +6 -0
  2674. package/src/engine/sound/material/detector/SoundMaterialSurfaceDetector.js +19 -0
  2675. package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +121 -0
  2676. package/src/engine/sound/sopra/AbstractAudioClip.js +29 -0
  2677. package/src/engine/sound/sopra/ContainerAudioClip.js +13 -0
  2678. package/src/engine/sound/sopra/README.md +1 -0
  2679. package/src/engine/sound/sopra/RandomContainerAudioClip.js +15 -0
  2680. package/src/engine/sound/sopra/SequenceContainerAudioClip.js +8 -0
  2681. package/src/engine/sound/sopra/SilenceAudioClip.js +15 -0
  2682. package/src/engine/ui/DraggableAspect.js +83 -0
  2683. package/src/engine/ui/GUIEngine.js +563 -0
  2684. package/src/engine/ui/bindings/DomElementBinding.js +32 -0
  2685. package/src/engine/ui/bindings/DomElementBindingDescription.js +37 -0
  2686. package/src/engine/ui/bindings/DomElementProcessor.js +29 -0
  2687. package/src/engine/ui/bindings/DomElementProcessorManager.js +311 -0
  2688. package/src/engine/ui/bindings/processors/DomElementProcessorTilt3D.js +99 -0
  2689. package/src/engine/ui/cursor/CursorCoalescence.js +50 -0
  2690. package/src/engine/ui/cursor/CursorType.js +10 -0
  2691. package/src/engine/ui/modal/ModalStack.js +116 -0
  2692. package/src/engine/ui/notification/AnimatedObjectEmitter.js +272 -0
  2693. package/src/engine/ui/notification/NotificationAreaKind.js +9 -0
  2694. package/src/engine/ui/notification/NotificationManager.js +268 -0
  2695. package/src/engine/ui/notification/ViewEmitter.js +92 -0
  2696. package/src/engine/ui/notification/notificationGenerator.js +56 -0
  2697. package/src/engine/ui/scene/SceneGUIContext.js +76 -0
  2698. package/src/engine/ui/scene/initializeNotifications.js +144 -0
  2699. package/src/engine/ui/tiles2d/TileGrid.js +170 -0
  2700. package/src/engine/ui/tiles2d/TileGrid.spec.js +20 -0
  2701. package/src/engine/ui/tiles2d/TileMoveInstruction.js +71 -0
  2702. package/src/engine/ui/tiles2d/TileMoveProgram.js +69 -0
  2703. package/src/engine/ui/tiles2d/computeTileGridMove.js +164 -0
  2704. package/src/engine/ui/tiles2d/computeTileGridMove.spec.js +54 -0
  2705. package/src/extractName.js +8 -0
  2706. package/src/generation/GraphGenerationRule.js +17 -0
  2707. package/src/generation/GridGeneratorConfig.js +25 -0
  2708. package/src/generation/GridGeneratorConfigurator.js +0 -0
  2709. package/src/generation/GridTags.js +15 -0
  2710. package/src/generation/GridTaskGroup.js +111 -0
  2711. package/src/generation/ZoneNode.js +9 -0
  2712. package/src/generation/automata/CaveGeneratorCellularAutomata.js +56 -0
  2713. package/src/generation/automata/CellularAutomata.js +18 -0
  2714. package/src/generation/example/SampleGenerator0.js +565 -0
  2715. package/src/generation/example/filters/SampleGroundMoistureFilter.js +73 -0
  2716. package/src/generation/example/filters/SampleNoise20_0.js +3 -0
  2717. package/src/generation/example/generators/interactive/mir_generator_place_buff_objects.js +334 -0
  2718. package/src/generation/example/generators/mir_generator_place_bases.js +150 -0
  2719. package/src/generation/example/generators/mir_generator_place_road_decorators.js +59 -0
  2720. package/src/generation/example/generators/mir_generator_place_starting_point.js +52 -0
  2721. package/src/generation/example/grid/MirGridLayers.js +18 -0
  2722. package/src/generation/example/grid/configureMirGrid.js +19 -0
  2723. package/src/generation/example/main.js +216 -0
  2724. package/src/generation/example/rules/matcher_not_play_area.js +4 -0
  2725. package/src/generation/example/rules/matcher_play_area.js +5 -0
  2726. package/src/generation/example/rules/matcher_tag_not_traversable.js +4 -0
  2727. package/src/generation/example/rules/matcher_tag_occupied.js +5 -0
  2728. package/src/generation/example/rules/matcher_tag_traversable.js +5 -0
  2729. package/src/generation/example/rules/matcher_tag_traversable_unoccupied.js +5 -0
  2730. package/src/generation/example/rules/matcher_tag_unoccupied.js +4 -0
  2731. package/src/generation/example/rules/mir_matcher_attack_corridor.js +67 -0
  2732. package/src/generation/example/themes/SampleTheme0.js +1574 -0
  2733. package/src/generation/example/themes/SampleTheme1.js +19 -0
  2734. package/src/generation/example/themes/SampleTheme2.js +21 -0
  2735. package/src/generation/filtering/CellFilter.js +80 -0
  2736. package/src/generation/filtering/CellFilterCellMatcher.js +45 -0
  2737. package/src/generation/filtering/boolean/CellFilterLiteralBoolean.js +29 -0
  2738. package/src/generation/filtering/boolean/logic/CellFilterAnd.js +33 -0
  2739. package/src/generation/filtering/core/CellFilterBinaryOperation.js +53 -0
  2740. package/src/generation/filtering/core/CellFilterOperationTertiary.js +63 -0
  2741. package/src/generation/filtering/core/CellFilterUnaryOperation.js +33 -0
  2742. package/src/generation/filtering/numeric/CellFilterCache.js +79 -0
  2743. package/src/generation/filtering/numeric/CellFilterLiteralFloat.js +44 -0
  2744. package/src/generation/filtering/numeric/complex/CellFilterAngleToNormal.js +78 -0
  2745. package/src/generation/filtering/numeric/complex/CellFilterCurvature.js +123 -0
  2746. package/src/generation/filtering/numeric/complex/CellFilterDilate.js +36 -0
  2747. package/src/generation/filtering/numeric/complex/CellFilterFXAA.js +125 -0
  2748. package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +178 -0
  2749. package/src/generation/filtering/numeric/complex/CellFilterLookupTable.js +45 -0
  2750. package/src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js +119 -0
  2751. package/src/generation/filtering/numeric/complex/CellFilterSobel.js +66 -0
  2752. package/src/generation/filtering/numeric/math/CellFilterAbsolute.js +27 -0
  2753. package/src/generation/filtering/numeric/math/CellFilterClamp.js +31 -0
  2754. package/src/generation/filtering/numeric/math/CellFilterInverseLerp.js +37 -0
  2755. package/src/generation/filtering/numeric/math/CellFilterLerp.js +39 -0
  2756. package/src/generation/filtering/numeric/math/CellFilterMax2.js +32 -0
  2757. package/src/generation/filtering/numeric/math/CellFilterMembershipGeneralizedBell.js +55 -0
  2758. package/src/generation/filtering/numeric/math/CellFilterMin2.js +29 -0
  2759. package/src/generation/filtering/numeric/math/CellFilterOneMinus.js +24 -0
  2760. package/src/generation/filtering/numeric/math/CellFilterPower.js +31 -0
  2761. package/src/generation/filtering/numeric/math/CellFilterSaturate.js +24 -0
  2762. package/src/generation/filtering/numeric/math/CellFilterSmoothStep.js +34 -0
  2763. package/src/generation/filtering/numeric/math/CellFilterStep.js +37 -0
  2764. package/src/generation/filtering/numeric/math/algebra/CellFilterAdd.js +37 -0
  2765. package/src/generation/filtering/numeric/math/algebra/CellFilterDivide.js +38 -0
  2766. package/src/generation/filtering/numeric/math/algebra/CellFilterMultiply.js +37 -0
  2767. package/src/generation/filtering/numeric/math/algebra/CellFilterNegate.js +30 -0
  2768. package/src/generation/filtering/numeric/math/algebra/CellFilterSubtract.js +37 -0
  2769. package/src/generation/filtering/numeric/math/poly/CellFilterCubicFunction.js +50 -0
  2770. package/src/generation/filtering/numeric/process/computeCellFilterGradient.js +48 -0
  2771. package/src/generation/filtering/numeric/process/computeCellFilterGradient.spec.js +288 -0
  2772. package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.js +42 -0
  2773. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.js +36 -0
  2774. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js +41 -0
  2775. package/src/generation/filtering/numeric/util/CellFilterDisplaced.js +45 -0
  2776. package/src/generation/filtering/numeric/util/CellFilterLogToConsole.js +28 -0
  2777. package/src/generation/filtering/numeric/util/populateSampler2DFromCellFilter.js +31 -0
  2778. package/src/generation/grid/GridData.d.ts +7 -0
  2779. package/src/generation/grid/GridData.js +273 -0
  2780. package/src/generation/grid/GridTaskGenerator.js +66 -0
  2781. package/src/generation/grid/MarkerMatchCounter.js +25 -0
  2782. package/src/generation/grid/actions/ContinuousGridCellAction.js +54 -0
  2783. package/src/generation/grid/actions/ContinuousGridCellActionSetTerrainHeight.js +98 -0
  2784. package/src/generation/grid/actions/ContinuousGridCellActionSetTerrainObstacle.js +53 -0
  2785. package/src/generation/grid/actions/ContinuousGridCellActionWriteObstacle.js +123 -0
  2786. package/src/generation/grid/generation/GridTaskApplyActionToCells.js +86 -0
  2787. package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.js +382 -0
  2788. package/src/generation/grid/generation/GridTaskExecuteRuleTimes.js +118 -0
  2789. package/src/generation/grid/generation/GridTaskSequence.js +54 -0
  2790. package/src/generation/grid/generation/NoopGridTaskGenerator.js +8 -0
  2791. package/src/generation/grid/generation/discrete/GridTaskCellActionRuleSet.js +46 -0
  2792. package/src/generation/grid/generation/discrete/GridTaskCellularAutomata.js +129 -0
  2793. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +521 -0
  2794. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +212 -0
  2795. package/src/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.js +68 -0
  2796. package/src/generation/grid/generation/grid/GridTaskAddNodesFixed.js +42 -0
  2797. package/src/generation/grid/generation/grid/GridTaskGridAlignedNodeGenerator.js +17 -0
  2798. package/src/generation/grid/generation/grid/select/CellSupplier.js +28 -0
  2799. package/src/generation/grid/generation/grid/select/CellSupplierBestN.js +188 -0
  2800. package/src/generation/grid/generation/grid/select/CellSupplierPathUpHill.js +187 -0
  2801. package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +630 -0
  2802. package/src/generation/grid/generation/road/PathEndPoint.js +73 -0
  2803. package/src/generation/grid/generation/road/PathEndPointKind.js +10 -0
  2804. package/src/generation/grid/generation/road/RoadConnection.js +111 -0
  2805. package/src/generation/grid/generation/road/RoadConnectionNetwork.js +156 -0
  2806. package/src/generation/grid/generation/road/readMarkerNodeGroupId.js +13 -0
  2807. package/src/generation/grid/generation/util/buildDistanceMapToObjective.js +112 -0
  2808. package/src/generation/grid/generation/util/buildPathFromDistanceMap.js +82 -0
  2809. package/src/generation/grid/generation/util/buildUnsignedDistanceField.js +37 -0
  2810. package/src/generation/grid/layers/GridDataLayer.js +87 -0
  2811. package/src/generation/markers/GridActionRuleSet.js +213 -0
  2812. package/src/generation/markers/GridCellActionPlaceMarker.js +225 -0
  2813. package/src/generation/markers/GridCellActionPlaceMarkerGroup.js +76 -0
  2814. package/src/generation/markers/MarkerNode.js +127 -0
  2815. package/src/generation/markers/MarkerRelation.js +13 -0
  2816. package/src/generation/markers/RuleSelectionPolicyType.js +8 -0
  2817. package/src/generation/markers/actions/MarkerNodeAction.js +28 -0
  2818. package/src/generation/markers/actions/MarkerNodeActionEntityPlacement.js +100 -0
  2819. package/src/generation/markers/actions/MarkerNodeActionImaginary.js +86 -0
  2820. package/src/generation/markers/actions/MarkerNodeActionSequence.js +61 -0
  2821. package/src/generation/markers/actions/MarkerNodeProcessingRuleSet.js +151 -0
  2822. package/src/generation/markers/actions/MarkerProcessingRule.js +86 -0
  2823. package/src/generation/markers/actions/placement/MarkerNodeEntityProcessor.js +27 -0
  2824. package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorClingToTerrain.js +57 -0
  2825. package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorRandomRotation.js +30 -0
  2826. package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorSequence.js +64 -0
  2827. package/src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.js +106 -0
  2828. package/src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.spec.js +116 -0
  2829. package/src/generation/markers/actions/probability/MarkerNodeActionWeightedElement.js +51 -0
  2830. package/src/generation/markers/actions/terrain/MarkerNodeActionPaintTerrain.js +265 -0
  2831. package/src/generation/markers/actions/util/GridCellActionDebugBreak.js +28 -0
  2832. package/src/generation/markers/actions/util/GridCellActionLogToConsole.js +21 -0
  2833. package/src/generation/markers/debug/visualizeMarkers.js +196 -0
  2834. package/src/generation/markers/emitter/MarkerNodeConsumer.js +10 -0
  2835. package/src/generation/markers/emitter/MarkerNodeConsumerBuffer.js +87 -0
  2836. package/src/generation/markers/emitter/MarkerNodeEmitter.js +28 -0
  2837. package/src/generation/markers/emitter/MarkerNodeEmitterFromAction.js +64 -0
  2838. package/src/generation/markers/emitter/MarkerNodeEmitterGridCellAction.js +47 -0
  2839. package/src/generation/markers/emitter/MarkerNodeEmitterGroup.js +51 -0
  2840. package/src/generation/markers/emitter/MarkerNodeEmitterPredicated.js +75 -0
  2841. package/src/generation/markers/matcher/MarkerNodeMatcher.js +16 -0
  2842. package/src/generation/markers/matcher/MarkerNodeMatcherAnd.js +31 -0
  2843. package/src/generation/markers/matcher/MarkerNodeMatcherAny.js +13 -0
  2844. package/src/generation/markers/matcher/MarkerNodeMatcherBinary.js +19 -0
  2845. package/src/generation/markers/matcher/MarkerNodeMatcherByType.js +36 -0
  2846. package/src/generation/markers/matcher/MarkerNodeMatcherContainsTag.js +28 -0
  2847. package/src/generation/markers/matcher/MarkerNodeMatcherNone.js +13 -0
  2848. package/src/generation/markers/matcher/MarkerNodeMatcherNot.js +33 -0
  2849. package/src/generation/markers/matcher/MarkerNodeMatcherOr.js +28 -0
  2850. package/src/generation/markers/predicate/GridDataNodePredicate.js +26 -0
  2851. package/src/generation/markers/predicate/GridDataNodePredicateAnd.js +32 -0
  2852. package/src/generation/markers/predicate/GridDataNodePredicateAny.js +13 -0
  2853. package/src/generation/markers/predicate/GridDataNodePredicateBinary.js +42 -0
  2854. package/src/generation/markers/predicate/GridDataNodePredicateNot.js +37 -0
  2855. package/src/generation/markers/predicate/GridDataNodePredicateOverlaps.js +33 -0
  2856. package/src/generation/markers/prototypeGridCellActionPlaceMarker.js +209 -0
  2857. package/src/generation/markers/transform/MarkerNodeTransformRotateRandom.js +33 -0
  2858. package/src/generation/markers/transform/MarkerNodeTransformer.js +26 -0
  2859. package/src/generation/markers/transform/MarkerNodeTransformerAddPositionYFromFilter.js +64 -0
  2860. package/src/generation/markers/transform/MarkerNodeTransformerOffsetPosition.js +45 -0
  2861. package/src/generation/markers/transform/MarkerNodeTransformerRecordProperty.js +57 -0
  2862. package/src/generation/markers/transform/MarkerNodeTransformerRecordPropertyClosure.js +57 -0
  2863. package/src/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +77 -0
  2864. package/src/generation/markers/transform/MarkerNodeTransformerRemoveTag.js +40 -0
  2865. package/src/generation/markers/transform/MarkerNodeTransformerSequence.js +47 -0
  2866. package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.js +72 -0
  2867. package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.js +87 -0
  2868. package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.spec.js +106 -0
  2869. package/src/generation/placement/GridCellActionTransformNearbyMarkers.js +118 -0
  2870. package/src/generation/placement/GridCellPlacementRule.js +122 -0
  2871. package/src/generation/placement/action/GridCellAction.js +32 -0
  2872. package/src/generation/placement/action/GridCellActionPlaceTags.js +123 -0
  2873. package/src/generation/placement/action/GridCellActionPlaceTags.spec.js +21 -0
  2874. package/src/generation/placement/action/GridCellActionWriteFilterToLayer.js +91 -0
  2875. package/src/generation/placement/action/random/CellActionSelectRandom.js +69 -0
  2876. package/src/generation/placement/action/random/weighted/CellActionSelectWeightedRandom.js +123 -0
  2877. package/src/generation/placement/action/random/weighted/WeightedGridCellAction.js +54 -0
  2878. package/src/generation/placement/action/util/CellMatcherWithinAABB.js +33 -0
  2879. package/src/generation/placement/action/util/GridCellActionSequence.js +58 -0
  2880. package/src/generation/placement/action/util/GridCellDisplacedAction.js +55 -0
  2881. package/src/generation/rules/CellMatcher.js +29 -0
  2882. package/src/generation/rules/CellMatcherAny.js +13 -0
  2883. package/src/generation/rules/CellMatcherContainsTag.spec.js +22 -0
  2884. package/src/generation/rules/CellMatcherFromFilter.js +38 -0
  2885. package/src/generation/rules/CellMatcherLayerBitMaskTest.js +67 -0
  2886. package/src/generation/rules/GridLayerCellMatcher.js +31 -0
  2887. package/src/generation/rules/cell/CellMatcherContainsMarkerWithinRadius.js +41 -0
  2888. package/src/generation/rules/cell/CellMatcherGridPattern.js +124 -0
  2889. package/src/generation/rules/cell/GridPatternMatcher.spec.js +285 -0
  2890. package/src/generation/rules/cell/GridPatternMatcherCell.js +33 -0
  2891. package/src/generation/rules/logic/CellMatcherAnd.js +34 -0
  2892. package/src/generation/rules/logic/CellMatcherBinary.js +24 -0
  2893. package/src/generation/rules/logic/CellMatcherDecorator.js +17 -0
  2894. package/src/generation/rules/logic/CellMatcherNot.js +25 -0
  2895. package/src/generation/rules/logic/CellMatcherOr.js +33 -0
  2896. package/src/generation/theme/AreaMask.js +61 -0
  2897. package/src/generation/theme/AreaTheme.js +13 -0
  2898. package/src/generation/theme/TerrainLayerDescription.js +68 -0
  2899. package/src/generation/theme/TerrainLayerRule.js +38 -0
  2900. package/src/generation/theme/TerrainLayerRuleAggregator.js +55 -0
  2901. package/src/generation/theme/TerrainTheme.js +35 -0
  2902. package/src/generation/theme/Theme.js +45 -0
  2903. package/src/generation/theme/ThemeEngine.js +628 -0
  2904. package/src/generation/theme/cell/CellProcessingRule.js +52 -0
  2905. package/src/generation/theme/cell/CellProcessingRuleSet.js +33 -0
  2906. package/src/misc/makeMatcapSelectionOption.d.ts +13 -0
  2907. package/src/misc/makeMatcapSelectionOption.js +52 -0
  2908. package/src/misc/makeMaterialIcon.js +34 -0
  2909. package/src/misc/makeMaterialIconCached.js +50 -0
  2910. package/src/view/DOM.js +174 -0
  2911. package/src/view/SVG.js +122 -0
  2912. package/src/view/View.d.ts +30 -0
  2913. package/src/view/View.js +794 -0
  2914. package/src/view/ViewGroup.js +90 -0
  2915. package/src/view/asset/AssetLoaderStatusView.js +74 -0
  2916. package/src/view/asset/PreloaderView.js +60 -0
  2917. package/src/view/common/LabelView.js +240 -0
  2918. package/src/view/common/ListView.js +287 -0
  2919. package/src/view/common/LocalizedLabelView.js +155 -0
  2920. package/src/view/common/MeshView.js +99 -0
  2921. package/src/view/common/TabbedView.js +126 -0
  2922. package/src/view/common/VirtualListView.js +288 -0
  2923. package/src/view/common/dnd/DragAndDropContext.js +125 -0
  2924. package/src/view/common/dnd/Draggable.js +184 -0
  2925. package/src/view/common/dnd/DropTarget.js +283 -0
  2926. package/src/view/controller/GuiController.js +73 -0
  2927. package/src/view/controller/controls/BooleanVector3Control.js +77 -0
  2928. package/src/view/controller/controls/GuiControl.js +45 -0
  2929. package/src/view/controller/controls/ListController.js +113 -0
  2930. package/src/view/controller/controls/NativeListController.js +87 -0
  2931. package/src/view/controller/controls/NumericIntervalControl.js +90 -0
  2932. package/src/view/controller/controls/Vector1Control.js +102 -0
  2933. package/src/view/controller/controls/Vector2Control.js +87 -0
  2934. package/src/view/controller/controls/Vector3Control.js +93 -0
  2935. package/src/view/controller/controls_v2/AbstractPropertyBinding.ts +10 -0
  2936. package/src/view/controller/controls_v2/Controller.ts +32 -0
  2937. package/src/view/controller/controls_v2/IPropertyBinding.ts +6 -0
  2938. package/src/view/controller/controls_v2/PrimitivePropertyBinding.ts +12 -0
  2939. package/src/view/controller/controls_v2/SliderController.ts +10 -0
  2940. package/src/view/controller/dat/DatGuiUtils.js +451 -0
  2941. package/src/view/currency/CompositeCurrencyLabelView.js +57 -0
  2942. package/src/view/currency/CurrencyDenominationLabelView.js +23 -0
  2943. package/src/view/currency/CurrencyDenominationSpec.js +14 -0
  2944. package/src/view/currency/CurrencyDisplaySpec.js +30 -0
  2945. package/src/view/currency/FantasyCurrencySpec.js +7 -0
  2946. package/src/view/currency/SingleCoinCurrency.js +5 -0
  2947. package/src/view/elements/BottomLeftResizeHandleView.js +52 -0
  2948. package/src/view/elements/CanvasView.js +36 -0
  2949. package/src/view/elements/CheckboxView.js +43 -0
  2950. package/src/view/elements/ColorPickerView.js +296 -0
  2951. package/src/view/elements/CompassArrowView.js +64 -0
  2952. package/src/view/elements/ConfirmationDialogView.js +80 -0
  2953. package/src/view/elements/DropDownSelectionView.js +164 -0
  2954. package/src/view/elements/EmptyView.js +60 -0
  2955. package/src/view/elements/Group.js +37 -0
  2956. package/src/view/elements/MeshPreview.js +283 -0
  2957. package/src/view/elements/SimpleWindow.js +120 -0
  2958. package/src/view/elements/button/ButtonView.js +118 -0
  2959. package/src/view/elements/button/ButtonView.stories.js +14 -0
  2960. package/src/view/elements/image/HTMLElementCacheKey.js +214 -0
  2961. package/src/view/elements/image/ImageView.js +147 -0
  2962. package/src/view/elements/image/SvgImageView.js +84 -0
  2963. package/src/view/elements/label/LabeledValueView.js +68 -0
  2964. package/src/view/elements/navigation/NavigationMenu.js +27 -0
  2965. package/src/view/elements/navigation/ViewStack.js +144 -0
  2966. package/src/view/elements/notify/NotificationView.js +69 -0
  2967. package/src/view/elements/notify/ToastLogView.js +99 -0
  2968. package/src/view/elements/progress/RectangularPieProgressView.js +115 -0
  2969. package/src/view/elements/progress/SmoothProgressBar.js +199 -0
  2970. package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.js +182 -0
  2971. package/src/view/elements/progress/segmented/SegmentDefinition.js +29 -0
  2972. package/src/view/elements/progress/segmented/SegmentedResourceBarView.js +300 -0
  2973. package/src/view/elements/radial/RadialMenu.js +394 -0
  2974. package/src/view/elements/radial/RadialMenuElement.js +209 -0
  2975. package/src/view/elements/radial/RadialMenuElementDefinition.d.ts +39 -0
  2976. package/src/view/elements/radial/RadialMenuElementDefinition.js +219 -0
  2977. package/src/view/elements/radial/RadialProgressView.js +94 -0
  2978. package/src/view/elements/radial/RadialText.js +259 -0
  2979. package/src/view/elements/radial/makeDonut.js +26 -0
  2980. package/src/view/elements/tiles2d/Tile.js +84 -0
  2981. package/src/view/elements/tiles2d/TileGrid.js +456 -0
  2982. package/src/view/elements/video/VideoView.js +165 -0
  2983. package/src/view/elements/windrose/WindRoseDiagram.js +369 -0
  2984. package/src/view/elements/windrose/prototype.js +37 -0
  2985. package/src/view/game/achievements/AchievementNotificationView.js +56 -0
  2986. package/src/view/interaction/CommandButtonView.js +159 -0
  2987. package/src/view/interaction/InteractionCommand.js +61 -0
  2988. package/src/view/interaction/InteractionCommandSet.js +34 -0
  2989. package/src/view/interaction/InterfaceCommand.js +146 -0
  2990. package/src/view/m3_cm_compose_transform.js +66 -0
  2991. package/src/view/m3_rm_compose_transform.js +45 -0
  2992. package/src/view/math/FunctionGraphView.js +85 -0
  2993. package/src/view/minimap/Minimap.js +246 -0
  2994. package/src/view/minimap/dom/MinimapCameraView.js +211 -0
  2995. package/src/view/minimap/dom/MinimapMarkerView.js +80 -0
  2996. package/src/view/minimap/dom/MinimapTerrainView.js +146 -0
  2997. package/src/view/minimap/gl/MarkerGL.js +114 -0
  2998. package/src/view/minimap/gl/MarkerGLAttributes.js +10 -0
  2999. package/src/view/minimap/gl/MinimapFogOfWar.js +187 -0
  3000. package/src/view/minimap/gl/MinimapMarkersGL.js +321 -0
  3001. package/src/view/minimap/gl/MinimapTerrainGL.js +184 -0
  3002. package/src/view/minimap/gl/MinimapWorldGL.js +193 -0
  3003. package/src/view/minimap/gl/MinimapWorldLayer.js +33 -0
  3004. package/src/view/minimap/gl/buildMaterial.js +94 -0
  3005. package/src/view/multiplyMatrices3.js +49 -0
  3006. package/src/view/renderModel.js +102 -0
  3007. package/src/view/string_tag_to_css_class_name.js +12 -0
  3008. package/src/view/task/TaskLoadingScreen.js +172 -0
  3009. package/src/view/task/TaskProgressView.js +150 -0
  3010. package/src/view/tooltip/DomTooltipManager.js +193 -0
  3011. package/src/view/tooltip/DomTooltipObserver.js +166 -0
  3012. package/src/view/tooltip/TooltipManager.js +251 -0
  3013. package/src/view/tooltip/TooltipView.js +364 -0
  3014. package/src/view/tooltip/VisualTip.js +50 -0
  3015. package/src/view/tooltip/gml/GMLEngine.js +543 -0
  3016. package/src/view/tooltip/gml/TooltipParser.js +54 -0
  3017. package/src/view/tooltip/gml/TooltipParser.spec.js +142 -0
  3018. package/src/view/tooltip/gml/compiler/GMLReferenceCompiler.js +36 -0
  3019. package/src/view/tooltip/gml/parser/TooltipReferenceValue.js +19 -0
  3020. package/src/view/tooltip/gml/parser/TooltipTokenType.js +11 -0
  3021. package/src/view/tooltip/gml/parser/parseTooltipString.js +78 -0
  3022. package/src/view/tooltip/gml/parser/readReferenceToken.js +102 -0
  3023. package/src/view/tooltip/gml/parser/readReferenceValueToken.js +56 -0
  3024. package/src/view/tooltip/gml/parser/readStyleToken.js +63 -0
  3025. package/src/view/util/DomSizeObserver.js +196 -0
@@ -0,0 +1,1683 @@
1
+ /**
2
+ * Created by Alex on 11/11/2014.
3
+ */
4
+
5
+
6
+ import { clamp } from "../../../../core/math/clamp.js";
7
+ import { max2 } from "../../../../core/math/max2.js";
8
+ import { min2 } from "../../../../core/math/min2.js";
9
+ import { mix } from "../../../../core/math/mix.js";
10
+ import { BlendingType } from "./BlendingType.js";
11
+ import { assert } from "../../../../core/assert.js";
12
+ import { typedArrayConstructorByInstance } from "./typedArrayConstructorByInstance.js";
13
+ import { typedArrayToDataType } from "../../../../core/collection/array/typedArrayToDataType.js";
14
+ import {
15
+ compute_typed_array_constructor_from_data_type
16
+ } from "../../../../core/collection/table/DataType2TypedArrayConstructorMapping.js";
17
+ import { Base64 } from "../../../../core/binary/Base64.js";
18
+ import { computeStridedIntegerArrayHash } from "../../../computeStridedIntegerArrayHash.js";
19
+ import { is_typed_array_equals } from "../../../../core/collection/array/typed/is_typed_array_equals.js";
20
+
21
+ /**
22
+ * @class
23
+ */
24
+ export class Sampler2D {
25
+ /**
26
+ *
27
+ * @param {ArrayLike<number>|number[]|Uint8ClampedArray|Uint8Array|Uint16Array|Uint32Array|Int8Array|Int16Array|Int32Array|Float32Array|Float64Array} data
28
+ * @param {number} itemSize
29
+ * @param {number} width
30
+ * @param {number} height
31
+ * @constructor
32
+ */
33
+ constructor(data = [], itemSize = 1, width = 0, height = 0) {
34
+ if (!Number.isInteger(itemSize) || itemSize < 0) {
35
+ throw new Error(`itemSize must be a non-negative integer, instead was ${itemSize}`);
36
+ }
37
+ if (!Number.isInteger(width) || itemSize < 0) {
38
+ throw new Error(`width must be a non-negative integer, instead was ${width}`);
39
+ }
40
+ if (!Number.isInteger(height) || itemSize < 0) {
41
+ throw new Error(`height must be a non-negative integer, instead was ${height}`);
42
+ }
43
+
44
+ if (data === undefined) {
45
+ throw new Error("data was undefined");
46
+ }
47
+
48
+ /**
49
+ *
50
+ * @type {Number}
51
+ */
52
+ this.width = width;
53
+
54
+ /**
55
+ *
56
+ * @type {Number}
57
+ */
58
+ this.height = height;
59
+
60
+ /**
61
+ * Number of channels
62
+ * @type {Number}
63
+ */
64
+ this.itemSize = itemSize;
65
+
66
+ /**
67
+ *
68
+ * @type {number[]|Uint8ClampedArray|Uint8Array|Uint16Array|Uint32Array|Int8Array|Int16Array|Int32Array|Float32Array|Float64Array}
69
+ */
70
+ this.data = data;
71
+
72
+ /**
73
+ * Used to tracking changes
74
+ * @type {number}
75
+ */
76
+ this.version = 0;
77
+ /**
78
+ * @readonly
79
+ * @type {boolean}
80
+ */
81
+ this.isSampler2D = true;
82
+ }
83
+
84
+ /**
85
+ * @param {number} [channel=0]
86
+ * @returns {{x: number, index: number, y: number, value: number}}
87
+ */
88
+ computeMax(channel = 0) {
89
+ const itemSize = this.itemSize;
90
+
91
+ assert.typeOf(channel, "number", "channel");
92
+ assert.ok(channel >= 0, `channel must be >= 0, was ${channel}`);
93
+ assert.ok(channel < itemSize, `channel must be less than itemSize(=${itemSize}), was ${channel}`);
94
+
95
+ const data = this.data;
96
+
97
+ const l = data.length;
98
+
99
+ if (l === 0) {
100
+ //no data
101
+ return undefined;
102
+ }
103
+
104
+ let bestValue = data[channel];
105
+ let bestIndex = channel;
106
+
107
+ for (let i = channel + itemSize; i < l; i += itemSize) {
108
+ const value = data[i];
109
+
110
+ if (bestValue < value) {
111
+ bestValue = value;
112
+ bestIndex = i;
113
+ }
114
+
115
+ }
116
+
117
+ const width = this.width;
118
+
119
+ const itemIndex = (bestIndex / this.itemSize) | 0;
120
+
121
+ const x = itemIndex % width;
122
+ const y = (itemIndex / width) | 0;
123
+
124
+ return {
125
+ index: bestIndex,
126
+ value: bestValue,
127
+ x,
128
+ y
129
+ };
130
+ }
131
+
132
+ /**
133
+ * @param {number[]} result
134
+ * @param {number} [channel=0]
135
+ */
136
+ computeMinIndices(result, channel = 0) {
137
+ const itemSize = this.itemSize;
138
+
139
+ assert.typeOf(channel, "number", "channel");
140
+ assert.ok(channel >= 0, `channel must be >= 0, was ${channel}`);
141
+ assert.ok(channel < itemSize, `channel must be less than itemSize(=${itemSize}), was ${channel}`);
142
+
143
+ assert.ok(Array.isArray(result), "result is not an array");
144
+
145
+ const data = this.data;
146
+
147
+ const l = data.length;
148
+
149
+ if (l === 0) {
150
+ //no data
151
+ return undefined;
152
+ }
153
+
154
+ let bestValue = data[channel];
155
+
156
+ let resultCount = 0;
157
+
158
+ for (let i = channel + itemSize; i < l; i += itemSize) {
159
+ const value = data[i];
160
+
161
+ if (bestValue > value) {
162
+ bestValue = value;
163
+ //drop result
164
+ resultCount = 1;
165
+
166
+ result[0] = i;
167
+ } else if (value === bestValue) {
168
+ result[resultCount++] = i;
169
+ }
170
+
171
+ }
172
+
173
+ //crop results
174
+ if (resultCount < result.length) {
175
+ result.splice(resultCount, result.length - resultCount);
176
+ }
177
+
178
+ return;
179
+ }
180
+
181
+ /**
182
+ * @param {number} [channel=0]
183
+ * @returns {{x: number, index: number, y: number, value: number}}
184
+ */
185
+ computeMin(channel = 0) {
186
+ const itemSize = this.itemSize;
187
+
188
+ assert.typeOf(channel, "number", "channel");
189
+ assert.ok(channel >= 0, `channel must be >= 0, was ${channel}`);
190
+ assert.ok(channel < itemSize, `channel must be less than itemSize(=${itemSize}), was ${channel}`);
191
+
192
+ const data = this.data;
193
+
194
+ const l = data.length;
195
+
196
+ if (l === 0) {
197
+ //no data
198
+ return undefined;
199
+ }
200
+
201
+ let bestValue = data[channel];
202
+ let bestIndex = channel;
203
+
204
+ for (let i = channel + itemSize; i < l; i += itemSize) {
205
+ const value = data[i];
206
+
207
+ if (bestValue > value) {
208
+ bestValue = value;
209
+ bestIndex = i;
210
+ }
211
+
212
+ }
213
+
214
+ const width = this.width;
215
+
216
+ const itemIndex = (bestIndex / this.itemSize) | 0;
217
+
218
+ const x = itemIndex % width;
219
+ const y = (itemIndex / width) | 0;
220
+
221
+ return {
222
+ index: bestIndex,
223
+ value: bestValue,
224
+ x,
225
+ y
226
+ };
227
+ }
228
+
229
+ /**
230
+ *
231
+ * @deprecated
232
+ * @param {number} x
233
+ * @param {number}y
234
+ * @param {Vector1|Vector2|Vector3|Vector4} result
235
+ * @returns {number}
236
+ */
237
+ get(x, y, result) {
238
+ console.warn("Deprecated method, use sampleBilinear instead");
239
+
240
+ const t = [];
241
+
242
+ this.sampleBilinear(x, y, t, 0);
243
+
244
+ if (result !== undefined) {
245
+ result.readFromArray(t, 0);
246
+ return result;
247
+ } else {
248
+ return t[0];
249
+ }
250
+ }
251
+
252
+ /**
253
+ *
254
+ * @param {number} u
255
+ * @param {number} v
256
+ * @param {number[]} result
257
+ */
258
+ sampleCatmullRomUV(u, v, result) {
259
+ const itemSize = this.itemSize;
260
+
261
+ for (let i = 0; i < itemSize; i++) {
262
+ result[i] = this.sampleChannelCatmullRomUV(u, v, i);
263
+ }
264
+ }
265
+
266
+ /**
267
+ *
268
+ * @param {number} u
269
+ * @param {number} v
270
+ * @param {number} channel
271
+ * @returns {number}
272
+ */
273
+ sampleChannelCatmullRomUV(u, v, channel) {
274
+ const x = u * (this.width - 1);
275
+ const y = v * (this.height - 1);
276
+
277
+ return this.sampleChannelCatmullRom(x, y, channel);
278
+ }
279
+
280
+ /**
281
+ *
282
+ * @see https://gist.github.com/TheRealMJP/c83b8c0f46b63f3a88a5986f4fa982b1
283
+ * @param {number} x
284
+ * @param {number} y
285
+ * @param {number} channel
286
+ * @returns {number}
287
+ */
288
+ sampleChannelCatmullRom(x, y, channel) {
289
+ // We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding
290
+ // down the sample location to get the exact center of our "starting" texel. The starting texel will be at
291
+ // location [1, 1] in the grid, where [0, 0] is the top-left corner.
292
+ const texPos1_x = Math.floor(x - 0.5) + 0.5;
293
+ const texPos1_y = Math.floor(y - 0.5) + 0.5;
294
+
295
+ // Compute the fractional offset from our starting texel to our original sample location, which we'll
296
+ // feed into the Catmull-Rom spline function to get our filter weights.
297
+ const f_x = x - texPos1_x;
298
+ const f_y = y - texPos1_y;
299
+
300
+ // Compute the Catmull-Rom weights using the fractional offset that we calculated earlier.
301
+ // These equations are pre-expanded based on our knowledge of where the texels will be located,
302
+ // which lets us avoid having to evaluate a piece-wise function.
303
+ const w0_x = f_x * (-0.5 + f_x * (1.0 - 0.5 * f_x));
304
+ const w0_y = f_y * (-0.5 + f_y * (1.0 - 0.5 * f_y));
305
+
306
+ const w1_x = 1.0 + f_x * f_x * (-2.5 + 1.5 * f_x);
307
+ const w1_y = 1.0 + f_y * f_y * (-2.5 + 1.5 * f_y);
308
+
309
+ const w2_x = f_x * (0.5 + f_x * (2.0 - 1.5 * f_x));
310
+ const w2_y = f_y * (0.5 + f_y * (2.0 - 1.5 * f_y));
311
+
312
+ const w3_x = f_x * f_x * (-0.5 + 0.5 * f_x);
313
+ const w3_y = f_y * f_y * (-0.5 + 0.5 * f_y);
314
+
315
+ // Work out weighting factors and sampling offsets that will let us use bilinear filtering to
316
+ // simultaneously evaluate the middle 2 samples from the 4x4 grid.
317
+ const w12_x = w1_x + w2_x;
318
+ const w12_y = w1_y + w2_y;
319
+ const offset12_x = w2_x / w12_x;
320
+ const offset12_y = w2_y / w12_y;
321
+
322
+ // Compute the final coordinates we'll use for sampling the texture
323
+ const texPos0_x = texPos1_x - 1;
324
+ const texPos0_y = texPos1_y - 1;
325
+ const texPos3_x = texPos1_x + 2;
326
+ const texPos3_y = texPos1_y + 2;
327
+ const texPos12_x = texPos1_x + offset12_x;
328
+ const texPos12_y = texPos1_y + offset12_y;
329
+
330
+
331
+ let result = 0.0;
332
+ result += this.sampleChannelBilinear(texPos0_x, texPos0_y, channel) * w0_x * w0_y;
333
+ result += this.sampleChannelBilinear(texPos12_x, texPos0_y, channel) * w12_x * w0_y;
334
+ result += this.sampleChannelBilinear(texPos3_x, texPos0_y, channel) * w3_x * w0_y;
335
+
336
+ result += this.sampleChannelBilinear(texPos0_x, texPos12_y, channel) * w0_x * w12_y;
337
+ result += this.sampleChannelBilinear(texPos12_x, texPos12_y, channel) * w12_x * w12_y;
338
+ result += this.sampleChannelBilinear(texPos3_x, texPos12_y, channel) * w3_x * w12_y;
339
+
340
+ result += this.sampleChannelBilinear(texPos0_x, texPos3_y, channel) * w0_x * w3_y;
341
+ result += this.sampleChannelBilinear(texPos12_x, texPos3_y, channel) * w12_x * w3_y;
342
+ result += this.sampleChannelBilinear(texPos3_x, texPos3_y, channel) * w3_x * w3_y;
343
+
344
+ return result;
345
+ }
346
+
347
+ /**
348
+ *
349
+ * @param {number} u
350
+ * @param {number} v
351
+ * @param {number[]} result
352
+ */
353
+ sampleBicubicUV(u, v, result) {
354
+ const itemSize = this.itemSize;
355
+
356
+ for (let i = 0; i < itemSize; i++) {
357
+ result[i] = this.sampleChannelBicubicUV(u, v, i);
358
+ }
359
+ }
360
+
361
+ /**
362
+ *
363
+ * @param {number} u
364
+ * @param {number} v
365
+ * @param {number} channel
366
+ * @returns {number}
367
+ */
368
+ sampleChannelBicubicUV(u, v, channel) {
369
+ const x = u * (this.width - 1);
370
+ const y = v * (this.height - 1);
371
+
372
+ return this.sampleChannelBicubic(x - 0.5, y - 0.5, channel);
373
+ }
374
+
375
+ /**
376
+ * Bicubic-filtered sampling
377
+ * @param {number} x
378
+ * @param {number} y
379
+ * @param {number} channel
380
+ * @returns {number}
381
+ */
382
+ sampleChannelBicubic(x, y, channel) {
383
+
384
+ const itemSize = this.itemSize;
385
+
386
+ const width = this.width;
387
+ const height = this.height;
388
+
389
+ const data = this.data;
390
+
391
+ const rowSize = width * itemSize;
392
+
393
+ const x_max = width - 1;
394
+ const y_max = height - 1;
395
+
396
+ const clamped_x = clamp(x, 0, x_max)
397
+ const clamped_y = clamp(y, 0, y_max)
398
+
399
+ // fractional texel position (from the nearest low texel)
400
+ const x1 = clamped_x | 0;
401
+ const y1 = clamped_y | 0;
402
+
403
+ const xd = clamped_x - x1;
404
+ const yd = clamped_y - y1;
405
+
406
+ const x0 = max2(0, x1 - 1);
407
+ const y0 = max2(0, y1 - 1);
408
+
409
+ const x2 = min2(x_max, x1 + 1);
410
+ const y2 = min2(y_max, y1 + 1);
411
+
412
+ const x3 = min2(x_max, x2 + 1);
413
+ const y3 = min2(y_max, y2 + 1);
414
+
415
+ // compute row offsets
416
+ const row0 = y0 * rowSize;
417
+ const row1 = y1 * rowSize;
418
+ const row2 = y2 * rowSize;
419
+ const row3 = y3 * rowSize;
420
+
421
+ const row0_address = row0 + channel;
422
+ const row1_address = row1 + channel;
423
+ const row2_address = row2 + channel;
424
+ const row3_address = row3 + channel;
425
+
426
+ const col0_offset = x0 * itemSize;
427
+ const col1_offset = x1 * itemSize;
428
+ const col2_offset = x2 * itemSize;
429
+ const col3_offset = x3 * itemSize;
430
+
431
+ // read samples
432
+ const vi0 = data[row0_address + col0_offset];
433
+ const vi1 = data[row0_address + col1_offset];
434
+ const vi2 = data[row0_address + col2_offset];
435
+ const vi3 = data[row0_address + col3_offset];
436
+
437
+ const vj0 = data[row1_address + col0_offset];
438
+ const vj1 = data[row1_address + col1_offset];
439
+ const vj2 = data[row1_address + col2_offset];
440
+ const vj3 = data[row1_address + col3_offset];
441
+
442
+ const vk0 = data[row2_address + col0_offset];
443
+ const vk1 = data[row2_address + col1_offset];
444
+ const vk2 = data[row2_address + col2_offset];
445
+ const vk3 = data[row2_address + col3_offset];
446
+
447
+ const vl0 = data[row3_address + col0_offset];
448
+ const vl1 = data[row3_address + col1_offset];
449
+ const vl2 = data[row3_address + col2_offset];
450
+ const vl3 = data[row3_address + col3_offset];
451
+
452
+
453
+ // return bicubic(xd, yd,
454
+ // vi0, vi1, vi2, vi3,
455
+ // vj0, vj1, vj2, vj3,
456
+ // vk0, vk1, vk2, vk3,
457
+ // vl0, vl1, vl2, vl3,
458
+ // );
459
+
460
+
461
+ // perform filtering in X (rows)
462
+ const s0 = bicubic_terp(xd, vi0, vi1, vi2, vi3);
463
+ const s1 = bicubic_terp(xd, vj0, vj1, vj2, vj3);
464
+ const s2 = bicubic_terp(xd, vk0, vk1, vk2, vk3);
465
+ const s3 = bicubic_terp(xd, vl0, vl1, vl2, vl3);
466
+
467
+ // filter in Y (columns)
468
+ return bicubic_terp(yd, s0, s1, s2, s3);
469
+ }
470
+
471
+ /**
472
+ *
473
+ * @param {number} u
474
+ * @param {number} v
475
+ * @param {number[]} result
476
+ * @param {number} result_offset
477
+ */
478
+ sampleBilinearUV(u, v, result, result_offset = 0) {
479
+
480
+ const itemSize = this.itemSize;
481
+
482
+ for (let i = 0; i < itemSize; i++) {
483
+ result[i + result_offset] = this.sampleChannelBilinearUV(u, v, i);
484
+
485
+ }
486
+ }
487
+
488
+ /**
489
+ *
490
+ * @param {number} x
491
+ * @param {number} y
492
+ * @param {number[]} result
493
+ * @param {number} result_offset
494
+ */
495
+ sampleBilinear(x, y, result, result_offset = 0) {
496
+
497
+ const itemSize = this.itemSize;
498
+
499
+ for (let i = 0; i < itemSize; i++) {
500
+ //TODO this can be optimized greatly
501
+ result[i + result_offset] = this.sampleChannelBilinear(x, y, i);
502
+
503
+ }
504
+ }
505
+
506
+ /**
507
+ *
508
+ * @param {number} u
509
+ * @param {number} v
510
+ * @param {number} channel
511
+ * @return {number}
512
+ */
513
+ sampleChannelBilinearUV(u, v, channel) {
514
+ const x = u * (this.width - 1);
515
+ const y = v * (this.height - 1);
516
+
517
+ return this.sampleChannelBilinear(x, y, channel);
518
+ }
519
+
520
+ /**
521
+ *
522
+ * @param {number} x
523
+ * @param {number} y
524
+ * @param {number} channel
525
+ * @returns {number}
526
+ */
527
+ sampleChannelBilinear(x, y, channel) {
528
+ assert.isNonNegativeInteger(channel, 'channel');
529
+
530
+ const itemSize = this.itemSize;
531
+
532
+ const width = this.width;
533
+ const height = this.height;
534
+
535
+ const rowSize = width * itemSize;
536
+
537
+ //sample 4 points
538
+ const x_max = width - 1;
539
+ const y_max = height - 1;
540
+
541
+ const clamped_x = clamp(x, 0, x_max);
542
+ const clamped_y = clamp(y, 0, y_max);
543
+
544
+ const x0 = clamped_x | 0;
545
+ const y0 = clamped_y | 0;
546
+
547
+ //
548
+ const row0 = y0 * rowSize;
549
+ const col0_offset = x0 * itemSize + channel;
550
+
551
+ const i0 = row0 + col0_offset;
552
+
553
+ //
554
+ let x1, y1;
555
+
556
+ if (clamped_x === x0 || x0 >= x_max) {
557
+ x1 = x0;
558
+ } else {
559
+ x1 = x0 + 1;
560
+ }
561
+
562
+
563
+ if (clamped_y === y0 || y0 >= y_max) {
564
+ y1 = y0;
565
+ } else {
566
+ y1 = y0 + 1;
567
+ }
568
+
569
+ const data = this.data;
570
+
571
+ const q0 = data[i0];
572
+
573
+ if (x0 === x1 && y0 === y1) {
574
+ return q0;
575
+ }
576
+
577
+ //
578
+ const xd = clamped_x - x0;
579
+ const yd = clamped_y - y0;
580
+
581
+ const col1_offset = x1 * itemSize + channel;
582
+
583
+ const i1 = row0 + col1_offset;
584
+
585
+ const row1 = y1 * rowSize;
586
+
587
+ const j0 = row1 + col0_offset;
588
+ const j1 = row1 + col1_offset;
589
+
590
+ const q1 = data[i1];
591
+ const p0 = data[j0];
592
+ const p1 = data[j1];
593
+
594
+ // perform Bi-Linear interpolation
595
+ const s0 = mix(q0, q1, xd);
596
+ const s1 = mix(p0, p1, xd);
597
+
598
+ return mix(s0, s1, yd);
599
+ }
600
+
601
+ sampleNearestUV(u, v, result) {
602
+ const x = Math.round(u * (this.width - 1));
603
+ const y = Math.round(v * (this.height - 1));
604
+
605
+ this.read(min2(x, this.width - 1), min2(y, this.height - 1), result);
606
+ }
607
+
608
+ /**
609
+ *
610
+ * @param {number} x
611
+ * @param {number} y
612
+ * @param {number} channel
613
+ * @returns {number}
614
+ */
615
+ readChannel(x, y, channel) {
616
+ assert.isNumber(x, "x");
617
+ assert.isNumber(y, "y");
618
+ assert.isNumber(channel, "channel");
619
+
620
+ assert.isNonNegativeInteger(channel, 'channel');
621
+
622
+ const index = (y * this.width + x) * this.itemSize + channel;
623
+
624
+ return this.data[index];
625
+ }
626
+
627
+ /**
628
+ *
629
+ * @param {number} x
630
+ * @param {number} y
631
+ * @param {number[]} result
632
+ */
633
+ read(x, y, result) {
634
+
635
+ const width = this.width;
636
+
637
+ const itemSize = this.itemSize;
638
+
639
+ const i0 = (y * width + x) * itemSize;
640
+
641
+ for (let i = 0; i < itemSize; i++) {
642
+ const v = this.data[i0 + i];
643
+
644
+ result[i] = v;
645
+ }
646
+ }
647
+
648
+ /**
649
+ *
650
+ * @param {number} u
651
+ * @param {number} v
652
+ * @param {Vector4|Vector3|Vector2} [result]
653
+ * @deprecated
654
+ */
655
+ sample(u, v, result) {
656
+ console.warn("Deprecated method, use sampleBilinear instead");
657
+
658
+ const temp = [];
659
+
660
+ this.sampleBilinear(u * (this.width - 1), v * (this.height - 1), temp, 0);
661
+
662
+ result.readFromArray(temp);
663
+
664
+ return temp[0];
665
+ }
666
+
667
+ /**
668
+ *
669
+ * @param {number} index
670
+ * @param {number[]} result
671
+ */
672
+ computeNeighbors(index, result) {
673
+ const width = this.width;
674
+ const height = this.height;
675
+
676
+ const x = index % width;
677
+ const y = (index / width) | 0;
678
+ if (x > 0) {
679
+ result.push(index - 1);
680
+ }
681
+ if (x < width - 1) {
682
+ result.push(index + 1);
683
+ }
684
+ if (y > 0) {
685
+ result.push(index - width);
686
+ }
687
+ if (y < height - 1) {
688
+ result.push(index + width);
689
+ }
690
+ }
691
+
692
+ /**
693
+ *
694
+ * @param {number} x
695
+ * @param {number} y
696
+ * @returns {number}
697
+ */
698
+ point2index(x, y) {
699
+ return x + y * this.width;
700
+ }
701
+
702
+ /**
703
+ *
704
+ * @param {number} index
705
+ * @param {Vector2} result
706
+ */
707
+ index2point(index, result) {
708
+ const width = this.width;
709
+
710
+ const x = index % width;
711
+ const y = (index / width) | 0;
712
+
713
+ result.set(x, y);
714
+ }
715
+
716
+ /**
717
+ *
718
+ * @param {number} scale
719
+ * @param {number} offset
720
+ * @return {function(index:int, array:ArrayLike, x:int, y:int)}
721
+ */
722
+ makeArrayFiller(scale, offset) {
723
+ scale = scale || 255;
724
+ offset = offset || 0;
725
+
726
+ const sampler = this;
727
+ const v4 = [1 / scale, 1 / scale, 1 / scale, 1 / scale];
728
+
729
+ //
730
+ function fillDD1(index, array, x, y) {
731
+ const val = (sampler.sampleChannelBilinear(x, y, 0) + offset) * scale | 0;
732
+ array[index] = val;
733
+ array[index + 1] = val;
734
+ array[index + 2] = val;
735
+ array[index + 3] = 255;
736
+ }
737
+
738
+ function fillDD2(index, array, x, y) {
739
+ sampler.sampleBilinear(x, y, v4, 0);
740
+ const val = (v4[0] + offset) * scale | 0;
741
+ array.fill(val, index, index + 3);
742
+ array[index + 3] = (v4[1] + offset) * scale | 0;
743
+ }
744
+
745
+ function fillDD3(index, array, x, y) {
746
+
747
+ sampler.sampleBilinear(x, y, v4, 0);
748
+
749
+ array[index] = (v4[0] + offset) * scale | 0;
750
+ array[index + 1] = (v4[1] + offset) * scale | 0;
751
+ array[index + 2] = (v4[2] + offset) * scale | 0;
752
+ array[index + 3] = 255;
753
+ }
754
+
755
+ function fillDD4(index, array, x, y) {
756
+ sampler.sampleBilinear(x, y, v4, 0);
757
+ array[index] = (v4[0] + offset) * scale | 0;
758
+ array[index + 1] = (v4[1] + offset) * scale | 0;
759
+ array[index + 2] = (v4[2] + offset) * scale | 0;
760
+ array[index + 3] = (v4[3] + offset) * scale | 0;
761
+ }
762
+
763
+ let fillDD;
764
+ switch (sampler.itemSize) {
765
+ case 1:
766
+ fillDD = fillDD1;
767
+ break;
768
+ case 2:
769
+ fillDD = fillDD2;
770
+ break;
771
+ case 3:
772
+ fillDD = fillDD3;
773
+ break;
774
+ case 4:
775
+ fillDD = fillDD4;
776
+ break;
777
+ default :
778
+ throw new Error("unsupported item size");
779
+ break;
780
+ }
781
+ return fillDD;
782
+ }
783
+
784
+ /**
785
+ * Copy a patch from another sampler with a margin.
786
+ * This is useful for texture rendering where filtering can cause bleeding along the edges of the patch.
787
+ * @param {Sampler2D} source where to copy from
788
+ * @param {Number} sourceX where to start reading from, X coordinate
789
+ * @param {Number} sourceY where to start reading from, X coordinate
790
+ * @param {Number} destinationX where to start writing to, X coordinate
791
+ * @param {Number} destinationY where to start writing to, X coordinate
792
+ * @param {Number} width size of the patch that is to be copied
793
+ * @param {Number} height size of the patch that is to be copied
794
+ * @param {Number} marginLeft
795
+ * @param {Number} marginRight
796
+ * @param {Number} marginTop
797
+ * @param {Number} marginBottom
798
+ */
799
+ copyWithMargin(source, sourceX, sourceY, destinationX, destinationY, width, height, marginLeft, marginRight, marginTop, marginBottom) {
800
+ const dItemSize = this.itemSize;
801
+ const sItemSize = source.itemSize;
802
+ const _itemSize = Math.min(dItemSize, sItemSize);
803
+
804
+
805
+ const dRowSize = dItemSize * this.width;
806
+ const sRowSize = sItemSize * source.width;
807
+
808
+ const sData = source.data;
809
+ const dData = this.data;
810
+
811
+ let x, y, i, j;
812
+
813
+ let xMax, yMax;
814
+
815
+ let dA, sA, dOffset, sOffset;
816
+ //Write top-left corner
817
+ sOffset = sourceY * sRowSize + sourceX * dItemSize;
818
+ for (y = Math.max(0, destinationY - marginTop), yMax = destinationY; y < yMax; y++) {
819
+ dA = y * dRowSize;
820
+
821
+ for (x = Math.max(0, destinationX - marginLeft), xMax = destinationX; x < xMax; x++) {
822
+
823
+ dOffset = dA + x * dItemSize;
824
+
825
+ for (i = 0; i < _itemSize; i++) {
826
+ dData[dOffset + i] = sData[sOffset + i];
827
+ }
828
+ }
829
+ }
830
+ //Write top margin
831
+ sA = sourceY * sRowSize;
832
+ for (y = Math.max(0, destinationY - marginTop), yMax = destinationY; y < yMax; y++) {
833
+ dA = y * dRowSize;
834
+
835
+ for (x = 0; x < width; x++) {
836
+
837
+ dOffset = dA + (x + destinationX) * dItemSize;
838
+ sOffset = sA + (x + sourceX) * dItemSize;
839
+ for (i = 0; i < _itemSize; i++) {
840
+ dData[dOffset + i] = sData[sOffset + i];
841
+ }
842
+ }
843
+ }
844
+ //Write top-right corner
845
+ sOffset = sourceY * sRowSize + (sourceX + width - 1) * dItemSize;
846
+ for (y = Math.max(0, destinationY - marginTop), yMax = destinationY; y < yMax; y++) {
847
+ dA = y * dRowSize;
848
+
849
+ for (x = destinationX + width, xMax = Math.min(this.width, x + marginRight); x < xMax; x++) {
850
+
851
+ dOffset = dA + x * dItemSize;
852
+
853
+ for (i = 0; i < _itemSize; i++) {
854
+ dData[dOffset + i] = sData[sOffset + i];
855
+ }
856
+ }
857
+ }
858
+ //Write left margin
859
+ for (y = 0; y < height; y++) {
860
+ dA = (y + destinationY) * dRowSize;
861
+ sA = (y + sourceY) * sRowSize;
862
+
863
+ sOffset = sA + (sourceX) * dItemSize;
864
+
865
+ for (x = Math.max(0, destinationX - marginLeft), xMax = destinationX; x < xMax; x++) {
866
+
867
+ dOffset = dA + x * dItemSize;
868
+
869
+ for (i = 0; i < _itemSize; i++) {
870
+ dData[dOffset + i] = sData[sOffset + i];
871
+ }
872
+ }
873
+ }
874
+ //write actual patch
875
+ this.copy(source, sourceX, sourceY, destinationX, destinationY, width, height);
876
+
877
+ //Write right margin
878
+ for (y = 0; y < height; y++) {
879
+ dA = (y + destinationY) * dRowSize;
880
+ sA = (y + sourceY) * sRowSize;
881
+
882
+ sOffset = sA + (sourceX + width - 1) * dItemSize;
883
+
884
+ for (x = destinationX + width, xMax = Math.min(this.width, x + marginRight); x < xMax; x++) {
885
+
886
+ dOffset = dA + x * dItemSize;
887
+
888
+ for (i = 0; i < _itemSize; i++) {
889
+ dData[dOffset + i] = sData[sOffset + i];
890
+ }
891
+ }
892
+ }
893
+
894
+ //Write Bottom-left margin
895
+ sOffset = (sourceY + height - 1) * sRowSize + sourceX * dItemSize;
896
+ for (y = destinationY + width, yMax = Math.min(this.height, y + marginBottom); y < yMax; y++) {
897
+ dA = y * dRowSize;
898
+
899
+ for (x = Math.max(0, destinationX - marginLeft), xMax = destinationX; x < xMax; x++) {
900
+
901
+ dOffset = dA + x * dItemSize;
902
+
903
+ for (i = 0; i < _itemSize; i++) {
904
+ dData[dOffset + i] = sData[sOffset + i];
905
+ }
906
+ }
907
+ }
908
+ //Write Bottom margin
909
+ sA = (sourceY + height - 1) * sRowSize;
910
+ for (y = destinationY + width, yMax = Math.min(this.height, y + marginBottom); y < yMax; y++) {
911
+ dA = y * dRowSize;
912
+
913
+ for (x = 0; x < width; x++) {
914
+
915
+ dOffset = dA + (x + destinationX) * dItemSize;
916
+ sOffset = sA + (x + sourceX) * dItemSize;
917
+ for (i = 0; i < _itemSize; i++) {
918
+ dData[dOffset + i] = sData[sOffset + i];
919
+ }
920
+ }
921
+ }
922
+ //Write Bottom-right margin
923
+ sOffset = (sourceY + height - 1) * sRowSize + (sourceX + width - 1) * dItemSize;
924
+ for (y = destinationY + width, yMax = Math.min(this.height, y + marginBottom); y < yMax; y++) {
925
+ dA = y * dRowSize;
926
+
927
+ for (x = destinationX + width, xMax = Math.min(this.width, x + marginRight); x < xMax; x++) {
928
+
929
+ dOffset = dA + x * dItemSize;
930
+
931
+ for (i = 0; i < _itemSize; i++) {
932
+ dData[dOffset + i] = sData[sOffset + i];
933
+ }
934
+ }
935
+ }
936
+
937
+ this.version++;
938
+ }
939
+
940
+ /**
941
+ * Copy a patch from another sampler
942
+ * @param {Sampler2D} source where to copy from
943
+ * @param {Number} sourceX where to start reading from, X coordinate
944
+ * @param {Number} sourceY where to start reading from, X coordinate
945
+ * @param {Number} destinationX where to start writing to, X coordinate
946
+ * @param {Number} destinationY where to start writing to, X coordinate
947
+ * @param {Number} width size of the patch that is to be copied
948
+ * @param {Number} height size of the patch that is to be copied
949
+ */
950
+ copy(
951
+ source, sourceX, sourceY,
952
+ destinationX, destinationY, width, height
953
+ ) {
954
+
955
+ assert.isNumber(sourceX, 'sourceX');
956
+ assert.isNumber(sourceY, 'sourceY');
957
+
958
+ assert.isNumber(destinationX, 'destinationX');
959
+ assert.isNumber(destinationY, 'destinationY');
960
+
961
+ assert.isNumber(width, 'width');
962
+ assert.isNumber(height, 'height');
963
+
964
+ const _w = Math.min(width, source.width - sourceX, this.width - destinationX);
965
+ const _h = Math.min(height, source.height - sourceY, this.height - destinationY);
966
+
967
+
968
+ const dItemSize = this.itemSize;
969
+ const sItemSize = source.itemSize;
970
+ const _itemSize = Math.min(dItemSize, sItemSize);
971
+
972
+
973
+ const dRowSize = dItemSize * this.width;
974
+ const sRowSize = sItemSize * source.width;
975
+
976
+ const sData = source.data;
977
+ const dData = this.data;
978
+
979
+ let x, y, i;
980
+
981
+ for (y = 0; y < _h; y++) {
982
+ const dA = (y + destinationY) * dRowSize;
983
+ const sA = (y + sourceY) * sRowSize;
984
+ for (x = 0; x < _w; x++) {
985
+ const dOffset = dA + (x + destinationX) * dItemSize;
986
+ const sOffset = sA + (x + sourceX) * sItemSize;
987
+ for (i = 0; i < _itemSize; i++) {
988
+ dData[dOffset + i] = sData[sOffset + i];
989
+ }
990
+ }
991
+ }
992
+
993
+ this.version++;
994
+ }
995
+
996
+ /**
997
+ * Copy a patch from another sampler with the same itemSize
998
+ * @param {Sampler2D} source where to copy from
999
+ * @param {Number} sourceX where to start reading from, X coordinate
1000
+ * @param {Number} sourceY where to start reading from, X coordinate
1001
+ * @param {Number} destinationX where to start writing to, X coordinate
1002
+ * @param {Number} destinationY where to start writing to, X coordinate
1003
+ * @param {Number} width size of the patch that is to be copied
1004
+ * @param {Number} height size of the patch that is to be copied
1005
+ */
1006
+ copy_sameItemSize(source, sourceX, sourceY, destinationX, destinationY, width, height) {
1007
+ const itemSize = this.itemSize;
1008
+ const sItemSize = source.itemSize;
1009
+
1010
+ assert.equal(sItemSize, sItemSize, `source.itemSize(=${sItemSize}) != this.itemSize(=${itemSize})`);
1011
+
1012
+ const _w = Math.min(width, source.width - sourceX, this.width - destinationX);
1013
+ const _h = Math.min(height, source.height - sourceY, this.height - destinationY);
1014
+
1015
+
1016
+ const dRowSize = itemSize * this.width;
1017
+ const sRowSize = itemSize * source.width;
1018
+
1019
+ const sData = source.data;
1020
+ const dData = this.data;
1021
+
1022
+ const patchRowSize = _w * itemSize;
1023
+
1024
+ let y, i;
1025
+
1026
+ for (y = 0; y < _h; y++) {
1027
+ const dA = (y + destinationY) * dRowSize;
1028
+ const sA = (y + sourceY) * sRowSize;
1029
+
1030
+ const dOffset = dA + destinationX * itemSize;
1031
+ const sOffset = sA + sourceX * itemSize;
1032
+
1033
+ for (i = 0; i < patchRowSize; i++) {
1034
+
1035
+ dData[dOffset + i] = sData[sOffset + i];
1036
+
1037
+ }
1038
+ }
1039
+
1040
+ this.version++;
1041
+ }
1042
+
1043
+ /**
1044
+ * Assumes both samplers are uint8 with values 0-255
1045
+ * @param {Sampler2D} source
1046
+ * @param sourceX
1047
+ * @param sourceY
1048
+ * @param destinationX
1049
+ * @param destinationY
1050
+ * @param width
1051
+ * @param height
1052
+ * @param {BlendingType} [blendMode]
1053
+ */
1054
+ paint(source, sourceX, sourceY, destinationX, destinationY, width, height, blendMode = BlendingType.Normal) {
1055
+ let blendFunction;
1056
+ if (blendMode === BlendingType.Normal) {
1057
+ blendFunction = blendFunctionNormal;
1058
+ } else {
1059
+ throw new Error(`Unsupported blendType(=${blendMode})`);
1060
+ }
1061
+
1062
+ const _w = Math.min(width, source.width - sourceX, this.width - destinationX);
1063
+ const _h = Math.min(height, source.height - sourceY, this.height - destinationY);
1064
+
1065
+ const _x0 = Math.max(0, -destinationX);
1066
+ const _y0 = Math.max(0, -destinationY);
1067
+
1068
+ const c0 = [0, 0, 0, 255];
1069
+ const c1 = [0, 0, 0, 255];
1070
+
1071
+ const c3 = [];
1072
+
1073
+ let x, y;
1074
+
1075
+ for (y = _y0; y < _h; y++) {
1076
+ for (x = _x0; x < _w; x++) {
1077
+ const d_x = Math.round(x + destinationX);
1078
+ const d_y = Math.round(y + destinationY);
1079
+
1080
+ this.read(d_x, d_y, c0);
1081
+
1082
+ const s_x = Math.round(x + sourceY);
1083
+ const s_y = Math.round(y + sourceY);
1084
+
1085
+ source.read(s_x, s_y, c1);
1086
+
1087
+ blendFunction(c1, c0, c3);
1088
+
1089
+ this.set(d_x, d_y, c3);
1090
+
1091
+ }
1092
+ }
1093
+
1094
+
1095
+ }
1096
+
1097
+ /**
1098
+ * Fill data values with zeros for a given area
1099
+ * @param {Number} x
1100
+ * @param {Number} y
1101
+ * @param {Number} width
1102
+ * @param {Number} height
1103
+ */
1104
+ zeroFill(x, y, width, height) {
1105
+ assert.isNonNegativeInteger(width, 'width');
1106
+ assert.isNonNegativeInteger(height, 'height');
1107
+
1108
+ const x0 = clamp(x, 0, this.width);
1109
+ const y0 = clamp(y, 0, this.height);
1110
+ const x1 = clamp(x + width, 0, this.width);
1111
+ const y1 = clamp(y + height, 0, this.height);
1112
+
1113
+ // console.log(`#zerofill x:${x}, y:${y}, width:${width}, height:${height} \t -> \t x0:${x0}, y0:${y0}, x1:${x1}, y1:${y1}`); // DEBUG
1114
+
1115
+ const data = this.data;
1116
+ const itemSize = this.itemSize;
1117
+
1118
+ const rowSize = itemSize * this.width;
1119
+
1120
+ const clearRowOffset0 = x0 * itemSize;
1121
+ const clearRowOffset1 = x1 * itemSize;
1122
+
1123
+ let _y;
1124
+
1125
+ for (_y = y0; _y < y1; _y++) {
1126
+
1127
+ const a = _y * rowSize;
1128
+
1129
+ data.fill(0, a + clearRowOffset0, a + clearRowOffset1);
1130
+
1131
+ }
1132
+
1133
+ this.version++;
1134
+ }
1135
+
1136
+ /**
1137
+ *
1138
+ * @param {number} channel_index
1139
+ * @param {number} value
1140
+ */
1141
+ fill_channel(channel_index, value) {
1142
+ const itemSize = this.itemSize;
1143
+ const data = this.data;
1144
+ const length = data.length;
1145
+
1146
+ for (let i = channel_index; i < length; i += itemSize) {
1147
+ data[i] = value;
1148
+ }
1149
+
1150
+ this.version++;
1151
+ }
1152
+
1153
+ /**
1154
+ *
1155
+ * @param {Number} x
1156
+ * @param {Number} y
1157
+ * @param {Number} width
1158
+ * @param {Number} height
1159
+ * @param {Array.<Number>} value
1160
+ */
1161
+ fill(x, y, width, height, value) {
1162
+
1163
+ const _w = this.width;
1164
+ const _h = this.height;
1165
+
1166
+ const x0 = clamp(x, 0, _w);
1167
+ const y0 = clamp(y, 0, _h);
1168
+ const x1 = clamp(x + width, 0, _w);
1169
+ const y1 = clamp(y + height, 0, _h);
1170
+
1171
+ const data = this.data;
1172
+ const itemSize = this.itemSize;
1173
+
1174
+ const rowSize = itemSize * _w;
1175
+
1176
+ let _y, _x, i;
1177
+
1178
+ for (_y = y0; _y < y1; _y++) {
1179
+
1180
+ const a = _y * rowSize;
1181
+
1182
+ for (_x = x0; _x < x1; _x++) {
1183
+
1184
+ const offset = a + _x * itemSize;
1185
+
1186
+ for (i = 0; i < itemSize; i++) {
1187
+
1188
+ data[offset + i] = value[i];
1189
+
1190
+ }
1191
+
1192
+ }
1193
+ }
1194
+
1195
+ this.version++;
1196
+ }
1197
+
1198
+ /**
1199
+ * Set channel value of a specific texel
1200
+ * @param {number} x
1201
+ * @param {number} y
1202
+ * @param {number} channel
1203
+ * @param {number} value
1204
+ */
1205
+ writeChannel(x, y, channel, value) {
1206
+ assert.isNumber(x, "x");
1207
+ assert.isNumber(y, "y");
1208
+
1209
+ assert.greaterThanOrEqual(x, 0);
1210
+ assert.greaterThanOrEqual(y, 0);
1211
+ assert.lessThan(x, this.width);
1212
+ assert.lessThan(y, this.height);
1213
+
1214
+ const pointIndex = y * this.width + x;
1215
+ const pointAddress = pointIndex * this.itemSize;
1216
+ const channelAddress = pointAddress + channel;
1217
+
1218
+ this.data[channelAddress] = value;
1219
+
1220
+ this.version++;
1221
+ }
1222
+
1223
+ /**
1224
+ *
1225
+ * @param {number} x
1226
+ * @param {number} y
1227
+ * @param {number[]|Float32Array} value
1228
+ */
1229
+ set(x, y, value) {
1230
+ const data = this.data;
1231
+ const itemSize = this.itemSize;
1232
+
1233
+ const rowSize = itemSize * this.width;
1234
+
1235
+ const offset = (rowSize * y) + x * itemSize;
1236
+
1237
+ for (let i = 0; i < itemSize; i++) {
1238
+ data[offset + i] = value[i];
1239
+ }
1240
+
1241
+ this.version++;
1242
+ }
1243
+
1244
+ /**
1245
+ * Traverses area inside a circle
1246
+ * NOTE: Based on palm3d answer on stack overflow: https://stackoverflow.com/questions/1201200/fast-algorithm-for-drawing-filled-circles
1247
+ * @param {number} centerX
1248
+ * @param {number} centerY
1249
+ * @param {number} radius
1250
+ * @param {function(x:number,y:number, sampler:Sampler2D)} visitor
1251
+ */
1252
+ traverseCircle(centerX, centerY, radius, visitor) {
1253
+ let x, y;
1254
+
1255
+ //convert offsets to integers for safety
1256
+ const offsetX = centerX | 0;
1257
+ const offsetY = centerY | 0;
1258
+
1259
+ const r2 = radius * radius;
1260
+
1261
+ const radiusCeil = Math.ceil(radius);
1262
+
1263
+ for (y = -radiusCeil; y <= radiusCeil; y++) {
1264
+ const y2 = y * y;
1265
+
1266
+ for (x = -radiusCeil; x <= radiusCeil; x++) {
1267
+
1268
+ if (x * x + y2 <= r2) {
1269
+ visitor(offsetX + x, offsetY + y, this);
1270
+ }
1271
+
1272
+ }
1273
+ }
1274
+ }
1275
+
1276
+ /**
1277
+ *
1278
+ * @param {number} x
1279
+ * @param {number} y
1280
+ * @param {boolean} [preserveData=true]
1281
+ */
1282
+ resize(x, y, preserveData = true) {
1283
+ assert.isNonNegativeInteger(x, 'x');
1284
+ assert.isNonNegativeInteger(y, 'y');
1285
+
1286
+ const _w = this.width;
1287
+ const _h = this.height;
1288
+
1289
+ if (_w === x && _h === y) {
1290
+ // size didn't change
1291
+ return;
1292
+ }
1293
+
1294
+ const itemSize = this.itemSize;
1295
+
1296
+ const length = x * y * itemSize;
1297
+
1298
+ const oldData = this.data;
1299
+
1300
+ const Constructor = typedArrayConstructorByInstance(oldData);
1301
+
1302
+ const newData = new Constructor(length);
1303
+
1304
+ if (preserveData) {
1305
+ //copy old data
1306
+ if (x === _w) {
1307
+ // number of columns is preserved, we can just copy the old data across
1308
+ newData.set(oldData.subarray(0, Math.min(oldData.length, length)));
1309
+ } else {
1310
+ //we need to copy new data row-by-row
1311
+ const rowCount = min2(y, _h);
1312
+
1313
+ const columnCount = min2(x, _w);
1314
+
1315
+ for (let i = 0; i < rowCount; i++) {
1316
+ for (let j = 0; j < columnCount; j++) {
1317
+
1318
+ const targetItemAddress = (i * x + j) * itemSize;
1319
+ const sourceItemAddress = (i * _w + j) * itemSize;
1320
+
1321
+ for (let k = 0; k < itemSize; k++) {
1322
+
1323
+ newData[targetItemAddress + k] = oldData[sourceItemAddress + k];
1324
+
1325
+ }
1326
+ }
1327
+ }
1328
+ }
1329
+ }
1330
+
1331
+ this.width = x;
1332
+ this.height = y;
1333
+
1334
+ this.data = newData;
1335
+
1336
+ this.version++;
1337
+ }
1338
+
1339
+ /**
1340
+ * Estimate memory requirement of the object
1341
+ * @return {number}
1342
+ */
1343
+ computeByteSize() {
1344
+ let dataSize;
1345
+
1346
+ if (Array.isArray(this.data)) {
1347
+ dataSize = 8 * this.data.length;
1348
+ } else {
1349
+ dataSize = this.data.buffer.byteLength;
1350
+ }
1351
+
1352
+ return dataSize + 280;
1353
+ }
1354
+
1355
+ /**
1356
+ * @deprecated Use {@link Sampler2DSerializationAdapter} adapter instead
1357
+ * @param {BinaryBuffer} buffer
1358
+ */
1359
+ toBinaryBuffer(buffer) {
1360
+ const width = this.width;
1361
+ const height = this.height;
1362
+
1363
+ const itemSize = this.itemSize;
1364
+
1365
+ buffer.writeUint16(width);
1366
+ buffer.writeUint16(height);
1367
+
1368
+ buffer.writeUint8(itemSize);
1369
+
1370
+ if (this.data instanceof Uint8Array) {
1371
+ //data type
1372
+ buffer.writeUint8(0);
1373
+
1374
+
1375
+ const byteSize = width * height * itemSize;
1376
+
1377
+ buffer.writeBytes(this.data, 0, byteSize);
1378
+
1379
+ } else {
1380
+ throw new TypeError(`Unsupported data type`);
1381
+ }
1382
+ }
1383
+
1384
+ /**
1385
+ * @deprecated Use {@link Sampler2DSerializationAdapter} adapter instead
1386
+ * @param {BinaryBuffer} buffer
1387
+ */
1388
+ fromBinaryBuffer(buffer) {
1389
+ this.width = buffer.readUint16();
1390
+ this.height = buffer.readUint16();
1391
+
1392
+ this.itemSize = buffer.readUint8();
1393
+
1394
+ const dataType = buffer.readUint8();
1395
+
1396
+ if (dataType === 0) {
1397
+
1398
+ const numBytes = this.height * this.width * this.itemSize;
1399
+ this.data = new Uint8Array(numBytes);
1400
+
1401
+ buffer.readBytes(this.data, 0, numBytes);
1402
+
1403
+ this.version++;
1404
+ } else {
1405
+ throw new TypeError(`Unsupported data type (${dataType})`);
1406
+ }
1407
+ }
1408
+
1409
+ /**
1410
+ *
1411
+ * @param {number} x
1412
+ * @param {number} y
1413
+ * @param {function(x:number, y:number, value:number, index:number):boolean?} visitor
1414
+ * @param {*} [thisArg]
1415
+ */
1416
+ traverseOrthogonalNeighbours(x, y, visitor, thisArg) {
1417
+ const width = this.width;
1418
+ const height = this.height;
1419
+
1420
+ const index = this.point2index(x, y);
1421
+
1422
+ let i = 0;
1423
+ const data = this.data;
1424
+ if (x > 0) {
1425
+ i = index - 1;
1426
+ visitor.call(thisArg, x - 1, y, data[i], i);
1427
+ }
1428
+ if (x < width - 1) {
1429
+ i = index + 1;
1430
+ visitor.call(thisArg, x + 1, y, data[i], i);
1431
+ }
1432
+ if (y > 0) {
1433
+ i = index - width;
1434
+ visitor.call(thisArg, x, y - 1, data[i], i);
1435
+ }
1436
+ if (y < height - 1) {
1437
+ i = index + width;
1438
+ visitor.call(thisArg, x, y + 1, data[i], i);
1439
+ }
1440
+ }
1441
+
1442
+ /**
1443
+ *
1444
+ * @param {Sampler2D} other
1445
+ * @return {boolean}
1446
+ */
1447
+ equals(other) {
1448
+ if (
1449
+ this.width !== other.width
1450
+ || this.height !== other.height
1451
+ || this.itemSize !== other.itemSize
1452
+ ) {
1453
+ return false;
1454
+ }
1455
+
1456
+ return is_typed_array_equals(this.data, other.data);
1457
+ }
1458
+
1459
+ /**
1460
+ *
1461
+ * @return {number}
1462
+ */
1463
+ hash() {
1464
+ let hash = (((this.width & 0xFFFF) << 16) | (this.height & 0xFFFF)) ^ this.itemSize;
1465
+
1466
+ const length = this.data.length;
1467
+
1468
+ const stride = Math.max(1, Math.ceil(length / 509));
1469
+
1470
+ hash ^= computeStridedIntegerArrayHash(this.data, 0, length, stride);
1471
+
1472
+ return hash;
1473
+ }
1474
+
1475
+
1476
+ /**
1477
+ * @returns {Sampler2D}
1478
+ */
1479
+ clone() {
1480
+ let data_clone;
1481
+
1482
+ if (Array.isArray(this.data)) {
1483
+ data_clone = this.data.slice();
1484
+ } else {
1485
+ // storage is a typed array
1486
+ const T = this.data.constructor;
1487
+
1488
+ data_clone = new T(this.data);
1489
+ }
1490
+
1491
+ return new Sampler2D(data_clone, this.itemSize, this.width, this.height);
1492
+ }
1493
+
1494
+ toJSON() {
1495
+ const encoded = Base64.encode(this.data.buffer);
1496
+
1497
+ return {
1498
+ height: this.height,
1499
+ width: this.width,
1500
+ itemSize: this.itemSize,
1501
+ type: typedArrayToDataType(this.data),
1502
+ data: encoded
1503
+ }
1504
+ }
1505
+
1506
+ fromJSON({ height, width, itemSize, type, data }) {
1507
+ const CTOR = compute_typed_array_constructor_from_data_type(type);
1508
+
1509
+ if (typeof data === "string") {
1510
+
1511
+ const decoded = Base64.decode(data);
1512
+
1513
+ this.data = new CTOR(decoded);
1514
+
1515
+ } else if (Array.isArray(data)) {
1516
+ // deprecated
1517
+ console.warn('Array JSON format is deprecated, please upgrade your data as soon as possible');
1518
+
1519
+ this.data = new CTOR(data);
1520
+
1521
+ } else {
1522
+
1523
+ throw new Error('Unsupported data format');
1524
+
1525
+ }
1526
+
1527
+ this.height = height;
1528
+ this.width = width;
1529
+ this.itemSize = itemSize;
1530
+ }
1531
+
1532
+ /**
1533
+ *
1534
+ * @param {int} itemSize
1535
+ * @param {int} width
1536
+ * @param {int} height
1537
+ * @return {Sampler2D}
1538
+ */
1539
+ static uint8clamped(itemSize, width, height) {
1540
+ const data = new Uint8ClampedArray(width * height * itemSize);
1541
+ const sampler = new Sampler2D(data, itemSize, width, height);
1542
+ return sampler;
1543
+ }
1544
+
1545
+ /**
1546
+ *
1547
+ * @param {int} itemSize
1548
+ * @param {int} width
1549
+ * @param {int} height
1550
+ * @return {Sampler2D}
1551
+ */
1552
+ static uint8(itemSize, width, height) {
1553
+ const data = new Uint8Array(width * height * itemSize);
1554
+ const sampler = new Sampler2D(data, itemSize, width, height);
1555
+ return sampler;
1556
+ }
1557
+
1558
+ /**
1559
+ *
1560
+ * @param {int} itemSize
1561
+ * @param {int} width
1562
+ * @param {int} height
1563
+ * @return {Sampler2D}
1564
+ */
1565
+ static uint16(itemSize, width, height) {
1566
+ const data = new Uint16Array(width * height * itemSize);
1567
+ const sampler = new Sampler2D(data, itemSize, width, height);
1568
+ return sampler;
1569
+ }
1570
+
1571
+ /**
1572
+ *
1573
+ * @param {int} itemSize
1574
+ * @param {int} width
1575
+ * @param {int} height
1576
+ * @return {Sampler2D}
1577
+ */
1578
+ static uint32(itemSize, width, height) {
1579
+ const data = new Uint32Array(width * height * itemSize);
1580
+ const sampler = new Sampler2D(data, itemSize, width, height);
1581
+ return sampler;
1582
+ }
1583
+
1584
+ /**
1585
+ *
1586
+ * @param {int} itemSize
1587
+ * @param {int} width
1588
+ * @param {int} height
1589
+ * @return {Sampler2D}
1590
+ */
1591
+ static int8(itemSize, width, height) {
1592
+ const data = new Int8Array(width * height * itemSize);
1593
+ const sampler = new Sampler2D(data, itemSize, width, height);
1594
+ return sampler;
1595
+ }
1596
+
1597
+ /**
1598
+ *
1599
+ * @param {int} itemSize
1600
+ * @param {int} width
1601
+ * @param {int} height
1602
+ * @return {Sampler2D}
1603
+ */
1604
+ static int16(itemSize, width, height) {
1605
+ const data = new Int16Array(width * height * itemSize);
1606
+ const sampler = new Sampler2D(data, itemSize, width, height);
1607
+ return sampler;
1608
+ }
1609
+
1610
+ /**
1611
+ *
1612
+ * @param {int} itemSize
1613
+ * @param {int} width
1614
+ * @param {int} height
1615
+ * @return {Sampler2D}
1616
+ */
1617
+ static int32(itemSize, width, height) {
1618
+ const data = new Int32Array(width * height * itemSize);
1619
+ const sampler = new Sampler2D(data, itemSize, width, height);
1620
+ return sampler;
1621
+ }
1622
+
1623
+ /**
1624
+ *
1625
+ * @param {int} itemSize
1626
+ * @param {int} width
1627
+ * @param {int} height
1628
+ * @return {Sampler2D}
1629
+ */
1630
+ static float32(itemSize, width, height) {
1631
+ const data = new Float32Array(width * height * itemSize);
1632
+ const sampler = new Sampler2D(data, itemSize, width, height);
1633
+ return sampler;
1634
+ }
1635
+
1636
+ /**
1637
+ *
1638
+ * @param {int} itemSize
1639
+ * @param {int} width
1640
+ * @param {int} height
1641
+ * @return {Sampler2D}
1642
+ */
1643
+ static float64(itemSize, width, height) {
1644
+ const data = new Float64Array(width * height * itemSize);
1645
+ const sampler = new Sampler2D(data, itemSize, width, height);
1646
+ return sampler;
1647
+ }
1648
+
1649
+ }
1650
+
1651
+
1652
+ /**
1653
+ * Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
1654
+ * @param {number} t
1655
+ * @param {number} a
1656
+ * @param {number} b
1657
+ * @param {number} c
1658
+ * @param {number} d
1659
+ * @returns {number}
1660
+ */
1661
+ function bicubic_terp(t, a, b, c, d) {
1662
+ return 0.5 * (c - a + (2.0 * a - 5.0 * b + 4.0 * c - d + (3.0 * (b - c) + d - a) * t) * t) * t + b;
1663
+ }
1664
+
1665
+
1666
+ /**
1667
+ *
1668
+ * @param {number[]} source
1669
+ * @param {number[]} destination
1670
+ * @param {Array} result
1671
+ */
1672
+ function blendFunctionNormal(source, destination, result) {
1673
+
1674
+ const a1 = source[3] / 255;
1675
+ const a0 = destination[3] / 255;
1676
+
1677
+ result[0] = source[0] * a1 + destination[0] * (1 - a1);
1678
+ result[1] = source[1] * a1 + destination[1] * (1 - a1);
1679
+ result[2] = source[2] * a1 + destination[2] * (1 - a1);
1680
+ result[3] = (a1 + a0 * (1 - a1)) * 255;
1681
+ }
1682
+
1683
+