@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
|
@@ -3,32 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
7
|
-
import { BinaryClassUpgrader } from "../storage/binary/BinaryClassUpgrader.js";
|
|
8
6
|
import { computeStringHash } from "../../../core/primitives/strings/computeStringHash.js";
|
|
9
7
|
import { assert } from "../../../core/assert.js";
|
|
10
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Stores textual tags, useful for marking entities
|
|
11
|
+
*/
|
|
11
12
|
export class Tag {
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @
|
|
15
|
-
* @constructor
|
|
14
|
+
* @private
|
|
15
|
+
* @type {String[]}
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @private
|
|
21
|
-
* @type {String[]}
|
|
22
|
-
*/
|
|
23
|
-
this.values = [];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (name !== undefined) {
|
|
27
|
-
this.add(name);
|
|
28
|
-
|
|
29
|
-
console.warn('constructor arguments are deprecated');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
17
|
+
values = [];
|
|
32
18
|
|
|
33
19
|
/**
|
|
34
20
|
*
|
|
@@ -49,27 +35,6 @@ export class Tag {
|
|
|
49
35
|
return this.values[i];
|
|
50
36
|
}
|
|
51
37
|
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* @param {String} v
|
|
55
|
-
*/
|
|
56
|
-
set name(v) {
|
|
57
|
-
console.warn('name property is deprecated');
|
|
58
|
-
|
|
59
|
-
this.clear();
|
|
60
|
-
this.add(v);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
* @returns {String}
|
|
66
|
-
*/
|
|
67
|
-
get name() {
|
|
68
|
-
console.warn('name property is deprecated');
|
|
69
|
-
|
|
70
|
-
return this.getFirst();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
38
|
clear() {
|
|
74
39
|
this.values.splice(0, this.values.length);
|
|
75
40
|
}
|
|
@@ -327,65 +292,4 @@ Tag.typeName = "Tag";
|
|
|
327
292
|
|
|
328
293
|
export default Tag;
|
|
329
294
|
|
|
330
|
-
export class TagSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
331
|
-
constructor() {
|
|
332
|
-
super();
|
|
333
|
-
|
|
334
|
-
this.klass = Tag;
|
|
335
|
-
this.version = 1;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
*
|
|
340
|
-
* @param {BinaryBuffer} buffer
|
|
341
|
-
* @param {Tag} value
|
|
342
|
-
*/
|
|
343
|
-
serialize(buffer, value) {
|
|
344
|
-
const values = value.getValues();
|
|
345
|
-
|
|
346
|
-
const n = values.length;
|
|
347
|
-
|
|
348
|
-
buffer.writeUintVar(n);
|
|
349
|
-
|
|
350
|
-
for (let i = 0; i < n; i++) {
|
|
351
|
-
const v = values[i];
|
|
352
|
-
|
|
353
|
-
buffer.writeUTF8String(v);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
*
|
|
359
|
-
* @param {BinaryBuffer} buffer
|
|
360
|
-
* @param {Tag} value
|
|
361
|
-
*/
|
|
362
|
-
deserialize(buffer, value) {
|
|
363
|
-
value.clear();
|
|
364
|
-
|
|
365
|
-
const tagCount = buffer.readUintVar();
|
|
366
|
-
|
|
367
|
-
for (let i = 0; i < tagCount; i++) {
|
|
368
|
-
const v = buffer.readUTF8String();
|
|
369
|
-
|
|
370
|
-
value.add(v);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
export class TagSerializationUpgrader_0_1 extends BinaryClassUpgrader {
|
|
377
|
-
constructor() {
|
|
378
|
-
super();
|
|
379
|
-
|
|
380
|
-
this.__startVersion = 0;
|
|
381
|
-
this.__targetVersion = 1;
|
|
382
|
-
}
|
|
383
295
|
|
|
384
|
-
upgrade(source, target) {
|
|
385
|
-
const tag = source.readUTF8String();
|
|
386
|
-
|
|
387
|
-
//write tag count
|
|
388
|
-
target.writeUintVar(1);
|
|
389
|
-
target.writeUTF8String(tag);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import Tag from "./Tag.js";
|
|
3
|
+
|
|
4
|
+
export class TagSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
+
|
|
6
|
+
klass = Tag;
|
|
7
|
+
version = 1;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {BinaryBuffer} buffer
|
|
12
|
+
* @param {Tag} value
|
|
13
|
+
*/
|
|
14
|
+
serialize(buffer, value) {
|
|
15
|
+
const values = value.getValues();
|
|
16
|
+
|
|
17
|
+
const n = values.length;
|
|
18
|
+
|
|
19
|
+
buffer.writeUintVar(n);
|
|
20
|
+
|
|
21
|
+
for (let i = 0; i < n; i++) {
|
|
22
|
+
const v = values[i];
|
|
23
|
+
|
|
24
|
+
buffer.writeUTF8String(v);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {BinaryBuffer} buffer
|
|
31
|
+
* @param {Tag} value
|
|
32
|
+
*/
|
|
33
|
+
deserialize(buffer, value) {
|
|
34
|
+
value.clear();
|
|
35
|
+
|
|
36
|
+
const tagCount = buffer.readUintVar();
|
|
37
|
+
|
|
38
|
+
for (let i = 0; i < tagCount; i++) {
|
|
39
|
+
const v = buffer.readUTF8String();
|
|
40
|
+
|
|
41
|
+
value.add(v);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BinaryClassUpgrader } from "../storage/binary/BinaryClassUpgrader.js";
|
|
2
|
+
|
|
3
|
+
export class TagSerializationUpgrader_0_1 extends BinaryClassUpgrader {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
|
|
7
|
+
this.__startVersion = 0;
|
|
8
|
+
this.__targetVersion = 1;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
upgrade(source, target) {
|
|
12
|
+
const tag = source.readUTF8String();
|
|
13
|
+
|
|
14
|
+
//write tag count
|
|
15
|
+
target.writeUintVar(1);
|
|
16
|
+
target.writeUTF8String(tag);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -3,7 +3,7 @@ import { AbstractContextSystem } from "../system/AbstractContextSystem.js";
|
|
|
3
3
|
import { SystemEntityContext } from "../system/SystemEntityContext.js";
|
|
4
4
|
import { DataScope } from "../../../../../model/game/unit/actions/data/DataScope.js";
|
|
5
5
|
import { Blackboard } from "../../intelligence/blackboard/Blackboard.js";
|
|
6
|
-
import {
|
|
6
|
+
import { returnTrue } from "../../../core/function/Functions.js";
|
|
7
7
|
import { EntityProxyScope } from "../binding/EntityProxyScope.js";
|
|
8
8
|
import EntityBuilder from "../EntityBuilder.js";
|
|
9
9
|
import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
@@ -12,7 +12,7 @@ import { DieBehavior } from "../../intelligence/behavior/ecs/DieBehavior.js";
|
|
|
12
12
|
import { SerializationMetadata } from "../components/SerializationMetadata.js";
|
|
13
13
|
import Tag from "../components/Tag.js";
|
|
14
14
|
import { OverrideContextBehavior } from "../../../../../model/game/util/behavior/OverrideContextBehavior.js";
|
|
15
|
-
import { HashMap } from "../../../core/collection/HashMap.js";
|
|
15
|
+
import { HashMap } from "../../../core/collection/map/HashMap.js";
|
|
16
16
|
import { assert } from "../../../core/assert.js";
|
|
17
17
|
import { RuleExecution } from "./RuleExecution.js";
|
|
18
18
|
import { computeContextualDynamicRuleDebugString } from "./rules/computeContextualDynamicRuleDebugString.js";
|
|
@@ -23,6 +23,7 @@ import { randomMultipleFromArray } from "../../../core/collection/array/randomMu
|
|
|
23
23
|
import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
|
|
24
24
|
import { ResourceAccessKind } from "../../../core/model/ResourceAccessKind.js";
|
|
25
25
|
import { EntityBuilderFlags } from "../EntityBuilderFlags.js";
|
|
26
|
+
import { number_compare_descending } from "../../../core/primitives/numbers/number_compare_descending.js";
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* In seconds
|
|
@@ -503,7 +504,7 @@ export class DynamicActorSystem extends AbstractContextSystem {
|
|
|
503
504
|
|
|
504
505
|
}
|
|
505
506
|
|
|
506
|
-
scores.sort(
|
|
507
|
+
scores.sort(number_compare_descending);
|
|
507
508
|
|
|
508
509
|
for (let i = 0; i < scores.length && result.length < count; i++) {
|
|
509
510
|
const score = scores[i];
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { NumericInterval } from "../../../../core/math/interval/NumericInterval.js";
|
|
2
2
|
|
|
3
3
|
export class DynamicRuleCooldownDescription {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* @type {NumericInterval}
|
|
15
|
-
*/
|
|
16
|
-
this.value = new NumericInterval(0, 0);
|
|
17
|
-
}
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @type {string}
|
|
7
|
+
*/
|
|
8
|
+
id = "";
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @type {NumericInterval}
|
|
12
|
+
*/
|
|
13
|
+
value= new NumericInterval(0, 0);
|
|
18
14
|
|
|
19
15
|
fromJSON({ id, value }) {
|
|
20
16
|
|
|
@@ -7,45 +7,37 @@ import { deserializeActionFromJSON } from "../actions/definition/deserializeActi
|
|
|
7
7
|
import { DynamicRuleCooldownDescription } from "./DynamicRuleCooldownDescription.js";
|
|
8
8
|
|
|
9
9
|
export class DynamicRuleDescription {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.predicate_complexity = 0;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Specified which global cooldowns will be triggered and for how long
|
|
45
|
-
* @type {DynamicRuleCooldownDescription[]}
|
|
46
|
-
*/
|
|
47
|
-
this.cooldowns_global = [];
|
|
48
|
-
}
|
|
10
|
+
id = 0;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @type {ReactiveExpression}
|
|
14
|
+
*/
|
|
15
|
+
condition = null;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @type {AbstractActionDescription}
|
|
19
|
+
*/
|
|
20
|
+
action = null;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @type {ReactiveReference[]}
|
|
24
|
+
*/
|
|
25
|
+
references = [];
|
|
26
|
+
/**
|
|
27
|
+
* Rules with higher priority have the right to interrupt lower priority rules
|
|
28
|
+
* @type {number}
|
|
29
|
+
*/
|
|
30
|
+
priority = 0;
|
|
31
|
+
/**
|
|
32
|
+
* @private
|
|
33
|
+
* @type {number}
|
|
34
|
+
*/
|
|
35
|
+
predicate_complexity = 0;
|
|
36
|
+
/**
|
|
37
|
+
* Specified which global cooldowns will be triggered and for how long
|
|
38
|
+
* @type {DynamicRuleCooldownDescription[]}
|
|
39
|
+
*/
|
|
40
|
+
cooldowns_global = [];
|
|
49
41
|
|
|
50
42
|
/**
|
|
51
43
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StaticKnowledgeDataTable } from "../../../knowledge/database/StaticKnowledgeDataTable.js";
|
|
2
2
|
import { DynamicRuleDescription } from "./DynamicRuleDescription.js";
|
|
3
3
|
import { MultiPredicateEvaluator } from "../../../../core/model/reactive/evaluation/MultiPredicateEvaluator.js";
|
|
4
|
-
import { HashMap } from "../../../../core/collection/HashMap.js";
|
|
4
|
+
import { HashMap } from "../../../../core/collection/map/HashMap.js";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
export class DynamicRuleDescriptionTable extends StaticKnowledgeDataTable {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { seededRandom } from "
|
|
2
|
-
import { DynamicRuleDescriptionTable } from "./
|
|
1
|
+
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
2
|
+
import { DynamicRuleDescriptionTable } from "./DynamicRuleDescriptionTable.js";
|
|
3
3
|
import {
|
|
4
4
|
createRandomReactiveExpression
|
|
5
|
-
} from "
|
|
6
|
-
import { ReactiveReference } from "
|
|
7
|
-
import { ReactiveLiteralNumber } from "
|
|
8
|
-
import { ReactiveLiteralString } from "
|
|
9
|
-
import { ReactiveLiteralBoolean } from "
|
|
10
|
-
import { DynamicRuleDescription } from "./
|
|
11
|
-
import DataType from "
|
|
12
|
-
import { randomFromArray } from "
|
|
13
|
-
import { randomFloatBetween } from "
|
|
14
|
-
import { randomIntegerBetween } from "
|
|
5
|
+
} from "../../../../core/model/reactive/model/util/createRandomReactiveExpression.js";
|
|
6
|
+
import { ReactiveReference } from "../../../../core/model/reactive/model/terminal/ReactiveReference.js";
|
|
7
|
+
import { ReactiveLiteralNumber } from "../../../../core/model/reactive/model/terminal/ReactiveLiteralNumber.js";
|
|
8
|
+
import { ReactiveLiteralString } from "../../../../core/model/reactive/model/terminal/ReactiveLiteralString.js";
|
|
9
|
+
import { ReactiveLiteralBoolean } from "../../../../core/model/reactive/model/terminal/ReactiveLiteralBoolean.js";
|
|
10
|
+
import { DynamicRuleDescription } from "./DynamicRuleDescription.js";
|
|
11
|
+
import DataType from "../../../../core/parser/simple/DataType.js";
|
|
12
|
+
import { randomFromArray } from "../../../../core/math/random/randomFromArray.js";
|
|
13
|
+
import { randomFloatBetween } from "../../../../core/math/random/randomFloatBetween.js";
|
|
14
|
+
import { randomIntegerBetween } from "../../../../core/math/random/randomIntegerBetween.js";
|
|
15
15
|
|
|
16
16
|
describe.skip('performance', () => {
|
|
17
17
|
|
|
@@ -3,12 +3,9 @@ import { InstancedMeshComponent } from "./InstancedMeshComponent.js";
|
|
|
3
3
|
import { InstancedMeshLayer } from "./InstancedMeshLayer.js";
|
|
4
4
|
|
|
5
5
|
export class InstancedMeshSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
7
|
+
klass = InstancedMeshComponent;
|
|
8
|
+
version = 0;
|
|
12
9
|
|
|
13
10
|
/**
|
|
14
11
|
*
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../storage/binary/BinaryClas
|
|
|
2
2
|
import { FogOfWarRevealer } from "../FogOfWarRevealer.js";
|
|
3
3
|
|
|
4
4
|
export class FogOfWarRevealerSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = FogOfWarRevealer;
|
|
7
|
+
version = 0;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -7,14 +7,11 @@ import {
|
|
|
7
7
|
} from "../../../graphics/texture/sampler/serialization/Sampler2DSerializationAdapter.js";
|
|
8
8
|
|
|
9
9
|
export class FogOfWarSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
klass = FogOfWar;
|
|
12
|
+
version = 1;
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
}
|
|
14
|
+
__sampler_serializer = new Sampler2DSerializationAdapter();
|
|
18
15
|
|
|
19
16
|
/**
|
|
20
17
|
*
|
|
@@ -40,7 +37,7 @@ export class FogOfWarSerializationAdapter extends BinaryClassSerializationAdapte
|
|
|
40
37
|
|
|
41
38
|
buffer.writeUint32(color);
|
|
42
39
|
|
|
43
|
-
this.__sampler_serializer.serialize(buffer,value.sampler);
|
|
40
|
+
this.__sampler_serializer.serialize(buffer, value.sampler);
|
|
44
41
|
|
|
45
42
|
//serialize reveal state
|
|
46
43
|
serializeRowFirstTable(buffer, value.fadeMask);
|
|
@@ -73,7 +70,7 @@ export class FogOfWarSerializationAdapter extends BinaryClassSerializationAdapte
|
|
|
73
70
|
color_a / 255
|
|
74
71
|
);
|
|
75
72
|
|
|
76
|
-
this.__sampler_serializer.deserialize(buffer,value.sampler);
|
|
73
|
+
this.__sampler_serializer.deserialize(buffer, value.sampler);
|
|
77
74
|
|
|
78
75
|
//deserialize reveal state
|
|
79
76
|
deserializeRowFirstTable(buffer, value.fadeMask);
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../storage/binary/BinaryClassSe
|
|
|
2
2
|
import GUIElement, { GUIElementFlag } from "./GUIElement.js";
|
|
3
3
|
|
|
4
4
|
export class GUIElementSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = GUIElement;
|
|
7
|
+
version = 0;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -2,12 +2,9 @@ import { BinaryClassSerializationAdapter } from "../../storage/binary/BinaryClas
|
|
|
2
2
|
import HeadsUpDisplay from "./HeadsUpDisplay.js";
|
|
3
3
|
|
|
4
4
|
export class HeadsUpDisplaySerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
6
|
+
klass = HeadsUpDisplay;
|
|
7
|
+
version = 0;
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
*
|
|
@@ -16,7 +13,7 @@ export class HeadsUpDisplaySerializationAdapter extends BinaryClassSerialization
|
|
|
16
13
|
*/
|
|
17
14
|
serialize(buffer, value) {
|
|
18
15
|
value.worldOffset.toBinaryBuffer(buffer);
|
|
19
|
-
buffer.writeUint8(value.flags
|
|
16
|
+
buffer.writeUint8(value.flags);
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
/**
|
|
@@ -151,12 +151,9 @@ ViewportPosition.serializable = true;
|
|
|
151
151
|
export default ViewportPosition;
|
|
152
152
|
|
|
153
153
|
export class ViewportPositionSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
154
|
-
constructor() {
|
|
155
|
-
super();
|
|
156
154
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
155
|
+
version = 0;
|
|
156
|
+
klass = ViewportPosition;
|
|
160
157
|
|
|
161
158
|
/**
|
|
162
159
|
*
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { NumericInterval } from "../../../core/math/interval/NumericInterval.js";
|
|
2
|
+
import { computeHashIntegerArray } from "../../../core/collection/array/computeHashIntegerArray.js";
|
|
3
|
+
import { computeStringHash } from "../../../core/primitives/strings/computeStringHash.js";
|
|
4
|
+
import { computeHashFloat } from "../../../core/primitives/numbers/computeHashFloat.js";
|
|
5
|
+
|
|
6
|
+
export class IKConstraint {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* End bone that is going to be placed
|
|
10
|
+
* @type {String}
|
|
11
|
+
*/
|
|
12
|
+
effector = "";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* How far should effector be from the contact, positive values result in effector not reaching the surface, and negative result in penetration
|
|
16
|
+
* @example For a foot effector this would be distance above the ground
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
offset = 0;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Positive distance from the surface at which IK starts to take effect, low value represents full effect and high value represents where the influence begins
|
|
23
|
+
* @type {NumericInterval}
|
|
24
|
+
*/
|
|
25
|
+
distance = new NumericInterval(0, 0);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @type {number}
|
|
30
|
+
*/
|
|
31
|
+
strength = 1;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @type {number}
|
|
36
|
+
*/
|
|
37
|
+
limit = Math.PI;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Solver to be used for this constraint
|
|
41
|
+
* @type {string}
|
|
42
|
+
*/
|
|
43
|
+
solver = "2BIK";
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param {IKConstraint} other
|
|
49
|
+
*/
|
|
50
|
+
copy(other) {
|
|
51
|
+
this.effector = other.effector;
|
|
52
|
+
this.offset = other.offset;
|
|
53
|
+
this.distance.copy(other.distance);
|
|
54
|
+
this.strength = other.strength;
|
|
55
|
+
this.limit = other.limit;
|
|
56
|
+
this.solver = other.solver;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
clone() {
|
|
60
|
+
const r = new IKConstraint();
|
|
61
|
+
|
|
62
|
+
r.copy(this);
|
|
63
|
+
|
|
64
|
+
return r;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param {IKConstraint} other
|
|
70
|
+
* @returns {boolean}
|
|
71
|
+
*/
|
|
72
|
+
equals(other) {
|
|
73
|
+
return this.effector === other.effector
|
|
74
|
+
&& this.offset === other.offset
|
|
75
|
+
&& this.distance.equals(other.distance)
|
|
76
|
+
&& this.strength === other.strength
|
|
77
|
+
&& this.limit === other.limit
|
|
78
|
+
&& this.solver === other.solver;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @return {number}
|
|
84
|
+
*/
|
|
85
|
+
hash() {
|
|
86
|
+
return computeHashIntegerArray(
|
|
87
|
+
computeStringHash(this.effector),
|
|
88
|
+
computeHashFloat(this.offset),
|
|
89
|
+
this.distance.hash(),
|
|
90
|
+
computeHashFloat(this.strength),
|
|
91
|
+
computeHashFloat(this.limit),
|
|
92
|
+
computeStringHash(this.solver)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
* @param {number} directionY
|
|
10
10
|
* @param {number} directionZ
|
|
11
11
|
*/
|
|
12
|
-
export function v3_computeOffsetVector(
|
|
12
|
+
export function v3_computeOffsetVector(
|
|
13
|
+
result,
|
|
14
|
+
distance,
|
|
15
|
+
sourceX, sourceY, sourceZ,
|
|
16
|
+
directionX, directionY, directionZ
|
|
17
|
+
) {
|
|
13
18
|
if (distance === 0) {
|
|
14
19
|
result.set(sourceX, sourceY, sourceZ);
|
|
15
20
|
return;
|