@woosh/meep-engine 2.93.2 → 2.94.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 (110) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +296 -233
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +296 -233
  5. package/package.json +1 -1
  6. package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
  7. package/src/core/bvh2/bvh3/BVH.js +4 -2
  8. package/src/core/bvh2/bvh3/build_triangle_morton_codes.d.ts.map +1 -1
  9. package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +2 -1
  10. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
  11. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +12 -1
  12. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts.map +1 -1
  13. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +11 -1
  14. package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.d.ts +14 -0
  15. package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.d.ts.map +1 -0
  16. package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.js +146 -0
  17. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts +16 -0
  18. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts.map +1 -0
  19. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js +90 -0
  20. package/src/core/color/Color.d.ts.map +1 -1
  21. package/src/core/color/Color.js +17 -7
  22. package/src/core/geom/2d/bvh/BVH2D.d.ts.map +1 -1
  23. package/src/core/geom/2d/bvh/BVH2D.js +24 -29
  24. package/src/core/geom/2d/bvh/BVH2D.spec.js +10 -9
  25. package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.d.ts +2 -0
  26. package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.d.ts.map +1 -0
  27. package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.js +89 -0
  28. package/src/core/geom/2d/quad-tree/QuadTreeNode.spec.js +1 -1
  29. package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
  30. package/src/core/geom/3d/aabb/AABB3.js +8 -1
  31. package/src/core/geom/3d/aabb/aabb3_array_combine.d.ts.map +1 -1
  32. package/src/core/geom/3d/aabb/aabb3_array_combine.js +5 -0
  33. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js +2 -0
  34. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.d.ts.map +1 -1
  35. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.js +9 -1
  36. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.d.ts +16 -0
  37. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.d.ts.map +1 -0
  38. package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.js +55 -0
  39. package/src/core/math/build_gaussian_kernel_1d.d.ts +8 -0
  40. package/src/core/math/build_gaussian_kernel_1d.d.ts.map +1 -0
  41. package/src/core/math/build_gaussian_kernel_1d.js +26 -0
  42. package/src/core/math/build_gaussian_kernel_2d.d.ts +10 -0
  43. package/src/core/math/build_gaussian_kernel_2d.d.ts.map +1 -0
  44. package/src/core/math/build_gaussian_kernel_2d.js +55 -0
  45. package/src/core/math/nextOdd.d.ts +8 -0
  46. package/src/core/math/nextOdd.d.ts.map +1 -0
  47. package/src/core/math/nextOdd.js +15 -0
  48. package/src/core/math/nextOdd.spec.d.ts +2 -0
  49. package/src/core/math/nextOdd.spec.d.ts.map +1 -0
  50. package/src/core/math/nextOdd.spec.js +9 -0
  51. package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -1
  52. package/src/engine/animation/clip/ecd_bind_animation_curve.js +7 -3
  53. package/src/engine/animation/curve/prototypeGLTF.js +18 -11
  54. package/src/engine/ecs/Entity.js +1 -1
  55. package/src/engine/ecs/EntityComponentDataset.js +0 -14
  56. package/src/engine/ecs/computeComponentClassName.d.ts +2 -0
  57. package/src/engine/ecs/computeComponentClassName.d.ts.map +1 -0
  58. package/src/engine/ecs/computeComponentClassName.js +13 -0
  59. package/src/engine/graphics/ecs/light/binding/LightBinding.d.ts +2 -0
  60. package/src/engine/graphics/ecs/light/binding/LightBinding.d.ts.map +1 -1
  61. package/src/engine/graphics/ecs/light/binding/LightBinding.js +16 -0
  62. package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.d.ts +13 -2
  63. package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.d.ts.map +1 -1
  64. package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.js +37 -4
  65. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts.map +1 -1
  66. package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +12 -8
  67. package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
  68. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts +0 -9
  69. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts.map +1 -1
  70. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +100 -129
  71. package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
  72. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +6 -4
  73. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +11 -4
  74. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts +2 -2
  75. package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js +2 -2
  76. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  77. package/src/engine/graphics/texture/sampler/Sampler2D.js +6 -4
  78. package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.d.ts.map +1 -1
  79. package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.js +1 -2
  80. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.d.ts +2 -2
  81. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.d.ts.map +1 -1
  82. package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js +3 -3
  83. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts.map +1 -1
  84. package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js +5 -31
  85. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.d.ts +3 -6
  86. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.d.ts.map +1 -1
  87. package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.js +8 -27
  88. package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.d.ts +4 -0
  89. package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.d.ts.map +1 -1
  90. package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.js +12 -0
  91. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts +29 -0
  92. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts.map +1 -0
  93. package/src/engine/graphics/texture/virtual/VirtualTextureSystem.js +102 -0
  94. package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js +1 -1
  95. package/src/engine/graphics/texture/virtual/prototype.js +221 -79
  96. package/src/generation/filtering/numeric/CellFilterCache.d.ts.map +1 -1
  97. package/src/generation/filtering/numeric/CellFilterCache.js +7 -7
  98. package/src/generation/filtering/numeric/complex/CellFilterFXAA.d.ts.map +1 -1
  99. package/src/generation/filtering/numeric/complex/CellFilterFXAA.js +9 -6
  100. package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.d.ts +1 -13
  101. package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.d.ts.map +1 -1
  102. package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +39 -111
  103. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts.map +1 -1
  104. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +6 -5
  105. package/src/generation/grid/generation/util/buildDistanceMapToObjective.d.ts +1 -1
  106. package/src/generation/grid/generation/util/buildDistanceMapToObjective.d.ts.map +1 -1
  107. package/src/generation/grid/generation/util/buildDistanceMapToObjective.js +5 -12
  108. package/src/core/math/makeNextOdd.d.ts +0 -8
  109. package/src/core/math/makeNextOdd.d.ts.map +0 -1
  110. package/src/core/math/makeNextOdd.js +0 -15
