@woosh/meep-engine 2.54.0 → 2.56.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.
- package/editor/view/node-graph/PortView.js +2 -2
- package/package.json +1 -1
- package/src/core/__module.js +1 -1
- package/src/core/binary/BinaryBuffer.js +2 -1
- package/src/core/cache/Cache.js +1 -1
- package/src/core/cache/LoadingCache.js +10 -5
- package/src/core/collection/Stack.js +11 -14
- package/src/core/collection/array/array_contains_duplicates.js +5 -2
- package/src/core/collection/array/array_contains_duplicates.spec.js +14 -0
- package/src/core/collection/array/array_copy_entire.js +6 -11
- package/src/core/collection/array/array_get_index_in_range.js +5 -0
- package/src/core/collection/array/array_get_index_in_range.spec.js +16 -0
- package/src/core/collection/array/array_remove_element.js +6 -9
- package/src/core/collection/array/array_remove_first.js +13 -6
- package/src/core/collection/array/array_remove_first.spec.js +39 -0
- package/src/core/collection/array/binarySearchHighIndex.spec.js +10 -9
- package/src/core/collection/array/groupArrayBy.js +1 -1
- package/src/core/collection/array/isArrayEqual.js +4 -1
- package/src/core/collection/array/randomizeArrayElementOrder.js +1 -0
- package/src/core/collection/array/randomizeArrayElementOrder.spec.js +27 -0
- package/src/core/collection/heap/Uin32Heap.spec.js +100 -0
- package/src/core/collection/heap/Uint32Heap.js +16 -7
- package/src/core/collection/list/List.js +1 -0
- package/src/core/collection/{HashMap.js → map/HashMap.js} +10 -10
- package/src/core/collection/{HashMap.spec.js → map/HashMap.spec.js} +1 -1
- package/src/core/collection/{ObservedMap.js → map/ObservedMap.js} +1 -1
- package/src/core/collection/{HashSet.js → set/HashSet.js} +4 -3
- package/src/core/collection/{Set.d.ts → set/Set.d.ts} +1 -1
- package/src/core/collection/{Set.js → set/Set.js} +17 -14
- package/src/core/function/FunctionCompiler.js +4 -4
- package/src/core/function/Functions.js +0 -19
- package/src/core/geom/2d/aabb/AABB2.js +1 -1
- package/src/core/geom/3d/SurfacePoint3.js +30 -20
- package/src/core/geom/3d/SurfacePoint3.spec.js +116 -0
- package/src/core/geom/3d/aabb/AABB3.js +13 -10
- package/src/core/geom/3d/aabb/{aabb3_array_contains_point.js → aabb3_array_intersects_point.js} +4 -1
- package/src/core/geom/3d/aabb/aabb3_from_min_max.js +25 -1
- package/src/core/geom/3d/aabb/aabb3_from_threejs_geometry.js +2 -25
- package/src/core/geom/3d/aabb/aabb3_signed_distance_sqr_to_point.js +5 -1
- package/src/core/geom/3d/apply_mat4_transform_to_direction_v3_array.js +5 -1
- package/src/core/geom/3d/apply_mat4_transform_to_v3_array.js +5 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +2 -2
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_calc_edges.js +1 -1
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.spec.js +26 -0
- package/src/core/geom/3d/v3_compute_triangle_normal.spec.js +18 -0
- package/src/core/geom/Vector2.js +1 -1
- package/src/core/geom/Vector3.js +1 -1
- package/src/core/geom/packing/miniball/Miniball.spec.js +24 -0
- package/src/core/math/statistics/computeStatisticalPartialMedian.js +2 -2
- package/src/core/model/ObservedInteger.js +12 -7
- package/src/core/model/ObservedString.js +10 -8
- package/src/core/model/node-graph/visual/NodeGraphVisualData.js +1 -1
- package/src/core/model/object/ImmutableObjectPool.js +1 -1
- package/src/core/model/object/read_property.js +2 -2
- package/src/core/model/object/write_property.js +3 -3
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +1 -1
- package/src/core/primitives/numbers/compareNumbers.js +4 -4
- package/src/core/primitives/numbers/number_compare_ascending.js +9 -0
- package/src/core/primitives/numbers/number_compare_ascending.spec.js +9 -0
- package/src/core/primitives/numbers/number_compare_descending.js +9 -0
- package/src/core/primitives/numbers/number_compare_descending.spec.js +9 -0
- package/src/core/primitives/numbers/number_format_by_thousands.spec.js +12 -0
- package/src/core/primitives/numbers/number_pretty_print.js +1 -1
- package/src/core/primitives/strings/compareStrings.spec.js +12 -0
- package/src/core/primitives/strings/string_capitalize.js +15 -0
- package/src/core/primitives/strings/string_capitalize.spec.js +13 -0
- package/src/core/primitives/strings/string_compute_byte_size.js +21 -0
- package/src/core/primitives/strings/string_compute_common_prefix.js +44 -0
- package/src/core/primitives/strings/string_compute_common_prefix.spec.js +23 -0
- package/src/core/primitives/strings/string_format_camel_to_kebab.js +9 -0
- package/src/core/primitives/strings/string_format_camel_to_kebab.spec.js +8 -0
- package/src/core/primitives/strings/string_format_kebab_to_underscore.js +8 -0
- package/src/core/time/current_time_in_seconds.js +11 -0
- package/src/engine/Clock.js +3 -13
- package/src/engine/animation/curve/AnimationCurve.spec.js +27 -0
- package/src/engine/asset/AssetManager.js +5 -5
- package/src/engine/asset/loaders/GLTFAssetLoader.js +1 -1
- package/src/engine/ecs/EntityBlueprint.js +8 -10
- package/src/engine/ecs/EntityManager.js +8 -1
- package/src/engine/ecs/EntityManager.spec.js +56 -6
- package/src/engine/ecs/animation/Animation.spec.js +22 -0
- package/src/engine/ecs/animation/AnimationSerializationAdapter.js +2 -5
- package/src/engine/ecs/attachment/Attachment.js +24 -25
- package/src/engine/ecs/attachment/AttachmentBinding.js +27 -30
- package/src/engine/ecs/attachment/AttachmentSystem.js +21 -24
- package/src/engine/ecs/attachment/BoneAttachmentBinding.js +6 -9
- package/src/engine/ecs/attachment/TransformAttachmentBinding.js +0 -3
- package/src/engine/ecs/components/CharacterController.js +24 -18
- package/src/engine/ecs/components/Motion.js +0 -27
- package/src/engine/ecs/components/MotionSerializationAdapter.js +26 -0
- package/src/engine/ecs/components/PropertySet.js +0 -29
- package/src/engine/ecs/components/PropertySetSerializationAdapter.js +29 -0
- package/src/engine/ecs/components/SerializationMetadata.js +0 -28
- package/src/engine/ecs/components/SerializationMetadataSerializationAdapter.js +26 -0
- package/src/engine/ecs/components/Steering.js +0 -35
- package/src/engine/ecs/components/SteeringSerializationAdapter.js +34 -0
- package/src/engine/ecs/components/Tag.js +6 -102
- package/src/engine/ecs/components/TagSerializationAdapter.js +44 -0
- package/src/engine/ecs/components/TagSerializationUpgrader_0_1.js +18 -0
- package/src/engine/ecs/components/Timer.js +1 -1
- package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +4 -3
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleCooldownDescription.js +10 -14
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescription.js +31 -39
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.js +1 -1
- package/src/engine/ecs/dynamic_actions/{DynamicRuleDescriptionTable.spec.js → rules/DynamicRuleDescriptionTable.spec.js} +12 -12
- package/src/engine/ecs/foliage/ecs/InstancedMeshSerializationAdapter.js +2 -5
- package/src/engine/ecs/fow/FogOfWarRevealer.js +2 -3
- package/src/engine/ecs/fow/serialization/FogOfWarRevealerSerializationAdapter.js +2 -5
- package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.js +5 -8
- package/src/engine/ecs/gui/GUIElementSerializationAdapter.js +2 -5
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySerializationAdapter.js +3 -6
- package/src/engine/ecs/gui/position/ViewportPosition.js +2 -5
- package/src/engine/ecs/ik/IKConstraint.js +95 -0
- package/src/engine/ecs/ik/IKMath.js +6 -1
- package/src/engine/ecs/ik/IKProblem.js +17 -17
- package/src/engine/ecs/ik/InverseKinematics.js +14 -174
- package/src/engine/ecs/ik/InverseKinematicsSerializationAdapter.js +72 -0
- package/src/engine/ecs/ik/InverseKinematicsSystem.js +24 -26
- package/src/engine/ecs/speaker/Voice.js +5 -8
- package/src/engine/ecs/speaker/VoiceSystem.js +15 -19
- package/src/engine/ecs/speaker/lines/LineDescription.js +20 -25
- package/src/engine/ecs/speaker/lines/sets/LineSetDescription.js +15 -19
- package/src/engine/ecs/storage/BinaryBufferSerializer.js +3 -3
- package/src/engine/ecs/storage/binary/BinaryClassSerializationAdapter.js +7 -0
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +1 -1
- package/src/engine/ecs/storage/binary/object/ObjectBasedClassSerializationAdapter.js +6 -9
- package/src/engine/ecs/systems/TagSystem.js +1 -6
- package/src/engine/ecs/team/TeamSerializationAdapter.js +2 -5
- package/src/engine/ecs/terrain/ecs/Terrain.spec.js +5 -0
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +23 -21
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationAdapter.js +2 -5
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +2 -2
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +2 -40
- package/src/engine/ecs/terrain/serialization/TerrainSerializationAdapter.js +7 -10
- package/src/engine/ecs/tooltip/TooltipComponent.spec.js +47 -0
- package/src/engine/ecs/tooltip/TooltipComponentSerializationAdapter.js +2 -5
- package/src/engine/ecs/transform/Transform.spec.js +52 -0
- package/src/engine/ecs/transform/TransformSerializationAdapter.js +2 -5
- package/src/engine/ecs/transform-attachment/TransformAttachment.js +18 -19
- package/src/engine/graphics/ecs/animation/AnimationController.js +20 -129
- package/src/engine/graphics/ecs/animation/AnimationControllerSerializationAdapter.js +27 -0
- package/src/engine/graphics/ecs/animation/AnimationRule.js +79 -0
- package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraphSerializationAdapter.js +9 -11
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionSerializationAdapter.js +3 -5
- package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.js +2 -6
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLander.js +3 -15
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.js +2 -4
- package/src/engine/graphics/ecs/highlight/HighlightSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.js +1 -1
- package/src/engine/graphics/ecs/light/LightSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/mesh/serialization/MeshSerializationAdapter.js +2 -5
- package/src/engine/graphics/ecs/mesh/skeleton/BoneMapping.js +2 -2
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +3 -0
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.spec.js +14 -0
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/InstancedRendererAdapter.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/SGCacheKey.js +21 -9
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/SGCacheKey.spec.js +79 -0
- package/src/engine/graphics/ecs/water/WaterSerializationAdapter.js +2 -5
- package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +1 -1
- package/src/engine/graphics/material/manager/MaterialManager.js +1 -1
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -1
- package/src/engine/graphics/particles/node-based/codegen/CodeContext.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +2 -5
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationAdapter.js +2 -5
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.js +1 -1
- package/src/engine/graphics/render/visibility/IncrementalDeltaSet.spec.js +7 -6
- package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.js +1 -1
- package/src/engine/graphics/texture/sampler/serialization/Sampler2DSerializationAdapter.js +2 -5
- package/src/engine/grid/grid2transform/GridPosition2Transform.js +11 -13
- package/src/engine/grid/grid2transform/GridPosition2TransformSerializationAdapter.js +3 -5
- package/src/engine/grid/obstacle/GridObstacleSerializationAdapter.js +2 -5
- package/src/engine/grid/position/GridPositionSerializationAdapter.js +2 -5
- package/src/engine/grid/transform2grid/Transform2GridPosition.js +10 -13
- package/src/engine/input/devices/KeyboardDevice.js +5 -2
- package/src/engine/input/devices/KeyboardDevice.spec.js +12 -0
- package/src/engine/input/devices/PointerDevice.js +5 -1
- package/src/engine/input/ecs/components/Input.js +37 -11
- package/src/engine/input/ecs/ism/InputBinding.js +30 -12
- package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.js +7 -10
- package/src/engine/intelligence/behavior/ecs/WaitForEventBehaviorSerializationAdapter.js +2 -5
- package/src/engine/intelligence/behavior/primitive/FailingBehaviorSerializationAdapter.js +2 -6
- package/src/engine/intelligence/behavior/primitive/SucceedingBehaviorSerializationAdapter.js +2 -5
- package/src/engine/intelligence/blackboard/BlackboardSerializationAdapter.js +2 -5
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.js +12 -13
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.spec.js +23 -0
- package/src/engine/navigation/ecs/components/PathSerializationAdapter.js +2 -5
- package/src/engine/navigation/ecs/path_following/PathFollowerSerializationAdapter.js +2 -5
- package/src/engine/navigation/grid/find_path_on_grid_astar.spec.js +25 -0
- package/src/engine/options/OptionAbstract.js +6 -5
- package/src/engine/options/OptionGroup.js +13 -25
- package/src/engine/options/OptionGroup.spec.js +61 -0
- package/src/engine/save/storage/InMemoryStorage.js +3 -2
- package/src/engine/simulation/Ticker.js +17 -20
- package/src/engine/sound/ecs/SoundController.js +2 -6
- package/src/engine/sound/ecs/SoundListener.js +3 -21
- package/src/engine/sound/ecs/emitter/SoundEmitterSerializationAdapter.js +2 -6
- package/src/generation/GridTaskGroup.js +5 -9
- package/src/generation/filtering/numeric/CellFilterCache.js +12 -16
- package/src/generation/filtering/numeric/complex/CellFilterFXAA.js +31 -32
- package/src/generation/filtering/numeric/complex/CellFilterLookupTable.js +6 -9
- package/src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js +7 -10
- package/src/generation/filtering/numeric/complex/CellFilterSobel.js +6 -9
- package/src/generation/filtering/numeric/math/CellFilterMembershipGeneralizedBell.js +18 -21
- package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.js +24 -25
- package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js +1 -1
- package/src/generation/grid/GridData.js +23 -22
- package/src/generation/grid/GridData.spec.js +41 -0
- package/src/generation/grid/GridTaskGenerator.js +7 -8
- package/src/generation/grid/layers/GridDataLayer.js +23 -25
- package/src/generation/markers/GridActionRuleSet.js +20 -22
- package/src/generation/markers/GridCellActionPlaceMarker.js +40 -43
- package/src/generation/markers/GridCellActionPlaceMarkerGroup.js +7 -9
- package/src/generation/markers/MarkerNode.js +44 -44
- package/src/generation/markers/actions/MarkerNodeActionEntityPlacement.js +15 -18
- package/src/generation/markers/actions/MarkerNodeActionSequence.js +6 -9
- package/src/generation/markers/actions/MarkerNodeProcessingRuleSet.js +5 -7
- package/src/generation/markers/actions/MarkerProcessingRule.js +25 -26
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorClingToTerrain.js +12 -15
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorRandomRotation.js +2 -5
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorSequence.js +6 -9
- package/src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.js +8 -11
- package/src/generation/markers/actions/probability/MarkerNodeActionWeightedElement.js +13 -13
- package/src/generation/markers/actions/util/GridCellActionDebugBreak.js +5 -8
- package/src/generation/markers/actions/util/GridCellActionLogToConsole.js +1 -4
- package/src/generation/markers/emitter/MarkerNodeConsumerBuffer.js +10 -13
- package/src/generation/markers/emitter/MarkerNodeEmitterFromAction.js +5 -9
- package/src/generation/markers/emitter/MarkerNodeEmitterGridCellAction.js +12 -15
- package/src/generation/markers/emitter/MarkerNodeEmitterGroup.js +5 -8
- package/src/generation/markers/emitter/MarkerNodeEmitterPredicated.js +18 -21
- package/src/generation/markers/matcher/MarkerNodeMatcher.js +2 -1
- package/src/generation/markers/matcher/MarkerNodeMatcherBinary.js +12 -13
- package/src/generation/markers/matcher/MarkerNodeMatcherContainsTag.js +7 -9
- package/src/generation/markers/matcher/MarkerNodeMatcherNot.js +7 -9
- package/src/generation/markers/predicate/GridDataNodePredicateBinary.js +10 -14
- package/src/generation/markers/predicate/GridDataNodePredicateNot.js +9 -11
- package/src/generation/markers/predicate/GridDataNodePredicateOverlaps.js +6 -9
- package/src/generation/markers/transform/MarkerNodeTransformRotateRandom.js +2 -6
- package/src/generation/markers/transform/MarkerNodeTransformerAddPositionYFromFilter.js +6 -9
- package/src/generation/markers/transform/MarkerNodeTransformerOffsetPosition.js +1 -4
- package/src/generation/markers/transform/MarkerNodeTransformerRecordProperty.js +12 -15
- package/src/generation/markers/transform/MarkerNodeTransformerRecordPropertyClosure.js +14 -17
- package/src/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +21 -23
- package/src/generation/markers/transform/MarkerNodeTransformerRemoveTag.js +1 -4
- package/src/generation/markers/transform/MarkerNodeTransformerSequence.js +6 -9
- package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilter.js +13 -17
- package/src/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.js +12 -16
- package/src/generation/placement/GridCellActionTransformNearbyMarkers.js +26 -29
- package/src/generation/placement/GridCellPlacementRule.js +30 -32
- package/src/generation/placement/action/GridCellActionPlaceTags.js +26 -28
- package/src/generation/placement/action/GridCellActionWriteFilterToLayer.js +16 -20
- package/src/generation/placement/action/random/weighted/CellActionSelectWeightedRandom.js +13 -16
- package/src/generation/placement/action/random/weighted/WeightedGridCellAction.js +11 -14
- package/src/generation/placement/action/util/CellMatcherWithinAABB.js +2 -6
- package/src/generation/placement/action/util/GridCellActionSequence.js +7 -9
- package/src/generation/placement/action/util/GridCellDisplacedAction.js +9 -12
- package/src/generation/rules/CellMatcherFromFilter.js +6 -9
- package/src/generation/rules/CellMatcherLayerBitMaskTest.js +6 -9
- package/src/generation/rules/GridLayerCellMatcher.js +11 -14
- package/src/generation/rules/cell/CellMatcherContainsMarkerWithinRadius.js +11 -14
- package/src/generation/rules/cell/CellMatcherGridPattern.js +6 -8
- package/src/generation/rules/cell/GridPatternMatcherCell.js +11 -12
- package/src/generation/rules/logic/CellMatcherBinary.js +10 -14
- package/src/generation/rules/logic/CellMatcherDecorator.js +5 -8
- package/src/generation/theme/AreaMask.js +15 -17
- package/src/generation/theme/AreaTheme.js +7 -8
- package/src/generation/theme/TerrainLayerDescription.js +10 -12
- package/src/generation/theme/TerrainLayerRule.js +11 -13
- package/src/generation/theme/TerrainTheme.js +6 -7
- package/src/generation/theme/Theme.js +15 -17
- package/src/generation/theme/ThemeEngine.js +17 -19
- package/src/view/string_tag_to_css_class_name.js +2 -2
- package/src/view/tooltip/gml/TooltipParser.js +2 -2
- package/src/core/cache/PersistentCacheAdapter.js +0 -378
- package/src/core/collection/LazyStream.js +0 -23
- package/src/core/collection/LazyStream.spec.js +0 -13
- package/src/core/collection/heap/BinaryHeap.js +0 -153
- package/src/core/primitives/strings/StringUtils.js +0 -105
- package/src/core/primitives/strings/StringUtils.spec.js +0 -42
- package/src/engine/ecs/components/GeometryBVH.js +0 -44
- package/src/engine/ecs/components/MonsterAI.js +0 -15
- package/src/engine/ecs/systems/GeometryBVHSystem.js +0 -36
- package/src/generation/markers/MarkerRelation.js +0 -13
- /package/src/core/collection/{HashMap.d.ts → map/HashMap.d.ts} +0 -0
- /package/src/core/collection/{HashSet.d.ts → set/HashSet.d.ts} +0 -0
|
@@ -2,6 +2,7 @@ import { EntityManager } from "./EntityManager.js";
|
|
|
2
2
|
import { System, SystemState } from "./System.js";
|
|
3
3
|
import { jest } from '@jest/globals';
|
|
4
4
|
import { IllegalStateException } from "../../core/fsm/exceptions/IllegalStateException.js";
|
|
5
|
+
import { EntityComponentDataset } from "./EntityComponentDataset.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
@@ -21,15 +22,11 @@ function makeEm(systems = []) {
|
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
class DummyComponent {
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
class DummySystem extends System {
|
|
28
|
-
|
|
29
|
-
super();
|
|
30
|
-
|
|
31
|
-
this.dependencies = [DummyComponent];
|
|
32
|
-
}
|
|
29
|
+
dependencies = [DummyComponent];
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
test("constructor doesn't throw", () => {
|
|
@@ -143,6 +140,19 @@ test("addSystem", async () => {
|
|
|
143
140
|
expect(() => em.addSystem(new DummySystem())).toThrow(IllegalStateException);
|
|
144
141
|
});
|
|
145
142
|
|
|
143
|
+
test("add system to running manager", async () => {
|
|
144
|
+
|
|
145
|
+
const em = new EntityManager();
|
|
146
|
+
|
|
147
|
+
await new Promise((resolve, reject) => em.startup(resolve, reject));
|
|
148
|
+
|
|
149
|
+
const system = new DummySystem();
|
|
150
|
+
|
|
151
|
+
await em.addSystem(system);
|
|
152
|
+
|
|
153
|
+
expect(em.hasSystem(DummySystem)).toBe(true);
|
|
154
|
+
});
|
|
155
|
+
|
|
146
156
|
test("removeSystem", async () => {
|
|
147
157
|
|
|
148
158
|
const system = new DummySystem();
|
|
@@ -158,3 +168,43 @@ test("removeSystem", async () => {
|
|
|
158
168
|
// Try again, this time we expect nothing to happen
|
|
159
169
|
expect(await em.removeSystem(system)).toEqual(false);
|
|
160
170
|
});
|
|
171
|
+
|
|
172
|
+
test("attempt to detach dataset when none is attached", () => {
|
|
173
|
+
const manager = new EntityManager();
|
|
174
|
+
|
|
175
|
+
expect(() => manager.detachDataSet()).not.toThrow();
|
|
176
|
+
|
|
177
|
+
// do it second time, in case something changes in the above call
|
|
178
|
+
expect(() => manager.detachDataSet()).not.toThrow();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test("getComponentTypeMap with 1 system", async () => {
|
|
182
|
+
|
|
183
|
+
const em = await makeEm([
|
|
184
|
+
new DummySystem()
|
|
185
|
+
]);
|
|
186
|
+
|
|
187
|
+
expect(em.getComponentTypeMap()).toEqual([DummyComponent]);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
test("attempting to attach another dataset before detaching previous one should throw", () => {
|
|
191
|
+
|
|
192
|
+
const em = new EntityManager();
|
|
193
|
+
|
|
194
|
+
em.attachDataSet(new EntityComponentDataset());
|
|
195
|
+
|
|
196
|
+
expect(() => em.attachDataSet(new EntityComponentDataset())).toThrow();
|
|
197
|
+
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
test("attaching same dataset should succeed", () => {
|
|
201
|
+
|
|
202
|
+
const em = new EntityManager();
|
|
203
|
+
|
|
204
|
+
const ecd = new EntityComponentDataset();
|
|
205
|
+
em.attachDataSet(ecd);
|
|
206
|
+
|
|
207
|
+
em.attachDataSet(ecd); // second time
|
|
208
|
+
|
|
209
|
+
expect(em.dataset).toBe(ecd);
|
|
210
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Animation } from "./Animation.js";
|
|
2
|
+
import { AnimationClip } from "./AnimationClip.js";
|
|
3
|
+
|
|
4
|
+
test("constructor does not throw", () => {
|
|
5
|
+
new Animation()
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
test("equality", () => {
|
|
9
|
+
|
|
10
|
+
const a = new Animation();
|
|
11
|
+
const b = new Animation();
|
|
12
|
+
|
|
13
|
+
expect(a.equals(b)).toBe(true);
|
|
14
|
+
|
|
15
|
+
a.clips.add(new AnimationClip());
|
|
16
|
+
|
|
17
|
+
expect(a.equals(b)).toBe(false);
|
|
18
|
+
|
|
19
|
+
b.clips.add(new AnimationClip());
|
|
20
|
+
|
|
21
|
+
expect(a.equals(b)).toBe(true);
|
|
22
|
+
});
|
|
@@ -3,12 +3,9 @@ import { AnimationClip } from "./AnimationClip.js";
|
|
|
3
3
|
import { Animation } from "./Animation.js";
|
|
4
4
|
|
|
5
5
|
export class AnimationSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
7
|
+
klass = Animation;
|
|
8
|
+
version = 0;
|
|
12
9
|
|
|
13
10
|
/**
|
|
14
11
|
*
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import { Transform } from "../transform/Transform.js";
|
|
2
2
|
|
|
3
3
|
export class Attachment {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Parent entity to which attachment is made
|
|
7
|
+
* @type {number}
|
|
8
|
+
*/
|
|
9
|
+
parent = -1;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Socket on the parent entity to which attachment is made
|
|
13
|
+
* @type {String}
|
|
14
|
+
*/
|
|
15
|
+
socket = null;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @type {Transform}
|
|
20
|
+
*/
|
|
21
|
+
transform = new Transform();
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @type {boolean}
|
|
26
|
+
*/
|
|
27
|
+
immediate = false;
|
|
29
28
|
|
|
30
29
|
fromJSON({ parent, socket, transform, immediate = false }) {
|
|
31
30
|
this.parent = parent;
|
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
export class AttachmentBinding {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*/
|
|
30
|
-
this.attachment = null;
|
|
31
|
-
}
|
|
2
|
+
attachedEntity = -1;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @type {Transform}
|
|
7
|
+
*/
|
|
8
|
+
attachedTransform = null;
|
|
9
|
+
|
|
10
|
+
parentEntity = -1;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @type {Transform}
|
|
15
|
+
*/
|
|
16
|
+
parentTransform = null;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {AttachmentSocket}
|
|
21
|
+
*/
|
|
22
|
+
socket = null;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {Attachment}
|
|
27
|
+
*/
|
|
28
|
+
attachment = null;
|
|
32
29
|
|
|
33
30
|
link() {
|
|
34
31
|
|
|
@@ -10,35 +10,32 @@ import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessS
|
|
|
10
10
|
import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
|
|
11
11
|
|
|
12
12
|
export class AttachmentSystem extends System {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
dependencies = [Attachment, Transform];
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
components_used = [
|
|
17
|
+
ResourceAccessSpecification.from(AttachmentSockets, ResourceAccessKind.Read),
|
|
18
|
+
ResourceAccessSpecification.from(Mesh, ResourceAccessKind.Read),
|
|
19
|
+
ResourceAccessSpecification.from(Transform, ResourceAccessKind.Write)
|
|
20
|
+
];
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {number[]}
|
|
25
|
+
*/
|
|
26
|
+
waiting = [];
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @type {Map<number,AttachmentBinding>}
|
|
31
|
+
*/
|
|
32
|
+
bindings = new Map();
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @type {Map<number, AttachmentBinding[]>}
|
|
37
|
+
*/
|
|
38
|
+
parentBindingIndex = new Map();
|
|
42
39
|
|
|
43
40
|
|
|
44
41
|
/**
|
|
@@ -12,15 +12,12 @@ const pPosition = new Vector3();
|
|
|
12
12
|
const attachmentM4 = new Matrix4();
|
|
13
13
|
|
|
14
14
|
export class BoneAttachmentBinding extends AttachmentBinding {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
this.bone = null;
|
|
23
|
-
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @type {Bone}
|
|
19
|
+
*/
|
|
20
|
+
bone = null;
|
|
24
21
|
|
|
25
22
|
update() {
|
|
26
23
|
const socketTransform = this.socket.transform;
|
|
@@ -6,9 +6,6 @@ const scratch_m4_1 = new Float32Array(16);
|
|
|
6
6
|
const scratch_m4_2 = new Float32Array(16);
|
|
7
7
|
|
|
8
8
|
export class TransformAttachmentBinding extends AttachmentBinding {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
}
|
|
12
9
|
|
|
13
10
|
/**
|
|
14
11
|
* TODO make use of Transform.multiplyTransforms for better readability and performance
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* FPS-style character controller
|
|
3
|
+
* @author Alex Goldring
|
|
4
|
+
* @copyright Alex Goldring 7/4/2014
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.onSolidSurface = false;
|
|
11
|
-
this.lockedTimeout = 0;
|
|
6
|
+
class CharacterController {
|
|
7
|
+
height = 4;
|
|
8
|
+
onSolidSurface = false;
|
|
9
|
+
lockedTimeout = 0;
|
|
12
10
|
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
forward = false;
|
|
12
|
+
back = false;
|
|
13
|
+
left = false;
|
|
14
|
+
right = false;
|
|
15
|
+
sprinting = false;
|
|
16
|
+
attacking = false;
|
|
17
|
+
aim = null;
|
|
20
18
|
//
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
movementSpeed = 1;
|
|
20
|
+
sprintingMultiplier = 1;
|
|
21
|
+
|
|
22
|
+
constructor({
|
|
23
|
+
movementSpeed = 1,
|
|
24
|
+
sprintingMultiplier = 1.2
|
|
25
|
+
} = {}) {
|
|
26
|
+
this.movementSpeed = movementSpeed;
|
|
27
|
+
this.sprintingMultiplier = sprintingMultiplier;
|
|
28
|
+
}
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
export default CharacterController;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Time: 20:41
|
|
5
5
|
*/
|
|
6
6
|
import Vector3 from '../../../core/geom/Vector3.js';
|
|
7
|
-
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class Motion {
|
|
@@ -33,29 +32,3 @@ Motion.typeName = "Motion";
|
|
|
33
32
|
export default Motion;
|
|
34
33
|
|
|
35
34
|
|
|
36
|
-
export class MotionSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
37
|
-
constructor() {
|
|
38
|
-
super();
|
|
39
|
-
|
|
40
|
-
this.klass = Motion;
|
|
41
|
-
this.version = 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* @param {BinaryBuffer} buffer
|
|
47
|
-
* @param {Motion} value
|
|
48
|
-
*/
|
|
49
|
-
serialize(buffer, value) {
|
|
50
|
-
value.velocity.toBinaryBufferFloat32(buffer);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
* @param {BinaryBuffer} buffer
|
|
56
|
-
* @param {Motion} value
|
|
57
|
-
*/
|
|
58
|
-
deserialize(buffer, value) {
|
|
59
|
-
value.velocity.fromBinaryBufferFloat32(buffer);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import Motion from "./Motion.js";
|
|
3
|
+
|
|
4
|
+
export class MotionSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
+
|
|
6
|
+
klass = Motion;
|
|
7
|
+
version = 0;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {BinaryBuffer} buffer
|
|
12
|
+
* @param {Motion} value
|
|
13
|
+
*/
|
|
14
|
+
serialize(buffer, value) {
|
|
15
|
+
value.velocity.toBinaryBufferFloat32(buffer);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {BinaryBuffer} buffer
|
|
21
|
+
* @param {Motion} value
|
|
22
|
+
*/
|
|
23
|
+
deserialize(buffer, value) {
|
|
24
|
+
value.velocity.fromBinaryBufferFloat32(buffer);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
import { resolvePath } from "../../../core/json/resolvePath.js";
|
|
7
|
-
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
8
7
|
|
|
9
8
|
function PropertySet(options) {
|
|
10
9
|
this.data = {};
|
|
@@ -110,31 +109,3 @@ PropertySet.prototype.fromBinaryBuffer = function (buffer) {
|
|
|
110
109
|
|
|
111
110
|
export default PropertySet;
|
|
112
111
|
|
|
113
|
-
export class PropertySetSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
114
|
-
constructor() {
|
|
115
|
-
super();
|
|
116
|
-
|
|
117
|
-
this.klass = PropertySet;
|
|
118
|
-
this.version = 0;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
*
|
|
123
|
-
* @param {BinaryBuffer} buffer
|
|
124
|
-
* @param {PropertySet} value
|
|
125
|
-
*/
|
|
126
|
-
serialize(buffer, value) {
|
|
127
|
-
buffer.writeUTF8String(JSON.stringify(value.data));
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
*
|
|
132
|
-
* @param {BinaryBuffer} buffer
|
|
133
|
-
* @param {PropertySet} value
|
|
134
|
-
*/
|
|
135
|
-
deserialize(buffer, value) {
|
|
136
|
-
const string = buffer.readUTF8String();
|
|
137
|
-
|
|
138
|
-
value.data = JSON.parse(string);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import PropertySet from "./PropertySet.js";
|
|
3
|
+
|
|
4
|
+
export class PropertySetSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
klass = PropertySet;
|
|
8
|
+
version = 0;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {BinaryBuffer} buffer
|
|
13
|
+
* @param {PropertySet} value
|
|
14
|
+
*/
|
|
15
|
+
serialize(buffer, value) {
|
|
16
|
+
buffer.writeUTF8String(JSON.stringify(value.data));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {BinaryBuffer} buffer
|
|
22
|
+
* @param {PropertySet} value
|
|
23
|
+
*/
|
|
24
|
+
deserialize(buffer, value) {
|
|
25
|
+
const string = buffer.readUTF8String();
|
|
26
|
+
|
|
27
|
+
value.data = JSON.parse(string);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
-
|
|
3
1
|
export const SerializationFlags = {
|
|
4
2
|
Transient: 1
|
|
5
3
|
};
|
|
@@ -69,29 +67,3 @@ SerializationMetadata.Transient = Object.freeze(transient);
|
|
|
69
67
|
SerializationMetadata.typeName = "SerializationMetadata";
|
|
70
68
|
|
|
71
69
|
|
|
72
|
-
export class SerializationMetadataSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
73
|
-
constructor() {
|
|
74
|
-
super();
|
|
75
|
-
|
|
76
|
-
this.klass = SerializationMetadata;
|
|
77
|
-
this.version = 0;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
*
|
|
82
|
-
* @param {BinaryBuffer} buffer
|
|
83
|
-
* @param {SerializationMetadata} value
|
|
84
|
-
*/
|
|
85
|
-
serialize(buffer, value) {
|
|
86
|
-
buffer.writeUint8(value.flags);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
* @param {BinaryBuffer} buffer
|
|
92
|
-
* @param {SerializationMetadata} value
|
|
93
|
-
*/
|
|
94
|
-
deserialize(buffer, value) {
|
|
95
|
-
value.flags = buffer.readUint8();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import { SerializationMetadata } from "./SerializationMetadata.js";
|
|
3
|
+
|
|
4
|
+
export class SerializationMetadataSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
+
|
|
6
|
+
klass = SerializationMetadata;
|
|
7
|
+
version = 0;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {BinaryBuffer} buffer
|
|
12
|
+
* @param {SerializationMetadata} value
|
|
13
|
+
*/
|
|
14
|
+
serialize(buffer, value) {
|
|
15
|
+
buffer.writeUint8(value.flags);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {BinaryBuffer} buffer
|
|
21
|
+
* @param {SerializationMetadata} value
|
|
22
|
+
*/
|
|
23
|
+
deserialize(buffer, value) {
|
|
24
|
+
value.flags = buffer.readUint8();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
import Vector3 from '../../../core/geom/Vector3.js';
|
|
9
|
-
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* @readonly
|
|
@@ -110,37 +109,3 @@ Steering.typeName = "Steering";
|
|
|
110
109
|
|
|
111
110
|
export default Steering;
|
|
112
111
|
|
|
113
|
-
export class SteeringSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
114
|
-
constructor() {
|
|
115
|
-
super();
|
|
116
|
-
|
|
117
|
-
this.klass = Steering;
|
|
118
|
-
this.version = 0;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
*
|
|
123
|
-
* @param {BinaryBuffer} buffer
|
|
124
|
-
* @param {Steering} value
|
|
125
|
-
*/
|
|
126
|
-
serialize(buffer, value) {
|
|
127
|
-
buffer.writeFloat32(value.maxSpeed);
|
|
128
|
-
buffer.writeFloat32(value.rotationSpeed);
|
|
129
|
-
|
|
130
|
-
value.destination.toBinaryBufferFloat32(buffer);
|
|
131
|
-
value.targetMargin.toBinaryBufferFloat32_EqualityEncoded(buffer);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
* @param {BinaryBuffer} buffer
|
|
137
|
-
* @param {Steering} value
|
|
138
|
-
*/
|
|
139
|
-
deserialize(buffer, value) {
|
|
140
|
-
value.maxSpeed = buffer.readFloat32();
|
|
141
|
-
value.rotationSpeed = buffer.readFloat32();
|
|
142
|
-
|
|
143
|
-
value.destination.fromBinaryBufferFloat32(buffer);
|
|
144
|
-
value.targetMargin.fromBinaryBufferFloat32_EqualityEncoded(buffer);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import Steering from "./Steering.js";
|
|
3
|
+
|
|
4
|
+
export class SteeringSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
+
|
|
6
|
+
klass = Steering;
|
|
7
|
+
version = 0;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {BinaryBuffer} buffer
|
|
12
|
+
* @param {Steering} value
|
|
13
|
+
*/
|
|
14
|
+
serialize(buffer, value) {
|
|
15
|
+
buffer.writeFloat32(value.maxSpeed);
|
|
16
|
+
buffer.writeFloat32(value.rotationSpeed);
|
|
17
|
+
|
|
18
|
+
value.destination.toBinaryBufferFloat32(buffer);
|
|
19
|
+
value.targetMargin.toBinaryBufferFloat32_EqualityEncoded(buffer);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {BinaryBuffer} buffer
|
|
25
|
+
* @param {Steering} value
|
|
26
|
+
*/
|
|
27
|
+
deserialize(buffer, value) {
|
|
28
|
+
value.maxSpeed = buffer.readFloat32();
|
|
29
|
+
value.rotationSpeed = buffer.readFloat32();
|
|
30
|
+
|
|
31
|
+
value.destination.fromBinaryBufferFloat32(buffer);
|
|
32
|
+
value.targetMargin.fromBinaryBufferFloat32_EqualityEncoded(buffer);
|
|
33
|
+
}
|
|
34
|
+
}
|