@woosh/meep-engine 2.116.0 → 2.117.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.
Files changed (53) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +90 -65
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +90 -65
  5. package/package.json +1 -1
  6. package/src/core/collection/array/array_replace_all.d.ts +2 -1
  7. package/src/core/collection/array/array_replace_all.d.ts.map +1 -1
  8. package/src/core/collection/array/array_replace_all.js +3 -0
  9. package/src/core/collection/list/List.d.ts.map +1 -1
  10. package/src/core/collection/list/List.js +4 -7
  11. package/src/core/collection/set/ArraySet.d.ts.map +1 -1
  12. package/src/core/collection/set/ArraySet.js +11 -1
  13. package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
  14. package/src/core/math/physics/brdf/brdf_burley.js +3 -14
  15. package/src/core/math/physics/bsdf/bsdf_schlick.js +1 -1
  16. package/src/core/math/physics/pdf/pdf_normal.d.ts +8 -0
  17. package/src/core/math/physics/pdf/pdf_normal.d.ts.map +1 -0
  18. package/src/core/math/physics/pdf/pdf_normal.js +11 -0
  19. package/src/core/math/physics/reflectivity_to_ior.d.ts.map +1 -1
  20. package/src/core/math/physics/reflectivity_to_ior.js +3 -1
  21. package/src/core/primitives/strings/computeStringHash.d.ts +9 -1
  22. package/src/core/primitives/strings/computeStringHash.d.ts.map +1 -1
  23. package/src/core/primitives/strings/computeStringHash.js +10 -5
  24. package/src/engine/development/performance/MetricCollection.d.ts +1 -1
  25. package/src/engine/development/performance/MetricCollection.js +2 -2
  26. package/src/engine/development/performance/monitor/MetricCollectionConsoleMonitor.d.ts +10 -0
  27. package/src/engine/development/performance/monitor/MetricCollectionConsoleMonitor.d.ts.map +1 -0
  28. package/src/engine/development/performance/monitor/MetricCollectionConsoleMonitor.js +23 -0
  29. package/src/engine/graphics/render/forward_plus/model/AbstractLight.d.ts.map +1 -1
  30. package/src/engine/graphics/render/forward_plus/model/AbstractLight.js +3 -3
  31. package/src/engine/graphics/render/forward_plus/model/DirectionalLight.d.ts +6 -6
  32. package/src/engine/graphics/render/forward_plus/model/DirectionalLight.d.ts.map +1 -1
  33. package/src/engine/graphics/render/forward_plus/model/DirectionalLight.js +26 -27
  34. package/src/engine/graphics/render/forward_plus/model/PointLight.d.ts +4 -4
  35. package/src/engine/graphics/render/forward_plus/model/PointLight.d.ts.map +1 -1
  36. package/src/engine/graphics/render/forward_plus/model/PointLight.js +31 -33
  37. package/src/engine/graphics/render/forward_plus/model/SpotLight.d.ts +14 -14
  38. package/src/engine/graphics/render/forward_plus/model/SpotLight.d.ts.map +1 -1
  39. package/src/engine/graphics/render/forward_plus/model/SpotLight.js +46 -47
  40. package/src/engine/graphics/render/visibility/hiz/query/QueryShader.d.ts.map +1 -1
  41. package/src/engine/graphics/render/visibility/hiz/query/QueryShader.js +0 -4
  42. package/src/engine/graphics/sh3/gi/material/common.glsl +3 -2
  43. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
  44. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +6 -3
  45. package/src/engine/graphics/sh3/prototypeSH3Probe.js +16 -12
  46. package/src/engine/graphics/shaders/DenoiseShader.d.ts.map +1 -1
  47. package/src/engine/graphics/shaders/DenoiseShader.js +3 -12
  48. package/src/engine/input/ecs/components/InputBinding.d.ts.map +1 -1
  49. package/src/engine/input/ecs/components/InputBinding.js +3 -2
  50. package/src/engine/input/ecs/components/InputController.d.ts.map +1 -1
  51. package/src/engine/input/ecs/components/InputController.js +18 -1
  52. package/src/engine/input/ecs/controllers/KeyboardCameraController.js +9 -9
  53. package/src/engine/physics/fluid/prototype.js +7 -12
