@woosh/meep-engine 3.29.0 → 3.30.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/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
- package/src/core/binary/BinaryBuffer.js +14 -2
- package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/BVH.js +14 -1
- package/src/core/cache/FrequencySketch.d.ts +3 -1
- package/src/core/cache/FrequencySketch.d.ts.map +1 -1
- package/src/core/cache/FrequencySketch.js +10 -4
- package/src/core/cache/wtinylfu/CacheWTinylfu.d.ts.map +1 -1
- package/src/core/cache/wtinylfu/CacheWTinylfu.js +24 -2
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_vertex_quadrics.d.ts +20 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_vertex_quadrics.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_vertex_quadrics.js +69 -4
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts +48 -18
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.js +262 -70
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_fold_limit.d.ts +25 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_fold_limit.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_fold_limit.js +228 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_would_fold.d.ts +13 -0
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_would_fold.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_would_fold.js +10 -128
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_build_face_bvh.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_build_face_bvh.js +11 -1
- package/src/core/graph/mn_graph_collapse_weighted_edge.js +6 -6
- package/src/core/math/lookup/ParameterLookupTable.d.ts.map +1 -1
- package/src/core/math/lookup/ParameterLookupTable.js +10 -5
- package/src/core/math/noise/sdnoise.d.ts.map +1 -1
- package/src/core/math/noise/sdnoise.js +16 -10
- package/src/core/model/object/ImmutableObjectPool.d.ts.map +1 -1
- package/src/core/model/object/ImmutableObjectPool.js +17 -7
- package/src/core/process/executor/ConcurrentExecutor.d.ts +1 -5
- package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
- package/src/core/process/executor/ConcurrentExecutor.js +95 -1
- package/src/core/process/task/task_find_dependency_cycle.d.ts +17 -0
- package/src/core/process/task/task_find_dependency_cycle.d.ts.map +1 -0
- package/src/core/process/task/task_find_dependency_cycle.js +81 -0
- package/src/core/wfc/WFCCellChoice.d.ts +17 -0
- package/src/core/wfc/WFCCellChoice.d.ts.map +1 -0
- package/src/core/wfc/WFCCellChoice.js +36 -0
- package/src/core/wfc/WFCLattice.d.ts +105 -0
- package/src/core/wfc/WFCLattice.d.ts.map +1 -0
- package/src/core/wfc/WFCLattice.js +235 -0
- package/src/core/wfc/WFCRuleTable.d.ts +172 -0
- package/src/core/wfc/WFCRuleTable.d.ts.map +1 -0
- package/src/core/wfc/WFCRuleTable.js +334 -0
- package/src/core/wfc/WFCState.d.ts +273 -0
- package/src/core/wfc/WFCState.d.ts.map +1 -0
- package/src/core/wfc/WFCState.js +552 -0
- package/src/core/wfc/WFCStatus.d.ts +11 -0
- package/src/core/wfc/WFCStatus.d.ts.map +1 -0
- package/src/core/wfc/WFCStatus.js +28 -0
- package/src/core/wfc/WFCTileWeights.d.ts +48 -0
- package/src/core/wfc/WFCTileWeights.d.ts.map +1 -0
- package/src/core/wfc/WFCTileWeights.js +86 -0
- package/src/core/wfc/WFC_UNRESOLVED.d.ts +12 -0
- package/src/core/wfc/WFC_UNRESOLVED.d.ts.map +1 -0
- package/src/core/wfc/WFC_UNRESOLVED.js +11 -0
- package/src/core/wfc/wfc_estimate_bytes.d.ts +24 -0
- package/src/core/wfc/wfc_estimate_bytes.d.ts.map +1 -0
- package/src/core/wfc/wfc_estimate_bytes.js +47 -0
- package/src/core/wfc/wfc_rule_table_tile_components.d.ts +27 -0
- package/src/core/wfc/wfc_rule_table_tile_components.d.ts.map +1 -0
- package/src/core/wfc/wfc_rule_table_tile_components.js +80 -0
- package/src/core/wfc/wfc_solve.d.ts +21 -0
- package/src/core/wfc/wfc_solve.d.ts.map +1 -0
- package/src/core/wfc/wfc_solve.js +154 -0
- package/src/core/wfc/wfc_state_apply_boundary.d.ts +18 -0
- package/src/core/wfc/wfc_state_apply_boundary.d.ts.map +1 -0
- package/src/core/wfc/wfc_state_apply_boundary.js +61 -0
- package/src/core/wfc/wfc_state_assign.d.ts +11 -0
- package/src/core/wfc/wfc_state_assign.d.ts.map +1 -0
- package/src/core/wfc/wfc_state_assign.js +36 -0
- package/src/core/wfc/wfc_state_ban_bits.d.ts +17 -0
- package/src/core/wfc/wfc_state_ban_bits.d.ts.map +1 -0
- package/src/core/wfc/wfc_state_ban_bits.js +81 -0
- package/src/core/wfc/wfc_state_collapse.d.ts +12 -0
- package/src/core/wfc/wfc_state_collapse.d.ts.map +1 -0
- package/src/core/wfc/wfc_state_collapse.js +73 -0
- package/src/core/wfc/wfc_state_flush_dirty.d.ts +12 -0
- package/src/core/wfc/wfc_state_flush_dirty.d.ts.map +1 -0
- package/src/core/wfc/wfc_state_flush_dirty.js +39 -0
- package/src/core/wfc/wfc_state_propagate.d.ts +14 -0
- package/src/core/wfc/wfc_state_propagate.d.ts.map +1 -0
- package/src/core/wfc/wfc_state_propagate.js +155 -0
- package/src/core/wfc/wfc_state_read.d.ts +11 -0
- package/src/core/wfc/wfc_state_read.d.ts.map +1 -0
- package/src/core/wfc/wfc_state_read.js +38 -0
- package/src/core/wfc/wfc_state_restrict.d.ts +18 -0
- package/src/core/wfc/wfc_state_restrict.d.ts.map +1 -0
- package/src/core/wfc/wfc_state_restrict.js +39 -0
- package/src/core/wfc/wfc_state_set_eligible.d.ts +24 -0
- package/src/core/wfc/wfc_state_set_eligible.d.ts.map +1 -0
- package/src/core/wfc/wfc_state_set_eligible.js +49 -0
- package/src/core/wfc/wfc_state_undo_to.d.ts +13 -0
- package/src/core/wfc/wfc_state_undo_to.d.ts.map +1 -0
- package/src/core/wfc/wfc_state_undo_to.js +84 -0
- package/src/core/wfc/wfc_words_per_cell.d.ts +11 -0
- package/src/core/wfc/wfc_words_per_cell.d.ts.map +1 -0
- package/src/core/wfc/wfc_words_per_cell.js +16 -0
- package/src/engine/ecs/EntityComponentDataset.d.ts +8 -0
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +37 -14
- package/src/engine/ecs/fow/FogOfWarRevealerSystem.d.ts +8 -1
- package/src/engine/ecs/fow/FogOfWarRevealerSystem.d.ts.map +1 -1
- package/src/engine/ecs/fow/FogOfWarRevealerSystem.js +37 -2
- package/src/engine/ecs/guid/UUID.d.ts.map +1 -1
- package/src/engine/ecs/guid/UUID.js +45 -17
- package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.d.ts.map +1 -1
- package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +3 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js +366 -360
- package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_linear.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_linear.js +24 -10
- package/src/engine/grid/grid2transform/GridPosition2TransformSystem.d.ts.map +1 -1
- package/src/engine/grid/grid2transform/GridPosition2TransformSystem.js +24 -5
- package/src/engine/interpolation/Interpoland.d.ts +7 -1
- package/src/engine/interpolation/Interpoland.d.ts.map +1 -1
- package/src/engine/interpolation/Interpoland.js +8 -1
- package/src/engine/interpolation/InterpolationSystem.d.ts.map +1 -1
- package/src/engine/interpolation/InterpolationSystem.js +3 -0
- package/src/engine/interpolation/TransformPoseSerializationAdapter.d.ts +5 -3
- package/src/engine/interpolation/TransformPoseSerializationAdapter.d.ts.map +1 -1
- package/src/engine/interpolation/TransformPoseSerializationAdapter.js +14 -3
- package/src/engine/interpolation/pose_interpoland.d.ts.map +1 -1
- package/src/engine/interpolation/pose_interpoland.js +2 -0
- package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/NetworkPeer.js +15 -10
- package/src/engine/physics/cloth/ecs/ClothWorld.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothWorld.js +17 -0
- package/src/engine/physics/mls-mpm/MLS_MPM.d.ts.map +1 -1
- package/src/engine/physics/mls-mpm/MLS_MPM.js +14 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts +2 -1
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +1 -1
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts +1 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts +1 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts +2 -1
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +12 -3
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts +1 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +1 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/EventInstance.js +4 -1
- package/src/format/image/avif/av1/decode/decode_coefficients.d.ts.map +1 -1
- package/src/format/image/avif/av1/decode/decode_coefficients.js +248 -259
- package/src/format/image/avif/av1/decode/read_golomb.d.ts +21 -0
- package/src/format/image/avif/av1/decode/read_golomb.d.ts.map +1 -0
- package/src/format/image/avif/av1/decode/read_golomb.js +49 -0
- package/src/format/image/avif/av1/filter/loop_restoration.js +461 -451
- package/src/format/image/avif/av1/util/round2.d.ts +19 -2
- package/src/format/image/avif/av1/util/round2.d.ts.map +1 -1
- package/src/format/image/avif/av1/util/round2.js +51 -27
- package/src/format/image/avif/heif/parse_avif_file.js +24 -0
- package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/GPUTypedTable.js +14 -0
- package/src/shade/renderer/geometry/virtual/VIRTUAL_GEOMETRY_DESIGN.md +46 -3
- package/src/shade/renderer/geometry/virtual/WEDGE_PLAN_2026_09_18.md +91 -1
- package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.d.ts +0 -13
- package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.js +0 -15
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js +5 -5
- package/src/shade/renderer/geometry/virtual/build/mesh/VGEO_DEFAULT_ATTRIBUTE_WEIGHT_RATIOS.d.ts +11 -1
- package/src/shade/renderer/geometry/virtual/build/mesh/VGEO_DEFAULT_ATTRIBUTE_WEIGHT_RATIOS.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/mesh/VGEO_DEFAULT_ATTRIBUTE_WEIGHT_RATIOS.js +11 -1
- package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_compute_vertex_normals.d.ts +18 -9
- package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_compute_vertex_normals.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_compute_vertex_normals.js +20 -26
- package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_normalize_source.d.ts +1 -3
- package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_normalize_source.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_normalize_source.js +2 -5
- package/src/shade/renderer/geometry/virtual/build/vgeo_build.js +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.js +14 -1
- package/src/shade/renderer/global_illumination/probe/octahedral/GPUProbeAtlas.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe/octahedral/GPUProbeAtlas.js +12 -3
- package/src/shade/renderer/light/environment/rgbe/RGBE_ReadPixels_RLE.d.ts.map +1 -1
- package/src/shade/renderer/light/environment/rgbe/RGBE_ReadPixels_RLE.js +7 -1
- package/src/shade/renderer/lightmap/GPULightMap.d.ts.map +1 -1
- package/src/shade/renderer/lightmap/GPULightMap.js +349 -336
- package/src/shade/renderer/loader/gltf/load_gltf.d.ts.map +1 -1
- package/src/shade/renderer/loader/gltf/load_gltf.js +1137 -1128
- package/src/shade/renderer/particles/DESIGN.md +14 -5
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts +25 -10
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
- package/src/shade/renderer/particles/GPUParticleSystem.js +182 -38
- package/src/shade/renderer/particles/graph/groups/simplex_reference.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/groups/simplex_reference.js +16 -10
- package/src/shade/renderer/particles/graph_particles.d.ts +4 -2
- package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles.js +8 -2
- package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_vm_semantics.js +8 -2
- package/src/shade/renderer/particles/optimizer/pass_fold_constants.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/pass_fold_constants.js +10 -4
- package/src/shade/renderer/particles/shaders/shader_particle_init_free_list.d.ts +31 -0
- package/src/shade/renderer/particles/shaders/shader_particle_init_free_list.d.ts.map +1 -0
- package/src/shade/renderer/particles/shaders/shader_particle_init_free_list.js +62 -0
- package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts +13 -0
- package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts.map +1 -1
- package/src/shade/renderer/particles/vm/ParticleVMReference.js +95 -17
- package/src/shade/renderer/rasterize/bucket/rasterization_has_opaque_bucket.d.ts +21 -0
- package/src/shade/renderer/rasterize/bucket/rasterization_has_opaque_bucket.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/bucket/rasterization_has_opaque_bucket.js +28 -0
- package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.js +19 -2
- package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.js +19 -2
- package/src/shade/renderer/shader/type/WebGPUStruct.d.ts.map +1 -1
- package/src/shade/renderer/shader/type/WebGPUStruct.js +12 -0
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.d.ts +8 -2
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.d.ts.map +1 -1
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +41 -6
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +2383 -2356
- package/src/view/tooltip/DomTooltipManager.d.ts +7 -0
- package/src/view/tooltip/DomTooltipManager.d.ts.map +1 -1
- package/src/view/tooltip/DomTooltipManager.js +22 -0
- package/src/view/tooltip/DomTooltipObserver.d.ts.map +1 -1
- package/src/view/tooltip/DomTooltipObserver.js +13 -3
- package/src/shade/renderer/geometry/virtual/build/mesh/VGEO_CREASE_ANGLE.js +0 -45
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ctz32 } from "../binary/ctz32.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Rewind the wave, and everything derived from it, to a trail mark — the exact mirror of
|
|
5
|
+
* {@link wfc_state_ban_bits}.
|
|
6
|
+
*
|
|
7
|
+
* Cells touched are marked dirty so {@link wfc_state_flush_dirty} can repair the selection queue
|
|
8
|
+
* afterwards. The propagation queue is emptied rather than rewound: its contents were derived from
|
|
9
|
+
* a wave that no longer exists.
|
|
10
|
+
*
|
|
11
|
+
* @param {WFCState} state
|
|
12
|
+
* @param {number} trail_mark trail length to return to
|
|
13
|
+
*/
|
|
14
|
+
export function wfc_state_undo_to(state, trail_mark) {
|
|
15
|
+
const { wave, words_per_cell, possibility_count, weight_sum, weight_log_sum, eligible } = state;
|
|
16
|
+
const weight = state.weights.weight;
|
|
17
|
+
const weight_log_weight = state.weights.weight_log_weight;
|
|
18
|
+
|
|
19
|
+
let lowest_restored = state.cell_count;
|
|
20
|
+
|
|
21
|
+
for (let entry = state.trail_length - 1; entry >= trail_mark; entry--) {
|
|
22
|
+
const address = state.trail_address(entry);
|
|
23
|
+
const bits = state.trail_bits(entry);
|
|
24
|
+
|
|
25
|
+
wave[address] |= bits;
|
|
26
|
+
|
|
27
|
+
// `| 0` is an int32 conversion, which is why the constructor caps cell_count *
|
|
28
|
+
// words_per_cell below 2^31 rather than 2^32
|
|
29
|
+
const cell = (address / words_per_cell) | 0;
|
|
30
|
+
const word_index = address - (cell * words_per_cell);
|
|
31
|
+
const tile_base = word_index << 5;
|
|
32
|
+
|
|
33
|
+
let weight_delta = 0;
|
|
34
|
+
let weight_log_delta = 0;
|
|
35
|
+
let count = 0;
|
|
36
|
+
let rest = bits;
|
|
37
|
+
|
|
38
|
+
while (rest !== 0) {
|
|
39
|
+
const low = rest & -rest;
|
|
40
|
+
const tile = tile_base + ctz32(low);
|
|
41
|
+
|
|
42
|
+
rest ^= low;
|
|
43
|
+
count++;
|
|
44
|
+
|
|
45
|
+
weight_delta += weight[tile];
|
|
46
|
+
weight_log_delta += weight_log_weight[tile];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const old_count = possibility_count[cell];
|
|
50
|
+
const new_count = old_count + count;
|
|
51
|
+
|
|
52
|
+
possibility_count[cell] = new_count;
|
|
53
|
+
weight_sum[cell] += weight_delta;
|
|
54
|
+
weight_log_sum[cell] += weight_log_delta;
|
|
55
|
+
|
|
56
|
+
if (old_count <= 1 && new_count > 1 && eligible[cell] === 1) {
|
|
57
|
+
state.undecided_eligible++;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (state.dirty[cell] === 0) {
|
|
61
|
+
state.dirty[cell] = 1;
|
|
62
|
+
state.dirty_list[state.dirty_count++] = cell;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (cell < lowest_restored) {
|
|
66
|
+
lowest_restored = cell;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
state.trail_truncate(trail_mark);
|
|
71
|
+
|
|
72
|
+
for (let i = 0; i < state.queue_count; i++) {
|
|
73
|
+
state.in_queue[state.queue[i]] = 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
state.queue_count = 0;
|
|
77
|
+
state.contradiction = false;
|
|
78
|
+
|
|
79
|
+
// the scanline cursor has walked past cells that just became undecided again; rewind it to the
|
|
80
|
+
// earliest one rather than to zero, so a backtrack costs a short rescan instead of a full one
|
|
81
|
+
if (lowest_restored < state.scan_cursor) {
|
|
82
|
+
state.scan_cursor = lowest_restored;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many `u32` words a domain mask over `tile_count` tiles occupies.
|
|
3
|
+
*
|
|
4
|
+
* Written `W` throughout the module: the wave is `cell_count × W` words and a rule row is `W`, so
|
|
5
|
+
* this one number sets both the footprint and the cost of every mask operation.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} tile_count
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
export function wfc_words_per_cell(tile_count: number): number;
|
|
11
|
+
//# sourceMappingURL=wfc_words_per_cell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wfc_words_per_cell.d.ts","sourceRoot":"","sources":["../../../../src/core/wfc/wfc_words_per_cell.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,+CAHW,MAAM,GACJ,MAAM,CAMlB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { assert } from "../assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* How many `u32` words a domain mask over `tile_count` tiles occupies.
|
|
5
|
+
*
|
|
6
|
+
* Written `W` throughout the module: the wave is `cell_count × W` words and a rule row is `W`, so
|
|
7
|
+
* this one number sets both the footprint and the cost of every mask operation.
|
|
8
|
+
*
|
|
9
|
+
* @param {number} tile_count
|
|
10
|
+
* @returns {number}
|
|
11
|
+
*/
|
|
12
|
+
export function wfc_words_per_cell(tile_count) {
|
|
13
|
+
assert.isPositiveInteger(tile_count, 'tile_count');
|
|
14
|
+
|
|
15
|
+
return (tile_count + 31) >> 5;
|
|
16
|
+
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many handler slots the shared entity-event dispatch stack currently has reserved. Zero whenever
|
|
3
|
+
* no dispatch is in progress, so a non-zero reading at rest means a dispatch leaked its reservation
|
|
4
|
+
* and the stack will never be reused below that mark again. Diagnostic only — nothing in the dispatch
|
|
5
|
+
* path reads it.
|
|
6
|
+
* @returns {number}
|
|
7
|
+
*/
|
|
8
|
+
export function entity_event_dispatch_stack_depth(): number;
|
|
1
9
|
/**
|
|
2
10
|
* Represents a storage for entities and their associated components.
|
|
3
11
|
* Entities are just integer IDs and components are stored in a virtual table, where each component type has a separate column and each entity is a row in that table.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityComponentDataset.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityComponentDataset.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityComponentDataset.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityComponentDataset.js"],"names":[],"mappings":"AA6kEA;;;;;;GAMG;AACH,qDAFa,MAAM,CAIlB;AAj+DD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wDAfyB,MAAM;IAiB3B;;;;OAIG;IACH,wBAA+B;IAE/B;;;;;OAKG;IACH,yBAAsC;IAEtC;;;;;;;;;OASG;IACH,2BAAkC;IAElC;;;;;OAKG;IACH,yBAAsB;IAEtB;;;;OAIG;IACH,4BAAgC;IAEhC;;;;OAIG;IACH,2BAAuB;IAEvB;;;;OAIG;IACH,mBAAgB;IAEhB;;;;OAIG;IACH,oBAAgB;IAEhB;;;;;;;OAOG;IACH,mBAAe;IAEf;;;OAGG;IACH,8BAA+B;IAE/B;;;OAGG;IACH,8BAA+B;IAG/B;;;;OAIG;IACH,+BAA4B;IAE5B;;;;OAIG;IACH,kCAA+B;IAE/B;;;OAGG;IACH,kBAAe;IAGf;;;;;;OAMG;IACH,+BAJW,MAAM,iCAsChB;IAED;;;;;OAKG;IACH,sBAJW,cAAc,cACd,OAAO,GACL,OAAO,CAqDnB;IAED;;;;;OAKG;IACH,yBAJW,cAAc,cACd,OAAO,GACL,OAAO,CA6DnB;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,yBAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,qBACN,EAAE,SAmCZ;IAED;;;;;;;OAOG;IACH,6BANW,EAAE,iBACF,MAAM,aACN,MAAM,GACJ,MAAM,CAoClB;IAED;;;;;;;OAOG;IACH,4BAJW,MAAM,GACJ,EAAE,CA0Bd;IAED;;;;;OAKG;IACH,yBAJW,KAAK,EAAE,GACL,IAAI,CA0LhB;IAED;;;;OAIG;IACH,mCAHW,KAAK,EAAE,GACL,OAAO,CAenB;IAED;;;;;OAKG;IACH,gCAHW,KAAK,WAAS,GACb,OAAO,CASlB;IAED;;;OAGG;IACH,uBAFa,KAAK,EAAE,CAInB;IAED;;;;OAIG;IACH,kCAHW,KAAK,EAAE,GACL,OAAO,CAgBnB;IAED;;;;OAIG;IACH,4BAHW,KAAK,WAAS,GACZ,OAAO,CAanB;IAED;;;;OAIG;IACH,8BAHW,KAAK,GACH,OAAO,CAkBnB;IAED;;;;OAIG;IACH,iCAHW,MAAM,GACJ,IAAI,CAmBhB;IAED;;;;;OAKG;IACH,+BAHW,MAAM,GACJ,MAAM,CAOlB;IAED;;;;OAIG;IACH,2BAiBC;IAED;;;OAGG;IACH,gBAFa,MAAM,CAQlB;IAED;;;;;OAKG;IACH,gCAJW,MAAM,GAEJ,IAAI,CAQhB;IAED;;;;OAIG;IACH,0BAHW,MAAM,GACJ,OAAO,CAMnB;IAED;;;;OAIG;IACH,qCAHW,MAAM,GACJ,OAAO,CAMnB;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,OAAO,CAwCnB;IAED;;;;;OAKG;IACH,2BAHW,MAAM,EAAE,GACN,IAAI,CAQhB;IAED;;;;;OAKG;IACH,qCAJW,MAAM,SACN,KAAK,GACH,IAAI,CAUhB;IAED;;;;;OAKG;IACH,4CAJW,MAAM,mBACN,MAAM,GACJ,IAAI,CAiBhB;IAED;;;;;;;OAOG;IACH,mDAgBC;IAED;;;;OAIG;IACH,iCAHW,WAAS,KAAK,GACZ,MAAM,CAalB;IAED;;;;OAIG;IACH,wCAFa,MAAM,CAUlB;IAED;;;;;;;OAOG;IACH;gBAFqB,MAAM;;MA2B1B;IAED;;;;;;;;OAQG;IACH,mCAJW,MAAM,0BAEJ,IAAI,CAqBhB;IAED;;;;;;;OAOG;IACH,4CALW,MAAM,mBACN,MAAM,4BAEJ,IAAI,CA4BhB;IAED;;;;;OAKG;IACH,oCAJW,MAAM,mBACN,MAAM,OAUhB;IAED;;;;;;OAMG;IACH,6BAJW,MAAM,+DAEJ,OAAO,CAInB;IAED;;;;;OAKG;IACH,6BAJW,MAAM,mEAiBhB;IAED;;;;;;;OAOG;IACH,iCALW,MAAM,mEAahB;IAED;;;;;;;OAOG;IACH,sDALW,KAAK,sCAGH,IAAI,CAiBhB;IAED;;;;;;;;;;;;;OAaG;IACH,gEAJ6B,OAAO,YACzB,MAAM,GACJ,IAAI,CAsEhB;IAED;;;;;;;OAOG;IACH,uEAFa,IAAI,CA0DhB;IAkBD;;;;;;;;;;OAUG;IACH,qHAJiC,MAAM,KAAK,IAAI,kBAEnC,IAAI,CAahB;IAED;;;;;;OAMG;IACH,2CALW,MAAM,qCAGJ,IAAI,CAShB;IAED;;;;;;;OAOG;IACH,+CAyBC;IAED;;;;;;OAMG;IACH,iDAsBC;IAED;;;;;OAKG;IACH,wCAgCC;IAED;;;;;OAKG;IACH,0CA2BC;IAED;;;;;;;;;OASG;IACH,kCARW,MAAM,sCAGJ,IAAI,CAuBhB;IAED;;;;;;;;;OASG;IACH,qCARW,MAAM,sCAGJ,OAAO,CAkCnB;IAED;;;;;;;;;;OAUG;IACH,+BATW,MAAM,cACN,MAAM,uCAGJ,IAAI,CAiChB;IAED;;;;;;;;;;OAUG;IACH,kCATW,MAAM,cACN,MAAM,sCAGJ,OAAO,CA2CnB;IAED;;;;;;;OAOG;IACH,kBANW,MAAM,QACN,MAAM,gBAEJ,IAAI,CAmBhB;IAED;;;;OAIG;IACH,+BAHW,MAAM,GACJ,OAAO,CAenB;IAED;;;;OAIG;IACH,SAHa,IAAI,CAShB;IAED;;;;;OAKG;IACH,YAHa,IAAI,CAgBhB;IAED;;;;OAIG;IACH,yCAHW,MAAM,kEAkBhB;IAED;;;;;OAKG;IACH,mBAHW,sBAAsB,6BACpB,IAAI,CA6DhB;IAED;;;;;OAKG;IACH,qEAHW,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,GACzE,IAAI,CAgDhB;IAED;;;OAGG;IACH,WAFa,OAAO,CAInB;IAED;;;;;OAKG;IACH,+BAJW,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,kBAE3B,IAAI,CAgBhB;IAGL;;;;;OAKG;IACH,mCAFU,OAAO,CAEwC;IAIzD;;OAEG;IACH,4BAjnBgB,UAAU,MAAM,CAAC,CAinBoB;IAErD;;OAEG;IACH,iCAnZe,MAAM,wCAGJ,OAAO,CAgZ+B;IAxnBnD;;;OAGG;IACH,qBAFY,UAAU,MAAM,CAAC,CAY5B;CAslBJ;6BAlgEY,OAAO,gCAAgC,EAAE,KAAK,CAAC,CAAC,CAAC;6BAIjD,OAAO,qBAAqB,EAAE,cAAc"}
|
|
@@ -2123,6 +2123,17 @@ const entityListenersProxy = [];
|
|
|
2123
2123
|
*/
|
|
2124
2124
|
let entityListenersProxyPointer = 0;
|
|
2125
2125
|
|
|
2126
|
+
/**
|
|
2127
|
+
* How many handler slots the shared entity-event dispatch stack currently has reserved. Zero whenever
|
|
2128
|
+
* no dispatch is in progress, so a non-zero reading at rest means a dispatch leaked its reservation
|
|
2129
|
+
* and the stack will never be reused below that mark again. Diagnostic only — nothing in the dispatch
|
|
2130
|
+
* path reads it.
|
|
2131
|
+
* @returns {number}
|
|
2132
|
+
*/
|
|
2133
|
+
export function entity_event_dispatch_stack_depth() {
|
|
2134
|
+
return entityListenersProxyPointer;
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2126
2137
|
/**
|
|
2127
2138
|
*
|
|
2128
2139
|
* @param {Object<SignalHandler[]>} hash
|
|
@@ -2159,15 +2170,24 @@ function dispatchEventListenersByHash(hash, entity, name, event) {
|
|
|
2159
2170
|
}
|
|
2160
2171
|
|
|
2161
2172
|
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2173
|
+
/**
|
|
2174
|
+
* `finally`, because the restore is what hands these slots back. A handler that throws unwinds
|
|
2175
|
+
* past a bare restore — through every enclosing dispatch frame too, since `sendEvent` does not
|
|
2176
|
+
* catch — and the pointer then stays at that dispatch's high-water mark for the life of the page,
|
|
2177
|
+
* with `entityListenersProxy` growing above it and holding every handler and `context` it ever
|
|
2178
|
+
* saw. User handlers are exactly the code most likely to throw.
|
|
2179
|
+
*/
|
|
2180
|
+
try {
|
|
2181
|
+
//invoke handlers
|
|
2182
|
+
for (let i = 0; i < numListeners; i++) {
|
|
2183
|
+
const handler = entityListenersProxy[i + pointerOffset];
|
|
2165
2184
|
|
|
2166
|
-
|
|
2185
|
+
handler.handle.call(handler.context, event, entity);
|
|
2186
|
+
}
|
|
2187
|
+
} finally {
|
|
2188
|
+
//reset proxy
|
|
2189
|
+
entityListenersProxyPointer = pointerOffset;
|
|
2167
2190
|
}
|
|
2168
|
-
|
|
2169
|
-
//reset proxy
|
|
2170
|
-
entityListenersProxyPointer = pointerOffset;
|
|
2171
2191
|
}
|
|
2172
2192
|
|
|
2173
2193
|
/**
|
|
@@ -2201,13 +2221,16 @@ function dispatchAnyEventListenersByHash(listeners, entity, name, event) {
|
|
|
2201
2221
|
}
|
|
2202
2222
|
|
|
2203
2223
|
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2224
|
+
//`finally` for the same reason as in dispatchEventListenersByHash above
|
|
2225
|
+
try {
|
|
2226
|
+
//invoke handlers
|
|
2227
|
+
for (let i = 0; i < numListeners; i++) {
|
|
2228
|
+
const handler = entityListenersProxy[i + pointerOffset];
|
|
2207
2229
|
|
|
2208
|
-
|
|
2230
|
+
handler.handle.call(handler.context, name, event, entity);
|
|
2231
|
+
}
|
|
2232
|
+
} finally {
|
|
2233
|
+
//reset proxy
|
|
2234
|
+
entityListenersProxyPointer = pointerOffset;
|
|
2209
2235
|
}
|
|
2210
|
-
|
|
2211
|
-
//reset proxy
|
|
2212
|
-
entityListenersProxyPointer = pointerOffset;
|
|
2213
2236
|
}
|
|
@@ -21,7 +21,14 @@ export class FogOfWarRevealerSystem extends System<any> {
|
|
|
21
21
|
*/
|
|
22
22
|
link(revealer: FogOfWarRevealer, transform: Transform64, team: Team, entity: any): void;
|
|
23
23
|
forceUpdate(): void;
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {FogOfWarRevealer} revealer
|
|
27
|
+
* @param {Transform64} transform
|
|
28
|
+
* @param {Team} team
|
|
29
|
+
* @param {number} entity
|
|
30
|
+
*/
|
|
31
|
+
unlink(revealer: FogOfWarRevealer, transform: Transform64, team: Team, entity: number): void;
|
|
25
32
|
}
|
|
26
33
|
import { System } from "../System.js";
|
|
27
34
|
import { Transform64 } from "../transform/Transform64.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FogOfWarRevealerSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/fow/FogOfWarRevealerSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FogOfWarRevealerSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/fow/FogOfWarRevealerSystem.js"],"names":[],"mappings":"AAcA;IAOI;;;OAGG;IACH,kBAFW,MAAM,EAUhB;IAlBD,6EAAqD;IACrD,gEAEE;IACF,YAAU;IASN;;;OAGG;IACH,MAFU,MAAM,CAEA;IAGpB;;;;;;OAMG;IACH,eALW,gBAAgB,aAChB,WAAW,QACX,IAAI,qBAqFd;IAED,oBAmCC;IAED;;;;;;OAMG;IACH,iBALW,gBAAgB,aAChB,WAAW,QACX,IAAI,UACJ,MAAM,QAQhB;CACJ;uBAjLsB,cAAc;4BAKT,6BAA6B;iCAJxB,uBAAuB;iBAGvC,iBAAiB;yBADT,eAAe;4CAMI,oDAAoD"}
|
|
@@ -4,6 +4,7 @@ import { SignalBinding } from "../../../core/events/signal/SignalBinding.js";
|
|
|
4
4
|
import { FogOfWar } from "./FogOfWar.js";
|
|
5
5
|
import Team from "../team/Team.js";
|
|
6
6
|
import { Transform64 } from "../transform/Transform64.js";
|
|
7
|
+
import { TRANSFORM64_EVENT_CHANGE } from "../transform/TRANSFORM64_EVENT_CHANGE.js";
|
|
7
8
|
import Vector2 from "../../../core/geom/Vector2.js";
|
|
8
9
|
import { obtainTerrain } from "../terrain/util/obtainTerrain.js";
|
|
9
10
|
import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
|
|
@@ -67,7 +68,34 @@ export class FogOfWarRevealerSystem extends System {
|
|
|
67
68
|
|
|
68
69
|
const signalBindings = [];
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Transform64 carries no signals — TRANSFORM64_EVENT_CHANGE exists precisely because
|
|
73
|
+
* `position.onChanged` is gone — so the watch is registered against the entity and the
|
|
74
|
+
* transform's own change event. Wrapped to keep the link/unlink shape the team watcher
|
|
75
|
+
* below and `unlink` both rely on; `addEntityEventListener` has no idempotence of its own,
|
|
76
|
+
* hence the flag.
|
|
77
|
+
*/
|
|
78
|
+
let transform_watched = false;
|
|
79
|
+
|
|
80
|
+
const positionWatcher = {
|
|
81
|
+
link() {
|
|
82
|
+
if (transform_watched) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
em.dataset.addEntityEventListener(entity, TRANSFORM64_EVENT_CHANGE, update);
|
|
87
|
+
transform_watched = true;
|
|
88
|
+
},
|
|
89
|
+
unlink() {
|
|
90
|
+
if (!transform_watched) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
em.dataset.removeEntityEventListener(entity, TRANSFORM64_EVENT_CHANGE, update);
|
|
95
|
+
transform_watched = false;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
71
99
|
signalBindings.push(positionWatcher);
|
|
72
100
|
|
|
73
101
|
|
|
@@ -133,7 +161,14 @@ export class FogOfWarRevealerSystem extends System {
|
|
|
133
161
|
}
|
|
134
162
|
}
|
|
135
163
|
|
|
136
|
-
|
|
164
|
+
/**
|
|
165
|
+
*
|
|
166
|
+
* @param {FogOfWarRevealer} revealer
|
|
167
|
+
* @param {Transform64} transform
|
|
168
|
+
* @param {Team} team
|
|
169
|
+
* @param {number} entity
|
|
170
|
+
*/
|
|
171
|
+
unlink(revealer, transform, team, entity) {
|
|
137
172
|
const bindings = this.data[entity];
|
|
138
173
|
|
|
139
174
|
bindings.forEach(b => b.unlink());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUID.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UUID.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/guid/UUID.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IA2HI;;;OAGG;IACH,aAFY,IAAI,CAQf;IAkBD;;;OAGG;IACH,aAFa,IAAI,CAQhB;IAED;;;;OAIG;IACH,iBAFY,MAAM,CAIjB;IA6CD;;;;OAIG;IACH,qBAHW,MAAM,GACL,IAAI,CAQf;IA/ND;;;OAGG;IACH,4BAKC;IAED;;;OAGG;IACH,uBAEC;IAED;;;;;;;;OAQG;IACH,sBAKC;IAED;;;;OAIG;IACH,OAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,MAFa,IAAI,CAwEhB;IAcD;;;OAGG;IACH,MAFa,IAAI,CAYhB;IAuBD;;;OAGG;IACH,cAFW,MAAM,QAuChB;IAeD;;;;;;OAMG;IACH,YAFa,MAAM,CA2BlB;IAED;;;OAGG;IACH,YAFW,IAAI,QAId;IAED;;;OAGG;IACH,SAFY,IAAI,CAQf;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAcnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAYlB;IAIL;;OAEG;IACH,uBAzFiB,MAAM,CAyFF;IAErB;;OAEG;IACH,4BAzJe,MAAM,UAyJE;IAQvB;;;OAGG;IACH,iBAFU,OAAO,CAEI;;CAtBpB;;kBAcS,MAAM"}
|
|
@@ -2,26 +2,63 @@ import { assert } from "../../../core/assert.js";
|
|
|
2
2
|
import { dec2hex } from "../../../core/binary/dec2hex.js";
|
|
3
3
|
import { hex2dec } from "../../../core/binary/hex2dec.js";
|
|
4
4
|
import { array_copy } from "../../../core/collection/array/array_copy.js";
|
|
5
|
-
import { randomBytes } from "../../../core/math/random/randomBytes.js";
|
|
6
|
-
import { randomUint8 } from "../../../core/math/random/randomUint8.js";
|
|
7
|
-
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
8
5
|
|
|
9
6
|
// Previous uuid creation time
|
|
10
7
|
let _last_milliseconds = 0;
|
|
11
8
|
let _last_nanoseconds = 0;
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Bytes drawn ahead from `crypto.getRandomValues`, and how many of them are still unread.
|
|
12
|
+
*
|
|
13
|
+
* These identifiers are not allowed to be a function of the clock. `NetworkSession` mints a
|
|
14
|
+
* {@link UUID.v1} as a peer's reconnect credential and authenticates a reconnect by comparing against
|
|
15
|
+
* it, and a v1 carries no entropy beyond the node id and the clock sequence below — so seeding those
|
|
16
|
+
* from `Date.now()`, as this module used to, reduced that credential to "which millisecond did the
|
|
17
|
+
* host load". `UUID.string()` also backs element ids, `DynamicRuleDescription.id` and `Tile.uuid`,
|
|
18
|
+
* which two clients loading in the same millisecond would then collide on outright.
|
|
19
|
+
*
|
|
20
|
+
* Drawn a block at a time rather than 16 bytes per call: `getRandomValues` is a per-call cost, and
|
|
21
|
+
* these are minted in loops. The pool holds no more than one block, so nothing accumulates.
|
|
22
|
+
* @type {Uint8Array}
|
|
23
|
+
*/
|
|
24
|
+
const _entropy_pool = new Uint8Array(1024);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @type {number} read cursor into {@link _entropy_pool}; `length` means exhausted
|
|
28
|
+
*/
|
|
29
|
+
let _entropy_pool_position = _entropy_pool.length;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Fill `count` bytes of `destination` from `offset` with cryptographically strong randomness.
|
|
33
|
+
* @param {Uint8Array} destination
|
|
34
|
+
* @param {number} offset
|
|
35
|
+
* @param {number} count
|
|
36
|
+
*/
|
|
37
|
+
function fill_random_bytes(destination, offset, count) {
|
|
38
|
+
for (let i = 0; i < count; i++) {
|
|
39
|
+
if (_entropy_pool_position >= _entropy_pool.length) {
|
|
40
|
+
crypto.getRandomValues(_entropy_pool);
|
|
41
|
+
_entropy_pool_position = 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
destination[offset + i] = _entropy_pool[_entropy_pool_position];
|
|
45
|
+
|
|
46
|
+
_entropy_pool_position++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
15
49
|
|
|
16
50
|
// node and clockseq need to be initialized to random values.
|
|
17
51
|
const _node_id = new Uint8Array(6);
|
|
18
52
|
|
|
19
53
|
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
20
|
-
|
|
54
|
+
fill_random_bytes(_node_id, 0, 6);
|
|
21
55
|
_node_id[0] |= 0x01;
|
|
22
56
|
|
|
23
57
|
// Per 4.2.2, randomize (14 bit) clockseq
|
|
24
|
-
|
|
58
|
+
const _clock_seq_bytes = new Uint8Array(2);
|
|
59
|
+
fill_random_bytes(_clock_seq_bytes, 0, 2);
|
|
60
|
+
|
|
61
|
+
let _clock_seq = ((_clock_seq_bytes[0] << 8) | _clock_seq_bytes[1]) & 0x3fff;
|
|
25
62
|
|
|
26
63
|
/**
|
|
27
64
|
* Universally Unique Identifier (UUID), a 128 bit label used to uniquely identify resources.
|
|
@@ -187,16 +224,7 @@ export class UUID {
|
|
|
187
224
|
|
|
188
225
|
const data = this.data;
|
|
189
226
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const r = (random() * 4294967296) >>> 0;
|
|
193
|
-
|
|
194
|
-
data[i] = r & 0xff;
|
|
195
|
-
data[i + 1] = (r >>> 8) & 0xff;
|
|
196
|
-
data[i + 2] = (r >>> 16) & 0xff;
|
|
197
|
-
data[i + 3] = (r >>> 24) & 0xff;
|
|
198
|
-
|
|
199
|
-
}
|
|
227
|
+
fill_random_bytes(data, 0, 16);
|
|
200
228
|
|
|
201
229
|
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
202
230
|
data[6] = (data[6] & 0x0f) | 0x40;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneBoneSurfaceAlignmentSolver.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js"],"names":[],"mappings":"AA4CA;;GAEG;AACH;IACI,
|
|
1
|
+
{"version":3,"file":"OneBoneSurfaceAlignmentSolver.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js"],"names":[],"mappings":"AA4CA;;GAEG;AACH;IACI,0BAuGC;CACJ;yBA/IwB,eAAe"}
|
|
@@ -144,7 +144,9 @@ export class OneBoneSurfaceAlignmentSolver extends IKSolver {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
//slerp, not lerp: see ClingToTerrainSystem.alignToVector. A componentwise blend is not a
|
|
148
|
+
//unit quaternion, and `ik_write_local_rotation` writes it straight into the Transform64.
|
|
149
|
+
r.slerp(target, constraint.strength * influence);
|
|
148
150
|
|
|
149
151
|
ik_write_local_rotation(dataset, bone, r);
|
|
150
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClingToTerrainSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js"],"names":[],"mappings":"AA8MA;;;;;;;GAOG;AACH,wCANW,UAAU,aACV,OAAO,gBACP,MAAM,
|
|
1
|
+
{"version":3,"file":"ClingToTerrainSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js"],"names":[],"mappings":"AA8MA;;;;;;;GAOG;AACH,wCANW,UAAU,aACV,OAAO,gBACP,MAAM,yCA4ChB;;uBA3PsB,wCAAwC;oBAE3C,qCAAqC;AAyCzD;;IAGI,6DAA6C;IAG7C,mHAGE;IAEF;;;OAGG;IACH,aAFU,MAAM,MAAM,CAAC,CAEG;IAE1B,YAAU;IAEV;;;OAGG;IACH,kBAFU,MAAM,CAEwB;IAExC;;;OAGG;IACH,sBAFW,MAAM,QAOhB;IAED;;;;;OAKG;IACH,YAHW,cAAc,aADd,WAAW,YAEX,MAAM,QAyBhB;IAED;;;;;OAKG;IACH,cAHW,cAAc,aADd,WAAW,YAEX,MAAM,QAgBhB;IAED,6BAiDC;CACJ;uBA9KsB,oBAAoB;4BACf,mCAAmC;2BAIpC,qBAAqB;4CANJ,0DAA0D;oBAIlF,eAAe;sBAbb,+CAA+C"}
|