@woosh/meep-engine 2.93.3 → 2.94.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 +336 -269
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +336 -269
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/BVH.js +4 -2
- package/src/core/bvh2/bvh3/build_triangle_morton_codes.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +2 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +12 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +11 -1
- package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.d.ts +14 -0
- package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/ebvh_geometry_query_nearest_triangle_ray.js +146 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts +16 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js +90 -0
- package/src/core/collection/heap/Uint32Heap.d.ts.map +1 -1
- package/src/core/collection/heap/Uint32Heap.js +22 -17
- package/src/core/color/Color.d.ts.map +1 -1
- package/src/core/color/Color.js +17 -7
- package/src/core/geom/2d/bvh/BVH2D.d.ts.map +1 -1
- package/src/core/geom/2d/bvh/BVH2D.js +24 -29
- package/src/core/geom/2d/bvh/BVH2D.spec.js +10 -9
- package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.d.ts +2 -0
- package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.d.ts.map +1 -0
- package/src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.js +89 -0
- package/src/core/geom/2d/quad-tree/QuadTreeNode.spec.js +1 -1
- package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +8 -1
- package/src/core/geom/3d/aabb/aabb3_array_combine.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_array_combine.js +5 -0
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js +2 -0
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricEdge.js +9 -1
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.d.ts +16 -0
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.js +55 -0
- package/src/core/math/build_gaussian_kernel_1d.d.ts +8 -0
- package/src/core/math/build_gaussian_kernel_1d.d.ts.map +1 -0
- package/src/core/math/build_gaussian_kernel_1d.js +26 -0
- package/src/core/math/build_gaussian_kernel_2d.d.ts +10 -0
- package/src/core/math/build_gaussian_kernel_2d.d.ts.map +1 -0
- package/src/core/math/build_gaussian_kernel_2d.js +55 -0
- package/src/core/math/nextOdd.d.ts +8 -0
- package/src/core/math/nextOdd.d.ts.map +1 -0
- package/src/core/math/nextOdd.js +15 -0
- package/src/core/math/nextOdd.spec.d.ts +2 -0
- package/src/core/math/nextOdd.spec.d.ts.map +1 -0
- package/src/core/math/nextOdd.spec.js +9 -0
- package/src/engine/animation/curve/prototypeGLTF.js +4 -1
- package/src/engine/graphics/ecs/light/binding/LightBinding.d.ts +2 -0
- package/src/engine/graphics/ecs/light/binding/LightBinding.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/binding/LightBinding.js +16 -0
- package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.d.ts +13 -2
- package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/binding/fp/FPLightBinding.js +37 -4
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +12 -8
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts +0 -9
- package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +100 -129
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +6 -4
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +11 -4
- package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts +2 -2
- package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js +2 -2
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +6 -4
- package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.js +1 -2
- package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.d.ts +2 -2
- package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js +3 -3
- package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/filter/sampler2d_blur_gaussian.js +5 -31
- package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.d.ts +3 -6
- package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureMaterial.js +8 -27
- package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.d.ts +4 -0
- package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureMemoryMapping.js +12 -0
- package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts +29 -0
- package/src/engine/graphics/texture/virtual/VirtualTextureSystem.d.ts.map +1 -0
- package/src/engine/graphics/texture/virtual/VirtualTextureSystem.js +102 -0
- package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js +1 -1
- package/src/engine/graphics/texture/virtual/prototype.js +221 -79
- package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
- package/src/engine/navigation/grid/find_path_on_grid_astar.js +18 -19
- package/src/engine/navigation/grid/find_path_on_grid_astar.spec.js +2 -2
- package/src/engine/ui/GUIEngine.js +1 -1
- package/src/generation/filtering/numeric/CellFilterCache.d.ts.map +1 -1
- package/src/generation/filtering/numeric/CellFilterCache.js +7 -7
- package/src/generation/filtering/numeric/complex/CellFilterFXAA.d.ts.map +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterFXAA.js +9 -6
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.d.ts +1 -13
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.d.ts.map +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +39 -111
- package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts.map +1 -1
- package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +6 -5
- package/src/generation/grid/generation/util/buildDistanceMapToObjective.d.ts +1 -1
- package/src/generation/grid/generation/util/buildDistanceMapToObjective.d.ts.map +1 -1
- package/src/generation/grid/generation/util/buildDistanceMapToObjective.js +5 -12
- package/src/core/math/makeNextOdd.d.ts +0 -8
- package/src/core/math/makeNextOdd.d.ts.map +0 -1
- package/src/core/math/makeNextOdd.js +0 -15
|
@@ -4,6 +4,7 @@ import { array_copy } from "../../../collection/array/array_copy.js";
|
|
|
4
4
|
import { typed_array_copy } from "../../../collection/array/typed/typed_array_copy.js";
|
|
5
5
|
import { max2 } from "../../../math/max2.js";
|
|
6
6
|
import { min2 } from "../../../math/min2.js";
|
|
7
|
+
import { aabb2_array_combine } from "../aabb/aabb2_array_combine.js";
|
|
7
8
|
import { aabb2_compute_area } from "../aabb/aabb2_compute_area.js";
|
|
8
9
|
|
|
9
10
|
|
|
@@ -536,31 +537,16 @@ export class BVH2D {
|
|
|
536
537
|
const address_a = ELEMENT_WORD_COUNT * index_a;
|
|
537
538
|
const address_b = ELEMENT_WORD_COUNT * index_b;
|
|
538
539
|
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
const a_x0 = float32[address_a];
|
|
542
|
-
const b_x0 = float32[address_b];
|
|
543
|
-
const x0 = min2(a_x0, b_x0);
|
|
544
|
-
|
|
545
|
-
const a_y0 = float32[address_a + 1];
|
|
546
|
-
const b_y0 = float32[address_b + 1];
|
|
547
|
-
const y0 = min2(a_y0, b_y0);
|
|
540
|
+
const address_destination = ELEMENT_WORD_COUNT * destination;
|
|
548
541
|
|
|
549
|
-
const
|
|
550
|
-
const b_x1 = float32[address_b + 2];
|
|
551
|
-
const x1 = max2(a_x1, b_x1);
|
|
552
|
-
|
|
553
|
-
const a_y1 = float32[address_a + 3];
|
|
554
|
-
const b_y1 = float32[address_b + 3];
|
|
555
|
-
const y1 = max2(a_y1, b_y1);
|
|
556
|
-
|
|
557
|
-
const address_destination = destination * ELEMENT_WORD_COUNT;
|
|
542
|
+
const float32 = this.__data_float32;
|
|
558
543
|
|
|
559
|
-
|
|
560
|
-
|
|
544
|
+
aabb2_array_combine(
|
|
545
|
+
float32,address_destination,
|
|
546
|
+
float32,address_a,
|
|
547
|
+
float32,address_b
|
|
548
|
+
);
|
|
561
549
|
|
|
562
|
-
float32[address_destination + 2] = x1;
|
|
563
|
-
float32[address_destination + 3] = y1;
|
|
564
550
|
}
|
|
565
551
|
|
|
566
552
|
/**
|
|
@@ -586,10 +572,16 @@ export class BVH2D {
|
|
|
586
572
|
// Find the best sibling for this node
|
|
587
573
|
let index = this.__root;
|
|
588
574
|
|
|
589
|
-
while (
|
|
575
|
+
while (true) {
|
|
590
576
|
const node_address = index * ELEMENT_WORD_COUNT;
|
|
591
577
|
|
|
592
578
|
const child1 = uint32[node_address + COLUMN_CHILD_1];
|
|
579
|
+
|
|
580
|
+
if(child1 === NULL_NODE){
|
|
581
|
+
// it's a leaf node
|
|
582
|
+
break;
|
|
583
|
+
}
|
|
584
|
+
|
|
593
585
|
const child2 = uint32[node_address + COLUMN_CHILD_2];
|
|
594
586
|
|
|
595
587
|
const area = this.node_get_surface_area(index);
|
|
@@ -803,20 +795,23 @@ export class BVH2D {
|
|
|
803
795
|
//b2TreeNode* A = m_nodes + iA;
|
|
804
796
|
const uint32 = this.__data_uint32;
|
|
805
797
|
|
|
806
|
-
|
|
798
|
+
const iB = uint32[iA * ELEMENT_WORD_COUNT + COLUMN_CHILD_1];
|
|
799
|
+
|
|
800
|
+
const is_leaf_node = iB === NULL_NODE;
|
|
801
|
+
|
|
802
|
+
if (is_leaf_node || uint32[iA * ELEMENT_WORD_COUNT + COLUMN_HEIGHT] < 2) {
|
|
807
803
|
return iA;
|
|
808
804
|
}
|
|
809
805
|
|
|
810
|
-
const iB = uint32[iA * ELEMENT_WORD_COUNT + COLUMN_CHILD_1];
|
|
811
806
|
const iC = uint32[iA * ELEMENT_WORD_COUNT + COLUMN_CHILD_2];
|
|
812
807
|
|
|
813
808
|
assert.notEqual(iA, iB, 'child1 equal to parent');
|
|
814
809
|
assert.notEqual(iA, iB, 'child2 equal to parent');
|
|
815
810
|
|
|
816
811
|
assert.greaterThanOrEqual(iB, 0);
|
|
817
|
-
assert.lessThan(iB, this.
|
|
812
|
+
assert.lessThan(iB, this.__capacity);
|
|
818
813
|
assert.greaterThanOrEqual(iC, 0);
|
|
819
|
-
assert.lessThan(iC, this.
|
|
814
|
+
assert.lessThan(iC, this.__capacity);
|
|
820
815
|
|
|
821
816
|
//b2TreeNode* B = m_nodes + iB;
|
|
822
817
|
//b2TreeNode* C = m_nodes + iC;
|
|
@@ -835,9 +830,9 @@ export class BVH2D {
|
|
|
835
830
|
// b2TreeNode* G = m_nodes + iG;
|
|
836
831
|
|
|
837
832
|
assert.greaterThanOrEqual(iF, 0);
|
|
838
|
-
assert.lessThan(iF, this.
|
|
833
|
+
assert.lessThan(iF, this.__capacity);
|
|
839
834
|
assert.greaterThanOrEqual(iG, 0);
|
|
840
|
-
assert.lessThan(iG, this.
|
|
835
|
+
assert.lessThan(iG, this.__capacity);
|
|
841
836
|
|
|
842
837
|
// Swap A and C
|
|
843
838
|
uint32[iC * ELEMENT_WORD_COUNT + COLUMN_CHILD_1] = iA;
|
|
@@ -305,16 +305,16 @@ test("move leaf node", () => {
|
|
|
305
305
|
expect(actual_bounds).toEqual(a_new_bounds);
|
|
306
306
|
});
|
|
307
307
|
|
|
308
|
-
test.skip("performance, insert
|
|
308
|
+
test.skip("performance, insert 1m random nodes", () => {
|
|
309
309
|
|
|
310
310
|
const random = seededRandom(1);
|
|
311
311
|
|
|
312
312
|
const bvh = new BVH2D();
|
|
313
313
|
|
|
314
|
-
const min_bound =
|
|
315
|
-
const max_bound =
|
|
314
|
+
const min_bound = 1;
|
|
315
|
+
const max_bound = 99;
|
|
316
316
|
|
|
317
|
-
const OBJECT_COUNT =
|
|
317
|
+
const OBJECT_COUNT = 1000000;
|
|
318
318
|
|
|
319
319
|
const leaves = new Uint32Array(OBJECT_COUNT);
|
|
320
320
|
for (let i = 0; i < OBJECT_COUNT; i++) {
|
|
@@ -325,13 +325,14 @@ test.skip("performance, insert 100k random nodes", () => {
|
|
|
325
325
|
const x = randomFloatBetween(random, min_bound, max_bound);
|
|
326
326
|
const y = randomFloatBetween(random, min_bound, max_bound);
|
|
327
327
|
|
|
328
|
-
const
|
|
328
|
+
const extents_x = randomFloatBetween(random, 0.05, 1);
|
|
329
|
+
const extents_y = randomFloatBetween(random, 0.05, 1);
|
|
329
330
|
|
|
330
|
-
const x0 = x -
|
|
331
|
-
const y0 = y -
|
|
331
|
+
const x0 = x - extents_x;
|
|
332
|
+
const y0 = y - extents_y;
|
|
332
333
|
|
|
333
|
-
const x1 = x +
|
|
334
|
-
const y1 = y +
|
|
334
|
+
const x1 = x + extents_x;
|
|
335
|
+
const y1 = y + extents_y;
|
|
335
336
|
|
|
336
337
|
// console.log([x0, y0, z0, x1, y1, z1].join(', '))
|
|
337
338
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bvh2d_query_all_data_by_circle.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/bvh/bvh2d_query_all_data_by_circle.spec.js"],"names":[],"mappings":""}
|
|
@@ -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;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,CA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AYnB;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;
|
|
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;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,iBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,YAFW,KAAK,QAIf;IAED;;;;;;;;OAQG;IACH,wFAsCC;IAED;;;;OAIG;IACH,cAHW,KAAK,GACH,OAAO,CAInB;IAED;;;;;;;;;OASG;IACH,iFAFa,OAAO,CASnB;IAED;;;;;;;;OAQG;IACH,iGA6BC;IAED,oCAEC;IAED,0BAEC;IAED;;;;;OAKG;IACH,cAJW,MAAM,KACN,MAAM,KACN,MAAM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C;IAED;;;;OAIG;IACH,kCAFa,OAAO,CAMnB;IAED;;;;OAIG;IACH,oDAmBC;IAED;;;OAGG;IACH,mBAFW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,QAa5C;IAED;;;;OAIG;IACH,qBAHW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,WAClC,MAAM,QAYhB;IAED;;;;OAIG;IACH,sBAHW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,WAClC,MAAM,QAchB;IAED;;;OAGG;IACH,wBAHW,MAAM,KAAK,OAWrB;IAED;;;;;;;OAOG;IACH,oCANW,MAAM,YACN,MAAM,YACN,MAAM,UACN,MAAM,GACJ,MAAM,CAQlB;IAED;;;;;;;OAOG;IACH,wBANW,MAAM,YACN,MAAM,YACN,MAAM,UACN,MAAM,GACJ,OAAO,CAInB;IAED;;;;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;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,
|
|
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
|
|
|
@@ -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,
|
|
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(
|
|
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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"nextOdd.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/math/nextOdd.spec.js"],"names":[],"mappings":""}
|
|
@@ -58,7 +58,10 @@ async function main(engine) {
|
|
|
58
58
|
// 'All Animations'
|
|
59
59
|
// ], engine.entityManager.dataset);
|
|
60
60
|
|
|
61
|
-
make_sample('moicon/Separated_Cardboard-Box-800x600x400_Roughness0/V1 Cardboard B.gltf', [
|
|
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', [
|
|
62
65
|
'All Animations'
|
|
63
66
|
], engine.entityManager.dataset);
|
|
64
67
|
}
|
|
@@ -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":"
|
|
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"}
|