@woosh/meep-engine 2.56.1 → 2.58.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/Editor.js +4 -4
- package/editor/ecs/component/editors/ColorEditor.js +1 -1
- package/editor/ecs/component/editors/ImagePathEditor.js +2 -2
- package/editor/ecs/component/editors/{LargeStrongEditor.js → LargeStringEditor.js} +1 -1
- package/editor/process/symbolic/buildThreeJSHelperEntity.js +3 -3
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +3 -3
- package/editor/process/symbolic/makePositionedIconDisplaySymbol.js +3 -3
- package/editor/tools/GridPaintTool.js +3 -3
- package/editor/tools/TopDownCameraControlTool.js +1 -1
- package/editor/tools/TransformTool.js +1 -1
- package/editor/tools/engine/Tool.js +9 -23
- package/editor/tools/engine/ToolEngine.js +5 -7
- package/editor/tools/paint/TerrainHeightPaintTool.js +2 -2
- package/editor/tools/paint/TerrainPaintTool.js +2 -2
- package/editor/tools/paint/TerrainTexturePaintTool.js +2 -2
- package/editor/tools/v2/prototypeTransformControls.js +3 -3
- package/editor/view/ecs/ComponentControlView.js +2 -1
- package/package.json +1 -1
- package/samples/generation/main.js +2 -2
- package/samples/terrain/from_image.js +2 -2
- package/samples/terrain/from_image_2.js +4 -4
- package/src/core/binary/byteArrayToString.js +28 -0
- package/src/core/binary/downloadAsFile.js +28 -0
- package/src/core/binary/downloadUrlAsFile.js +14 -0
- package/src/core/binary/jsonToStringToByteArray.js +27 -0
- package/src/core/binary/stringToByteArray.js +24 -0
- package/src/core/bvh2/BinaryNode.spec.js +2 -1
- package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +1 -1
- package/src/core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js +1 -1
- package/src/core/bvh2/traversal/__process_point_if_within_planes.js +1 -1
- package/src/core/cache/LoadingCache.js +3 -2
- package/src/core/collection/array/arraySetSortingDiff.spec.js +12 -12
- package/src/core/collection/array/weightedRandomFromArray.js +2 -2
- package/src/core/color/Color.js +6 -6
- package/src/core/color/Color.spec.js +27 -1
- package/src/core/color/YCbCr/YCbCr.spec.js +16 -0
- package/src/core/color/{YCbCr_to_rgb_uint24.js → YCbCr/YCbCr_to_rgb_uint24.js} +6 -6
- package/src/core/color/YCbCr/rgb_to_YCbCr_uint24.js +16 -0
- package/src/core/color/{hex2rgb.js → hex/hex2rgb.js} +1 -1
- package/src/core/color/{rgb2hex.js → hex/rgb2hex.js} +1 -1
- package/src/core/color/{hsv2rgb.js → hsv/hsv2rgb.js} +3 -3
- package/src/core/color/hsv/rgb2hsv.js +49 -0
- package/src/core/color/{kelvin_to_rgb.js → kelvin/kelvin_to_rgb.js} +1 -1
- package/src/core/color/{kelvin_to_rgb.spec.js → kelvin/kelvin_to_rgb.spec.js} +2 -2
- package/src/core/color/{prototype_kelvin_to_rgb.js → kelvin/prototype_kelvin_to_rgb.js} +5 -5
- package/src/core/color/{rgb_to_kelvin.spec.js → kelvin/rgb_to_kelvin.spec.js} +1 -1
- package/src/core/color/{parseColor.js → parse_color.js} +5 -5
- package/src/core/color/parse_color.spec.js +18 -0
- package/src/core/color/rgb2uint24.js +3 -3
- package/src/core/color/sRGB/sRGB.spec.js +16 -0
- package/src/core/color/xyz/XYZ.spec.js +16 -0
- package/src/core/color/xyz/rgb_to_xyz.js +15 -0
- package/src/core/color/xyz/xyz_to_rgb.js +14 -0
- package/src/core/events/signal/Signal.js +5 -0
- package/src/core/events/signal/{signalAggregateByTimeWindow.js → signal_aggregate_by_time_window.js} +1 -1
- package/src/core/events/signal/{SignalUtils.js → signal_filter.js} +1 -2
- package/src/core/fsm/simple/SimpleStateMachine.spec.js +34 -2
- package/src/core/geom/2d/spline_bezier2_2d.js +26 -0
- package/src/core/geom/2d/spline_bezier2_2d.spec.js +16 -0
- package/src/core/geom/3d/SurfacePoint3.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_compute_plane_side.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.js +1 -1
- package/src/core/geom/3d/compute_circle_bounding_box.js +1 -1
- package/src/core/geom/3d/cone/computeConeBoundingBox.js +1 -1
- package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/src/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js +1 -1
- package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.js +1 -1
- package/src/core/geom/3d/matrix/m4_multiply.js +2 -2
- package/src/core/geom/3d/matrix/m4_multiply.spec.js +11 -0
- package/src/core/geom/3d/matrix/m4_multiply_alphatensor.spec.js +11 -0
- package/src/core/geom/3d/morton/split_by_2.js +1 -1
- package/src/core/geom/3d/normal/hemioct/unit_hemioct.spec.js +1 -1
- package/src/core/geom/3d/normal/spherical/sphere_map_transform.js +1 -1
- package/src/core/geom/3d/plane/is_point_within_planes.js +1 -1
- package/src/core/geom/3d/plane/lerp_planes_to_array.js +1 -1
- package/src/core/geom/3d/plane/plane3_compute_convex_3_plane_intersection.js +1 -1
- package/src/core/geom/3d/plane/plane3_compute_line_segment_intersection.js +1 -1
- package/src/core/geom/3d/plane/plane3_compute_ray_intersection.js +1 -1
- package/src/core/geom/3d/plane/plane3_lerp.js +2 -2
- package/src/core/geom/3d/plane/plane3_projectPoint.js +1 -1
- package/src/core/geom/3d/plane/plane3_slerp.js +3 -3
- package/src/core/geom/3d/ray/ray_computeNearestPointToPoint.js +1 -1
- package/src/core/geom/3d/ray/ray_distance_to_point.js +1 -1
- package/src/core/geom/3d/shape/UnionShape3D.js +3 -3
- package/src/core/geom/3d/shape/UnitCubeShape3D.js +1 -1
- package/src/core/geom/3d/shape/UnitSphereShape3D.js +1 -1
- package/src/core/geom/3d/shape/util/shape_to_visual_entity.js +10 -10
- package/src/core/geom/3d/sphere/sphere_intersects_ray.js +1 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +6 -0
- package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.js +1 -1
- package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.spec.js +1 -1
- package/src/core/geom/3d/tetrahedra/compute_circumsphere.js +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js +1 -0
- package/src/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.spec.js +10 -2
- package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +2 -2
- package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +1 -1
- package/src/core/geom/3d/topology/samples/sampleFloodFill.js +4 -4
- package/src/core/geom/3d/topology/simplify/compute_face_normal_change_dot_product.js +1 -1
- package/src/core/geom/3d/topology/simplify/quadratic/Quadratic3.js +1 -1
- package/src/core/geom/3d/topology/simplify/tm_edge_collapse_is_degenerate_flip.js +2 -2
- package/src/core/geom/3d/topology/struct/TopoVertex.js +1 -1
- package/src/core/geom/3d/topology/util/compute_face_connection_weight.js +2 -2
- package/src/core/geom/3d/triangle/computeTrianglePlaneSide.js +1 -1
- package/src/core/geom/3d/triangle/computeTriangleRayIntersection.js +1 -1
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.js +1 -1
- package/src/core/geom/3d/v3_compute_triangle_normal.js +1 -1
- package/src/core/geom/Quaternion.js +1 -1
- package/src/core/geom/Vector3.js +7 -7
- package/src/core/geom/Vector3.spec.js +68 -1
- package/src/core/geom/mat2/m2_add.js +17 -0
- package/src/core/geom/mat2/m2_determinant.js +8 -0
- package/src/core/geom/mat2/m2_multiply.js +17 -0
- package/src/core/geom/mat2/m2_multiply_scalar.js +18 -0
- package/src/core/geom/mat2/m2_multiply_transposed.js +18 -0
- package/src/core/geom/mat2/m2_sub_transposed.js +17 -0
- package/src/{view → core/geom/mat3}/m3_cm_compose_transform.js +0 -29
- package/src/core/geom/mat3/m3_cm_extract_rotation.js +8 -0
- package/src/core/geom/mat3/m3_cm_from_translation.js +19 -0
- package/src/{view/multiplyMatrices3.js → core/geom/mat3/m3_multiply.js} +2 -2
- package/src/{view → core/geom/mat3}/m3_rm_compose_transform.js +0 -9
- package/src/core/geom/mat3/m3_rm_extract_scale.js +7 -0
- package/src/core/geom/{3d/vector/allocate_v3.js → vec3/v3_allocate.js} +1 -1
- package/src/core/geom/{v3_angle_between.js → vec3/v3_angle_between.js} +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.js +20 -0
- package/src/core/geom/{v3_lerp.js → vec3/v3_lerp.js} +1 -1
- package/src/core/graph/SquareMatrix.js +26 -3
- package/src/core/graph/SquareMatrix.spec.js +52 -2
- package/src/core/math/clamp01.js +1 -0
- package/src/core/math/fract.js +3 -1
- package/src/core/math/inverseLerp.js +7 -5
- package/src/core/math/lerp.js +5 -5
- package/src/core/math/physics/spring/computeHookeForce.js +9 -0
- package/src/core/math/remap.js +19 -0
- package/src/core/math/remap.spec.js +15 -0
- package/src/core/math/smoothStep.spec.js +16 -0
- package/src/core/math/spline/spline_bezier2.js +13 -0
- package/src/core/math/spline/spline_bezier2.spec.js +13 -0
- package/src/core/model/object/compareValues.js +2 -2
- package/src/core/model/object/read_property.js +10 -2
- package/src/core/model/object/write_property.js +3 -23
- package/src/core/model/object/write_property.spec.js +26 -0
- package/src/core/primitives/numbers/number_pretty_print.spec.js +19 -0
- package/src/core/process/action/AsynchronousDelayAction.js +2 -2
- package/src/core/process/executor/profile/ConcurrentExecutorProfiler.js +1 -1
- package/src/engine/EngineHarness.js +7 -7
- package/src/engine/EntityCreator.js +5 -5
- package/src/engine/__module.js +1 -1
- package/src/engine/achievements/AchievementManager.js +2 -2
- package/src/engine/animation/AnimationUtils.js +4 -4
- package/src/engine/animation/behavior/animateProperty.js +2 -2
- package/src/engine/animation/curve/draw/build_plot_entity_from_array.js +3 -3
- package/src/engine/animation/playAnimationTrack.js +3 -3
- package/src/engine/animation/playTrackRealTime.js +3 -3
- package/src/engine/animation/removeEntityWithMeshParticlesEffect.js +2 -2
- package/src/engine/control/ControlContext.js +7 -7
- package/src/engine/ecs/{EntityBuilder.d.ts → Entity.d.ts} +5 -5
- package/src/engine/ecs/{EntityBuilder.js → Entity.js} +29 -29
- package/src/engine/ecs/{EntityBuilder.spec.js → Entity.spec.js} +17 -17
- package/src/engine/ecs/EntityBlueprint.d.ts +2 -2
- package/src/engine/ecs/EntityBlueprint.js +3 -3
- package/src/engine/ecs/EntityBlueprint.spec.js +2 -2
- package/src/engine/ecs/{EntityBuilderFlags.js → EntityFlags.js} +1 -1
- package/src/engine/ecs/EntityObserver.spec.js +8 -8
- package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +5 -5
- package/src/engine/ecs/foliage/ecs/InstancedMeshUtils.js +3 -3
- package/src/engine/ecs/gui/menu/radial/RadialContextMenu.d.ts +2 -2
- package/src/engine/ecs/gui/menu/radial/RadialContextMenu.js +5 -5
- package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +2 -2
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +2 -2
- package/src/engine/ecs/parent/EntityNode.d.ts +3 -3
- package/src/engine/ecs/parent/EntityNode.js +5 -5
- package/src/engine/ecs/parent/testHuDPerf.js +2 -2
- package/src/engine/ecs/speaker/VoiceSystem.js +5 -5
- package/src/engine/ecs/systems/SteeringSystem.js +1 -1
- package/src/engine/ecs/terrain/ecs/splat/SplatMapOptimizerDebugger.js +1 -1
- package/src/engine/ecs/tooltip/testTooltipComponentSystem.js +3 -3
- package/src/engine/graphics/camera/makeOrbitalCameraController.js +3 -3
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +3 -3
- package/src/engine/graphics/debug/createDebugLabel.js +3 -3
- package/src/engine/graphics/ecs/camera/Camera.js +1 -1
- package/src/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
- package/src/engine/graphics/ecs/camera/filter/setup_filtered_camera_controller.js +3 -3
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +3 -11
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalEditor.js +3 -3
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +14 -14
- package/src/engine/graphics/ecs/highlight/Highlight.js +20 -102
- package/src/engine/graphics/ecs/mesh/Mesh.js +12 -18
- package/src/engine/graphics/ecs/mesh/MeshSystem.js +41 -26
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/prototypeSGMesh.js +3 -3
- package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +5 -5
- package/src/engine/graphics/ecs/mesh-v2/sample/prototype_sg_raycast.js +6 -6
- package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js +3 -3
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +3 -3
- package/src/engine/graphics/ecs/path/tube/build/TubePathBuilder.js +4 -4
- package/src/engine/graphics/ecs/path/tube/build/makeTubeGeometry.js +1 -1
- package/src/engine/graphics/ecs/path/tube/build/make_cap.js +3 -3
- package/src/engine/graphics/ecs/path/tube/build/make_ring_vertices.js +1 -1
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +3 -3
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +2 -2
- package/src/engine/graphics/ecs/sprite/prototypeSpriteSystem.js +2 -2
- package/src/engine/graphics/geometry/MikkT/InitTriInfo.js +5 -6
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +3 -3
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.js +1 -2
- package/src/engine/graphics/geometry/MikkT/STSpace.js +3 -3
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.js +2 -2
- package/src/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +1 -1
- package/src/engine/graphics/geometry/clipping/ClippedGeometry.js +1 -1
- package/src/engine/graphics/geometry/optimization/merge/prototypeGeometryMerge.js +4 -4
- package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +7 -7
- package/src/engine/graphics/particles/node-based/editor/ParticleSpecificationEditorView.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +102 -95
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleLayer.spec.js +25 -0
- package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +0 -35
- package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +39 -2
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +2 -2
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.js +22 -6
- package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.d.ts +2 -2
- package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +3 -3
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +10 -10
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
- package/src/engine/graphics/render/buffer/simple-fx/taa/prototypeTAA.js +2 -2
- package/src/engine/graphics/render/forward_plus/LightManager.js +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +13 -13
- package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +3 -3
- package/src/engine/graphics/render/forward_plus/query/detailed_sphere_frustum_intersection_test.js +1 -1
- package/src/engine/graphics/render/layers/RenderLayerUtils.js +1 -1
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +8 -7
- package/src/engine/graphics/sh3/LightProbeVolume.js +3 -3
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/ray_reflect.js +1 -1
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +3 -3
- package/src/engine/graphics/sh3/sky/hosek/data.js +3744 -0
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +10 -3786
- package/src/engine/graphics/sh3/visualise_probe.js +3 -3
- package/src/engine/graphics/shadows/testShadowMapRendering.js +3 -3
- package/src/engine/graphics/texture/atlas/AbstractTextureAtlas.js +1 -1
- package/src/engine/graphics/texture/atlas/AtlasPatch.js +0 -1
- package/src/engine/graphics/texture/atlas/AtlasPatchFlag.js +8 -1
- package/src/engine/graphics/texture/atlas/CachingTextureAtlas.js +25 -0
- package/src/engine/graphics/texture/atlas/CachingTextureAtlas.spec.js +54 -0
- package/src/engine/graphics/texture/atlas/ManagedTextureAtlas.js +101 -160
- package/src/engine/graphics/texture/atlas/TextureAtlas.js +18 -1
- package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_ensure_uint8_RGBA.js +22 -0
- package/src/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +2 -2
- package/src/engine/graphics/util/projectSphere.js +1 -1
- package/src/engine/input/ecs/controllers/KeyboardCameraController.js +2 -2
- package/src/engine/input/ecs/util/TopDownCameraControllerHelper.js +2 -2
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.spec.js +13 -12
- package/src/engine/navigation/ecs/components/Path.js +1 -1
- package/src/engine/physics/fluid/prototype.js +3 -3
- package/src/engine/physics/mls-mpm/MLS_MPM.js +11 -106
- package/src/engine/reference/v2/Reference.js +6 -2
- package/src/engine/save/storage/JsonStringCodec.js +1 -1
- package/src/engine/save/storage/LocalStorage.js +2 -1
- package/src/engine/sound/ecs/emitter/SoundEmitter.js +7 -7
- package/src/engine/sound/ecs/emitter/SoundTrack.js +6 -6
- package/src/engine/ui/GUIEngine.js +4 -4
- package/src/engine/ui/notification/NotificationManager.js +3 -3
- package/src/generation/filtering/numeric/complex/CellFilterAngleToNormal.js +1 -1
- package/src/generation/grid/generation/road/GridTaskGenerateRoads.js +2 -4
- package/src/generation/markers/debug/visualizeMarkers.js +2 -2
- package/src/generation/markers/prototypeGridCellActionPlaceMarker.js +2 -2
- package/src/generation/placement/action/random/weighted/CellActionSelectWeightedRandom.js +2 -2
- package/src/generation/theme/ThemeEngine.js +2 -2
- package/src/generation/theme/ThemeEngine.spec.js +7 -0
- package/src/view/View.js +21 -13
- package/src/view/elements/ColorPickerView.js +2 -2
- package/src/view/minimap/gl/MarkerGL.js +20 -18
- package/src/view/minimap/gl/MinimapMarkersGL.js +2 -1
- package/editor/tools/FoliagePaintTool.js +0 -168
- package/editor/tools/engine/ToolStateMachine.js +0 -53
- package/src/core/NumberFormat.js +0 -4
- package/src/core/binary/ByteArrayTools.js +0 -137
- package/src/core/binary/NaiveBitSet.js +0 -69
- package/src/core/binary/objects/StandardTypeBuilder.js +0 -126
- package/src/core/binary/serde/JsonSerializer.js +0 -113
- package/src/core/color/rgb2hsv.js +0 -47
- package/src/core/color/rgb_to_YCbCr_uint24.js +0 -16
- package/src/core/fsm/StateMachine.js +0 -440
- package/src/core/fsm/Transition.js +0 -65
- package/src/core/geom/Bezier.js +0 -24
- package/src/core/geom/Bezier.spec.js +0 -16
- package/src/core/math/spline/quadraticCurve.js +0 -11
- package/src/core/math/spline/quadraticCurve.spec.js +0 -13
- package/src/core/primitives/numbers/compareNumbers.js +0 -9
- package/src/engine/graphics/ecs/decal/Decal.js +0 -10
- package/src/engine/graphics/ecs/decal/DecalSystem.js +0 -99
- package/src/engine/graphics/ecs/decal/threejs/DecalGeometry.js +0 -298
- package/src/engine/graphics/ecs/trail/Trail.js +0 -83
- package/src/engine/graphics/ecs/trail/TrailMaterial.js +0 -67
- package/src/engine/graphics/ecs/trail/TrailMaterial2.js +0 -73
- package/src/engine/graphics/ecs/trail/TrailSystem.js +0 -162
- package/src/engine/graphics/ecs/water2/NodeWaterShader1.js +0 -213
- package/src/engine/graphics/ecs/water2/shader/JBWaterShader.js +0 -315
- package/src/engine/graphics/geometry/MikkT/Length.js +0 -10
- package/src/engine/graphics/texture/ImageLoader.js +0 -33
- package/src/engine/graphics/three/DDSLoader.js +0 -286
- package/src/engine/graphics/three/Water2.js +0 -343
- package/src/engine/physics/spring/computeHookeForce.js +0 -9
- package/src/engine/reference/v1/ReferenceManager.js +0 -124
- /package/src/core/color/{hex2rgb.spec.js → hex/hex2rgb.spec.js} +0 -0
- /package/src/core/color/{rgb2hex.spec.js → hex/rgb2hex.spec.js} +0 -0
- /package/src/core/color/{hsv2rgb.spec.js → hsv/hsv2rgb.spec.js} +0 -0
- /package/src/core/color/{rgb_to_kelvin.js → kelvin/rgb_to_kelvin.js} +0 -0
- /package/src/core/color/{linear_to_sRGB.js → sRGB/linear_to_sRGB.js} +0 -0
- /package/src/core/color/{sRGB_to_linear.js → sRGB/sRGB_to_linear.js} +0 -0
- /package/src/core/geom/{m3_determinant.js → mat3/m3_determinant.js} +0 -0
- /package/src/core/geom/{v3_distance.js → vec3/v3_distance.js} +0 -0
- /package/src/core/geom/{v3_distance_above_plane.js → vec3/v3_distance_above_plane.js} +0 -0
- /package/src/core/geom/{v3_distance_above_plane.spec.js → vec3/v3_distance_above_plane.spec.js} +0 -0
- /package/src/core/geom/{v3_distance_sqr.d.ts → vec3/v3_distance_sqr.d.ts} +0 -0
- /package/src/core/geom/{v3_distance_sqr.js → vec3/v3_distance_sqr.js} +0 -0
- /package/src/core/geom/{v3_dot.js → vec3/v3_dot.js} +0 -0
- /package/src/core/geom/{v3_length.js → vec3/v3_length.js} +0 -0
- /package/src/core/geom/{v3_length_sqr.js → vec3/v3_length_sqr.js} +0 -0
- /package/src/core/geom/{v3_slerp.js → vec3/v3_slerp.js} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import {ParallelBehavior, ParallelBehaviorPolicy} from "./ParallelBehavior.js";
|
|
2
|
+
import {SucceedingBehavior} from "../primitive/SucceedingBehavior.js";
|
|
3
|
+
import {BehaviorStatus} from "../BehaviorStatus.js";
|
|
4
|
+
import {FailingBehavior} from "../primitive/FailingBehavior.js";
|
|
5
|
+
import {jest} from '@jest/globals';
|
|
6
|
+
import {RepeatBehavior} from "../decorator/RepeatBehavior.js";
|
|
6
7
|
|
|
7
8
|
test("constructor doesn't throw", () => {
|
|
8
9
|
new ParallelBehavior(ParallelBehaviorPolicy.RequireAll, ParallelBehaviorPolicy.RequireAll);
|
|
@@ -33,11 +34,11 @@ test("1 succeeding child", () => {
|
|
|
33
34
|
test("1 succeeding child, 1 tick delay", () => {
|
|
34
35
|
const p = new ParallelBehavior(ParallelBehaviorPolicy.RequireAll, ParallelBehaviorPolicy.RequireOne);
|
|
35
36
|
|
|
36
|
-
const b =
|
|
37
|
+
const b = RepeatBehavior.from(SucceedingBehavior.INSTANCE, 2);
|
|
37
38
|
|
|
38
|
-
b.tick = jest.fn(b.tick);
|
|
39
|
-
b.initialize = jest.fn(b.initialize);
|
|
40
|
-
b.finalize = jest.fn(b.finalize);
|
|
39
|
+
b.tick = jest.fn(b.tick.bind(b));
|
|
40
|
+
b.initialize = jest.fn(b.initialize.bind(b));
|
|
41
|
+
b.finalize = jest.fn(b.finalize.bind(b));
|
|
41
42
|
|
|
42
43
|
p.addChild(b);
|
|
43
44
|
|
|
@@ -105,7 +106,7 @@ test("policy success-One, failure-One. Succeeding", () => {
|
|
|
105
106
|
|
|
106
107
|
p.addChild(a);
|
|
107
108
|
|
|
108
|
-
const b =
|
|
109
|
+
const b = RepeatBehavior.from(SucceedingBehavior.INSTANCE, 2);
|
|
109
110
|
|
|
110
111
|
p.addChild(b);
|
|
111
112
|
|
|
@@ -121,7 +122,7 @@ test("policy success-All, failure-One. Succeeding", () => {
|
|
|
121
122
|
|
|
122
123
|
p.addChild(a);
|
|
123
124
|
|
|
124
|
-
const b =
|
|
125
|
+
const b = RepeatBehavior.from(SucceedingBehavior.INSTANCE, 2);
|
|
125
126
|
|
|
126
127
|
p.addChild(b);
|
|
127
128
|
|
|
@@ -138,7 +139,7 @@ test("policy success-One, failure-One. Failing", () => {
|
|
|
138
139
|
|
|
139
140
|
p.addChild(a);
|
|
140
141
|
|
|
141
|
-
const b =
|
|
142
|
+
const b = RepeatBehavior.from(SucceedingBehavior.INSTANCE, 2);
|
|
142
143
|
|
|
143
144
|
p.addChild(b);
|
|
144
145
|
|
|
@@ -14,7 +14,7 @@ import { RowFirstTable } from "../../../../core/collection/table/RowFirstTable.j
|
|
|
14
14
|
import { min2 } from "../../../../core/math/min2.js";
|
|
15
15
|
import { computeNonuniformCatmullRomSplineSample } from "./computeNonuniformCatmullRomSplineSample.js";
|
|
16
16
|
import { InterpolationType } from "./InterpolationType.js";
|
|
17
|
-
import { v3_distance } from "../../../../core/geom/v3_distance.js";
|
|
17
|
+
import { v3_distance } from "../../../../core/geom/vec3/v3_distance.js";
|
|
18
18
|
import {
|
|
19
19
|
line3_computeSegmentPointDistance_sqr
|
|
20
20
|
} from "../../../../core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EngineHarness } from "../../EngineHarness.js";
|
|
2
2
|
import GUIElementSystem from "../../ecs/gui/GUIElementSystem.js";
|
|
3
|
-
import
|
|
3
|
+
import Entity from "../../ecs/Entity.js";
|
|
4
4
|
import GUIElement from "../../ecs/gui/GUIElement.js";
|
|
5
5
|
import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
6
6
|
import { BehaviorSystem } from "../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
@@ -58,7 +58,7 @@ function main(engine) {
|
|
|
58
58
|
slice_view.setData(field.buffer, field.resolution);
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
new
|
|
61
|
+
new Entity()
|
|
62
62
|
.add(BehaviorComponent.looping_function(time_delta => {
|
|
63
63
|
|
|
64
64
|
const t0 = performance.now();
|
|
@@ -82,7 +82,7 @@ function main(engine) {
|
|
|
82
82
|
return `${m}: ${metric_stats}`;
|
|
83
83
|
}).join('\n')).start()
|
|
84
84
|
|
|
85
|
-
new
|
|
85
|
+
new Entity()
|
|
86
86
|
.add(GUIElement.fromView(slice_view))
|
|
87
87
|
.build(ecd);
|
|
88
88
|
|
|
@@ -1,105 +1,10 @@
|
|
|
1
1
|
import { clamp } from "../../../core/math/clamp.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function determinant(a) {
|
|
9
|
-
return a[0] * a[3] - a[1] * a[2]
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param {number[]} r
|
|
15
|
-
* @param {number[]} a
|
|
16
|
-
* @param {number[]} b
|
|
17
|
-
*/
|
|
18
|
-
function m2_multiply(r, a, b) {
|
|
19
|
-
const v0 = a[0] * b[0] + a[1] * b[2];
|
|
20
|
-
const v1 = a[0] * b[1] + a[1] * b[3];
|
|
21
|
-
const v2 = a[2] * b[0] + a[3] * b[2];
|
|
22
|
-
const v3 = a[2] * b[1] + a[3] * b[3];
|
|
23
|
-
|
|
24
|
-
r[0] = v0;
|
|
25
|
-
r[1] = v1;
|
|
26
|
-
r[2] = v2;
|
|
27
|
-
r[3] = v3;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Second argument will be transposed before multiplication
|
|
32
|
-
* @param {number[]} r
|
|
33
|
-
* @param {number[]} a
|
|
34
|
-
* @param {number[]} b
|
|
35
|
-
*/
|
|
36
|
-
function m2_multiply_t(r, a, b) {
|
|
37
|
-
const v0 = a[0] * b[0] + a[1] * b[1];
|
|
38
|
-
const v1 = a[0] * b[2] + a[1] * b[3];
|
|
39
|
-
const v2 = a[2] * b[0] + a[3] * b[1];
|
|
40
|
-
const v3 = a[2] * b[2] + a[3] * b[3];
|
|
41
|
-
|
|
42
|
-
r[0] = v0;
|
|
43
|
-
r[1] = v1;
|
|
44
|
-
r[2] = v2;
|
|
45
|
-
r[3] = v3;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param {number[]} r
|
|
51
|
-
* @param {number[]} a
|
|
52
|
-
* @param {number} s
|
|
53
|
-
*/
|
|
54
|
-
function m2_multiply_scalar(r, a, s) {
|
|
55
|
-
|
|
56
|
-
const v0 = a[0] * s;
|
|
57
|
-
const v1 = a[1] * s;
|
|
58
|
-
const v2 = a[2] * s;
|
|
59
|
-
const v3 = a[3] * s;
|
|
60
|
-
|
|
61
|
-
r[0] = v0;
|
|
62
|
-
r[1] = v1;
|
|
63
|
-
r[2] = v2;
|
|
64
|
-
r[3] = v3;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
69
|
-
* @param {number[]} r
|
|
70
|
-
* @param {number[]} a
|
|
71
|
-
* @param {number[]} b
|
|
72
|
-
*/
|
|
73
|
-
function m2_add(r, a, b) {
|
|
74
|
-
const v0 = a[0] + b[0];
|
|
75
|
-
const v1 = a[1] + b[1];
|
|
76
|
-
const v2 = a[2] + b[2];
|
|
77
|
-
const v3 = a[3] + b[3];
|
|
78
|
-
|
|
79
|
-
r[0] = v0;
|
|
80
|
-
r[1] = v1;
|
|
81
|
-
r[2] = v2;
|
|
82
|
-
r[3] = v3;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Trasposes second matrix before subtraction
|
|
88
|
-
* @param {number[]} r
|
|
89
|
-
* @param {number[]} a
|
|
90
|
-
* @param {number[]} b
|
|
91
|
-
*/
|
|
92
|
-
function m2_sub_ta(r, a, b) {
|
|
93
|
-
const v0 = a[0] - b[0];
|
|
94
|
-
const v1 = a[2] - b[1];
|
|
95
|
-
const v2 = a[1] - b[2];
|
|
96
|
-
const v3 = a[3] - b[3];
|
|
97
|
-
|
|
98
|
-
r[0] = v0;
|
|
99
|
-
r[1] = v1;
|
|
100
|
-
r[2] = v2;
|
|
101
|
-
r[3] = v3;
|
|
102
|
-
}
|
|
2
|
+
import { m2_multiply } from "../../../core/geom/mat2/m2_multiply.js";
|
|
3
|
+
import { m2_multiply_transposed } from "../../../core/geom/mat2/m2_multiply_transposed.js";
|
|
4
|
+
import { m2_determinant } from "../../../core/geom/mat2/m2_determinant.js";
|
|
5
|
+
import { m2_multiply_scalar } from "../../../core/geom/mat2/m2_multiply_scalar.js";
|
|
6
|
+
import { m2_add } from "../../../core/geom/mat2/m2_add.js";
|
|
7
|
+
import { m2_sub_transposed } from "../../../core/geom/mat2/m2_sub_transposed.js";
|
|
103
8
|
|
|
104
9
|
|
|
105
10
|
/**
|
|
@@ -354,14 +259,14 @@ export class MLS_MPMSolver {
|
|
|
354
259
|
// Cauchy stress times dt and inv_dx
|
|
355
260
|
// original taichi: stress = -4*inv_dx*inv_dx*dt*vol*( 2*mu*(p.F-r)*transposed(p.F) + lambda*(J-1)*J )
|
|
356
261
|
// (in taichi matrices are coded transposed)
|
|
357
|
-
const J =
|
|
262
|
+
const J = m2_determinant(p.F); // Current volume
|
|
358
263
|
polar_decomp_noS(r, p.F); // Polar decomp. for fixed corotated model
|
|
359
264
|
const k1 = -4 * inv_dx * inv_dx * dt * vol;
|
|
360
265
|
const k2 = lambda * (J - 1) * J;
|
|
361
266
|
|
|
362
267
|
|
|
363
268
|
//compute stress
|
|
364
|
-
|
|
269
|
+
m2_sub_transposed(m2_temp0, p.F, r);
|
|
365
270
|
|
|
366
271
|
m2_multiply(m2_temp0, m2_temp0, p.F);
|
|
367
272
|
|
|
@@ -571,11 +476,11 @@ export class MLS_MPMSolver {
|
|
|
571
476
|
sig[i + 2 * i] = clamp(sig[i + 2 * i], 1.0 - 2.5e-2, 1.0 + 7.5e-3);
|
|
572
477
|
}
|
|
573
478
|
|
|
574
|
-
const oldJ =
|
|
479
|
+
const oldJ = m2_determinant(F);
|
|
575
480
|
// original taichi: F = svd_u * sig * transposed(svd_v)
|
|
576
481
|
m2_multiply(m2_temp0, svd_u, sig);
|
|
577
|
-
|
|
578
|
-
const Jp_new = clamp(p.Jp * oldJ /
|
|
482
|
+
m2_multiply_transposed(p.F, m2_temp0, svd_v);
|
|
483
|
+
const Jp_new = clamp(p.Jp * oldJ / m2_determinant(p.F), 0.6, 20.0);
|
|
579
484
|
p.Jp = Jp_new;
|
|
580
485
|
}
|
|
581
486
|
}
|
|
@@ -13,7 +13,7 @@ export class Reference {
|
|
|
13
13
|
#onReleased = new Signal();
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Actual value being held
|
|
17
17
|
* @type {T}
|
|
18
18
|
* @private
|
|
19
19
|
*/
|
|
@@ -27,7 +27,7 @@ export class Reference {
|
|
|
27
27
|
*/
|
|
28
28
|
#is_bound = false;
|
|
29
29
|
|
|
30
|
-
get bound(){
|
|
30
|
+
get bound() {
|
|
31
31
|
return this.#is_bound;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -65,6 +65,10 @@ export class Reference {
|
|
|
65
65
|
return this.#value;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Release value being referenced. After this the held value is set to null
|
|
70
|
+
* This method is idempotent, calling it multiple times is safe
|
|
71
|
+
*/
|
|
68
72
|
release() {
|
|
69
73
|
if (!this.#is_bound) {
|
|
70
74
|
// not bound
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import { byteArrayToString } from "../../../core/binary/ByteArrayTools.js";
|
|
7
6
|
import { stringify } from "../../../core/json/JsonUtils.js";
|
|
7
|
+
import {byteArrayToString} from "../../../core/binary/byteArrayToString.js";
|
|
8
8
|
|
|
9
9
|
function JsonStringCodec() {
|
|
10
10
|
}
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
import MsgPackCodec from './MsgPackCodec.js';
|
|
7
7
|
|
|
8
8
|
import Storage from '../Storage.js';
|
|
9
|
-
import { byteArrayToString, stringToByteArray } from "../../../core/binary/ByteArrayTools.js";
|
|
10
9
|
import { InMemoryLocalStorage } from "./InMemoryLocalStorage.js";
|
|
10
|
+
import {stringToByteArray} from "../../../core/binary/stringToByteArray.js";
|
|
11
|
+
import {byteArrayToString} from "../../../core/binary/byteArrayToString.js";
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class LocalStorage extends Storage {
|
|
@@ -21,7 +21,7 @@ import { computeStringHash } from "../../../../core/primitives/strings/computeSt
|
|
|
21
21
|
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
22
22
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
23
23
|
import { compareStrings } from "../../../../core/primitives/strings/compareStrings.js";
|
|
24
|
-
import {
|
|
24
|
+
import { number_compare_ascending } from "../../../../core/primitives/numbers/number_compare_ascending.js";
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Convert decibel to percentage volume
|
|
@@ -159,36 +159,36 @@ export class SoundEmitter {
|
|
|
159
159
|
return channel;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
const distanceMin =
|
|
162
|
+
const distanceMin = number_compare_ascending(this.__distanceMin, other.__distanceMin);
|
|
163
163
|
|
|
164
164
|
if (distanceMin !== 0) {
|
|
165
165
|
return distanceMin;
|
|
166
166
|
}
|
|
167
|
-
const distanceMax =
|
|
167
|
+
const distanceMax = number_compare_ascending(this.__distanceMax, other.__distanceMax);
|
|
168
168
|
|
|
169
169
|
if (distanceMax !== 0) {
|
|
170
170
|
return distanceMax;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
const panningModel =
|
|
173
|
+
const panningModel = number_compare_ascending(this.panningModel, other.panningModel);
|
|
174
174
|
|
|
175
175
|
if (panningModel !== 0) {
|
|
176
176
|
return panningModel;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
const attenuation =
|
|
179
|
+
const attenuation = number_compare_ascending(this.attenuation, other.attenuation);
|
|
180
180
|
|
|
181
181
|
if (attenuation !== 0) {
|
|
182
182
|
return attenuation;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
const flags =
|
|
185
|
+
const flags = number_compare_ascending(this.flags, other.flags);
|
|
186
186
|
|
|
187
187
|
if (flags !== 0) {
|
|
188
188
|
return flags;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
const volume =
|
|
191
|
+
const volume = number_compare_ascending(this.volume.getValue(), other.volume.getValue());
|
|
192
192
|
|
|
193
193
|
if (volume !== 0) {
|
|
194
194
|
return volume;
|
|
@@ -5,7 +5,7 @@ import { computeStringHash } from "../../../../core/primitives/strings/computeSt
|
|
|
5
5
|
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
6
6
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
7
7
|
import { compareStrings } from "../../../../core/primitives/strings/compareStrings.js";
|
|
8
|
-
import {
|
|
8
|
+
import { number_compare_ascending } from "../../../../core/primitives/numbers/number_compare_ascending.js";
|
|
9
9
|
|
|
10
10
|
const DEFAULT_FLAGS = SoundTrackFlags.StartWhenReady;
|
|
11
11
|
|
|
@@ -120,8 +120,8 @@ export class SoundTrack {
|
|
|
120
120
|
// Make the sound source use the buffer and start playing it.
|
|
121
121
|
nodes.source.buffer = this.#buffer;
|
|
122
122
|
|
|
123
|
-
nodes.source.onended = ()=> {
|
|
124
|
-
if(!looping){
|
|
123
|
+
nodes.source.onended = () => {
|
|
124
|
+
if (!looping) {
|
|
125
125
|
this.clearFlag(SoundTrackFlags.Playing);
|
|
126
126
|
this.on.ended.send1(this);
|
|
127
127
|
}
|
|
@@ -167,7 +167,7 @@ export class SoundTrack {
|
|
|
167
167
|
return url;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
const time =
|
|
170
|
+
const time = number_compare_ascending(this.time, other.time);
|
|
171
171
|
|
|
172
172
|
if (time !== 0) {
|
|
173
173
|
return time;
|
|
@@ -179,13 +179,13 @@ export class SoundTrack {
|
|
|
179
179
|
return channel;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
const volume =
|
|
182
|
+
const volume = number_compare_ascending(this.__volume, other.__volume);
|
|
183
183
|
|
|
184
184
|
if (volume !== 0) {
|
|
185
185
|
return volume;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
const flags =
|
|
188
|
+
const flags = number_compare_ascending(this.flags, other.flags);
|
|
189
189
|
|
|
190
190
|
if (flags !== 0) {
|
|
191
191
|
return flags;
|
|
@@ -9,7 +9,7 @@ import { playTrackRealTime } from "../animation/playTrackRealTime.js";
|
|
|
9
9
|
import GUIElement from '../ecs/gui/GUIElement.js';
|
|
10
10
|
import ViewportPosition from '../ecs/gui/position/ViewportPosition.js';
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import Entity from '../ecs/Entity.js';
|
|
13
13
|
|
|
14
14
|
import ConfirmationDialogView from '../../view/elements/ConfirmationDialogView.js';
|
|
15
15
|
import SimpleWindowView from '../../view/elements/SimpleWindow.js';
|
|
@@ -127,10 +127,10 @@ function GUIEngine() {
|
|
|
127
127
|
* @param {View} content
|
|
128
128
|
* @param {string} title
|
|
129
129
|
* @param {View} [wrapper]
|
|
130
|
-
* @returns {
|
|
130
|
+
* @returns {Entity}
|
|
131
131
|
*/
|
|
132
132
|
GUIEngine.prototype.openWindow = function ({ closeable, content, title, wrapper }) {
|
|
133
|
-
const entityBuilder = new
|
|
133
|
+
const entityBuilder = new Entity();
|
|
134
134
|
|
|
135
135
|
function closeAction() {
|
|
136
136
|
entityBuilder.destroy();
|
|
@@ -219,7 +219,7 @@ GUIEngine.prototype.createModal = function ({ content, title, priority = 0 }) {
|
|
|
219
219
|
lifecycle.makeDestroyed();
|
|
220
220
|
});
|
|
221
221
|
|
|
222
|
-
const builder = new
|
|
222
|
+
const builder = new Entity();
|
|
223
223
|
|
|
224
224
|
builder.add(SerializationMetadata.Transient);
|
|
225
225
|
builder.add(GUIElement.fromView(overlay));
|
|
@@ -2,7 +2,7 @@ import NotificationLog from "../../notify/NotificationLog.js";
|
|
|
2
2
|
import { assert } from "../../../core/assert.js";
|
|
3
3
|
import { noop } from "../../../core/function/Functions.js";
|
|
4
4
|
import List from "../../../core/collection/list/List.js";
|
|
5
|
-
import
|
|
5
|
+
import Entity from "../../ecs/Entity.js";
|
|
6
6
|
import GUIElement from "../../ecs/gui/GUIElement.js";
|
|
7
7
|
import { SerializationMetadata } from "../../ecs/components/SerializationMetadata.js";
|
|
8
8
|
import { EventType } from "../../ecs/EntityManager.js";
|
|
@@ -148,7 +148,7 @@ export class NotificationManager {
|
|
|
148
148
|
addEmitterDisplay(channel, viewEmitter, grouping = null) {
|
|
149
149
|
/**
|
|
150
150
|
*
|
|
151
|
-
* @type {Map<View,
|
|
151
|
+
* @type {Map<View, Entity>}
|
|
152
152
|
*/
|
|
153
153
|
const views = new Map();
|
|
154
154
|
|
|
@@ -196,7 +196,7 @@ export class NotificationManager {
|
|
|
196
196
|
|
|
197
197
|
view.addClass(managedNotificationChannelClass);
|
|
198
198
|
|
|
199
|
-
const eb = new
|
|
199
|
+
const eb = new Entity();
|
|
200
200
|
|
|
201
201
|
//prevent serialization of the notification
|
|
202
202
|
eb.add(SerializationMetadata.Transient);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CellFilter } from "../../CellFilter.js";
|
|
2
2
|
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
3
3
|
import { assert } from "../../../../core/assert.js";
|
|
4
|
-
import { v3_angle_between } from "../../../../core/geom/v3_angle_between.js";
|
|
4
|
+
import { v3_angle_between } from "../../../../core/geom/vec3/v3_angle_between.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Distance from the reference point where support points will be sampled to compute derivative
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { inverseLerp } from "../../../../core/math/inverseLerp.js";
|
|
2
|
-
import { lerp } from "../../../../core/math/lerp.js";
|
|
3
1
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
4
2
|
import { GridTaskGenerator } from "../../GridTaskGenerator.js";
|
|
5
3
|
import TaskGroup from "../../../../core/process/task/TaskGroup.js";
|
|
@@ -24,6 +22,7 @@ import { MirGridLayers } from "../../../../../samples/generation/grid/MirGridLay
|
|
|
24
22
|
import { actionTask } from "../../../../core/process/task/util/actionTask.js";
|
|
25
23
|
import { countTask } from "../../../../core/process/task/util/countTask.js";
|
|
26
24
|
import { groupArrayBy } from "../../../../core/collection/array/groupArrayBy.js";
|
|
25
|
+
import { remap } from "../../../../core/math/remap.js";
|
|
27
26
|
|
|
28
27
|
const NODE_TYPE_ROAD_CONNECTOR = 'Road Connector';
|
|
29
28
|
|
|
@@ -427,8 +426,7 @@ function drawPath(path, actions, traversable, grid) {
|
|
|
427
426
|
for (let i = 0; i < n; i++) {
|
|
428
427
|
const index = pathIndices[i];
|
|
429
428
|
|
|
430
|
-
const
|
|
431
|
-
const thickness = lerp(sourceThickness, targetThickness, f);
|
|
429
|
+
const thickness = remap(0, n, sourceThickness, targetThickness, i);
|
|
432
430
|
|
|
433
431
|
const thickness_0 = Math.floor(thickness / 2);
|
|
434
432
|
const thickness_1 = Math.ceil(thickness / 2);
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
MeshLambertMaterial,
|
|
9
9
|
TetrahedronBufferGeometry
|
|
10
10
|
} from "three";
|
|
11
|
-
import
|
|
11
|
+
import Entity from "../../../engine/ecs/Entity.js";
|
|
12
12
|
import Renderable from "../../../engine/ecs/renderable/Renderable.js";
|
|
13
13
|
import { Transform } from "../../../engine/ecs/transform/Transform.js";
|
|
14
14
|
import LabelView from "../../../view/common/LabelView.js";
|
|
@@ -140,7 +140,7 @@ export function visualizeMarkers({
|
|
|
140
140
|
|
|
141
141
|
g.add(mark_size);
|
|
142
142
|
|
|
143
|
-
const entityBuilder = new
|
|
143
|
+
const entityBuilder = new Entity();
|
|
144
144
|
|
|
145
145
|
const renderable = new Renderable(g);
|
|
146
146
|
renderable.computeBoundsFromObject();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EngineHarness } from "../../engine/EngineHarness.js";
|
|
2
2
|
import { GridCellActionPlaceMarker } from "./GridCellActionPlaceMarker.js";
|
|
3
3
|
import { GridData } from "../grid/GridData.js";
|
|
4
|
-
import
|
|
4
|
+
import Entity from "../../engine/ecs/Entity.js";
|
|
5
5
|
import Mesh from "../../engine/graphics/ecs/mesh/Mesh.js";
|
|
6
6
|
import { MeshSystem } from "../../engine/graphics/ecs/mesh/MeshSystem.js";
|
|
7
7
|
import { GameAssetType } from "../../engine/asset/GameAssetType.js";
|
|
@@ -166,7 +166,7 @@ async function main(engine) {
|
|
|
166
166
|
|
|
167
167
|
function build_node(node, url) {
|
|
168
168
|
|
|
169
|
-
new
|
|
169
|
+
new Entity()
|
|
170
170
|
.add(node.transform)
|
|
171
171
|
.add(Mesh.fromJSON({
|
|
172
172
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
|
|
2
2
|
import { GridCellAction } from "../../GridCellAction.js";
|
|
3
|
-
import { compareNumbers } from "../../../../../core/primitives/numbers/compareNumbers.js";
|
|
4
3
|
import { assert } from "../../../../../core/assert.js";
|
|
5
4
|
import { binarySearchHighIndex } from "../../../../../core/collection/array/binarySearchHighIndex.js";
|
|
5
|
+
import { number_compare_ascending } from "../../../../../core/primitives/numbers/number_compare_ascending.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -111,7 +111,7 @@ export class CellActionSelectWeightedRandom extends GridCellAction {
|
|
|
111
111
|
|
|
112
112
|
const targetWeight = this.__random() * totalWeight;
|
|
113
113
|
|
|
114
|
-
const index = binarySearchHighIndex(evaluatedWeights, targetWeight,
|
|
114
|
+
const index = binarySearchHighIndex(evaluatedWeights, targetWeight, number_compare_ascending, 0, n - 1);
|
|
115
115
|
|
|
116
116
|
const targetElement = elements[index];
|
|
117
117
|
|
|
@@ -5,7 +5,6 @@ import { TerrainLayerRuleAggregator } from "./TerrainLayerRuleAggregator.js";
|
|
|
5
5
|
import { Sampler2D } from "../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
6
6
|
import Task from "../../core/process/task/Task.js";
|
|
7
7
|
import { TaskSignal } from "../../core/process/task/TaskSignal.js";
|
|
8
|
-
import { compareNumbers } from "../../core/primitives/numbers/compareNumbers.js";
|
|
9
8
|
import TaskGroup from "../../core/process/task/TaskGroup.js";
|
|
10
9
|
import Future from "../../core/process/Future.js";
|
|
11
10
|
import { optimizeIndividualMeshesEntitiesToInstances } from "../../engine/ecs/foliage/ecs/InstancedMeshUtils.js";
|
|
@@ -20,6 +19,7 @@ import { actionTask } from "../../core/process/task/util/actionTask.js";
|
|
|
20
19
|
import { countTask } from "../../core/process/task/util/countTask.js";
|
|
21
20
|
import { emptyTask } from "../../core/process/task/util/emptyTask.js";
|
|
22
21
|
import { futureTask } from "../../core/process/task/util/futureTask.js";
|
|
22
|
+
import { number_compare_ascending } from "../../core/primitives/numbers/number_compare_ascending.js";
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
@@ -431,7 +431,7 @@ export class ThemeEngine {
|
|
|
431
431
|
//select a theme
|
|
432
432
|
const t = randomFloatBetween(random, 0, influenceSum);
|
|
433
433
|
|
|
434
|
-
const themeIndex = binarySearchLowIndex(themeInfluence, t,
|
|
434
|
+
const themeIndex = binarySearchLowIndex(themeInfluence, t, number_compare_ascending);
|
|
435
435
|
|
|
436
436
|
const themeArea = themeAreas[themeIndex];
|
|
437
437
|
|
package/src/view/View.js
CHANGED
|
@@ -10,7 +10,8 @@ import Signal from "../core/events/signal/Signal.js";
|
|
|
10
10
|
import { SignalBinding } from "../core/events/signal/SignalBinding.js";
|
|
11
11
|
import { assert } from "../core/assert.js";
|
|
12
12
|
import Vector1 from "../core/geom/Vector1.js";
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
import { m3_cm_compose_transform } from "../core/geom/mat3/m3_cm_compose_transform.js";
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
const scratch_m3_0 = new Float32Array(9);
|
|
@@ -362,10 +363,10 @@ class View {
|
|
|
362
363
|
* @returns {View}
|
|
363
364
|
*/
|
|
364
365
|
addChild(child) {
|
|
365
|
-
assert.
|
|
366
|
-
assert.
|
|
367
|
-
assert.
|
|
368
|
-
assert.
|
|
366
|
+
assert.defined(child, 'child');
|
|
367
|
+
assert.notNull(child, 'child');
|
|
368
|
+
assert.isInstanceOf(child, View, 'child');
|
|
369
|
+
assert.equal(child.isLinked, false, 'child is already linked somewhere');
|
|
369
370
|
|
|
370
371
|
child.parent = this;
|
|
371
372
|
|
|
@@ -425,18 +426,25 @@ class View {
|
|
|
425
426
|
/**
|
|
426
427
|
*
|
|
427
428
|
* @param {View} child
|
|
429
|
+
* @returns {boolean}
|
|
428
430
|
*/
|
|
429
431
|
removeChild(child) {
|
|
430
|
-
const
|
|
431
|
-
if (i !== -1) {
|
|
432
|
-
this.children.splice(i, 1);
|
|
433
|
-
this.el.removeChild(child.el);
|
|
434
|
-
child.unlink();
|
|
432
|
+
const children = this.children;
|
|
435
433
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
434
|
+
const i = children.indexOf(child);
|
|
435
|
+
|
|
436
|
+
if (i === -1) {
|
|
437
|
+
//console.warn('Child not found. this:', this, 'child:', child);
|
|
438
|
+
return false;
|
|
439
439
|
}
|
|
440
|
+
|
|
441
|
+
children.splice(i, 1);
|
|
442
|
+
this.el.removeChild(child.el);
|
|
443
|
+
child.unlink();
|
|
444
|
+
|
|
445
|
+
child.parent = null;
|
|
446
|
+
|
|
447
|
+
return true;
|
|
440
448
|
}
|
|
441
449
|
|
|
442
450
|
/**
|
|
@@ -2,8 +2,8 @@ import GuiControl from "../controller/controls/GuiControl.js";
|
|
|
2
2
|
import { GaugeView } from "../../../editor/view/ecs/components/color/GaugeView.js";
|
|
3
3
|
import Vector1 from "../../core/geom/Vector1.js";
|
|
4
4
|
import { drawCheckers } from "../../../editor/view/ecs/components/particles/ColorParameterLUTController.js";
|
|
5
|
-
import { hsv2rgb } from "../../core/color/hsv2rgb.js";
|
|
6
|
-
import { rgb2hsv } from "../../core/color/rgb2hsv.js";
|
|
5
|
+
import { hsv2rgb } from "../../core/color/hsv/hsv2rgb.js";
|
|
6
|
+
import { rgb2hsv } from "../../core/color/hsv/rgb2hsv.js";
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
export class ColorPickerView extends GuiControl {
|