@woosh/meep-engine 2.50.3 → 2.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/editor/actions/concrete/WriteGridValueAction.js +13 -18
  2. package/editor/ecs/component/editors/Sampler2DEditor.js +2 -2
  3. package/editor/process/SymbolicDisplayProcess.js +1 -1
  4. package/editor/process/symbolic/buildThreeJSHelperEntity.js +1 -1
  5. package/editor/process/symbolic/makeCameraSymbolicDisplay.js +1 -1
  6. package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +1 -1
  7. package/editor/process/symbolic/makeLightSymbolicDisplay.js +1 -1
  8. package/editor/process/symbolic/makePathSymbolicDisplay.js +1 -1
  9. package/editor/process/symbolic/makePositionedIconDisplaySymbol.js +1 -1
  10. package/editor/view/ecs/components/GridObstacleController.js +2 -2
  11. package/editor/view/ecs/components/TerrainController.js +2 -2
  12. package/package.json +1 -1
  13. package/samples/terrain/editor.js +2 -2
  14. package/src/core/NumberFormat.js +0 -71
  15. package/src/core/UUID.spec.js +8 -0
  16. package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.d.ts +4 -0
  17. package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +58 -55
  18. package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.spec.js +54 -0
  19. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +3 -3
  20. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.spec.js +60 -0
  21. package/src/core/bvh2/bvh3/query/BVHQueryAny.js +16 -0
  22. package/src/core/bvh2/bvh3/query/bvh_collect_user_data.js +5 -5
  23. package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.js +2 -3
  24. package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.spec.js +22 -0
  25. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +2 -2
  26. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.spec.js +64 -0
  27. package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.js +2 -3
  28. package/src/core/bvh2/visual/convert_bvh_to_dot_format_string.js +2 -2
  29. package/src/core/cache/Cache.js +3 -5
  30. package/src/core/cache/CacheElement.js +1 -0
  31. package/src/core/geom/2d/quad-tree/PointQuadTree.js +10 -0
  32. package/src/core/geom/3d/aabb/aabb3_array_combine.js +3 -3
  33. package/src/core/geom/3d/aabb/aabb3_from_threejs_geometry.js +41 -0
  34. package/src/core/geom/3d/topology/struct/TopoMesh.js +3 -2
  35. package/src/core/geom/3d/topology/struct/prototypeBinaryTopology.js +4 -4
  36. package/src/core/geom/Vector2.d.ts +9 -0
  37. package/src/core/geom/Vector2.js +8 -22
  38. package/src/core/geom/Vector2.spec.js +153 -0
  39. package/src/core/graph/{convertGraphToDotString.js → convert_graph_to_dot_string.js} +1 -1
  40. package/src/core/graph/convert_graph_to_dot_string.spec.js +28 -0
  41. package/src/core/math/noise/sdnoise.js +5 -7
  42. package/src/core/math/noise/sdnoise.spec.js +87 -0
  43. package/src/core/model/ModuleRegistry.js +2 -4
  44. package/src/core/model/ModuleRegistry.spec.js +31 -0
  45. package/src/core/model/reactive/js/compileReactiveToJS.spec.js +14 -0
  46. package/src/core/model/reactive/model/logic/ReactiveAnd.spec.js +31 -1
  47. package/src/core/model/reactive/model/logic/ReactiveOr.spec.js +53 -0
  48. package/src/core/model/stat/LinearModifier.js +2 -2
  49. package/src/core/model/stat/LinearModifier.spec.js +62 -0
  50. package/src/core/model/stat/Stat.js +12 -0
  51. package/src/core/model/stat/Stat.spec.js +36 -0
  52. package/src/core/primitives/array/computeStridedIntegerArrayHash.spec.js +28 -0
  53. package/src/core/primitives/numbers/number_format_by_thousands.js +14 -0
  54. package/src/core/primitives/numbers/number_pretty_print.js +49 -0
  55. package/src/core/primitives/strings/computeStringHash.spec.js +12 -5
  56. package/src/core/process/BaseProcess.js +8 -8
  57. package/src/engine/Clock.js +30 -29
  58. package/src/engine/Clock.spec.js +26 -0
  59. package/src/engine/{Platform.js → browserInfo.js} +1 -5
  60. package/src/engine/ecs/EntityBuilder.js +3 -1
  61. package/src/engine/ecs/EntityBuilder.spec.js +21 -0
  62. package/src/engine/ecs/fow/FogOfWar.js +48 -54
  63. package/src/engine/ecs/gui/GUIElement.js +1 -1
  64. package/src/engine/ecs/gui/position/ViewportPosition.js +3 -3
  65. package/src/engine/ecs/{systems → renderable}/RenderSystem.d.ts +1 -1
  66. package/src/engine/ecs/{systems → renderable}/RenderSystem.js +10 -38
  67. package/src/engine/ecs/renderable/Renderable.d.ts +25 -0
  68. package/src/engine/ecs/{components → renderable}/Renderable.js +18 -83
  69. package/src/engine/ecs/renderable/Renderable.spec.js +10 -0
  70. package/src/engine/ecs/speaker/VoiceSystem.js +15 -9
  71. package/src/engine/ecs/terrain/ecs/TerrainClassifier.js +1 -1
  72. package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +3 -3
  73. package/src/engine/ecs/terrain/ecs/splat/SplatMapOptimizerDebugger.js +3 -3
  74. package/src/engine/ecs/terrain/ecs/splat/SplatMapping.js +2 -2
  75. package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +2 -2
  76. package/src/engine/ecs/terrain/util/paintTerrainOverlayViaLookupTable.js +2 -2
  77. package/src/engine/ecs/transform/Transform.js +1 -0
  78. package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -4
  79. package/src/engine/graphics/copy_transform_to_threejs_object.js +12 -0
  80. package/src/engine/graphics/debug/VisualSymbolLine.js +1 -1
  81. package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraph.spec.js +5 -0
  82. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +24 -25
  83. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.spec.js +5 -0
  84. package/src/engine/graphics/ecs/decal/DecalSystem.js +3 -21
  85. package/src/engine/graphics/ecs/decal/v2/Decal.js +32 -32
  86. package/src/engine/graphics/ecs/decal/v2/Decal.spec.js +5 -0
  87. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +4 -2
  88. package/src/engine/graphics/ecs/highlight/renderer/makeGaussianBlurShader.js +1 -4
  89. package/src/engine/graphics/ecs/highlight/system/RenderableHighlightSystem.d.ts +1 -1
  90. package/src/engine/graphics/ecs/highlight/system/RenderableHighlightSystem.js +2 -2
  91. package/src/engine/graphics/ecs/mesh/applyTransformToThreeObject.js +2 -5
  92. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +4 -33
  93. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +8 -4
  94. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.spec.js +5 -0
  95. package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +0 -12
  96. package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js +2 -2
  97. package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +0 -2
  98. package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +0 -4
  99. package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +0 -2
  100. package/src/engine/graphics/geometry/buffered/computeBufferAttributeHash.js +1 -1
  101. package/src/engine/graphics/geometry/optimization/merge/prototypeGeometryMerge.js +1 -1
  102. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -3
  103. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -4
  104. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -5
  105. package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +2 -2
  106. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +2 -6
  107. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +2 -1
  108. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +6 -1
  109. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +4 -4
  110. package/src/engine/graphics/shaders/SoftOutlineShader.js +2 -4
  111. package/src/engine/graphics/shadows/testShadowMapRendering.js +0 -2
  112. package/src/engine/graphics/texture/atlas/CachingTextureAtlas.spec.js +24 -0
  113. package/src/engine/graphics/texture/atlas/TextureAtlas.spec.js +46 -0
  114. package/src/engine/graphics/texture/sampler/SampleTraverser.js +1 -1
  115. package/src/engine/graphics/texture/sampler/Sampler2D.js +1 -1
  116. package/src/engine/graphics/texture/sampler/bicubic.spec.js +13 -0
  117. package/src/engine/graphics/texture/sampler/differenceSampler.js +1 -1
  118. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.js +5 -1
  119. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.spec.js +183 -0
  120. package/src/engine/graphics/texture/sampler/filter/filter_lanczos3.js +20 -0
  121. package/src/engine/graphics/texture/sampler/filter/mitchell.js +0 -21
  122. package/src/engine/graphics/texture/sampler/filter/mitchell_v1.js +21 -0
  123. package/src/engine/graphics/texture/sampler/filter/sampler2d_scale_down_generic.js +17 -16
  124. package/src/engine/graphics/texture/sampler/prototypeSamplerFiltering.js +11 -9
  125. package/src/engine/graphics/texture/sampler/{scaleSampler2D.js → resize/sampler2d_scale.js} +8 -8
  126. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale.spec.js +73 -0
  127. package/src/engine/graphics/texture/sampler/{sampler2_d_scale_down_lanczos.js → resize/sampler2d_scale_down_lanczos.js} +3 -24
  128. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.spec.js +29 -0
  129. package/src/engine/graphics/texture/sampler/{sampler2d_scale_down_linear.js → resize/sampler2d_scale_down_linear.js} +5 -5
  130. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_linear.spec.js +44 -0
  131. package/src/engine/graphics/texture/sampler/resize/{sampler2d_downsample_mipmap.js → sampler2d_scale_down_mipmap.js} +2 -2
  132. package/src/engine/graphics/texture/sampler/resize/{sampler2d_downsample_mipmap.spec.js → sampler2d_scale_down_mipmap.spec.js} +2 -2
  133. package/src/engine/graphics/texture/sampler/{genericResampleSampler2D.js → resize/sampler2d_scale_generic.js} +16 -12
  134. package/src/engine/graphics/texture/sampler/{upsampleSampler2D.js → resize/sampler2d_scale_up_linear.js} +5 -2
  135. package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_up_linear.spec.js +14 -0
  136. package/src/engine/graphics/texture/sampler/sampler2d_channel_compute_min_indices.js +4 -2
  137. package/src/engine/graphics/texture/sampler/sampler2d_channel_compute_min_indices.spec.js +15 -0
  138. package/src/engine/graphics/texture/sampler/util/drawSamplerHTML.js +2 -2
  139. package/src/engine/graphics/three/expand_aabb_by_transformed_three_object.js +46 -0
  140. package/src/engine/graphics/three/expand_aabb_by_transformed_three_object.spec.js +108 -0
  141. package/src/engine/graphics/trail/TemporalPath.js +83 -78
  142. package/src/engine/graphics/trail/TemporalPath.spec.js +5 -0
  143. package/src/engine/graphics/trail/x/RibbonX.spec.js +5 -0
  144. package/src/engine/grid/components/GridObstacle.js +45 -25
  145. package/src/engine/grid/components/GridObstacle.spec.js +130 -1
  146. package/src/engine/grid/components/GridPosition.js +5 -17
  147. package/src/engine/grid/components/GridPosition2Transform.js +1 -70
  148. package/src/engine/grid/components/GridPosition2TransformSerializationAdapter.js +70 -0
  149. package/src/engine/input/devices/InputDeviceSwitch.spec.js +5 -0
  150. package/src/engine/input/ecs/{InputBinding.js → components/InputBinding.js} +1 -1
  151. package/src/engine/input/ecs/components/InputController.js +2 -2
  152. package/src/engine/input/ecs/ism/InputBinding.js +2 -2
  153. package/src/engine/input/ecs/util/TerrainCameraTargetSampler.js +1 -1
  154. package/src/engine/input/ecs/util/TopDownCameraControllerHelper.js +1 -1
  155. package/src/engine/intelligence/behavior/behavior_to_dot.spec.js +25 -0
  156. package/src/engine/intelligence/behavior/util/DelayBehavior.js +6 -4
  157. package/src/engine/intelligence/blackboard/Blackboard.d.ts +2 -0
  158. package/src/engine/intelligence/blackboard/Blackboard.js +36 -2
  159. package/src/engine/intelligence/blackboard/Blackboard.spec.js +49 -0
  160. package/src/engine/intelligence/blackboard/BlackboardSerializationAdapter.spec.js +2 -0
  161. package/src/engine/navigation/grid/{AStar.js → find_path_on_grid_astar.js} +21 -18
  162. package/src/engine/navigation/grid/find_path_on_grid_astar.spec.js +7 -0
  163. package/src/engine/plugin/EnginePlugin.js +12 -14
  164. package/src/engine/plugin/EnginePlugin.spec.js +5 -0
  165. package/src/engine/plugin/EnginePluginManager.js +18 -22
  166. package/src/engine/scene/transitionToScene.js +12 -1
  167. package/src/engine/simulation/Ticker.js +1 -1
  168. package/src/engine/sound/ecs/SoundListenerSystem.js +1 -1
  169. package/src/generation/markers/debug/visualizeMarkers.js +1 -1
  170. package/src/generation/theme/TerrainLayerDescription.js +1 -1
  171. package/src/view/common/LabelView.js +3 -3
  172. package/src/engine/MeepSettings.js +0 -9
  173. package/src/engine/User.js +0 -28
  174. package/src/engine/UserController.js +0 -273
  175. package/src/engine/ecs/components/AABB.js +0 -33
  176. package/src/engine/ecs/components/AABBCollider.js +0 -15
  177. package/src/engine/ecs/components/AimController.js +0 -18
  178. package/src/engine/ecs/components/Attacker.js +0 -13
  179. package/src/engine/ecs/components/MeshCollider.js +0 -15
  180. package/src/engine/ecs/components/RangedAttack.js +0 -12
  181. package/src/engine/ecs/components/Renderable.d.ts +0 -14
  182. package/src/engine/ecs/components/TargetAI.js +0 -11
  183. package/src/engine/ecs/components/ViewportMeshProjection.js +0 -18
  184. package/src/engine/ecs/grid/Sampler2DDecoder.js +0 -57
  185. package/src/engine/ecs/grid/makeTerrainGeometry.js +0 -110
  186. package/src/engine/ecs/systems/AABBColliderSystem.js +0 -61
  187. package/src/engine/ecs/systems/AABBSystem.js +0 -89
  188. package/src/engine/ecs/systems/AimControllerSystem.js +0 -63
  189. package/src/engine/ecs/systems/AttackerSystem.js +0 -67
  190. package/src/engine/ecs/systems/MeshColliderSystem.js +0 -47
  191. package/src/engine/ecs/systems/MonsterAISystem.js +0 -163
  192. package/src/engine/ecs/systems/MortalitySystem.js +0 -46
  193. package/src/engine/ecs/systems/RangedAttackSystem.js +0 -132
  194. package/src/engine/ecs/systems/SerializationMetadataSystem.js +0 -10
  195. package/src/engine/ecs/systems/TargetAISystem.js +0 -107
  196. package/src/engine/ecs/systems/ViewportMeshProjectionSystem.js +0 -68
  197. package/src/engine/graphics/particles/ParticleEmitterLibrary.js +0 -87
  198. package/src/engine/graphics/texture/sampler/sampler2d_make_array_filler_function.js +0 -65
  199. package/src/engine/graphics/texture/sampler/sampler2d_scale_down_linear.spec.js +0 -17
  200. package/src/engine/graphics/trail/x/simulator/RibbonState.js +0 -10
  201. package/src/engine/grid/Grid.js +0 -131
  202. package/src/engine/grid/components/ViewportGridProjection.js +0 -20
  203. package/src/engine/grid/systems/GridObstacleSystem.js +0 -58
  204. package/src/engine/grid/systems/ViewportGridProjectionSystem.js +0 -105
  205. package/src/engine/navigation/grid/GridField.js +0 -328
  206. /package/src/{engine → core/primitives/array}/computeStridedIntegerArrayHash.js +0 -0
  207. /package/src/engine/ecs/{components → renderable}/RenderableFlags.js +0 -0
