@woosh/meep-engine 2.113.3 → 2.113.6
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/meep.cjs +40 -34
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +40 -34
- package/package.json +1 -1
- package/src/core/binary/bitset_find_clear_gap.d.ts +10 -0
- package/src/core/binary/bitset_find_clear_gap.d.ts.map +1 -0
- package/src/core/binary/bitset_find_clear_gap.js +30 -0
- package/src/core/collection/array/combine_hash.d.ts +7 -0
- package/src/core/collection/array/combine_hash.d.ts.map +1 -0
- package/src/core/collection/array/combine_hash.js +13 -0
- package/src/core/collection/array/computeHashIntegerArray.d.ts.map +1 -1
- package/src/core/collection/array/computeHashIntegerArray.js +4 -7
- package/src/core/collection/array/typed/uint_array_for_count.d.ts +2 -2
- package/src/core/collection/array/typed/uint_array_for_count.d.ts.map +1 -1
- package/src/core/collection/array/typed/uint_array_for_count.js +5 -2
- package/src/core/collection/map/HashMap.js +1 -1
- package/src/core/function/FunctionCompiler.js +3 -3
- package/src/core/geom/ConicRay.js +2 -2
- package/src/core/geom/Vector4.js +2 -2
- package/src/core/math/{isPowerOrTwo.d.ts → isPowerOfTwo.d.ts} +1 -1
- package/src/core/math/isPowerOfTwo.d.ts.map +1 -0
- package/src/core/model/node-graph/NodeGraph.d.ts +8 -0
- package/src/core/model/node-graph/NodeGraph.d.ts.map +1 -1
- package/src/core/model/node-graph/NodeGraph.js +29 -0
- package/src/core/model/node-graph/node/NodeInstancePortReference.js +2 -2
- package/src/core/model/reactive/model/ReactiveBinaryExpression.d.ts.map +1 -1
- package/src/core/model/reactive/model/ReactiveBinaryExpression.js +2 -2
- package/src/core/model/reactive/model/terminal/ReactiveReference.d.ts.map +1 -1
- package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -2
- package/src/core/primitives/strings/computeStringHash.d.ts.map +1 -1
- package/src/core/primitives/strings/computeStringHash.js +13 -4
- package/src/engine/animation/curve/compression/downsample_float_array_curve_by_error.js +4 -4
- package/src/engine/asset/AssetDescription.js +2 -2
- package/src/engine/asset/loaders/material/computeMaterialHash.js +6 -6
- package/src/engine/asset/loaders/material/computeTextureHash.js +2 -2
- package/src/engine/ecs/animation/Animation.js +2 -2
- package/src/engine/ecs/animation/AnimationClip.d.ts.map +1 -1
- package/src/engine/ecs/animation/AnimationClip.js +4 -4
- package/src/engine/ecs/gui/GUIElement.js +2 -2
- package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +2 -2
- package/src/engine/ecs/gui/position/ViewportPosition.js +2 -2
- package/src/engine/ecs/ik/IKConstraint.d.ts.map +1 -1
- package/src/engine/ecs/ik/IKConstraint.js +3 -3
- package/src/engine/graphics/ecs/animation/animator/AnimationClip.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/AnimationClip.js +4 -4
- package/src/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +4 -4
- package/src/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +3 -3
- package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +8 -8
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +3 -3
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +2 -2
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +2 -2
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +8 -3
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrack.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrack.js +3 -3
- package/src/engine/graphics/particles/particular/engine/parameter/ParticleParameter.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParticleParameter.js +4 -4
- package/src/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.d.ts.map +1 -1
- package/src/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +4 -4
- package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.js +2 -2
- package/src/engine/grid/obstacle/GridObstacle.js +2 -2
- package/src/engine/intelligence/behavior/selector/WeightedElement.js +2 -2
- package/src/engine/sound/ecs/emitter/SoundEmitter.js +2 -2
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundTrack.js +6 -6
- package/src/misc/makeMaterialIconCached.js +2 -2
- package/src/view/common/HTMLElementCacheKey.d.ts.map +1 -1
- package/src/view/common/HTMLElementCacheKey.js +5 -5
- package/src/core/math/isPowerOrTwo.d.ts.map +0 -1
- /package/src/core/math/{isPowerOrTwo.js → isPowerOfTwo.js} +0 -0
package/build/meep.module.js
CHANGED
|
@@ -50533,11 +50533,12 @@ function computeIntegerArrayHash(data, offset, length) {
|
|
|
50533
50533
|
}
|
|
50534
50534
|
|
|
50535
50535
|
/**
|
|
50536
|
-
* Computes hash on integer values
|
|
50536
|
+
* Computes hash on integer values, useful for building composite hashes
|
|
50537
50537
|
* @param {...number} value
|
|
50538
50538
|
* @returns {number}
|
|
50539
50539
|
*/
|
|
50540
|
-
function
|
|
50540
|
+
function combine_hash(...value) {
|
|
50541
|
+
|
|
50541
50542
|
return computeIntegerArrayHash(value, 0, value.length);
|
|
50542
50543
|
}
|
|
50543
50544
|
|
|
@@ -50799,7 +50800,7 @@ class Vector4 {
|
|
|
50799
50800
|
* @return {number}
|
|
50800
50801
|
*/
|
|
50801
50802
|
hash() {
|
|
50802
|
-
return
|
|
50803
|
+
return combine_hash(
|
|
50803
50804
|
computeHashFloat(this.x),
|
|
50804
50805
|
computeHashFloat(this.y),
|
|
50805
50806
|
computeHashFloat(this.z),
|
|
@@ -50926,16 +50927,21 @@ function computeStringHash(string) {
|
|
|
50926
50927
|
|
|
50927
50928
|
const length = string.length;
|
|
50928
50929
|
|
|
50929
|
-
let hash =
|
|
50930
|
+
let hash = length;
|
|
50930
50931
|
|
|
50931
50932
|
for (let i = 0; i < length; i++) {
|
|
50932
|
-
const
|
|
50933
|
+
const code_point = string.charCodeAt(i);
|
|
50933
50934
|
|
|
50934
|
-
|
|
50935
|
+
/*
|
|
50936
|
+
* Avoiding potentially expensive multiplication operation by using 2 cheaper operation instead
|
|
50937
|
+
* (h<<5) - h === h*31
|
|
50938
|
+
*/
|
|
50939
|
+
hash = ((hash << 5) - hash) + code_point;
|
|
50935
50940
|
|
|
50936
50941
|
}
|
|
50937
50942
|
|
|
50938
|
-
|
|
50943
|
+
// force uint32
|
|
50944
|
+
return hash >>> 0;
|
|
50939
50945
|
}
|
|
50940
50946
|
|
|
50941
50947
|
/**
|
|
@@ -59809,9 +59815,9 @@ function array_swap_one(array, index0, index1) {
|
|
|
59809
59815
|
}
|
|
59810
59816
|
|
|
59811
59817
|
/**
|
|
59812
|
-
*
|
|
59818
|
+
* @example `const my_array = new ( UintArrayForCount(x) )(length);`
|
|
59813
59819
|
* @param {number} max_value maximum value to be contained in the array
|
|
59814
|
-
* @returns {function} constructor
|
|
59820
|
+
* @returns {function} TypedArray constructor
|
|
59815
59821
|
*/
|
|
59816
59822
|
function UintArrayForCount(max_value) {
|
|
59817
59823
|
|
|
@@ -75863,15 +75869,6 @@ class GenericRendererAdapter extends AbstractRenderAdapter {
|
|
|
75863
75869
|
|
|
75864
75870
|
}
|
|
75865
75871
|
|
|
75866
|
-
/**
|
|
75867
|
-
*
|
|
75868
|
-
* @param {Plane} plane
|
|
75869
|
-
* @returns {number}
|
|
75870
|
-
*/
|
|
75871
|
-
function planeHash(plane) {
|
|
75872
|
-
return mortonEncode_magicbits(plane.normal.x, plane.normal.y, plane.normal.z) ^ plane.constant;
|
|
75873
|
-
}
|
|
75874
|
-
|
|
75875
75872
|
/**
|
|
75876
75873
|
* @template T
|
|
75877
75874
|
* @param {T[]} array
|
|
@@ -75897,6 +75894,23 @@ function computeHashArray(array, elementHashFunction, thisArg) {
|
|
|
75897
75894
|
return hash;
|
|
75898
75895
|
}
|
|
75899
75896
|
|
|
75897
|
+
/**
|
|
75898
|
+
*
|
|
75899
|
+
* @param {THREE.Color} c
|
|
75900
|
+
*/
|
|
75901
|
+
function computeHashColor(c) {
|
|
75902
|
+
return c.getHex();
|
|
75903
|
+
}
|
|
75904
|
+
|
|
75905
|
+
/**
|
|
75906
|
+
*
|
|
75907
|
+
* @param {Plane} plane
|
|
75908
|
+
* @returns {number}
|
|
75909
|
+
*/
|
|
75910
|
+
function planeHash(plane) {
|
|
75911
|
+
return mortonEncode_magicbits(plane.normal.x, plane.normal.y, plane.normal.z) ^ plane.constant;
|
|
75912
|
+
}
|
|
75913
|
+
|
|
75900
75914
|
/**
|
|
75901
75915
|
*
|
|
75902
75916
|
* @param {THREE.Texture} texture
|
|
@@ -75910,14 +75924,6 @@ function textureHashById(texture) {
|
|
|
75910
75924
|
return texture.id;
|
|
75911
75925
|
}
|
|
75912
75926
|
|
|
75913
|
-
/**
|
|
75914
|
-
*
|
|
75915
|
-
* @param {THREE.Color} c
|
|
75916
|
-
*/
|
|
75917
|
-
function computeHashColor(c) {
|
|
75918
|
-
return c.getHex();
|
|
75919
|
-
}
|
|
75920
|
-
|
|
75921
75927
|
/**
|
|
75922
75928
|
*
|
|
75923
75929
|
* @param {Material|MeshStandardMaterial|ShaderMaterial} material
|
|
@@ -75925,7 +75931,7 @@ function computeHashColor(c) {
|
|
|
75925
75931
|
*/
|
|
75926
75932
|
function computeMaterialHash(material) {
|
|
75927
75933
|
|
|
75928
|
-
let hash =
|
|
75934
|
+
let hash = combine_hash(
|
|
75929
75935
|
computeHashFloat(material.alphaTest),
|
|
75930
75936
|
material.blendDst,
|
|
75931
75937
|
material.blendDstAlpha === null ? 0 : computeHashFloat(material.blendDstAlpha),
|
|
@@ -75959,7 +75965,7 @@ function computeMaterialHash(material) {
|
|
|
75959
75965
|
|
|
75960
75966
|
|
|
75961
75967
|
if (material.isMeshStandardMaterial) {
|
|
75962
|
-
hash =
|
|
75968
|
+
hash = combine_hash(
|
|
75963
75969
|
hash,
|
|
75964
75970
|
computeHashColor(material.color),
|
|
75965
75971
|
computeHashFloat(material.roughness),
|
|
@@ -76507,7 +76513,7 @@ function computeTextureHash(t) {
|
|
|
76507
76513
|
|
|
76508
76514
|
const specificHash = computeSpecificHash(t);
|
|
76509
76515
|
|
|
76510
|
-
return
|
|
76516
|
+
return combine_hash(
|
|
76511
76517
|
t.mapping,
|
|
76512
76518
|
t.wrapS,
|
|
76513
76519
|
t.wrapT,
|
|
@@ -85548,7 +85554,7 @@ class AssetDescription {
|
|
|
85548
85554
|
* @returns {number}
|
|
85549
85555
|
*/
|
|
85550
85556
|
hash() {
|
|
85551
|
-
return
|
|
85557
|
+
return combine_hash(
|
|
85552
85558
|
computeStringHash(this.path),
|
|
85553
85559
|
computeStringHash(this.type)
|
|
85554
85560
|
);
|
|
@@ -98228,7 +98234,7 @@ function isArrayEqual(first, second) {
|
|
|
98228
98234
|
* @param {KeyValuePair<string,string>} pair
|
|
98229
98235
|
*/
|
|
98230
98236
|
function computeStringPairHash(pair) {
|
|
98231
|
-
return
|
|
98237
|
+
return combine_hash(
|
|
98232
98238
|
computeStringHash(pair.key),
|
|
98233
98239
|
computeStringHash(pair.value)
|
|
98234
98240
|
);
|
|
@@ -98463,7 +98469,7 @@ class HTMLElementCacheKey {
|
|
|
98463
98469
|
const tagHash = computeStringHash(this.tag);
|
|
98464
98470
|
|
|
98465
98471
|
|
|
98466
|
-
this.__hash =
|
|
98472
|
+
this.__hash = combine_hash(
|
|
98467
98473
|
styleHash,
|
|
98468
98474
|
attributeHash,
|
|
98469
98475
|
tagHash
|
|
@@ -102796,7 +102802,7 @@ class GUIElement {
|
|
|
102796
102802
|
* @return {number}
|
|
102797
102803
|
*/
|
|
102798
102804
|
hash() {
|
|
102799
|
-
return
|
|
102805
|
+
return combine_hash(
|
|
102800
102806
|
this.flags,
|
|
102801
102807
|
computeStringHash(this.klass),
|
|
102802
102808
|
this.anchor.hash(),
|
|
@@ -102933,7 +102939,7 @@ class ViewportPosition {
|
|
|
102933
102939
|
}
|
|
102934
102940
|
|
|
102935
102941
|
hash() {
|
|
102936
|
-
return
|
|
102942
|
+
return combine_hash(
|
|
102937
102943
|
this.position.hash(),
|
|
102938
102944
|
this.offset.hash(),
|
|
102939
102945
|
this.anchor.hash(),
|
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find a range of unset bits in the {@link BitSet}
|
|
3
|
+
* useful for allocation algorithms
|
|
4
|
+
* @param {BitSet} bitset
|
|
5
|
+
* @param {number} bit_count
|
|
6
|
+
* @param {number} start_index
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function bitset_find_clear_gap(bitset: BitSet, bit_count: number, start_index?: number): number;
|
|
10
|
+
//# sourceMappingURL=bitset_find_clear_gap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitset_find_clear_gap.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/bitset_find_clear_gap.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,iEAJW,MAAM,gBACN,MAAM,GACJ,MAAM,CAuBlB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find a range of unset bits in the {@link BitSet}
|
|
3
|
+
* useful for allocation algorithms
|
|
4
|
+
* @param {BitSet} bitset
|
|
5
|
+
* @param {number} bit_count
|
|
6
|
+
* @param {number} start_index
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function bitset_find_clear_gap(bitset, bit_count, start_index = 0) {
|
|
10
|
+
let slot_index = start_index;
|
|
11
|
+
|
|
12
|
+
main_loop:while (true) {
|
|
13
|
+
|
|
14
|
+
slot_index = bitset.nextClearBit(slot_index)
|
|
15
|
+
|
|
16
|
+
const search_range_end = slot_index + bit_count;
|
|
17
|
+
|
|
18
|
+
for (let i = slot_index; i < search_range_end; i++) {
|
|
19
|
+
if (bitset.get(i)) {
|
|
20
|
+
// slot is occupied
|
|
21
|
+
slot_index = i + 1;
|
|
22
|
+
|
|
23
|
+
continue main_loop;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// found a hole big enough
|
|
28
|
+
return slot_index;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combine_hash.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/combine_hash.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,uCAHc,MAAM,KACP,MAAM,CAMlB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
2
|
+
import { computeIntegerArrayHash } from "../../primitives/array/computeIntegerArrayHash.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Computes hash on integer values, useful for building composite hashes
|
|
6
|
+
* @param {...number} value
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function combine_hash(...value) {
|
|
10
|
+
assert.isArray(value, 'value');
|
|
11
|
+
|
|
12
|
+
return computeIntegerArrayHash(value, 0, value.length);
|
|
13
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeHashIntegerArray.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/computeHashIntegerArray.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"computeHashIntegerArray.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/computeHashIntegerArray.js"],"names":[],"mappings":"AAEA;;;GAGG;AACH,gDAFsB,CAAC,MAAM,CAAC,OAAG,MAAM,CAEa"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { combine_hash } from "./combine_hash.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* @returns {number}
|
|
4
|
+
* @deprecated use {@link combine_hash} instead
|
|
5
|
+
* @type {function(...[number]): number}
|
|
7
6
|
*/
|
|
8
|
-
export
|
|
9
|
-
return computeIntegerArrayHash(value, 0, value.length);
|
|
10
|
-
}
|
|
7
|
+
export const computeHashIntegerArray = combine_hash;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @example `const my_array = new ( UintArrayForCount(x) )(length);`
|
|
3
3
|
* @param {number} max_value maximum value to be contained in the array
|
|
4
|
-
* @returns {function} constructor
|
|
4
|
+
* @returns {function} TypedArray constructor
|
|
5
5
|
*/
|
|
6
6
|
export function UintArrayForCount(max_value: number): Function;
|
|
7
7
|
//# sourceMappingURL=uint_array_for_count.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint_array_for_count.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/uint_array_for_count.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uint_array_for_count.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/uint_array_for_count.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,6CAHW,MAAM,YAehB"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
4
|
+
* @example `const my_array = new ( UintArrayForCount(x) )(length);`
|
|
3
5
|
* @param {number} max_value maximum value to be contained in the array
|
|
4
|
-
* @returns {function} constructor
|
|
6
|
+
* @returns {function} TypedArray constructor
|
|
5
7
|
*/
|
|
6
8
|
export function UintArrayForCount(max_value) {
|
|
9
|
+
assert.isNonNegativeInteger(max_value, 'max_value');
|
|
7
10
|
|
|
8
11
|
if (max_value <= 256) {
|
|
9
12
|
return Uint8Array;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assert } from "../../assert.js";
|
|
2
2
|
import { ctz32 } from "../../binary/ctz32.js";
|
|
3
3
|
import { ceilPowerOfTwo } from "../../binary/operations/ceilPowerOfTwo.js";
|
|
4
|
-
import { isPowerOfTwo } from "../../math/
|
|
4
|
+
import { isPowerOfTwo } from "../../math/isPowerOfTwo.js";
|
|
5
5
|
import { min2 } from "../../math/min2.js";
|
|
6
6
|
import { invokeObjectEquals } from "../../model/object/invokeObjectEquals.js";
|
|
7
7
|
import { invokeObjectHash } from "../../model/object/invokeObjectHash.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { assert } from "../assert.js";
|
|
2
2
|
import { Cache } from "../cache/Cache.js";
|
|
3
|
+
import { combine_hash } from "../collection/array/combine_hash.js";
|
|
4
|
+
import { computeHashArray } from "../collection/array/computeHashArray.js";
|
|
3
5
|
import { isArrayEqualStrict } from "../collection/array/isArrayEqualStrict.js";
|
|
4
6
|
import { invokeObjectEquals } from "../model/object/invokeObjectEquals.js";
|
|
5
7
|
import { invokeObjectHash } from "../model/object/invokeObjectHash.js";
|
|
6
8
|
import { computeStringHash } from "../primitives/strings/computeStringHash.js";
|
|
7
|
-
import { computeHashArray } from "../collection/array/computeHashArray.js";
|
|
8
|
-
import { computeHashIntegerArray } from "../collection/array/computeHashIntegerArray.js";
|
|
9
9
|
import { string_compute_byte_size } from "../primitives/strings/string_compute_byte_size.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -49,7 +49,7 @@ class FunctionDefinition {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
updateHash() {
|
|
52
|
-
this.__hash =
|
|
52
|
+
this.__hash = combine_hash(
|
|
53
53
|
computeStringHash(this.name),
|
|
54
54
|
computeStringHash(this.body),
|
|
55
55
|
computeHashArray(this.args, computeStringHash)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assert } from "../assert.js";
|
|
2
|
-
import {
|
|
2
|
+
import { combine_hash } from "../collection/array/combine_hash.js";
|
|
3
3
|
import { EPSILON } from "../math/EPSILON.js";
|
|
4
4
|
import { epsilonEquals } from "../math/epsilonEquals.js";
|
|
5
5
|
import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
|
|
@@ -81,7 +81,7 @@ export class ConicRay {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
hash() {
|
|
84
|
-
return
|
|
84
|
+
return combine_hash(
|
|
85
85
|
computeHashFloat(this.angle),
|
|
86
86
|
this.direction.hash()
|
|
87
87
|
);
|
package/src/core/geom/Vector4.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assert } from "../assert.js";
|
|
2
|
-
import {
|
|
2
|
+
import { combine_hash } from "../collection/array/combine_hash.js";
|
|
3
3
|
import { Signal } from "../events/signal/Signal.js";
|
|
4
4
|
import { lerp } from "../math/lerp.js";
|
|
5
5
|
import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
|
|
@@ -273,7 +273,7 @@ class Vector4 {
|
|
|
273
273
|
* @return {number}
|
|
274
274
|
*/
|
|
275
275
|
hash() {
|
|
276
|
-
return
|
|
276
|
+
return combine_hash(
|
|
277
277
|
computeHashFloat(this.x),
|
|
278
278
|
computeHashFloat(this.y),
|
|
279
279
|
computeHashFloat(this.z),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPowerOfTwo.d.ts","sourceRoot":"","sources":["../../../../src/core/math/isPowerOfTwo.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,oCAHW,MAAM,GACJ,OAAO,CAQnB"}
|
|
@@ -25,6 +25,12 @@ export class NodeGraph {
|
|
|
25
25
|
* @private
|
|
26
26
|
*/
|
|
27
27
|
private readonly __idpConnections;
|
|
28
|
+
/**
|
|
29
|
+
* Gets incremented every time structure of the graph changes, meaning nodes or connections are added/removed
|
|
30
|
+
* Unsigned integer value
|
|
31
|
+
* @return {number}
|
|
32
|
+
*/
|
|
33
|
+
get version(): number;
|
|
28
34
|
/**
|
|
29
35
|
* @readonly
|
|
30
36
|
*/
|
|
@@ -138,6 +144,7 @@ export class NodeGraph {
|
|
|
138
144
|
* Same as getNode but throw exception when node doesn't exist
|
|
139
145
|
* @param {number} id
|
|
140
146
|
* @returns {NodeInstance}
|
|
147
|
+
* @throws if node doesn't exist
|
|
141
148
|
*/
|
|
142
149
|
getNodeSafe(id: number): NodeInstance;
|
|
143
150
|
/**
|
|
@@ -207,6 +214,7 @@ export class NodeGraph {
|
|
|
207
214
|
* @type {boolean}
|
|
208
215
|
*/
|
|
209
216
|
readonly isNodeGraph: boolean;
|
|
217
|
+
#private;
|
|
210
218
|
}
|
|
211
219
|
import { NodeInstance } from "./node/NodeInstance.js";
|
|
212
220
|
import { Connection } from "./Connection.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeGraph.d.ts","sourceRoot":"","sources":["../../../../../src/core/model/node-graph/NodeGraph.js"],"names":[],"mappings":"AASA;IAEI;;;;OAIG;IACH,uBAAmB;IAEnB;;;;OAIG;IACH,6BAAyB;IAEzB;;;;;OAKG;IACH,4BAA0B;IAE1B;;;;;OAKG;IACH,kCAAgC;
|
|
1
|
+
{"version":3,"file":"NodeGraph.d.ts","sourceRoot":"","sources":["../../../../../src/core/model/node-graph/NodeGraph.js"],"names":[],"mappings":"AASA;IAEI;;;;OAIG;IACH,uBAAmB;IAEnB;;;;OAIG;IACH,6BAAyB;IAEzB;;;;;OAKG;IACH,4BAA0B;IAE1B;;;;;OAKG;IACH,kCAAgC;IAQhC;;;;OAIG;IACH,sBAEC;IAED;;OAEG;IACH;QACI;;;WAGG;;QAGH;;;WAGG;;QAGH;;;WAGG;;QAGH;;;WAGG;;MAEL;IAEF;;OAEG;IACH,cAQC;IAED;;;OAGG;IACH,YAFW,SAAS,QAYnB;IAED;;;OAGG;IACH,SAFa,SAAS,CAQrB;IAED;;;;;;OAMG;IACH,aAHW,SAAS,GACP;QAAC,WAAW,EAAC,UAAU,EAAE,CAAC;QAAC,KAAK,EAAC,YAAY,EAAE,CAAA;KAAC,CAe5D;IAED;;;;;;;;OAQG;IACH,sCAJW,YAAY,EAAE,GAEZ;QAAC,WAAW,EAAC,UAAU,EAAE,CAAC;QAAC,KAAK,EAAC,YAAY,EAAE,CAAA;KAAC,CAmF5D;IAED;;;;OAIG;IACH,8BAHoB,YAAY,+BAK/B;IAED;;;;OAIG;IACH,oCAHoB,UAAU,+BAK7B;IAED;;;OAGG;IACH,YAFY,YAAY,EAAE,CAIzB;IAED;;;OAGG;IACH,kBAFY,UAAU,EAAE,CAIvB;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAgBnB;IAED;;;;OAIG;IACH,qDAFa,YAAY,EAAE,CAsB1B;IAED;;;;OAIG;IACH,0DAFa,YAAY,EAAE,CAqB1B;IAED;;;;OAIG;IACH,YAHW,MAAM,GACJ,YAAY,GAAC,SAAS,CAkBlC;IAED;;;;;OAKG;IACH,gBAJW,MAAM,GACJ,YAAY,CAWxB;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,UAAU,GAAC,SAAS,CAgBhC;IAED;;;;;OAKG;IACH,+BAJW,MAAM,WACN,MAAM,GACJ,4BAA0B,SAAS,CAY/C;IAED;;;;OAIG;IACH,mCAFa,MAAM,CAclB;IAED;;;OAGG;IACH,cAFW,YAAY,QAkBtB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,OAAO,CA8BnB;IAED;;;;;;;;OAQG;IACH,uCANW,MAAM,cACN,MAAM,cACN,MAAM,cACN,MAAM,GACJ,MAAM,CAqClB;IAED;;;;;;;OAOG;IACH,6BANW,MAAM,cACN,MAAM,cACN,MAAM,cACN,MAAM,GACJ,MAAM,CAsDlB;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACJ,OAAO,CAyBnB;IAED;;;;;OAKG;IACH,iCAJW,MAAM,UACN,MAAM,EAAE,GACN,MAAM,CAyBlB;IAGL;;;OAGG;IACH,sBAFU,OAAO,CAEc;;CAN9B;6BAxpB4B,wBAAwB;2BAD1B,iBAAiB"}
|
|
@@ -39,6 +39,21 @@ export class NodeGraph {
|
|
|
39
39
|
*/
|
|
40
40
|
__idpConnections = new IdPool();
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Gets incremented every time structure of the graph changes
|
|
44
|
+
* @type {number}
|
|
45
|
+
*/
|
|
46
|
+
#version = 0;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Gets incremented every time structure of the graph changes, meaning nodes or connections are added/removed
|
|
50
|
+
* Unsigned integer value
|
|
51
|
+
* @return {number}
|
|
52
|
+
*/
|
|
53
|
+
get version() {
|
|
54
|
+
return this.#version;
|
|
55
|
+
}
|
|
56
|
+
|
|
42
57
|
/**
|
|
43
58
|
* @readonly
|
|
44
59
|
*/
|
|
@@ -77,6 +92,8 @@ export class NodeGraph {
|
|
|
77
92
|
|
|
78
93
|
this.__idpNodes.reset();
|
|
79
94
|
this.__idpConnections.reset();
|
|
95
|
+
|
|
96
|
+
this.#version++;
|
|
80
97
|
}
|
|
81
98
|
|
|
82
99
|
/**
|
|
@@ -261,6 +278,7 @@ export class NodeGraph {
|
|
|
261
278
|
* @returns {boolean}
|
|
262
279
|
*/
|
|
263
280
|
hasNode(node) {
|
|
281
|
+
|
|
264
282
|
const existing_node = this.getNode(node.id);
|
|
265
283
|
|
|
266
284
|
if (existing_node === undefined) {
|
|
@@ -281,6 +299,7 @@ export class NodeGraph {
|
|
|
281
299
|
* @returns {NodeInstance[]}
|
|
282
300
|
*/
|
|
283
301
|
getNodesByDescription(description) {
|
|
302
|
+
|
|
284
303
|
assert.defined(description, 'description');
|
|
285
304
|
assert.notNull(description, 'description');
|
|
286
305
|
assert.equal(description.isNodeDescription, true, 'description.isNodeDescription !== true');
|
|
@@ -354,6 +373,7 @@ export class NodeGraph {
|
|
|
354
373
|
* Same as getNode but throw exception when node doesn't exist
|
|
355
374
|
* @param {number} id
|
|
356
375
|
* @returns {NodeInstance}
|
|
376
|
+
* @throws if node doesn't exist
|
|
357
377
|
*/
|
|
358
378
|
getNodeSafe(id) {
|
|
359
379
|
const result = this.getNode(id);
|
|
@@ -441,6 +461,8 @@ export class NodeGraph {
|
|
|
441
461
|
|
|
442
462
|
//record the node
|
|
443
463
|
this.nodes.add(node);
|
|
464
|
+
|
|
465
|
+
this.#version++;
|
|
444
466
|
}
|
|
445
467
|
|
|
446
468
|
/**
|
|
@@ -473,6 +495,8 @@ export class NodeGraph {
|
|
|
473
495
|
//release id
|
|
474
496
|
this.__idpNodes.release(id);
|
|
475
497
|
|
|
498
|
+
this.#version++;
|
|
499
|
+
|
|
476
500
|
return true;
|
|
477
501
|
}
|
|
478
502
|
|
|
@@ -529,6 +553,7 @@ export class NodeGraph {
|
|
|
529
553
|
* @param {number} targetNode
|
|
530
554
|
* @param {number} targetPort
|
|
531
555
|
* @returns {number} ID of created or already existing connection
|
|
556
|
+
* @throws if any node or port are not found
|
|
532
557
|
*/
|
|
533
558
|
createConnection(sourceNode, sourcePort, targetNode, targetPort) {
|
|
534
559
|
assert.isNonNegativeInteger(sourceNode, 'sourceNode');
|
|
@@ -579,6 +604,8 @@ export class NodeGraph {
|
|
|
579
604
|
array_push_if_unique(sourceEndpoint.connections, connection);
|
|
580
605
|
array_push_if_unique(targetEndpoint.connections, connection);
|
|
581
606
|
|
|
607
|
+
this.#version++;
|
|
608
|
+
|
|
582
609
|
return id;
|
|
583
610
|
}
|
|
584
611
|
|
|
@@ -607,6 +634,8 @@ export class NodeGraph {
|
|
|
607
634
|
array_remove_first(sourceEndpoint.connections, connection);
|
|
608
635
|
array_remove_first(targetEndpoint.connections, connection);
|
|
609
636
|
|
|
637
|
+
this.#version++;
|
|
638
|
+
|
|
610
639
|
return true;
|
|
611
640
|
}
|
|
612
641
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assert } from "../../../assert.js";
|
|
2
|
-
import {
|
|
2
|
+
import { combine_hash } from "../../../collection/array/combine_hash.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
@@ -133,7 +133,7 @@ export class NodeInstancePortReference {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
hash() {
|
|
136
|
-
return
|
|
136
|
+
return combine_hash(
|
|
137
137
|
this.instance.hash(),
|
|
138
138
|
this.port.hash()
|
|
139
139
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactiveBinaryExpression.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/reactive/model/ReactiveBinaryExpression.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACI,cAqBC;IAlBG;;;OAGG;IACH,MAFU,0BAAmB,IAAI,CAEjB;IAChB;;;OAGG;IACH,OAFU,0BAAmB,IAAI,CAEhB;IAEjB;;;;OAIG;IACH,mBAA2B;IAI/B,uBAQC;IAED,wBAcC;IAED,eAMC;IAED,0BAQC;IAED,eAUC;IAED;;;OAGG;IACH,kCAFa,IAAE,OAAO,GAAC,MAAM,CAI5B;IAED,2CAKC;IAED;;;;OAIG;IACH,qCAkBC;IAED,mBAaC;IAyBL;;;;;;OAMG;IACH,wBAFU,OAAO,CAE+B;IAEhD;;;OAGG;IACH,6BAFU,OAAO,CAEoC;CAfpD;
|
|
1
|
+
{"version":3,"file":"ReactiveBinaryExpression.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/reactive/model/ReactiveBinaryExpression.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACI,cAqBC;IAlBG;;;OAGG;IACH,MAFU,0BAAmB,IAAI,CAEjB;IAChB;;;OAGG;IACH,OAFU,0BAAmB,IAAI,CAEhB;IAEjB;;;;OAIG;IACH,mBAA2B;IAI/B,uBAQC;IAED,wBAcC;IAED,eAMC;IAED,0BAQC;IAED,eAUC;IAED;;;OAGG;IACH,kCAFa,IAAE,OAAO,GAAC,MAAM,CAI5B;IAED,2CAKC;IAED;;;;OAIG;IACH,qCAkBC;IAED,mBAaC;IAyBL;;;;;;OAMG;IACH,wBAFU,OAAO,CAE+B;IAEhD;;;OAGG;IACH,6BAFU,OAAO,CAEoC;CAfpD;mCAjKkC,yBAAyB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assert } from "../../../assert.js";
|
|
2
|
+
import { combine_hash } from "../../../collection/array/combine_hash.js";
|
|
2
3
|
import { ReactiveExpression } from "./ReactiveExpression.js";
|
|
3
|
-
import { computeHashIntegerArray } from "../../../collection/array/computeHashIntegerArray.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @extends {ReactiveExpression}
|
|
@@ -56,7 +56,7 @@ export class ReactiveBinaryExpression extends ReactiveExpression {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
hash() {
|
|
59
|
-
return
|
|
59
|
+
return combine_hash(
|
|
60
60
|
this.left.hash(),
|
|
61
61
|
this.right.hash(),
|
|
62
62
|
super.hash()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactiveReference.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/reactive/model/terminal/ReactiveReference.js"],"names":[],"mappings":"AAOA;;GAEG;AACH;IAEI;;;OAGG;IACH,kBAFW,MAAM,EAgBhB;IAXG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,QAFU,mDAA0C,CAElC;IAGtB;;;OAGG;IACH,YAFW,iBAAiB,QAU3B;IAED;;;OAGG;IACH,SAFY,iBAAiB,CAQ5B;IAED,gCAEC;IAED,2BAmBC;IAED,mBAQC;IAED,wBAKC;IAED,iBAEC;IAGD,eAKC;IAED,0BAGC;IAOL;;;OAGG;IACH,qBAFU,OAAO,CAEqB;IAEtC;;;OAGG;IACH,sBAFU,OAAO,CAEsB;CAZtC;;IAcD;;;;;OAKG;IACH,6DAaC;;
|
|
1
|
+
{"version":3,"file":"ReactiveReference.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/model/reactive/model/terminal/ReactiveReference.js"],"names":[],"mappings":"AAOA;;GAEG;AACH;IAEI;;;OAGG;IACH,kBAFW,MAAM,EAgBhB;IAXG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,QAFU,mDAA0C,CAElC;IAGtB;;;OAGG;IACH,YAFW,iBAAiB,QAU3B;IAED;;;OAGG;IACH,SAFY,iBAAiB,CAQ5B;IAED,gCAEC;IAED,2BAmBC;IAED,mBAQC;IAED,wBAKC;IAED,iBAEC;IAGD,eAKC;IAED,0BAGC;IAOL;;;OAGG;IACH,qBAFU,OAAO,CAEqB;IAEtC;;;OAGG;IACH,sBAFU,OAAO,CAEsB;CAZtC;;IAcD;;;;;OAKG;IACH,6DAaC;;mCArJkC,0BAA0B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { assert } from "../../../../assert.js";
|
|
2
|
+
import { combine_hash } from "../../../../collection/array/combine_hash.js";
|
|
2
3
|
import DataType from "../../../../parser/simple/DataType.js";
|
|
3
4
|
import { computeStringHash } from "../../../../primitives/strings/computeStringHash.js";
|
|
4
5
|
import { ReactiveExpression } from "../ReactiveExpression.js";
|
|
5
|
-
import { computeHashIntegerArray } from "../../../../collection/array/computeHashIntegerArray.js";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -104,7 +104,7 @@ export class ReactiveReference extends ReactiveExpression {
|
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
hash() {
|
|
107
|
-
return
|
|
107
|
+
return combine_hash(
|
|
108
108
|
computeStringHash(this.name),
|
|
109
109
|
super.hash()
|
|
110
110
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeStringHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/strings/computeStringHash.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"computeStringHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/strings/computeStringHash.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,0CAHW,MAAM,GAAC,IAAI,GAAC,SAAS,GACnB,MAAM,CA8BlB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { assert } from "../../assert.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
*
|
|
3
5
|
* @param {string|null|undefined} string
|
|
@@ -12,16 +14,23 @@ export function computeStringHash(string) {
|
|
|
12
14
|
return 1;
|
|
13
15
|
}
|
|
14
16
|
|
|
17
|
+
assert.isString(string,'string');
|
|
18
|
+
|
|
15
19
|
const length = string.length;
|
|
16
20
|
|
|
17
|
-
let hash =
|
|
21
|
+
let hash = length;
|
|
18
22
|
|
|
19
23
|
for (let i = 0; i < length; i++) {
|
|
20
|
-
const
|
|
24
|
+
const code_point = string.charCodeAt(i);
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
/*
|
|
27
|
+
* Avoiding potentially expensive multiplication operation by using 2 cheaper operation instead
|
|
28
|
+
* (h<<5) - h === h*31
|
|
29
|
+
*/
|
|
30
|
+
hash = ((hash << 5) - hash) + code_point;
|
|
23
31
|
|
|
24
32
|
}
|
|
25
33
|
|
|
26
|
-
|
|
34
|
+
// force uint32
|
|
35
|
+
return hash >>> 0;
|
|
27
36
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
//
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
5
|
+
import { isPowerOfTwo } from "../../../../core/math/isPowerOfTwo.js";
|
|
5
6
|
import { lerp } from "../../../../core/math/lerp.js";
|
|
6
|
-
import {
|
|
7
|
+
import { max2 } from "../../../../core/math/max2.js";
|
|
7
8
|
import { max3 } from "../../../../core/math/max3.js";
|
|
9
|
+
import { min3 } from "../../../../core/math/min3.js";
|
|
8
10
|
import { downsample_float_array } from "./downsample_float_array.js";
|
|
9
|
-
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
10
|
-
import { isPowerOfTwo } from "../../../../core/math/isPowerOrTwo.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
*
|