@woosh/meep-engine 2.35.17 → 2.36.2

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 (91) hide show
  1. package/core/binary/BinaryBuffer.js +42 -17
  2. package/core/bvh2/BinaryNode.js +1 -1
  3. package/core/bvh2/aabb3/AABB3.js +2 -2
  4. package/core/bvh2/aabb3/aabb3_array_combine.js +20 -0
  5. package/core/bvh2/aabb3/aabb3_array_intersects_frustum_array.js +20 -0
  6. package/core/bvh2/aabb3/aabb3_array_intersects_ray.js +1 -0
  7. package/core/bvh2/aabb3/aabb3_array_intersects_ray_array.js +14 -0
  8. package/core/bvh2/{aabb3_combined_surface_area.js → aabb3/aabb3_combined_surface_area.js} +3 -3
  9. package/core/bvh2/aabb3/aabb3_intersects_frustum_array.js +1 -19
  10. package/core/bvh2/bvh3/BVHNodeProxy.js +53 -0
  11. package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +848 -0
  12. package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.spec.js +142 -0
  13. package/core/bvh2/bvh3/bvh_query_leaves_generic.js +79 -0
  14. package/core/bvh2/bvh3/bvh_query_leaves_ray.js +95 -0
  15. package/core/bvh2/bvh3/query/BVHQuery.js +11 -0
  16. package/core/bvh2/bvh3/query/BVHQueryIntersectsFrustum.js +36 -0
  17. package/core/bvh2/bvh3/query/BVHQueryIntersectsRay.js +36 -0
  18. package/core/collection/array/copyArray.js +2 -2
  19. package/core/collection/table/RowFirstTable.js +25 -7
  20. package/core/collection/table/RowFirstTableSpec.js +4 -4
  21. package/core/geom/3d/aabb/aabb3_matrix4_project.spec.js +1 -1
  22. package/{engine/graphics/util → core/geom/3d/aabb}/computeBoundingBoxFromVertexData.js +1 -1
  23. package/core/geom/3d/compose_matrix4_array.js +53 -0
  24. package/{engine/graphics/util → core/geom/3d}/decompose_matrix_4_array.js +0 -0
  25. package/core/geom/AABB2.d.ts +2 -0
  26. package/core/geom/Vector1.js +2 -3
  27. package/core/geom/Vector3.js +5 -1
  28. package/core/process/undo/ActionProcessor.js +31 -3
  29. package/core/process/undo/ActionProcessor.spec.js +1 -1
  30. package/engine/animation/curve/AnimationCurve.js +40 -1
  31. package/engine/animation/curve/Keyframe.js +19 -0
  32. package/engine/animation/curve/compression/animation_curve_to_float_array.js +35 -0
  33. package/engine/animation/curve/compression/downsample_float_array.js +50 -0
  34. package/engine/animation/curve/compression/downsample_float_array_curve_by_error.js +147 -0
  35. package/engine/animation/curve/compression/downsample_float_array_curve_by_error.spec.js +47 -0
  36. package/engine/animation/curve/compression/prototypeCurveCompression.js +154 -0
  37. package/engine/animation/curve/draw/build_curve_editor.js +316 -0
  38. package/engine/animation/curve/draw/build_plot_entity_from_array.js +47 -0
  39. package/engine/animation/curve/draw/build_tangent_editor.js +115 -0
  40. package/engine/animation/curve/draw/draw_grid.js +27 -0
  41. package/engine/animation/curve/draw/draw_label.js +17 -0
  42. package/engine/animation/curve/draw/plot_array.js +76 -0
  43. package/engine/animation/curve/draw/plot_data.js +49 -0
  44. package/engine/asset/loaders/GLTFAssetLoader.js +3 -0
  45. package/engine/asset/loaders/gltf/GLTFAssetTransformMikkTSpaceTangents.js +27 -0
  46. package/engine/ecs/EntityComponentDataset.js +7 -4
  47. package/engine/ecs/foliage/InstancedFoliage.js +1 -1
  48. package/engine/ecs/foliage/ViewState.js +1 -1
  49. package/engine/ecs/parent/EntityNode.d.ts +7 -3
  50. package/engine/ecs/parent/EntityNode.js +21 -0
  51. package/engine/ecs/parent/entity_node_compute_bounding_box.js +41 -0
  52. package/engine/ecs/transform/Transform.js +2 -2
  53. package/engine/graphics/ecs/highlight/HighlightDefinition.d.ts +10 -0
  54. package/engine/graphics/ecs/highlight/HighlightDefinition.js +18 -8
  55. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +5 -0
  56. package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +46 -12
  57. package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +81 -95
  58. package/engine/graphics/ecs/mesh-v2/render/ShadedGeometryRendererContext.js +16 -5
  59. package/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +2 -0
  60. package/engine/graphics/ecs/mesh-v2/sample/load_gltf.js +1 -0
  61. package/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +1 -1
  62. package/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +1 -2
  63. package/engine/graphics/geometry/MikkT/MikkTSpace.js +2210 -0
  64. package/engine/graphics/geometry/MikkT/MikkTSpace.spec.js +22 -0
  65. package/engine/graphics/geometry/MikkT/buffer_geometry_ensure_tangents.js +34 -0
  66. package/engine/graphics/geometry/MikkT/buffer_geometry_generate_tangents.js +28 -0
  67. package/engine/graphics/{compute_geometry_polycount.js → geometry/compute_geometry_polycount.js} +0 -0
  68. package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +34 -3
  69. package/engine/graphics/geometry/skining/computeSkinnedMeshBoundingVolumes.js +1 -1
  70. package/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +83 -0
  71. package/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.spec.js +24 -0
  72. package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +42 -19
  73. package/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +5 -0
  74. package/engine/graphics/micron/plugin/MicronRenderPlugin.js +0 -4
  75. package/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +10 -0
  76. package/engine/graphics/micron/prototypeVirtualGeometry.js +5 -3
  77. package/engine/graphics/micron/render/refinement/ActivePatchList.js +2 -2
  78. package/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +2 -2
  79. package/engine/graphics/micron/render/v1/MicronRenderContext.js +0 -6
  80. package/engine/graphics/render/forward_plus/LightManager.js +3 -1
  81. package/engine/graphics/util/composeMatrix4.js +1 -53
  82. package/engine/graphics/util/composeMatrix4RotationScale.js +1 -1
  83. package/engine/intelligence/blackboard/AbstractBlackboard.js +9 -0
  84. package/engine/notify/Notification.js +1 -1
  85. package/engine/ui/DraggableAspect.js +4 -1
  86. package/engine/ui/notification/ViewEmitter.js +7 -1
  87. package/engine/ui/notification/notificationGenerator.js +1 -1
  88. package/engine/ui/scene/SceneGUIContext.js +11 -130
  89. package/engine/ui/scene/initializeNotifications.js +141 -0
  90. package/package.json +1 -1
  91. package/view/elements/notify/NotificationView.js +1 -2