@@ -1 +1 @@
1
- {"version":3,"file":"DirectionalLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/DirectionalLight.js"],"names":[],"mappings":"AAKA;IAIQ;;;OAGG;IACH,UAFU,OAAO,CAEY;IAE7B;;;OAGG;IACH,WAFU,OAAO,CAEa;IAE9B;;;OAGG;IACH,gBAFU,KAAK,CAEgB;IAE/B;;;OAGG;IACH,WAFU,OAAO,CAEc;IAIvC;;;OAGG;IACH,6BAFU,OAAO,CAE4B;CAN5C;8BA9B6B,oBAAoB;oBAD9B,qCAAqC;sBAFnC,oCAAoC;oBACtC,qCAAqC"}
1
+ {"version":3,"file":"DirectionalLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/DirectionalLight.js"],"names":[],"mappings":"AAKA;IAGI;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,oBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,KAAK,CAEY;IAE3B;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAI/B;;;OAGG;IACH,6BAFU,OAAO,CAE4B;CAN5C;8BA7B6B,oBAAoB;oBAD9B,qCAAqC;sBAFnC,oCAAoC;oBACtC,qCAAqC"}
@@ -4,33 +4,32 @@ import Vector3 from "../../../../../core/geom/Vector3.js";
4
4
  import { AbstractLight } from "./AbstractLight.js";
5
5
 
6
6
  export class DirectionalLight extends AbstractLight {
7
- constructor() {
8
- super();
9
-
10
- /**
11
- *
12
- * @type {Vector3}
13
- */
14
- this.position = new Vector3();
15
-
16
- /**
17
- *
18
- * @type {Vector3}
19
- */
20
- this.direction = new Vector3();
21
-
22
- /**
23
- * @readonly
24
- * @type {Color}
25
- */
26
- this.color = new Color(1, 1, 1);
27
-
28
- /**
29
- *
30
- * @type {Vector1}
31
- */
32
- this.intensity = new Vector1(1);
33
- }
7
+
8
+
9
+ /**
10
+ * @readonly
11
+ * @type {Vector3}
12
+ */
13
+ position = new Vector3();
14
+
15
+ /**
16
+ * @readonly
17
+ * @type {Vector3}
18
+ */
19
+ direction = new Vector3();
20
+
21
+ /**
22
+ * @readonly
23
+ * @type {Color}
24
+ */
25
+ color = new Color(1, 1, 1);
26
+
27
+ /**
28
+ * @readonly
29
+ * @type {Vector1}
30
+ */
31
+ intensity = new Vector1(1);
32
+
34
33
  }
35
34
 
36
35
  /**
@@ -5,20 +5,20 @@ export class PointLight extends AbstractLight {
5
5
  */
6
6
  readonly position: Vector3;
7
7
  /**
8
- *
8
+ * @readonly
9
9
  * @type {Vector1}
10
10
  */
11
- radius: Vector1;
11
+ readonly radius: Vector1;
12
12
  /**
13
13
  * @readonly
14
14
  * @type {Color}
15
15
  */
16
16
  readonly color: Color;
17
17
  /**
18
- *
18
+ * @readonly
19
19
  * @type {Vector1}
20
20
  */
21
- intensity: Vector1;
21
+ readonly intensity: Vector1;
22
22
  getCenter(result: any): void;
23
23
  getAABB(result: any): void;
24
24
  onDimensionChanged(listener: any, context: any): void;
