@woosh/meep-engine 2.33.21 → 2.33.25
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/core/assert.js +3 -1
- package/core/bvh2/BinaryNode.js +1 -1
- package/core/bvh2/aabb3/AABB3.js +18 -0
- package/core/bvh2/aabb3/AABB3Math.js +1 -1
- package/core/bvh2/binary/2/BinaryUint32BVH.js +498 -0
- package/core/bvh2/binary/2/BinaryUint32BVH.spec.js +54 -0
- package/core/bvh2/binary/IndexedBinaryBVH.js +22 -26
- package/core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js +5 -1
- package/core/bvh2/traversal/__detailed_box_volume_intersection.js +31 -11
- package/core/collection/ArrayUtils.js +1 -1
- package/core/collection/array/arrayQuickSort.js +9 -6
- package/core/collection/array/array_swap.js +22 -0
- package/core/collection/array/binarySearchHighIndex.js +1 -1
- package/core/collection/array/computeHashArray.js +22 -0
- package/core/collection/array/computeHashIntegerArray.js +15 -0
- package/core/collection/array/copyArray.js +2 -2
- package/core/collection/table/DataType2TypedArrayConstructorMapping.js +15 -0
- package/core/color/Color.js +2 -1
- package/core/function/FunctionCompiler.js +2 -1
- package/core/geom/3d/aabb/aabb3_computeDistanceAbovePlane.js +9 -33
- package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +10 -2
- package/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js +41 -0
- package/core/geom/3d/morton/mortonEncode_magicbits.js +2 -1
- package/core/geom/3d/morton/reinterpret_float32_as_int32.js +13 -0
- package/core/geom/3d/morton/v3_morton_encode_transformed.js +33 -0
- package/core/geom/3d/normal/hemioct/unit_hemioct.spec.js +1 -1
- package/core/geom/3d/plane/plane_computeConvex3PlaneIntersection.js +13 -14
- package/core/geom/3d/ray/ray_computeNearestPointToPoint.js +37 -0
- package/core/geom/3d/shape/AbstractShape3D.js +38 -0
- package/core/geom/3d/shape/CompositeShape.js +240 -0
- package/core/geom/3d/shape/TransformedShape3D.js +126 -0
- package/core/geom/3d/shape/UnitCubeShape3D.js +24 -0
- package/core/geom/3d/shape/UnitSphereShape3D.js +24 -0
- package/core/geom/3d/shape/util/shape_to_visual_entity.js +159 -0
- package/core/geom/3d/voxel/DenseBitVolume3D.js +87 -0
- package/core/geom/3d/voxel/buildVolumeFromProjectedGeometry.js +23 -0
- package/core/geom/AABB2.js +1 -1
- package/core/geom/ConicRay.js +3 -1
- package/core/geom/LineSegment.js +0 -78
- package/core/geom/Matrix4.js +7 -8
- package/core/geom/Plane.js +14 -9
- package/core/geom/Rectangle.js +2 -1
- package/core/geom/Vector1.js +1 -1
- package/core/geom/Vector3.js +2 -1
- package/core/geom/Vector4.js +2 -1
- package/core/geom/random/randomPointInBox.js +7 -3
- package/core/geom/random/randomPointInPoint.js +6 -3
- package/core/geom/random/randomPointInSphere.js +9 -5
- package/core/geom/random/randomPointOnBox.js +7 -3
- package/core/geom/random/randomPointOnSphere.js +6 -3
- package/core/geom/v3_length.js +8 -3
- package/core/graph/graph_k_means_cluster.js +1 -1
- package/core/json/resolvePathByArray.js +2 -2
- package/core/math/MathUtils.js +0 -354
- package/core/math/MathUtils.spec.js +7 -1
- package/core/math/gaussian.js +9 -0
- package/core/math/hash/computeHashFloat.js +17 -0
- package/core/math/hash/computeHashFloatArray.js +34 -0
- package/core/math/hash/computeObjectHash.js +54 -0
- package/core/math/intersects1D.js +19 -0
- package/core/math/interval/NumericInterval.js +2 -2
- package/core/math/isValueBetween.js +10 -0
- package/core/math/isValueBetweenInclusive.js +10 -0
- package/core/math/noise/curl_noise_3dt.js +1 -1
- package/core/math/noise/sdnoise.js +10 -10
- package/core/math/overlap1D.js +19 -0
- package/core/math/pingpong.js +17 -0
- package/core/math/random/makeRangedRandom.js +19 -0
- package/core/math/random/randomFloatBetween.js +14 -0
- package/core/math/random/randomFromArray.js +19 -0
- package/core/math/random/randomGaussian.js +15 -0
- package/core/math/random/randomIntegerBetween.js +14 -0
- package/core/math/random/roundFair.js +15 -0
- package/core/math/separation1D.js +21 -0
- package/core/math/solveQuadratic.js +25 -0
- package/core/model/BoundedValue.js +1 -1
- package/core/model/node-graph/node/NodeInstancePortReference.js +1 -1
- package/core/model/node-graph/node/Port.js +1 -1
- package/core/model/reactive/evaluation/MultiPredicateEvaluator.spec.js +3 -1
- package/core/model/reactive/model/ReactiveBinaryExpression.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveReference.js +1 -1
- package/core/model/reactive/model/util/createRandomReactiveExpression.js +1 -1
- package/core/model/stat/LinearModifier.js +1 -1
- package/core/primitives/array/computeIntegerArrayHash.js +1 -1
- package/{engine/graphics/render/forward_plus/materials → core/primitives/strings}/insert_after.js +3 -0
- package/core/primitives/strings/insert_after_or_replace.js +27 -0
- package/editor/process/symbolic/makeHelperBoxGeometry.js +44 -0
- package/editor/view/ecs/EntityEditor.js +2 -2
- package/editor/view/ecs/components/particles/ParticleEmitterController.js +2 -2
- package/engine/EngineHarness.js +1 -0
- package/engine/animation/AnimationUtils.js +5 -5
- package/engine/animation/curve/AnimationCurve.js +72 -0
- package/engine/animation/curve/Keyframe.js +27 -0
- package/engine/animation/keyed2/AnimationTrack.js +27 -3
- package/engine/asset/Asset.js +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.d.ts +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.js +10 -0
- package/engine/asset/loaders/image/ImageRGBADataAsset.js +8 -1
- package/engine/asset/loaders/material/computeImageBitmapEquality.js +11 -0
- package/engine/asset/loaders/material/computeImageBitmapHash.js +22 -28
- package/engine/asset/loaders/material/computeMaterialHash.js +3 -1
- package/engine/asset/loaders/material/computeTextureHash.js +2 -1
- package/engine/ecs/EntityBuilder.js +25 -5
- package/engine/ecs/animation/Animation.js +2 -1
- package/engine/ecs/animation/InverseKinematics.js +2 -1
- package/engine/ecs/attachment/AttachmentBinding.js +8 -0
- package/engine/ecs/attachment/AttachmentSystem.js +4 -0
- package/engine/ecs/attachment/TransformAttachmentBinding.js +14 -44
- package/engine/ecs/components/Tag.js +27 -6
- package/engine/ecs/dynamic_actions/DynamicActorSystem.js +2 -1
- package/engine/ecs/dynamic_actions/DynamicRuleDescriptionTable.spec.js +3 -5
- package/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +1 -1
- package/engine/ecs/evaluation/complex/PointFitnessGaussianBlur.js +1 -1
- package/engine/ecs/foliage/ecs/Foliage2.js +1 -1
- package/engine/ecs/fow/FogOfWar.js +4 -0
- package/engine/ecs/fow/FogOfWarSystem.js +2 -0
- package/engine/ecs/fow/shader/FogOfWarRenderer.js +1 -1
- package/engine/ecs/gui/GUIElement.js +1 -1
- package/engine/ecs/gui/hud/HeadsUpDisplay.js +1 -1
- package/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +2 -0
- package/engine/ecs/gui/position/ViewportPosition.js +2 -1
- package/engine/ecs/system/AbstractContextSystem.js +1 -1
- package/engine/ecs/systems/RangedAttackSystem.js +1 -1
- package/engine/ecs/systems/SteeringSystem.js +1 -1
- package/engine/ecs/systems/TagSystem.js +17 -0
- package/engine/ecs/terrain/tiles/TerrainTileManager.js +1 -1
- package/engine/ecs/tooltip/TooltipComponent.js +15 -0
- package/engine/ecs/transform/Transform.js +19 -6
- package/engine/ecs/util/hideEntityGracefully.js +18 -0
- package/engine/graphics/GraphicsEngine.js +11 -23
- package/engine/graphics/camera/testClippingPlaneComputation.js +2 -2
- package/engine/graphics/composit/CompositLayer.js +17 -4
- package/engine/graphics/composit/CompositingStages.js +8 -0
- package/engine/graphics/composit/LayerCompositer.js +35 -6
- package/engine/graphics/ecs/animation/animator/AnimationClip.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +1 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +2 -1
- package/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
- package/engine/graphics/ecs/highlight/HighlightDefinition.js +2 -1
- package/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +11 -7
- package/engine/graphics/ecs/light/Light.d.ts +1 -1
- package/engine/graphics/ecs/light/Light.js +5 -0
- package/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +5 -1
- package/engine/graphics/ecs/mesh/Mesh.js +2 -1
- package/engine/graphics/ecs/mesh-v2/DrawMode.js +5 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +13 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +32 -18
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +6 -0
- package/engine/graphics/ecs/path/testPathDisplaySystem.js +98 -98
- package/engine/graphics/ecs/trail2d/Trail2D.js +17 -4
- package/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +2 -3
- package/engine/graphics/ecs/trail2d/Trail2DSystem.js +34 -118
- package/engine/graphics/geometry/AttributeSpec.js +105 -0
- package/engine/graphics/{micron/format/MicronVertexDataSpec.js → geometry/VertexDataSpec.js} +56 -25
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +7 -7
- package/engine/graphics/micron/build/fill_patch_geometry_data.js +1 -1
- package/engine/graphics/micron/buildPatchwork.js +1 -1
- package/engine/graphics/micron/format/MicronGeometry.js +3 -3
- package/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +2 -2
- package/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
- package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +5 -5
- package/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
- package/engine/graphics/particles/ParticleEmitterLibrary.js +3 -0
- package/engine/graphics/particles/ecs/{ParticleEmitterSystem2.js → ParticleEmitterSystem.js} +17 -9
- package/engine/graphics/particles/particular/engine/ParticularEngine.js +12 -4
- package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +84 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +106 -169
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js +5 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +14 -3
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +141 -14
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +8 -7
- package/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +37 -0
- package/engine/graphics/particles/particular/engine/emitter/distance_to_camera.js +25 -0
- package/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +8 -2
- package/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +2 -1
- package/engine/graphics/particles/particular/engine/parameter/ParameterTrack.js +1 -1
- package/engine/graphics/particles/particular/engine/parameter/ParticleParameter.js +1 -1
- package/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +24 -0
- package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +262 -71
- package/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +9 -9
- package/engine/graphics/particles/particular/engine/shader/ShaderManager.js +80 -46
- package/engine/graphics/particles/particular/engine/shader/debugAtlas.js +14 -0
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.js +2 -6
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.js +2 -7
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/update_parameters.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +141 -0
- package/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +478 -0
- package/engine/graphics/particles/particular/engine/utils/volume/lut_to_sampler.js +27 -0
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +935 -0
- package/engine/graphics/particles/particular/group/Operation.js +18 -0
- package/engine/graphics/particles/particular/group/OperationType.js +9 -0
- package/engine/graphics/particles/particular/group/ParticleAttribute.js +2 -1
- package/engine/graphics/particles/particular/group/ParticleAttributeType.js +11 -0
- package/engine/graphics/particles/particular/group/ParticleDataType.js +10 -0
- package/engine/graphics/particles/particular/group/ParticleGroup.js +7 -245
- package/engine/graphics/particles/particular/group/ParticleGroup.spec.js +3 -1
- package/engine/graphics/particles/particular/group/ParticleSpecification.js +21 -14
- package/engine/graphics/particles/particular/group/itemSizeFromAttributeType.js +20 -0
- package/engine/graphics/particles/particular/group/optimizeCommandQueue.js +162 -0
- package/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.js +19 -0
- package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
- package/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +13 -7
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +2 -1
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterSet.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.js +126 -95
- package/engine/graphics/render/forward_plus/PointLight.js +9 -0
- package/engine/graphics/render/forward_plus/PointLightData.js +1 -1
- package/engine/graphics/render/forward_plus/SpotLight.js +9 -0
- package/engine/graphics/render/forward_plus/cluster/compute_light_data_hash_0.js +2 -2
- package/engine/graphics/render/forward_plus/computeFrustumCorners.js +14 -32
- package/engine/graphics/render/forward_plus/materials/FP_INJECTION_POINT_ACCUMULATION.js +1 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +32 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_DECODE_PARS.js +51 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_PREAMBLE.js +25 -0
- package/engine/graphics/render/forward_plus/materials/fp_build_fragment_shader.js +31 -120
- package/engine/graphics/render/forward_plus/materials/fp_build_vertex_lighting_shared.js +35 -0
- package/engine/graphics/render/forward_plus/materials/fp_build_vertex_shader.js +4 -5
- package/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
- package/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +10 -3
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +595 -60
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +256 -136
- package/engine/graphics/render/forward_plus/query/analytical_triplanar_corner_mapping.js +8 -0
- package/engine/graphics/render/forward_plus/query/cube_mapping.js +38 -0
- package/engine/graphics/render/forward_plus/query/detailed_sphere_frustum_intersection_test.js +86 -0
- package/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +73 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_objects.js +131 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +129 -0
- package/engine/graphics/render/forward_plus/query/spot_light_inside_volume.js +33 -0
- package/engine/graphics/render/forward_plus/read_frustum_corner.js +14 -0
- package/engine/graphics/render/forward_plus/testClusterEquality.js +22 -0
- package/engine/graphics/render/layers/RenderLayerUtils.js +7 -4
- package/engine/graphics/render/visibility/IncrementalDeltaSet.js +11 -0
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +2 -2
- package/engine/graphics/shaders/TerrainShader.js +4 -5
- package/engine/graphics/texture/atlas/AtlasPatch.js +7 -2
- package/engine/graphics/texture/atlas/TextureAtlas.js +2 -2
- package/engine/graphics/texture/sampler/HarmonicDiffusionGrid.spec.js +1 -1
- package/engine/graphics/texture/sampler/SampleTraverser.js +1 -1
- package/engine/graphics/texture/sampler/Sampler2D.js +8 -7
- package/engine/graphics/texture/sampler/distanceField.spec.js +1 -1
- package/engine/graphics/texture/sampler/scaleSampler2D.js +7 -10
- package/engine/graphics/trail/x/RibbonMaterialX.js +3 -3
- package/engine/graphics/trail/x/RibbonX.js +17 -2
- package/engine/graphics/trail/x/RibbonXPlugin.js +51 -1
- package/engine/graphics/util/composeMatrix4.js +33 -23
- package/engine/graphics/util/decompose_matrix_4_array.js +61 -0
- package/engine/grid/components/GridObstacle.js +3 -10
- package/engine/intelligence/behavior/ecs/BehaviorComponent.js +30 -14
- package/engine/intelligence/behavior/selector/WeightedElement.js +2 -1
- package/engine/intelligence/optimization/RandomOptimizer.js +1 -1
- package/engine/knowledge/database/StaticKnowledgeDataTable.js +6 -1
- package/engine/navigation/ecs/components/Path.js +1 -6
- package/engine/navigation/grid/FastBinaryHeap.spec.js +1 -1
- package/engine/reference/v2/Reference.js +6 -0
- package/engine/sound/ecs/emitter/SoundEmitter.js +2 -1
- package/engine/sound/ecs/emitter/SoundTrack.js +2 -1
- package/engine/sound/material/concrete/RandomSoundMaterial.js +1 -1
- package/engine/ui/notification/notificationGenerator.js +1 -1
- package/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +1 -1
- package/generation/grid/generation/GridTaskExecuteRuleTimes.js +2 -1
- package/generation/markers/actions/MarkerNodeActionSelectRandom.js +1 -1
- package/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +1 -1
- package/generation/placement/action/random/CellActionSelectRandom.js +1 -1
- package/generation/theme/ThemeEngine.js +2 -2
- package/misc/makeMaterialIconCached.js +2 -2
- package/package.json +3 -3
- package/view/View.js +4 -2
- package/view/elements/image/HTMLElementCacheKey.js +2 -1
- package/view/elements/radial/RadialText.js +2 -1
- package/view/minimap/gl/MinimapMarkersGL.js +6 -100
- package/view/minimap/gl/buildMaterial.js +94 -0
- package/engine/graphics/micron/format/MicronGeometryBufferAttributeSpec.js +0 -71
- package/engine/graphics/render/forward_plus/queryBVH_Frustum.js +0 -345
|
@@ -82,8 +82,8 @@ export class TextureAtlas {
|
|
|
82
82
|
* @returns {boolean}
|
|
83
83
|
*/
|
|
84
84
|
contains(patch) {
|
|
85
|
-
assert.
|
|
86
|
-
assert.
|
|
85
|
+
assert.notNull(patch, 'patch');
|
|
86
|
+
assert.defined(patch, 'patch');
|
|
87
87
|
assert.ok(patch.isAtlasPatch, 'patch argument is not an AtlasPatch');
|
|
88
88
|
|
|
89
89
|
return this.patches.includes(patch);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
2
2
|
import { HarmonicDiffusionGrid } from "./HarmonicDiffusionGrid.js";
|
|
3
|
-
import { randomIntegerBetween} from "../../../../core/math/
|
|
3
|
+
import { randomIntegerBetween } from "../../../../core/math/random/randomIntegerBetween.js";
|
|
4
4
|
|
|
5
5
|
test("constructor doesn't throw", () => {
|
|
6
6
|
new HarmonicDiffusionGrid([], 0, 0);
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import QuadTree from '../../../../core/geom/2d/quad-tree/PointQuadTree.js';
|
|
5
5
|
import AABB2 from '../../../../core/geom/AABB2.js';
|
|
6
|
-
import { makeRangedRandom} from '../../../../core/math/MathUtils.js';
|
|
7
6
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
7
|
+
import { makeRangedRandom } from "../../../../core/math/random/makeRangedRandom.js";
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
const Point2 = function (x, y) {
|
|
@@ -493,7 +493,7 @@ Sampler2D.prototype.get = function (x, y, result) {
|
|
|
493
493
|
|
|
494
494
|
const t = [];
|
|
495
495
|
|
|
496
|
-
this.sampleBilinear(x, y, t);
|
|
496
|
+
this.sampleBilinear(x, y, t, 0);
|
|
497
497
|
|
|
498
498
|
if (result !== undefined) {
|
|
499
499
|
result.readFromArray(t, 0);
|
|
@@ -655,14 +655,15 @@ Sampler2D.prototype.sampleChannelBicubic = function (x, y, channel) {
|
|
|
655
655
|
* @param {number} x
|
|
656
656
|
* @param {number} y
|
|
657
657
|
* @param {number[]} result
|
|
658
|
+
* @param {number} result_offset
|
|
658
659
|
*/
|
|
659
|
-
Sampler2D.prototype.sampleBilinear = function (x, y, result) {
|
|
660
|
+
Sampler2D.prototype.sampleBilinear = function (x, y, result, result_offset) {
|
|
660
661
|
|
|
661
662
|
const itemSize = this.itemSize;
|
|
662
663
|
|
|
663
664
|
for (let i = 0; i < itemSize; i++) {
|
|
664
665
|
//TODO this can be optimized greatly
|
|
665
|
-
result[i] = this.sampleChannelBilinear(x, y, i);
|
|
666
|
+
result[i + result_offset] = this.sampleChannelBilinear(x, y, i);
|
|
666
667
|
|
|
667
668
|
}
|
|
668
669
|
};
|
|
@@ -809,7 +810,7 @@ Sampler2D.prototype.sample = function (u, v, result) {
|
|
|
809
810
|
|
|
810
811
|
const temp = [];
|
|
811
812
|
|
|
812
|
-
this.sampleBilinear(u * (this.width - 1), v * (this.height - 1), temp);
|
|
813
|
+
this.sampleBilinear(u * (this.width - 1), v * (this.height - 1), temp, 0);
|
|
813
814
|
|
|
814
815
|
result.readFromArray(temp);
|
|
815
816
|
|
|
@@ -888,7 +889,7 @@ Sampler2D.prototype.makeArrayFiller = function (scale, offset) {
|
|
|
888
889
|
}
|
|
889
890
|
|
|
890
891
|
function fillDD2(index, array, x, y) {
|
|
891
|
-
sampler.sampleBilinear(x, y, v4);
|
|
892
|
+
sampler.sampleBilinear(x, y, v4, 0);
|
|
892
893
|
const val = (v4[0] + offset) * scale | 0;
|
|
893
894
|
array.fill(val, index, index + 3);
|
|
894
895
|
array[index + 3] = (v4[1] + offset) * scale | 0;
|
|
@@ -896,7 +897,7 @@ Sampler2D.prototype.makeArrayFiller = function (scale, offset) {
|
|
|
896
897
|
|
|
897
898
|
function fillDD3(index, array, x, y) {
|
|
898
899
|
|
|
899
|
-
sampler.sampleBilinear(x, y, v4);
|
|
900
|
+
sampler.sampleBilinear(x, y, v4, 0);
|
|
900
901
|
|
|
901
902
|
array[index] = (v4[0] + offset) * scale | 0;
|
|
902
903
|
array[index + 1] = (v4[1] + offset) * scale | 0;
|
|
@@ -905,7 +906,7 @@ Sampler2D.prototype.makeArrayFiller = function (scale, offset) {
|
|
|
905
906
|
}
|
|
906
907
|
|
|
907
908
|
function fillDD4(index, array, x, y) {
|
|
908
|
-
sampler.sampleBilinear(x, y, v4);
|
|
909
|
+
sampler.sampleBilinear(x, y, v4, 0);
|
|
909
910
|
array[index] = (v4[0] + offset) * scale | 0;
|
|
910
911
|
array[index + 1] = (v4[1] + offset) * scale | 0;
|
|
911
912
|
array[index + 2] = (v4[2] + offset) * scale | 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
2
2
|
import { Sampler2D } from "./Sampler2D.js";
|
|
3
3
|
import { computeUnsignedDistanceField } from "./distanceField.js";
|
|
4
|
-
import { randomIntegerBetween} from "../../../../core/math/
|
|
4
|
+
import { randomIntegerBetween } from "../../../../core/math/random/randomIntegerBetween.js";
|
|
5
5
|
|
|
6
6
|
describe('computeUnsignedDistanceField', () => {
|
|
7
7
|
test('empty', () => {
|
|
@@ -7,6 +7,7 @@ import { assert } from "../../../../core/assert.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export function scaleSampler2D(source, target) {
|
|
9
9
|
const targetItemSize = target.itemSize;
|
|
10
|
+
|
|
10
11
|
assert.equal(source.itemSize, targetItemSize, 'both source and target must have the same number of channels');
|
|
11
12
|
|
|
12
13
|
const targetWidth = target.width;
|
|
@@ -18,32 +19,28 @@ export function scaleSampler2D(source, target) {
|
|
|
18
19
|
const target_data = target.data;
|
|
19
20
|
|
|
20
21
|
if (sourceWidth === targetWidth && sourceHeight === targetHeight) {
|
|
21
|
-
// exact size match
|
|
22
|
+
// exact size match, nothing to do
|
|
22
23
|
target_data.set(source.data);
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
const sample = [];
|
|
27
|
-
|
|
28
27
|
const targetRowSize = targetItemSize * targetWidth;
|
|
29
28
|
|
|
29
|
+
const source_scale_x = sourceWidth / targetWidth;
|
|
30
|
+
const source_scale_y = sourceHeight / targetHeight;
|
|
31
|
+
|
|
30
32
|
for (let y = 0; y < targetHeight; y++) {
|
|
31
33
|
|
|
32
|
-
const v = y / targetHeight;
|
|
33
34
|
|
|
35
|
+
const sample_y = y * source_scale_y;
|
|
34
36
|
const target_row_address = y * targetRowSize;
|
|
35
37
|
|
|
36
38
|
for (let x = 0; x < targetWidth; x++) {
|
|
37
39
|
|
|
38
|
-
const u = x / targetWidth;
|
|
39
|
-
|
|
40
|
-
source.sampleBilinear(u * sourceWidth, v * sourceHeight, sample);
|
|
41
40
|
|
|
42
41
|
const target_offset = target_row_address + x * targetItemSize;
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
target_data[target_offset + i] = sample[i];
|
|
46
|
-
}
|
|
43
|
+
source.sampleBilinear(x * source_scale_x, sample_y, target_data, target_offset);
|
|
47
44
|
|
|
48
45
|
}
|
|
49
46
|
}
|
|
@@ -106,11 +106,11 @@ export class RibbonMaterialX extends ShaderMaterial {
|
|
|
106
106
|
uDiffuse: {
|
|
107
107
|
type: 't',
|
|
108
108
|
value: null
|
|
109
|
-
},
|
|
110
|
-
defines: {
|
|
111
|
-
USE_TEXTURE: false
|
|
112
109
|
}
|
|
113
110
|
},
|
|
111
|
+
defines: {
|
|
112
|
+
USE_TEXTURE: false
|
|
113
|
+
},
|
|
114
114
|
blending: NormalBlending,
|
|
115
115
|
transparent: true,
|
|
116
116
|
depthWrite: false,
|
|
@@ -36,7 +36,6 @@ export class RibbonX {
|
|
|
36
36
|
*/
|
|
37
37
|
this.__data = new RowFirstTable(ribbon_attributes_spec);
|
|
38
38
|
|
|
39
|
-
|
|
40
39
|
/**
|
|
41
40
|
* Index into current geometry segment that is at the END of the ribbon
|
|
42
41
|
* @type {number}
|
|
@@ -66,6 +65,10 @@ export class RibbonX {
|
|
|
66
65
|
this.__count = 0;
|
|
67
66
|
}
|
|
68
67
|
|
|
68
|
+
dispose() {
|
|
69
|
+
this.__geometry.dispose();
|
|
70
|
+
}
|
|
71
|
+
|
|
69
72
|
/**
|
|
70
73
|
*
|
|
71
74
|
* @returns {BufferGeometry}
|
|
@@ -350,6 +353,11 @@ export class RibbonX {
|
|
|
350
353
|
this.setPointAttribute_Vector3(index, RIBBON_ATTRIBUTE_ADDRESS_COLOR, r, g, b);
|
|
351
354
|
}
|
|
352
355
|
|
|
356
|
+
/**
|
|
357
|
+
*
|
|
358
|
+
* @param {number} index
|
|
359
|
+
* @param {number} value
|
|
360
|
+
*/
|
|
353
361
|
setPointAlpha(index, value) {
|
|
354
362
|
const i2 = index * 2;
|
|
355
363
|
|
|
@@ -359,7 +367,11 @@ export class RibbonX {
|
|
|
359
367
|
this.__ib_float32.needsUpdate = true;
|
|
360
368
|
}
|
|
361
369
|
|
|
362
|
-
|
|
370
|
+
/**
|
|
371
|
+
*
|
|
372
|
+
* @param {number} index
|
|
373
|
+
* @param {number} value
|
|
374
|
+
*/
|
|
363
375
|
setPointThickness(index, value) {
|
|
364
376
|
const i2 = index * 2;
|
|
365
377
|
|
|
@@ -377,6 +389,9 @@ export class RibbonX {
|
|
|
377
389
|
assert.greaterThanOrEqual(count, 2, 'number of points in the ribbon must be at least 2 (to produce at least a single quad)');
|
|
378
390
|
assert.isNonNegativeInteger(count, 'count');
|
|
379
391
|
|
|
392
|
+
// dispose of existing geometry
|
|
393
|
+
this.__geometry.dispose();
|
|
394
|
+
|
|
380
395
|
const point_count = count * 2;
|
|
381
396
|
|
|
382
397
|
if (this.__data.length > point_count) {
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { EnginePlugin } from "../../../plugin/EnginePlugin.js";
|
|
2
2
|
import { RibbonMaterialX } from "./RibbonMaterialX.js";
|
|
3
|
-
import { DoubleSide } from "three";
|
|
3
|
+
import { DoubleSide, Vector2 } from "three";
|
|
4
4
|
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
5
5
|
import { Cache } from "../../../../core/cache/Cache.js";
|
|
6
6
|
import { invokeObjectEquals } from "../../../../core/model/object/invokeObjectEquals.js";
|
|
7
7
|
import { invokeObjectHash } from "../../../../core/model/object/invokeObjectHash.js";
|
|
8
|
+
import { MaterialManager } from "../../material/manager/MaterialManager.js";
|
|
8
9
|
|
|
9
10
|
export class RibbonXPlugin extends EnginePlugin {
|
|
10
11
|
initialize(engine) {
|
|
11
12
|
super.initialize(engine);
|
|
12
13
|
|
|
14
|
+
this.id = 'ribbon-x-plugin';
|
|
15
|
+
|
|
13
16
|
/**
|
|
14
17
|
* @private
|
|
15
18
|
* @readonly
|
|
@@ -21,6 +24,51 @@ export class RibbonXPlugin extends EnginePlugin {
|
|
|
21
24
|
keyHashFunction: invokeObjectHash,
|
|
22
25
|
keyEqualityFunction: invokeObjectEquals
|
|
23
26
|
});
|
|
27
|
+
|
|
28
|
+
this.__shared_uniforms = {
|
|
29
|
+
resolution: {
|
|
30
|
+
value: new Vector2(1, 1)
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @type {MaterialManager}
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
this.__materials = new MaterialManager();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
__handle_viewport_size_change() {
|
|
43
|
+
const s = this.engine.graphics.viewport.size;
|
|
44
|
+
|
|
45
|
+
this.__shared_uniforms.resolution.value.set(s.x, s.y);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async startup() {
|
|
49
|
+
this.__handle_viewport_size_change();
|
|
50
|
+
|
|
51
|
+
this.engine.graphics.viewport.size.onChanged.add(this.__handle_viewport_size_change, this);
|
|
52
|
+
|
|
53
|
+
return super.startup();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async shutdown() {
|
|
57
|
+
|
|
58
|
+
this.engine.graphics.viewport.size.onChanged.remove(this.__handle_viewport_size_change, this);
|
|
59
|
+
|
|
60
|
+
return super.shutdown();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @param {RibbonXMaterialSpec} spec
|
|
66
|
+
* @return {Reference<Material>}
|
|
67
|
+
*/
|
|
68
|
+
obtain_material_reference(spec) {
|
|
69
|
+
const mm = this.obtain_material_x(spec);
|
|
70
|
+
|
|
71
|
+
return this.__materials.obtain(mm);
|
|
24
72
|
}
|
|
25
73
|
|
|
26
74
|
/**
|
|
@@ -62,6 +110,8 @@ export class RibbonXPlugin extends EnginePlugin {
|
|
|
62
110
|
}
|
|
63
111
|
});
|
|
64
112
|
|
|
113
|
+
material.uniforms.resolution = this.__shared_uniforms.resolution;
|
|
114
|
+
|
|
65
115
|
if (spec.diffuse !== null) {
|
|
66
116
|
const am = this.engine.assetManager;
|
|
67
117
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* @param {
|
|
3
|
+
* @param {number[]|Float32Array|mat4} result
|
|
4
4
|
* @param {Vector3} position
|
|
5
5
|
* @param {Quaternion} rotation
|
|
6
6
|
* @param {Vector3} scale
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
9
|
-
const te = result.elements;
|
|
10
|
-
|
|
8
|
+
export function compose_matrix4_array(result, position, rotation, scale) {
|
|
11
9
|
const x = rotation.x;
|
|
12
10
|
const y = rotation.y;
|
|
13
11
|
const z = rotation.z;
|
|
@@ -33,23 +31,35 @@ export function composeMatrix4(result, position, rotation, scale) {
|
|
|
33
31
|
const sy = scale.y;
|
|
34
32
|
const sz = scale.z;
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
34
|
+
result[0] = (1 - (yy + zz)) * sx;
|
|
35
|
+
result[1] = (xy + wz) * sx;
|
|
36
|
+
result[2] = (xz - wy) * sx;
|
|
37
|
+
result[3] = 0;
|
|
38
|
+
|
|
39
|
+
result[4] = (xy - wz) * sy;
|
|
40
|
+
result[5] = (1 - (xx + zz)) * sy;
|
|
41
|
+
result[6] = (yz + wx) * sy;
|
|
42
|
+
result[7] = 0;
|
|
43
|
+
|
|
44
|
+
result[8] = (xz + wy) * sz;
|
|
45
|
+
result[9] = (yz - wx) * sz;
|
|
46
|
+
result[10] = (1 - (xx + yy)) * sz;
|
|
47
|
+
result[11] = 0;
|
|
48
|
+
|
|
49
|
+
result[12] = position.x;
|
|
50
|
+
result[13] = position.y;
|
|
51
|
+
result[14] = position.z;
|
|
52
|
+
result[15] = 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param {Matrix4} result
|
|
58
|
+
* @param {Vector3} position
|
|
59
|
+
* @param {Quaternion} rotation
|
|
60
|
+
* @param {Vector3} scale
|
|
61
|
+
*/
|
|
62
|
+
export function composeMatrix4(result, position, rotation, scale) {
|
|
63
|
+
const te = result.elements;
|
|
64
|
+
compose_matrix4_array(te, position, rotation, scale);
|
|
55
65
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]} m
|
|
4
|
+
* @param {Vector3} position
|
|
5
|
+
* @param {Quaternion} rotation
|
|
6
|
+
* @param {Vector3} scale
|
|
7
|
+
*/
|
|
8
|
+
export function decompose_matrix_4_array(m, position, rotation, scale) {
|
|
9
|
+
const m11 = m[0];
|
|
10
|
+
const m12 = m[1];
|
|
11
|
+
const m13 = m[2];
|
|
12
|
+
|
|
13
|
+
const m21 = m[4];
|
|
14
|
+
const m22 = m[5];
|
|
15
|
+
const m23 = m[6];
|
|
16
|
+
|
|
17
|
+
const m31 = m[8];
|
|
18
|
+
const m32 = m[9];
|
|
19
|
+
const m33 = m[10];
|
|
20
|
+
|
|
21
|
+
const scale_x = Math.hypot(m11, m12, m13);
|
|
22
|
+
const scale_y = Math.hypot(m21, m22, m23);
|
|
23
|
+
const scale_z = Math.hypot(m31, m32, m33);
|
|
24
|
+
|
|
25
|
+
// extract rotation
|
|
26
|
+
const is1 = 1 / scale_x;
|
|
27
|
+
const is2 = 1 / scale_y;
|
|
28
|
+
const is3 = 1 / scale_z;
|
|
29
|
+
|
|
30
|
+
const sm11 = m11 * is1;
|
|
31
|
+
const sm12 = m12 * is1;
|
|
32
|
+
const sm13 = m13 * is1;
|
|
33
|
+
|
|
34
|
+
const sm21 = m21 * is2;
|
|
35
|
+
const sm22 = m22 * is2;
|
|
36
|
+
const sm23 = m23 * is2;
|
|
37
|
+
|
|
38
|
+
const sm31 = m31 * is3;
|
|
39
|
+
const sm32 = m32 * is3;
|
|
40
|
+
const sm33 = m33 * is3;
|
|
41
|
+
|
|
42
|
+
// write out results
|
|
43
|
+
|
|
44
|
+
position.set(
|
|
45
|
+
m[12],
|
|
46
|
+
m[13],
|
|
47
|
+
m[14]
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
scale.set(
|
|
51
|
+
scale_x,
|
|
52
|
+
scale_y,
|
|
53
|
+
scale_z
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
rotation.__setFromRotationMatrix(
|
|
57
|
+
sm11, sm21, sm31,
|
|
58
|
+
sm12, sm22, sm32,
|
|
59
|
+
sm13, sm23, sm33
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
import Vector2 from '../../../core/geom/Vector2.js';
|
|
7
|
-
import { computeHashIntegerArray } from "../../../core/math/MathUtils.js";
|
|
8
7
|
import { assert } from "../../../core/assert.js";
|
|
9
8
|
import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
10
9
|
import { computeIntegerArrayHash } from "../../../core/primitives/array/computeIntegerArrayHash.js";
|
|
10
|
+
import { isArrayEqualStrict } from "../../../core/collection/array/isArrayEqualStrict.js";
|
|
11
|
+
import { computeHashIntegerArray } from "../../../core/collection/array/computeHashIntegerArray.js";
|
|
11
12
|
|
|
12
13
|
class GridObstacle {
|
|
13
14
|
constructor() {
|
|
@@ -236,15 +237,7 @@ class GridObstacle {
|
|
|
236
237
|
return false;
|
|
237
238
|
}
|
|
238
239
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
for (let i = 0; i < dataSize; i++) {
|
|
242
|
-
if (this.data[i] !== other.data[i]) {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return true;
|
|
240
|
+
return isArrayEqualStrict(this.data, other.data);
|
|
248
241
|
}
|
|
249
242
|
}
|
|
250
243
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
2
|
import { ClockChannelType } from "./ClockChannelType.js";
|
|
3
|
+
import { RepeatBehavior } from "../decorator/RepeatBehavior.js";
|
|
4
|
+
import { ActionBehavior } from "../primitive/ActionBehavior.js";
|
|
3
5
|
|
|
4
6
|
export const BehaviorComponentFlag = {
|
|
5
7
|
AllowSleep: 1
|
|
@@ -25,24 +27,38 @@ export class BehaviorComponent {
|
|
|
25
27
|
*/
|
|
26
28
|
this.flags = 0;
|
|
27
29
|
}
|
|
28
|
-
}
|
|
29
30
|
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param {Behavior} b
|
|
33
|
-
* @returns {BehaviorComponent}
|
|
34
|
-
*/
|
|
35
|
-
BehaviorComponent.fromOne = function (b) {
|
|
36
|
-
assert.notEqual(b, undefined, 'behavior is undefined');
|
|
37
|
-
assert.notEqual(b, null, 'behavior is null');
|
|
38
|
-
assert.equal(b.isBehavior, true, 'b.isBehavior !== true');
|
|
39
31
|
|
|
40
|
-
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param {function} f
|
|
35
|
+
* @param {*} [thisArg]
|
|
36
|
+
* @returns {BehaviorComponent}
|
|
37
|
+
*/
|
|
38
|
+
static looping_function(f, thisArg) {
|
|
39
|
+
return BehaviorComponent.fromOne(RepeatBehavior.from(
|
|
40
|
+
new ActionBehavior(f, thisArg)
|
|
41
|
+
));
|
|
42
|
+
}
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param {Behavior} b
|
|
47
|
+
* @returns {BehaviorComponent}
|
|
48
|
+
*/
|
|
49
|
+
static fromOne(b) {
|
|
50
|
+
assert.notEqual(b, undefined, 'behavior is undefined');
|
|
51
|
+
assert.notEqual(b, null, 'behavior is null');
|
|
52
|
+
assert.equal(b.isBehavior, true, 'b.isBehavior !== true');
|
|
43
53
|
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
const result = new BehaviorComponent();
|
|
55
|
+
|
|
56
|
+
result.list.push(b);
|
|
57
|
+
|
|
58
|
+
return result;
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
}
|
|
46
62
|
|
|
47
63
|
/**
|
|
48
64
|
* @readonly
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { computeHashFloat, computeHashIntegerArray } from "../../../../core/math/MathUtils.js";
|
|
2
1
|
import { assert } from "../../../../core/assert.js";
|
|
3
2
|
import { invokeObjectEquals } from "../../../../core/model/object/invokeObjectEquals.js";
|
|
4
3
|
import { invokeObjectHash } from "../../../../core/model/object/invokeObjectHash.js";
|
|
4
|
+
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
5
|
+
import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
|
|
5
6
|
|
|
6
7
|
export class WeightedElement {
|
|
7
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { randomFromArray} from "../../../core/math/MathUtils.js";
|
|
2
1
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
2
|
+
import { randomFromArray } from "../../../core/math/random/randomFromArray.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Hill climbing optimizer based on random moves
|
|
@@ -222,7 +222,7 @@ export class StaticKnowledgeDataTable {
|
|
|
222
222
|
} catch (e) {
|
|
223
223
|
|
|
224
224
|
let id;
|
|
225
|
-
//attempt to extract
|
|
225
|
+
//attempt to extract item ID
|
|
226
226
|
try {
|
|
227
227
|
id = datum.id;
|
|
228
228
|
} catch (e) {
|
|
@@ -243,6 +243,11 @@ export class StaticKnowledgeDataTable {
|
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
if (this.contains(id)) {
|
|
247
|
+
console.error(`Duplicate id '${id}'`);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
|
|
246
251
|
this.__json.set(id, datum);
|
|
247
252
|
|
|
248
253
|
const added = this.add(element);
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import { line3_computeSegmentPointDistance_sqr } from "../../../../core/geom/LineSegment.js";
|
|
7
6
|
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
8
7
|
|
|
9
8
|
import { CatmullRomCurve3 } from "three";
|
|
@@ -18,6 +17,7 @@ import { min2 } from "../../../../core/math/min2.js";
|
|
|
18
17
|
import { computeNonuniformCatmullRomSplineSample } from "./computeNonuniformCatmullRomSplineSample.js";
|
|
19
18
|
import { InterpolationType } from "./InterpolationType.js";
|
|
20
19
|
import { v3_distance } from "../../../../core/geom/v3_distance.js";
|
|
20
|
+
import { line3_computeSegmentPointDistance_sqr } from "../../../../core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js";
|
|
21
21
|
|
|
22
22
|
const v3_a = new Vector3();
|
|
23
23
|
const v3_b = new Vector3();
|
|
@@ -270,11 +270,6 @@ class Path {
|
|
|
270
270
|
copy(other) {
|
|
271
271
|
this.__data.copy(other.__data);
|
|
272
272
|
this.interpolation = other.interpolation;
|
|
273
|
-
|
|
274
|
-
// Traversal variables
|
|
275
|
-
this.markerOffset = other.markerOffset;
|
|
276
|
-
this.markerIndex = other.markerIndex;
|
|
277
|
-
this.markerDistanceToNext = other.markerDistanceToNext;
|
|
278
273
|
}
|
|
279
274
|
|
|
280
275
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
2
2
|
import BinaryHeap from "./FastBinaryHeap.js";
|
|
3
3
|
import { passThrough, returnZero } from "../../../core/function/Functions.js";
|
|
4
|
-
import { randomIntegerBetween} from "../../../core/math/
|
|
4
|
+
import { randomIntegerBetween } from "../../../core/math/random/randomIntegerBetween.js";
|
|
5
5
|
|
|
6
6
|
test("constructor doesn't throw", () => {
|
|
7
7
|
new BinaryHeap(returnZero);
|
|
@@ -10,11 +10,12 @@ import { SoundEmitterFlags } from "./SoundEmitterFlags.js";
|
|
|
10
10
|
import { SoundAttenuationFunction } from "./SoundAttenuationFunction.js";
|
|
11
11
|
import { attenuateSoundLinear } from "./attenuate/attenuateSoundLinear.js";
|
|
12
12
|
import { attenuateSoundLogarithmic } from "./attenuate/attenuateSoundLogarithmic.js";
|
|
13
|
-
import { computeHashFloat, computeHashIntegerArray } from "../../../../core/math/MathUtils.js";
|
|
14
13
|
import { SoundPanningModelType } from "./SoundPanningModelType.js";
|
|
15
14
|
import { attenuateSoundSmith } from "./attenuate/attenuateSoundSmith.js";
|
|
16
15
|
import { objectKeyByValue } from "../../../../core/model/object/objectKeyByValue.js";
|
|
17
16
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
17
|
+
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
18
|
+
import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Convert decibel to percentage volume
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import Signal from "../../../../core/events/signal/Signal.js";
|
|
2
2
|
import { SoundTrackFlags } from "./SoundTrackFlags.js";
|
|
3
|
-
import { computeHashFloat, computeHashIntegerArray } from "../../../../core/math/MathUtils.js";
|
|
4
3
|
import { assert } from "../../../../core/assert.js";
|
|
5
4
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
5
|
+
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
6
|
+
import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
|
|
6
7
|
|
|
7
8
|
const DEFAULT_FLAGS = SoundTrackFlags.StartWhenReady;
|
|
8
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractSoundMaterialDefinition } from "../AbstractSoundMaterialDefinition.js";
|
|
2
|
-
import { randomFromArray } from "../../../../core/math/MathUtils.js";
|
|
3
2
|
import { SoundAssetPlaybackSpec } from "../../asset/SoundAssetPlaybackSpec.js";
|
|
3
|
+
import { randomFromArray } from "../../../../core/math/random/randomFromArray.js";
|
|
4
4
|
|
|
5
5
|
export class RandomSoundMaterial extends AbstractSoundMaterialDefinition {
|
|
6
6
|
constructor() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Notification } from "../../notify/Notification.js";
|
|
2
|
-
import { randomFromArray } from "../../../core/math/MathUtils.js";
|
|
3
2
|
import { NotificationAreaKind } from "../GUIEngine.js";
|
|
3
|
+
import { randomFromArray } from "../../../core/math/random/randomFromArray.js";
|
|
4
4
|
|
|
5
5
|
function notificationGenerator(callback, timeout = 5) {
|
|
6
6
|
const phrases = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CellFilter } from "../../CellFilter.js";
|
|
2
|
-
import { gaussian } from "../../../../core/math/
|
|
2
|
+
import { gaussian } from "../../../../core/math/gaussian.js";
|
|
3
3
|
|
|
4
4
|
function buildKernel(result, samplesX, samplesY, sigma_x, sigma_y) {
|
|
5
5
|
const half_samples_x = (samplesX / 2);
|