@@ -864,23 +864,6 @@ BinaryBuffer.prototype.writeUTF8String = function (string) {
864
864
  this.position = at;
865
865
  };
866
866
 
867
- /**
868
- *
869
- * @param {number} length
870
- * @returns {string}
871
- */
872
- BinaryBuffer.prototype.readASCIICharacters = function (length) {
873
- let result = "";
874
-
875
- for (let i = 0; i < length; i++) {
876
- const code = this.readUint8();
877
-
878
- result += String.fromCharCode(code);
879
- }
880
-
881
- return result;
882
- };
883
-
884
867
  /**
885
868
  * Adapted from https://github.com/samthor/fast-text-encoding/blob/master/text.js
886
869
  * @licence Original license is Apache 2.0
@@ -954,6 +937,48 @@ BinaryBuffer.prototype.readUTF8String = function () {
954
937
  return result;
955
938
  };
956
939
 
940
+ /**
941
+ *
942
+ * @param {string} string
943
+ */
944
+ BinaryBuffer.prototype.writeASCIIString = function (string) {
945
+ const char_count = string.length;
946
+
947
+ const start = this.position;
948
+ const end = start + char_count;
949
+
950
+ this.ensureCapacity(end);
951
+
952
+ for (let i = 0; i < char_count; i++) {
953
+ const char_code = string.charCodeAt(i);
954
+
955
+ if (char_code > 0xFF) {
956
+ throw new Error(`Character ${String.fromCharCode(char_code)} can\'t be represented by a US-ASCII byte.`);
957
+ }
958
+
959
+ this.__data_uint8[start + i] = char_code;
960
+ }
961
+
962
+ this.position = end;
963
+ };
964
+
965
+ /**
966
+ *
967
+ * @param {number} length
968
+ * @returns {string}
969
+ */
970
+ BinaryBuffer.prototype.readASCIICharacters = function (length) {
971
+ let result = "";
972
+
973
+ for (let i = 0; i < length; i++) {
974
+ const code = this.readUint8();
975
+
976
+ result += String.fromCharCode(code);
977
+ }
978
+
979
+ return result;
980
+ };
981
+
957
982
  /**
958
983
  *
959
984
  * @param {BinaryBuffer} source
@@ -15,7 +15,7 @@ import { BVHVisitor } from "./traversal/BVHVisitor.js";
15
15
  import { traverseBinaryNodeUsingVisitor } from "./traversal/traverseBinaryNodeUsingVisitor.js";
16
16
  import { aabb3_intersect_aabb3 } from "./aabb3/aabb3_intersect_aabb3.js";
17
17
  import { aabb3_box_surface_area_2 } from "./aabb3/aabb3_box_surface_area_2.js";
18
- import { aabb3_combined_surface_area } from "./aabb3_combined_surface_area.js";
18
+ import { aabb3_combined_surface_area } from "./aabb3/aabb3_combined_surface_area.js";
19
19
 
20
20
 
21
21
  /**
@@ -9,10 +9,10 @@ import computeMortonCode from "../../geom/3d/morton/Morton.js";
9
9
  import { aabb3_build_corners } from "../../geom/3d/aabb/aabb3_build_corners.js";
10
10
  import { assert } from "../../assert.js";
11
11
  import { aabb3_intersects_frustum_degree } from "./aabb3_intersects_frustum_degree.js";
12
- import { aabb3_intersects_frustum } from "./aabb3_intersects_frustum_array.js";
13
12
  import { aabb3_intersects_line_segment } from "./aabb3_intersects_line_segment.js";
14
13
  import { aabb3_intersects_ray } from "./aabb3_intersects_ray.js";
15
14
  import { aabb3_compute_surface_area } from "./aabb3_compute_surface_area.js";
15
+ import { aabb3_intersects_frustum_array } from "./aabb3_intersects_frustum_array.js";
16
16
 
17
17
 
18
18
  export class AABB3 {
@@ -903,7 +903,7 @@ export class AABB3 {
903
903
  const y1 = this.y1;
904
904
  const z1 = this.z1;
905
905
 
906
- return aabb3_intersects_frustum(x0, y0, z0, x1, y1, z1, frustum);
906
+ return aabb3_intersects_frustum_array(x0, y0, z0, x1, y1, z1, frustum);
907
907
  }
908
908
 
909
909
  /**
@@ -0,0 +1,20 @@
1
+ //
2
+
3
+ import { min2 } from "../../math/min2.js";
4
+ import { max2 } from "../../math/max2.js";
5
+
6
+ /**
7
+ *
8
+ * @param {ArrayLike<number>|number[]} result
9
+ * @param {ArrayLike<number>|number[]} a
10
+ * @param {ArrayLike<number>|number[]} b
11
+ */
12
+ export function aabb3_array_combine(result, a, b) {
13
+ result[0] = min2(a[0], b[0]);
14
+ result[1] = min2(a[1], b[1]);
15
+ result[2] = min2(a[2], b[2]);
16
+
17
+ result[3] = max2(a[3], b[3]);
18
+ result[4] = max2(a[4], b[4]);
19
+ result[5] = max2(a[5], b[5]);
20
+ }
@@ -0,0 +1,20 @@
1
+ import { aabb3_intersects_frustum_array } from "./aabb3_intersects_frustum_array.js";
2
+
3
+ /**
4
+ *
5
+ * @param {Float32Array|number[]} aabb
6
+ * @param {Float32Array|number[]} frustum
7
+ * @return {boolean}
8
+ */
9
+ export function aabb3_array_intersects_frustum_array(aabb, frustum) {
10
+
11
+ const x0 = aabb[0];
12
+ const y0 = aabb[1];
13
+ const z0 = aabb[2];
14
+ const x1 = aabb[3];
15
+ const y1 = aabb[4];
16
+ const z1 = aabb[5];
17
+
18
+ return aabb3_intersects_frustum_array(x0, y0, z0, x1, y1, z1, frustum);
19
+ }
20
+
@@ -18,3 +18,4 @@ export function aabb3_array_intersects_ray(aabb, origin_x, origin_y, origin_z, d
18
18
  direction_x, direction_y, direction_z
19
19
  );