@@ -1 +1 @@
1
- {"version":3,"file":"PointLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/PointLight.js"],"names":[],"mappings":"AAKA;IAIQ;;;OAGG;IACH,mBAFU,OAAO,CAEY;IAE7B;;;OAGG;IACH,QAFU,OAAO,CAEW;IAE5B;;;OAGG;IACH,gBAFU,KAAK,CAEgB;IAE/B;;;OAGG;IACH,WAFU,OAAO,CAEc;IAGnC,6BAEC;IAED,2BAeC;IAED,sDAGC;IAED,uDAGC;IA6BL;;;OAGG;IACH,uBAFU,OAAO,CAEgB;IAEjC,2BAAuC;CARtC;8BAvF6B,oBAAoB;oBAH9B,qCAAqC;oBAErC,qCAAqC;sBADnC,oCAAoC"}
1
+ {"version":3,"file":"PointLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/PointLight.js"],"names":[],"mappings":"AAKA;IAEI;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,iBAFU,OAAO,CAEO;IAExB;;;OAGG;IACH,gBAFU,KAAK,CAEY;IAE3B;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAG3B,6BAEC;IAED,2BAeC;IAED,sDAGC;IAED,uDAGC;IA6BL;;;OAGG;IACH,uBAFU,OAAO,CAEgB;IAEjC,2BAAuC;CARtC;8BArF6B,oBAAoB;oBAD9B,qCAAqC;oBADrC,qCAAqC;sBADnC,oCAAoC"}
@@ -1,36 +1,34 @@
1
- import Vector3 from "../../../../../core/geom/Vector3.js";
2
1
  import { Color } from "../../../../../core/color/Color.js";
3
2
  import Vector1 from "../../../../../core/geom/Vector1.js";
3
+ import Vector3 from "../../../../../core/geom/Vector3.js";
4
4
  import { AbstractLight } from "./AbstractLight.js";
5
5
 
