@woosh/meep-engine 2.108.2 → 2.108.3
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 +472 -181
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +472 -181
- package/package.json +1 -1
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts +6 -0
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +15 -3
- package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +3 -3
- 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 +25 -14
- package/src/core/collection/array/arrayQuickSort.d.ts +0 -9
- package/src/core/collection/array/arrayQuickSort.d.ts.map +1 -1
- package/src/core/collection/array/arrayQuickSort.js +0 -73
- package/src/core/collection/array/array_quick_sort_by_comparator.d.ts +10 -0
- package/src/core/collection/array/array_quick_sort_by_comparator.d.ts.map +1 -0
- package/src/core/collection/array/array_quick_sort_by_comparator.js +75 -0
- package/src/core/collection/array/array_quick_sort_by_lookup.d.ts +8 -0
- package/src/core/collection/array/array_quick_sort_by_lookup.d.ts.map +1 -0
- package/src/core/collection/array/array_quick_sort_by_lookup.js +78 -0
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts +15 -0
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts.map +1 -0
- package/src/core/geom/2d/triangle2d_get_barycentric.js +48 -0
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_from_v3_array.js +2 -7
- package/src/core/geom/3d/aabb3_compute_from_triangle.d.ts +11 -0
- package/src/core/geom/3d/aabb3_compute_from_triangle.d.ts.map +1 -0
- package/src/core/geom/3d/aabb3_compute_from_triangle.js +43 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +5 -5
- package/src/core/geom/3d/sphere/harmonics/sh_compute_K.d.ts +9 -0
- package/src/core/geom/3d/sphere/harmonics/sh_compute_K.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh_compute_K.js +17 -0
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +6 -3
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +56 -18
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_towards_containing_tetrahedron.d.ts +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_towards_containing_tetrahedron.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_towards_containing_tetrahedron.js +11 -4
- package/src/core/geom/3d/tetrahedra/{GetDepthForTetrahedronProbe.glsl → triangle/GetDepthForTetrahedronProbe.glsl} +17 -10
- package/src/core/geom/3d/tetrahedra/triangle/prototype.d.ts +2 -0
- package/src/core/geom/3d/tetrahedra/triangle/prototype.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/triangle/prototype.js +128 -0
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.d.ts +13 -0
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.js +120 -0
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.d.ts +3 -0
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.js +106 -0
- package/src/core/math/factorial.d.ts +7 -0
- package/src/core/math/factorial.d.ts.map +1 -0
- package/src/core/math/factorial.js +15 -0
- package/src/core/math/factorial.spec.d.ts +2 -0
- package/src/core/math/factorial.spec.d.ts.map +1 -0
- package/src/core/math/factorial.spec.js +9 -0
- package/src/core/model/DebouncedObservedBoolean.d.ts +1 -1
- package/src/core/model/DebouncedObservedBoolean.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeDescription.d.ts +6 -4
- package/src/engine/asset/loaders/material/computeTextureEquality.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.js +8 -1
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.js +3 -1
- package/src/engine/graphics/filter/sampler2d_flipY_in_place.d.ts +8 -0
- package/src/engine/graphics/filter/sampler2d_flipY_in_place.d.ts.map +1 -0
- package/src/engine/graphics/filter/{FlipArrayInPlace.js → sampler2d_flipY_in_place.js} +1 -1
- package/src/engine/graphics/geometry/bvh/buffered/bvh32_set_leaf_from_triangle.d.ts.map +1 -1
- package/src/engine/graphics/geometry/bvh/buffered/bvh32_set_leaf_from_triangle.js +5 -27
- package/src/engine/graphics/render/Lines.d.ts.map +1 -1
- package/src/engine/graphics/render/Lines.js +10 -2
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts +24 -0
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +293 -0
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.js +71 -0
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.js +256 -0
- package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.js +4 -4
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +3 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +12 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts +2 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +6 -6
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts +8 -0
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +3 -2
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +9 -4
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts +3 -3
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.d.ts +2 -2
- package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.js +18 -8
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +51 -22
- package/src/engine/graphics/texture/AttributeDataTexture.d.ts.map +1 -1
- package/src/engine/graphics/texture/AttributeDataTexture.js +8 -2
- package/src/engine/graphics/texture/computeThreeTextureFormat.js +2 -1
- package/src/engine/graphics/texture/computeThreeTextureFormatFromDataType.d.ts +7 -0
- package/src/engine/graphics/texture/computeThreeTextureFormatFromDataType.d.ts.map +1 -0
- package/src/engine/graphics/texture/computeThreeTextureFormatFromDataType.js +13 -0
- package/src/engine/graphics/texture/numericTypeFromBinaryDataType.d.ts +9 -0
- package/src/engine/graphics/texture/numericTypeFromBinaryDataType.d.ts.map +1 -0
- package/src/engine/graphics/texture/numericTypeFromBinaryDataType.js +31 -0
- package/src/engine/graphics/texture/sampler/Sampler2D.js +2 -2
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +47 -19
- package/src/engine/graphics/texture/sampler/debug/prototypeSamplerFiltering.js +5 -33
- package/src/engine/graphics/texture/sampler/sampler2d_copy_rectangle.d.ts +11 -0
- package/src/engine/graphics/texture/sampler/sampler2d_copy_rectangle.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/sampler2d_copy_rectangle.js +41 -0
- package/src/engine/graphics/texture/virtual/VirtualTextureUsage.d.ts +0 -4
- package/src/engine/graphics/texture/virtual/VirtualTextureUsage.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureUsage.js +19 -30
- package/src/engine/graphics/filter/FlipArrayInPlace.d.ts +0 -8
- package/src/engine/graphics/filter/FlipArrayInPlace.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.d.ts +0 -3
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.js +0 -3
package/build/meep.module.js
CHANGED
|
@@ -49606,8 +49606,8 @@ class Sampler2D {
|
|
|
49606
49606
|
const clamped_x = clamp$1(x, 0, x_max);
|
|
49607
49607
|
const clamped_y = clamp$1(y, 0, y_max);
|
|
49608
49608
|
|
|
49609
|
-
const x0 = clamped_x
|
|
49610
|
-
const y0 = clamped_y
|
|
49609
|
+
const x0 = clamped_x >>> 0;
|
|
49610
|
+
const y0 = clamped_y >>> 0;
|
|
49611
49611
|
|
|
49612
49612
|
//
|
|
49613
49613
|
const row0 = y0 * rowSize;
|
|
@@ -53270,7 +53270,7 @@ function aabb3_intersects_ray(
|
|
|
53270
53270
|
return f2 <= extents_x * abs_direction_y + extents_y * abs_direction_x;
|
|
53271
53271
|
}
|
|
53272
53272
|
|
|
53273
|
-
const stack$
|
|
53273
|
+
const stack$a = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
53274
53274
|
|
|
53275
53275
|
|
|
53276
53276
|
/**
|
|
@@ -53303,9 +53303,9 @@ function bvh_query_leaves_ray(
|
|
|
53303
53303
|
*
|
|
53304
53304
|
* @type {number}
|
|
53305
53305
|
*/
|
|
53306
|
-
const stack_top = stack$
|
|
53306
|
+
const stack_top = stack$a.pointer++;
|
|
53307
53307
|
|
|
53308
|
-
stack$
|
|
53308
|
+
stack$a[stack_top] = root;
|
|
53309
53309
|
|
|
53310
53310
|
let result_cursor = result_offset;
|
|
53311
53311
|
|
|
@@ -53316,13 +53316,13 @@ function bvh_query_leaves_ray(
|
|
|
53316
53316
|
const uint32 = bvh.__data_uint32;
|
|
53317
53317
|
|
|
53318
53318
|
do {
|
|
53319
|
-
stack$
|
|
53319
|
+
stack$a.pointer--;
|
|
53320
53320
|
|
|
53321
53321
|
/**
|
|
53322
53322
|
*
|
|
53323
53323
|
* @type {number}
|
|
53324
53324
|
*/
|
|
53325
|
-
const node = stack$
|
|
53325
|
+
const node = stack$a[stack$a.pointer];
|
|
53326
53326
|
|
|
53327
53327
|
const address = node * ELEMENT_WORD_COUNT;
|
|
53328
53328
|
|
|
@@ -53344,15 +53344,15 @@ function bvh_query_leaves_ray(
|
|
|
53344
53344
|
if (child_1 !== NULL_NODE) {
|
|
53345
53345
|
|
|
53346
53346
|
// this is not a leaf node, push children onto traversal stack
|
|
53347
|
-
stack$
|
|
53348
|
-
stack$
|
|
53347
|
+
stack$a[stack$a.pointer++] = uint32[address + COLUMN_CHILD_2];
|
|
53348
|
+
stack$a[stack$a.pointer++] = child_1;
|
|
53349
53349
|
|
|
53350
53350
|
} else {
|
|
53351
53351
|
// leaf node
|
|
53352
53352
|
|
|
53353
53353
|
result[result_cursor++] = node;
|
|
53354
53354
|
}
|
|
53355
|
-
} while (stack$
|
|
53355
|
+
} while (stack$a.pointer > stack_top);
|
|
53356
53356
|
|
|
53357
53357
|
return result_cursor - result_offset;
|
|
53358
53358
|
}
|
|
@@ -55232,7 +55232,7 @@ function build_morton(data, address, bounds) {
|
|
|
55232
55232
|
|
|
55233
55233
|
}
|
|
55234
55234
|
|
|
55235
|
-
const stack$
|
|
55235
|
+
const stack$9 = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
55236
55236
|
|
|
55237
55237
|
class BinaryUint32BVH {
|
|
55238
55238
|
/**
|
|
@@ -55374,6 +55374,18 @@ class BinaryUint32BVH {
|
|
|
55374
55374
|
|
|
55375
55375
|
}
|
|
55376
55376
|
|
|
55377
|
+
/**
|
|
55378
|
+
*
|
|
55379
|
+
* @param {number} index
|
|
55380
|
+
* @return {number}
|
|
55381
|
+
*/
|
|
55382
|
+
getLeafAddress(index) {
|
|
55383
|
+
|
|
55384
|
+
const leaf_block_address = this.__node_count_binary * BVH_BINARY_NODE_SIZE;
|
|
55385
|
+
|
|
55386
|
+
return index * BVH_LEAF_NODE_SIZE + leaf_block_address;
|
|
55387
|
+
}
|
|
55388
|
+
|
|
55377
55389
|
/**
|
|
55378
55390
|
*
|
|
55379
55391
|
* @param {number} index
|
|
@@ -55391,9 +55403,7 @@ class BinaryUint32BVH {
|
|
|
55391
55403
|
x1, y1, z1
|
|
55392
55404
|
) {
|
|
55393
55405
|
|
|
55394
|
-
const
|
|
55395
|
-
|
|
55396
|
-
const address = index * BVH_LEAF_NODE_SIZE + leaf_block_address;
|
|
55406
|
+
const address = this.getLeafAddress(index);
|
|
55397
55407
|
|
|
55398
55408
|
aabb3_array_set(
|
|
55399
55409
|
this.__data_float32,
|
|
@@ -55533,16 +55543,16 @@ class BinaryUint32BVH {
|
|
|
55533
55543
|
let stackPointer = 2;
|
|
55534
55544
|
let i, j;
|
|
55535
55545
|
|
|
55536
|
-
stack$
|
|
55537
|
-
stack$
|
|
55546
|
+
stack$9[0] = 0; // first node
|
|
55547
|
+
stack$9[1] = this.__node_count_leaf - 1; // last node
|
|
55538
55548
|
|
|
55539
55549
|
const data = this.__data_float32;
|
|
55540
55550
|
|
|
55541
55551
|
while (stackPointer > 0) {
|
|
55542
55552
|
stackPointer -= 2;
|
|
55543
55553
|
|
|
55544
|
-
const right = stack$
|
|
55545
|
-
const left = stack$
|
|
55554
|
+
const right = stack$9[stackPointer + 1];
|
|
55555
|
+
const left = stack$9[stackPointer];
|
|
55546
55556
|
|
|
55547
55557
|
i = left;
|
|
55548
55558
|
j = right;
|
|
@@ -55577,12 +55587,12 @@ class BinaryUint32BVH {
|
|
|
55577
55587
|
|
|
55578
55588
|
/* recursion */
|
|
55579
55589
|
if (left < j) {
|
|
55580
|
-
stack$
|
|
55581
|
-
stack$
|
|
55590
|
+
stack$9[stackPointer++] = left;
|
|
55591
|
+
stack$9[stackPointer++] = j;
|
|
55582
55592
|
}
|
|
55583
55593
|
if (i < right) {
|
|
55584
|
-
stack$
|
|
55585
|
-
stack$
|
|
55594
|
+
stack$9[stackPointer++] = i;
|
|
55595
|
+
stack$9[stackPointer++] = right;
|
|
55586
55596
|
}
|
|
55587
55597
|
}
|
|
55588
55598
|
}
|
|
@@ -57180,7 +57190,7 @@ function aabb3_array_intersects_ray(
|
|
|
57180
57190
|
);
|
|
57181
57191
|
}
|
|
57182
57192
|
|
|
57183
|
-
const stack$
|
|
57193
|
+
const stack$8 = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
57184
57194
|
|
|
57185
57195
|
/**
|
|
57186
57196
|
*
|
|
@@ -57214,13 +57224,13 @@ function bvh32_query_user_data_ray(
|
|
|
57214
57224
|
*
|
|
57215
57225
|
* @type {number}
|
|
57216
57226
|
*/
|
|
57217
|
-
const stack_top = stack$
|
|
57227
|
+
const stack_top = stack$8.pointer++;
|
|
57218
57228
|
|
|
57219
57229
|
/**
|
|
57220
57230
|
* After performing empirical tests, stack-based depth-first traversal turns out faster than using a queue
|
|
57221
57231
|
* @type {number}
|
|
57222
57232
|
*/
|
|
57223
|
-
stack$
|
|
57233
|
+
stack$8[stack_top] = 0;
|
|
57224
57234
|
|
|
57225
57235
|
const last_valid_index = binary_node_count + bvh.leaf_node_count;
|
|
57226
57236
|
|
|
@@ -57228,10 +57238,10 @@ function bvh32_query_user_data_ray(
|
|
|
57228
57238
|
const uint32 = bvh.uint32;
|
|
57229
57239
|
|
|
57230
57240
|
do {
|
|
57231
|
-
stack$
|
|
57241
|
+
stack$8.pointer--;
|
|
57232
57242
|
|
|
57233
57243
|
// query_bvh_frustum_from_objects.iteration_count++;
|
|
57234
|
-
const node_index = stack$
|
|
57244
|
+
const node_index = stack$8[stack$8.pointer];
|
|
57235
57245
|
|
|
57236
57246
|
const node_address = bvh.getNodeAddress(node_index);
|
|
57237
57247
|
|
|
@@ -57253,11 +57263,11 @@ function bvh32_query_user_data_ray(
|
|
|
57253
57263
|
|
|
57254
57264
|
// left node ends up on top of the stack, which aligns with the desired access sequence
|
|
57255
57265
|
if (right_index < last_valid_index) {
|
|
57256
|
-
stack$
|
|
57266
|
+
stack$8[stack$8.pointer++] = right_index;
|
|
57257
57267
|
// micro-optimization, since we know that right node is valid and left appears before that, left is valid too
|
|
57258
|
-
stack$
|
|
57268
|
+
stack$8[stack$8.pointer++] = left_index;
|
|
57259
57269
|
} else if (left_index < last_valid_index) {
|
|
57260
|
-
stack$
|
|
57270
|
+
stack$8[stack$8.pointer++] = left_index;
|
|
57261
57271
|
}
|
|
57262
57272
|
|
|
57263
57273
|
|
|
@@ -57270,7 +57280,7 @@ function bvh32_query_user_data_ray(
|
|
|
57270
57280
|
hit_count++;
|
|
57271
57281
|
}
|
|
57272
57282
|
|
|
57273
|
-
} while (stack$
|
|
57283
|
+
} while (stack$8.pointer > stack_top)
|
|
57274
57284
|
|
|
57275
57285
|
return hit_count;
|
|
57276
57286
|
}
|
|
@@ -65881,14 +65891,17 @@ function read_three_planes_to_array(planes, array) {
|
|
|
65881
65891
|
|
|
65882
65892
|
/**
|
|
65883
65893
|
*
|
|
65884
|
-
* @param {
|
|
65885
|
-
* @param {number}
|
|
65894
|
+
* @param {number[]|Float32Array} output
|
|
65895
|
+
* @param {number} output_offset
|
|
65886
65896
|
* @param {number[]|Float32Array} vertices
|
|
65887
65897
|
* @param {number} a_index
|
|
65888
65898
|
* @param {number} b_index
|
|
65889
65899
|
* @param {number} c_index
|
|
65890
65900
|
*/
|
|
65891
|
-
function
|
|
65901
|
+
function aabb3_compute_from_triangle(
|
|
65902
|
+
output, output_offset,
|
|
65903
|
+
vertices, a_index, b_index, c_index
|
|
65904
|
+
) {
|
|
65892
65905
|
const a = a_index * 3;
|
|
65893
65906
|
const b = b_index * 3;
|
|
65894
65907
|
const c = c_index * 3;
|
|
@@ -65907,15 +65920,31 @@ function bvh32_set_leaf_from_triangle(bvh, triangle_index, vertices, a_index, b_
|
|
|
65907
65920
|
const cZ = vertices[c + 2];
|
|
65908
65921
|
|
|
65909
65922
|
// compute bounds of the triangle
|
|
65910
|
-
|
|
65911
|
-
|
|
65912
|
-
|
|
65923
|
+
output[output_offset] = min3(aX, bX, cX);
|
|
65924
|
+
output[output_offset + 1] = min3(aY, bY, cY);
|
|
65925
|
+
output[output_offset + 2] = min3(aZ, bZ, cZ);
|
|
65913
65926
|
|
|
65914
|
-
|
|
65915
|
-
|
|
65916
|
-
|
|
65927
|
+
output[output_offset + 3] = max3(aX, bX, cX);
|
|
65928
|
+
output[output_offset + 4] = max3(aY, bY, cY);
|
|
65929
|
+
output[output_offset + 5] = max3(aZ, bZ, cZ);
|
|
65930
|
+
|
|
65931
|
+
}
|
|
65932
|
+
|
|
65933
|
+
/**
|
|
65934
|
+
*
|
|
65935
|
+
* @param {BinaryUint32BVH} bvh
|
|
65936
|
+
* @param {number} triangle_index
|
|
65937
|
+
* @param {number[]|Float32Array} vertices
|
|
65938
|
+
* @param {number} a_index
|
|
65939
|
+
* @param {number} b_index
|
|
65940
|
+
* @param {number} c_index
|
|
65941
|
+
*/
|
|
65942
|
+
function bvh32_set_leaf_from_triangle(bvh, triangle_index, vertices, a_index, b_index, c_index) {
|
|
65943
|
+
|
|
65944
|
+
const address = bvh.getLeafAddress(triangle_index);
|
|
65945
|
+
aabb3_compute_from_triangle(bvh.__data_float32, address, vertices, a_index, b_index, c_index);
|
|
65946
|
+
bvh.__data_uint32[address + 6] = triangle_index;
|
|
65917
65947
|
|
|
65918
|
-
bvh.setLeafData(triangle_index, triangle_index, x0, y0, z0, x1, y1, z1);
|
|
65919
65948
|
}
|
|
65920
65949
|
|
|
65921
65950
|
/**
|
|
@@ -66043,7 +66072,7 @@ function aabb3_array_intersects_clipping_volume_array(
|
|
|
66043
66072
|
);
|
|
66044
66073
|
}
|
|
66045
66074
|
|
|
66046
|
-
const stack$
|
|
66075
|
+
const stack$7 = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
66047
66076
|
|
|
66048
66077
|
/**
|
|
66049
66078
|
*
|
|
@@ -66073,13 +66102,13 @@ function bvh32_query_user_data_overlaps_clipping_volume(
|
|
|
66073
66102
|
*
|
|
66074
66103
|
* @type {number}
|
|
66075
66104
|
*/
|
|
66076
|
-
const stack_top = stack$
|
|
66105
|
+
const stack_top = stack$7.pointer++;
|
|
66077
66106
|
|
|
66078
66107
|
/**
|
|
66079
66108
|
* After performing empirical tests, stack-based depth-first traversal turns out faster than using a queue
|
|
66080
66109
|
* @type {number}
|
|
66081
66110
|
*/
|
|
66082
|
-
stack$
|
|
66111
|
+
stack$7[stack_top] = 0;
|
|
66083
66112
|
|
|
66084
66113
|
const last_valid_index = binary_node_count + bvh.leaf_node_count;
|
|
66085
66114
|
|
|
@@ -66087,10 +66116,10 @@ function bvh32_query_user_data_overlaps_clipping_volume(
|
|
|
66087
66116
|
const uint32 = bvh.uint32;
|
|
66088
66117
|
|
|
66089
66118
|
do {
|
|
66090
|
-
stack$
|
|
66119
|
+
stack$7.pointer--;
|
|
66091
66120
|
|
|
66092
66121
|
// query_bvh_frustum_from_objects.iteration_count++;
|
|
66093
|
-
const node_index = stack$
|
|
66122
|
+
const node_index = stack$7[stack$7.pointer];
|
|
66094
66123
|
|
|
66095
66124
|
const node_address = bvh.getNodeAddress(node_index);
|
|
66096
66125
|
|
|
@@ -66111,11 +66140,11 @@ function bvh32_query_user_data_overlaps_clipping_volume(
|
|
|
66111
66140
|
|
|
66112
66141
|
// left node ends up on top of the stack, which aligns with the desired access sequence
|
|
66113
66142
|
if (right_index < last_valid_index) {
|
|
66114
|
-
stack$
|
|
66143
|
+
stack$7[stack$7.pointer++] = right_index;
|
|
66115
66144
|
// micro-optimization, since we know that right node is valid and left appears before that, left is valid too
|
|
66116
|
-
stack$
|
|
66145
|
+
stack$7[stack$7.pointer++] = left_index;
|
|
66117
66146
|
} else if (left_index < last_valid_index) {
|
|
66118
|
-
stack$
|
|
66147
|
+
stack$7[stack$7.pointer++] = left_index;
|
|
66119
66148
|
}
|
|
66120
66149
|
|
|
66121
66150
|
|
|
@@ -66128,7 +66157,7 @@ function bvh32_query_user_data_overlaps_clipping_volume(
|
|
|
66128
66157
|
hit_count++;
|
|
66129
66158
|
}
|
|
66130
66159
|
|
|
66131
|
-
} while (stack$
|
|
66160
|
+
} while (stack$7.pointer > stack_top)
|
|
66132
66161
|
|
|
66133
66162
|
return hit_count;
|
|
66134
66163
|
}
|
|
@@ -67239,7 +67268,7 @@ function aabb3_array_intersects_frustum_degree(aabb, frustum) {
|
|
|
67239
67268
|
//
|
|
67240
67269
|
|
|
67241
67270
|
|
|
67242
|
-
const stack$
|
|
67271
|
+
const stack$6 = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
67243
67272
|
|
|
67244
67273
|
/**
|
|
67245
67274
|
*
|
|
@@ -67262,20 +67291,20 @@ function bvh_collect_user_data(
|
|
|
67262
67291
|
*
|
|
67263
67292
|
* @type {number}
|
|
67264
67293
|
*/
|
|
67265
|
-
const stack_top = stack$
|
|
67294
|
+
const stack_top = stack$6.pointer++;
|
|
67266
67295
|
|
|
67267
|
-
stack$
|
|
67296
|
+
stack$6[stack_top] = root;
|
|
67268
67297
|
|
|
67269
67298
|
let result_cursor = destination_offset;
|
|
67270
67299
|
|
|
67271
|
-
while (stack$
|
|
67272
|
-
stack$
|
|
67300
|
+
while (stack$6.pointer > stack_top) {
|
|
67301
|
+
stack$6.pointer--;
|
|
67273
67302
|
|
|
67274
67303
|
/**
|
|
67275
67304
|
*
|
|
67276
67305
|
* @type {number}
|
|
67277
67306
|
*/
|
|
67278
|
-
const node = stack$
|
|
67307
|
+
const node = stack$6[stack$6.pointer];
|
|
67279
67308
|
|
|
67280
67309
|
const node_is_leaf = bvh.node_is_leaf(node);
|
|
67281
67310
|
|
|
@@ -67286,8 +67315,8 @@ function bvh_collect_user_data(
|
|
|
67286
67315
|
const child2 = bvh.node_get_child2(node);
|
|
67287
67316
|
|
|
67288
67317
|
// write to stack in reverse order, so that fist child ends up being visited first
|
|
67289
|
-
stack$
|
|
67290
|
-
stack$
|
|
67318
|
+
stack$6[stack$6.pointer++] = child1;
|
|
67319
|
+
stack$6[stack$6.pointer++] = child2;
|
|
67291
67320
|
|
|
67292
67321
|
} else {
|
|
67293
67322
|
// leaf root
|
|
@@ -67303,7 +67332,7 @@ function bvh_collect_user_data(
|
|
|
67303
67332
|
|
|
67304
67333
|
//
|
|
67305
67334
|
|
|
67306
|
-
const stack$
|
|
67335
|
+
const stack$5 = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
67307
67336
|
|
|
67308
67337
|
const scratch_aabb$1 = new Float32Array(6);
|
|
67309
67338
|
|
|
@@ -67330,20 +67359,20 @@ function bvh_query_user_data_overlaps_frustum(
|
|
|
67330
67359
|
*
|
|
67331
67360
|
* @type {number}
|
|
67332
67361
|
*/
|
|
67333
|
-
const stack_top = stack$
|
|
67362
|
+
const stack_top = stack$5.pointer++;
|
|
67334
67363
|
|
|
67335
|
-
stack$
|
|
67364
|
+
stack$5[stack_top] = root;
|
|
67336
67365
|
|
|
67337
67366
|
let result_cursor = result_offset;
|
|
67338
67367
|
|
|
67339
|
-
while (stack$
|
|
67340
|
-
stack$
|
|
67368
|
+
while (stack$5.pointer > stack_top) {
|
|
67369
|
+
stack$5.pointer--;
|
|
67341
67370
|
|
|
67342
67371
|
/**
|
|
67343
67372
|
*
|
|
67344
67373
|
* @type {number}
|
|
67345
67374
|
*/
|
|
67346
|
-
const node = stack$
|
|
67375
|
+
const node = stack$5[stack$5.pointer];
|
|
67347
67376
|
|
|
67348
67377
|
// test node against the ray
|
|
67349
67378
|
bvh.node_get_aabb(node, scratch_aabb$1);
|
|
@@ -67370,8 +67399,8 @@ function bvh_query_user_data_overlaps_frustum(
|
|
|
67370
67399
|
const child2 = bvh.node_get_child2(node);
|
|
67371
67400
|
|
|
67372
67401
|
// write to stack in reverse order, so that fist child ends up being visited first
|
|
67373
|
-
stack$
|
|
67374
|
-
stack$
|
|
67402
|
+
stack$5[stack$5.pointer++] = child1;
|
|
67403
|
+
stack$5[stack$5.pointer++] = child2;
|
|
67375
67404
|
}
|
|
67376
67405
|
}
|
|
67377
67406
|
|
|
@@ -67432,7 +67461,7 @@ function computeFileExtension(path) {
|
|
|
67432
67461
|
* @param {number} height
|
|
67433
67462
|
* @param {number} channel_count
|
|
67434
67463
|
*/
|
|
67435
|
-
function
|
|
67464
|
+
function sampler2d_flipY_in_place(input, width, height, channel_count = 4) {
|
|
67436
67465
|
const row_size = width * channel_count;
|
|
67437
67466
|
let t, x0, x1;
|
|
67438
67467
|
let i = 0;
|
|
@@ -67503,6 +67532,235 @@ const CopyShader = {
|
|
|
67503
67532
|
|
|
67504
67533
|
};
|
|
67505
67534
|
|
|
67535
|
+
/**
|
|
67536
|
+
*
|
|
67537
|
+
* @param {number} format
|
|
67538
|
+
* @returns {number}
|
|
67539
|
+
*/
|
|
67540
|
+
function formatToChannelCount(format) {
|
|
67541
|
+
switch (format) {
|
|
67542
|
+
case RedFormat:
|
|
67543
|
+
case RedIntegerFormat:
|
|
67544
|
+
return 1;
|
|
67545
|
+
case RGFormat:
|
|
67546
|
+
return 2;
|
|
67547
|
+
case RGBFormat:
|
|
67548
|
+
return 3;
|
|
67549
|
+
case RGBAFormat:
|
|
67550
|
+
return 4;
|
|
67551
|
+
default:
|
|
67552
|
+
throw new Error(`Unsupported format '${format}'`);
|
|
67553
|
+
}
|
|
67554
|
+
}
|
|
67555
|
+
|
|
67556
|
+
/**
|
|
67557
|
+
*
|
|
67558
|
+
* @param {Uint8Array|Uint16Array|Uint32Array|Int8Array|Int16Array|Int32Array} array
|
|
67559
|
+
* @return {boolean}
|
|
67560
|
+
*/
|
|
67561
|
+
function typed_array_is_integer(array) {
|
|
67562
|
+
const ctor = array.constructor;
|
|
67563
|
+
|
|
67564
|
+
return ctor === Uint8ClampedArray
|
|
67565
|
+
|| ctor === Uint8Array
|
|
67566
|
+
|| ctor === Uint16Array
|
|
67567
|
+
|| ctor === Uint32Array
|
|
67568
|
+
|| ctor === Int8Array
|
|
67569
|
+
|| ctor === Int16Array
|
|
67570
|
+
|| ctor === Int32Array
|
|
67571
|
+
;
|
|
67572
|
+
}
|
|
67573
|
+
|
|
67574
|
+
/**
|
|
67575
|
+
* Applies a linear polynomial transform to each value of a given channel
|
|
67576
|
+
* @param {Sampler2D} output
|
|
67577
|
+
* @param {Sampler2D} input
|
|
67578
|
+
* @param {number} output_channel_index
|
|
67579
|
+
* @param {number} input_channel_index
|
|
67580
|
+
* @param {number} gradient
|
|
67581
|
+
* @param {number} intercept
|
|
67582
|
+
*/
|
|
67583
|
+
function sampler2d_channel_linear_transform(
|
|
67584
|
+
output, input,
|
|
67585
|
+
output_channel_index, input_channel_index,
|
|
67586
|
+
gradient, intercept
|
|
67587
|
+
) {
|
|
67588
|
+
|
|
67589
|
+
const input_width = input.width;
|
|
67590
|
+
const input_height = input.height;
|
|
67591
|
+
|
|
67592
|
+
const output_width = output.width;
|
|
67593
|
+
const output_height = output.height;
|
|
67594
|
+
|
|
67595
|
+
if (
|
|
67596
|
+
input_width !== output_width
|
|
67597
|
+
|| input_height !== output_height
|
|
67598
|
+
) {
|
|
67599
|
+
throw new Error('Dimensions of input and output are incompatible');
|
|
67600
|
+
}
|
|
67601
|
+
|
|
67602
|
+
const input_item_size = input.itemSize;
|
|
67603
|
+
const output_item_size = output.itemSize;
|
|
67604
|
+
|
|
67605
|
+
const input_data = input.data;
|
|
67606
|
+
const output_data = output.data;
|
|
67607
|
+
|
|
67608
|
+
const pixel_count = input_width * input_height;
|
|
67609
|
+
|
|
67610
|
+
|
|
67611
|
+
if (typed_array_is_integer(output_data)) {
|
|
67612
|
+
|
|
67613
|
+
for (let i = 0; i < pixel_count; i++) {
|
|
67614
|
+
|
|
67615
|
+
const input_address = i * input_item_size + input_channel_index;
|
|
67616
|
+
const output_address = i * output_item_size + output_channel_index;
|
|
67617
|
+
|
|
67618
|
+
const input_value = input_data[input_address];
|
|
67619
|
+
|
|
67620
|
+
output_data[output_address] = Math.round(input_value * gradient + intercept);
|
|
67621
|
+
|
|
67622
|
+
}
|
|
67623
|
+
|
|
67624
|
+
} else {
|
|
67625
|
+
|
|
67626
|
+
for (let i = 0; i < pixel_count; i++) {
|
|
67627
|
+
|
|
67628
|
+
const input_address = i * input_item_size + input_channel_index;
|
|
67629
|
+
const output_address = i * output_item_size + output_channel_index;
|
|
67630
|
+
|
|
67631
|
+
const input_value = input_data[input_address];
|
|
67632
|
+
|
|
67633
|
+
output_data[output_address] = input_value * gradient + intercept;
|
|
67634
|
+
|
|
67635
|
+
}
|
|
67636
|
+
|
|
67637
|
+
}
|
|
67638
|
+
|
|
67639
|
+
}
|
|
67640
|
+
|
|
67641
|
+
function compute_gradient_and_intercept_uint8(ctor) {
|
|
67642
|
+
let gradient = 1;
|
|
67643
|
+
let intercept = 0;
|
|
67644
|
+
|
|
67645
|
+
switch (ctor) {
|
|
67646
|
+
case Uint16Array:
|
|
67647
|
+
gradient = 0.0038910505836575876;
|
|
67648
|
+
break;
|
|
67649
|
+
case Uint32Array:
|
|
67650
|
+
gradient = 5.937181414556033e-8;
|
|
67651
|
+
break;
|
|
67652
|
+
case Int8Array:
|
|
67653
|
+
gradient = 1;
|
|
67654
|
+
intercept = 127;
|
|
67655
|
+
break
|
|
67656
|
+
case Int16Array:
|
|
67657
|
+
gradient = 0.0038910505836575876;
|
|
67658
|
+
intercept = 127;
|
|
67659
|
+
break;
|
|
67660
|
+
case Int32Array:
|
|
67661
|
+
gradient = 5.937181414556033e-8;
|
|
67662
|
+
intercept = 127;
|
|
67663
|
+
break
|
|
67664
|
+
case Float32Array:
|
|
67665
|
+
case Float64Array:
|
|
67666
|
+
gradient = 255;
|
|
67667
|
+
break;
|
|
67668
|
+
// do nothing;
|
|
67669
|
+
}
|
|
67670
|
+
|
|
67671
|
+
return {
|
|
67672
|
+
gradient, intercept
|
|
67673
|
+
}
|
|
67674
|
+
}
|
|
67675
|
+
|
|
67676
|
+
/**
|
|
67677
|
+
* Many applications work with 8bit RGBA images, this utility function converts a given input to that format
|
|
67678
|
+
* @param {Sampler2D} input
|
|
67679
|
+
* @param {Sampler2D} output
|
|
67680
|
+
*/
|
|
67681
|
+
function sampler2d_to_uint8_RGBA(output, input) {
|
|
67682
|
+
if (
|
|
67683
|
+
input.width !== output.width
|
|
67684
|
+
|| input.height !== output.height
|
|
67685
|
+
) {
|
|
67686
|
+
throw new Error('Dimensions of source and destination are incompatible');
|
|
67687
|
+
}
|
|
67688
|
+
|
|
67689
|
+
if (output.itemSize !== 4) {
|
|
67690
|
+
throw new Error(`Destination must have 4 channels exactly, instead got '${output.itemSize}'`);
|
|
67691
|
+
}
|
|
67692
|
+
|
|
67693
|
+
const { gradient, intercept } = compute_gradient_and_intercept_uint8(input.data.constructor);
|
|
67694
|
+
|
|
67695
|
+
const source_item_size = input.itemSize;
|
|
67696
|
+
|
|
67697
|
+
if (intercept === 0 && gradient === 1 && source_item_size === 4) {
|
|
67698
|
+
// already in the right format, use shortcut
|
|
67699
|
+
output.data.set(input.data);
|
|
67700
|
+
return;
|
|
67701
|
+
}
|
|
67702
|
+
|
|
67703
|
+
if (source_item_size === 1) {
|
|
67704
|
+
|
|
67705
|
+
// grayscale
|
|
67706
|
+
|
|
67707
|
+
sampler2d_channel_linear_transform(output, input, 0, 0, gradient, intercept);
|
|
67708
|
+
sampler2d_channel_linear_transform(output, input, 1, 0, gradient, intercept);
|
|
67709
|
+
sampler2d_channel_linear_transform(output, input, 2, 0, gradient, intercept);
|
|
67710
|
+
|
|
67711
|
+
output.channelFill(3, 255);
|
|
67712
|
+
|
|
67713
|
+
} else if (source_item_size === 2) {
|
|
67714
|
+
|
|
67715
|
+
// grayscale with alpha
|
|
67716
|
+
|
|
67717
|
+
sampler2d_channel_linear_transform(output, input, 0, 0, gradient, intercept);
|
|
67718
|
+
sampler2d_channel_linear_transform(output, input, 1, 0, gradient, intercept);
|
|
67719
|
+
sampler2d_channel_linear_transform(output, input, 2, 0, gradient, intercept);
|
|
67720
|
+
sampler2d_channel_linear_transform(output, input, 3, 1, gradient, intercept);
|
|
67721
|
+
|
|
67722
|
+
} else if (source_item_size === 3) {
|
|
67723
|
+
|
|
67724
|
+
// RGB
|
|
67725
|
+
|
|
67726
|
+
sampler2d_channel_linear_transform(output, input, 0, 0, gradient, intercept);
|
|
67727
|
+
sampler2d_channel_linear_transform(output, input, 1, 1, gradient, intercept);
|
|
67728
|
+
sampler2d_channel_linear_transform(output, input, 2, 2, gradient, intercept);
|
|
67729
|
+
|
|
67730
|
+
output.channelFill(3, 255);
|
|
67731
|
+
|
|
67732
|
+
} else if (source_item_size === 4) {
|
|
67733
|
+
|
|
67734
|
+
// RGBA
|
|
67735
|
+
|
|
67736
|
+
sampler2d_channel_linear_transform(output, input, 0, 0, gradient, intercept);
|
|
67737
|
+
sampler2d_channel_linear_transform(output, input, 1, 1, gradient, intercept);
|
|
67738
|
+
sampler2d_channel_linear_transform(output, input, 2, 2, gradient, intercept);
|
|
67739
|
+
sampler2d_channel_linear_transform(output, input, 3, 3, gradient, intercept);
|
|
67740
|
+
|
|
67741
|
+
}
|
|
67742
|
+
}
|
|
67743
|
+
|
|
67744
|
+
/**
|
|
67745
|
+
*
|
|
67746
|
+
* @param {Sampler2D} input
|
|
67747
|
+
* @returns {Sampler2D}
|
|
67748
|
+
*/
|
|
67749
|
+
function sampler2d_ensure_uint8_RGBA(input) {
|
|
67750
|
+
if (
|
|
67751
|
+
input.itemSize === 4
|
|
67752
|
+
&& (input.data.constructor === Uint8Array || input.data.constructor === Uint8ClampedArray)
|
|
67753
|
+
) {
|
|
67754
|
+
return input;
|
|
67755
|
+
}
|
|
67756
|
+
|
|
67757
|
+
const resampled = Sampler2D.uint8(4, input.width, input.height);
|
|
67758
|
+
|
|
67759
|
+
sampler2d_to_uint8_RGBA(resampled, input);
|
|
67760
|
+
|
|
67761
|
+
return resampled;
|
|
67762
|
+
}
|
|
67763
|
+
|
|
67506
67764
|
const DEFAULT_TEXTURE_WIDTH = 512;
|
|
67507
67765
|
const DEFAULT_TEXTURE_HEIGHT = 512;
|
|
67508
67766
|
|
|
@@ -67523,6 +67781,8 @@ function convertTexture2Sampler2D(
|
|
|
67523
67781
|
let _height = height;
|
|
67524
67782
|
let _width = width;
|
|
67525
67783
|
|
|
67784
|
+
const channel_count = formatToChannelCount(texture.format);
|
|
67785
|
+
|
|
67526
67786
|
// TODO take channel count into account
|
|
67527
67787
|
|
|
67528
67788
|
if (_width === undefined || _height === undefined) {
|
|
@@ -67557,34 +67817,57 @@ function convertTexture2Sampler2D(
|
|
|
67557
67817
|
|
|
67558
67818
|
}
|
|
67559
67819
|
|
|
67560
|
-
// TODO add special case for DataTexture
|
|
67561
67820
|
|
|
67562
|
-
|
|
67821
|
+
let data;
|
|
67563
67822
|
|
|
67564
|
-
|
|
67823
|
+
if (texture.isDataTexture === true) {
|
|
67565
67824
|
|
|
67566
|
-
//
|
|
67567
|
-
|
|
67825
|
+
// special case
|
|
67826
|
+
|
|
67827
|
+
const source = new Sampler2D(texture.image.data, channel_count, texture.image.width, texture.image.height);
|
|
67828
|
+
|
|
67829
|
+
let converted = sampler2d_ensure_uint8_RGBA(source);
|
|
67830
|
+
|
|
67831
|
+
if (converted.width !== _width || converted.height !== _height) {
|
|
67832
|
+
const target = Sampler2D.uint8(4, _width, _height);
|
|
67833
|
+
|
|
67834
|
+
sampler2d_scale(converted, target);
|
|
67835
|
+
|
|
67836
|
+
converted = target;
|
|
67837
|
+
}
|
|
67838
|
+
|
|
67839
|
+
data = converted.data;
|
|
67840
|
+
|
|
67841
|
+
} else {
|
|
67842
|
+
const built = WebGLRendererPool.global.use(renderer => {
|
|
67843
|
+
|
|
67844
|
+
const ctx = renderer.getContext();
|
|
67845
|
+
|
|
67846
|
+
//support for compressed textures
|
|
67847
|
+
ctx.getExtension("WEBGL_compressed_texture_s3tc");
|
|
67848
|
+
|
|
67849
|
+
return processTexture(renderer, _width, _height, {
|
|
67850
|
+
vertexShader: CopyShader.vertexShader,
|
|
67851
|
+
fragmentShader: CopyShader.fragmentShader,
|
|
67852
|
+
uniforms: {
|
|
67853
|
+
tDiffuse: {
|
|
67854
|
+
value: texture,
|
|
67855
|
+
type: 't'
|
|
67856
|
+
},
|
|
67857
|
+
opacity: { value: 1.0 }
|
|
67858
|
+
}
|
|
67859
|
+
});
|
|
67568
67860
|
|
|
67569
|
-
return processTexture(renderer, _width, _height, {
|
|
67570
|
-
vertexShader: CopyShader.vertexShader,
|
|
67571
|
-
fragmentShader: CopyShader.fragmentShader,
|
|
67572
|
-
uniforms: {
|
|
67573
|
-
tDiffuse: {
|
|
67574
|
-
value: texture,
|
|
67575
|
-
type: 't'
|
|
67576
|
-
},
|
|
67577
|
-
opacity: { value: 1.0 }
|
|
67578
|
-
}
|
|
67579
67861
|
});
|
|
67580
67862
|
|
|
67581
|
-
|
|
67863
|
+
data = built.array;
|
|
67864
|
+
}
|
|
67582
67865
|
|
|
67583
67866
|
if (flipY) {
|
|
67584
|
-
|
|
67867
|
+
sampler2d_flipY_in_place(data, _width, _height);
|
|
67585
67868
|
}
|
|
67586
67869
|
|
|
67587
|
-
return new Sampler2D(
|
|
67870
|
+
return new Sampler2D(data, 4, _width, _height);
|
|
67588
67871
|
}
|
|
67589
67872
|
|
|
67590
67873
|
/**
|
|
@@ -74777,7 +75060,7 @@ class SGMeshSystem extends System {
|
|
|
74777
75060
|
}
|
|
74778
75061
|
}
|
|
74779
75062
|
|
|
74780
|
-
const stack$
|
|
75063
|
+
const stack$4 = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
74781
75064
|
|
|
74782
75065
|
/**
|
|
74783
75066
|
*
|
|
@@ -74801,20 +75084,20 @@ function bvh_query_leaves_generic(
|
|
|
74801
75084
|
*
|
|
74802
75085
|
* @type {number}
|
|
74803
75086
|
*/
|
|
74804
|
-
const stack_top = stack$
|
|
75087
|
+
const stack_top = stack$4.pointer++;
|
|
74805
75088
|
|
|
74806
|
-
stack$
|
|
75089
|
+
stack$4[stack_top] = root;
|
|
74807
75090
|
|
|
74808
75091
|
let result_cursor = result_offset;
|
|
74809
75092
|
|
|
74810
|
-
while (stack$
|
|
74811
|
-
stack$
|
|
75093
|
+
while (stack$4.pointer > stack_top) {
|
|
75094
|
+
stack$4.pointer--;
|
|
74812
75095
|
|
|
74813
75096
|
/**
|
|
74814
75097
|
*
|
|
74815
75098
|
* @type {number}
|
|
74816
75099
|
*/
|
|
74817
|
-
const node = stack$
|
|
75100
|
+
const node = stack$4[stack$4.pointer];
|
|
74818
75101
|
|
|
74819
75102
|
// test node against the ray
|
|
74820
75103
|
const pass = query.evaluate(node, bvh);
|
|
@@ -74832,8 +75115,8 @@ function bvh_query_leaves_generic(
|
|
|
74832
75115
|
const child2 = bvh.node_get_child2(node);
|
|
74833
75116
|
|
|
74834
75117
|
// write to stack in reverse order, so that fist child ends up being visited first
|
|
74835
|
-
stack$
|
|
74836
|
-
stack$
|
|
75118
|
+
stack$4[stack$4.pointer++] = child2;
|
|
75119
|
+
stack$4[stack$4.pointer++] = child1;
|
|
74837
75120
|
|
|
74838
75121
|
} else {
|
|
74839
75122
|
// leaf node
|
|
@@ -75141,85 +75424,11 @@ class RuntimeDrawMethodOptimizer {
|
|
|
75141
75424
|
}
|
|
75142
75425
|
}
|
|
75143
75426
|
|
|
75144
|
-
const stack$
|
|
75427
|
+
const stack$3 = [];
|
|
75145
75428
|
|
|
75146
75429
|
/**
|
|
75147
75430
|
* @template T
|
|
75148
|
-
* @param {T[]|
|
|
75149
|
-
* @param {function(T):number} score_function
|
|
75150
|
-
* @param {*} score_function_context
|
|
75151
|
-
* @param {number} start
|
|
75152
|
-
* @param {number} end
|
|
75153
|
-
* @param {function(T[],number, number):*} [swap_operator]
|
|
75154
|
-
* @param {*} [swap_context]
|
|
75155
|
-
*/
|
|
75156
|
-
function arrayQuickSort(
|
|
75157
|
-
data,
|
|
75158
|
-
score_function, score_function_context,
|
|
75159
|
-
start, end,
|
|
75160
|
-
swap_operator = array_swap_one, swap_context = undefined
|
|
75161
|
-
) {
|
|
75162
|
-
if (start >= end) {
|
|
75163
|
-
// section of 0 size, nothing to sort
|
|
75164
|
-
return;
|
|
75165
|
-
}
|
|
75166
|
-
|
|
75167
|
-
let stackPointer = 2;
|
|
75168
|
-
let i, j;
|
|
75169
|
-
|
|
75170
|
-
stack$2[0] = start;
|
|
75171
|
-
stack$2[1] = end;
|
|
75172
|
-
|
|
75173
|
-
while (stackPointer > 0) {
|
|
75174
|
-
stackPointer -= 2;
|
|
75175
|
-
|
|
75176
|
-
const right = stack$2[stackPointer + 1];
|
|
75177
|
-
const left = stack$2[stackPointer];
|
|
75178
|
-
|
|
75179
|
-
i = left;
|
|
75180
|
-
j = right;
|
|
75181
|
-
|
|
75182
|
-
const pivotIndex = (left + right) >> 1;
|
|
75183
|
-
|
|
75184
|
-
const pivot = score_function.call(score_function_context, data[pivotIndex]);
|
|
75185
|
-
|
|
75186
|
-
/* partition */
|
|
75187
|
-
while (i <= j) {
|
|
75188
|
-
while (score_function.call(score_function_context, data[i]) < pivot) {
|
|
75189
|
-
i++;
|
|
75190
|
-
}
|
|
75191
|
-
|
|
75192
|
-
while (score_function.call(score_function_context, data[j]) > pivot) {
|
|
75193
|
-
j--;
|
|
75194
|
-
}
|
|
75195
|
-
|
|
75196
|
-
if (i <= j) {
|
|
75197
|
-
|
|
75198
|
-
if (i !== j) {
|
|
75199
|
-
//do swap
|
|
75200
|
-
swap_operator.call(swap_context, data, i, j);
|
|
75201
|
-
}
|
|
75202
|
-
|
|
75203
|
-
i++;
|
|
75204
|
-
j--;
|
|
75205
|
-
}
|
|
75206
|
-
}
|
|
75207
|
-
|
|
75208
|
-
/* recursion */
|
|
75209
|
-
if (left < j) {
|
|
75210
|
-
stack$2[stackPointer++] = left;
|
|
75211
|
-
stack$2[stackPointer++] = j;
|
|
75212
|
-
}
|
|
75213
|
-
if (i < right) {
|
|
75214
|
-
stack$2[stackPointer++] = i;
|
|
75215
|
-
stack$2[stackPointer++] = right;
|
|
75216
|
-
}
|
|
75217
|
-
}
|
|
75218
|
-
}
|
|
75219
|
-
|
|
75220
|
-
/**
|
|
75221
|
-
* @template T
|
|
75222
|
-
* @param {T[]} data
|
|
75431
|
+
* @param {T[]|Uint32Array} data
|
|
75223
75432
|
* @param {function(T,T):number} compare_function
|
|
75224
75433
|
* @param {*} compare_function_context
|
|
75225
75434
|
* @param {number} start
|
|
@@ -75238,14 +75447,14 @@ function array_quick_sort_by_comparator(
|
|
|
75238
75447
|
let stackPointer = 2;
|
|
75239
75448
|
let i, j;
|
|
75240
75449
|
|
|
75241
|
-
stack$
|
|
75242
|
-
stack$
|
|
75450
|
+
stack$3[0] = start;
|
|
75451
|
+
stack$3[1] = end;
|
|
75243
75452
|
|
|
75244
75453
|
while (stackPointer > 0) {
|
|
75245
75454
|
stackPointer -= 2;
|
|
75246
75455
|
|
|
75247
|
-
const right = stack$
|
|
75248
|
-
const left = stack$
|
|
75456
|
+
const right = stack$3[stackPointer + 1];
|
|
75457
|
+
const left = stack$3[stackPointer];
|
|
75249
75458
|
|
|
75250
75459
|
i = left;
|
|
75251
75460
|
j = right;
|
|
@@ -75281,12 +75490,12 @@ function array_quick_sort_by_comparator(
|
|
|
75281
75490
|
|
|
75282
75491
|
/* recursion */
|
|
75283
75492
|
if (left < j) {
|
|
75284
|
-
stack$
|
|
75285
|
-
stack$
|
|
75493
|
+
stack$3[stackPointer++] = left;
|
|
75494
|
+
stack$3[stackPointer++] = j;
|
|
75286
75495
|
}
|
|
75287
75496
|
if (i < right) {
|
|
75288
|
-
stack$
|
|
75289
|
-
stack$
|
|
75497
|
+
stack$3[stackPointer++] = i;
|
|
75498
|
+
stack$3[stackPointer++] = right;
|
|
75290
75499
|
}
|
|
75291
75500
|
}
|
|
75292
75501
|
}
|
|
@@ -76207,6 +76416,12 @@ function textureImagesEqual(a, b) {
|
|
|
76207
76416
|
|
|
76208
76417
|
}
|
|
76209
76418
|
|
|
76419
|
+
if (isTypedArray(a.data) && isTypedArray(b.data)) {
|
|
76420
|
+
if (!textureMipmapEqual(a, b)) {
|
|
76421
|
+
return false;
|
|
76422
|
+
}
|
|
76423
|
+
}
|
|
76424
|
+
|
|
76210
76425
|
// assume equivalent
|
|
76211
76426
|
return true;
|
|
76212
76427
|
}
|
|
@@ -88152,7 +88367,7 @@ class ColorAndDepthFrameBuffer extends FrameBuffer {
|
|
|
88152
88367
|
}
|
|
88153
88368
|
}
|
|
88154
88369
|
|
|
88155
|
-
const stack$
|
|
88370
|
+
const stack$2 = [];
|
|
88156
88371
|
|
|
88157
88372
|
class ThreeBypassRenderer {
|
|
88158
88373
|
constructor() {
|
|
@@ -88229,13 +88444,13 @@ class ThreeBypassRenderer {
|
|
|
88229
88444
|
const object3D = input[i];
|
|
88230
88445
|
|
|
88231
88446
|
if (input_filter(object3D)) {
|
|
88232
|
-
stack$
|
|
88447
|
+
stack$2[stack_top++] = object3D;
|
|
88233
88448
|
}
|
|
88234
88449
|
|
|
88235
88450
|
}
|
|
88236
88451
|
|
|
88237
88452
|
while (stack_top > 0) {
|
|
88238
|
-
const object3D = stack$
|
|
88453
|
+
const object3D = stack$2[--stack_top];
|
|
88239
88454
|
|
|
88240
88455
|
if (
|
|
88241
88456
|
object_filter(object3D)
|
|
@@ -88274,7 +88489,7 @@ class ThreeBypassRenderer {
|
|
|
88274
88489
|
for (i = 0; i < child_count; i++) {
|
|
88275
88490
|
const child = children[i];
|
|
88276
88491
|
|
|
88277
|
-
stack$
|
|
88492
|
+
stack$2[stack_top++] = child;
|
|
88278
88493
|
}
|
|
88279
88494
|
}
|
|
88280
88495
|
|
|
@@ -105798,6 +106013,82 @@ function computeBinaryDataTypeByPrecision(type, precision) {
|
|
|
105798
106013
|
throw new Error(`Unsupported numeric type(=${type}) and precision(=${precision}) combination`);
|
|
105799
106014
|
}
|
|
105800
106015
|
|
|
106016
|
+
const stack$1 = [];
|
|
106017
|
+
|
|
106018
|
+
/**
|
|
106019
|
+
* @template T
|
|
106020
|
+
* @param {T[]|ArrayLike<number>|Uint32Array} data
|
|
106021
|
+
* @param {function(T):number} score_function
|
|
106022
|
+
* @param {*} score_function_context
|
|
106023
|
+
* @param {number} start
|
|
106024
|
+
* @param {number} end
|
|
106025
|
+
* @param {function(T[],number, number):*} [swap_operator]
|
|
106026
|
+
* @param {*} [swap_context]
|
|
106027
|
+
*/
|
|
106028
|
+
function arrayQuickSort(
|
|
106029
|
+
data,
|
|
106030
|
+
score_function, score_function_context,
|
|
106031
|
+
start, end,
|
|
106032
|
+
swap_operator = array_swap_one, swap_context = undefined
|
|
106033
|
+
) {
|
|
106034
|
+
if (start >= end) {
|
|
106035
|
+
// section of 0 size, nothing to sort
|
|
106036
|
+
return;
|
|
106037
|
+
}
|
|
106038
|
+
|
|
106039
|
+
let stackPointer = 2;
|
|
106040
|
+
let i, j;
|
|
106041
|
+
|
|
106042
|
+
stack$1[0] = start;
|
|
106043
|
+
stack$1[1] = end;
|
|
106044
|
+
|
|
106045
|
+
while (stackPointer > 0) {
|
|
106046
|
+
stackPointer -= 2;
|
|
106047
|
+
|
|
106048
|
+
const right = stack$1[stackPointer + 1];
|
|
106049
|
+
const left = stack$1[stackPointer];
|
|
106050
|
+
|
|
106051
|
+
i = left;
|
|
106052
|
+
j = right;
|
|
106053
|
+
|
|
106054
|
+
const pivotIndex = (left + right) >> 1;
|
|
106055
|
+
|
|
106056
|
+
const pivot = score_function.call(score_function_context, data[pivotIndex]);
|
|
106057
|
+
|
|
106058
|
+
/* partition */
|
|
106059
|
+
while (i <= j) {
|
|
106060
|
+
while (score_function.call(score_function_context, data[i]) < pivot) {
|
|
106061
|
+
i++;
|
|
106062
|
+
}
|
|
106063
|
+
|
|
106064
|
+
while (score_function.call(score_function_context, data[j]) > pivot) {
|
|
106065
|
+
j--;
|
|
106066
|
+
}
|
|
106067
|
+
|
|
106068
|
+
if (i <= j) {
|
|
106069
|
+
|
|
106070
|
+
if (i !== j) {
|
|
106071
|
+
//do swap
|
|
106072
|
+
swap_operator.call(swap_context, data, i, j);
|
|
106073
|
+
}
|
|
106074
|
+
|
|
106075
|
+
i++;
|
|
106076
|
+
j--;
|
|
106077
|
+
}
|
|
106078
|
+
}
|
|
106079
|
+
|
|
106080
|
+
/* recursion */
|
|
106081
|
+
if (left < j) {
|
|
106082
|
+
stack$1[stackPointer++] = left;
|
|
106083
|
+
stack$1[stackPointer++] = j;
|
|
106084
|
+
}
|
|
106085
|
+
if (i < right) {
|
|
106086
|
+
stack$1[stackPointer++] = i;
|
|
106087
|
+
stack$1[stackPointer++] = right;
|
|
106088
|
+
}
|
|
106089
|
+
}
|
|
106090
|
+
}
|
|
106091
|
+
|
|
105801
106092
|
/**
|
|
105802
106093
|
*
|
|
105803
106094
|
* @param {number[]|Float32Array|Float64Array} source
|