@@ -26,7 +26,6 @@ import ViewportPositionSystem from "../../ecs/gui/position/ViewportPositionSyste
26
26
  import { GridPosition2TransformSystem } from "../../grid/systems/GridPosition2TransformSystem.js";
27
27
  import { Transform2GridPositionSystem } from "../../grid/transform2grid/Transform2GridPositionSystem.js";
28
28
  import SynchronizePositionSystem from "../../ecs/systems/SynchronizePositionSystem.js";
29
- import GridObstacleSystem from "../../grid/systems/GridObstacleSystem.js";
30
29
  import GridPositionSystem from "../../grid/systems/GridPositionSystem.js";
31
30
  import InputControllerSystem from "../../input/ecs/systems/InputControllerSystem.js";
32
31
  import { InputSystem } from "../../input/ecs/systems/InputSystem.js";
@@ -37,7 +36,6 @@ import { AnimationGraphSystem } from "../ecs/animation/animator/AnimationGraphSy
37
36
  import { FogOfWarSystem } from "../../ecs/fow/FogOfWarSystem.js";
38
37
  import { FogOfWarRevealerSystem } from "../../ecs/fow/FogOfWarRevealerSystem.js";
39
38
  import { BehaviorSystem } from "../../intelligence/behavior/ecs/BehaviorSystem.js";