6
6
  export class PointLight extends AbstractLight {
7
- constructor() {
8
- super();
9
-
10
- /**
11
- * @readonly
12
- * @type {Vector3}
13
- */
14
- this.position = new Vector3();
15
-
16
- /**
17
- *
18
- * @type {Vector1}
19
- */
20
- this.radius = new Vector1(1);
21
-
22
- /**
23
- * @readonly
24
- * @type {Color}
25
- */
26
- this.color = new Color(1, 1, 1);
27
-
28
- /**
29
- *
30
- * @type {Vector1}
31
- */
32
- this.intensity = new Vector1(1);
33
- }
7
+
8
+ /**
9
+ * @readonly
10
+ * @type {Vector3}
11
+ */
12
+ position = new Vector3();
13
+
14
+ /**
15
+ * @readonly
16
+ * @type {Vector1}
17
+ */
18
+ radius = new Vector1(1);
19
+
20
+ /**
21
+ * @readonly
22
+ * @type {Color}
23
+ */
24
+ color = new Color(1, 1, 1);
25
+
26
+ /**
27
+ * @readonly
28
+ * @type {Vector1}
29
+ */
30
+ intensity = new Vector1(1);
31
+
34
32
 
35
33
  getCenter(result) {
36
34
  this.position.writeToArray(result, 0);
@@ -45,12 +43,12 @@ export class PointLight extends AbstractLight {
45
43
  const center_z = p.z;
46
44
 
47
45
  result[0] = center_x - r;
48
- result[1] = center_y - r;
49
- result[2] = center_z - r;
46
+ result[1] = center_y - r;
47
+ result[2] = center_z - r;
50
48
 
51
- result[3] = center_x + r;
52
- result[4] = center_y + r;
53
- result[5] = center_z + r;
49
+ result[3] = center_x + r;
50
+ result[4] = center_y + r;
51
+ result[5] = center_z + r;
54
52
  }
55
53
 
56
54
  onDimensionChanged(listener, context) {
@@ -1,39 +1,39 @@
1
1
  export class SpotLight extends AbstractLight {
2
2
  /**
3
- *
3
+ * @readonly
4
4
  * @type {Vector3}
5
5
  */
6
- position: Vector3;
6
+ readonly position: Vector3;
7
7
  /**
8
- *
8
+ * @readonly
9
9
  * @type {Vector3}
10
10
  */
11
- direction: Vector3;
11
+ readonly direction: Vector3;
12
12
  /**
13
- *
13
+ * @readonly
14
14
  * @type {Vector1}
15
15
  */
16
- angle: Vector1;
16
+ readonly angle: Vector1;
17
17
  /**
18
- *
18
+ * @readonly
19
19
  * @type {Vector1}
20
20
  */
21
- distance: Vector1;
21
+ readonly distance: Vector1;
22
22
  /**
23
- *
23
+ * @readonly
24
24
  * @type {Color}
25
25
  */
26
- color: Color;
26
+ readonly color: Color;
27
27
  /**
28
- *
28
+ * @readonly
29
29
  * @type {Vector1}
30
30
  */
31
- intensity: Vector1;
31
+ readonly intensity: Vector1;
32
32
  /**
33
- *
33
+ * @readonly
34
34
  * @type {Vector1}
35
35
  */
36
- penumbra: Vector1;
36
+ readonly penumbra: Vector1;
37
37
  getCenter(result: any): void;
38
38
  getAABB(result: any): void;
39
39
  onDimensionChanged(listener: any, context: any): void;
@@ -1 +1 @@
1
- {"version":3,"file":"SpotLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/SpotLight.js"],"names":[],"mappings":"AAMA;IAIQ;;;OAGG;IACH,UAFU,OAAO,CAEY;IAE7B;;;OAGG;IACH,WAFU,OAAO,CAEa;IAE9B;;;OAGG;IACH,OAFU,OAAO,CAEoB;IAErC;;;OAGG;IACH,UAFU,OAAO,CAEa;IAE9B;;;OAGG;IACH,OAFU,KAAK,CAEgB;IAE/B;;;OAGG;IACH,WAFU,OAAO,CAEc;IAE/B;;;OAGG;IACH,UAFU,OAAO,CAEe;IAGpC,6BAYC;IAED,2BAcC;IAED,sDAKC;IAED,uDAKC;IAuCL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;8BAhI6B,oBAAoB;oBAJ9B,qCAAqC;oBACrC,qCAAqC;sBACnC,oCAAoC"}
1
+ {"version":3,"file":"SpotLight.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/render/forward_plus/model/SpotLight.js"],"names":[],"mappings":"AAMA;IAGI;;;OAGG;IACH,mBAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,oBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,OAAO,CAEgB;IAEjC;;;OAGG;IACH,mBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,KAAK,CAEY;IAE3B;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAE3B;;;OAGG;IACH,mBAFU,OAAO,CAEW;IAG5B,6BAYC;IAED,2BAcC;IAED,sDAKC;IAED,uDAKC;IAuCL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;8BA/H6B,oBAAoB;oBAD9B,qCAAqC;oBADrC,qCAAqC;sBAFnC,oCAAoC"}
@@ -1,55 +1,54 @@
1
- import Vector3 from "../../../../../core/geom/Vector3.js";
2
- import Vector1 from "../../../../../core/geom/Vector1.js";
3
1
  import { Color } from "../../../../../core/color/Color.js";
4
2
  import { computeConeBoundingBox } from "../../../../../core/geom/3d/cone/computeConeBoundingBox.js";
3
+ import Vector1 from "../../../../../core/geom/Vector1.js";
4
+ import Vector3 from "../../../../../core/geom/Vector3.js";
5
5
  import { AbstractLight } from "./AbstractLight.js";
6
6
 
7
7
  export class SpotLight extends AbstractLight {
8
- constructor() {
9
- super();
10
-
11
- /**
12
- *
13
- * @type {Vector3}
14
- */
15
- this.position = new Vector3();
16
-
17
- /**
18
- *
19
- * @type {Vector3}
20
- */
21
- this.direction = new Vector3();
22
-
23
- /**
24
- *
25
- * @type {Vector1}
26
- */
27
- this.angle = new Vector1(Math.PI / 2);
28
-
29
- /**
30
- *
31
- * @type {Vector1}
32
- */
33
- this.distance = new Vector1(1);
34
-
35
- /**
36
- *
37
- * @type {Color}
38
- */
39
- this.color = new Color(1, 1, 1);
40
-
41
- /**
42
- *
43
- * @type {Vector1}
44
- */
45
- this.intensity = new Vector1(1);
46
-
47
- /**
48
- *
49
- * @type {Vector1}
50
- */
51
- this.penumbra = new Vector1(0.4);
52
- }
8
+
9
+
10
+ /**
11
+ * @readonly
12
+ * @type {Vector3}
13
+ */
14
+ position = new Vector3();
15
+
16
+ /**
17
+ * @readonly
18
+ * @type {Vector3}
19
+ */
20
+ direction = new Vector3();
21
+
22
+ /**
23
+ * @readonly
24
+ * @type {Vector1}
25
+ */
26
+ angle = new Vector1(Math.PI / 2);
27
+
28
+ /**
29
+ * @readonly
30
+ * @type {Vector1}
31
+ */
32
+ distance = new Vector1(1);
33
+
34
+ /**
35
+ * @readonly
36
+ * @type {Color}
37
+ */
38
+ color = new Color(1, 1, 1);
39
+
40
+ /**
41
+ * @readonly
42
+ * @type {Vector1}
43
+ */
44
+ intensity = new Vector1(1);
45
+
46
+ /**
47
+ * @readonly
48
+ * @type {Vector1}
49
+ */
50
+ penumbra = new Vector1(0.4);
51
+
53
52
 
54
53
  getCenter(result) {
55
54
  // find center of the cone (mid point along the cone length)
@@ -1 +1 @@
1
- {"version":3,"file":"QueryShader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/render/visibility/hiz/query/QueryShader.js"],"names":[],"mappings":"AAEA,kDA0KC;+BA5K8C,OAAO"}
1
+ {"version":3,"file":"QueryShader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/render/visibility/hiz/query/QueryShader.js"],"names":[],"mappings":"AAEA,kDAsKC;+BAxK8C,OAAO"}
@@ -15,10 +15,6 @@ export function makeQueryShader() {
15
15
 
16
16
  out highp vec4 out_value;
17
17
 
18
- float reduce(float a, float b, float c, float d){
19
- return max( a, max( b, max( c, d ) ) );
20
- }
21
-
22
18
  vec3 read_input_v3(ivec2 start){
23
19
  float x = texelFetch(utInput, start, 0).x;
24
20
  float y = texelFetch(utInput, start + ivec2(1,0), 0).x;
@@ -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
- weight *= max(0.0001, dot(direction_to_probe, normal));
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
- // weight *= backface_term * backface_term + 0.05;
455
+ weight *= backface_term * backface_term + 0.05;
456
+ // weight *= backface_term;
456
457
 
457
458
  }
458
459
 
@@ -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,CA8FrC;iCAxGgC,uBAAuB"}
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: 5000
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, -1, 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 !== null) {
423
- sg.writeFlag(ShadedGeometryFlags.CastShadow | ShadedGeometryFlags.ReceiveShadow, true);
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);
@@ -1 +1 @@
1
- {"version":3,"file":"DenoiseShader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/shaders/DenoiseShader.js"],"names":[],"mappings":"AAuEA;;;;;GAKG;AACH,sCAJW,MAAM,qBACN,MAAM;;;;;;;;YAyBD;;eAEG;;;;;;;;;;;;;;;;;EAiBlB;;IA/CD;;;;;OAKG;IACH,oBAJW,MAAM,qBACN,MAAM,EA4ChB;;wBAtHuB,OAAO"}
1
+ {"version":3,"file":"DenoiseShader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/shaders/DenoiseShader.js"],"names":[],"mappings":"AA8DA;;;;;GAKG;AACH,sCAJW,MAAM,qBACN,MAAM;;;;;;;;YAyBD;;eAEG;;;;;;;;;;;;;;;;;EAiBlB;;IA/CD;;;;;OAKG;IACH,oBAJW,MAAM,qBACN,MAAM,EA4ChB;;wBA7GuB,OAAO"}
@@ -1,4 +1,5 @@
1
1
  import { Vector2 } from "three";
