@woosh/meep-engine 2.113.4 → 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 +11 -6
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +11 -6
- 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/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/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/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/graphics/impostors/octahedral/ImpostorBaker.js +1 -1
- 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
|
@@ -50927,16 +50927,21 @@ function computeStringHash(string) {
|
|
|
50927
50927
|
|
|
50928
50928
|
const length = string.length;
|
|
50929
50929
|
|
|
50930
|
-
let hash =
|
|
50930
|
+
let hash = length;
|
|
50931
50931
|
|
|
50932
50932
|
for (let i = 0; i < length; i++) {
|
|
50933
|
-
const
|
|
50933
|
+
const code_point = string.charCodeAt(i);
|
|
50934
50934
|
|
|
50935
|
-
|
|
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;
|
|
50936
50940
|
|
|
50937
50941
|
}
|
|
50938
50942
|
|
|
50939
|
-
|
|
50943
|
+
// force uint32
|
|
50944
|
+
return hash >>> 0;
|
|
50940
50945
|
}
|
|
50941
50946
|
|
|
50942
50947
|
/**
|
|
@@ -59810,9 +59815,9 @@ function array_swap_one(array, index0, index1) {
|
|
|
59810
59815
|
}
|
|
59811
59816
|
|
|
59812
59817
|
/**
|
|
59813
|
-
*
|
|
59818
|
+
* @example `const my_array = new ( UintArrayForCount(x) )(length);`
|
|
59814
59819
|
* @param {number} max_value maximum value to be contained in the array
|
|
59815
|
-
* @returns {function} constructor
|
|
59820
|
+
* @returns {function} TypedArray constructor
|
|
59816
59821
|
*/
|
|
59817
59822
|
function UintArrayForCount(max_value) {
|
|
59818
59823
|
|
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
|
+
}
|
|
@@ -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";
|
|
@@ -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,Y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
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 +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
|
*
|
|
@@ -4,7 +4,7 @@ import { assert } from "../../../../core/assert.js";
|
|
|
4
4
|
import { collectIteratorValueToArray } from "../../../../core/collection/collectIteratorValueToArray.js";
|
|
5
5
|
import { HashMap } from "../../../../core/collection/map/HashMap.js";
|
|
6
6
|
import Signal from "../../../../core/events/signal/Signal.js";
|
|
7
|
-
import { isPowerOfTwo } from "../../../../core/math/
|
|
7
|
+
import { isPowerOfTwo } from "../../../../core/math/isPowerOfTwo.js";
|
|
8
8
|
import { computeMaterialEquality } from "../../../asset/loaders/material/computeMaterialEquality.js";
|
|
9
9
|
import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
|
|
10
10
|
import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isPowerOrTwo.d.ts","sourceRoot":"","sources":["../../../../src/core/math/isPowerOrTwo.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,oCAHW,MAAM,GACJ,OAAO,CAQnB"}
|
|
File without changes
|