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