2
+ import { pdf_normal } from "../../../core/math/physics/pdf/pdf_normal.js";
2
3
 
3
4
  const KERNEL_SIZE = 15;
4
5
 
@@ -59,16 +60,6 @@ void main(void) {
59
60
  }
60
61
  `;
61
62
 
62
- /**
63
- * Normal Probability Distribution Function
64
- * @param {number} x
65
- * @param {number} sigma
66
- * @return {number}
67
- */
68
- function normpdf(x, sigma) {
69
- return 0.39894 * Math.exp(-0.5 * x * x / (sigma * sigma)) / sigma;
70
- }
71
-
72
63
  /**
73
64
  *
74
65
  * @param {number} sigma
@@ -77,13 +68,13 @@ function normpdf(x, sigma) {
77
68
  */
78
69
  export function DenoiseShader(sigma = 10, filterSmoothness = 0.2) {
79
70
  // compute zNorm
80
- const zNorm = 1 / normpdf(0, filterSmoothness);
71
+ const zNorm = 1 / pdf_normal(0, filterSmoothness);
81
72
 
82
73
  // build kernel
83
74
  const kernel = new Float32Array(KERNEL_SIZE);
84
75
  const kSize = Math.floor((KERNEL_SIZE - 1) / 2);
85
76
  for (let i = 0; i <= kSize; i++) {
86
- const v = normpdf(i, sigma);
77
+ const v = pdf_normal(i, sigma);
87
78
 
88
79
  kernel[kSize + i] = v;
89
80
  kernel[kSize - i] = v;
@@ -1 +1 @@
1
- {"version":3,"file":"InputBinding.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputBinding.js"],"names":[],"mappings":"AAEA;IACI;;;;;OAKG;IACH,2CAJW,MAAM,EAuBhB;IAfG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAChB;;;OAGG;IACH,mBAAwB;IACxB;;;OAGG;IACH,WAFU,OAAO,CAES;CAEjC"}
1
+ {"version":3,"file":"InputBinding.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputBinding.js"],"names":[],"mappings":"AAEA;IACI;;;;;OAKG;IACH,2CAJW,MAAM,EAwBhB;IAfG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAChB;;;OAGG;IACH,mBAAwB;IACxB;;;OAGG;IACH,WAFU,OAAO,CAES;CAEjC"}
@@ -8,8 +8,9 @@ export class InputBinding {
8
8
  * @param {boolean} [exclusive=false]
9
9
  */
10
10
  constructor({ path, listener, exclusive = false }) {
11
- assert.typeOf(path, 'string', 'path');
12
- assert.typeOf(listener, 'function', 'listener');
11
+ assert.isString(path, 'path');
12
+ assert.isFunction(listener, 'listener');
13
+ assert.isBoolean(exclusive, 'exclusive');
13
14
 
14
15
  /**
15
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"InputController.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputController.js"],"names":[],"mappings":";AAMA;IAoBI;;;OAGG;IACH,8CAaC;IApCD;;;;OAIG;IACH,8BAYC;IATG,mBAAyB;IAMzB;;MAEC;CAqBR;;;;;iBA3CgB,0CAA0C;mBACxC,0CAA0C"}
1
+ {"version":3,"file":"InputController.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputController.js"],"names":[],"mappings":";AAMA;IAqCI;;;OAGG;IACH,8CAaC;IArDD;;;;OAIG;IACH,8BAYC;IATG,mBAAyB;IAMzB;;MAEC;IAGL;;;;;OAKG;IACH,WAJW,MAAM,qBAEJ,YAAY,CAWxB;CAoBJ;;;;;iBA5DgB,0CAA0C;mBACxC,0CAA0C;6BAChC,mBAAmB"}
@@ -7,7 +7,7 @@ import { InputBinding } from "./InputBinding.js";
7
7
  class InputController {
8
8
  /**
9
9
  *
10
- * @param {Array} bindings
10
+ * @param {Array} [bindings]
11
11
  * @constructor
12
12
  */
13
13
  constructor(bindings = []) {
@@ -24,6 +24,23 @@ class InputController {
24
24
  };
25
25
  }
26
26
 
27
+ /**
28
+ *
29
+ * @param {string} path
30
+ * @param {function} action
31
+ * @returns {InputBinding}
32
+ */
33
+ bind(path, action) {
34
+ assert.isFunction(action, 'action');
35
+ assert.isString(path, 'path');
36
+
37
+ const binding = new InputBinding({ path, listener: action });
38
+
39
+ this.mapping.add(binding);
40
+
41
+ return binding;
42
+ }
43
+
27
44
  /**
28
45
  *
29
46
  * @param {Array} bindings
@@ -45,19 +45,19 @@ class KeyboardCameraController {
45
45
  function registerToggle(keys, object, propertyName) {
46
46
  keys.forEach((keyName) => {
47
47
 
48
- inputController.mapping.add({
49
- path: "keyboard/keys/" + keyName + "/down",
50
- listener: () => {
48
+ inputController.bind(
49
+ "keyboard/keys/" + keyName + "/down",
50
+ () => {
51
51
  object[propertyName] = true;
52
52
 
53
53
  //send interaction event
54
54
  ecd.sendEvent(cameraController.entity, 'user-input');
55
55
  }
56
- });
57
- inputController.mapping.add({
58
- path: "keyboard/keys/" + keyName + "/up",
59
- listener: () => object[propertyName] = false
60
- });
56
+ );
57
+ inputController.bind(
58
+ "keyboard/keys/" + keyName + "/up",
59
+ () => object[propertyName] = false
60
+ );
61
61
  });
62
62
  }
63
63
 
@@ -89,7 +89,7 @@ class KeyboardCameraController {
89
89
  return;
90
90
  }
91
91
 
92
- let displacement = cameraPanSpeed.clone().multiplyScalar(keyboardPanSpeed * timeDelta);
92
+ const displacement = cameraPanSpeed.clone().multiplyScalar(keyboardPanSpeed * timeDelta);
93
93
 
94
94
  const camera_transform = ecd.getComponent(cameraController.entity, Transform);
95
95
 
@@ -1,12 +1,13 @@
1
- import { EngineHarness } from "../../EngineHarness.js";
2
- import GUIElementSystem from "../../ecs/gui/GUIElementSystem.js";
1
+ import { MetricCollection } from "../../development/performance/MetricCollection.js";
2
+ import {
3
+ MetricCollectionConsoleMonitor
4
+ } from "../../development/performance/monitor/MetricCollectionConsoleMonitor.js";
3
5
  import Entity from "../../ecs/Entity.js";
4
6
  import GUIElement from "../../ecs/gui/GUIElement.js";
7
+ import GUIElementSystem from "../../ecs/gui/GUIElementSystem.js";
8
+ import { EngineHarness } from "../../EngineHarness.js";
5
9
  import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
6
10
  import { BehaviorSystem } from "../../intelligence/behavior/ecs/BehaviorSystem.js";
7
- import { MetricCollection } from "../../development/performance/MetricCollection.js";
8
- import { PeriodicConsolePrinter } from "../../development/performance/monitor/PeriodicConsolePrinter.js";
9
- import { MetricStatistics } from "../../development/performance/MetricStatistics.js";
10
11
  import { FluidField } from "./FluidField.js";
11
12
  import { FluidSimulator } from "./FluidSimulator.js";
12
13
  import { SliceVisualiser } from "./SliceVisualiser.js";
@@ -74,13 +75,7 @@ function main(engine) {
74
75
  }))
75
76
  .build(ecd);
76
77
 
77
- const metric_stats = new MetricStatistics();
78
-
79
- new PeriodicConsolePrinter(3, () => metrics.list().map(m => {
80
- metrics.get(m).computeStats(metric_stats);
81
-
82
- return `${m}: ${metric_stats}`;
83
- }).join('\n')).start()
78
+ MetricCollectionConsoleMonitor.from(metrics).start()
84
79
 
85
80
  new Entity()
86
81
  .add(GUIElement.fromView(slice_view))