@@ -0,0 +1,89 @@
1
+ import { randomFloatBetween } from "../../../math/random/randomFloatBetween.js";
2
+ import { seededRandom } from "../../../math/random/seededRandom.js";
3
+ import { BVH2D } from "./BVH2D.js";
4
+ import { bvh2d_query_all_data_by_circle } from "./bvh2d_query_all_data_by_circle.js";
5
+
6
+ test.skip("performance, 10k objects, 1m queries", () => {
7
+ const OBJECT_COUNT = 30000;
8
+ const QUERY_COUNT = 1e6;
9
+
10
+ const QUERY_DISTANCE_MIN = 0.1;
11
+ const QUERY_DISTANCE_MAX = 0.2;
12
+
13
+ const grid_bounds_x1 = 256;
14
+ const grid_bounds_y1 = 256;
15
+
16
+ const bvh = new BVH2D();
17
+
18
+ const random = seededRandom();
19
+
20
+ // fill
21
+ for (let i = 0; i < OBJECT_COUNT; i++) {
22
+
23
+ const width = randomFloatBetween(random, 0.2, 1);
24
+ const height = randomFloatBetween(random, 0.2, 1);
25
+ const x0 = randomFloatBetween(random, 0, grid_bounds_x1 - width);
26
+ const y0 = randomFloatBetween(random, 0, grid_bounds_y1 - height);
27
+
28
+ const node = bvh.allocate_node();
29
+
30
+ bvh.node_set_user_data(node, i);
31
+ bvh.node_set_aabb_primitive(
32
+ node,
33
+ x0,
34
+ y0,
35
+ x0 + width,
36
+ y0 + height
37
+ );
38
+
39
+ bvh.insert_leaf(node);
40
+ }
41
+
42
+
43
+ const queries = new Float32Array(QUERY_COUNT * 3);
44
+
45
+ // build queries
46
+ for (let i = 0; i < QUERY_COUNT; i++) {
47
+
48
+ const offset = i * 3;
49
+
50
+ // pick radius
51
+ const radius = randomFloatBetween(random, QUERY_DISTANCE_MIN, QUERY_DISTANCE_MAX);
52
+
53
+ // pick starting point
54
+ const ax = randomFloatBetween(random, radius, grid_bounds_x1 - radius);
55
+ const ay = randomFloatBetween(random, radius, grid_bounds_y1 - radius);
56
+
57
+ queries[offset] = ax;
58
+ queries[offset + 1] = ay;
59
+
60
+ queries[offset + 2] = radius;
61
+ }
62
+
63
+ // execute
64
+ const t0 = performance.now();
65
+
66
+ const result = [];
67
+
68
+ for (let i = 0; i < QUERY_COUNT; i++) {
69
+
70
+ const offset = i * 3;
71
+
72
+ bvh2d_query_all_data_by_circle(
73
+ bvh,
74
+ bvh.root,
75
+ result,
76
+ 0,
77
+ queries[offset],
78
+ queries[offset + 1],
79
+ queries[offset + 2]
80
+ );
81
+ }
82
+
83
+ const duration = performance.now() - t0;
84
+
85
+ const duration_seconds = duration * 1e-3;
86
+
87
+ console.log(`Duration ${duration_seconds}s, ${(QUERY_COUNT / duration_seconds).toFixed(2)} cycles per second`);
88
+
89
+ });
@@ -183,7 +183,7 @@ test('test traverseRectangleIntersections', () => {
183
183
  expect(visitor0).toHaveBeenCalledWith(e, 0, 0, 3, 3);
184
184
  });
