@woosh/meep-engine 2.49.9 → 2.50.1

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 (170) hide show
  1. package/editor/actions/concrete/ArrayCopyAction.js +1 -1
  2. package/package.json +1 -1
  3. package/src/core/binary/BinaryBuffer.js +1 -1
  4. package/src/core/binary/BinaryBuffer.spec.js +128 -0
  5. package/src/core/binary/int32_to_binary_string.js +4 -1
  6. package/src/core/binary/int32_to_binary_string.spec.js +9 -0
  7. package/src/core/bvh2/BinaryNode.js +0 -30
  8. package/src/core/bvh2/binary/2/BinaryUint32BVH.js +1 -1
  9. package/src/core/bvh2/binary/IndexedBinaryBVH.js +1 -1
  10. package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +1 -1
  11. package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +1 -1
  12. package/src/core/cache/Cache.js +31 -29
  13. package/src/core/cache/Cache.spec.js +4 -1
  14. package/src/core/collection/HashMap.js +1 -1
  15. package/src/core/collection/array/{copyArray.js → array_copy.js} +1 -24
  16. package/src/core/collection/array/array_copy_entire.js +21 -0
  17. package/src/core/collection/array/typed/typed_array_copy.js +1 -1
  18. package/src/core/collection/queue/Deque.d.ts +4 -0
  19. package/src/core/collection/queue/Deque.js +5 -7
  20. package/src/core/collection/queue/Deque.spec.js +107 -0
  21. package/src/core/collection/table/RowFirstTable.js +1 -1
  22. package/src/core/geom/2d/aabb/AABB2.d.ts +14 -0
  23. package/src/core/geom/2d/aabb/AABB2.js +9 -7
  24. package/src/core/geom/2d/aabb/AABB2.spec.js +100 -0
  25. package/src/core/geom/2d/aabb/aabb2_compute_center_from_multiple.spec.js +11 -0
  26. package/src/core/geom/2d/aabb/aabb2_compute_overlap.spec.js +56 -0
  27. package/src/core/geom/2d/aabb/aabb2_contains.spec.js +40 -0
  28. package/src/core/geom/2d/bvh/Node2.js +1 -1
  29. package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +1 -1
  30. package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +1 -1
  31. package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_2d.js +35 -0
  32. package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_array_2d.js +51 -0
  33. package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_vectors_2d.js +15 -0
  34. package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_vectors_array_2d.js +30 -0
  35. package/src/core/geom/2d/line/line_segment_line_segment_intersection_exists_2d.js +29 -0
  36. package/src/core/geom/3d/aabb/AABB3.d.ts +4 -0
  37. package/src/core/geom/3d/aabb/AABB3.spec.js +30 -0
  38. package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.js +4 -4
  39. package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +5 -5
  40. package/src/core/geom/3d/matrix/m4_make_translation.js +1 -1
  41. package/src/core/geom/3d/plane/is_point_within_planes.js +1 -1
  42. package/src/core/geom/3d/plane/lerp_planes_to_array.js +2 -0
  43. package/src/core/geom/3d/plane/{plane_computeConvex3PlaneIntersection.js → plane3_compute_convex_3_plane_intersection.js} +1 -1
  44. package/src/core/geom/3d/plane/{plane3_computeLineSegmentIntersection.js → plane3_compute_line_segment_intersection.js} +1 -1
  45. package/src/core/geom/3d/plane/{computePlanePlaneIntersection.js → plane3_compute_plane_intersection.js} +15 -11
  46. package/src/core/geom/3d/plane/{computePlaneLineIntersection.js → plane3_compute_ray_intersection.js} +5 -1
  47. package/src/core/geom/3d/plane/plane3_intersect_plane.js +14 -0
  48. package/src/core/geom/3d/plane/{plane_three_compute_convex3_plane_intersection.js → plane3_three_compute_convex_3_plane_intersection.js} +7 -4
  49. package/src/core/geom/3d/plane/planeRayIntersection.js +2 -2
  50. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +1 -1
  51. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +1 -1
  52. package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.js +5 -5
  53. package/src/core/geom/3d/tetrahedra/compute_circumsphere.js +1 -1
  54. package/src/core/geom/3d/tetrahedra/delaunay/fill_in_a_cavity.js +1 -1
  55. package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +1 -1
  56. package/src/core/geom/3d/topology/expandConnectivityByLocality.js +1 -1
  57. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.js +1 -1
  58. package/src/core/geom/Quaternion.d.ts +11 -0
  59. package/src/core/geom/Quaternion.js +36 -27
  60. package/src/core/geom/Quaternion.spec.js +141 -0
  61. package/src/core/geom/Vector2.d.ts +5 -1
  62. package/src/core/geom/Vector2.js +24 -0
  63. package/src/core/geom/Vector3.d.ts +6 -0
  64. package/src/core/geom/Vector3.spec.js +60 -0
  65. package/src/core/graph/GraphUtils.js +4 -2
  66. package/src/core/graph/layout/CircleLayout.js +4 -2
  67. package/src/core/math/vector_nd_dot.js +16 -0
  68. package/src/core/math/{normalizeArrayVector.js → vector_nd_normalize.js} +3 -3
  69. package/src/core/math/{normalizeArrayVector.spec.js → vector_nd_normalize.spec.js} +3 -3
  70. package/src/core/process/PromiseWatcher.spec.js +1 -1
  71. package/src/engine/animation/curve/compression/downsample_float_array_curve_by_error.js +1 -1
  72. package/src/engine/ecs/EntityBlueprint.d.ts +14 -0
  73. package/src/engine/ecs/EntityBlueprint.js +2 -2
  74. package/src/engine/ecs/EntityBlueprint.spec.js +52 -0
  75. package/src/engine/ecs/EntityBuilder.js +8 -0
  76. package/src/engine/ecs/EntityManager.d.ts +1 -0
  77. package/src/engine/ecs/EntityManager.js +17 -213
  78. package/src/engine/ecs/EntityManager.spec.js +62 -1
  79. package/src/engine/ecs/System.js +8 -2
  80. package/src/engine/ecs/fow/FogOfWar.js +1 -1
  81. package/src/engine/ecs/guid/GUID.js +1 -1
  82. package/src/engine/ecs/terrain/ecs/splat/SplatMapping.js +1 -1
  83. package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +1 -1
  84. package/src/engine/ecs/terrain/tiles/TerrainTile.js +1 -1
  85. package/src/engine/ecs/transform/Transform.d.ts +2 -0
  86. package/src/engine/ecs/transform/Transform.spec.js +63 -0
  87. package/src/engine/ecs/transform-attachment/TransformAttachment.d.ts +17 -1
  88. package/src/engine/ecs/transform-attachment/TransformAttachment.js +12 -2
  89. package/src/engine/ecs/transform-attachment/TransformAttachment.spec.js +103 -0
  90. package/src/engine/graphics/ecs/camera/Camera.js +2 -2
  91. package/src/engine/graphics/ecs/path/entity/EntityPath.js +1 -1
  92. package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +1 -1
  93. package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +1 -1
  94. package/src/engine/graphics/geometry/MikkT/m_getNormal.js +1 -1
  95. package/src/engine/graphics/geometry/MikkT/m_getTexCoord.js +1 -1
  96. package/src/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +1 -1
  97. package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +1 -1
  98. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
  99. package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +1 -1
  100. package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +1 -1
  101. package/src/engine/graphics/render/Lines.js +1 -1
  102. package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +1 -1
  103. package/src/engine/graphics/render/forward_plus/LightManager.js +1 -1
  104. package/src/engine/graphics/render/forward_plus/computeFrustumCorners.js +10 -10
  105. package/src/engine/graphics/render/forward_plus/model/Decal.js +1 -1
  106. package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +1 -1
  107. package/src/engine/graphics/render/gizmo/GizmoShapeRenderingInterface.js +1 -1
  108. package/src/engine/graphics/render/layers/RenderLayerUtils.js +3 -3
  109. package/src/engine/graphics/render/view/CameraView.js +1 -1
  110. package/src/engine/graphics/render/visibility/hiz/query/BatchOcclusionQuery.js +1 -1
  111. package/src/engine/graphics/render/webgpu/sample/MeshInstance.js +1 -1
  112. package/src/engine/graphics/sh3/LightProbeVolume.js +1 -1
  113. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +1 -1
  114. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +1 -1
  115. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +1 -1
  116. package/src/engine/graphics/sh3/prototypeSH3Probe.js +1 -1
  117. package/src/engine/graphics/texture/3d/scs3d_read_2d_slice.js +1 -1
  118. package/src/engine/graphics/texture/CanvasClone.js +5 -1
  119. package/src/engine/graphics/texture/sampler/Sampler2D.js +14 -75
  120. package/src/engine/graphics/texture/sampler/bicubic.js +19 -19
  121. package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.spec.js +10 -0
  122. package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.spec.js +90 -0
  123. package/src/engine/graphics/texture/sampler/differenceSampler.js +13 -8
  124. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js +140 -0
  125. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.js +130 -0
  126. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js +10 -0
  127. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.spec.js +183 -0
  128. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.js +133 -0
  129. package/src/engine/graphics/texture/sampler/filter/mitchell.js +4 -0
  130. package/src/engine/graphics/texture/sampler/loadSampler2D.js +5 -2
  131. package/src/engine/graphics/texture/sampler/resize/sampler2d_downsample_mipmap.js +8 -3
  132. package/src/engine/graphics/texture/sampler/resize/sampler2d_downsample_mipmap.spec.js +13 -0
  133. package/src/engine/graphics/texture/sampler/sampler2d_channel_compute_min_indices.js +58 -0
  134. package/src/engine/graphics/trail/TemporalPath.js +0 -36
  135. package/src/engine/intelligence/behavior/composite/ParallelBehavior.spec.js +12 -12
  136. package/src/engine/intelligence/behavior/composite/SequenceBehavior.spec.js +17 -0
  137. package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.js +3 -1
  138. package/src/engine/knowledge/database/StaticKnowledgeDataTable.d.ts +7 -1
  139. package/src/engine/knowledge/database/StaticKnowledgeDataTable.spec.js +21 -0
  140. package/src/engine/knowledge/database/StaticKnowledgeDataTableDescriptor.d.ts +2 -2
  141. package/src/engine/logging/ConsoleLoggerBackend.js +4 -0
  142. package/src/engine/logging/VoidLoggerBackend.js +12 -0
  143. package/src/engine/navigation/ecs/components/computeCatmullRomSpline.js +1 -1
  144. package/src/engine/navigation/ecs/components/computeCatmullRomSplineUniformDistance.js +1 -1
  145. package/src/engine/physics/cannon/CannonJSPhysicsSystem.js +1 -1
  146. package/src/engine/save/GameStateLoader.js +1 -1
  147. package/src/engine/scene/Scene.d.ts +2 -0
  148. package/src/engine/scene/Scene.js +2 -2
  149. package/src/engine/scene/Scene.spec.js +20 -0
  150. package/src/engine/scene/SceneManager.d.ts +4 -0
  151. package/src/engine/scene/SceneManager.js +46 -23
  152. package/src/engine/scene/SceneManager.spec.js +131 -0
  153. package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +2 -2
  154. package/src/engine/ui/GUIEngine.js +1 -1
  155. package/src/generation/grid/GridData.js +8 -2
  156. package/src/generation/grid/GridData.spec.js +5 -0
  157. package/src/generation/grid/generation/util/buildUnsignedDistanceField.js +3 -1
  158. package/src/generation/markers/MarkerNode.js +2 -2
  159. package/src/generation/markers/actions/MarkerNodeActionEntityPlacement.js +1 -1
  160. package/src/generation/theme/AreaMask.js +3 -1
  161. package/src/view/elements/progress/RectangularPieProgressView.js +8 -6
  162. package/src/view/minimap/dom/MinimapCameraView.js +3 -3
  163. package/src/core/geom/2d/LineSegment2.js +0 -175
  164. package/src/core/geom/3d/plane/computePlaneRayIntersection.js +0 -55
  165. package/src/core/geom/Matrix4.js +0 -275
  166. package/src/engine/graphics/texture/sampler/distanceField.js +0 -411
  167. package/src/engine/graphics/texture/sampler/distanceField.spec.js +0 -184
  168. package/src/engine/physics/cannon/cannon.min.js +0 -27
  169. package/src/generation/grid/MarkerMatchCounter.js +0 -25
  170. /package/src/engine/physics/spring/{Spring.js → computeHookeForce.js} +0 -0
