@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
package/build/meep.cjs
CHANGED
|
@@ -49005,13 +49005,6 @@ function typedArrayToDataType(v) {
|
|
|
49005
49005
|
}
|
|
49006
49006
|
}
|
|
49007
49007
|
|
|
49008
|
-
/**
|
|
49009
|
-
*
|
|
49010
|
-
* Produces a proportional mix of 2 values, a*(1-portion) + b*portion
|
|
49011
|
-
* Same as lerp
|
|
49012
|
-
*/
|
|
49013
|
-
const mix = lerp$1;
|
|
49014
|
-
|
|
49015
49008
|
/**
|
|
49016
49009
|
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
49017
49010
|
* @param {number} t ratio
|
|
@@ -49301,6 +49294,7 @@ class Sampler2D {
|
|
|
49301
49294
|
}
|
|
49302
49295
|
|
|
49303
49296
|
/**
|
|
49297
|
+
* TODO there is an oversaturation bug in here somewhere, prefer to use linear sampling for now instead
|
|
49304
49298
|
* Bicubic-filtered sampling
|
|
49305
49299
|
* @param {number} x
|
|
49306
49300
|
* @param {number} y
|
|
@@ -49489,6 +49483,7 @@ class Sampler2D {
|
|
|
49489
49483
|
const q0 = data[i0];
|
|
49490
49484
|
|
|
49491
49485
|
if (x0 === x1 && y0 === y1) {
|
|
49486
|
+
// exactly sampled in the center of the pixel, no interpolation required
|
|
49492
49487
|
return q0;
|
|
49493
49488
|
}
|
|
49494
49489
|
|
|
@@ -49510,10 +49505,10 @@ class Sampler2D {
|
|
|
49510
49505
|
const p1 = data[j1];
|
|
49511
49506
|
|
|
49512
49507
|
// perform Bi-Linear interpolation
|
|
49513
|
-
const s0 =
|
|
49514
|
-
const s1 =
|
|
49508
|
+
const s0 = lerp$1(q0, q1, xd);
|
|
49509
|
+
const s1 = lerp$1(p0, p1, xd);
|
|
49515
49510
|
|
|
49516
|
-
return
|
|
49511
|
+
return lerp$1(s0, s1, yd);
|
|
49517
49512
|
}
|
|
49518
49513
|
|
|
49519
49514
|
/**
|
|
@@ -52551,8 +52546,10 @@ class BVH {
|
|
|
52551
52546
|
* @param {number} index_b
|
|
52552
52547
|
*/
|
|
52553
52548
|
node_set_combined_aabb(destination, index_a, index_b) {
|
|
52549
|
+
|
|
52554
52550
|
const address_a = ELEMENT_WORD_COUNT * index_a;
|
|
52555
52551
|
const address_b = ELEMENT_WORD_COUNT * index_b;
|
|
52552
|
+
const address_destination = ELEMENT_WORD_COUNT * destination;
|
|
52556
52553
|
|
|
52557
52554
|
const float32 = this.__data_float32;
|
|
52558
52555
|
|
|
@@ -52580,7 +52577,6 @@ class BVH {
|
|
|
52580
52577
|
const b_z1 = float32[address_b + 5];
|
|
52581
52578
|
const z1 = max2(a_z1, b_z1);
|
|
52582
52579
|
|
|
52583
|
-
const address_destination = destination * ELEMENT_WORD_COUNT;
|
|
52584
52580
|
|
|
52585
52581
|
float32[address_destination] = x0;
|
|
52586
52582
|
float32[address_destination + 1] = y0;
|
|
@@ -53323,6 +53319,95 @@ function clamp01(value) {
|
|
|
53323
53319
|
}
|
|
53324
53320
|
}
|
|
53325
53321
|
|
|
53322
|
+
/**
|
|
53323
|
+
* Returns lowest value out of 3 supplied
|
|
53324
|
+
* @param {number} a
|
|
53325
|
+
* @param {number} b
|
|
53326
|
+
* @param {number} c
|
|
53327
|
+
* @returns {number}
|
|
53328
|
+
*/
|
|
53329
|
+
function min3(a, b, c) {
|
|
53330
|
+
|
|
53331
|
+
let v = a;
|
|
53332
|
+
if (v > b) {
|
|
53333
|
+
v = b;
|
|
53334
|
+
}
|
|
53335
|
+
if (v > c) {
|
|
53336
|
+
v = c;
|
|
53337
|
+
}
|
|
53338
|
+
return v;
|
|
53339
|
+
}
|
|
53340
|
+
|
|
53341
|
+
/**
|
|
53342
|
+
* Convert a decimal value to hex
|
|
53343
|
+
* @param {number} c generally expects b byte value, 0-255
|
|
53344
|
+
* @returns {string} zero-padded value, for example instead of "0", will return "00" and instead of "F" will return "0F"
|
|
53345
|
+
*/
|
|
53346
|
+
function dec2hex(c) {
|
|
53347
|
+
const hex = Math.round(c).toString(16);
|
|
53348
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
53349
|
+
}
|
|
53350
|
+
|
|
53351
|
+
/**
|
|
53352
|
+
* Takes values in 0..255 range
|
|
53353
|
+
* @param {number} r
|
|
53354
|
+
* @param {number} g
|
|
53355
|
+
* @param {number} b
|
|
53356
|
+
* @returns {string}
|
|
53357
|
+
*/
|
|
53358
|
+
function rgb2hex(r, g, b) {
|
|
53359
|
+
|
|
53360
|
+
return dec2hex(r) + dec2hex(g) + dec2hex(b);
|
|
53361
|
+
}
|
|
53362
|
+
|
|
53363
|
+
/**
|
|
53364
|
+
*
|
|
53365
|
+
* @param {number} r 0 to 255
|
|
53366
|
+
* @param {number} g 0 to 255
|
|
53367
|
+
* @param {number} b 0 to 255
|
|
53368
|
+
* @returns {{h: number, s: number, v: number}}
|
|
53369
|
+
*/
|
|
53370
|
+
function rgb2hsv(r, g, b) {
|
|
53371
|
+
|
|
53372
|
+
const _r = uint82float(r);
|
|
53373
|
+
const _g = uint82float(g);
|
|
53374
|
+
const _b = uint82float(b);
|
|
53375
|
+
|
|
53376
|
+
|
|
53377
|
+
const max = Math.max(_r, _g, _b);
|
|
53378
|
+
const min = Math.min(_r, _g, _b);
|
|
53379
|
+
|
|
53380
|
+
let h, s, v = max;
|
|
53381
|
+
|
|
53382
|
+
const d = max - min;
|
|
53383
|
+
|
|
53384
|
+
s = max === 0 ? 0 : d / max;
|
|
53385
|
+
|
|
53386
|
+
if (max === min) {
|
|
53387
|
+
h = 0; // achromatic
|
|
53388
|
+
} else {
|
|
53389
|
+
switch (max) {
|
|
53390
|
+
case _r:
|
|
53391
|
+
h = (_g - _b) / d + (_g < _b ? 6 : 0);
|
|
53392
|
+
break;
|
|
53393
|
+
case _g:
|
|
53394
|
+
h = (_b - _r) / d + 2;
|
|
53395
|
+
break;
|
|
53396
|
+
case _b:
|
|
53397
|
+
h = (_r - _g) / d + 4;
|
|
53398
|
+
break;
|
|
53399
|
+
}
|
|
53400
|
+
|
|
53401
|
+
h /= 6;
|
|
53402
|
+
}
|
|
53403
|
+
|
|
53404
|
+
return {
|
|
53405
|
+
h,
|
|
53406
|
+
s,
|
|
53407
|
+
v
|
|
53408
|
+
};
|
|
53409
|
+
}
|
|
53410
|
+
|
|
53326
53411
|
/**
|
|
53327
53412
|
*
|
|
53328
53413
|
* @param {number} h from 0 to 1
|
|
@@ -53497,73 +53582,6 @@ function parse_color(c) {
|
|
|
53497
53582
|
return result;
|
|
53498
53583
|
}
|
|
53499
53584
|
|
|
53500
|
-
/**
|
|
53501
|
-
* Returns lowest value out of 3 supplied
|
|
53502
|
-
* @param {number} a
|
|
53503
|
-
* @param {number} b
|
|
53504
|
-
* @param {number} c
|
|
53505
|
-
* @returns {number}
|
|
53506
|
-
*/
|
|
53507
|
-
function min3(a, b, c) {
|
|
53508
|
-
|
|
53509
|
-
let v = a;
|
|
53510
|
-
if (v > b) {
|
|
53511
|
-
v = b;
|
|
53512
|
-
}
|
|
53513
|
-
if (v > c) {
|
|
53514
|
-
v = c;
|
|
53515
|
-
}
|
|
53516
|
-
return v;
|
|
53517
|
-
}
|
|
53518
|
-
|
|
53519
|
-
/**
|
|
53520
|
-
*
|
|
53521
|
-
* @param {number} r 0 to 255
|
|
53522
|
-
* @param {number} g 0 to 255
|
|
53523
|
-
* @param {number} b 0 to 255
|
|
53524
|
-
* @returns {{h: number, s: number, v: number}}
|
|
53525
|
-
*/
|
|
53526
|
-
function rgb2hsv(r, g, b) {
|
|
53527
|
-
|
|
53528
|
-
const _r = uint82float(r);
|
|
53529
|
-
const _g = uint82float(g);
|
|
53530
|
-
const _b = uint82float(b);
|
|
53531
|
-
|
|
53532
|
-
|
|
53533
|
-
const max = Math.max(_r, _g, _b);
|
|
53534
|
-
const min = Math.min(_r, _g, _b);
|
|
53535
|
-
|
|
53536
|
-
let h, s, v = max;
|
|
53537
|
-
|
|
53538
|
-
const d = max - min;
|
|
53539
|
-
|
|
53540
|
-
s = max === 0 ? 0 : d / max;
|
|
53541
|
-
|
|
53542
|
-
if (max === min) {
|
|
53543
|
-
h = 0; // achromatic
|
|
53544
|
-
} else {
|
|
53545
|
-
switch (max) {
|
|
53546
|
-
case _r:
|
|
53547
|
-
h = (_g - _b) / d + (_g < _b ? 6 : 0);
|
|
53548
|
-
break;
|
|
53549
|
-
case _g:
|
|
53550
|
-
h = (_b - _r) / d + 2;
|
|
53551
|
-
break;
|
|
53552
|
-
case _b:
|
|
53553
|
-
h = (_r - _g) / d + 4;
|
|
53554
|
-
break;
|
|
53555
|
-
}
|
|
53556
|
-
|
|
53557
|
-
h /= 6;
|
|
53558
|
-
}
|
|
53559
|
-
|
|
53560
|
-
return {
|
|
53561
|
-
h,
|
|
53562
|
-
s,
|
|
53563
|
-
v
|
|
53564
|
-
};
|
|
53565
|
-
}
|
|
53566
|
-
|
|
53567
53585
|
/**
|
|
53568
53586
|
*
|
|
53569
53587
|
* @param {number} r in 0..1 range
|
|
@@ -53582,28 +53600,6 @@ function rgb2uint24(r, g, b) {
|
|
|
53582
53600
|
;
|
|
53583
53601
|
}
|
|
53584
53602
|
|
|
53585
|
-
/**
|
|
53586
|
-
* Convert a decimal value to hex
|
|
53587
|
-
* @param {number} c generally expects b byte value, 0-255
|
|
53588
|
-
* @returns {string} zero-padded value, for example instead of "0", will return "00" and instead of "F" will return "0F"
|
|
53589
|
-
*/
|
|
53590
|
-
function dec2hex(c) {
|
|
53591
|
-
const hex = Math.round(c).toString(16);
|
|
53592
|
-
return hex.length === 1 ? "0" + hex : hex;
|
|
53593
|
-
}
|
|
53594
|
-
|
|
53595
|
-
/**
|
|
53596
|
-
* Takes values in 0..255 range
|
|
53597
|
-
* @param {number} r
|
|
53598
|
-
* @param {number} g
|
|
53599
|
-
* @param {number} b
|
|
53600
|
-
* @returns {string}
|
|
53601
|
-
*/
|
|
53602
|
-
function rgb2hex(r, g, b) {
|
|
53603
|
-
|
|
53604
|
-
return dec2hex(r) + dec2hex(g) + dec2hex(b);
|
|
53605
|
-
}
|
|
53606
|
-
|
|
53607
53603
|
function convert(c) {
|
|
53608
53604
|
return (c < 0.0031308) ? c * 12.92 : 1.055 * (Math.pow(c, 0.41666)) - 0.055;
|
|
53609
53605
|
}
|
|
@@ -53652,7 +53648,7 @@ class Color {
|
|
|
53652
53648
|
* @param {number} r value from 0 to 1
|
|
53653
53649
|
* @param {number} g value from 0 to 1
|
|
53654
53650
|
* @param {number} b value from 0 to 1
|
|
53655
|
-
* @param {number} [a] value from 0 to 1
|
|
53651
|
+
* @param {number} [a] value from 0 to 1 Alpha channel (transparency)
|
|
53656
53652
|
*/
|
|
53657
53653
|
constructor(r = 0, g = 0, b = 0, a = 1) {
|
|
53658
53654
|
/**
|
|
@@ -53752,6 +53748,14 @@ class Color {
|
|
|
53752
53748
|
this.a = v;
|
|
53753
53749
|
}
|
|
53754
53750
|
|
|
53751
|
+
/**
|
|
53752
|
+
* Pretending to be an array
|
|
53753
|
+
* @return {number}
|
|
53754
|
+
*/
|
|
53755
|
+
get length() {
|
|
53756
|
+
return 4;
|
|
53757
|
+
}
|
|
53758
|
+
|
|
53755
53759
|
/**
|
|
53756
53760
|
*
|
|
53757
53761
|
* @param {number} r
|
|
@@ -54021,6 +54025,7 @@ class Color {
|
|
|
54021
54025
|
* @param {number} value
|
|
54022
54026
|
*/
|
|
54023
54027
|
fromUint(value) {
|
|
54028
|
+
|
|
54024
54029
|
const r = value >> 16;
|
|
54025
54030
|
const g = (value >> 8) & 0xFF;
|
|
54026
54031
|
const b = (value) & 0xFF;
|
|
@@ -56345,7 +56350,7 @@ class AABB3 {
|
|
|
56345
56350
|
* @param {number} y
|
|
56346
56351
|
* @param {number} z
|
|
56347
56352
|
*/
|
|
56348
|
-
_translate(x,y,z){
|
|
56353
|
+
_translate(x, y, z) {
|
|
56349
56354
|
this.setBounds(
|
|
56350
56355
|
this.x0 + x, this.y0 + y, this.z0 + z,
|
|
56351
56356
|
this.x1 + x, this.y1 + y, this.z1 + z
|
|
@@ -56958,7 +56963,14 @@ class AABB3 {
|
|
|
56958
56963
|
* @readonly
|
|
56959
56964
|
* @type {boolean}
|
|
56960
56965
|
*/
|
|
56961
|
-
AABB3.prototype.isAABB3 = true;
|
|
56966
|
+
AABB3.prototype.isAABB3 = true;
|
|
56967
|
+
|
|
56968
|
+
/**
|
|
56969
|
+
* Pretending to be an array
|
|
56970
|
+
* @readonly
|
|
56971
|
+
* @type {number}
|
|
56972
|
+
*/
|
|
56973
|
+
AABB3.prototype.length = 6;
|
|
56962
56974
|
|
|
56963
56975
|
/**
|
|
56964
56976
|
*
|
|
@@ -102832,7 +102844,7 @@ class GUIEngine {
|
|
|
102832
102844
|
|
|
102833
102845
|
constructor() {
|
|
102834
102846
|
|
|
102835
|
-
this.ticker.
|
|
102847
|
+
this.ticker.onTick.add(d => {
|
|
102836
102848
|
|
|
102837
102849
|
|
|
102838
102850
|
let ctx = null;
|
|
@@ -111133,6 +111145,101 @@ class SystemEntityContext {
|
|
|
111133
111145
|
}
|
|
111134
111146
|
}
|
|
111135
111147
|
|
|
111148
|
+
class PointLight extends AbstractLight {
|
|
111149
|
+
constructor() {
|
|
111150
|
+
super();
|
|
111151
|
+
|
|
111152
|
+
/**
|
|
111153
|
+
* @readonly
|
|
111154
|
+
* @type {Vector3}
|
|
111155
|
+
*/
|
|
111156
|
+
this.position = new Vector3$1();
|
|
111157
|
+
|
|
111158
|
+
/**
|
|
111159
|
+
*
|
|
111160
|
+
* @type {Vector1}
|
|
111161
|
+
*/
|
|
111162
|
+
this.radius = new Vector1(1);
|
|
111163
|
+
|
|
111164
|
+
/**
|
|
111165
|
+
* @readonly
|
|
111166
|
+
* @type {Color}
|
|
111167
|
+
*/
|
|
111168
|
+
this.color = new Color(1, 1, 1);
|
|
111169
|
+
|
|
111170
|
+
/**
|
|
111171
|
+
*
|
|
111172
|
+
* @type {Vector1}
|
|
111173
|
+
*/
|
|
111174
|
+
this.intensity = new Vector1(1);
|
|
111175
|
+
}
|
|
111176
|
+
|
|
111177
|
+
getCenter(result) {
|
|
111178
|
+
this.position.writeToArray(result, 0);
|
|
111179
|
+
}
|
|
111180
|
+
|
|
111181
|
+
getAABB(result) {
|
|
111182
|
+
const r = this.radius.getValue();
|
|
111183
|
+
const p = this.position;
|
|
111184
|
+
|
|
111185
|
+
const center_x = p.x;
|
|
111186
|
+
const center_y = p.y;
|
|
111187
|
+
const center_z = p.z;
|
|
111188
|
+
|
|
111189
|
+
result[0] = center_x - r;
|
|
111190
|
+
result[1] = center_y - r;
|
|
111191
|
+
result[2] = center_z - r;
|
|
111192
|
+
|
|
111193
|
+
result[3] = center_x + r;
|
|
111194
|
+
result[4] = center_y + r;
|
|
111195
|
+
result[5] = center_z + r;
|
|
111196
|
+
}
|
|
111197
|
+
|
|
111198
|
+
onDimensionChanged(listener, context) {
|
|
111199
|
+
this.position.onChanged.add(listener, context);
|
|
111200
|
+
this.radius.onChanged.add(listener, context);
|
|
111201
|
+
}
|
|
111202
|
+
|
|
111203
|
+
offDimensionChanged(listener, context) {
|
|
111204
|
+
this.position.onChanged.remove(listener, context);
|
|
111205
|
+
this.radius.onChanged.remove(listener, context);
|
|
111206
|
+
}
|
|
111207
|
+
|
|
111208
|
+
/**
|
|
111209
|
+
*
|
|
111210
|
+
* @param {number[]|Float32Array|Float64Array} destination
|
|
111211
|
+
* @param {number} address
|
|
111212
|
+
* @returns {number} number of used slots
|
|
111213
|
+
*/
|
|
111214
|
+
toArray(destination, address) {
|
|
111215
|
+
const position = this.position;
|
|
111216
|
+
|
|
111217
|
+
destination[address] = position.x;
|
|
111218
|
+
destination[address + 1] = position.y;
|
|
111219
|
+
destination[address + 2] = position.z;
|
|
111220
|
+
|
|
111221
|
+
destination[address + 3] = this.radius.getValue();
|
|
111222
|
+
|
|
111223
|
+
const color = this.color;
|
|
111224
|
+
|
|
111225
|
+
destination[address + 4] = color.r;
|
|
111226
|
+
destination[address + 5] = color.g;
|
|
111227
|
+
destination[address + 6] = color.b;
|
|
111228
|
+
|
|
111229
|
+
destination[address + 7] = this.intensity.getValue();
|
|
111230
|
+
|
|
111231
|
+
return 8;
|
|
111232
|
+
}
|
|
111233
|
+
}
|
|
111234
|
+
|
|
111235
|
+
/**
|
|
111236
|
+
* @readonly
|
|
111237
|
+
* @type {boolean}
|
|
111238
|
+
*/
|
|
111239
|
+
PointLight.prototype.isPointLight = true;
|
|
111240
|
+
|
|
111241
|
+
PointLight.prototype.ENCODED_SLOT_COUNT = 8;
|
|
111242
|
+
|
|
111136
111243
|
class LightBinding {
|
|
111137
111244
|
constructor() {
|
|
111138
111245
|
/**
|
|
@@ -111149,6 +111256,14 @@ class LightBinding {
|
|
|
111149
111256
|
this.__c_light = null;
|
|
111150
111257
|
}
|
|
111151
111258
|
|
|
111259
|
+
get scaled_distance() {
|
|
111260
|
+
const scale = this.__c_transform.scale;
|
|
111261
|
+
const scale_magnitude = max3(scale.x, scale.y, scale.z);
|
|
111262
|
+
const light_radius = this.__c_light.distance.getValue();
|
|
111263
|
+
|
|
111264
|
+
return light_radius * scale_magnitude;
|
|
111265
|
+
}
|
|
111266
|
+
|
|
111152
111267
|
set component_transform(v) {
|
|
111153
111268
|
this.__c_transform = v;
|
|
111154
111269
|
}
|
|
@@ -111172,6 +111287,7 @@ class LightBinding {
|
|
|
111172
111287
|
link(ctx) {
|
|
111173
111288
|
this.__c_transform.position.onChanged.add(this.__apply_position, this);
|
|
111174
111289
|
this.__c_transform.rotation.onChanged.add(this.__apply_rotation, this);
|
|
111290
|
+
this.__c_transform.rotation.onChanged.add(this.__apply_scale, this);
|
|
111175
111291
|
|
|
111176
111292
|
const l = this.__c_light;
|
|
111177
111293
|
|
|
@@ -111197,6 +111313,7 @@ class LightBinding {
|
|
|
111197
111313
|
|
|
111198
111314
|
this.__apply_position();
|
|
111199
111315
|
this.__apply_rotation();
|
|
111316
|
+
this.__apply_scale();
|
|
111200
111317
|
|
|
111201
111318
|
this.applySettings(ctx.system.settings);
|
|
111202
111319
|
}
|
|
@@ -111208,6 +111325,7 @@ class LightBinding {
|
|
|
111208
111325
|
unlink(ctx) {
|
|
111209
111326
|
this.__c_transform.position.onChanged.remove(this.__apply_position, this);
|
|
111210
111327
|
this.__c_transform.rotation.onChanged.remove(this.__apply_rotation, this);
|
|
111328
|
+
this.__c_transform.rotation.onChanged.remove(this.__apply_scale, this);
|
|
111211
111329
|
|
|
111212
111330
|
this.__c_light.intensity.onChanged.remove(this.__apply_intensity, this);
|
|
111213
111331
|
this.__c_light.color.onChanged.remove(this.__apply_color, this);
|
|
@@ -111225,6 +111343,10 @@ class LightBinding {
|
|
|
111225
111343
|
|
|
111226
111344
|
}
|
|
111227
111345
|
|
|
111346
|
+
__apply_scale(){
|
|
111347
|
+
|
|
111348
|
+
}
|
|
111349
|
+
|
|
111228
111350
|
__apply_intensity() {
|
|
111229
111351
|
|
|
111230
111352
|
}
|
|
@@ -111250,106 +111372,22 @@ class LightBinding {
|
|
|
111250
111372
|
}
|
|
111251
111373
|
}
|
|
111252
111374
|
|
|
111253
|
-
class
|
|
111375
|
+
class FPLightBinding extends LightBinding {
|
|
111254
111376
|
constructor() {
|
|
111255
111377
|
super();
|
|
111256
111378
|
|
|
111257
|
-
/**
|
|
111258
|
-
* @readonly
|
|
111259
|
-
* @type {Vector3}
|
|
111260
|
-
*/
|
|
111261
|
-
this.position = new Vector3$1();
|
|
111262
|
-
|
|
111263
111379
|
/**
|
|
111264
111380
|
*
|
|
111265
|
-
* @type {
|
|
111266
|
-
|
|
111267
|
-
this.radius = new Vector1(1);
|
|
111268
|
-
|
|
111269
|
-
/**
|
|
111270
|
-
* @readonly
|
|
111271
|
-
* @type {Color}
|
|
111381
|
+
* @type {PointLight|null}
|
|
111382
|
+
* @private
|
|
111272
111383
|
*/
|
|
111273
|
-
this.
|
|
111384
|
+
this.__light = null;
|
|
111274
111385
|
|
|
111275
111386
|
/**
|
|
111276
111387
|
*
|
|
111277
|
-
* @type {
|
|
111388
|
+
* @type {SignalBinding[]}
|
|
111278
111389
|
*/
|
|
111279
|
-
this.
|
|
111280
|
-
}
|
|
111281
|
-
|
|
111282
|
-
getCenter(result) {
|
|
111283
|
-
this.position.writeToArray(result, 0);
|
|
111284
|
-
}
|
|
111285
|
-
|
|
111286
|
-
getAABB(result) {
|
|
111287
|
-
const r = this.radius.getValue();
|
|
111288
|
-
const p = this.position;
|
|
111289
|
-
|
|
111290
|
-
const center_x = p.x;
|
|
111291
|
-
const center_y = p.y;
|
|
111292
|
-
const center_z = p.z;
|
|
111293
|
-
|
|
111294
|
-
result[0] = center_x - r;
|
|
111295
|
-
result[1] = center_y - r;
|
|
111296
|
-
result[2] = center_z - r;
|
|
111297
|
-
|
|
111298
|
-
result[3] = center_x + r;
|
|
111299
|
-
result[4] = center_y + r;
|
|
111300
|
-
result[5] = center_z + r;
|
|
111301
|
-
}
|
|
111302
|
-
|
|
111303
|
-
onDimensionChanged(listener, context) {
|
|
111304
|
-
this.position.onChanged.add(listener, context);
|
|
111305
|
-
this.radius.onChanged.add(listener, context);
|
|
111306
|
-
}
|
|
111307
|
-
|
|
111308
|
-
offDimensionChanged(listener, context) {
|
|
111309
|
-
this.position.onChanged.remove(listener, context);
|
|
111310
|
-
this.radius.onChanged.remove(listener, context);
|
|
111311
|
-
}
|
|
111312
|
-
|
|
111313
|
-
/**
|
|
111314
|
-
*
|
|
111315
|
-
* @param {number[]|Float32Array|Float64Array} destination
|
|
111316
|
-
* @param {number} address
|
|
111317
|
-
* @returns {number} number of used slots
|
|
111318
|
-
*/
|
|
111319
|
-
toArray(destination, address) {
|
|
111320
|
-
const position = this.position;
|
|
111321
|
-
|
|
111322
|
-
destination[address] = position.x;
|
|
111323
|
-
destination[address + 1] = position.y;
|
|
111324
|
-
destination[address + 2] = position.z;
|
|
111325
|
-
|
|
111326
|
-
destination[address + 3] = this.radius.getValue();
|
|
111327
|
-
|
|
111328
|
-
const color = this.color;
|
|
111329
|
-
|
|
111330
|
-
destination[address + 4] = color.r;
|
|
111331
|
-
destination[address + 5] = color.g;
|
|
111332
|
-
destination[address + 6] = color.b;
|
|
111333
|
-
|
|
111334
|
-
destination[address + 7] = this.intensity.getValue();
|
|
111335
|
-
|
|
111336
|
-
return 8;
|
|
111337
|
-
}
|
|
111338
|
-
}
|
|
111339
|
-
|
|
111340
|
-
/**
|
|
111341
|
-
* @readonly
|
|
111342
|
-
* @type {boolean}
|
|
111343
|
-
*/
|
|
111344
|
-
PointLight.prototype.isPointLight = true;
|
|
111345
|
-
|
|
111346
|
-
PointLight.prototype.ENCODED_SLOT_COUNT = 8;
|
|
111347
|
-
|
|
111348
|
-
class FPLightBinding extends LightBinding {
|
|
111349
|
-
constructor() {
|
|
111350
|
-
super();
|
|
111351
|
-
|
|
111352
|
-
this.__light = null;
|
|
111390
|
+
this.bindings = [];
|
|
111353
111391
|
}
|
|
111354
111392
|
|
|
111355
111393
|
/**
|
|
@@ -111361,6 +111399,10 @@ class FPLightBinding extends LightBinding {
|
|
|
111361
111399
|
return ctx.system.__plugin.getValue();
|
|
111362
111400
|
}
|
|
111363
111401
|
|
|
111402
|
+
#updateDistance() {
|
|
111403
|
+
this.__light.radius.set(this.scaled_distance);
|
|
111404
|
+
}
|
|
111405
|
+
|
|
111364
111406
|
link(ctx) {
|
|
111365
111407
|
/**
|
|
111366
111408
|
*
|
|
@@ -111373,11 +111415,17 @@ class FPLightBinding extends LightBinding {
|
|
|
111373
111415
|
const pl = new PointLight();
|
|
111374
111416
|
|
|
111375
111417
|
const cLight = this.__c_light;
|
|
111418
|
+
const cTransform = this.__c_transform;
|
|
111419
|
+
|
|
111420
|
+
this.bindings.push(
|
|
111421
|
+
new SignalBinding(cLight.distance.onChanged, this.#updateDistance, this),
|
|
111422
|
+
new SignalBinding(cTransform.scale.onChanged, this.#updateDistance, this)
|
|
111423
|
+
);
|
|
111376
111424
|
|
|
111377
111425
|
pl.intensity = cLight.intensity;
|
|
111378
111426
|
pl.color = cLight.color;
|
|
111379
|
-
|
|
111380
|
-
pl.position =
|
|
111427
|
+
|
|
111428
|
+
pl.position = cTransform.position;
|
|
111381
111429
|
|
|
111382
111430
|
/**
|
|
111383
111431
|
*
|
|
@@ -111386,9 +111434,15 @@ class FPLightBinding extends LightBinding {
|
|
|
111386
111434
|
*/
|
|
111387
111435
|
cLight.__fp_light = pl;
|
|
111388
111436
|
|
|
111437
|
+
this.__light = pl;
|
|
111438
|
+
|
|
111439
|
+
this.#updateDistance();
|
|
111440
|
+
|
|
111389
111441
|
lightManager.addLight(pl);
|
|
111390
111442
|
|
|
111391
|
-
this.
|
|
111443
|
+
for (let i = 0; i < this.bindings.length; i++) {
|
|
111444
|
+
this.bindings[i].link();
|
|
111445
|
+
}
|
|
111392
111446
|
}
|
|
111393
111447
|
|
|
111394
111448
|
unlink(ctx) {
|
|
@@ -111401,9 +111455,49 @@ class FPLightBinding extends LightBinding {
|
|
|
111401
111455
|
const lightManager = fp.getLightManager();
|
|
111402
111456
|
|
|
111403
111457
|
lightManager.removeLight(this.__light);
|
|
111458
|
+
|
|
111459
|
+
for (let i = 0; i < this.bindings.length; i++) {
|
|
111460
|
+
this.bindings[i].unlink();
|
|
111461
|
+
}
|
|
111462
|
+
this.bindings.splice(0, this.bindings.length);
|
|
111463
|
+
}
|
|
111464
|
+
}
|
|
111465
|
+
|
|
111466
|
+
class ShadowMap {
|
|
111467
|
+
constructor() {
|
|
111468
|
+
/**
|
|
111469
|
+
*
|
|
111470
|
+
* @type {CameraView[]}
|
|
111471
|
+
*/
|
|
111472
|
+
this.views = [];
|
|
111473
|
+
|
|
111474
|
+
|
|
111404
111475
|
}
|
|
111405
111476
|
}
|
|
111406
111477
|
|
|
111478
|
+
/**
|
|
111479
|
+
*
|
|
111480
|
+
* @param {Light} component
|
|
111481
|
+
* @param {Quaternion} r
|
|
111482
|
+
*/
|
|
111483
|
+
function applyRotation(component, r) {
|
|
111484
|
+
const l = component.__threeObject;
|
|
111485
|
+
|
|
111486
|
+
r.toEulerAnglesXYZ(l.rotation);
|
|
111487
|
+
|
|
111488
|
+
if (l.target !== undefined) {
|
|
111489
|
+
|
|
111490
|
+
const targetPosition = l.target.position;
|
|
111491
|
+
|
|
111492
|
+
targetPosition.set(0, 0, 1).applyQuaternion(r);
|
|
111493
|
+
targetPosition.set(l.position.x + targetPosition.x, l.position.y + targetPosition.y, l.position.z + targetPosition.z);
|
|
111494
|
+
|
|
111495
|
+
l.target.updateMatrixWorld(true);
|
|
111496
|
+
}
|
|
111497
|
+
|
|
111498
|
+
threeUpdateTransform(component.__threeObject);
|
|
111499
|
+
}
|
|
111500
|
+
|
|
111407
111501
|
/**
|
|
111408
111502
|
*
|
|
111409
111503
|
* @param {Light} component
|
|
@@ -111453,41 +111547,6 @@ function threeEnsureLightObject(component, cache) {
|
|
|
111453
111547
|
}
|
|
111454
111548
|
}
|
|
111455
111549
|
|
|
111456
|
-
/**
|
|
111457
|
-
*
|
|
111458
|
-
* @param {Light} component
|
|
111459
|
-
* @param {Quaternion} r
|
|
111460
|
-
*/
|
|
111461
|
-
function applyRotation(component, r) {
|
|
111462
|
-
const l = component.__threeObject;
|
|
111463
|
-
|
|
111464
|
-
r.toEulerAnglesXYZ(l.rotation);
|
|
111465
|
-
|
|
111466
|
-
if (l.target !== undefined) {
|
|
111467
|
-
|
|
111468
|
-
const targetPosition = l.target.position;
|
|
111469
|
-
|
|
111470
|
-
targetPosition.set(0, 0, 1).applyQuaternion(r);
|
|
111471
|
-
targetPosition.set(l.position.x + targetPosition.x, l.position.y + targetPosition.y, l.position.z + targetPosition.z);
|
|
111472
|
-
|
|
111473
|
-
l.target.updateMatrixWorld(true);
|
|
111474
|
-
}
|
|
111475
|
-
|
|
111476
|
-
threeUpdateTransform(component.__threeObject);
|
|
111477
|
-
}
|
|
111478
|
-
|
|
111479
|
-
class ShadowMap {
|
|
111480
|
-
constructor() {
|
|
111481
|
-
/**
|
|
111482
|
-
*
|
|
111483
|
-
* @type {CameraView[]}
|
|
111484
|
-
*/
|
|
111485
|
-
this.views = [];
|
|
111486
|
-
|
|
111487
|
-
|
|
111488
|
-
}
|
|
111489
|
-
}
|
|
111490
|
-
|
|
111491
111550
|
const shadow_scene = new Scene$1();
|
|
111492
111551
|
shadow_scene.autoUpdate = false;
|
|
111493
111552
|
shadow_scene.matrixAutoUpdate = false;
|
|
@@ -111627,7 +111686,7 @@ class ThreeLightBinding extends LightBinding {
|
|
|
111627
111686
|
}
|
|
111628
111687
|
|
|
111629
111688
|
__apply_distance(v) {
|
|
111630
|
-
this.__three_getLight().distance = this.
|
|
111689
|
+
this.__three_getLight().distance = this.scaled_distance;
|
|
111631
111690
|
}
|
|
111632
111691
|
|
|
111633
111692
|
__apply_angle() {
|
|
@@ -111794,6 +111853,10 @@ class ThreeLightBinding extends LightBinding {
|
|
|
111794
111853
|
applyRotation(this.__c_light, this.__c_transform.rotation);
|
|
111795
111854
|
}
|
|
111796
111855
|
|
|
111856
|
+
__apply_scale() {
|
|
111857
|
+
this.__three_getLight().distance = this.scaled_distance;
|
|
111858
|
+
}
|
|
111859
|
+
|
|
111797
111860
|
applySettings(settings) {
|
|
111798
111861
|
const light = this.__three_getLight();
|
|
111799
111862
|
|
|
@@ -116190,17 +116253,17 @@ class Uint32Heap {
|
|
|
116190
116253
|
const size = this.__size;
|
|
116191
116254
|
|
|
116192
116255
|
while (true) {
|
|
116193
|
-
const
|
|
116194
|
-
const
|
|
116256
|
+
const left = (i << 1) + 1;
|
|
116257
|
+
const right = left + 1;
|
|
116195
116258
|
|
|
116196
116259
|
let smallest = i;
|
|
116197
116260
|
|
|
116198
|
-
if (
|
|
116199
|
-
smallest =
|
|
116261
|
+
if (left < size && this.compare(left, smallest)) {
|
|
116262
|
+
smallest = left;
|
|
116200
116263
|
}
|
|
116201
116264
|
|
|
116202
|
-
if (
|
|
116203
|
-
smallest =
|
|
116265
|
+
if (right < size && this.compare(right, smallest)) {
|
|
116266
|
+
smallest = right;
|
|
116204
116267
|
}
|
|
116205
116268
|
|
|
116206
116269
|
if (smallest === i) {
|
|
@@ -116274,19 +116337,23 @@ class Uint32Heap {
|
|
|
116274
116337
|
|
|
116275
116338
|
pop_min() {
|
|
116276
116339
|
|
|
116277
|
-
const
|
|
116340
|
+
const new_size = this.__size - 1;
|
|
116341
|
+
this.__size = new_size;
|
|
116278
116342
|
|
|
116279
|
-
this.
|
|
116343
|
+
const uint32 = this.__data_uint32;
|
|
116344
|
+
const top_id = uint32[1];
|
|
116280
116345
|
|
|
116281
|
-
|
|
116282
|
-
|
|
116283
|
-
|
|
116346
|
+
// move bottom element to the top.
|
|
116347
|
+
// the top doesn't need to be moved down as we have discarded it already
|
|
116348
|
+
const i2 = new_size << 1; // same as *2
|
|
116284
116349
|
|
|
116285
|
-
|
|
116286
|
-
|
|
116287
|
-
}
|
|
116350
|
+
uint32[0] = uint32[i2];
|
|
116351
|
+
uint32[1] = uint32[i2 + 1];
|
|
116288
116352
|
|
|
116289
|
-
|
|
116353
|
+
// re-balance
|
|
116354
|
+
this.heap_down(0);
|
|
116355
|
+
|
|
116356
|
+
return top_id;
|
|
116290
116357
|
}
|
|
116291
116358
|
|
|
116292
116359
|
/**
|
|
@@ -116304,6 +116371,7 @@ class Uint32Heap {
|
|
|
116304
116371
|
const _id = uint32[address];
|
|
116305
116372
|
|
|
116306
116373
|
if (_id === id) {
|
|
116374
|
+
// reverse address to index
|
|
116307
116375
|
return (address >>> 1);
|
|
116308
116376
|
}
|
|
116309
116377
|
}
|
|
@@ -116317,7 +116385,7 @@ class Uint32Heap {
|
|
|
116317
116385
|
* @param {number} id
|
|
116318
116386
|
* @returns {boolean}
|
|
116319
116387
|
*/
|
|
116320
|
-
contains(id){
|
|
116388
|
+
contains(id) {
|
|
116321
116389
|
return this.find_index_by_id(id) !== -1;
|
|
116322
116390
|
}
|
|
116323
116391
|
|
|
@@ -116448,7 +116516,7 @@ class Uint32Heap {
|
|
|
116448
116516
|
|
|
116449
116517
|
// insert at the end
|
|
116450
116518
|
const index = current_size;
|
|
116451
|
-
const address = index << 1;
|
|
116519
|
+
const address = index << 1; // same as *2
|
|
116452
116520
|
|
|
116453
116521
|
// write data
|
|
116454
116522
|
this.__data_float32[address] = score;
|
|
@@ -116646,6 +116714,12 @@ const open = new Uint32Heap();
|
|
|
116646
116714
|
const closed = new BitSet();
|
|
116647
116715
|
closed.preventShrink();
|
|
116648
116716
|
|
|
116717
|
+
/**
|
|
116718
|
+
* Contains refined heuristic value
|
|
116719
|
+
* @type {Float32Array}
|
|
116720
|
+
*/
|
|
116721
|
+
let g_score = new Float32Array(1024);
|
|
116722
|
+
|
|
116649
116723
|
/**
|
|
116650
116724
|
*
|
|
116651
116725
|
* @param {number[]|Uint8Array|Uint16Array|Float32Array} field
|
|
@@ -116669,14 +116743,15 @@ function find_path_on_grid_astar(
|
|
|
116669
116743
|
open.clear();
|
|
116670
116744
|
closed.reset();
|
|
116671
116745
|
|
|
116672
|
-
|
|
116673
|
-
* Contains refined heuristic value
|
|
116674
|
-
* @type {number[]}
|
|
116675
|
-
*/
|
|
116676
|
-
const g_score = [];
|
|
116746
|
+
const cell_count = width * height;
|
|
116677
116747
|
|
|
116678
|
-
g_score
|
|
116748
|
+
if (g_score.length < cell_count) {
|
|
116749
|
+
g_score = new Float32Array(cell_count);
|
|
116750
|
+
}
|
|
116679
116751
|
|
|
116752
|
+
g_score.fill(Infinity, 0, cell_count);
|
|
116753
|
+
|
|
116754
|
+
g_score[start] = 0;
|
|
116680
116755
|
|
|
116681
116756
|
open.insert(start, heuristic(start, goal, width));
|
|
116682
116757
|
|
|
@@ -116720,27 +116795,19 @@ function find_path_on_grid_astar(
|
|
|
116720
116795
|
// updated path cost
|
|
116721
116796
|
const cost_so_far = g_score[currentNode] + transition_cost;
|
|
116722
116797
|
|
|
116723
|
-
|
|
116724
|
-
|
|
116725
|
-
const not_in_open_set = index_in_open_set === -1;
|
|
116726
|
-
|
|
116727
|
-
if (not_in_open_set || cost_so_far < g_score[neighbor]) {
|
|
116798
|
+
if (cost_so_far < g_score[neighbor]) {
|
|
116728
116799
|
|
|
116729
|
-
// update
|
|
116800
|
+
// update actual cost
|
|
116730
116801
|
g_score[neighbor] = cost_so_far;
|
|
116731
116802
|
|
|
116732
116803
|
const remaining_heuristic = heuristic(neighbor, goal, width);
|
|
116733
116804
|
|
|
116734
116805
|
const refined_heuristic = cost_so_far + remaining_heuristic;
|
|
116735
116806
|
|
|
116736
|
-
|
|
116737
|
-
|
|
116738
|
-
open.insert(neighbor, refined_heuristic);
|
|
116739
|
-
} else {
|
|
116740
|
-
// Already seen the node, but since it has been re-scored we need to reorder it in the heap
|
|
116741
|
-
open.__update_score_by_index(index_in_open_set, refined_heuristic);
|
|
116742
|
-
}
|
|
116807
|
+
// Pushing to heap will put it in proper place based on the 'f' value.
|
|
116808
|
+
open.insert_or_update(neighbor, refined_heuristic);
|
|
116743
116809
|
}
|
|
116810
|
+
|
|
116744
116811
|
}
|
|
116745
116812
|
}
|
|
116746
116813
|
|