185
185
 
186
- test("performance, insertion 1m random", () => {
186
+ test.skip("performance, insertion 1m random", () => {
187
187
  const tree = new QuadTreeNode(0, 0, 100, 100);
188
188
 
189
189
  const random = seededRandom(42);
@@ -1 +1 @@
1
- {"version":3,"file":"AABB3.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/AABB3.js"],"names":[],"mappings":"AAoBA;;;GAGG;AACH;IACI;;;;;;;;;OASG;IACH,iBARW,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,EAYhB;IAyCD,gBAEC;IA7BD,aAEC;IA6BD,gBAEC;IA5BD,aAEC;IA4BD,gBAEC;IA5BD,aAEC;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AED;;;;OAIG;IACH,4BAFY,OAAO,CAMlB;IAED;;;OAGG;IACH,+BAHW,OAAO,GACL,OAAO,CAanB;IAED;;;;OAIG;IACH,0CAFa,MAAM,CAoBlB;IAED;;;;OAIG;IACH,sCAHW,MAAM,EAAE,GACN,MAAM,CAMlB;IAED;;;;OAIG;IACH;;QAFa,OAAO,CAYnB;IAED;;;;OAIG;IACH,gCAHW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,GACrC,OAAO,CAYnB;IAED;;;OAGG;IACH,qBAFW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,QAWjD;IAED;;;OAGG;IACH,YAFW,MAAM,QAUhB;IAED;;;OAGG;IACH,SAFa,KAAK,CAQjB;IAED;;;;;;;aAEC;IAIL;;;OAGG;IACH,kBAFU,OAAO,CAEM;IAz2BnB,mDAUC;CAw1BJ"}
1
+ {"version":3,"file":"AABB3.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/AABB3.js"],"names":[],"mappings":"AAoBA;;;GAGG;AACH;IACI;;;;;;;;;OASG;IACH,iBARW,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,EAYhB;IAyCD,gBAEC;IA7BD,aAEC;IA6BD,gBAEC;IA5BD,aAEC;IA4BD,gBAEC;IA5BD,aAEC;IA4BD,gBAEC;IA3BD,aAEC;IA2BD,gBAEC;IA1BD,aAEC;IA0BD,gBAEC;IA1BD,aAEC;IAGG,QAAW;IAIX,QAAW;IAIX,QAAW;IAIX,QAAW;IAIX,QAAW;IAIX,QAAW;IAGf;;;;;;OAMG;IACH,iBALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;OAOG;IACH,8BANW,MAAM,KACN,MAAM,KACN,MAAM,aACN,MAAM,GACJ,OAAO,CAMnB;IAED,4BAKC;IAED;;;OAGG;IACH,sBAFa,MAAM,CAIlB;IAED;;;OAGG;I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AC,YAAY,QAWjD;IAED;;;OAGG;IACH,YAFW,MAAM,QAUhB;IAED;;;OAGG;IACH,SAFa,KAAK,CAQjB;IAED;;;;;;;aAEC;IAIL;;;OAGG;IACH,kBAFU,OAAO,CAEM;IAEvB;;;;OAIG;IACH,iBAFU,MAAM,CAEM;IAh3BlB,mDAUC;CAw1BJ"}
@@ -302,7 +302,7 @@ export class AABB3 {
302
302
  * @param {number} y
303
303
  * @param {number} z
304
304
  */
305
- _translate(x,y,z){
305
+ _translate(x, y, z) {
306
306
  this.setBounds(
307
307
  this.x0 + x, this.y0 + y, this.z0 + z,
308
308
  this.x1 + x, this.y1 + y, this.z1 + z
@@ -918,3 +918,10 @@ export class AABB3 {
918
918
  * @type {boolean}
919
919
  */
920
920
  AABB3.prototype.isAABB3 = true;
921
+
922
+ /**
923
+ * Pretending to be an array
924
+ * @readonly
925
+ * @type {number}
926
+ */
927
+ AABB3.prototype.length = 6
@@ -1 +1 @@
1
- {"version":3,"file":"aabb3_array_combine.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_combine.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,4CAPW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,iBACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,QA2ChB"}
1
+ {"version":3,"file":"aabb3_array_combine.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_combine.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,4CAPW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,iBACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,QAgDhB"}
@@ -18,9 +18,14 @@ export function aabb3_array_combine(
18
18
  a, a_offset,
19
19
  b, b_offset
20
20
  ) {
21
+
22
+ assert.isNumber(a_offset,'a_offset');
23
+ assert.notNaN(a_offset,'a_offset');
21
24
  assert.isNonNegativeInteger(a_offset, 'a_offset');
22
25
  assert.lessThanOrEqual(a_offset, a.length - 6, 'a_offset array overflow');
23
26
 
27
+ assert.isNumber(b_offset,'b_offset');
28
+ assert.notNaN(a_offset,'b_offset');
24
29
  assert.isNonNegativeInteger(b_offset, 'b_offset');
25
30
  assert.lessThanOrEqual(b_offset, b.length - 6, 'b_offset array overflow');
26
31
 
@@ -92,3 +92,5 @@ export function computeTriangleRayIntersectionBarycentric(
92
92
  edge2_x, edge2_y, edge2_z
93
93
  );
94
94
  }
95
+
96
+
@@ -1 +1 @@
1
- {"version":3,"file":"computeTriangleRayIntersectionBarycentricEdge.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,sEAlBW,MAAM,EAAE,YACR,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,GACL,OAAO,CAwDlB"}
1
+ {"version":3,"file":"computeTriangleRayIntersectionBarycentricEdge.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,sEAlBW,MAAM,EAAE,YACR,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,GACL,OAAO,CAgElB"}
@@ -24,7 +24,15 @@ import { v3_dot } from "../../vec3/v3_dot.js";
24
24
  * @param {number} edge2_z
25
25
  * @return {boolean}
26
26
  */
27
- export function computeTriangleRayIntersectionBarycentricEdge(result, origin_x, origin_y, origin_z, direction_x, direction_y, direction_z, ax, ay, az, edge1_x, edge1_y, edge1_z, edge2_x, edge2_y, edge2_z) {
27
+ export function computeTriangleRayIntersectionBarycentricEdge(
28
+ result,
29
+ origin_x, origin_y, origin_z,
30
+ direction_x, direction_y, direction_z,
31
+ ax, ay, az,
32
+ edge1_x, edge1_y, edge1_z,
33
+ edge2_x, edge2_y, edge2_z
34
+ ) {
35
+
28
36
  // begin calculating determinant - also used to calculate U parameter
29
37
 
30
38
  // CROSS(pvec, dir, edge2)
@@ -0,0 +1,16 @@
1
+ /**
2
+ *
3
+ * @param {number[]} result
4
+ * @param {number} origin_x
5
+ * @param {number} origin_y
6
+ * @param {number} origin_z
7
+ * @param {number} direction_x
8
+ * @param {number} direction_y
9
+ * @param {number} direction_z
10
+ * @param {number[]|ArrayLike<number>|Uint32Array} indices
11
+ * @param {number} triangle_index
12
+ * @param {number[]|Float32Array} positions
13
+ * @return {boolean}
14
+ */
15
+ export function computeTriangleRayIntersectionBarycentricGeometry(result: number[], origin_x: number, origin_y: number, origin_z: number, direction_x: number, direction_y: number, direction_z: number, indices: number[] | ArrayLike<number> | Uint32Array, triangle_index: number, positions: number[] | Float32Array): boolean;
16
+ //# sourceMappingURL=computeTriangleRayIntersectionBarycentricGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeTriangleRayIntersectionBarycentricGeometry.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,0EAZW,MAAM,EAAE,YACR,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,WACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,WAAW,kBACtC,MAAM,aACN,MAAM,EAAE,GAAC,YAAY,GACpB,OAAO,CAwClB"}
@@ -0,0 +1,55 @@
1
+ import { computeTriangleRayIntersectionBarycentric } from "./computeTriangleRayIntersectionBarycentric.js";
2
+
3
+ /**
4
+ *
5
+ * @param {number[]} result
6
+ * @param {number} origin_x
7
+ * @param {number} origin_y
8
+ * @param {number} origin_z
9
+ * @param {number} direction_x
10
+ * @param {number} direction_y
11
+ * @param {number} direction_z
12
+ * @param {number[]|ArrayLike<number>|Uint32Array} indices
13
+ * @param {number} triangle_index
14
+ * @param {number[]|Float32Array} positions
15
+ * @return {boolean}
16
+ */
17
+ export function computeTriangleRayIntersectionBarycentricGeometry(
18
+ result,
19
+ origin_x, origin_y, origin_z,
20
+ direction_x, direction_y, direction_z,
21
+ indices, triangle_index, positions
22
+ ) {
23
+ const index_offset = triangle_index * 3;
24
+
25
+ const a = indices[index_offset];
26
+ const b = indices[index_offset + 1];
27
+ const c = indices[index_offset + 2];
28
+
29
+
30
+ const a_address = a * 3;
31
+ const b_address = b * 3;
32
+ const c_address = c * 3;
33
+
34
+
35
+ const ax = positions[a_address];
36
+ const ay = positions[a_address + 1];
37
+ const az = positions[a_address + 2];
38
+
39
+ const bx = positions[b_address];
40
+ const by = positions[b_address + 1];
41
+ const bz = positions[b_address + 2];
42
+
43
+ const cx = positions[c_address];
44
+ const cy = positions[c_address + 1];
45
+ const cz = positions[c_address + 2];
46
+
47
+ return computeTriangleRayIntersectionBarycentric(
48
+ result,
49
+ origin_x, origin_y, origin_z,
50
+ direction_x, direction_y, direction_z,
51
+ ax, ay, az,
52
+ bx, by, bz,
53
+ cx, cy, cz
54
+ );
55
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {Float32Array} kernel
4
+ * @param {number} sample_count
5
+ * @param {number} sigma
6
+ */
7
+ export function build_gaussian_kernel_1d(kernel: Float32Array, sample_count: number, sigma: number): void;
8
+ //# sourceMappingURL=build_gaussian_kernel_1d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build_gaussian_kernel_1d.d.ts","sourceRoot":"","sources":["../../../../src/core/math/build_gaussian_kernel_1d.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,iDAJW,YAAY,gBACZ,MAAM,SACN,MAAM,QAmBhB"}
@@ -0,0 +1,26 @@
1
+ import { gaussian } from "./gaussian.js";
2
+
3
+ /**
4
+ *
5
+ * @param {Float32Array} kernel
6
+ * @param {number} sample_count
7
+ * @param {number} sigma
8
+ */
9
+ export function build_gaussian_kernel_1d(kernel, sample_count, sigma) {
10
+
11
+ const half_width = (sample_count - 1) * 0.5;
12
+
13
+ let kernel_power_sum = 0;
14
+ for (let i = 0; i < sample_count; i++) {
15
+ const local = i - half_width;
16
+
17
+ const power = gaussian(sigma, local);
18
+ kernel[i] = power;
19
+ kernel_power_sum += power;
20
+ }
21
+
22
+ // normalize kernel
23
+ for (let i = 0; i < sample_count; i++) {
24
+ kernel[i] /= kernel_power_sum;
25
+ }
26
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Build gaussian 2d kernel
3
+ * @param {number[]|Float32Array} result
4
+ * @param {number} samplesX
5
+ * @param {number} samplesY
6
+ * @param {number} sigma_x
7
+ * @param {number} sigma_y
8
+ */
9
+ export function build_gaussian_kernel_2d(result: number[] | Float32Array, samplesX: number, samplesY: number, sigma_x: number, sigma_y: number): void;
10
+ //# sourceMappingURL=build_gaussian_kernel_2d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build_gaussian_kernel_2d.d.ts","sourceRoot":"","sources":["../../../../src/core/math/build_gaussian_kernel_2d.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,iDANW,MAAM,EAAE,GAAC,YAAY,YACrB,MAAM,YACN,MAAM,WACN,MAAM,WACN,MAAM,QA6ChB"}
@@ -0,0 +1,55 @@
1
+ import { assert } from "../assert.js";
2
+ import { gaussian } from "./gaussian.js";
3
+
4
+ /**
5
+ * Build gaussian 2d kernel
6
+ * @param {number[]|Float32Array} result
7
+ * @param {number} samplesX
8
+ * @param {number} samplesY
9
+ * @param {number} sigma_x
10
+ * @param {number} sigma_y
11
+ */
12
+ export function build_gaussian_kernel_2d(
13
+ result,
14
+ samplesX, samplesY,
15
+ sigma_x, sigma_y
16
+ ) {
17
+ assert.isNonNegativeInteger(samplesX, 'samplesX');
18
+ assert.isNonNegativeInteger(samplesY, 'samplesY');
19
+
20
+ const half_samples_x = (samplesX - 1) * 0.5;
21
+ const half_samples_y = (samplesY - 1) * 0.5;
22
+
23
+ let powerTotal = 0;
24
+ let ix, iy;
25
+
26
+ const i_samples_x = samplesX | 0;
27
+
28
+ for (iy = 0; iy < samplesY; iy++) {
29
+ const local_y = iy - half_samples_y;
30
+
31
+ const fy = gaussian(sigma_y, local_y);
32
+
33
+ for (ix = 0; ix < samplesX; ix++) {
34
+
35
+ const local_x = ix - half_samples_x;
36
+
37
+ const fx = gaussian(sigma_x, local_x);
38
+
39
+
40
+ const power = fx * fy;
41
+
42
+ powerTotal += power;
43
+
44
+ result[iy * i_samples_x + ix] = power;
45
+ }
46
+ }
47
+
48
+ const inv_total_power = 1 / powerTotal;
49
+
50
+ // normalize kernel
51
+ for (let i = 0; i < samplesX * samplesY; i++) {
52
+ result[i] *= inv_total_power;
53
+ }
54
+
55
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * Returns next odd value or input if already odd
4
+ * @param {number} x integer
5
+ * @return {number} odd integer
6
+ */
7
+ export function nextOdd(x: number): number;
8
+ //# sourceMappingURL=nextOdd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextOdd.d.ts","sourceRoot":"","sources":["../../../../src/core/math/nextOdd.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,2BAHW,MAAM,GACL,MAAM,CAUjB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ *
3
+ * Returns next odd value or input if already odd
4
+ * @param {number} x integer
5
+ * @return {number} odd integer
6
+ */
7
+ export function nextOdd(x) {
8
+ if (x % 2 === 0) {
9
+ // even, make odd
10
+ return x + 1;
11
+ }
12
+
13
+ // already odd
14
+ return x;
15
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=nextOdd.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextOdd.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/math/nextOdd.spec.js"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { nextOdd } from "./nextOdd.js";
2
+
3
+ test("basics", () => {
4
+
5
+ expect(nextOdd(0)).toBe(1);
6
+ expect(nextOdd(1)).toBe(1);
7
+ expect(nextOdd(-1)).toBe(-1);
8
+
9
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"ecd_bind_animation_curve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/clip/ecd_bind_animation_curve.js"],"names":[],"mappings":"AAmUA;;;;GAIG;AACH,2DAFW,mBAAmB,wBA6B7B;8BA5V6B,oBAAoB;qCACb,2BAA2B"}
1
+ {"version":3,"file":"ecd_bind_animation_curve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/clip/ecd_bind_animation_curve.js"],"names":[],"mappings":"AAuUA;;;;GAIG;AACH,2DAFW,mBAAmB,wBA6B7B;8BAhW6B,oBAAoB;qCACb,2BAA2B"}
@@ -14,13 +14,17 @@ import { AnimationTrackBinding } from "./AnimationTrackBinding.js";
14
14
  /**
15
15
  *
16
16
  * @param {EntityNode} node
17
- * @returns {String}
17
+ * @returns {string|undefined}
18
18
  */
19
19
  function get_node_name(node) {
20
20
  /**
21
21
  * @type {Name}
22
22
  */
23
- const name = node.entity.getComponentSafe(Name);
23
+ const name = node.entity.getComponent(Name);
24
+
25
+ if (name === null) {
26
+ return undefined;
27
+ }
24
28
 
25
29
  return name.getValue();
26
30
  }
@@ -348,7 +352,7 @@ export function convert_three_clip(node, clip) {
348
352
  meep_clip.tracks.push(meep_track);
349
353
  clip_binding.tracks.push(AnimationTrackBinding.from(writer, meep_track));
350
354
  } catch (e) {
351
- logger.error(`Failed to parse track[${i}]: ${e.message}`);
355
+ logger.error(`Failed to parse track[${i}]: ${e}`);
352
356
  }
353
357
  }
354
358
 
@@ -38,17 +38,17 @@ async function main(engine) {
38
38
  yaw: 3.123185307179593,
39
39
  });
40
40
  //
41
- make_sample('data/models/samples/InterpolationTest.glb',[
42
- 'Step Scale',
43
- 'Linear Scale',
44
- 'CubicSpline Scale',
45
- 'Step Rotation',
46
- 'CubicSpline Rotation',
47
- 'Linear Rotation',
48
- 'Step Translation',
49
- 'CubicSpline Translation',
50
- 'Linear Translation'
51
- ],engine.entityManager.dataset);
41
+ // make_sample('data/models/samples/InterpolationTest.glb',[
42
+ // 'Step Scale',
43
+ // 'Linear Scale',
44
+ // 'CubicSpline Scale',
45
+ // 'Step Rotation',
46
+ // 'CubicSpline Rotation',
47
+ // 'Linear Rotation',
48
+ // 'Step Translation',
49
+ // 'CubicSpline Translation',
50
+ // 'Linear Translation'
51
+ // ],engine.entityManager.dataset);
52
52
 
53
53
  // make_sample('data/models/samples/BoxAnimated.glb',[
54
54
  // 'animation_0'
@@ -57,6 +57,13 @@ async function main(engine) {
57
57
  // make_sample('data/models/samples/animatedbox1.gltf', [
58
58
  // 'All Animations'
59
59
  // ], engine.entityManager.dataset);
60
+
61
+ // make_sample('moicon/Separated_Cardboard-Box-800x600x400_Roughness0/V1 Cardboard B.gltf', [
62
+ // 'All Animations'
63
+ // ], engine.entityManager.dataset);
64
+ make_sample('moicon/v26/v26.gltf', [
65
+ 'All Animations'
66
+ ], engine.entityManager.dataset);
60
67
  }
61
68
 
62
69
  /**
@@ -193,7 +193,7 @@ class Entity {
193
193
  const component = this.getComponent(klass);
194
194
 
195
195
  if (component === null) {
196
- throw new Error(`Component of given class not found`);
196
+ throw new Error(`Component of given class '${computeComponentClassName(klass)}' not found`);
197
197
  }
198
198
 
199
199
  return component;
@@ -1868,20 +1868,6 @@ function stringifyComponent(c) {
1868
1868
  }
1869
1869
  }
1870
1870
 
1871
- function computeComponentClassName(klass) {
1872
- if (klass === undefined) {
1873
- return "undefined";
1874
- } else if (klass === null) {
1875
- return "null";
1876
- } else if (typeof klass.type === "string") {
1877
- return klass.type;
1878
- } else if (typeof klass === "function") {
1879
- return klass.name;
1880
- } else {
1881
- return "$UNKNOWN"
1882
- }
1883
- }
1884
-
1885
1871
 
1886
1872
  /**
1887
1873
  *
@@ -0,0 +1,2 @@
1
+ declare function computeComponentClassName(klass: any): any;
2
+ //# sourceMappingURL=computeComponentClassName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeComponentClassName.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/computeComponentClassName.js"],"names":[],"mappings":"AAAA,4DAYC"}
@@ -0,0 +1,13 @@
1
+ function computeComponentClassName(klass) {
2
+ if (klass === undefined) {
3
+ return "undefined";
4
+ } else if (klass === null) {
5
+ return "null";
6
+ } else if (typeof klass.type === "string") {
7
+ return klass.type;
8
+ } else if (typeof klass === "function") {
9
+ return klass.name;
10
+ } else {
11
+ return "$UNKNOWN"
12
+ }
13
+ }
@@ -11,6 +11,7 @@ export class LightBinding {
11
11
  * @protected
12
12
  */
13
13
  protected __c_light: Light;
14
+ get scaled_distance(): number;
14
15
  set component_transform(arg: any);
15
16
  set component_light(arg: any);
16
17
  /**
@@ -30,6 +31,7 @@ export class LightBinding {
30
31
  unlink(ctx: LightContext): void;
31
32
  __apply_position(): void;
32
33
  __apply_rotation(): void;
34
+ __apply_scale(): void;
33
35
  __apply_intensity(): void;
34
36
  __apply_color(): void;
35
37
  __apply_distance(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"LightBinding.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/light/binding/LightBinding.js"],"names":[],"mappings":"AAEA;IAEQ;;;;OAIG;IACH,mCAAyB;IACzB;;;;OAIG;IACH,2BAAqB;IAGzB,kCAEC;IAED,8BAEC;IAED;;;OAGG;IACH,mCAEC;IAED;;;OAGG;IACH,8BA8BC;IAED;;;OAGG;IACH,gCAUC;IAED,yBAEC;IAED,yBAEC;IAED,0BAEC;IAED,sBAEC;IAED,yBAEC;IAED,sBAEC;IAED,yBAEC;IAED,2BAEC;CACJ"}
1
+ {"version":3,"file":"LightBinding.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/light/binding/LightBinding.js"],"names":[],"mappings":"AAGA;IAEQ;;;;OAIG;IACH,mCAAyB;IACzB;;;;OAIG;IACH,2BAAqB;IAGzB,8BAMC;IAED,kCAEC;IAED,8BAEC;IAED;;;OAGG;IACH,mCAEC;IAED;;;OAGG;IACH,8BAgCC;IAED;;;OAGG;IACH,gCAWC;IAED,yBAEC;IAED,yBAEC;IAED,sBAEC;IAED,0BAEC;IAED,sBAEC;IAED,yBAEC;IAED,sBAEC;IAED,yBAEC;IAED,2BAEC;CACJ"}
@@ -1,3 +1,4 @@
1
+ import { max3 } from "../../../../../core/math/max3.js";
1
2
  import { LightType } from "../LightType.js";
2
3
 
3
4
  export class LightBinding {
@@ -16,6 +17,14 @@ export class LightBinding {
16
17
  this.__c_light = null;
17
18
  }
18
19
 
20
+ get scaled_distance() {
21
+ const scale = this.__c_transform.scale;
22
+ const scale_magnitude = max3(scale.x, scale.y, scale.z);
23
+ const light_radius = this.__c_light.distance.getValue();
24
+
25
+ return light_radius * scale_magnitude;
26
+ }
27
+
19
28
  set component_transform(v) {
20
29
  this.__c_transform = v;
21
30
  }
@@ -39,6 +48,7 @@ export class LightBinding {
39
48
  link(ctx) {
40
49
  this.__c_transform.position.onChanged.add(this.__apply_position, this);
41
50
  this.__c_transform.rotation.onChanged.add(this.__apply_rotation, this);
51
+ this.__c_transform.rotation.onChanged.add(this.__apply_scale, this);
42
52
 
43
53
  const l = this.__c_light;
44
54
 
@@ -64,6 +74,7 @@ export class LightBinding {
64
74
 
65
75
  this.__apply_position();
66
76
  this.__apply_rotation();
77
+ this.__apply_scale();
67
78
 
68
79
  this.applySettings(ctx.system.settings);
69
80
  }
@@ -75,6 +86,7 @@ export class LightBinding {
75
86
  unlink(ctx) {
76
87
  this.__c_transform.position.onChanged.remove(this.__apply_position, this);
77
88
  this.__c_transform.rotation.onChanged.remove(this.__apply_rotation, this);
89
+ this.__c_transform.rotation.onChanged.remove(this.__apply_scale, this);
78
90
 
79
91
  this.__c_light.intensity.onChanged.remove(this.__apply_intensity, this);
80
92
  this.__c_light.color.onChanged.remove(this.__apply_color, this);
@@ -92,6 +104,10 @@ export class LightBinding {
92
104
 
93
105
  }
94
106
 
107
+ __apply_scale(){
108
+
109
+ }
110
+
95
111
  __apply_intensity() {
96
112
 
97
113
  }