@woosh/meep-engine 2.115.0 → 2.116.1
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-terrain.js +1 -1
- package/build/meep.cjs +204 -177
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +204 -177
- package/editor/view/ecs/HierarchicalEntityListView.js +2 -2
- package/package.json +1 -1
- package/src/core/collection/array/{compareArrays.d.ts → array_compare.d.ts} +2 -2
- package/src/core/collection/array/array_compare.d.ts.map +1 -0
- package/src/core/collection/array/{compareArrays.js → array_compare.js} +5 -1
- package/src/core/collection/array/{arrayIndexByEquality.d.ts → array_index_by_equality.d.ts} +2 -2
- package/src/core/collection/array/array_index_by_equality.d.ts.map +1 -0
- package/src/core/collection/array/{arrayIndexByEquality.js → array_index_by_equality.js} +1 -1
- package/src/core/collection/array/array_pick_best_element.d.ts.map +1 -0
- package/src/core/collection/array/{arrayPickBestElement.js → array_pick_best_element.js} +2 -2
- package/src/core/collection/array/array_pick_best_elements.d.ts +8 -0
- package/src/core/collection/array/array_pick_best_elements.d.ts.map +1 -0
- package/src/core/collection/array/{arrayPickBestElements.js → array_pick_best_elements.js} +1 -1
- package/src/core/collection/array/array_replace_all.d.ts +2 -1
- package/src/core/collection/array/array_replace_all.d.ts.map +1 -1
- package/src/core/collection/array/array_replace_all.js +3 -0
- package/src/core/collection/array/{arraySetDiff.d.ts → array_set_diff.d.ts} +3 -3
- package/src/core/collection/array/array_set_diff.d.ts.map +1 -0
- package/src/core/collection/array/{arraySetDiff.js → array_set_diff.js} +4 -4
- package/src/core/collection/array/{arraySetSortingDiff.d.ts → array_set_diff_sorting.d.ts} +2 -2
- package/src/core/collection/array/array_set_diff_sorting.d.ts.map +1 -0
- package/src/core/collection/array/{arraySetSortingDiff.js → array_set_diff_sorting.js} +1 -1
- package/src/core/collection/list/FilteredListProjection.d.ts.map +1 -1
- package/src/core/collection/list/FilteredListProjection.js +2 -2
- package/src/core/collection/list/List.d.ts.map +1 -1
- package/src/core/collection/list/List.js +8 -11
- package/src/core/collection/set/ArraySet.d.ts.map +1 -1
- package/src/core/collection/set/ArraySet.js +11 -1
- package/src/core/geom/3d/topology/expandConnectivityByLocality.js +2 -2
- package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
- package/src/core/math/physics/brdf/brdf_burley.js +3 -14
- package/src/core/math/physics/bsdf/bsdf_schlick.js +1 -1
- package/src/core/math/physics/pdf/pdf_normal.d.ts +8 -0
- package/src/core/math/physics/pdf/pdf_normal.d.ts.map +1 -0
- package/src/core/math/physics/pdf/pdf_normal.js +11 -0
- package/src/core/math/physics/reflectivity_to_ior.d.ts.map +1 -1
- package/src/core/math/physics/reflectivity_to_ior.js +3 -1
- package/src/core/model/object/compareValues.js +3 -3
- package/src/core/primitives/strings/computeStringHash.d.ts +9 -1
- package/src/core/primitives/strings/computeStringHash.d.ts.map +1 -1
- package/src/core/primitives/strings/computeStringHash.js +10 -5
- package/src/engine/ecs/EntityComponentDataset.js +3 -3
- package/src/engine/graphics/ecs/mesh/SkeletonUtils.js +2 -2
- package/src/engine/graphics/sh3/gi/material/common.glsl +3 -2
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +4 -3
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +6 -3
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +16 -12
- package/src/engine/graphics/shaders/DenoiseShader.d.ts.map +1 -1
- package/src/engine/graphics/shaders/DenoiseShader.js +3 -12
- package/src/engine/input/ecs/components/InputBinding.d.ts.map +1 -1
- package/src/engine/input/ecs/components/InputBinding.js +3 -2
- package/src/engine/input/ecs/components/InputController.d.ts.map +1 -1
- package/src/engine/input/ecs/components/InputController.js +18 -1
- package/src/engine/input/ecs/controllers/KeyboardCameraController.js +9 -9
- package/src/engine/platform/WebEnginePlatform.d.ts.map +1 -1
- package/src/engine/platform/WebEnginePlatform.js +4 -4
- package/src/engine/save/GameStateLoader.js +2 -2
- package/src/engine/ui/cursor/CursorCoalescence.d.ts.map +1 -1
- package/src/engine/ui/cursor/CursorCoalescence.js +2 -2
- package/src/view/elements/radial/RadialMenu.js +2 -2
- package/src/core/collection/array/arrayIndexByEquality.d.ts.map +0 -1
- package/src/core/collection/array/arrayPickBestElement.d.ts.map +0 -1
- package/src/core/collection/array/arrayPickBestElements.d.ts +0 -8
- package/src/core/collection/array/arrayPickBestElements.d.ts.map +0 -1
- package/src/core/collection/array/arraySetDiff.d.ts.map +0 -1
- package/src/core/collection/array/arraySetSortingDiff.d.ts.map +0 -1
- package/src/core/collection/array/compareArrays.d.ts.map +0 -1
- /package/src/core/collection/array/{arrayPickBestElement.d.ts → array_pick_best_element.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_pick_best_elements.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_pick_best_elements.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,iFA0CC"}
|
|
@@ -6,7 +6,7 @@ import { assert } from "../../assert.js";
|
|
|
6
6
|
* @param {function(el:T, index:number):number} scoreFunction
|
|
7
7
|
* @returns {T[]}
|
|
8
8
|
*/
|
|
9
|
-
export function
|
|
9
|
+
export function array_pick_best_elements(array, scoreFunction) {
|
|
10
10
|
assert.notEqual(array, undefined, 'array is undefined');
|
|
11
11
|
assert.isArray(array, 'array');
|
|
12
12
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @param {T[]} array
|
|
4
4
|
* @param {T} victim
|
|
5
5
|
* @param {T} replacement
|
|
6
|
+
* @returns {T[]} input array after replacements
|
|
6
7
|
*/
|
|
7
|
-
export function array_replace_all<T>(array: T[], victim: T, replacement: T):
|
|
8
|
+
export function array_replace_all<T>(array: T[], victim: T, replacement: T): T[];
|
|
8
9
|
//# sourceMappingURL=array_replace_all.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array_replace_all.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_replace_all.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"array_replace_all.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_replace_all.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,iFAYC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @param {T[]} array
|
|
4
4
|
* @param {T} victim
|
|
5
5
|
* @param {T} replacement
|
|
6
|
+
* @returns {T[]} input array after replacements
|
|
6
7
|
*/
|
|
7
8
|
export function array_replace_all(array, victim, replacement) {
|
|
8
9
|
|
|
@@ -14,4 +15,6 @@ export function array_replace_all(array, victim, replacement) {
|
|
|
14
15
|
array[i] = replacement;
|
|
15
16
|
}
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
return array;
|
|
17
20
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Compute a diff between two arrays, result is a 3 way split between common items, unique items in `a` array and unique items in `b` array
|
|
3
|
-
* @see prefer to use {@link
|
|
3
|
+
* @see prefer to use {@link array_set_diff_sorting}, as it's much faster, especially for large sets
|
|
4
4
|
* @template T
|
|
5
5
|
* @param {T[]} a
|
|
6
6
|
* @param {T[]} b
|
|
7
7
|
* @param {function(a:T,b:T):boolean} [equals] method to determine equality between two elements
|
|
8
8
|
* @returns {{uniqueA:T[], uniqueB:T[], common:T[]}}
|
|
9
9
|
*/
|
|
10
|
-
export function
|
|
10
|
+
export function array_set_diff<T>(a: T[], b: T[], equals?: typeof strictEquals): {
|
|
11
11
|
uniqueA: T[];
|
|
12
12
|
uniqueB: T[];
|
|
13
13
|
common: T[];
|
|
14
14
|
};
|
|
15
15
|
import { strictEquals } from "../../function/strictEquals.js";
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=array_set_diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_set_diff.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_set_diff.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH;;;;EAoCC;6BAhD4B,gCAAgC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { assert } from "../../assert.js";
|
|
2
2
|
|
|
3
3
|
import { strictEquals } from "../../function/strictEquals.js";
|
|
4
|
-
import {
|
|
4
|
+
import { array_index_by_equality } from "./array_index_by_equality.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Compute a diff between two arrays, result is a 3 way split between common items, unique items in `a` array and unique items in `b` array
|
|
8
|
-
* @see prefer to use {@link
|
|
8
|
+
* @see prefer to use {@link array_set_diff_sorting}, as it's much faster, especially for large sets
|
|
9
9
|
* @template T
|
|
10
10
|
* @param {T[]} a
|
|
11
11
|
* @param {T[]} b
|
|
12
12
|
* @param {function(a:T,b:T):boolean} [equals] method to determine equality between two elements
|
|
13
13
|
* @returns {{uniqueA:T[], uniqueB:T[], common:T[]}}
|
|
14
14
|
*/
|
|
15
|
-
export function
|
|
15
|
+
export function array_set_diff(a, b, equals = strictEquals) {
|
|
16
16
|
assert.isArray(a, 'a');
|
|
17
17
|
assert.isArray(b, 'b');
|
|
18
18
|
assert.isFunction(equals, 'equals');
|
|
@@ -27,7 +27,7 @@ export function arraySetDiff(a, b, equals = strictEquals) {
|
|
|
27
27
|
for (let i = 0; i < a_length; i++) {
|
|
28
28
|
const elA = uniqueA[i];
|
|
29
29
|
|
|
30
|
-
const j =
|
|
30
|
+
const j = array_index_by_equality(uniqueB, elA, equals);
|
|
31
31
|
|
|
32
32
|
if (j !== -1) {
|
|
33
33
|
// common element found
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* @param {function(a:T,b:T):number} [compare]
|
|
7
7
|
* @returns {{uniqueA:T[], uniqueB:T[], common:T[]}}
|
|
8
8
|
*/
|
|
9
|
-
export function
|
|
9
|
+
export function array_set_diff_sorting<T>(a: T[], b: T[], compare: any): {
|
|
10
10
|
uniqueA: T[];
|
|
11
11
|
uniqueB: T[];
|
|
12
12
|
common: T[];
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=array_set_diff_sorting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array_set_diff_sorting.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/array_set_diff_sorting.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH;;;;EAsDC"}
|
|
@@ -10,7 +10,7 @@ import { assert } from "../../assert.js";
|
|
|
10
10
|
* @param {function(a:T,b:T):number} [compare]
|
|
11
11
|
* @returns {{uniqueA:T[], uniqueB:T[], common:T[]}}
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function array_set_diff_sorting(a, b, compare) {
|
|
14
14
|
assert.isFunction(compare, 'compare');
|
|
15
15
|
|
|
16
16
|
const uniqueA = a.slice();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteredListProjection.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/list/FilteredListProjection.js"],"names":[],"mappings":"AAKA;IACI;;;;;OAKG;IACH,qCAHW,sBAAsB,EA6BhC;IAzBG;;;OAGG;IACH,eAAkB;IAElB;;;OAGG;IACH,gBAAwB;IAExB;;;OAGG;IACH,SAFU,sBAAsB,CAEV;IAEtB;;;OAGG;IACH,UAFU,OAAO,CAEG;IAEpB,wBAAoD;IAGxD,eAMC;IAED;;;OAGG;IACH,oBAEC;IAED;;;OAGG;IACH,sBAEC;IAED;;;OAGG;IACH,0BAGC;IAED;;;OAGG;IACH,4BAGC;IAED,aAUC;IAED,eAQC;IAED,cAiFC;CACJ;
|
|
1
|
+
{"version":3,"file":"FilteredListProjection.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/list/FilteredListProjection.js"],"names":[],"mappings":"AAKA;IACI;;;;;OAKG;IACH,qCAHW,sBAAsB,EA6BhC;IAzBG;;;OAGG;IACH,eAAkB;IAElB;;;OAGG;IACH,gBAAwB;IAExB;;;OAGG;IACH,SAFU,sBAAsB,CAEV;IAEtB;;;OAGG;IACH,UAFU,OAAO,CAEG;IAEpB,wBAAoD;IAGxD,eAMC;IAED;;;OAGG;IACH,oBAEC;IAED;;;OAGG;IACH,sBAEC;IAED;;;OAGG;IACH,0BAGC;IAED;;;OAGG;IACH,4BAGC;IAED,aAUC;IAED,eAQC;IAED,cAiFC;CACJ;iBAvLgB,WAAW"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { frameThrottle } from "../../../engine/graphics/FrameThrottle.js";
|
|
2
2
|
import { invokeObjectEquals } from "../../model/object/invokeObjectEquals.js";
|
|
3
|
+
import { array_set_diff } from "../array/array_set_diff.js";
|
|
3
4
|
import List from "./List.js";
|
|
4
|
-
import { arraySetDiff } from "../array/arraySetDiff.js";
|
|
5
5
|
|
|
6
6
|
export class FilteredListProjection {
|
|
7
7
|
/**
|
|
@@ -136,7 +136,7 @@ export class FilteredListProjection {
|
|
|
136
136
|
newOutput.push(v);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
const diff =
|
|
139
|
+
const diff = array_set_diff(oldOutput, newOutput, invokeObjectEquals);
|
|
140
140
|
|
|
141
141
|
//resolve diff
|
|
142
142
|
const removals = diff.uniqueA;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/list/List.js"],"names":[],"mappings":";AAaA;;;;GAIG;AACH;IAuBI
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/list/List.js"],"names":[],"mappings":"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"}
|
|
@@ -7,8 +7,8 @@ import { assert } from "../../assert.js";
|
|
|
7
7
|
import Signal from "../../events/signal/Signal.js";
|
|
8
8
|
import { objectsEqual } from "../../function/objectsEqual.js";
|
|
9
9
|
import { invokeObjectEquals } from "../../model/object/invokeObjectEquals.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { array_index_by_equality } from "../array/array_index_by_equality.js";
|
|
11
|
+
import { array_set_diff } from "../array/array_set_diff.js";
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -40,8 +40,7 @@ class List {
|
|
|
40
40
|
data = []
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* @param {[]} [array]
|
|
44
|
-
* @constructor
|
|
43
|
+
* @param {T[]} [array]
|
|
45
44
|
*/
|
|
46
45
|
constructor(array) {
|
|
47
46
|
|
|
@@ -214,7 +213,7 @@ class List {
|
|
|
214
213
|
|
|
215
214
|
const data = this.data;
|
|
216
215
|
|
|
217
|
-
const diff =
|
|
216
|
+
const diff = array_set_diff(data, new_data, objectsEqual);
|
|
218
217
|
|
|
219
218
|
//resolve diff
|
|
220
219
|
const removals = diff.uniqueA;
|
|
@@ -291,12 +290,10 @@ class List {
|
|
|
291
290
|
* @param {Array.<T>} elements
|
|
292
291
|
*/
|
|
293
292
|
addAllUnique(elements) {
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
const length = data.length;
|
|
293
|
+
const length = elements.length;
|
|
297
294
|
|
|
298
295
|
for (let i = 0; i < length; i++) {
|
|
299
|
-
this.addUnique(
|
|
296
|
+
this.addUnique(elements[i]);
|
|
300
297
|
}
|
|
301
298
|
}
|
|
302
299
|
|
|
@@ -414,7 +411,7 @@ class List {
|
|
|
414
411
|
/**
|
|
415
412
|
*
|
|
416
413
|
* @param {function(a:T, b:T):number} [compare_function]
|
|
417
|
-
* @returns {
|
|
414
|
+
* @returns {this}
|
|
418
415
|
*/
|
|
419
416
|
sort(compare_function) {
|
|
420
417
|
Array.prototype.sort.call(this.data, compare_function);
|
|
@@ -744,7 +741,7 @@ class List {
|
|
|
744
741
|
for (let i = 0; i < nThisItems; i++) {
|
|
745
742
|
const a = thisItems[i];
|
|
746
743
|
|
|
747
|
-
const index =
|
|
744
|
+
const index = array_index_by_equality(otherItems, a, invokeObjectEquals);
|
|
748
745
|
|
|
749
746
|
if (index !== -1) {
|
|
750
747
|
newData[index] = a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArraySet.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/ArraySet.js"],"names":[],"mappings":";AAEA;;;GAGG;AACH;
|
|
1
|
+
{"version":3,"file":"ArraySet.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/set/ArraySet.js"],"names":[],"mappings":";AAEA;;;GAGG;AACH;IAyBI;;;;;;OAMG;IACH,yBAIC;IAnCD;;OAEG;IACH;;;MAGE;IAEF;;;OAGG;IACH,aAAU;IAEV,eAAW;IAEX;;;OAGG;IACH,mBAEC;IAeD;;;OAGG;IACH,yBAEC;IAED;;;OAGG;IACH,oBAWC;IAED;;;OAGG;IACH,uBAWC;IAED;;;;;OAKG;IACH,wBAIC;IAED;;;OAGG;IACH,WAFa,OAAO,CAInB;IAED;;OAEG;IACH,cAIC;IAED;;;OAGG;IACH,iBAFW,QAAS,QAQnB;IAED;;;OAGG;IACH,qBAFW,QAAS,QAuBnB;IAED;;;;OAIG;IACH,2CAIC;IAED;;;OAGG;IACH,WAFa,GAAG,CAIf;CACJ;mBA5KkB,+BAA+B"}
|
|
@@ -21,6 +21,14 @@ class ArraySet {
|
|
|
21
21
|
|
|
22
22
|
length = 0;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @returns {number}
|
|
27
|
+
*/
|
|
28
|
+
get size(){
|
|
29
|
+
return this.length;
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
/**
|
|
25
33
|
*
|
|
26
34
|
* @param {Array.<T>} [array=[]]
|
|
@@ -110,7 +118,9 @@ class ArraySet {
|
|
|
110
118
|
* @param {Array.<T>} elements
|
|
111
119
|
*/
|
|
112
120
|
addAll(elements) {
|
|
113
|
-
|
|
121
|
+
const count = elements.length;
|
|
122
|
+
|
|
123
|
+
for (let i = 0; i < count; i++) {
|
|
114
124
|
this.add(elements[i]);
|
|
115
125
|
}
|
|
116
126
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { array_copy } from "../../../collection/array/array_copy.js";
|
|
2
|
-
import {
|
|
2
|
+
import { array_set_diff_sorting } from "../../../collection/array/array_set_diff_sorting.js";
|
|
3
3
|
import { compareFaces } from "./compareFaces.js";
|
|
4
4
|
import { computeTopoMeshVertexDuplicates } from "./computeTopoMeshVertexDuplicates.js";
|
|
5
5
|
import { query_edge_other_vertex } from "./query/query_edge_other_vertex.js";
|
|
@@ -53,7 +53,7 @@ function connectEdges(a, b) {
|
|
|
53
53
|
const faces_a = a.faces;
|
|
54
54
|
const faces_b = b.faces;
|
|
55
55
|
|
|
56
|
-
const diff =
|
|
56
|
+
const diff = array_set_diff_sorting(faces_a, faces_b, compareFaces);
|
|
57
57
|
|
|
58
58
|
const unique_a = diff.uniqueA;
|
|
59
59
|
const unique_b = diff.uniqueB;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brdf_burley.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/brdf_burley.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"brdf_burley.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/brdf_burley.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AACH,iCANW,MAAM,OACN,MAAM,OACN,MAAM,aACN,MAAM,GACJ,MAAM,CASlB"}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { PI_RECIPROCAL } from "../../PI_RECIPROCAL.js";
|
|
2
|
-
import {
|
|
2
|
+
import { bsdf_schlick } from "../bsdf/bsdf_schlick.js";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param {number} u
|
|
7
|
-
* @param {number} f0
|
|
8
|
-
* @param {number} f90
|
|
9
|
-
* @return {number}
|
|
10
|
-
*/
|
|
11
|
-
function F_Schlick(u, f0, f90) {
|
|
12
|
-
|
|
13
|
-
return f0 + (f90 - f0) * fresnel_Schlick(u);
|
|
14
|
-
}
|
|
15
4
|
|
|
16
5
|
/**
|
|
17
6
|
* @see https://google.github.io/filament/Filament.md.html#listing_diffusebrdf
|
|
@@ -30,8 +19,8 @@ function F_Schlick(u, f0, f90) {
|
|
|
30
19
|
export function brdf_burley(NoV, NoL, LoH, roughness) {
|
|
31
20
|
const f90 = 0.5 + 2.0 * roughness * LoH * LoH;
|
|
32
21
|
|
|
33
|
-
const lightScatter =
|
|
34
|
-
const viewScatter =
|
|
22
|
+
const lightScatter = bsdf_schlick(1.0, f90, NoL);
|
|
23
|
+
const viewScatter = bsdf_schlick(1.0, f90, NoV);
|
|
35
24
|
|
|
36
25
|
return lightScatter * viewScatter * PI_RECIPROCAL;
|
|
37
26
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf_normal.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/pdf/pdf_normal.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,8BAJW,MAAM,SACN,MAAM,GACL,MAAM,CAIjB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { gaussian } from "../../gaussian.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Normal Probability Distribution Function
|
|
5
|
+
* @param {number} x
|
|
6
|
+
* @param {number} sigma
|
|
7
|
+
* @return {number}
|
|
8
|
+
*/
|
|
9
|
+
export function pdf_normal(x, sigma) {
|
|
10
|
+
return 0.39894 * gaussian(sigma, x) / sigma;
|
|
11
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflectivity_to_ior.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/physics/reflectivity_to_ior.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAHW,MAAM,GACL,MAAM,
|
|
1
|
+
{"version":3,"file":"reflectivity_to_ior.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/physics/reflectivity_to_ior.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAHW,MAAM,GACL,MAAM,CAMjB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { array_compare } from "../../collection/array/array_compare.js";
|
|
2
2
|
import { extractFunctionBody } from "../../function/extractFunctionBody.js";
|
|
3
3
|
import { compareBooleans } from "../../primitives/boolean/compareBooleans.js";
|
|
4
4
|
import { number_compare_ascending } from "../../primitives/numbers/number_compare_ascending.js";
|
|
@@ -42,13 +42,13 @@ export function compareValues(a, b) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (Array.isArray(a) && Array.isArray(b)) {
|
|
45
|
-
return
|
|
45
|
+
return array_compare(a, b, compareValues);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const aKeys = Object.keys(a);
|
|
49
49
|
const bKeys = Object.keys(b);
|
|
50
50
|
|
|
51
|
-
const dKeys =
|
|
51
|
+
const dKeys = array_compare(aKeys, bKeys, compareStrings);
|
|
52
52
|
|
|
53
53
|
if (dKeys !== 0) {
|
|
54
54
|
return dKeys;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {string|null|undefined} string
|
|
4
|
+
* @param {number} [start]
|
|
5
|
+
* @param {number} [length] how many characters to hash, defaults to full string length
|
|
6
|
+
* @returns {number}
|
|
7
|
+
*/
|
|
8
|
+
export function computeStringHash(string: string | null | undefined, start?: number, length?: number): number;
|
|
9
|
+
//# sourceMappingURL=computeStringHash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeStringHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/strings/computeStringHash.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"computeStringHash.d.ts","sourceRoot":"","sources":["../../../../../src/core/primitives/strings/computeStringHash.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,0CALW,MAAM,GAAC,IAAI,GAAC,SAAS,UACrB,MAAM,WACN,MAAM,GACJ,MAAM,CAiClB"}
|
|
@@ -3,9 +3,11 @@ import { assert } from "../../assert.js";
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param {string|null|undefined} string
|
|
6
|
+
* @param {number} [start]
|
|
7
|
+
* @param {number} [length] how many characters to hash, defaults to full string length
|
|
6
8
|
* @returns {number}
|
|
7
9
|
*/
|
|
8
|
-
export function computeStringHash(string) {
|
|
10
|
+
export function computeStringHash(string, start, length) {
|
|
9
11
|
if (string === null) {
|
|
10
12
|
return 0;
|
|
11
13
|
}
|
|
@@ -14,13 +16,16 @@ export function computeStringHash(string) {
|
|
|
14
16
|
return 1;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
assert.isString(string,'string');
|
|
19
|
+
assert.isString(string, 'string');
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
let _start = start ?? 0;
|
|
22
|
+
let _length = length ?? string.length - _start;
|
|
20
23
|
|
|
21
|
-
let hash =
|
|
24
|
+
let hash = _length;
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
const end = _start + _length;
|
|
27
|
+
|
|
28
|
+
for (let i = _start; i < end; i++) {
|
|
24
29
|
const code_point = string.charCodeAt(i);
|
|
25
30
|
|
|
26
31
|
/*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assert } from "../../core/assert.js";
|
|
2
2
|
import { BitSet } from "../../core/binary/BitSet.js";
|
|
3
|
+
import { array_set_diff } from "../../core/collection/array/array_set_diff.js";
|
|
3
4
|
import { array_shrink_to_size } from "../../core/collection/array/array_shrink_to_size.js";
|
|
4
|
-
import { arraySetDiff } from "../../core/collection/array/arraySetDiff.js";
|
|
5
5
|
import { findSignalHandlerIndexByHandle } from "../../core/events/signal/findSignalHandlerIndexByHandle.js";
|
|
6
6
|
import {
|
|
7
7
|
findSignalHandlerIndexByHandleAndContext
|
|
@@ -463,7 +463,7 @@ export class EntityComponentDataset {
|
|
|
463
463
|
|
|
464
464
|
const newComponentTypeCount = map.length;
|
|
465
465
|
|
|
466
|
-
const diff =
|
|
466
|
+
const diff = array_set_diff(map, this.componentTypeMap);
|
|
467
467
|
|
|
468
468
|
const typesToAdd = diff.uniqueA;
|
|
469
469
|
const typesToRemove = diff.uniqueB;
|
|
@@ -681,7 +681,7 @@ export class EntityComponentDataset {
|
|
|
681
681
|
* @returns {boolean} false if no new classes were added, true if at least one new class was added
|
|
682
682
|
*/
|
|
683
683
|
registerManyComponentTypes(types) {
|
|
684
|
-
const diff =
|
|
684
|
+
const diff = array_set_diff(types, this.componentTypeMap);
|
|
685
685
|
|
|
686
686
|
if (diff.uniqueA.length === 0) {
|
|
687
687
|
// all classes area already registered
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bone } from "three";
|
|
2
|
-
import {
|
|
2
|
+
import { array_pick_best_element } from "../../../../core/collection/array/array_pick_best_element.js";
|
|
3
3
|
import { string_compute_similarity } from "../../../../core/primitives/strings/string_compute_similarity.js";
|
|
4
4
|
import { extractName } from "../../../../extractName.js";
|
|
5
5
|
import { BoneMapping } from "./skeleton/BoneMapping.js";
|
|
@@ -43,7 +43,7 @@ export function getSkeletonBone(component, boneName) {
|
|
|
43
43
|
//bone not found
|
|
44
44
|
|
|
45
45
|
//try to find similar bones
|
|
46
|
-
const bestMatch =
|
|
46
|
+
const bestMatch = array_pick_best_element(bones, function (bone) {
|
|
47
47
|
return string_compute_similarity(bone.name, boneName);
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -447,12 +447,13 @@ vec4 lvp_mask_weights_by_visibility(in vec3 position, in vec3 normal, in vec3 vi
|
|
|
447
447
|
// room, the normals on the details might rule out all of the probes that have mutual
|
|
448
448
|
// visibility to the point. So, we instead use a "wrap shading" test below inspired by
|
|
449
449
|
// NPR work.
|
|
450
|
-
|
|
450
|
+
float backface_term = max(0.0001, dot(direction_to_probe, normal));
|
|
451
451
|
|
|
452
452
|
// The small offset at the end reduces the "going to zero" impact
|
|
453
453
|
// where this is really close to exactly opposite
|
|
454
454
|
// float backface_term = max(0.0001, (dot(direction_to_probe, normal) + 1.0) * 0.5);
|
|
455
|
-
|
|
455
|
+
weight *= backface_term * backface_term + 0.05;
|
|
456
|
+
// weight *= backface_term;
|
|
456
457
|
|
|
457
458
|
}
|
|
458
459
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathTracerProbeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js"],"names":[],"mappings":"AAuBA;IACI,mBAA0B;IAC1B,yBAAqB;
|
|
1
|
+
{"version":3,"file":"PathTracerProbeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js"],"names":[],"mappings":"AAuBA;IACI,mBAA0B;IAC1B,yBAAqB;IAGrB,qBAAoB;IACpB,qBAAyB;IAEzB,uBAA6B;IAE7B;;;;;;;;OAQG;IACH,kCAPW,MAAM,aACN,MAAM,YACN,MAAM,EAAE,mBACR,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,QAchB;IAED,iFAuCC;IAKD,mBACC;IAED,4BAKC;CACJ;8BA/F6B,oBAAoB;2BAHvB,8BAA8B;gCADzB,mCAAmC"}
|
|
@@ -24,8 +24,9 @@ const sampled_irradiance = new Float32Array(3);
|
|
|
24
24
|
export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
25
25
|
tracer = new PathTracer();
|
|
26
26
|
max_bounce_count = 5;
|
|
27
|
-
sample_count =
|
|
28
|
-
// sample_count =
|
|
27
|
+
// sample_count = 192;
|
|
28
|
+
// sample_count = 1000;
|
|
29
|
+
sample_count = 4096;
|
|
29
30
|
random = seededRandom(0);
|
|
30
31
|
|
|
31
32
|
scene = new PathTracedScene()
|
|
@@ -49,7 +50,7 @@ export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
|
49
50
|
this.scene,
|
|
50
51
|
position, position_offset,
|
|
51
52
|
resolution, max_depth,
|
|
52
|
-
|
|
53
|
+
8
|
|
53
54
|
);
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_probes_for_scene.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/build_probes_for_scene.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,iFAPW,gBAAgB,GAKd,QAAQ,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"build_probes_for_scene.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/build_probes_for_scene.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,iFAPW,gBAAgB,GAKd,QAAQ,gBAAgB,CAAC,CAiGrC;iCA3GgC,uBAAuB"}
|
|
@@ -60,9 +60,6 @@ export async function build_probes_for_scene(
|
|
|
60
60
|
// );
|
|
61
61
|
// }
|
|
62
62
|
|
|
63
|
-
// make_justified_point_grid(model_bounds, probe_grid_spacing, (x, y, z) => {
|
|
64
|
-
// volume.add_point(x, y, z);
|
|
65
|
-
// });
|
|
66
63
|
|
|
67
64
|
// lpv.add_point(10, 1, -10);
|
|
68
65
|
|
|
@@ -74,6 +71,12 @@ export async function build_probes_for_scene(
|
|
|
74
71
|
//
|
|
75
72
|
// volume.build_mesh();
|
|
76
73
|
console.time('Grid Build')
|
|
74
|
+
//
|
|
75
|
+
// make_justified_point_grid(model_bounds, probe_grid_spacing, (x, y, z) => {
|
|
76
|
+
// volume.add_point(x, y, z);
|
|
77
|
+
// });
|
|
78
|
+
// volume.build_mesh();
|
|
79
|
+
//
|
|
77
80
|
volume.build_grid(model_bounds, new Vector3(
|
|
78
81
|
Math.ceil(model_bounds.width / probe_grid_spacing),
|
|
79
82
|
Math.ceil(model_bounds.height / probe_grid_spacing),
|
|
@@ -46,7 +46,6 @@ import TopDownCameraController from "../ecs/camera/topdown/TopDownCameraControll
|
|
|
46
46
|
import { Light } from "../ecs/light/Light.js";
|
|
47
47
|
import LightSystem from "../ecs/light/LightSystem.js";
|
|
48
48
|
import { LightType } from "../ecs/light/LightType.js";
|
|
49
|
-
import { SGMesh } from "../ecs/mesh-v2/aggregate/SGMesh.js";
|
|
50
49
|
import { SGMeshSystem } from "../ecs/mesh-v2/aggregate/SGMeshSystem.js";
|
|
51
50
|
import { ShadedGeometry } from "../ecs/mesh-v2/ShadedGeometry.js";
|
|
52
51
|
import { ShadedGeometryFlags } from "../ecs/mesh-v2/ShadedGeometryFlags.js";
|
|
@@ -246,7 +245,7 @@ async function getVolume({
|
|
|
246
245
|
engine,
|
|
247
246
|
ecd,
|
|
248
247
|
bounds: mesh_bounds,
|
|
249
|
-
density:
|
|
248
|
+
density: 500
|
|
250
249
|
});
|
|
251
250
|
|
|
252
251
|
const buffer = new BinaryBuffer();
|
|
@@ -355,7 +354,7 @@ async function main(engine) {
|
|
|
355
354
|
sun: sun_color,
|
|
356
355
|
// sunIntensity: 1.7,
|
|
357
356
|
sunIntensity: 3,
|
|
358
|
-
sunDirection: new Vector3(0.2, -
|
|
357
|
+
sunDirection: new Vector3(0.2, -0.8, 1)
|
|
359
358
|
// sunDirection: new Vector3(1.2, -1, 0.2)
|
|
360
359
|
})
|
|
361
360
|
|
|
@@ -388,9 +387,10 @@ async function main(engine) {
|
|
|
388
387
|
// const path = 'data/models/samples/teapot.gltf';
|
|
389
388
|
// const path = 'data/models/samples/salle_de_bain/model.glb';
|
|
390
389
|
// const path = 'data/models/samples/conference/model-no-curtains.glb';
|
|
391
|
-
const path = 'data/models/pica_pica/pica_pica.gltf';
|
|
390
|
+
// const path = 'data/models/pica_pica/pica_pica.gltf';
|
|
392
391
|
// const path = 'data/models/samples/gi_box_01/model.glb';
|
|
393
392
|
// const path = 'data/models/samples/low_poly_classroom/no-glass/model.gltf';
|
|
393
|
+
const path = 'customer_data/halon_scene.glb';
|
|
394
394
|
|
|
395
395
|
const mesh_asset = await engine.assetManager.promise(path, 'model/gltf+json');
|
|
396
396
|
const gltf = mesh_asset.gltf;
|
|
@@ -401,12 +401,6 @@ async function main(engine) {
|
|
|
401
401
|
|
|
402
402
|
// make_cornel_box(ecd);
|
|
403
403
|
|
|
404
|
-
const mesh_entity = new Entity();
|
|
405
|
-
mesh_entity
|
|
406
|
-
.add(new Transform())
|
|
407
|
-
.add(SGMesh.fromURL(path))
|
|
408
|
-
;
|
|
409
|
-
|
|
410
404
|
|
|
411
405
|
const composition = three_object_to_entity_composition(gltf.scene);
|
|
412
406
|
|
|
@@ -419,8 +413,16 @@ async function main(engine) {
|
|
|
419
413
|
*/
|
|
420
414
|
const sg = n.entity.getComponent(ShadedGeometry);
|
|
421
415
|
|
|
422
|
-
if (sg
|
|
423
|
-
|
|
416
|
+
if (sg === null) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
sg.writeFlag(ShadedGeometryFlags.CastShadow | ShadedGeometryFlags.ReceiveShadow, true);
|
|
421
|
+
|
|
422
|
+
const material = sg.material;
|
|
423
|
+
if(material !== null){
|
|
424
|
+
material.depthTest = true;
|
|
425
|
+
material.depthWrite = true;
|
|
424
426
|
}
|
|
425
427
|
});
|
|
426
428
|
|
|
@@ -601,5 +603,7 @@ new EngineHarness().initialize({
|
|
|
601
603
|
config.addLoader('model/gltf+json', new GLTFAssetLoader());
|
|
602
604
|
|
|
603
605
|
config.addPlugin(GizmoRenderingPlugin);
|
|
606
|
+
|
|
607
|
+
// config.addPlugin(AmbientOcclusionPostProcessEffect);
|
|
604
608
|
}
|
|
605
609
|
}).then(main);
|