20
20
  }
21
+
@@ -0,0 +1,14 @@
1
+ import { aabb3_intersects_ray } from "./aabb3_intersects_ray.js";
2
+
3
+ /**
4
+ *
5
+ * @param {ArrayLike<number>|number[]|Float32Array} aabb bounding box, order: x0,y0,z0,x1,y1,z1
6
+ * @param {ArrayLike<number>|number[]|Float32Array} ray ray data, order: origin_x, origin_y, origin_z, direction_x, direction_y, direction_z
7
+ * @returns {boolean}
8
+ */
9
+ export function aabb3_array_intersects_ray_array(aabb, ray) {
10
+ return aabb3_intersects_ray(aabb[0], aabb[1], aabb[2], aabb[3], aabb[4], aabb[5],
11
+ ray[0], ray[1], ray[2],
12
+ ray[3], ray[4], ray[5]
13
+ );
14
+ }
@@ -1,6 +1,6 @@
1
- import { min2 } from "../math/min2.js";
2
- import { max2 } from "../math/max2.js";
3
- import { aabb3_compute_half_surface_area } from "./aabb3/aabb3_compute_half_surface_area.js";
1
+ import { min2 } from "../../math/min2.js";
2
+ import { max2 } from "../../math/max2.js";
3
+ import { aabb3_compute_half_surface_area } from "./aabb3_compute_half_surface_area.js";
4
4
 