@@ -155,13 +155,19 @@ Object.defineProperties(System.prototype, {
155
155
  * @readonly
156
156
  * @enum {number}
157
157
  */
158
- System.State = {
158
+ export const SystemState = {
159
159
  INITIAL: 0,
160
160
  STARTING: 1,
161
161
  RUNNING: 2,
162
162
  STOPPING: 3,
163
163
  STOPPED: 4
164
- };
164
+ }
165
+
166
+ /**
167
+ * @readonly
168
+ * @deprecated use {@link SystemState} directly instead
169
+ */
170
+ System.State = SystemState;
165
171
 
166
172
  /**
167
173
  *
@@ -6,13 +6,13 @@ import { ClampToEdgeWrapping, DataTexture, LinearFilter, RedFormat, UnsignedByte
6
6
  import Vector1 from "../../../core/geom/Vector1.js";
7
7
  import Vector2 from "../../../core/geom/Vector2.js";
8
8
  import { assert } from "../../../core/assert.js";
9
- import { computeUnsignedDistanceField } from "../../graphics/texture/sampler/distanceField.js";
10
9
  import Vector4 from "../../../core/geom/Vector4.js";
11
10
  import Signal from "../../../core/events/signal/Signal.js";
12
11
  import { RowFirstTable } from "../../../core/collection/table/RowFirstTable.js";
13
12
  import { RowFirstTableSpec } from "../../../core/collection/table/RowFirstTableSpec.js";
14
13
  import { BinaryDataType } from "../../../core/binary/type/BinaryDataType.js";
15
14
  import { writeSample2DDataToDataTexture } from "../../graphics/texture/sampler/writeSampler2DDataToDataTexture.js";
15
+ import { computeUnsignedDistanceField } from "../../graphics/texture/sampler/distance/computeUnsignedDistanceField.js";
16
16
 
17
17
  const samplePosition = [];
18
18
 
@@ -1,7 +1,7 @@
1
1
  import { seededRandom } from "../../../core/math/random/seededRandom.js";
2
2
  import { randomUint8 } from "../../../core/math/random/randomUint8.js";
3
3
  import { dec2hex } from "../../../core/binary/dec2hex.js";
4
- import { array_copy } from "../../../core/collection/array/copyArray.js";
4
+ import { array_copy } from "../../../core/collection/array/array_copy.js";
5
5
  import { randomBytes } from "../../../core/math/random/randomBytes.js";
6
6
  import { assert } from "../../../core/assert.js";
7
7
 
@@ -5,7 +5,7 @@ import { min2 } from "../../../../../core/math/min2.js";
5
5
  import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
6
6
  import { assert } from "../../../../../core/assert.js";
7
7
  import { scaleSampler2D } from "../../../../graphics/texture/sampler/scaleSampler2D.js";
8
- import { array_copy } from "../../../../../core/collection/array/copyArray.js";
8
+ import { array_copy } from "../../../../../core/collection/array/array_copy.js";
9
9
  import { typed_array_copy } from "../../../../../core/collection/array/typed/typed_array_copy.js";
10
10
  import { Base64 } from "../../../../../core/binary/Base64.js";
11
11
  import { countTask } from "../../../../../core/process/task/util/countTask.js";
@@ -15,7 +15,7 @@ import { scaleSampler2D } from "../../../graphics/texture/sampler/scaleSampler2D
15
15
  import { uint82float } from "../../../../core/binary/uint82float.js";
16
16
  import { float2uint8 } from "../../../../core/binary/float2uint8.js";
17
17
  import { isTypedArray } from "../../../../core/collection/array/typed/isTypedArray.js";
18
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
18
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
19
19
  import { WHITE_PIXEL_DATA_URL } from "../../../graphics/WHITE_PIXEL_DATA_URL.js";
20
20
 
21
21
  class Context {
@@ -26,7 +26,7 @@ import Signal from "../../../../core/events/signal/Signal.js";
26
26
  import { mat4 } from "gl-matrix";
27
27
  import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
28
28
  import { NumericInterval } from "../../../../core/math/interval/NumericInterval.js";
29
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
29
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
30
30
  import { passThrough } from "../../../../core/function/Functions.js";
31
31
 
32
32
  /**
@@ -6,6 +6,8 @@ export class Transform {
6
6
  public readonly rotation: Quaternion
7
7
  public readonly scale: Vector3
8
8
 
9
+ flags: number
10
+
9
11
  public readonly matrix: ArrayLike<number>
10
12
 
11
13
  public lookAt(target: Vector3): void
@@ -86,3 +86,66 @@ test("toString produces a valid string", () => {
86
86
 
87
87
  expect(typeof t.toString()).toBe("string");
88
88
  });
89
+
90
+
91
+ test("setFlag", () => {
92
+ const ut = new Transform();
93
+
94
+ ut.flags = 0;
95
+
96
+ ut.setFlag(0b101);
97
+
98
+ expect(ut.flags).toBe(5);
99
+
100
+ ut.setFlag(0b010);
101
+
102
+ expect(ut.flags).toBe(7);
103
+
104
+ ut.setFlag(0b1);
105
+
106
+ expect(ut.flags).toBe(7);
107
+ });
108
+
109
+ test("clearFlag", () => {
110
+ const ut = new Transform();
111
+ ut.flags = 0b101;
112
+
113
+ ut.clearFlag(0b1);
114
+
115
+ expect(ut.flags).toBe(4);
116
+
117
+ ut.clearFlag(0b10);
118
+
119
+ expect(ut.flags).toBe(4);
120
+
121
+ ut.clearFlag(0b100);
122
+
123
+ expect(ut.flags).toBe(0);
124
+ });
125
+
126
+ test("getFlag", () => {
127
+
128
+ const ut = new Transform();
129
+
130
+ ut.flags = 0b101;
131
+
132
+ expect(ut.getFlag(0b1)).toBe(true);
133
+ expect(ut.getFlag(0b10)).toBe(false);
134
+ expect(ut.getFlag(0b100)).toBe(true);
135
+ expect(ut.getFlag(0b1000)).toBe(false);
136
+ expect(ut.getFlag(0b101)).toBe(true);
137
+ expect(ut.getFlag(0b011)).toBe(false);
138
+ });
139
+
140
+ test("writeFlag", () => {
141
+ const ut = new Transform();
142
+
143
+ ut.flags = 0;
144
+
145
+ ut.writeFlag(0b101, true);
146
+ expect(ut.flags).toBe(5);
147
+
148
+ ut.writeFlag(0b100, false);
149
+
150
+ expect(ut.flags).toBe(1);
151
+ });
@@ -1,3 +1,19 @@
1
+ import {Transform} from "../transform/Transform";
2
+
1
3
  export class TransformAttachment {
2
-
4
+ readonly transform: Transform
5
+ parent: number
6
+ flags: number
7
+
8
+ setFlag(flags: number): void
9
+
10
+ clearFlag(flags: number): void
11
+
12
+ getFlag(flags: number): boolean
13
+
14
+ writeFlag(flags: number, value: boolean): void
15
+
16
+ toJSON(): any
17
+
18
+ fromJSON(json: any): void
3
19
  }
@@ -1,5 +1,5 @@
1
1
  import { Transform } from "../transform/Transform.js";
2
- import { int32_to_binary_string } from "../../../core/binary/int32_to_binary_string.js";
2
+ import { assert } from "../../../core/assert.js";
3
3
 
4
4
  export const TransformAttachmentFlags = {
5
5
  /**
@@ -40,10 +40,20 @@ export class TransformAttachment {
40
40
  return {
41
41
  transform: this.transform.toJSON(),
42
42
  parent: this.parent,
43
- flags: int32_to_binary_string(this.flags)
43
+ flags: this.flags
44
44
  };
45
45
  }
46
46
 
47
+ fromJSON({ transform, parent = -1, flags = DEFAULT_FLAGS }) {
48
+ assert.defined(transform, 'transform');
49
+ assert.isInteger(parent, 'parent');
50
+ assert.isNonNegativeInteger(flags, 'flags');
51
+
52
+ this.transform.fromJSON(transform);
53
+ this.parent = parent;
54
+ this.flags = flags;
55
+ }
56
+
47
57
  get immediate() {
48
58
  return this.getFlag(TransformAttachmentFlags.Immediate);
49
59
  }
@@ -0,0 +1,103 @@
1
+ import { TransformAttachment } from "./TransformAttachment.js";
2
+
3
+ test("newly created object has valid state", () => {
4
+
5
+ const ut = new TransformAttachment();
6
+
7
+ expect(ut.transform).toBeDefined();
8
+ expect(ut.transform).not.toBeNull();
9
+
10
+ expect(ut.parent).toBe(-1);
11
+ expect(typeof ut.flags).toBe("number");
12
+ expect(Number.isInteger(ut.flags)).toBe(true);
13
+ expect(ut.flags).toBeGreaterThanOrEqual(0);
14
+
15
+ });
16
+
17
+ test("to/from JSON", () => {
18
+
19
+ const expected = new TransformAttachment();
20
+ expected.flags = 123457;
21
+
22
+ expected.parent = 13;
23
+
24
+ // just position is enough. don't need to check the entire transform as that's not the point
25
+ expected.transform.position.set(1, 3, -5);
26
+
27
+ const actual = new TransformAttachment();
28
+
29
+ actual.fromJSON(expected.toJSON());
30
+
31
+ expect(actual.parent).toBe(13);
32
+ expect(actual.flags).toBe(123457);
33
+ expect(actual.transform.position.x).toBe(1);
34
+ expect(actual.transform.position.y).toBe(3);
35
+ expect(actual.transform.position.z).toBe(-5);
36
+ });
37
+
38
+ test("toString produces a non-empty string", () => {
39
+ const ut = new TransformAttachment();
40
+
41
+ const string = ut.toString();
42
+
43
+ expect(typeof string).toBe('string');
44
+ expect(string.trim().length).toBeGreaterThan(0);
45
+ });
46
+
47
+ test("setFlag", () => {
48
+ const ut = new TransformAttachment();
49
+
50
+ ut.setFlag(0b101);
51
+
52
+ expect(ut.flags).toBe(5);
53
+
54
+ ut.setFlag(0b010);
55
+
56
+ expect(ut.flags).toBe(7);
57
+
58
+ ut.setFlag(0b1);
59
+
60
+ expect(ut.flags).toBe(7);
61
+ });
62
+
63
+ test("clearFlag", () => {
64
+ const ut = new TransformAttachment();
65
+ ut.flags = 0b101;
66
+
67
+ ut.clearFlag(0b1);
68
+
69
+ expect(ut.flags).toBe(4);
70
+
71
+ ut.clearFlag(0b10);
72
+
73
+ expect(ut.flags).toBe(4);
74
+
75
+ ut.clearFlag(0b100);
76
+
77
+ expect(ut.flags).toBe(0);
78
+ });
79
+
80
+ test("getFlag", () => {
81
+
82
+ const ut = new TransformAttachment();
83
+
84
+ ut.flags = 0b101;
85
+
86
+ expect(ut.getFlag(0b1)).toBe(true);
87
+ expect(ut.getFlag(0b10)).toBe(false);
88
+ expect(ut.getFlag(0b100)).toBe(true);
89
+ expect(ut.getFlag(0b1000)).toBe(false);
90
+ expect(ut.getFlag(0b101)).toBe(true);
91
+ expect(ut.getFlag(0b011)).toBe(false);
92
+ });
93
+
94
+ test("writeFlag", () => {
95
+ const ut = new TransformAttachment();
96
+
97
+ ut.writeFlag(0b101, true);
98
+ expect(ut.flags).toBe(5);
99
+
100
+ ut.writeFlag(0b100, false);
101
+
102
+ expect(ut.flags).toBe(1);
103
+ });
@@ -14,7 +14,7 @@ import { frustum_from_camera } from "./frustum_from_camera.js";
14
14
  import { invertQuaternionOrientation } from "./InvertQuaternionOrientation.js";
15
15
  import { v3_distance_above_plane } from "../../../../core/geom/v3_distance_above_plane.js";
16
16
  import { ProjectionType } from "./ProjectionType.js";
17
- import { computePlaneRayIntersection } from "../../../../core/geom/3d/plane/computePlaneRayIntersection.js";
17
+ import { plane3_compute_ray_intersection } from "../../../../core/geom/3d/plane/plane3_compute_ray_intersection.js";
18
18
 
19
19
  /**
20
20
  * @class
@@ -250,7 +250,7 @@ export class Camera {
250
250
 
251
251
  assert.defined(plane, 'plane');
252
252
 
253
- computePlaneRayIntersection(
253
+ plane3_compute_ray_intersection(
254
254
  out,
255
255
  origin_x, origin_y, origin_z,
256
256
  direction_x, direction_y, direction_z,
@@ -86,7 +86,7 @@ export class EntityPath {
86
86
  const blueprint = def.blueprint;
87
87
 
88
88
  marker.offset = offset;
89
- marker.entity = blueprint.buildEntityBuilder({});
89
+ marker.entity = blueprint.build({});
90
90
  marker.definition = def;
91
91
 
92
92
  this.__position_marker(marker);
@@ -3,7 +3,7 @@ import { max2 } from "../../../../../../core/math/max2.js";
3
3
  import { min2 } from "../../../../../../core/math/min2.js";
4
4
  import { clamp } from "../../../../../../core/math/clamp.js";
5
5
  import { vec3 } from "gl-matrix";
6
- import { array_copy } from "../../../../../../core/collection/array/copyArray.js";
6
+ import { array_copy } from "../../../../../../core/collection/array/array_copy.js";
7
7
 
8
8
  /**
9
9
  * Compute a normal vector for Frenet frame based on a tangent (direction in which vertex points)
@@ -8,7 +8,7 @@ import { GROUP_WITH_ANY } from "./constants/GROUP_WITH_ANY.js";
8
8
  import { INTERNAL_RND_SORT_SEED } from "./constants/INTERNAL_RND_SORT_SEED.js";
9
9
  import { QuickSort } from "./QuickSort.js";
10
10
  import { CompareSubGroups } from "./CompareSubGroups.js";
11
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
11
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
12
12
  import { EvalTspace } from "./EvalTspace.js";
13
13
  import { ORIENT_PRESERVING } from "./constants/ORIENT_PRESERVING.js";
14
14
  import { AvgTSpace } from "./AvgTSpace.js";
@@ -1,4 +1,4 @@
1
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
1
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
2
2
 
3
3
  /**
4
4
  *
@@ -1,4 +1,4 @@
1
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
1
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
2
2
 
3
3
  /**
4
4
  *
@@ -8,7 +8,7 @@ import { v3_length } from "../../../../../core/geom/v3_length.js";
8
8
  import { ray3_array_apply_matrix4 } from "../../../../../core/geom/3d/ray/ray3_array_apply_matrix4.js";
9
9
  import { mat4 } from "gl-matrix";
10
10
  import { ray3_array_compose } from "../../../../../core/geom/3d/ray/ray3_array_compose.js";
11
- import { array_copy } from "../../../../../core/collection/array/copyArray.js";
11
+ import { array_copy } from "../../../../../core/collection/array/array_copy.js";
12
12
  import { MATRIX_4_IDENTITY } from "../../../../../core/geom/3d/matrix/MATRIX_4_IDENTITY.js";
13
13
 
14
14
  const hit = new ThreeVector3();
@@ -17,7 +17,7 @@ import { rewriteMaterial } from "./rewriteMaterial.js";
17
17
  import { max3 } from "../../../../core/math/max3.js";
18
18
  import { min2 } from "../../../../core/math/min2.js";
19
19
  import { DrawMode } from "../../ecs/mesh-v2/DrawMode.js";
20
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
20
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
21
21
  import { Cache } from "../../../../core/cache/Cache.js";
22
22
  import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
23
23
 
@@ -2,7 +2,7 @@ import { StaticMaterialCache } from "../../../../asset/loaders/material/StaticMa
2
2
  import { HashMap } from "../../../../../core/collection/HashMap.js";
3
3
  import { computeGeometryEquality } from "../../buffered/computeGeometryEquality.js";
4
4
  import { computeGeometryHash } from "../../buffered/computeGeometryHash.js";
5
- import { array_copy } from "../../../../../core/collection/array/copyArray.js";
5
+ import { array_copy } from "../../../../../core/collection/array/array_copy.js";
6
6
  import { mat4 } from "gl-matrix";
7
7
  import { Group, Matrix4, Mesh } from "three";
8
8
  import { mergeBufferGeometries } from "three/examples/jsm/utils/BufferGeometryUtils.js";
@@ -3,7 +3,7 @@
3
3
  import { renderSamplerFromTexture } from "../../../render/visibility/hiz/buildCanvasViewFromTexture.js";
4
4
  import { convex_hull_jarvis_2d } from "../../../../../core/geom/2d/convex-hull/convex_hull_jarvis_2d.js";
5
5
  import { fixed_convex_hull_relaxation } from "../../../../../core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js";
6
- import { array_copy } from "../../../../../core/collection/array/copyArray.js";
6
+ import { array_copy } from "../../../../../core/collection/array/array_copy.js";
7
7
  import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
8
8
  import { max2 } from "../../../../../core/math/max2.js";
9
9
  import { sampler2d_find_pixels } from "../../../texture/sampler/search/sampler2d_find_pixels.js";
@@ -2,7 +2,7 @@ import Signal from "../../../../../../../core/events/signal/Signal.js";
2
2
  import {
3
3
  DataType2TypedArrayConstructorMapping
4
4
  } from "../../../../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
5
- import { array_copy } from "../../../../../../../core/collection/array/copyArray.js";
5
+ import { array_copy } from "../../../../../../../core/collection/array/array_copy.js";
6
6
  import { min2 } from "../../../../../../../core/math/min2.js";
7
7
  import { assert } from "../../../../../../../core/assert.js";
8
8
  import { ParameterLookupTable } from "../../parameter/ParameterLookupTable.js";
@@ -1,5 +1,5 @@
1
1
  import { DynamicDrawUsage, LineBasicMaterial, LineSegments } from "three";
2
- import { array_copy } from "../../../core/collection/array/copyArray.js";
2
+ import { array_copy } from "../../../core/collection/array/array_copy.js";
3
3
  import { BufferGeometry } from "three/src/core/BufferGeometry.js";
4
4
  import { Float32BufferAttribute } from "three/src/core/BufferAttribute.js";
5
5
 
@@ -1,6 +1,6 @@
1
1
  import { EnginePlugin } from "../../../../../plugin/EnginePlugin.js";
2
2
  import { halton_sequence } from "../../../../../../core/math/statistics/halton_sequence.js";
3
- import { array_copy } from "../../../../../../core/collection/array/copyArray.js";
3
+ import { array_copy } from "../../../../../../core/collection/array/array_copy.js";
4
4
 
5
5
  /**
6
6
  * Generates a number of 2d jitter offsets in range -1...1
@@ -38,7 +38,7 @@ import { Decal } from "./model/Decal.js";
38
38
  import { ReferencedTextureAtlas } from "../../texture/atlas/ReferencedTextureAtlas.js";
39
39
  import { v3_morton_encode_transformed } from "../../../../core/geom/3d/morton/v3_morton_encode_transformed.js";
40
40
  import { v3_distance } from "../../../../core/geom/v3_distance.js";
41
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
41
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
42
42
  import { arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
43
43
  import { frustum_from_camera } from "../../ecs/camera/frustum_from_camera.js";
44
44
  import { arraySwapElements } from "../../../../core/collection/array/arraySwapElements.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
- plane_three_computeConvex3PlaneIntersection
3
- } from "../../../../core/geom/3d/plane/plane_three_compute_convex3_plane_intersection.js";
2
+ plane3_three_compute_convex_3_plane_intersection
3
+ } from "../../../../core/geom/3d/plane/plane3_three_compute_convex_3_plane_intersection.js";
4
4
 
5
5
  /**
6
6
  * Get frustum corners from a set of planes
@@ -13,7 +13,7 @@ export function computeFrustumCorners(result, planes) {
13
13
  const plane_y0 = planes[2];
14
14
  const plane_z0 = planes[4];
15
15
 
16
- plane_three_computeConvex3PlaneIntersection(result, 0,
16
+ plane3_three_compute_convex_3_plane_intersection(result, 0,
17
17
  plane_x0,
18
18
  plane_y0,
19
19
  plane_z0
@@ -21,7 +21,7 @@ export function computeFrustumCorners(result, planes) {
21
21
 
22
22
  const plane_z1 = planes[5];
23
23
 
24
- plane_three_computeConvex3PlaneIntersection(result, 3,
24
+ plane3_three_compute_convex_3_plane_intersection(result, 3,
25
25
  plane_x0,
26
26
  plane_y0,
27
27
  plane_z1
@@ -29,13 +29,13 @@ export function computeFrustumCorners(result, planes) {
29
29
 
30
30
  const plane_y1 = planes[3];
31
31
 
32
- plane_three_computeConvex3PlaneIntersection(result, 6,
32
+ plane3_three_compute_convex_3_plane_intersection(result, 6,
33
33
  plane_x0,
34
34
  plane_y1,
35
35
  plane_z0
36
36
  );
37
37
 
38
- plane_three_computeConvex3PlaneIntersection(result, 9,
38
+ plane3_three_compute_convex_3_plane_intersection(result, 9,
39
39
  plane_x0,
40
40
  plane_y1,
41
41
  plane_z1
@@ -43,25 +43,25 @@ export function computeFrustumCorners(result, planes) {
43
43
 
44
44
  const plane_x1 = planes[1];
45
45
 
46
- plane_three_computeConvex3PlaneIntersection(result, 12,
46
+ plane3_three_compute_convex_3_plane_intersection(result, 12,
47
47
  plane_x1,
48
48
  plane_y0,
49
49
  plane_z0
50
50
  );
51
51
 
52
- plane_three_computeConvex3PlaneIntersection(result, 15,
52
+ plane3_three_compute_convex_3_plane_intersection(result, 15,
53
53
  plane_x1,
54
54
  plane_y0,
55
55
  plane_z1
56
56
  );
57
57
 
58
- plane_three_computeConvex3PlaneIntersection(result, 18,
58
+ plane3_three_compute_convex_3_plane_intersection(result, 18,
59
59
  plane_x1,
60
60
  plane_y1,
61
61
  plane_z0
62
62
  );
63
63
 
64
- plane_three_computeConvex3PlaneIntersection(result, 21,
64
+ plane3_three_compute_convex_3_plane_intersection(result, 21,
65
65
  plane_x1,
66
66
  plane_y1,
67
67
  plane_z1
@@ -1,7 +1,7 @@
1
1
  import { AbstractLight } from "./AbstractLight.js";
2
2
  import { aabb3_matrix4_project_by_corners } from "../../../../../core/geom/3d/aabb/aabb3_matrix4_project_by_corners.js";
3
3
  import { aabb3_build_corners } from "../../../../../core/geom/3d/aabb/aabb3_build_corners.js";
4
- import { array_copy } from "../../../../../core/collection/array/copyArray.js";
4
+ import { array_copy } from "../../../../../core/collection/array/array_copy.js";
5
5
  import { mat4 } from "gl-matrix";
6
6
  import Signal from "../../../../../core/events/signal/Signal.js";
7
7
 
@@ -49,7 +49,7 @@ import { Decal } from "../model/Decal.js";
49
49
  import { mat4 } from "gl-matrix";
50
50
  import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
51
51
  import { makeHelperBoxGeometry } from "../../../../../../editor/process/symbolic/makeHelperBoxGeometry.js";
52
- import { array_copy } from "../../../../../core/collection/array/copyArray.js";
52
+ import { array_copy } from "../../../../../core/collection/array/array_copy.js";
53
53
  import { BufferGeometry } from "three/src/core/BufferGeometry.js";
54
54
  import { Float32BufferAttribute } from "three/src/core/BufferAttribute.js";
55
55
  import Quaternion from "../../../../../core/geom/Quaternion.js";
@@ -1,4 +1,4 @@
1
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
1
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
2
2
  import { assert } from "../../../../core/assert.js";
3
3
  import { InstancedMeshGroup } from "../../geometry/instancing/InstancedMeshGroup.js";
4
4
  import { BoxBufferGeometry, LineBasicMaterial, MeshBasicMaterial, OctahedronBufferGeometry } from "three";
@@ -1,7 +1,7 @@
1
1
  import { v3_distance_above_plane } from "../../../../core/geom/v3_distance_above_plane.js";
2
2
  import {
3
- plane_three_computeConvex3PlaneIntersection
4
- } from "../../../../core/geom/3d/plane/plane_three_compute_convex3_plane_intersection.js";
3
+ plane3_three_compute_convex_3_plane_intersection
4
+ } from "../../../../core/geom/3d/plane/plane3_three_compute_convex_3_plane_intersection.js";
5
5
 
6
6
  /**
7
7
  *
@@ -43,7 +43,7 @@ export function buildPlanarRenderLayerClipPlaneComputationMethod(traversePlanes,
43
43
  const p0 = pair[0];
44
44
  const p1 = pair[1];
45
45
 
46
- const planeIntersection = plane_three_computeConvex3PlaneIntersection(p, 0, p0, p1, objectPlane);
46
+ const planeIntersection = plane3_three_compute_convex_3_plane_intersection(p, 0, p0, p1, objectPlane);
47
47
 
48
48
  if (!planeIntersection) {
49
49
  //no intersection
@@ -6,7 +6,7 @@ import { read_frustum_planes_to_array } from "../../../../core/geom/3d/frustum/r
6
6
  import Signal from "../../../../core/events/signal/Signal.js";
7
7
  import { compare_three_objects } from "../../three/compare_three_objects.js";
8
8
  import { frustum_from_camera } from "../../ecs/camera/frustum_from_camera.js";
9
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
9
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
10
10
  import { array_remove_first } from "../../../../core/collection/array/array_remove_first.js";
11
11
 
12
12
  const DEFAULT_FLAGS = CameraViewFlags.Active
@@ -8,7 +8,7 @@ import {
8
8
  UnsignedByteType,
9
9
  WebGLRenderTarget
10
10
  } from "three";
11
- import { array_copy } from "../../../../../../core/collection/array/copyArray.js";
11
+ import { array_copy } from "../../../../../../core/collection/array/array_copy.js";
12
12
  import { makeQueryShader } from "./QueryShader.js";
13
13
  import { renderScreenSpace } from "../../../utils/renderScreenSpace.js";
14
14
  import { assert } from "../../../../../../core/assert.js";
@@ -1,4 +1,4 @@
1
- import { array_copy } from "../../../../../core/collection/array/copyArray.js";
1
+ import { array_copy } from "../../../../../core/collection/array/array_copy.js";
2
2
 
3
3
  const BIND_GROUP_MATERIAL = 1;
4
4
 
@@ -19,7 +19,7 @@ import {
19
19
  } from "three";
20
20
  import { DrawMode } from "../ecs/mesh-v2/DrawMode.js";
21
21
  import { Transform } from "../../ecs/transform/Transform.js";
22
- import { array_copy } from "../../../core/collection/array/copyArray.js";
22
+ import { array_copy } from "../../../core/collection/array/array_copy.js";
23
23
  import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
24
24
  import { Light } from "../ecs/light/Light.js";
25
25
  import { threeMakeLight } from "../ecs/light/binding/three/threeMakeLight.js";
@@ -1,4 +1,4 @@
1
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
1
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
2
2
  import { mat4 } from "gl-matrix";
3
3
  import { ray3_array_apply_matrix4 } from "../../../../core/geom/3d/ray/ray3_array_apply_matrix4.js";
4
4
  import { ray_hit_apply_transform } from "./ray_hit_apply_transform.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
4
4
  import { bvh_query_leaves_ray } from "../../../../core/bvh2/bvh3/query/bvh_query_leaves_ray.js";
5
5
  import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
6
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
6
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
7
7
  import { mat4, vec3 } from "gl-matrix";
8
8
  import { ensureGeometryBoundingBox } from "../../util/ensureGeometryBoundingBox.js";
9
9
  import { GeometryBVHBatched } from "./GeometryBVHBatched.js";