40
- import { SerializationMetadataSystem } from "../../ecs/systems/SerializationMetadataSystem.js";
41
39
  import { InverseKinematicsSystem } from "../../ecs/ik/InverseKinematicsSystem.js";
42
40
  import { PathDisplaySystem } from "../ecs/path/PathDisplaySystem.js";
43
41
  import RenderSystem from "../../ecs/systems/RenderSystem.js";
@@ -105,7 +103,6 @@ function makeConfig(engine) {
105
103
  new GridPosition2TransformSystem(),
106
104
  new Transform2GridPositionSystem(),
107
105
  new SynchronizePositionSystem(),
108
- new GridObstacleSystem(),
109
106
  new GridPositionSystem(),
110
107
  new InputControllerSystem(devices),
111
108
  new InputSystem(devices),
@@ -119,7 +116,6 @@ function makeConfig(engine) {
119
116
  new FogOfWarSystem(graphics),
120
117
  new FogOfWarRevealerSystem(0),
121
118
  new BehaviorSystem(engine),
122
- new SerializationMetadataSystem(),
123
119
  new InverseKinematicsSystem(),
124
120
  new PathDisplaySystem(engine),
125
121
  );
@@ -0,0 +1,12 @@
1
+ /**
2
+ *
3
+ * @param {Object3D} m
4
+ * @param {Transform} t
5
+ */
6
+ export function copy_transform_to_threejs_object(m, t) {
7
+ m.position.copy(t.position);
8
+
9
+ t.rotation.toEulerAnglesXYZ(m.rotation);
10
+
11
+ m.scale.copy(t.scale);
12
+ }
@@ -1,5 +1,5 @@
1
1
  import { BufferGeometry, Float32BufferAttribute, Line, LineBasicMaterial } from "three";
2
- import Renderable from "../../ecs/components/Renderable.js";
2
+ import Renderable from "../../ecs/renderable/Renderable.js";
3
3
 
4
4
  export class VisualSymbolLine {
5
5
 
@@ -0,0 +1,5 @@
1
+ import { AnimationGraph } from "./AnimationGraph.js";
2
+
3
+ test("constructor does not throw",()=>{
4
+ new AnimationGraph()
5
+ });
@@ -9,31 +9,30 @@ import { computeHashIntegerArray } from "../../../../../../../core/collection/ar
9
9
  import { isArrayEqual } from "../../../../../../../core/collection/array/isArrayEqual.js";
10
10
 
11
11
  export class AnimationGraphDefinition {
12
- constructor() {
13
- /**
14
- *
15
- * @type {AnimationStateDefinition[]}
16
- */
17
- this.states = [];
18
-
19
- /**
20
- *
21
- * @type {AnimationTransitionDefinition[]}
22
- */
23
- this.transitions = [];
24
-
25
- /**
26
- *
27
- * @type {AnimationStateDefinition}
28
- */
29
- this.startingSate = null;
30
-
31
- /**
32
- *
33
- * @type {AnimationClipDefinition[]}
34
- */
35
- this.clipIndex = [];
36
- }
12
+
13
+ /**
14
+ *
15
+ * @type {AnimationStateDefinition[]}
16
+ */
17
+ states = [];
18
+
19
+ /**
20
+ *
21
+ * @type {AnimationTransitionDefinition[]}
22
+ */
23
+ transitions = [];
24
+
25
+ /**
26
+ *
27
+ * @type {AnimationStateDefinition}
28
+ */
29
+ startingSate = null;
30
+
31
+ /**
32
+ *
33
+ * @type {AnimationClipDefinition[]}
34
+ */
35
+ clipIndex = [];
37
36
 
38
37
  /**
39
38
  *
@@ -0,0 +1,5 @@
1
+ import { AnimationGraphDefinition } from "./AnimationGraphDefinition.js";
2
+
3
+ test("constructor does not throw", () => {
4
+ new AnimationGraphDefinition();
5
+ });
@@ -5,30 +5,12 @@ import { System } from '../../../ecs/System.js';
5
5
  import { Euler as ThreeEuler, MaterialLoader, Mesh as ThreeMesh, Vector3 as ThreeVector3 } from 'three';
6
6
  import { Transform } from '../../../ecs/transform/Transform.js';
7
7
  import Mesh from '../mesh/Mesh.js';
8
- import Renderable from '../../../ecs/components/Renderable.js';
8
+ import Renderable from '../../../ecs/renderable/Renderable.js';
9
9
  import LoadMaterial from "../../material/LoadMaterial.js";
10
10
 
11
11
  import Decal from "./Decal.js";
12
12
  import DecalGeometry from "./threejs/DecalGeometry.js";
13
-
14
- /**
15
- *
16
- * @param {string} str
17
- * @returns {number}
18
- */
19
- function stringHash(str) {
20
- let hash = 5381,
21
- i = str.length;
22
-
23
- while (i) {
24
- hash = (hash * 33) ^ str.charCodeAt(--i)
25
- }
26
-
27
- /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
28
- * integers. Since we want the results to be always positive, convert the
29
- * signed int to an unsigned by doing an unsigned bitshift. */
30
- return hash >>> 0;
31
- }
13
+ import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
32
14
 
33
15
  const MaterialCache = function () {
34
16
  this.materialLoader = new MaterialLoader();
@@ -37,7 +19,7 @@ const MaterialCache = function () {
37
19
 
38
20
  MaterialCache.prototype.get = function (json) {
39
21
  const str = JSON.stringify(json);
40
- const hash = stringHash(str);
22
+ const hash = computeStringHash(str);
41
23
  if (this.table.hasOwnProperty(hash)) {
42
24
  return this.table[hash];
43
25
  } else {
@@ -3,38 +3,38 @@ import { computeStringHash } from "../../../../../core/primitives/strings/comput
3
3
  import { assert } from "../../../../../core/assert.js";
4
4
 
5
5
  export class Decal {
6
- constructor() {
7
- /**
8
- * Asset URL
9
- * @type {string}
10
- */
11
- this.uri = "";
12
-
13
- /**
14
- * Controls draw order
15
- * @type {number}
16
- */
17
- this.priority = 0;
18
-
19
- /**
20
- * Color of the decal will be pre-multiplied by this
21
- * @type {Color}
22
- */
23
- this.color = new Color(1, 1, 1, 1);
24
-
25
- /**
26
- * Internal transient reference to loaded asset
27
- * @type {Sampler2D|null}
28
- * @private
29
- */
30
- this.__cached_sampler = null;
31
- /**
32
- *
33
- * @type {String|null}
34
- * @private
35
- */
36
- this.__cached_uri = null;
37
- }
6
+
7
+ /**
8
+ * Asset URL
9
+ * @type {string}
10
+ */
11
+ uri = "";
12
+
13
+ /**
14
+ * Controls draw order
15
+ * @type {number}
16
+ */
17
+ priority = 0;
18
+
19
+ /**
20
+ * Color of the decal will be pre-multiplied by this
21
+ * @type {Color}
22
+ */
23
+ color = new Color(1, 1, 1, 1);
24
+
25
+ /**
26
+ * Internal transient reference to loaded asset
27
+ * @type {Sampler2D|null}
28
+ * @private
29
+ */
30
+ __cached_sampler = null;
31
+
32
+ /**
33
+ *
34
+ * @type {String|null}
35
+ * @private
36
+ */
37
+ __cached_uri = null;
38
38
 
39
39
  static fromJSON(j) {
40
40
  const r = new Decal();
@@ -0,0 +1,5 @@
1
+ import { Decal } from "./Decal.js";
2
+
3
+ test("constructor does not throw", () => {
4
+ new Decal();
5
+ });
@@ -387,7 +387,9 @@ export class FPDecalSystem extends AbstractContextSystem {
387
387
 
388
388
  const leaves = [];
389
389
 
390
- const hit_count = bvh_query_leaves_ray(this.bvh, leaves, 0,
390
+ const bvh = this.bvh;
391
+
392
+ const hit_count = bvh_query_leaves_ray(bvh,bvh.root, leaves, 0,
391
393
  origin_x, origin_y, origin_z,
392
394
  direction_x, direction_y, direction_z
393
395
  );
@@ -399,7 +401,7 @@ export class FPDecalSystem extends AbstractContextSystem {
399
401
  for (let i = 0; i < hit_count; i++) {
400
402
  const node = leaves[i];
401
403
 
402
- const entity = this.bvh.node_get_user_data(node);
404
+ const entity = bvh.node_get_user_data(node);
403
405
 
404
406
 
405
407
  /**
@@ -1,8 +1,5 @@
1
1
  import LineBuilder from "../../../../../core/codegen/LineBuilder.js";
2
-
3
- function gaussian(s, v) {
4
- return Math.exp(-(v * v) / (2.0 * s * s));
5
- }
2
+ import { gaussian } from "../../../../../core/math/gaussian.js";
6
3
 
7
4
  /**
8
5
  * Pre-build kernel internally, no branches in convolution code, everything is inlined
@@ -1,7 +1,7 @@
1
1
  import {System} from "../../../../ecs/System";
2
2
  import Engine from "../../../../Engine";
3
3
  import Highlight from "../Highlight";
4
- import Renderable from "../../../../ecs/components/Renderable";
4
+ import Renderable from "../../../../ecs/renderable/Renderable";
5
5
 
6
6
  export class RenderableHighlightSystem extends System<Highlight, Renderable> {
7
7
  constructor(engine: Engine)
@@ -1,7 +1,7 @@
1
1
  import { System } from "../../../../ecs/System.js";
2
2
  import { HighlightRenderElementSource } from "../plugin/HighlightRenderElementSource.js";
3
- import Renderable from "../../../../ecs/components/Renderable.js";
4
- import { RenderableFlags } from "../../../../ecs/components/RenderableFlags.js";
3
+ import Renderable from "../../../../ecs/renderable/Renderable.js";
4
+ import { RenderableFlags } from "../../../../ecs/renderable/RenderableFlags.js";
5
5
  import Highlight from "../Highlight.js";
6
6
  import { OutlineRenderPlugin } from "../plugin/OutlineRenderPlugin.js";
7
7
 
@@ -1,4 +1,5 @@
1
1
  import { rootObject3DFastMatrixUpdate } from "./rootObject3DFastMatrixUpdate.js";
2
+ import { copy_transform_to_threejs_object } from "../../copy_transform_to_threejs_object.js";
2
3
 
3
4
  /**
4
5
  *
@@ -6,11 +7,7 @@ import { rootObject3DFastMatrixUpdate } from "./rootObject3DFastMatrixUpdate.js"
6
7
  * @param {Transform} t
7
8
  */
8
9
  export function applyTransformToThreeObject(m, t) {
9
- m.position.copy(t.position);
10
-
11
- t.rotation.toEulerAnglesXYZ(m.rotation);
12
-
13
- m.scale.copy(t.scale);
10
+ copy_transform_to_threejs_object(m, t);
14
11
 
15
12
  rootObject3DFastMatrixUpdate(m);
16
13
  }
@@ -5,8 +5,8 @@ import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matri
5
5
  import { mat4 } from "gl-matrix";
6
6
  import { ray3_array_apply_matrix4 } from "../../../../core/geom/3d/ray/ray3_array_apply_matrix4.js";
7
7
  import { GeometrySpatialQueryAccelerator } from "../../geometry/buffered/query/GeometrySpatialQueryAccelerator.js";
8
- import { assert } from "../../../../core/assert.js";
9
8
  import { EBBVHLeafProxy } from "../../../../core/bvh2/bvh3/EBBVHLeafProxy.js";
9
+ import { aabb3_from_threejs_geometry } from "../../../../core/geom/3d/aabb/aabb3_from_threejs_geometry.js";
10
10
 
11
11
  /**
12
12
  * @readonly
@@ -267,38 +267,9 @@ export class ShadedGeometry {
267
267
 
268
268
  update_bounds() {
269
269
  // update bounds
270
- const gbb = this.geometry.boundingBox;
271
-
272
- const min = gbb.min;
273
-
274
- const x0 = min.x;
275
- const y0 = min.y;
276
- const z0 = min.z;
277
-
278
- const max = gbb.max;
279
-
280
- const x1 = max.x;
281
- const y1 = max.y;
282
- const z1 = max.z;
283
-
284
- // validate bounds
285
- assert.notNaN(x0, 'x0');
286
- assert.notNaN(y0, 'y0');
287
- assert.notNaN(z0, 'z0');
288
-
289
- assert.notNaN(x1, 'x1');
290
- assert.notNaN(y1, 'y1');
291
- assert.notNaN(z1, 'z1');
292
-
293
- // marshal into transform-accepted format
294
- scratch_aabb3_array[0] = x0;
295
- scratch_aabb3_array[1] = y0;
296
- scratch_aabb3_array[2] = z0;
297
-
298
- scratch_aabb3_array[3] = x1;
299
- scratch_aabb3_array[4] = y1;
300
- scratch_aabb3_array[5] = z1;
270
+ aabb3_from_threejs_geometry(scratch_aabb3_array, this.geometry);
301
271
 
272
+ // transform
302
273
  aabb3_matrix4_project(this.__bvh_leaf.bounds, scratch_aabb3_array, this.transform);
303
274
  }
304
275
 
@@ -315,7 +286,7 @@ export class ShadedGeometry {
315
286
  mat4.invert(scratch_m4, transform_matrix4);
316
287
 
317
288
  // transform ray to local space
318
- if (!ray3_array_apply_matrix4(scratch_ray_0,0, ray,0, scratch_m4)) {
289
+ if (!ray3_array_apply_matrix4(scratch_ray_0, 0, ray, 0, scratch_m4)) {
319
290
  // invalid transform matrix
320
291
  return false;
321
292
  }
@@ -369,7 +369,9 @@ export class ShadedGeometrySystem extends System {
369
369
 
370
370
  const hits = [];
371
371
 
372
- const hit_count = bvh_query_leaves_generic(hits, 0, this.__bvh_binary, BVHQueryIntersectsRay.from([origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]));
372
+ const bvh = this.__bvh_binary;
373
+
374
+ const hit_count = bvh_query_leaves_generic(hits, 0, bvh, bvh.root, BVHQueryIntersectsRay.from([origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]));
373
375
 
374
376
  const ecd = this.entityManager.dataset;
375
377
 
@@ -383,7 +385,7 @@ export class ShadedGeometrySystem extends System {
383
385
  for (let i = 0; i < hit_count; i++) {
384
386
  const node_id = hits[i];
385
387
 
386
- const entity = this.__bvh_binary.node_get_user_data(node_id);
388
+ const entity = bvh.node_get_user_data(node_id);
387
389
 
388
390
  /**
389
391
  *
@@ -447,7 +449,9 @@ export class ShadedGeometrySystem extends System {
447
449
 
448
450
  const hits = [];
449
451
 
450
- const hit_count = bvh_query_leaves_generic(hits, 0, this.__bvh_binary, BVHQueryIntersectsRay.from([origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]));
452
+ const bvh = this.__bvh_binary;
453
+
454
+ const hit_count = bvh_query_leaves_generic(hits, 0, bvh, bvh.root, BVHQueryIntersectsRay.from([origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]));
451
455
 
452
456
  const ecd = this.entityManager.dataset;
453
457
 
@@ -460,7 +464,7 @@ export class ShadedGeometrySystem extends System {
460
464
  for (let i = 0; i < hit_count; i++) {
461
465
  const node_id = hits[i];
462
466
 
463
- const entity = this.__bvh_binary.node_get_user_data(node_id);
467
+ const entity = bvh.node_get_user_data(node_id);
464
468
 
465
469
  /**
466
470
  *
@@ -0,0 +1,5 @@
1
+ import { SGMesh } from "./SGMesh.js";
2
+
3
+ test("constructor does not throw", () => {
4
+ expect(() => new SGMesh()).not.toThrow()
5
+ });
@@ -20,10 +20,6 @@ import { randomFromArray } from "../../../../../core/math/random/randomFromArray
20
20
  import { BehaviorComponent } from "../../../../intelligence/behavior/ecs/BehaviorComponent.js";
21
21
  import { OrbitingBehavior } from "../../../../../../../model/game/util/behavior/OrbitingBehavior.js";
22
22
  import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
23
- import {
24
- MicronShadedGeometryRenderAdapter
25
- } from "../../../micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js";
26
- import { MicronRenderContext } from "../../../micron/render/v1/MicronRenderContext.js";
27
23
  import Vector2 from "../../../../../core/geom/Vector2.js";
28
24
 
29
25
  const eh = new EngineHarness();
@@ -57,14 +53,6 @@ async function main(engine) {
57
53
 
58
54
  const sgs = new ShadedGeometrySystem(engine);
59
55
 
60
- const mrc = new MicronRenderContext();
61
- sgs.register_render_adapter(2, () => {
62
- const adapter = new MicronShadedGeometryRenderAdapter();
63
- adapter.ctx = mrc;
64
-
65
- return adapter;
66
- });
67
-
68
56
  await em.addSystem(sgs);
69
57
  await em.addSystem(new BehaviorSystem(engine));
70
58
 
@@ -4,8 +4,8 @@ import {
4
4
  RIBBON_ATTRIBUTE_ADDRESS_UV_OFFSET
5
5
  } from "../../../trail/x/ribbon_attributes_spec.js";
6
6
  import Vector3 from "../../../../../core/geom/Vector3.js";
7
- import Renderable from "../../../../ecs/components/Renderable.js";
8
- import { RenderableFlags } from "../../../../ecs/components/RenderableFlags.js";
7
+ import Renderable from "../../../../ecs/renderable/Renderable.js";
8
+ import { RenderableFlags } from "../../../../ecs/renderable/RenderableFlags.js";
9
9
  import { Transform } from "../../../../ecs/transform/Transform.js";
10
10
  import EntityBuilder from "../../../../ecs/EntityBuilder.js";
11
11
  import ThreeFactory from "../../../three/ThreeFactory.js";
@@ -38,7 +38,6 @@ import LightSystem from "../light/LightSystem.js";
38
38
  import AnimationControllerSystem from "../animation/AnimationControllerSystem.js";
39
39
  import { AnimationGraphSystem } from "../animation/animator/AnimationGraphSystem.js";
40
40
  import { BehaviorSystem } from "../../../intelligence/behavior/ecs/BehaviorSystem.js";
41
- import { SerializationMetadataSystem } from "../../../ecs/systems/SerializationMetadataSystem.js";
42
41
  import { InverseKinematicsSystem } from "../../../ecs/ik/InverseKinematicsSystem.js";
43
42
  import { PathDisplaySystem } from "./PathDisplaySystem.js";
44
43
  import { PathDisplay } from "./PathDisplay.js";
@@ -121,7 +120,6 @@ function makeConfig(engine) {
121
120
  new AnimationGraphSystem(graphics.viewport.size),
122
121
  headsUpDisplaySystem,
123
122
  new BehaviorSystem(engine),
124
- new SerializationMetadataSystem(),
125
123
  new InverseKinematicsSystem(),
126
124
  new ShadedGeometryHighlightSystem(engine),
127
125
  new PathDisplaySystem(engine),
@@ -27,7 +27,6 @@ import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositio
27
27
  import { GridPosition2TransformSystem } from "../../../../grid/systems/GridPosition2TransformSystem.js";
28
28
  import { Transform2GridPositionSystem } from "../../../../grid/transform2grid/Transform2GridPositionSystem.js";
29
29
  import SynchronizePositionSystem from "../../../../ecs/systems/SynchronizePositionSystem.js";
30
- import GridObstacleSystem from "../../../../grid/systems/GridObstacleSystem.js";
31
30
  import GridPositionSystem from "../../../../grid/systems/GridPositionSystem.js";
32
31
  import InputControllerSystem from "../../../../input/ecs/systems/InputControllerSystem.js";
33
32
  import { InputSystem } from "../../../../input/ecs/systems/InputSystem.js";
@@ -36,7 +35,6 @@ import LightSystem from "../../light/LightSystem.js";
36
35
  import AnimationControllerSystem from "../../animation/AnimationControllerSystem.js";
37
36
  import { AnimationGraphSystem } from "../../animation/animator/AnimationGraphSystem.js";
38
37
  import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
39
- import { SerializationMetadataSystem } from "../../../../ecs/systems/SerializationMetadataSystem.js";
40
38
  import { InverseKinematicsSystem } from "../../../../ecs/ik/InverseKinematicsSystem.js";
41
39
  import { PathDisplaySystem } from "../PathDisplaySystem.js";
42
40
  import {
@@ -119,7 +117,6 @@ function makeConfig(engine) {
119
117
  new GridPosition2TransformSystem(),
120
118
  new Transform2GridPositionSystem(),
121
119
  new SynchronizePositionSystem(),
122
- new GridObstacleSystem(),
123
120
  new GridPositionSystem(),
124
121
  new InputControllerSystem(devices),
125
122
  new InputSystem(devices),
@@ -131,7 +128,6 @@ function makeConfig(engine) {
131
128
  new AnimationGraphSystem(graphics.viewport.size),
132
129
  headsUpDisplaySystem,
133
130
  new BehaviorSystem(engine),
134
- new SerializationMetadataSystem(),
135
131
  new InverseKinematicsSystem(),
136
132
  new PathDisplaySystem(engine),
137
133
  );
@@ -14,7 +14,6 @@ import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositio
14
14
  import { GridPosition2TransformSystem } from "../../../../grid/systems/GridPosition2TransformSystem.js";
15
15
  import { Transform2GridPositionSystem } from "../../../../grid/transform2grid/Transform2GridPositionSystem.js";
16
16
  import SynchronizePositionSystem from "../../../../ecs/systems/SynchronizePositionSystem.js";
17
- import GridObstacleSystem from "../../../../grid/systems/GridObstacleSystem.js";
18
17
  import GridPositionSystem from "../../../../grid/systems/GridPositionSystem.js";
19
18
  import InputControllerSystem from "../../../../input/ecs/systems/InputControllerSystem.js";
20
19
  import { InputSystem } from "../../../../input/ecs/systems/InputSystem.js";
@@ -54,7 +53,6 @@ function makeConfig(engine) {
54
53
  new GridPosition2TransformSystem(),
55
54
  new Transform2GridPositionSystem(),
56
55
  new SynchronizePositionSystem(),
57
- new GridObstacleSystem(),
58
56
  new GridPositionSystem(),
59
57
  new InputControllerSystem(devices),
60
58
  new InputSystem(devices),
@@ -1,4 +1,4 @@
1
- import { computeStridedIntegerArrayHash } from "../../../computeStridedIntegerArrayHash.js";
1
+ import { computeStridedIntegerArrayHash } from "../../../../core/primitives/array/computeStridedIntegerArrayHash.js";
2
2
 
3
3
  /**
4
4
  *
@@ -8,7 +8,7 @@ import Vector3 from "../../../../../core/geom/Vector3.js";
8
8
  import Vector2 from "../../../../../core/geom/Vector2.js";
9
9
  import { GLTFAssetLoader } from "../../../../asset/loaders/GLTFAssetLoader.js";
10
10
  import EntityBuilder from "../../../../ecs/EntityBuilder.js";
11
- import Renderable from "../../../../ecs/components/Renderable.js";
11
+ import Renderable from "../../../../ecs/renderable/Renderable.js";
12
12
  import { Transform } from "../../../../ecs/transform/Transform.js";
13
13
  import { merge_geometry_hierarchy } from "./merge_geometry_hierarchy.js";
14
14
  import {
@@ -22,7 +22,6 @@ import { InputSystem } from "../../../../../../input/ecs/systems/InputSystem.js"
22
22
  import MeshHighlightSystem from "../../../../../ecs/highlight/system/MeshHighlightSystem.js";
23
23
  import LightSystem from "../../../../../ecs/light/LightSystem.js";
24
24
  import { BehaviorSystem } from "../../../../../../intelligence/behavior/ecs/BehaviorSystem.js";
25
- import { SerializationMetadataSystem } from "../../../../../../ecs/systems/SerializationMetadataSystem.js";
26
25
  import { PathDisplaySystem } from "../../../../../ecs/path/PathDisplaySystem.js";
27
26
  import RenderSystem from "../../../../../../ecs/systems/RenderSystem.js";
28
27
  import { makeEngineOptionsModel } from "../../../../../../../../../model/game/options/makeEngineOptionsModel.js";
@@ -65,7 +64,7 @@ import { ShadedGeometry } from "../../../../../ecs/mesh-v2/ShadedGeometry.js";
65
64
  import { DrawMode } from "../../../../../ecs/mesh-v2/DrawMode.js";
66
65
  import { makeHelperBoxGeometry } from "../../../../../../../../editor/process/symbolic/makeHelperBoxGeometry.js";
67
66
  import { LineBasicMaterial } from "three";
68
- import Renderable from "../../../../../../ecs/components/Renderable.js";
67
+ import Renderable from "../../../../../../ecs/renderable/Renderable.js";
69
68
  import { TransformControls } from "three/examples/jsm/controls/TransformControls.js";
70
69
  import { threeUpdateTransform } from "../../../../../util/threeUpdateTransform.js";
71
70
  import InputController from "../../../../../../input/ecs/components/InputController.js";
@@ -125,7 +124,6 @@ function makeConfig(engine) {
125
124
  }),
126
125
  headsUpDisplaySystem,
127
126
  new BehaviorSystem(engine),
128
- new SerializationMetadataSystem(),
129
127
  new PathDisplaySystem(engine),
130
128
  new ParticleEmitterSystem(engine),
131
129
  new ShadedGeometrySystem(engine)
@@ -27,7 +27,6 @@ import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositio
27
27
  import { GridPosition2TransformSystem } from "../../../../grid/systems/GridPosition2TransformSystem.js";
28
28
  import { Transform2GridPositionSystem } from "../../../../grid/transform2grid/Transform2GridPositionSystem.js";
29
29
  import SynchronizePositionSystem from "../../../../ecs/systems/SynchronizePositionSystem.js";
30
- import GridObstacleSystem from "../../../../grid/systems/GridObstacleSystem.js";
31
30
  import GridPositionSystem from "../../../../grid/systems/GridPositionSystem.js";
32
31
  import InputControllerSystem from "../../../../input/ecs/systems/InputControllerSystem.js";
33
32
  import { InputSystem } from "../../../../input/ecs/systems/InputSystem.js";
@@ -38,7 +37,6 @@ import { AnimationGraphSystem } from "../../../ecs/animation/animator/AnimationG
38
37
  import { FogOfWarSystem } from "../../../../ecs/fow/FogOfWarSystem.js";
39
38
  import { FogOfWarRevealerSystem } from "../../../../ecs/fow/FogOfWarRevealerSystem.js";
40
39
  import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
41
- import { SerializationMetadataSystem } from "../../../../ecs/systems/SerializationMetadataSystem.js";
42
40
  import { InverseKinematicsSystem } from "../../../../ecs/ik/InverseKinematicsSystem.js";
43
41
  import { CanvasView } from "../../../../../view/elements/CanvasView.js";
44
42
  import Vector3 from "../../../../../core/geom/Vector3.js";
@@ -111,7 +109,6 @@ function makeConfig(engine) {
111
109
  new GridPosition2TransformSystem(),
112
110
  new Transform2GridPositionSystem(),
113
111
  new SynchronizePositionSystem(),
114
- new GridObstacleSystem(),
115
112
  new GridPositionSystem(),
116
113
  new InputControllerSystem(devices),
117
114
  new InputSystem(devices),
@@ -125,7 +122,6 @@ function makeConfig(engine) {
125
122
  new FogOfWarSystem(graphics),
126
123
  new FogOfWarRevealerSystem(0),
127
124
  new BehaviorSystem(engine),
128
- new SerializationMetadataSystem(),
129
125
  new InverseKinematicsSystem(),
130
126
  new PathDisplaySystem(engine),
131
127
  );