5
5
  /**
6
6
  *
@@ -1,23 +1,5 @@
1
1
  import { aabb3_computeDistanceAbovePlane } from "../../geom/3d/aabb/aabb3_computeDistanceAbovePlane.js";
2
2
 
3
- /**
4
- *
5
- * @param {Float32Array|number[]} aabb
6
- * @param {Float32Array|number[]} frustum
7
- * @return {boolean}
8
- */
9
- export function aabb3_intersects_frustum_array(aabb, frustum) {
10
-
11
- const x0 = aabb[0];
12
- const y0 = aabb[1];
13
- const z0 = aabb[2];
14
- const x1 = aabb[3];
15
- const y1 = aabb[4];
16
- const z1 = aabb[5];
17
-
18
- return aabb3_intersects_frustum(x0, y0, z0, x1, y1, z1, frustum);
19
- }
20
-
21
3
  /**
22
4
  *
23
5
  * @param {number} x0
@@ -29,7 +11,7 @@ export function aabb3_intersects_frustum_array(aabb, frustum) {
29
11
  * @param {ArrayLike<number>|number[]|Float32Array|Float64Array} frustum
30
12
  * @return {boolean}
31
13
  */
32
- export function aabb3_intersects_frustum(x0, y0, z0, x1, y1, z1, frustum) {
14
+ export function aabb3_intersects_frustum_array(x0, y0, z0, x1, y1, z1, frustum) {
33
15
  for (let i = 0; i < 24; i += 4) {
34
16
 
35
17
  const plane_x = frustum[i];
@@ -0,0 +1,53 @@
1
+ export class BVHNodeProxy {
2
+ constructor() {
3
+ /**
4
+ *
5
+ * @type {number}
6
+ * @private
7
+ */
8
+ this.__node = -1;
9
+
10
+ /**
11
+ *
12
+ * @type {ExplicitBinaryBoundingVolumeHierarchy|null}
13
+ * @private
14
+ */
15
+ this.__tree = null;
16
+ }
17
+
18
+ /**
19
+ *
20
+ * @param {number} node
21
+ * @param {ExplicitBinaryBoundingVolumeHierarchy} tree
22
+ */
23
+ bind(node, tree) {
24
+ this.__node = node;
25
+ this.__tree = tree;
26
+ }
27
+
28
+ /**
29
+ *
30
+ * @param {number} x0
31
+ * @param {number} y0
32
+ * @param {number} z0
33
+ * @param {number} x1
34
+ * @param {number} y1
35
+ * @param {number} z1
36
+ */
37
+ set_bounds(x0, y0, z0, x1, y1, z1) {
38
+ this.__tree.node_set_aabb_primitive(this.__node,
39
+ x0, y0, z0, x1, y1, z1
40
+ );
41
+ }
42
+
43
+ disconnect() {
44
+ this.__tree.remove_leaf(this.__node);
45
+ }
46
+
47
+ destroy() {
48
+ this.__tree.release_node(this.__node);
49
+
50
+ this.__tree = null;
51
+ this.__node = -1;
52
+ }
53
+ }