@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
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import Vector2 from '../../../core/geom/Vector2.js';
|
|
7
7
|
import { assert } from "../../../core/assert.js";
|
|
8
|
-
import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
9
8
|
import { computeIntegerArrayHash } from "../../../core/primitives/array/computeIntegerArrayHash.js";
|
|
10
9
|
import { isArrayEqualStrict } from "../../../core/collection/array/isArrayEqualStrict.js";
|
|
11
10
|
import { computeHashIntegerArray } from "../../../core/collection/array/computeHashIntegerArray.js";
|
|
@@ -245,46 +244,3 @@ GridObstacle.typeName = "GridObstacle";
|
|
|
245
244
|
|
|
246
245
|
export default GridObstacle;
|
|
247
246
|
|
|
248
|
-
export class GridObstacleSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
249
|
-
constructor() {
|
|
250
|
-
super();
|
|
251
|
-
|
|
252
|
-
this.klass = GridObstacle;
|
|
253
|
-
this.version = 0;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
*
|
|
258
|
-
* @param {BinaryBuffer} buffer
|
|
259
|
-
* @param {GridObstacle} value
|
|
260
|
-
*/
|
|
261
|
-
serialize(buffer, value) {
|
|
262
|
-
|
|
263
|
-
const w = value.size.x;
|
|
264
|
-
const h = value.size.y;
|
|
265
|
-
|
|
266
|
-
buffer.writeUint16(w);
|
|
267
|
-
buffer.writeUint16(h);
|
|
268
|
-
|
|
269
|
-
buffer.writeBytes(value.data, 0, w * h);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
*
|
|
274
|
-
* @param {BinaryBuffer} buffer
|
|
275
|
-
* @param {GridObstacle} value
|
|
276
|
-
*/
|
|
277
|
-
deserialize(buffer, value) {
|
|
278
|
-
|
|
279
|
-
const x = buffer.readUint16();
|
|
280
|
-
const y = buffer.readUint16();
|
|
281
|
-
|
|
282
|
-
value.size.set(x, y);
|
|
283
|
-
|
|
284
|
-
const length = x * y;
|
|
285
|
-
|
|
286
|
-
value.data = new Uint8Array(length);
|
|
287
|
-
|
|
288
|
-
buffer.readBytes(value.data, 0, length);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import GridObstacle from "./GridObstacle.js";
|
|
3
|
+
|
|
4
|
+
export class GridObstacleSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
|
|
8
|
+
this.klass = GridObstacle;
|
|
9
|
+
this.version = 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {BinaryBuffer} buffer
|
|
15
|
+
* @param {GridObstacle} value
|
|
16
|
+
*/
|
|
17
|
+
serialize(buffer, value) {
|
|
18
|
+
|
|
19
|
+
const w = value.size.x;
|
|
20
|
+
const h = value.size.y;
|
|
21
|
+
|
|
22
|
+
buffer.writeUint16(w);
|
|
23
|
+
buffer.writeUint16(h);
|
|
24
|
+
|
|
25
|
+
buffer.writeBytes(value.data, 0, w * h);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {BinaryBuffer} buffer
|
|
31
|
+
* @param {GridObstacle} value
|
|
32
|
+
*/
|
|
33
|
+
deserialize(buffer, value) {
|
|
34
|
+
|
|
35
|
+
const x = buffer.readUint16();
|
|
36
|
+
const y = buffer.readUint16();
|
|
37
|
+
|
|
38
|
+
value.size.set(x, y);
|
|
39
|
+
|
|
40
|
+
const length = x * y;
|
|
41
|
+
|
|
42
|
+
value.data = new Uint8Array(length);
|
|
43
|
+
|
|
44
|
+
buffer.readBytes(value.data, 0, length);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -12,7 +12,7 @@ export class PointerDevice {
|
|
|
12
12
|
public readonly on: {
|
|
13
13
|
down: Signal<Vector2, MouseEvent | TouchEvent>,
|
|
14
14
|
up: Signal<Vector2, MouseEvent | TouchEvent>,
|
|
15
|
-
move: Signal<Vector2
|
|
15
|
+
move: Signal<Vector2 /*position*/, MouseEvent | TouchEvent, Vector2 /*delta*/>,
|
|
16
16
|
tap: Signal<Vector2, MouseEvent | TouchEvent>,
|
|
17
17
|
drag: Signal<Vector2, Vector2, Vector2, MouseEvent | TouchEvent>,
|
|
18
18
|
dragStart: Signal<Vector2, MouseEvent | TouchEvent>,
|
|
@@ -350,6 +350,10 @@ function PointerDevice(domElement) {
|
|
|
350
350
|
|
|
351
351
|
const position = this.position = new Vector2();
|
|
352
352
|
|
|
353
|
+
/**
|
|
354
|
+
*
|
|
355
|
+
* @param {MouseEvent} event
|
|
356
|
+
*/
|
|
353
357
|
this.eventHandlerMouseMove = (event) => {
|
|
354
358
|
event.preventDefault();
|
|
355
359
|
|
|
@@ -357,7 +361,7 @@ function PointerDevice(domElement) {
|
|
|
357
361
|
|
|
358
362
|
this.readPointerPositionFromEvent(position, event);
|
|
359
363
|
|
|
360
|
-
this.on.move.
|
|
364
|
+
this.on.move.send3(position, event, new Vector2(event.movementX, event.movementY));
|
|
361
365
|
};
|
|
362
366
|
this.eventHandlerMouseUp = (event) => {
|
|
363
367
|
this.readPointerPositionFromEvent(position, event);
|
|
@@ -383,9 +387,13 @@ function PointerDevice(domElement) {
|
|
|
383
387
|
this.on.move.send3(param0, param1, param2);
|
|
384
388
|
});
|
|
385
389
|
|
|
390
|
+
const anchor_touch_last = new Vector2();
|
|
391
|
+
|
|
386
392
|
this.eventHandlerTouchStart = function (event) {
|
|
387
393
|
getTouchCenter(event.touches, position);
|
|
388
394
|
touchStart.send2(position, event);
|
|
395
|
+
|
|
396
|
+
anchor_touch_last.copy(position);
|
|
389
397
|
};
|
|
390
398
|
|
|
391
399
|
this.eventHandlerTouchEnd = function (event) {
|
|
@@ -397,7 +405,14 @@ function PointerDevice(domElement) {
|
|
|
397
405
|
event.preventDefault();
|
|
398
406
|
|
|
399
407
|
getTouchCenter(event.touches, position);
|
|
400
|
-
|
|
408
|
+
|
|
409
|
+
const delta = new Vector2();
|
|
410
|
+
|
|
411
|
+
delta.subVectors(position, anchor_touch_last);
|
|
412
|
+
|
|
413
|
+
touchMove.send3(position, event, delta);
|
|
414
|
+
|
|
415
|
+
anchor_touch_last.copy(position);
|
|
401
416
|
};
|
|
402
417
|
|
|
403
418
|
const globalUp = new Signal();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Sampler2D } from "../../../graphics/texture/sampler/Sampler2D.js";
|
|
2
|
-
import {
|
|
2
|
+
import { sampler2D_scale_down_linear } from "../../../graphics/texture/sampler/sampler2D_scale_down_linear.js";
|
|
3
3
|
import { computeWholeDivisorLow } from "../../../../core/math/MathUtils.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -20,7 +20,7 @@ export function buildCameraTargetSampler({ heightSampler }) {
|
|
|
20
20
|
|
|
21
21
|
const result = Sampler2D.float32(1, s(heightSampler.width), s(heightSampler.height));
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
sampler2D_scale_down_linear(heightSampler, result);
|
|
24
24
|
|
|
25
25
|
return result;
|
|
26
26
|
}
|
|
@@ -17,7 +17,9 @@ import { min2 } from "../../../../core/math/min2.js";
|
|
|
17
17
|
import { computeNonuniformCatmullRomSplineSample } from "./computeNonuniformCatmullRomSplineSample.js";
|
|
18
18
|
import { InterpolationType } from "./InterpolationType.js";
|
|
19
19
|
import { v3_distance } from "../../../../core/geom/v3_distance.js";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
line3_computeSegmentPointDistance_sqr
|
|
22
|
+
} from "../../../../core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js";
|
|
21
23
|
|
|
22
24
|
const v3_a = new Vector3();
|
|
23
25
|
const v3_b = new Vector3();
|
|
@@ -262,6 +264,9 @@ class Path {
|
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
266
|
|
|
267
|
+
reverse() {
|
|
268
|
+
this.__data.reverse_rows();
|
|
269
|
+
}
|
|
265
270
|
|
|
266
271
|
/**
|
|
267
272
|
*
|
|
@@ -123,3 +123,120 @@ export function computeNonuniformCatmullRomSplineSample(result, p0, p1, p2, p3,
|
|
|
123
123
|
result[i] = C;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Alpha assumed to be 0.5
|
|
130
|
+
* @param {number} f
|
|
131
|
+
* @param {number} p0
|
|
132
|
+
* @param {number} p1
|
|
133
|
+
* @param {number} p2
|
|
134
|
+
* @param {number} p3
|
|
135
|
+
* @returns {number}
|
|
136
|
+
*/
|
|
137
|
+
function catmullrom_1d(f, p0, p1, p2, p3) {
|
|
138
|
+
const half_alpha = 0.25;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
*
|
|
142
|
+
* @param {number} p0
|
|
143
|
+
* @param {number} p1
|
|
144
|
+
* @param {number} half_alpha between 0..0.5
|
|
145
|
+
* @returns {number}
|
|
146
|
+
*/
|
|
147
|
+
function getT(p0, p1, half_alpha) {
|
|
148
|
+
const dx = p0 - p1;
|
|
149
|
+
|
|
150
|
+
const a = dx * dx;
|
|
151
|
+
|
|
152
|
+
return Math.pow(a, half_alpha);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// calculate T
|
|
156
|
+
const t0 = 0;
|
|
157
|
+
let t_01 = getT(p0, p1, half_alpha);
|
|
158
|
+
let t_02 = getT(p1, p2, half_alpha);
|
|
159
|
+
let t_03 = getT(p2, p3, half_alpha);
|
|
160
|
+
|
|
161
|
+
// safety check for repeated points, to prevent division by 0
|
|
162
|
+
if (t_01 < 1e-5) {
|
|
163
|
+
t_01 = 1;
|
|
164
|
+
}
|
|
165
|
+
if (t_02 < 1e-5) {
|
|
166
|
+
t_02 = t_01;
|
|
167
|
+
}
|
|
168
|
+
if (t_03 < 1e-5) {
|
|
169
|
+
t_03 = t_02;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const t1 = t_01 + t0;
|
|
173
|
+
const t2 = t_02 + t1;
|
|
174
|
+
const t3 = t_03 + t2;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Interpolation between points 1 and 2
|
|
178
|
+
* @type {number}
|
|
179
|
+
*/
|
|
180
|
+
const t = t1 * (1 - f) + t2 * f;
|
|
181
|
+
|
|
182
|
+
/*
|
|
183
|
+
Vector2 A1 = (t1-t)/(t1-t0)*p0 + (t-t0)/(t1-t0)*p1;
|
|
184
|
+
Vector2 A2 = (t2-t)/(t2-t1)*p1 + (t-t1)/(t2-t1)*p2;
|
|
185
|
+
Vector2 A3 = (t3-t)/(t3-t2)*p2 + (t-t2)/(t3-t2)*p3;
|
|
186
|
+
|
|
187
|
+
Vector2 B1 = (t2-t)/(t2-t0)*A1 + (t-t0)/(t2-t0)*A2;
|
|
188
|
+
Vector2 B2 = (t3-t)/(t3-t1)*A2 + (t-t1)/(t3-t1)*A3;
|
|
189
|
+
|
|
190
|
+
Vector2 C = (t2-t)/(t2-t1)*B1 + (t-t1)/(t2-t1)*B2;
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
const d_t1_t0 = t1 - t0;
|
|
194
|
+
|
|
195
|
+
const m_A1_0 = (t1 - t) / d_t1_t0;
|
|
196
|
+
const m_A1_1 = (t - t0) / d_t1_t0;
|
|
197
|
+
|
|
198
|
+
const d_t2_t1 = t2 - t1;
|
|
199
|
+
|
|
200
|
+
const m_A2_0 = (t2 - t) / d_t2_t1;
|
|
201
|
+
|
|
202
|
+
const d_t_t1 = t - t1;
|
|
203
|
+
|
|
204
|
+
const m_A2_1 = d_t_t1 / d_t2_t1;
|
|
205
|
+
|
|
206
|
+
const d_t3_t2 = t3 - t2;
|
|
207
|
+
|
|
208
|
+
const d_t3_t = t3 - t;
|
|
209
|
+
|
|
210
|
+
const m_A3_0 = d_t3_t / d_t3_t2;
|
|
211
|
+
const m_A3_1 = (t - t2) / d_t3_t2;
|
|
212
|
+
|
|
213
|
+
const d_t2_t0 = t2 - t0;
|
|
214
|
+
|
|
215
|
+
const m_B1_0 = (t2 - t) / d_t2_t0;
|
|
216
|
+
const m_B1_1 = (t - t0) / d_t2_t0;
|
|
217
|
+
|
|
218
|
+
const d_t3_t1 = t3 - t1;
|
|
219
|
+
|
|
220
|
+
const m_B2_0 = d_t3_t / d_t3_t1;
|
|
221
|
+
const m_B2_1 = d_t_t1 / d_t3_t1;
|
|
222
|
+
|
|
223
|
+
const m_C_0 = (t2 - t) / d_t2_t1;
|
|
224
|
+
const m_C_1 = d_t_t1 / d_t2_t1;
|
|
225
|
+
|
|
226
|
+
// read vector values for the dimension
|
|
227
|
+
const v0 = p0;
|
|
228
|
+
const v1 = p1;
|
|
229
|
+
const v2 = p2;
|
|
230
|
+
const v3 = p3;
|
|
231
|
+
|
|
232
|
+
// compute resulting value in this dimension
|
|
233
|
+
const A1 = m_A1_0 * v0 + m_A1_1 * v1;
|
|
234
|
+
const A2 = m_A2_0 * v1 + m_A2_1 * v2;
|
|
235
|
+
const A3 = m_A3_0 * v2 + m_A3_1 * v3;
|
|
236
|
+
|
|
237
|
+
const B1 = m_B1_0 * A1 + m_B1_1 * A2;
|
|
238
|
+
const B2 = m_B2_0 * A2 + m_B2_1 * A3;
|
|
239
|
+
|
|
240
|
+
return m_C_0 * B1 + m_C_1 * B2;
|
|
241
|
+
|
|
242
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import Vector2 from '../../../core/geom/Vector2.js';
|
|
2
2
|
import { clamp } from "../../../core/math/clamp.js";
|
|
3
|
-
import BinaryHeap from '
|
|
3
|
+
import BinaryHeap from '../../../core/collection/heap/BinaryHeap.js';
|
|
4
4
|
import { assert } from "../../../core/assert.js";
|
|
5
5
|
import { gridAStarSearch } from "./AStar.js";
|
|
6
6
|
|
|
7
7
|
const blockValue = 255;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* A kind of 2D data texture
|
|
11
|
+
* @deprecated prefer using {@link Sampler2D} instead, as it's more versatile and has wider feature set
|
|
11
12
|
* @param {Number} width
|
|
12
13
|
* @param {Number} height
|
|
13
14
|
* @constructor
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* extracts hash parameters
|
|
3
|
+
* @returns {Object<string>}
|
|
4
|
+
*/
|
|
5
|
+
export function getURLHash() {
|
|
6
|
+
const result = {};
|
|
7
|
+
|
|
8
|
+
if (window === undefined) {
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const location = window.location;
|
|
13
|
+
|
|
14
|
+
const hash = location.hash;
|
|
15
|
+
|
|
16
|
+
const hashRegEx = /([a-zA-Z0-9\-\_]+)\=([a-zA-Z0-9\-\_]+)/g;
|
|
17
|
+
|
|
18
|
+
let match;
|
|
19
|
+
while ((match = hashRegEx.exec(hash)) !== null) {
|
|
20
|
+
const variableName = match[1];
|
|
21
|
+
const value = match[2];
|
|
22
|
+
|
|
23
|
+
result[variableName] = value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
@@ -2,6 +2,7 @@ import { EnginePlatform } from "./EnginePlatform.js";
|
|
|
2
2
|
import { IndexedDBStorage } from "../save/storage/IndexedDBStorage.js";
|
|
3
3
|
import { StorageAchievementGateway } from "../achievements/gateway/StorageAchievementGateway.js";
|
|
4
4
|
import { arrayPickBestElement } from "../../core/collection/array/arrayPickBestElement.js";
|
|
5
|
+
import { getURLHash } from "./GetURLHash.js";
|
|
5
6
|
|
|
6
7
|
export class WebEnginePlatform extends EnginePlatform {
|
|
7
8
|
constructor({
|
|
@@ -32,29 +33,7 @@ export class WebEnginePlatform extends EnginePlatform {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
pickDefaultLocale(localeOptions) {
|
|
35
|
-
function getURLHash() {
|
|
36
|
-
const result = {};
|
|
37
36
|
|
|
38
|
-
if (window === undefined) {
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const location = window.location;
|
|
43
|
-
|
|
44
|
-
const hash = location.hash;
|
|
45
|
-
|
|
46
|
-
const hashRegEx = /([a-zA-Z0-9\-\_]+)\=([a-zA-Z0-9\-\_]+)/g;
|
|
47
|
-
|
|
48
|
-
let match;
|
|
49
|
-
while ((match = hashRegEx.exec(hash)) !== null) {
|
|
50
|
-
const variableName = match[1];
|
|
51
|
-
const value = match[2];
|
|
52
|
-
|
|
53
|
-
result[variableName] = value;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return result;
|
|
57
|
-
}
|
|
58
37
|
|
|
59
38
|
function pickLanguageByNavigator() {
|
|
60
39
|
/**
|
|
@@ -8,10 +8,14 @@ import Vector1 from "../../../../core/geom/Vector1.js";
|
|
|
8
8
|
import { SoundTrack } from "./SoundTrack.js";
|
|
9
9
|
import { SoundEmitterFlags } from "./SoundEmitterFlags.js";
|
|
10
10
|
import { SoundAttenuationFunction } from "./SoundAttenuationFunction.js";
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
interpolate_irradiance_linear
|
|
13
|
+
} from "../../../../core/math/physics/irradiance/interpolate_irradiance_linear.js";
|
|
14
|
+
import {
|
|
15
|
+
interpolate_irradiance_lograrithmic
|
|
16
|
+
} from "../../../../core/math/physics/irradiance/interpolate_irradiance_lograrithmic.js";
|
|
13
17
|
import { SoundPanningModelType } from "./SoundPanningModelType.js";
|
|
14
|
-
import {
|
|
18
|
+
import { interpolate_irradiance_smith } from "../../../../core/math/physics/irradiance/interpolate_irradiance_smith.js";
|
|
15
19
|
import { objectKeyByValue } from "../../../../core/model/object/objectKeyByValue.js";
|
|
16
20
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
17
21
|
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
@@ -354,11 +358,11 @@ export class SoundEmitter {
|
|
|
354
358
|
const distance_max = this.__distanceMax;
|
|
355
359
|
|
|
356
360
|
if (attenuation === SoundAttenuationFunction.Linear) {
|
|
357
|
-
volume =
|
|
361
|
+
volume = interpolate_irradiance_linear(distance, distance_min, distance_max);
|
|
358
362
|
} else if (attenuation === SoundAttenuationFunction.Logarithmic) {
|
|
359
|
-
volume =
|
|
363
|
+
volume = interpolate_irradiance_lograrithmic(distance, distance_min, distance_max);
|
|
360
364
|
} else if (attenuation === SoundAttenuationFunction.Smith) {
|
|
361
|
-
volume =
|
|
365
|
+
volume = interpolate_irradiance_smith(distance, distance_min, distance_max);
|
|
362
366
|
} else {
|
|
363
367
|
//unsupported function, don't attenuate
|
|
364
368
|
volume = 1;
|
|
@@ -60,8 +60,8 @@ export class DraggableAspect {
|
|
|
60
60
|
pointerGlobal.on.up.add(stopDrag);
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
this.pointerGlobal.on.move.add((position) => {
|
|
64
|
-
drag(position, dragOriginalPosition);
|
|
63
|
+
this.pointerGlobal.on.move.add((position, event, delta) => {
|
|
64
|
+
drag(position, dragOriginalPosition, delta);
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -34,11 +34,12 @@ export class GridGenerator {
|
|
|
34
34
|
*/
|
|
35
35
|
const tasks = [];
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const generators = this.generators;
|
|
38
|
+
const generator_count = generators.length;
|
|
38
39
|
|
|
39
40
|
//generate tasks
|
|
40
|
-
for (let i = 0; i <
|
|
41
|
-
const generator =
|
|
41
|
+
for (let i = 0; i < generator_count; i++) {
|
|
42
|
+
const generator = generators[i];
|
|
42
43
|
|
|
43
44
|
const task = generator.build(grid, ecd, seed);
|
|
44
45
|
|
|
@@ -46,8 +47,8 @@ export class GridGenerator {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
//assign dependencies
|
|
49
|
-
for (let i = 0; i <
|
|
50
|
-
const generator =
|
|
50
|
+
for (let i = 0; i < generator_count; i++) {
|
|
51
|
+
const generator = generators[i];
|
|
51
52
|
|
|
52
53
|
const task = tasks[i];
|
|
53
54
|
|
|
@@ -59,7 +60,7 @@ export class GridGenerator {
|
|
|
59
60
|
|
|
60
61
|
const dependency = dependencies[j];
|
|
61
62
|
|
|
62
|
-
const dependencyIndex =
|
|
63
|
+
const dependencyIndex = generators.indexOf(dependency);
|
|
63
64
|
|
|
64
65
|
if (dependencyIndex === -1) {
|
|
65
66
|
throw new Error(`Dependency ${j}(name='${dependency.name}') of task generator [${i}] (name='${generator.name}') is not found`);
|
|
@@ -34,7 +34,7 @@ import { CellMatcherAny } from "../rules/CellMatcherAny.js";
|
|
|
34
34
|
import { CellFilterGaussianBlur } from "../filtering/numeric/complex/CellFilterGaussianBlur.js";
|
|
35
35
|
import { GridCellActionSequence } from "../placement/action/util/GridCellActionSequence.js";
|
|
36
36
|
import { CellFilterStep } from "../filtering/numeric/math/CellFilterStep.js";
|
|
37
|
-
import {
|
|
37
|
+
import { CellFilterSampleLayerLinear } from "../filtering/numeric/sampling/CellFilterSampleLayerLinear.js";
|
|
38
38
|
import { CellFilterAngleToNormal } from "../filtering/numeric/complex/CellFilterAngleToNormal.js";
|
|
39
39
|
import Vector3 from "../../core/geom/Vector3.js";
|
|
40
40
|
import { CellFilterOneMinus } from "../filtering/numeric/math/CellFilterOneMinus.js";
|
|
@@ -77,10 +77,12 @@ pNoTreasureIn3.addRule(0, 0, CellMatcherNot.from(CellMatcherContainsMarkerWithin
|
|
|
77
77
|
)));
|
|
78
78
|
|
|
79
79
|
const chestPlacementRule = GridCellPlacementRule.from({
|
|
80
|
-
matcher: CellMatcherAnd.from(pTreasureCorner, pNoTreasureIn3),
|
|
80
|
+
matcher: CellMatcherAnd.from(pTreasureCorner, pNoTreasureIn3),
|
|
81
|
+
action: GridCellActionSequence.from([
|
|
81
82
|
GridCellActionPlaceMarker.from({ type: 'Treasure', size: 0.5 }),
|
|
82
83
|
GridCellActionPlaceTags.from(GridTags.Treasure, MirGridLayers.Tags)
|
|
83
|
-
],
|
|
84
|
+
]),
|
|
85
|
+
probability: CellFilterLiteralFloat.from(0.5)
|
|
84
86
|
});
|
|
85
87
|
|
|
86
88
|
|
|
@@ -136,7 +138,7 @@ const ACTION_PLACE_ENEMY_MARKER = GridCellActionPlaceMarker.from({
|
|
|
136
138
|
CellFilterSubtract.from(
|
|
137
139
|
CellFilterMultiply.from(
|
|
138
140
|
CellFilterDivide.from(
|
|
139
|
-
|
|
141
|
+
CellFilterSampleLayerLinear.from(MirGridLayers.DistanceFromStart),
|
|
140
142
|
//increase level by 1 for each X tiles distance
|
|
141
143
|
CellFilterLiteralFloat.from(20)
|
|
142
144
|
),
|
|
@@ -145,7 +147,7 @@ const ACTION_PLACE_ENEMY_MARKER = GridCellActionPlaceMarker.from({
|
|
|
145
147
|
CellFilterSmoothStep.from(
|
|
146
148
|
CellFilterLiteralFloat.from(20),
|
|
147
149
|
CellFilterLiteralFloat.from(50),
|
|
148
|
-
|
|
150
|
+
CellFilterSampleLayerLinear.from(MirGridLayers.DistanceFromStart)
|
|
149
151
|
),
|
|
150
152
|
CellFilterLerp.from(
|
|
151
153
|
CellFilterLiteralFloat.from(0.9),
|
|
@@ -177,10 +179,11 @@ const ACTION_PLACE_ENEMY_TAG = GridCellActionPlaceTags.from(GridTags.Enemy | Gri
|
|
|
177
179
|
|
|
178
180
|
const prTreasureGuards = GridCellPlacementRule.from(
|
|
179
181
|
{
|
|
180
|
-
matcher: pNearTreasure,
|
|
182
|
+
matcher: pNearTreasure,
|
|
183
|
+
action: GridCellActionSequence.from([
|
|
181
184
|
ACTION_PLACE_ENEMY_MARKER,
|
|
182
185
|
ACTION_PLACE_ENEMY_TAG
|
|
183
|
-
]
|
|
186
|
+
])
|
|
184
187
|
}
|
|
185
188
|
);
|
|
186
189
|
|
|
@@ -194,10 +197,11 @@ const prEnemyTreasureGuard = GridCellPlacementRule.from(
|
|
|
194
197
|
matcher: CellMatcherAnd.from(
|
|
195
198
|
pNearTreasure,
|
|
196
199
|
pNoEnemyIn3
|
|
197
|
-
),
|
|
200
|
+
),
|
|
201
|
+
action: GridCellActionSequence.from([
|
|
198
202
|
ACTION_PLACE_ENEMY_MARKER,
|
|
199
203
|
ACTION_PLACE_ENEMY_TAG
|
|
200
|
-
]
|
|
204
|
+
])
|
|
201
205
|
}
|
|
202
206
|
);
|
|
203
207
|
|
|
@@ -207,10 +211,11 @@ const prEnemyCorridorGuard = GridCellPlacementRule.from(
|
|
|
207
211
|
matcher: CellMatcherAnd.from(
|
|
208
212
|
mir_matcher_attack_corridor,
|
|
209
213
|
pNoEnemyIn3
|
|
210
|
-
),
|
|
214
|
+
),
|
|
215
|
+
action: GridCellActionSequence.from([
|
|
211
216
|
ACTION_PLACE_ENEMY_MARKER,
|
|
212
217
|
ACTION_PLACE_ENEMY_TAG
|
|
213
|
-
],
|
|
218
|
+
]),
|
|
214
219
|
probability: CellFilterLiteralFloat.from(0.5)
|
|
215
220
|
}
|
|
216
221
|
);
|
|
@@ -264,7 +269,7 @@ const gDrawLayerMoisture = GridTaskActionRuleSet.from({
|
|
|
264
269
|
GridCellPlacementRule.from(
|
|
265
270
|
{
|
|
266
271
|
matcher: CellMatcherAny.INSTANCE,
|
|
267
|
-
|
|
272
|
+
action: GridCellActionWriteFilterToLayer.from(MirGridLayers.Moisture, SampleGroundMoistureFilter)
|
|
268
273
|
}
|
|
269
274
|
)
|
|
270
275
|
]
|
|
@@ -272,7 +277,7 @@ const gDrawLayerMoisture = GridTaskActionRuleSet.from({
|
|
|
272
277
|
});
|
|
273
278
|
|
|
274
279
|
//trees
|
|
275
|
-
const fReadHeight =
|
|
280
|
+
const fReadHeight = CellFilterSampleLayerLinear.from(MirGridLayers.Heights);
|
|
276
281
|
|
|
277
282
|
const fTreeArea = CellFilterCache.from(
|
|
278
283
|
CellFilterMultiply.from(
|
|
@@ -282,7 +287,7 @@ const fTreeArea = CellFilterCache.from(
|
|
|
282
287
|
CellFilterInverseLerp.from(
|
|
283
288
|
CellFilterLiteralFloat.from(0.1),
|
|
284
289
|
CellFilterLiteralFloat.from(0.5),
|
|
285
|
-
|
|
290
|
+
CellFilterSampleLayerLinear.from(MirGridLayers.Moisture)
|
|
286
291
|
),
|
|
287
292
|
CellFilterLiteralFloat.from(0),
|
|
288
293
|
CellFilterLiteralFloat.from(1)
|
|
@@ -403,7 +408,7 @@ const fSharpSlope = CellFilterCache.from(
|
|
|
403
408
|
CellFilterLiteralFloat.from(Math.PI / 5),
|
|
404
409
|
CellFilterLiteralFloat.from(Math.PI / 3.5),
|
|
405
410
|
CellFilterAngleToNormal.from(
|
|
406
|
-
|
|
411
|
+
CellFilterSampleLayerLinear.from(MirGridLayers.Heights),
|
|
407
412
|
Vector3.forward
|
|
408
413
|
)
|
|
409
414
|
)
|
|
@@ -494,32 +499,31 @@ const gHeights = GridTaskActionRuleSet.from({
|
|
|
494
499
|
rules: [
|
|
495
500
|
GridCellPlacementRule.from(
|
|
496
501
|
{
|
|
497
|
-
matcher: CellMatcherAny.INSTANCE,
|
|
498
|
-
|
|
499
|
-
|
|
502
|
+
matcher: CellMatcherAny.INSTANCE,
|
|
503
|
+
actions: GridCellActionWriteFilterToLayer.from(
|
|
504
|
+
MirGridLayers.Heights,
|
|
500
505
|
|
|
506
|
+
CellFilterLerp.from(
|
|
507
|
+
CellFilterLiteralFloat.from(0),
|
|
501
508
|
CellFilterLerp.from(
|
|
502
|
-
CellFilterLiteralFloat.from(
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
+
CellFilterLiteralFloat.from(-2),
|
|
510
|
+
CellFilterLiteralFloat.from(7),
|
|
511
|
+
CellFilterMultiply.from(
|
|
512
|
+
CellFilterSimplexNoise.from(30, 30),
|
|
513
|
+
CellFilterSimplexNoise.from(13, 13)
|
|
514
|
+
)
|
|
515
|
+
),
|
|
516
|
+
CellFilterGaussianBlur.from(
|
|
517
|
+
CellFilterCache.from(
|
|
518
|
+
CellFilterCellMatcher.from(
|
|
519
|
+
mHeightArea
|
|
509
520
|
)
|
|
510
521
|
),
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
CellFilterCellMatcher.from(
|
|
514
|
-
mHeightArea
|
|
515
|
-
)
|
|
516
|
-
),
|
|
517
|
-
1.5,
|
|
518
|
-
1.5
|
|
519
|
-
)
|
|
522
|
+
1.5,
|
|
523
|
+
1.5
|
|
520
524
|
)
|
|
521
525
|
)
|
|
522
|
-
|
|
526
|
+
)
|
|
523
527
|
}
|
|
524
528
|
)
|
|
525
529
|
]
|