@woosh/meep-engine 2.37.18 → 2.38.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/core/assert.js +1 -1
- package/core/binary/float2uint8.js +8 -0
- package/core/binary/uint82float.js +8 -0
- package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +6 -4
- package/core/collection/array/array_get_index_in_range.js +16 -0
- package/core/collection/array/typed/isTypedArray.js +20 -0
- package/core/collection/array/typedArrayToDataType.js +1 -0
- package/{engine/navigation/grid → core/collection/heap}/BinaryHeap.js +6 -1
- package/{engine/navigation/grid → core/collection/heap}/FastBinaryHeap.js +3 -2
- package/{engine/navigation/grid → core/collection/heap}/FastBinaryHeap.spec.js +3 -3
- package/core/collection/heap/Uin32Heap.spec.js +59 -0
- package/core/collection/heap/Uint32Heap.js +385 -0
- package/core/collection/list/List.d.ts +1 -1
- package/core/collection/table/RowFirstTable.js +34 -0
- package/core/collection/table/RowFirstTable.spec.js +59 -1
- package/core/color/Color.js +83 -1
- package/core/color/YCbCr_to_rgb_uint24.js +3 -4
- package/core/color/hsv2rgb.js +4 -3
- package/core/color/linear_to_sRGB.js +4 -5
- package/core/color/rgb2hex.js +1 -1
- package/core/color/rgb2uint24.js +6 -4
- package/core/color/rgb_to_YCbCr_uint24.js +11 -13
- package/core/events/signal/Signal.d.ts +11 -9
- package/core/events/signal/Signal.spec.js +16 -0
- package/core/geom/2d/quad-tree/qt_collect_by_circle.js +67 -0
- package/core/geom/3d/topology/computeTopoMeshVertexDuplicates.js +9 -6
- package/core/geom/3d/topology/expandConnectivityByLocality.js +5 -5
- package/core/geom/3d/topology/query/query_edge_is_boundary.js +7 -0
- package/core/geom/3d/topology/query/query_edge_is_manifold.js +13 -0
- package/core/geom/3d/topology/query/query_edge_is_manifold_or_boundary.js +11 -0
- package/core/geom/3d/topology/query/query_edge_is_wire.js +13 -0
- package/core/geom/3d/topology/query/query_edge_other_vertex.js +20 -0
- package/core/geom/3d/topology/query/query_edge_share_vert.js +9 -0
- package/core/geom/3d/topology/query/query_face_get_other_edges.js +39 -0
- package/core/geom/3d/topology/query/query_face_next_vertex.js +19 -0
- package/core/geom/3d/topology/query/query_face_prev_vertex.js +18 -0
- package/core/geom/3d/topology/query/query_vertex_in_edge.js +14 -0
- package/core/geom/3d/topology/query/query_vertex_pair_share_face.js +24 -0
- package/core/geom/3d/topology/query/query_vertices_in_edge.js +19 -0
- package/core/geom/3d/topology/simplify/collapseEdge.spec.js +3 -5
- package/core/geom/3d/topology/simplify/collapse_all_degenerate_edges.js +8 -10
- package/core/geom/3d/topology/simplify/compute_face_normal_change_dot_product.js +12 -2
- package/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +277 -0
- package/core/geom/3d/topology/simplify/edge_collapse_quadratic.js +126 -0
- package/core/geom/3d/topology/simplify/prototypeMeshSimplification.js +502 -0
- package/core/geom/3d/topology/simplify/quadratic/Quadratic3.js +37 -5
- package/core/geom/3d/topology/simplify/quadratic/build_vertex_quadratics.js +86 -1
- package/core/geom/3d/topology/simplify/simplifyTopoMesh.js +4 -4
- package/core/geom/3d/topology/simplify/simplifyTopoMesh2.js +119 -0
- package/core/geom/3d/topology/simplify/tm_edge_collapse_is_degenerate_flip.js +81 -0
- package/core/geom/3d/topology/{TopoEdge.js → struct/TopoEdge.js} +47 -20
- package/core/geom/3d/topology/{TopoEdge.spec.js → struct/TopoEdge.spec.js} +0 -0
- package/core/geom/3d/topology/{TopoMesh.js → struct/TopoMesh.js} +20 -41
- package/core/geom/3d/topology/{TopoTriangle.js → struct/TopoTriangle.js} +15 -25
- package/core/geom/3d/topology/{TopoVertex.js → struct/TopoVertex.js} +21 -4
- package/core/geom/3d/topology/{TopoVertex.spec.js → struct/TopoVertex.spec.js} +0 -0
- package/core/geom/3d/topology/tm_edge_kill.js +24 -0
- package/core/geom/3d/topology/tm_edge_splice.js +42 -0
- package/core/geom/3d/topology/tm_face_area.js +18 -0
- package/core/geom/3d/topology/tm_face_kill.js +12 -0
- package/core/geom/3d/topology/tm_face_normal.js +14 -0
- package/core/geom/3d/topology/tm_kill_only_edge.js +35 -0
- package/core/geom/3d/topology/tm_kill_only_face.js +12 -0
- package/core/geom/3d/topology/tm_kill_only_vert.js +14 -0
- package/core/geom/3d/topology/tm_vert_kill.js +19 -0
- package/core/geom/3d/topology/tm_vert_splice.js +64 -0
- package/core/geom/3d/topology/tm_vertex_compute_normal.js +42 -0
- package/core/geom/3d/topology/topoMeshToBufferGeometry.js +18 -4
- package/core/geom/3d/topology/weld_duplicate_vertices.js +63 -0
- package/core/geom/Quaternion.d.ts +21 -1
- package/core/geom/Quaternion.js +279 -200
- package/core/geom/Quaternion.spec.js +71 -2
- package/core/geom/Vector2.js +3 -3
- package/core/geom/Vector3.d.ts +2 -0
- package/core/geom/Vector3.js +31 -7
- package/core/geom/Vector3.schema.json +16 -0
- package/core/geom/Vector4.js +16 -0
- package/core/geom/packing/MaxRectangles.js +1 -1
- package/core/graph/cluster_mesh_metis.js +16 -0
- package/core/graph/coarsen_graph.js +1 -1
- package/core/graph/graph_k_means_cluster.js +1 -1
- package/core/json/JsonUtils.js +2 -20
- package/core/math/bell_membership_function.js +19 -0
- package/core/math/exp2.js +8 -0
- package/core/math/interval/NumericInterval.js +17 -0
- package/core/math/physics/brdf/brdf_burley.js +25 -0
- package/core/math/physics/bsdf/bsdf_schlick.js +22 -0
- package/core/math/physics/irradiance/interpolate_irradiance_linear.js +18 -0
- package/{engine/sound/ecs/emitter/attenuate/attenuateSoundLogarithmic.js → core/math/physics/irradiance/interpolate_irradiance_lograrithmic.js} +2 -2
- package/{engine/sound/ecs/emitter/attenuate/attenuateSoundSmith.js → core/math/physics/irradiance/interpolate_irradiance_smith.js} +1 -1
- package/core/math/random/seededRandom.js +2 -31
- package/core/math/random/seededRandom_Mulberry32.js +31 -0
- package/core/math/random/seededRandom_sine.js +33 -0
- package/core/model/ObservedEnum.js +8 -0
- package/editor/Editor.js +97 -1
- package/editor/actions/concrete/ModifyPatchSampler2DAction.js +118 -0
- package/editor/actions/concrete/ModifyPatchSampler2DAction.spec.js +30 -0
- package/editor/actions/concrete/PatchTerrainHeightAction.js +13 -105
- package/editor/ecs/component/FieldDescriptor.js +34 -0
- package/editor/ecs/component/FieldValueAdapter.js +20 -0
- package/editor/ecs/component/TypeEditor.js +33 -0
- package/editor/ecs/component/TypeSchema.d.ts +38 -0
- package/editor/ecs/component/createFieldEditor.js +90 -0
- package/editor/ecs/component/createObjectEditor.js +266 -60
- package/editor/ecs/component/editors/ColorEditor.js +39 -0
- package/editor/ecs/component/editors/HTMLElementEditor.js +17 -0
- package/editor/ecs/component/editors/ImagePathEditor.js +50 -0
- package/editor/ecs/component/editors/NumericIntervalEditor.js +86 -0
- package/editor/ecs/component/editors/ObservedBooleanEditor.js +13 -0
- package/editor/ecs/component/editors/ObservedEnumEditor.js +32 -0
- package/editor/ecs/component/editors/ObservedIntegerEditor.js +43 -0
- package/editor/ecs/component/editors/ObservedStringEditor.js +51 -0
- package/editor/ecs/component/editors/Sampler2DEditor.js +107 -0
- package/editor/ecs/component/editors/collection/ListEditor.js +83 -0
- package/editor/ecs/component/editors/common/BitFlagsEditor.js +80 -0
- package/editor/ecs/component/editors/common/EnumEditor.js +41 -0
- package/editor/ecs/component/editors/common/makeV3_editor.js +85 -0
- package/editor/ecs/component/editors/common/noEditor.js +9 -0
- package/editor/ecs/component/editors/ecs/GridObstacleEditor.js +17 -0
- package/editor/ecs/component/editors/ecs/MinimapMarkerEditor.js +16 -0
- package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.js +44 -0
- package/editor/ecs/component/editors/ecs/ParameterTrackEditor.js +17 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterEditor.js +58 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.js +54 -0
- package/editor/ecs/component/editors/ecs/SimulationStepDefinitionEditor.js +21 -0
- package/editor/ecs/component/editors/ecs/Trail2DEditor.js +33 -0
- package/editor/ecs/component/editors/ecs/TransformEditor.js +23 -0
- package/editor/ecs/component/editors/ecs/terrain/SplatMappingEditor.js +21 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainEditor.js +89 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainLayerEditor.js +18 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainLayersEditor.js +22 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainOverlayEditor.js +20 -0
- package/editor/ecs/component/editors/geom/QuaternionEditor.js +56 -0
- package/editor/ecs/component/editors/geom/Vector1Editor.js +57 -0
- package/editor/ecs/component/editors/geom/Vector2Editor.js +11 -0
- package/editor/ecs/component/editors/geom/Vector3Editor.js +13 -0
- package/editor/ecs/component/editors/geom/Vector4Editor.js +12 -0
- package/editor/ecs/component/editors/primitive/ArrayEditor.js +46 -0
- package/editor/ecs/component/editors/primitive/BooleanEditor.js +27 -0
- package/editor/ecs/component/editors/primitive/FunctionEditor.js +29 -0
- package/editor/ecs/component/editors/primitive/NumberEditor.js +60 -0
- package/editor/ecs/component/editors/primitive/ObjectEditor.js +12 -0
- package/editor/ecs/component/editors/primitive/StringEditor.js +31 -0
- package/editor/ecs/component/editors/three/BufferGeometryEditor.js +28 -0
- package/editor/ecs/component/editors/three/MaterialEditor.js +27 -0
- package/editor/ecs/component/editors/three/MeshEditor.js +35 -0
- package/editor/ecs/component/editors/three/TextureEditor.js +32 -0
- package/editor/ecs/component/findNearestRegisteredType.js +59 -0
- package/editor/ecs/component/prototypeObjectEditor.js +379 -0
- package/editor/tools/SelectionTool.js +1 -1
- package/editor/tools/paint/TerrainHeightPaintTool.js +88 -68
- package/editor/tools/paint/TerrainPaintTool.js +2 -1
- package/editor/tools/paint/TerrainTexturePaintTool.js +8 -73
- package/editor/view/EditorView.js +1 -1
- package/editor/view/ecs/ComponentControlView.js +2 -30
- package/editor/view/ecs/EntityEditor.js +61 -139
- package/editor/view/ecs/components/GridObstacleController.js +4 -4
- package/editor/view/ecs/components/TerrainController.js +1 -1
- package/editor/view/ecs/components/common/NumberController.js +19 -7
- package/editor/view/node-graph/NodeGraphView.js +2 -2
- package/editor/view/node-graph/NodeView.js +7 -9
- package/engine/animation/keyed2/AnimationTrack.js +1 -1
- package/engine/asset/AssetManager.d.ts +1 -1
- package/engine/asset/AssetManager.js +390 -388
- package/engine/asset/loaders/gltf/extensions/MSFT_texture_dds.js +14 -2
- package/engine/ecs/components/TagEditor.js +15 -0
- package/engine/ecs/fow/FogOfWarEditor.js +13 -0
- package/engine/ecs/parent/ParentEntitySystem.js +57 -0
- package/engine/ecs/terrain/ecs/OffsetScaleTransform2D.d.ts +6 -0
- package/engine/ecs/terrain/ecs/Terrain.js +44 -43
- package/engine/ecs/terrain/ecs/TerrainSystem.js +2 -2
- package/engine/ecs/terrain/ecs/layers/TerrainLayer.js +1 -1
- package/engine/ecs/terrain/ecs/splat/SplatMapping.js +26 -28
- package/engine/ecs/terrain/overlay/TerrainOverlay.js +71 -66
- package/engine/ecs/terrain/tiles/TerrainTileManager.js +23 -0
- package/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +1 -1
- package/engine/ecs/terrain/util/paintTerrainOverlayViaLookupTable.js +13 -7
- package/engine/ecs/terrain/util/tensionOptimizeUV.js +1 -1
- package/engine/ecs/transform/Transform.d.ts +2 -0
- package/engine/ecs/transform/Transform.editor.schema.json +16 -0
- package/engine/ecs/transform/Transform.js +3 -0
- package/engine/graphics/ecs/highlight/HighlightEditor.js +17 -0
- package/engine/graphics/ecs/light/Light.js +0 -47
- package/engine/graphics/ecs/light/LightSerializationAdapter.js +50 -0
- package/engine/graphics/ecs/mesh/MeshEditor.js +28 -0
- package/engine/graphics/ecs/mesh-v2/DrawMode.js +2 -1
- package/engine/graphics/ecs/mesh-v2/aggregate/prototypeSGMesh.js +3 -3
- package/engine/graphics/ecs/mesh-v2/build_three_object.js +3 -1
- package/engine/graphics/ecs/mesh-v2/sg_compute_hierarchy_bounding_box_by_parent_entity.js +31 -0
- package/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.d.ts +4 -0
- package/engine/graphics/ecs/sprite/Sprite.js +11 -0
- package/engine/graphics/ecs/sprite/SpriteSystemPE.js +133 -0
- package/engine/graphics/ecs/sprite/prototypeSpriteSystem.js +1570 -0
- package/engine/graphics/micron/build/PatchRepresentation.js +7 -3
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +18 -8
- package/engine/graphics/micron/build/clustering/build_clustering_2.js +1 -1
- package/engine/graphics/micron/build/clustering/build_leaf_patches.js +2 -2
- package/engine/graphics/micron/build/clustering/build_leaf_patches_metis.js +1 -1
- package/engine/graphics/micron/build/hierarchy/buildAbstractPatchHierarchy.js +21 -3
- package/engine/graphics/micron/build/hierarchy/merge_patches.js +96 -43
- package/engine/graphics/micron/build/hierarchy/qvdr_build_simplified_clusters.js +11 -5
- package/engine/graphics/micron/format/VirtualGeometry.js +46 -3
- package/engine/graphics/micron/format/micron_build_proxy_geometry.js +4 -2
- package/engine/graphics/micron/prototypeVirtualGeometry.js +47 -10
- package/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +17 -17
- package/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +15 -3
- package/engine/graphics/micron/simplifyGeometry.js +1 -1
- package/engine/graphics/particles/particular/engine/ParticularEngine.js +5 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +17 -9
- package/engine/graphics/particles/particular/engine/renderers/ParticleRenderer.js +12 -10
- package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +7 -2
- package/engine/graphics/particles/particular/engine/renderers/billboard/SoftBillboardParticlePool.js +27 -0
- package/engine/graphics/particles/particular/engine/renderers/billboard/SoftBillboardParticleRenderer.js +80 -0
- package/engine/graphics/particles/particular/engine/shader/ShaderManager.js +16 -4
- package/engine/graphics/shaders/TerrainShader.js +8 -8
- package/engine/graphics/texture/atlas/TextureAtlasDebugger.js +2 -1
- package/engine/graphics/texture/sampler/Sampler2D.js +206 -201
- package/engine/graphics/texture/sampler/Sampler2D.spec.js +34 -35
- package/engine/graphics/texture/sampler/bicubic.js +59 -0
- package/engine/graphics/texture/sampler/downsampleSample2D.spec.js +2 -2
- package/engine/graphics/texture/sampler/genericResampleSampler2D.js +0 -2
- package/engine/graphics/texture/sampler/prototypeSamplerFiltering.js +146 -0
- package/engine/graphics/texture/sampler/{downsampleSampler2D.js → sampler2D_scale_down_linear.js} +8 -4
- package/engine/graphics/texture/sampler/sampler2_d_scale_down_lanczos.js +140 -0
- package/engine/graphics/texture/sampler/scaleSampler2D.js +3 -3
- package/engine/graphics/texture/sampler/writeSampler2DDataToDataTexture.js +1 -1
- package/engine/graphics/util/ScaleObject3ToBox.js +14 -1
- package/engine/graphics/util/makeMeshPreviewScene.js +2 -1
- package/engine/grid/components/GridObstacle.js +0 -44
- package/engine/grid/components/GridObstacleSerializationAdapter.js +46 -0
- package/engine/input/devices/PointerDevice.d.ts +1 -1
- package/engine/input/devices/PointerDevice.js +17 -2
- package/engine/input/ecs/util/TerrainCameraTargetSampler.js +2 -2
- package/engine/navigation/ecs/components/Path.d.ts +2 -0
- package/engine/navigation/ecs/components/Path.js +6 -1
- package/engine/navigation/ecs/components/computeNonuniformCatmullRomSplineSample.js +117 -0
- package/engine/navigation/grid/AStar.js +1 -1
- package/engine/navigation/grid/GridField.js +3 -2
- package/engine/platform/GetURLHash.js +27 -0
- package/engine/platform/WebEnginePlatform.js +1 -22
- package/engine/sound/ecs/emitter/SoundEmitter.js +10 -6
- package/engine/ui/DraggableAspect.js +2 -2
- package/generation/GridGenerator.js +7 -6
- package/generation/example/SampleGenerator0.js +39 -35
- package/generation/example/filters/SampleGroundMoistureFilter.js +58 -17
- package/generation/example/generators/interactive/mir_generator_place_buff_objects.js +7 -6
- package/generation/example/generators/mir_generator_place_bases.js +7 -3
- package/generation/example/generators/mir_generator_place_road_decorators.js +3 -3
- package/generation/example/generators/mir_generator_place_starting_point.js +3 -2
- package/generation/example/themes/SampleTheme0.js +11 -7
- package/generation/filtering/numeric/CellFilterLiteralFloat.js +5 -0
- package/generation/filtering/numeric/complex/CellFilterDilate.js +36 -0
- package/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +15 -5
- package/generation/filtering/numeric/complex/CellFilterSimplexNoise.js +53 -1
- package/generation/filtering/numeric/math/CellFilterMax2.js +3 -0
- package/generation/filtering/numeric/math/CellFilterMembershipGeneralizedBell.js +55 -0
- package/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.js +42 -0
- package/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.js +36 -0
- package/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js +41 -0
- package/generation/grid/GridData.d.ts +5 -1
- package/generation/grid/GridData.js +35 -36
- package/generation/grid/MarkerMatchCounter.js +5 -3
- package/generation/grid/generation/discrete/GridTaskConnectRooms.js +1 -1
- package/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +1 -1
- package/generation/grid/generation/discrete/layer/GridTaskDistanceToMarkers.js +1 -1
- package/generation/grid/generation/road/GridTaskGenerateRoads.js +1 -1
- package/generation/markers/GridActionRuleSet.js +15 -32
- package/generation/markers/GridCellActionPlaceMarker.js +12 -8
- package/generation/markers/debug/visualizeMarkers.js +56 -36
- package/generation/markers/emitter/MarkerNodeEmitterFromAction.js +8 -8
- package/generation/markers/prototypeGridCellActionPlaceMarker.js +209 -0
- package/generation/markers/transform/MarkerNodeTransformerOffsetPosition.js +1 -5
- package/generation/markers/transform/MarkerNodeTransformerYRotateByFilterGradient.spec.js +2 -2
- package/generation/placement/GridCellPlacementRule.js +31 -25
- package/generation/theme/ThemeEngine.js +1 -1
- package/package.json +1 -1
- package/samples/terrain/from_image.js +7 -3
- package/samples/terrain/main.js +1 -1
- package/view/View.js +23 -1
- package/view/common/LabelView.js +1 -1
- package/view/compose3x3transform.js +32 -8
- package/view/controller/dat/DatGuiUtils.js +1 -1
- package/view/elements/DropDownSelectionView.js +11 -3
- package/view/elements/image/ImageView.js +3 -1
- package/core/model/ObservedReal.js +0 -55
- package/editor/ecs/component/ObjectEditor.js +0 -0
- package/engine/graphics/particles/particular/engine/renderers/SoftBillboardParticleRenderer.js +0 -7
- package/engine/sound/ecs/emitter/attenuate/attenuateSoundLinear.js +0 -11
- package/generation/filtering/numeric/CellFilterReadGridLayer.js +0 -73
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { EngineHarness } from "../../engine/EngineHarness.js";
|
|
2
|
+
import { GridCellActionPlaceMarker } from "./GridCellActionPlaceMarker.js";
|
|
3
|
+
import { GridData } from "../grid/GridData.js";
|
|
4
|
+
import EntityBuilder from "../../engine/ecs/EntityBuilder.js";
|
|
5
|
+
import Mesh from "../../engine/graphics/ecs/mesh/Mesh.js";
|
|
6
|
+
import { MeshSystem } from "../../engine/graphics/ecs/mesh/MeshSystem.js";
|
|
7
|
+
import { GameAssetType } from "../../engine/asset/GameAssetType.js";
|
|
8
|
+
import { GLTFAssetLoader } from "../../engine/asset/loaders/GLTFAssetLoader.js";
|
|
9
|
+
import {
|
|
10
|
+
AmbientOcclusionPostProcessEffect
|
|
11
|
+
} from "../../engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
|
|
12
|
+
import { MarkerNodeEmitterFromAction } from "./emitter/MarkerNodeEmitterFromAction.js";
|
|
13
|
+
import { Transform } from "../../engine/ecs/transform/Transform.js";
|
|
14
|
+
import { MarkerNodeTransformerOffsetPosition } from "./transform/MarkerNodeTransformerOffsetPosition.js";
|
|
15
|
+
import { MarkerNodeConsumerBuffer } from "./emitter/MarkerNodeConsumerBuffer.js";
|
|
16
|
+
import { normalize_angle_rad } from "../../core/geom/normalize_angle_rad.js";
|
|
17
|
+
|
|
18
|
+
const harness = new EngineHarness();
|
|
19
|
+
|
|
20
|
+
const corner = MarkerNodeEmitterFromAction.from([
|
|
21
|
+
GridCellActionPlaceMarker.from({
|
|
22
|
+
type: 'Construction-Corner-L',
|
|
23
|
+
size: 0.2,
|
|
24
|
+
tags: ['wall-segment-damaged'],
|
|
25
|
+
transform: Transform.fromJSON({
|
|
26
|
+
scale: 0.1
|
|
27
|
+
})
|
|
28
|
+
}),
|
|
29
|
+
GridCellActionPlaceMarker.from({
|
|
30
|
+
type: 'Virtual',
|
|
31
|
+
size: 0.1,
|
|
32
|
+
transform: Transform.fromJSON({
|
|
33
|
+
scale: 0.1
|
|
34
|
+
}),
|
|
35
|
+
transformers: [
|
|
36
|
+
MarkerNodeTransformerOffsetPosition.from(-0.2, 0)
|
|
37
|
+
]
|
|
38
|
+
}),
|
|
39
|
+
GridCellActionPlaceMarker.from({
|
|
40
|
+
type: 'Virtual',
|
|
41
|
+
size: 0.1,
|
|
42
|
+
transform: Transform.fromJSON({
|
|
43
|
+
scale: 0.1
|
|
44
|
+
}),
|
|
45
|
+
transformers: [
|
|
46
|
+
MarkerNodeTransformerOffsetPosition.from(-0.4, 0)
|
|
47
|
+
]
|
|
48
|
+
}),
|
|
49
|
+
GridCellActionPlaceMarker.from({
|
|
50
|
+
type: 'Virtual',
|
|
51
|
+
size: 0.1,
|
|
52
|
+
transform: Transform.fromJSON({
|
|
53
|
+
scale: 0.1
|
|
54
|
+
}),
|
|
55
|
+
transformers: [
|
|
56
|
+
MarkerNodeTransformerOffsetPosition.from(-0.6, 0)
|
|
57
|
+
]
|
|
58
|
+
}),
|
|
59
|
+
GridCellActionPlaceMarker.from({
|
|
60
|
+
type: 'Virtual',
|
|
61
|
+
size: 0.13,
|
|
62
|
+
transform: Transform.fromJSON({
|
|
63
|
+
scale: 0.1
|
|
64
|
+
}),
|
|
65
|
+
tags: ['wall-segment-end'],
|
|
66
|
+
transformers: [
|
|
67
|
+
MarkerNodeTransformerOffsetPosition.from(-0.83, 0)
|
|
68
|
+
]
|
|
69
|
+
}),
|
|
70
|
+
|
|
71
|
+
//wall 2
|
|
72
|
+
GridCellActionPlaceMarker.from({
|
|
73
|
+
type: 'Virtual',
|
|
74
|
+
size: 0.1,
|
|
75
|
+
transform: Transform.fromJSON({
|
|
76
|
+
scale: 0.1
|
|
77
|
+
}),
|
|
78
|
+
transformers: [
|
|
79
|
+
MarkerNodeTransformerOffsetPosition.from(0, -0.2)
|
|
80
|
+
]
|
|
81
|
+
}),
|
|
82
|
+
GridCellActionPlaceMarker.from({
|
|
83
|
+
type: 'Virtual',
|
|
84
|
+
size: 0.1,
|
|
85
|
+
transform: Transform.fromJSON({
|
|
86
|
+
scale: 0.1
|
|
87
|
+
}),
|
|
88
|
+
transformers: [
|
|
89
|
+
MarkerNodeTransformerOffsetPosition.from(0, -0.4)
|
|
90
|
+
]
|
|
91
|
+
}),
|
|
92
|
+
GridCellActionPlaceMarker.from({
|
|
93
|
+
type: 'Virtual',
|
|
94
|
+
size: 0.1,
|
|
95
|
+
transform: Transform.fromJSON({
|
|
96
|
+
scale: 0.1
|
|
97
|
+
}),
|
|
98
|
+
transformers: [
|
|
99
|
+
MarkerNodeTransformerOffsetPosition.from(0, -0.6)
|
|
100
|
+
]
|
|
101
|
+
}),
|
|
102
|
+
GridCellActionPlaceMarker.from({
|
|
103
|
+
type: 'Virtual',
|
|
104
|
+
size: 0.13,
|
|
105
|
+
tags: ['wall-segment-end'],
|
|
106
|
+
transform: Transform.fromJSON({
|
|
107
|
+
scale: 0.1
|
|
108
|
+
}),
|
|
109
|
+
transformers: [
|
|
110
|
+
MarkerNodeTransformerOffsetPosition.from(0, -0.83)
|
|
111
|
+
]
|
|
112
|
+
})
|
|
113
|
+
]);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
*
|
|
117
|
+
* @param {Engine} engine
|
|
118
|
+
*/
|
|
119
|
+
async function main(engine) {
|
|
120
|
+
EngineHarness.buildBasics({
|
|
121
|
+
engine
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const action = GridCellActionPlaceMarker.from({
|
|
125
|
+
type: 'X',
|
|
126
|
+
size: 1
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const grid = new GridData();
|
|
130
|
+
|
|
131
|
+
grid.resize(50, 50);
|
|
132
|
+
|
|
133
|
+
corner.initialize(grid, 0);
|
|
134
|
+
|
|
135
|
+
const GRID_CENTER_X = 12;
|
|
136
|
+
const GRID_CENTER_Y = 12;
|
|
137
|
+
|
|
138
|
+
const GRID_SIZE = 0;
|
|
139
|
+
const ANGLE_STEP = Math.PI * 2 / (GRID_SIZE * GRID_SIZE);
|
|
140
|
+
const GRID_SPACING = 4;
|
|
141
|
+
|
|
142
|
+
const buffer = new MarkerNodeConsumerBuffer();
|
|
143
|
+
|
|
144
|
+
for (let i = 0; i < GRID_SIZE * GRID_SIZE; i++) {
|
|
145
|
+
const angle = i * ANGLE_STEP;
|
|
146
|
+
|
|
147
|
+
const x = i % GRID_SIZE;
|
|
148
|
+
|
|
149
|
+
const y = Math.floor(i / GRID_SIZE);
|
|
150
|
+
|
|
151
|
+
const _x = GRID_CENTER_X - (GRID_SPACING * GRID_SIZE) * 0.5 + x * GRID_SPACING;
|
|
152
|
+
const _y = GRID_CENTER_Y - (GRID_SPACING * GRID_SIZE) * 0.5 + y * GRID_SPACING;
|
|
153
|
+
|
|
154
|
+
corner.execute(grid, _x, _y, angle, buffer);
|
|
155
|
+
|
|
156
|
+
// const node = action.buildNode(grid, _x, _y, angle);
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
corner.execute(grid, 12, 12, (Math.PI / 2) * 0, buffer);
|
|
162
|
+
corner.execute(grid, 14, 12, (Math.PI / 2) * 1, buffer);
|
|
163
|
+
corner.execute(grid, 16, 12, (Math.PI / 2) * 2, buffer);
|
|
164
|
+
corner.execute(grid, 18, 12, normalize_angle_rad((Math.PI / 2) * 3), buffer);
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
function build_node(node, url) {
|
|
168
|
+
|
|
169
|
+
new EntityBuilder()
|
|
170
|
+
.add(node.transform)
|
|
171
|
+
.add(Mesh.fromJSON({
|
|
172
|
+
|
|
173
|
+
url: url
|
|
174
|
+
}))
|
|
175
|
+
.build(engine.entityManager.dataset);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
console.warn(buffer);
|
|
179
|
+
|
|
180
|
+
for (let i = 0; i < buffer.size(); i++) {
|
|
181
|
+
const node = buffer.get(i);
|
|
182
|
+
|
|
183
|
+
node.transform.position.set(
|
|
184
|
+
node.position.x * grid.transform.scale_x + grid.transform.offset_x,
|
|
185
|
+
node.transform.position.y,
|
|
186
|
+
node.position.y * grid.transform.scale_y + grid.transform.offset_y
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
// url: "data/models/arrow-symbols/arrow4/model.gltf"
|
|
191
|
+
|
|
192
|
+
build_node(node, 'data/models/arrow-symbols/arrow4/model.gltf');
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
harness
|
|
198
|
+
.initialize({
|
|
199
|
+
configuration(config, engine) {
|
|
200
|
+
config.addSystem(new MeshSystem(engine));
|
|
201
|
+
config.addPlugin(AmbientOcclusionPostProcessEffect);
|
|
202
|
+
|
|
203
|
+
const gltfAssetLoader = new GLTFAssetLoader();
|
|
204
|
+
|
|
205
|
+
config.addLoader(GameAssetType.ModelGLTF, gltfAssetLoader);
|
|
206
|
+
config.addLoader(GameAssetType.ModelGLTF_JSON, gltfAssetLoader);
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
.then(main);
|
|
@@ -2,8 +2,6 @@ import { MarkerNodeTransformer } from "./MarkerNodeTransformer.js";
|
|
|
2
2
|
import Vector2 from "../../../core/geom/Vector2.js";
|
|
3
3
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
4
4
|
|
|
5
|
-
const v3 = new Vector3();
|
|
6
|
-
|
|
7
5
|
export class MarkerNodeTransformerOffsetPosition extends MarkerNodeTransformer {
|
|
8
6
|
constructor() {
|
|
9
7
|
super();
|
|
@@ -28,10 +26,8 @@ export class MarkerNodeTransformerOffsetPosition extends MarkerNodeTransformer {
|
|
|
28
26
|
transform(node, grid) {
|
|
29
27
|
const r = node.clone();
|
|
30
28
|
|
|
31
|
-
r.transform.rotation.toEulerAnglesYXZ(v3);
|
|
32
|
-
|
|
33
29
|
//rotate offset
|
|
34
|
-
const rotation =
|
|
30
|
+
const rotation = r.transform.rotation.computeTwistAngle(Vector3.down);
|
|
35
31
|
|
|
36
32
|
const sin = Math.sin(rotation);
|
|
37
33
|
const cos = Math.cos(rotation);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MarkerNodeTransformerYRotateByFilterGradient } from "./MarkerNodeTransformerYRotateByFilterGradient.js";
|
|
2
2
|
import { GridData } from "../../grid/GridData.js";
|
|
3
3
|
import { GridDataLayer } from "../../grid/layers/GridDataLayer.js";
|
|
4
|
-
import {
|
|
4
|
+
import { CellFilterSampleLayerLinear } from "../../filtering/numeric/sampling/CellFilterSampleLayerLinear.js";
|
|
5
5
|
import { MarkerNode } from "../MarkerNode.js";
|
|
6
6
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
7
7
|
import { RAD_TO_DEG } from "../../../core/math/RAD_TO_DEG.js";
|
|
@@ -40,7 +40,7 @@ function prepareSample(data) {
|
|
|
40
40
|
const grid = makeGrid(data);
|
|
41
41
|
|
|
42
42
|
const transformer = MarkerNodeTransformerYRotateByFilterGradient.from(
|
|
43
|
-
|
|
43
|
+
CellFilterSampleLayerLinear.from('x')
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
transformer.initialize(grid, 0);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { assert } from "../../core/assert.js";
|
|
2
2
|
import Vector2 from "../../core/geom/Vector2.js";
|
|
3
3
|
import { CellFilterLiteralFloat } from "../filtering/numeric/CellFilterLiteralFloat.js";
|
|
4
|
+
import { GridCellActionSequence } from "./action/util/GridCellActionSequence.js";
|
|
4
5
|
|
|
5
6
|
export class GridCellPlacementRule {
|
|
6
7
|
constructor() {
|
|
@@ -25,9 +26,9 @@ export class GridCellPlacementRule {
|
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
*
|
|
28
|
-
* @type {GridCellAction
|
|
29
|
+
* @type {GridCellAction}
|
|
29
30
|
*/
|
|
30
|
-
this.
|
|
31
|
+
this.action = null;
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
*
|
|
@@ -39,28 +40,44 @@ export class GridCellPlacementRule {
|
|
|
39
40
|
/**
|
|
40
41
|
*
|
|
41
42
|
* @param {CellMatcher} matcher
|
|
42
|
-
* @param {GridCellAction[]} actions
|
|
43
|
+
* @param {GridCellAction[]} [actions]
|
|
44
|
+
* @param {GridCellAction} action
|
|
43
45
|
* @param {number|CellFilter} [probability]
|
|
44
46
|
* @param {Vector2} [offset]
|
|
47
|
+
* @param {boolean} [allowRotation]
|
|
45
48
|
* @returns {GridCellPlacementRule}
|
|
46
49
|
*/
|
|
47
|
-
static from({
|
|
50
|
+
static from({
|
|
51
|
+
matcher,
|
|
52
|
+
actions,
|
|
53
|
+
action = GridCellActionSequence.from(actions),
|
|
54
|
+
probability = CellFilterLiteralFloat.from(1),
|
|
55
|
+
offset = Vector2.zero,
|
|
56
|
+
allowRotation = true
|
|
57
|
+
}) {
|
|
48
58
|
|
|
49
59
|
assert.defined(matcher);
|
|
50
|
-
assert.defined(
|
|
51
|
-
|
|
52
|
-
assert.isArray(actions);
|
|
60
|
+
assert.defined(action);
|
|
53
61
|
|
|
54
62
|
const r = new GridCellPlacementRule();
|
|
55
63
|
|
|
56
64
|
r.pattern = matcher;
|
|
57
|
-
|
|
65
|
+
|
|
66
|
+
r.action = action;
|
|
67
|
+
|
|
68
|
+
if (actions !== undefined) {
|
|
69
|
+
console.warn(`"actions" parameter is deprecated. Use a sequence instead`);
|
|
70
|
+
assert.isArray(actions, 'actions');
|
|
71
|
+
}
|
|
58
72
|
|
|
59
73
|
assert.equal(probability.isCellFilter, true, 'probability.isCellFilter !== true');
|
|
74
|
+
|
|
60
75
|
r.probability = probability;
|
|
61
76
|
|
|
62
77
|
r.positionOffset.copy(offset);
|
|
63
78
|
|
|
79
|
+
r.allowRotation = allowRotation;
|
|
80
|
+
|
|
64
81
|
return r;
|
|
65
82
|
}
|
|
66
83
|
|
|
@@ -70,14 +87,8 @@ export class GridCellPlacementRule {
|
|
|
70
87
|
* @param {number} seed
|
|
71
88
|
*/
|
|
72
89
|
initialize(grid, seed) {
|
|
73
|
-
const actions = this.actions;
|
|
74
|
-
const n = actions.length;
|
|
75
90
|
|
|
76
|
-
|
|
77
|
-
const action = actions[i];
|
|
78
|
-
|
|
79
|
-
action.initialize(grid, seed);
|
|
80
|
-
}
|
|
91
|
+
this.action.initialize(grid, seed);
|
|
81
92
|
|
|
82
93
|
this.pattern.initialize(grid, seed);
|
|
83
94
|
|
|
@@ -94,23 +105,18 @@ export class GridCellPlacementRule {
|
|
|
94
105
|
* @param {number} rotation in Radians
|
|
95
106
|
*/
|
|
96
107
|
execute(grid, x, y, rotation) {
|
|
97
|
-
const actions = this.actions;
|
|
98
|
-
const n = actions.length;
|
|
99
|
-
|
|
100
108
|
const sin = Math.sin(rotation);
|
|
101
109
|
const cos = Math.cos(rotation);
|
|
102
110
|
|
|
103
|
-
const
|
|
104
|
-
|
|
111
|
+
const offset = this.positionOffset;
|
|
112
|
+
|
|
113
|
+
const local_x = offset.x;
|
|
114
|
+
const local_y = offset.y;
|
|
105
115
|
|
|
106
116
|
const rotated_local_x = local_x * cos - local_y * sin
|
|
107
117
|
const rotated_local_y = local_x * sin + local_y * cos;
|
|
108
118
|
|
|
109
|
-
|
|
110
|
-
const action = actions[i];
|
|
111
|
-
|
|
112
|
-
action.execute(grid, x + rotated_local_x, y + rotated_local_y, rotation);
|
|
113
|
-
}
|
|
119
|
+
this.action.execute(grid, x + rotated_local_x, y + rotated_local_y, rotation);
|
|
114
120
|
|
|
115
121
|
}
|
|
116
122
|
}
|
|
@@ -573,7 +573,7 @@ export class ThemeEngine {
|
|
|
573
573
|
const tTerrainGeometry = futureTask(new Future((resolve, reject) => {
|
|
574
574
|
|
|
575
575
|
terrain.updateWorkerHeights();
|
|
576
|
-
terrain.
|
|
576
|
+
terrain.__tiles.rebuild();
|
|
577
577
|
|
|
578
578
|
terrain.promiseAllTiles().then(resolve, reject);
|
|
579
579
|
}), 'Wait for terrain tiles');
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"productName": "Meep",
|
|
6
6
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.38.0",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|
|
@@ -19,14 +19,18 @@ import { TerrainLayerDescription } from "../../generation/theme/TerrainLayerDesc
|
|
|
19
19
|
import Vector2 from "../../core/geom/Vector2.js";
|
|
20
20
|
import { CellFilterLiteralFloat } from "../../generation/filtering/numeric/CellFilterLiteralFloat.js";
|
|
21
21
|
import { GridDataLayer } from "../../generation/grid/layers/GridDataLayer.js";
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
CellFilterSampleLayerLinear
|
|
24
|
+
} from "../../generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js";
|
|
23
25
|
import { CellFilterSmoothStep } from "../../generation/filtering/numeric/math/CellFilterSmoothStep.js";
|
|
24
26
|
import { CellFilterOneMinus } from "../../generation/filtering/numeric/math/CellFilterOneMinus.js";
|
|
25
27
|
import { CellFilterMultiply } from "../../generation/filtering/numeric/math/algebra/CellFilterMultiply.js";
|
|
26
28
|
import { CellFilterCurvature } from "../../generation/filtering/numeric/complex/CellFilterCurvature.js";
|
|
27
29
|
import { CellFilterMax2 } from "../../generation/filtering/numeric/math/CellFilterMax2.js";
|
|
28
30
|
import { CellFilterMin2 } from "../../generation/filtering/numeric/math/CellFilterMin2.js";
|
|
29
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
AmbientOcclusionPostProcessEffect
|
|
33
|
+
} from "../../engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
|
|
30
34
|
import { CellFilterAngleToNormal } from "../../generation/filtering/numeric/complex/CellFilterAngleToNormal.js";
|
|
31
35
|
import { CellFilterCache } from "../../generation/filtering/numeric/CellFilterCache.js";
|
|
32
36
|
|
|
@@ -61,7 +65,7 @@ function makeTheme() {
|
|
|
61
65
|
|
|
62
66
|
const terrainTheme = new TerrainTheme();
|
|
63
67
|
|
|
64
|
-
const height =
|
|
68
|
+
const height = CellFilterSampleLayerLinear.from('height');
|
|
65
69
|
const curvature = CellFilterCurvature.from(height);
|
|
66
70
|
|
|
67
71
|
const slope = CellFilterAngleToNormal.from(height, Vector3.forward);
|
package/samples/terrain/main.js
CHANGED
package/view/View.js
CHANGED
|
@@ -26,7 +26,7 @@ function setElementTransform(domElement, position, scale, rotation) {
|
|
|
26
26
|
|
|
27
27
|
const m3 = scratch_m3_0;
|
|
28
28
|
|
|
29
|
-
compose3x3transform(m3, position.x, position.y, scale.x, scale.y, rotation);
|
|
29
|
+
compose3x3transform(m3, position.x, position.y, scale.x, scale.y,0,0, rotation);
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
/*
|
|
@@ -346,6 +346,16 @@ class View {
|
|
|
346
346
|
this.on.unlinked.send0();
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
+
/**
|
|
350
|
+
*
|
|
351
|
+
* @param {View[]} children
|
|
352
|
+
*/
|
|
353
|
+
addChildren(children) {
|
|
354
|
+
for (let i = 0; i < children.length; i++) {
|
|
355
|
+
this.addChild(children[i]);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
349
359
|
/**
|
|
350
360
|
*
|
|
351
361
|
* @param {View} child
|
|
@@ -725,6 +735,18 @@ class View {
|
|
|
725
735
|
}
|
|
726
736
|
}
|
|
727
737
|
|
|
738
|
+
/**
|
|
739
|
+
*
|
|
740
|
+
* @param {Object} hash
|
|
741
|
+
*/
|
|
742
|
+
attr(hash) {
|
|
743
|
+
for (let propertyName in hash) {
|
|
744
|
+
if (hash.hasOwnProperty(propertyName)) {
|
|
745
|
+
this.el.setAttribute(propertyName, hash[propertyName]);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
728
750
|
/**
|
|
729
751
|
*
|
|
730
752
|
* @param {Vector2} size
|
package/view/common/LabelView.js
CHANGED
|
@@ -16,7 +16,7 @@ import { frameThrottle } from "../../engine/graphics/FrameThrottle.js";
|
|
|
16
16
|
import { assert } from "../../core/assert.js";
|
|
17
17
|
import ObservedInteger from "../../core/model/ObservedInteger.js";
|
|
18
18
|
import { noop } from "../../core/function/Functions.js";
|
|
19
|
-
import { isTypedArray } from "../../core/
|
|
19
|
+
import { isTypedArray } from "../../core/collection/array/typed/isTypedArray.js";
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -5,16 +5,11 @@
|
|
|
5
5
|
* @param {number} tY translation Y offset
|
|
6
6
|
* @param {number} sX scale in X axis
|
|
7
7
|
* @param {number} sY scale in Y axis
|
|
8
|
+
* @param {number} cx center of rotation X
|
|
9
|
+
* @param {number} cy center of rotation Y
|
|
8
10
|
* @param {number} angle rotation angle
|
|
9
11
|
*/
|
|
10
|
-
export function compose3x3transform(result, tX, tY, sX, sY, angle) {
|
|
11
|
-
/**
|
|
12
|
-
* Center of rotation
|
|
13
|
-
* @type {number}
|
|
14
|
-
*/
|
|
15
|
-
const cx = 0;
|
|
16
|
-
const cy = 0;
|
|
17
|
-
|
|
12
|
+
export function compose3x3transform(result, tX, tY, sX, sY, cx, cy, angle) {
|
|
18
13
|
const neg_angle = -angle;
|
|
19
14
|
|
|
20
15
|
const sin = Math.sin(neg_angle);
|
|
@@ -32,3 +27,32 @@ export function compose3x3transform(result, tX, tY, sX, sY, angle) {
|
|
|
32
27
|
result[7] = 0;
|
|
33
28
|
result[8] = 1;
|
|
34
29
|
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param {number[]|Float32Array} result
|
|
34
|
+
* @param {number} tX
|
|
35
|
+
* @param {number} tY
|
|
36
|
+
*/
|
|
37
|
+
export function m3_from_translation(result, tX, tY) {
|
|
38
|
+
result[0] = 1;
|
|
39
|
+
result[1] = 0;
|
|
40
|
+
result[2] = tX;
|
|
41
|
+
|
|
42
|
+
result[3] = 0;
|
|
43
|
+
result[4] = 1;
|
|
44
|
+
result[5] = tY;
|
|
45
|
+
|
|
46
|
+
result[6] = 0;
|
|
47
|
+
result[7] = 0;
|
|
48
|
+
result[8] = 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @see https://stackoverflow.com/questions/45159314/decompose-2d-transformation-matrix
|
|
53
|
+
* @param {mat3|number[]|Float32Array} m3
|
|
54
|
+
* @returns {number}
|
|
55
|
+
*/
|
|
56
|
+
export function m3_extract_rotation(m3) {
|
|
57
|
+
return Math.atan2(m3[3], m3[0]);
|
|
58
|
+
}
|
|
@@ -10,10 +10,10 @@ import Signal from "../../../core/events/signal/Signal.js";
|
|
|
10
10
|
import ObservedBoolean from "../../../core/model/ObservedBoolean.js";
|
|
11
11
|
import ObservedEnum from "../../../core/model/ObservedEnum.js";
|
|
12
12
|
import ObservedString from "../../../core/model/ObservedString.js";
|
|
13
|
-
import { isTypedArray } from "../../../core/json/JsonUtils.js";
|
|
14
13
|
import { Color } from "../../../core/color/Color.js";
|
|
15
14
|
import View from "../../View.js";
|
|
16
15
|
import ObservedInteger from "../../../core/model/ObservedInteger.js";
|
|
16
|
+
import { isTypedArray } from "../../../core/collection/array/typed/isTypedArray.js";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
@@ -33,7 +33,7 @@ class DropDownSelectionView extends View {
|
|
|
33
33
|
this.bindSignal(this.model.on.added, this.handleAdded, this);
|
|
34
34
|
this.bindSignal(this.model.on.removed, this.handleRemoved, this);
|
|
35
35
|
|
|
36
|
-
if(changeListener !== undefined) {
|
|
36
|
+
if (changeListener !== undefined) {
|
|
37
37
|
|
|
38
38
|
elRoot.addEventListener('change', (event) => {
|
|
39
39
|
const id = event.target.value;
|
|
@@ -139,10 +139,18 @@ class DropDownSelectionView extends View {
|
|
|
139
139
|
return this.getValueById(id);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
/**
|
|
143
|
+
*
|
|
144
|
+
* @param {T} v
|
|
145
|
+
*/
|
|
146
|
+
setSelectedValue(v) {
|
|
147
|
+
this.el.selectedIndex = this.model.indexOf(v);
|
|
148
|
+
}
|
|
144
149
|
|
|
150
|
+
link() {
|
|
145
151
|
this.model.forEach(this.handleAdded, this);
|
|
152
|
+
|
|
153
|
+
super.link();
|
|
146
154
|
}
|
|
147
155
|
|
|
148
156
|
unlink() {
|
|
@@ -62,7 +62,9 @@ class ImageView extends View {
|
|
|
62
62
|
*/
|
|
63
63
|
let src;
|
|
64
64
|
|
|
65
|
-
if (
|
|
65
|
+
if (url === null || url === undefined) {
|
|
66
|
+
src = '';
|
|
67
|
+
} else if (typeof url === "string") {
|
|
66
68
|
src = url;
|
|
67
69
|
} else if (typeof url === "object" && typeof url.getValue === "function") {
|
|
68
70
|
src = url.getValue();
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { assert } from "../assert.js";
|
|
2
|
-
import Signal from "../events/signal/Signal.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param {Number} value
|
|
7
|
-
* @constructor
|
|
8
|
-
*/
|
|
9
|
-
function ObservedReal(value) {
|
|
10
|
-
assert.equal(typeof value, "number", `Value must be of type "number", instead was "${typeof value}"`);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @type {Number}
|
|
15
|
-
* @private
|
|
16
|
-
*/
|
|
17
|
-
this.__value = value;
|
|
18
|
-
|
|
19
|
-
this.onChanged = new Signal();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param {Number} value
|
|
25
|
-
* @returns {ObservedReal}
|
|
26
|
-
*/
|
|
27
|
-
ObservedReal.prototype.set = function (value) {
|
|
28
|
-
assert.equal(typeof value, "number", `Value must be of type "number", instead was "${typeof value}"`);
|
|
29
|
-
|
|
30
|
-
const oldValue = this.__value;
|
|
31
|
-
if (oldValue !== value) {
|
|
32
|
-
this.__value = value;
|
|
33
|
-
this.onChanged.dispatch(value, oldValue);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return this;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
* @returns {Number}
|
|
42
|
-
*/
|
|
43
|
-
ObservedReal.prototype.getValue = function () {
|
|
44
|
-
return this.__value;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
ObservedReal.prototype.toJSON = function () {
|
|
48
|
-
return this.__value;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
ObservedReal.prototype.fromJSON = function (obj) {
|
|
52
|
-
this.set(obj);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default ObservedReal;
|
|
File without changes
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { inverseLerp } from "../../../../../core/math/inverseLerp.js";
|
|
2
|
-
|
|
3
|
-
export function attenuateSoundLinear(distance, min, max) {
|
|
4
|
-
if (distance <= min) {
|
|
5
|
-
return 1;
|
|
6
|
-
} else if (distance >= max) {
|
|
7
|
-
return 0;
|
|
8
|
-
} else {
|
|
9
|
-
return inverseLerp(max, min, distance);
|
|
10
|
-
}
|
|
11
|
-
}
|