@woosh/meep-engine 2.108.2 → 2.108.4
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 +490 -193
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +490 -193
- 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/formatToChannelCount.d.ts.map +1 -1
- package/src/engine/graphics/texture/formatToChannelCount.js +8 -1
- 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
|
@@ -5464,7 +5464,7 @@ const UnsignedShort5551Type = 1018;
|
|
|
5464
5464
|
const UnsignedShort565Type = 1019;
|
|
5465
5465
|
const UnsignedInt248Type = 1020;
|
|
5466
5466
|
const AlphaFormat = 1021;
|
|
5467
|
-
const RGBFormat = 1022;
|
|
5467
|
+
const RGBFormat$1 = 1022;
|
|
5468
5468
|
const RGBAFormat = 1023;
|
|
5469
5469
|
const LuminanceFormat = 1024;
|
|
5470
5470
|
const LuminanceAlphaFormat = 1025;
|
|
@@ -23396,7 +23396,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
23396
23396
|
( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',
|
|
23397
23397
|
|
|
23398
23398
|
parameters.dithering ? '#define DITHERING' : '',
|
|
23399
|
-
parameters.format === RGBFormat ? '#define OPAQUE' : '',
|
|
23399
|
+
parameters.format === RGBFormat$1 ? '#define OPAQUE' : '',
|
|
23400
23400
|
|
|
23401
23401
|
ShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
|
|
23402
23402
|
parameters.map ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '',
|
|
@@ -27494,7 +27494,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
27494
27494
|
|
|
27495
27495
|
mipmap = mipmaps[ i ];
|
|
27496
27496
|
|
|
27497
|
-
if ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) {
|
|
27497
|
+
if ( texture.format !== RGBAFormat && texture.format !== RGBFormat$1 ) {
|
|
27498
27498
|
|
|
27499
27499
|
if ( glFormat !== null ) {
|
|
27500
27500
|
|
|
@@ -27705,7 +27705,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
27705
27705
|
|
|
27706
27706
|
const mipmap = mipmaps[ j ];
|
|
27707
27707
|
|
|
27708
|
-
if ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) {
|
|
27708
|
+
if ( texture.format !== RGBAFormat && texture.format !== RGBFormat$1 ) {
|
|
27709
27709
|
|
|
27710
27710
|
if ( glFormat !== null ) {
|
|
27711
27711
|
|
|
@@ -28122,7 +28122,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
28122
28122
|
|
|
28123
28123
|
// Handles WebGL2 RGBFormat fallback - #18858
|
|
28124
28124
|
|
|
28125
|
-
if ( isWebGL2 && texture.format === RGBFormat && ( texture.type === FloatType || texture.type === HalfFloatType ) ) {
|
|
28125
|
+
if ( isWebGL2 && texture.format === RGBFormat$1 && ( texture.type === FloatType || texture.type === HalfFloatType ) ) {
|
|
28126
28126
|
|
|
28127
28127
|
texture.format = RGBAFormat;
|
|
28128
28128
|
|
|
@@ -28467,7 +28467,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
28467
28467
|
}
|
|
28468
28468
|
|
|
28469
28469
|
if ( p === AlphaFormat ) return 6406;
|
|
28470
|
-
if ( p === RGBFormat ) return 6407;
|
|
28470
|
+
if ( p === RGBFormat$1 ) return 6407;
|
|
28471
28471
|
if ( p === RGBAFormat ) return 6408;
|
|
28472
28472
|
if ( p === LuminanceFormat ) return 6409;
|
|
28473
28473
|
if ( p === LuminanceAlphaFormat ) return 6410;
|
|
@@ -29262,7 +29262,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
29262
29262
|
glProjLayer.textureWidth,
|
|
29263
29263
|
glProjLayer.textureHeight,
|
|
29264
29264
|
{
|
|
29265
|
-
format: attributes.alpha ? RGBAFormat : RGBFormat,
|
|
29265
|
+
format: attributes.alpha ? RGBAFormat : RGBFormat$1,
|
|
29266
29266
|
type: UnsignedByteType,
|
|
29267
29267
|
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
29268
29268
|
stencilBuffer: attributes.stencil,
|
|
@@ -34187,7 +34187,7 @@ class VideoTexture extends Texture {
|
|
|
34187
34187
|
|
|
34188
34188
|
super( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
|
|
34189
34189
|
|
|
34190
|
-
this.format = format !== undefined ? format : RGBFormat;
|
|
34190
|
+
this.format = format !== undefined ? format : RGBFormat$1;
|
|
34191
34191
|
|
|
34192
34192
|
this.minFilter = minFilter !== undefined ? minFilter : LinearFilter;
|
|
34193
34193
|
this.magFilter = magFilter !== undefined ? magFilter : LinearFilter;
|
|
@@ -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
|
}
|
|
@@ -58954,7 +58964,7 @@ function writeSample2DDataToDataTexture(sampler, texture) {
|
|
|
58954
58964
|
throw new Error('itemSize is 2 and texture.format is not RGFormat');
|
|
58955
58965
|
}
|
|
58956
58966
|
} else if (sampler.itemSize === 3) {
|
|
58957
|
-
if (texture.format !== RGBFormat) {
|
|
58967
|
+
if (texture.format !== RGBFormat$1) {
|
|
58958
58968
|
throw new Error('itemSize is 2 and texture.format is not RGBFormat');
|
|
58959
58969
|
}
|
|
58960
58970
|
} else if (sampler.itemSize === 4) {
|
|
@@ -59178,7 +59188,7 @@ function channelCountToThreeTextureFormat(count) {
|
|
|
59178
59188
|
case 2:
|
|
59179
59189
|
return RGFormat;
|
|
59180
59190
|
case 3:
|
|
59181
|
-
return RGBFormat;
|
|
59191
|
+
return RGBFormat$1;
|
|
59182
59192
|
case 4:
|
|
59183
59193
|
return RGBAFormat;
|
|
59184
59194
|
default:
|
|
@@ -62733,7 +62743,7 @@ class TerrainLayers {
|
|
|
62733
62743
|
* @type {DataTexture2DArray}
|
|
62734
62744
|
*/
|
|
62735
62745
|
this.texture = new DataTexture2DArray(new Uint8Array(3), 1, 1, 1);
|
|
62736
|
-
this.texture.format = RGBFormat;
|
|
62746
|
+
this.texture.format = RGBFormat$1;
|
|
62737
62747
|
this.texture.type = UnsignedByteType;
|
|
62738
62748
|
|
|
62739
62749
|
this.texture.wrapS = RepeatWrapping;
|
|
@@ -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,241 @@ const CopyShader = {
|
|
|
67505
67534
|
|
|
67506
67535
|
};
|
|
67507
67536
|
|
|
67537
|
+
/**
|
|
67538
|
+
* WebGL constant, declared explicitly to avoid issues with later THREE.js versions where it is absent
|
|
67539
|
+
* @type {number}
|
|
67540
|
+
*/
|
|
67541
|
+
const RGBFormat = 1022;
|
|
67542
|
+
|
|
67543
|
+
/**
|
|
67544
|
+
*
|
|
67545
|
+
* @param {number} format
|
|
67546
|
+
* @returns {number}
|
|
67547
|
+
*/
|
|
67548
|
+
function formatToChannelCount(format) {
|
|
67549
|
+
switch (format) {
|
|
67550
|
+
case RedFormat:
|
|
67551
|
+
case RedIntegerFormat:
|
|
67552
|
+
return 1;
|
|
67553
|
+
case RGFormat:
|
|
67554
|
+
return 2;
|
|
67555
|
+
case RGBFormat:
|
|
67556
|
+
return 3;
|
|
67557
|
+
case RGBAFormat:
|
|
67558
|
+
return 4;
|
|
67559
|
+
default:
|
|
67560
|
+
throw new Error(`Unsupported format '${format}'`);
|
|
67561
|
+
}
|
|
67562
|
+
}
|
|
67563
|
+
|
|
67564
|
+
/**
|
|
67565
|
+
*
|
|
67566
|
+
* @param {Uint8Array|Uint16Array|Uint32Array|Int8Array|Int16Array|Int32Array} array
|
|
67567
|
+
* @return {boolean}
|
|
67568
|
+
*/
|
|
67569
|
+
function typed_array_is_integer(array) {
|
|
67570
|
+
const ctor = array.constructor;
|
|
67571
|
+
|
|
67572
|
+
return ctor === Uint8ClampedArray
|
|
67573
|
+
|| ctor === Uint8Array
|
|
67574
|
+
|| ctor === Uint16Array
|
|
67575
|
+
|| ctor === Uint32Array
|
|
67576
|
+
|| ctor === Int8Array
|
|
67577
|
+
|| ctor === Int16Array
|
|
67578
|
+
|| ctor === Int32Array
|
|
67579
|
+
;
|
|
67580
|
+
}
|
|
67581
|
+
|
|
67582
|
+
/**
|
|
67583
|
+
* Applies a linear polynomial transform to each value of a given channel
|
|
67584
|
+
* @param {Sampler2D} output
|
|
67585
|
+
* @param {Sampler2D} input
|
|
67586
|
+
* @param {number} output_channel_index
|
|
67587
|
+
* @param {number} input_channel_index
|
|
67588
|
+
* @param {number} gradient
|
|
67589
|
+
* @param {number} intercept
|
|
67590
|
+
*/
|
|
67591
|
+
function sampler2d_channel_linear_transform(
|
|
67592
|
+
output, input,
|
|
67593
|
+
output_channel_index, input_channel_index,
|
|
67594
|
+
gradient, intercept
|
|
67595
|
+
) {
|
|
67596
|
+
|
|
67597
|
+
const input_width = input.width;
|
|
67598
|
+
const input_height = input.height;
|
|
67599
|
+
|
|
67600
|
+
const output_width = output.width;
|
|
67601
|
+
const output_height = output.height;
|
|
67602
|
+
|
|
67603
|
+
if (
|
|
67604
|
+
input_width !== output_width
|
|
67605
|
+
|| input_height !== output_height
|
|
67606
|
+
) {
|
|
67607
|
+
throw new Error('Dimensions of input and output are incompatible');
|
|
67608
|
+
}
|
|
67609
|
+
|
|
67610
|
+
const input_item_size = input.itemSize;
|
|
67611
|
+
const output_item_size = output.itemSize;
|
|
67612
|
+
|
|
67613
|
+
const input_data = input.data;
|
|
67614
|
+
const output_data = output.data;
|
|
67615
|
+
|
|
67616
|
+
const pixel_count = input_width * input_height;
|
|
67617
|
+
|
|
67618
|
+
|
|
67619
|
+
if (typed_array_is_integer(output_data)) {
|
|
67620
|
+
|
|
67621
|
+
for (let i = 0; i < pixel_count; i++) {
|
|
67622
|
+
|
|
67623
|
+
const input_address = i * input_item_size + input_channel_index;
|
|
67624
|
+
const output_address = i * output_item_size + output_channel_index;
|
|
67625
|
+
|
|
67626
|
+
const input_value = input_data[input_address];
|
|
67627
|
+
|
|
67628
|
+
output_data[output_address] = Math.round(input_value * gradient + intercept);
|
|
67629
|
+
|
|
67630
|
+
}
|
|
67631
|
+
|
|
67632
|
+
} else {
|
|
67633
|
+
|
|
67634
|
+
for (let i = 0; i < pixel_count; i++) {
|
|
67635
|
+
|
|
67636
|
+
const input_address = i * input_item_size + input_channel_index;
|
|
67637
|
+
const output_address = i * output_item_size + output_channel_index;
|
|
67638
|
+
|
|
67639
|
+
const input_value = input_data[input_address];
|
|
67640
|
+
|
|
67641
|
+
output_data[output_address] = input_value * gradient + intercept;
|
|
67642
|
+
|
|
67643
|
+
}
|
|
67644
|
+
|
|
67645
|
+
}
|
|
67646
|
+
|
|
67647
|
+
}
|
|
67648
|
+
|
|
67649
|
+
function compute_gradient_and_intercept_uint8(ctor) {
|
|
67650
|
+
let gradient = 1;
|
|
67651
|
+
let intercept = 0;
|
|
67652
|
+
|
|
67653
|
+
switch (ctor) {
|
|
67654
|
+
case Uint16Array:
|
|
67655
|
+
gradient = 0.0038910505836575876;
|
|
67656
|
+
break;
|
|
67657
|
+
case Uint32Array:
|
|
67658
|
+
gradient = 5.937181414556033e-8;
|
|
67659
|
+
break;
|
|
67660
|
+
case Int8Array:
|
|
67661
|
+
gradient = 1;
|
|
67662
|
+
intercept = 127;
|
|
67663
|
+
break
|
|
67664
|
+
case Int16Array:
|
|
67665
|
+
gradient = 0.0038910505836575876;
|
|
67666
|
+
intercept = 127;
|
|
67667
|
+
break;
|
|
67668
|
+
case Int32Array:
|
|
67669
|
+
gradient = 5.937181414556033e-8;
|
|
67670
|
+
intercept = 127;
|
|
67671
|
+
break
|
|
67672
|
+
case Float32Array:
|
|
67673
|
+
case Float64Array:
|
|
67674
|
+
gradient = 255;
|
|
67675
|
+
break;
|
|
67676
|
+
// do nothing;
|
|
67677
|
+
}
|
|
67678
|
+
|
|
67679
|
+
return {
|
|
67680
|
+
gradient, intercept
|
|
67681
|
+
}
|
|
67682
|
+
}
|
|
67683
|
+
|
|
67684
|
+
/**
|
|
67685
|
+
* Many applications work with 8bit RGBA images, this utility function converts a given input to that format
|
|
67686
|
+
* @param {Sampler2D} input
|
|
67687
|
+
* @param {Sampler2D} output
|
|
67688
|
+
*/
|
|
67689
|
+
function sampler2d_to_uint8_RGBA(output, input) {
|
|
67690
|
+
if (
|
|
67691
|
+
input.width !== output.width
|
|
67692
|
+
|| input.height !== output.height
|
|
67693
|
+
) {
|
|
67694
|
+
throw new Error('Dimensions of source and destination are incompatible');
|
|
67695
|
+
}
|
|
67696
|
+
|
|
67697
|
+
if (output.itemSize !== 4) {
|
|
67698
|
+
throw new Error(`Destination must have 4 channels exactly, instead got '${output.itemSize}'`);
|
|
67699
|
+
}
|
|
67700
|
+
|
|
67701
|
+
const { gradient, intercept } = compute_gradient_and_intercept_uint8(input.data.constructor);
|
|
67702
|
+
|
|
67703
|
+
const source_item_size = input.itemSize;
|
|
67704
|
+
|
|
67705
|
+
if (intercept === 0 && gradient === 1 && source_item_size === 4) {
|
|
67706
|
+
// already in the right format, use shortcut
|
|
67707
|
+
output.data.set(input.data);
|
|
67708
|
+
return;
|
|
67709
|
+
}
|
|
67710
|
+
|
|
67711
|
+
if (source_item_size === 1) {
|
|
67712
|
+
|
|
67713
|
+
// grayscale
|
|
67714
|
+
|
|
67715
|
+
sampler2d_channel_linear_transform(output, input, 0, 0, gradient, intercept);
|
|
67716
|
+
sampler2d_channel_linear_transform(output, input, 1, 0, gradient, intercept);
|
|
67717
|
+
sampler2d_channel_linear_transform(output, input, 2, 0, gradient, intercept);
|
|
67718
|
+
|
|
67719
|
+
output.channelFill(3, 255);
|
|
67720
|
+
|
|
67721
|
+
} else if (source_item_size === 2) {
|
|
67722
|
+
|
|
67723
|
+
// grayscale with alpha
|
|
67724
|
+
|
|
67725
|
+
sampler2d_channel_linear_transform(output, input, 0, 0, gradient, intercept);
|
|
67726
|
+
sampler2d_channel_linear_transform(output, input, 1, 0, gradient, intercept);
|
|
67727
|
+
sampler2d_channel_linear_transform(output, input, 2, 0, gradient, intercept);
|
|
67728
|
+
sampler2d_channel_linear_transform(output, input, 3, 1, gradient, intercept);
|
|
67729
|
+
|
|
67730
|
+
} else if (source_item_size === 3) {
|
|
67731
|
+
|
|
67732
|
+
// RGB
|
|
67733
|
+
|
|
67734
|
+
sampler2d_channel_linear_transform(output, input, 0, 0, gradient, intercept);
|
|
67735
|
+
sampler2d_channel_linear_transform(output, input, 1, 1, gradient, intercept);
|
|
67736
|
+
sampler2d_channel_linear_transform(output, input, 2, 2, gradient, intercept);
|
|
67737
|
+
|
|
67738
|
+
output.channelFill(3, 255);
|
|
67739
|
+
|
|
67740
|
+
} else if (source_item_size === 4) {
|
|
67741
|
+
|
|
67742
|
+
// RGBA
|
|
67743
|
+
|
|
67744
|
+
sampler2d_channel_linear_transform(output, input, 0, 0, gradient, intercept);
|
|
67745
|
+
sampler2d_channel_linear_transform(output, input, 1, 1, gradient, intercept);
|
|
67746
|
+
sampler2d_channel_linear_transform(output, input, 2, 2, gradient, intercept);
|
|
67747
|
+
sampler2d_channel_linear_transform(output, input, 3, 3, gradient, intercept);
|
|
67748
|
+
|
|
67749
|
+
}
|
|
67750
|
+
}
|
|
67751
|
+
|
|
67752
|
+
/**
|
|
67753
|
+
*
|
|
67754
|
+
* @param {Sampler2D} input
|
|
67755
|
+
* @returns {Sampler2D}
|
|
67756
|
+
*/
|
|
67757
|
+
function sampler2d_ensure_uint8_RGBA(input) {
|
|
67758
|
+
if (
|
|
67759
|
+
input.itemSize === 4
|
|
67760
|
+
&& (input.data.constructor === Uint8Array || input.data.constructor === Uint8ClampedArray)
|
|
67761
|
+
) {
|
|
67762
|
+
return input;
|
|
67763
|
+
}
|
|
67764
|
+
|
|
67765
|
+
const resampled = Sampler2D.uint8(4, input.width, input.height);
|
|
67766
|
+
|
|
67767
|
+
sampler2d_to_uint8_RGBA(resampled, input);
|
|
67768
|
+
|
|
67769
|
+
return resampled;
|
|
67770
|
+
}
|
|
67771
|
+
|
|
67508
67772
|
const DEFAULT_TEXTURE_WIDTH = 512;
|
|
67509
67773
|
const DEFAULT_TEXTURE_HEIGHT = 512;
|
|
67510
67774
|
|
|
@@ -67525,6 +67789,8 @@ function convertTexture2Sampler2D(
|
|
|
67525
67789
|
let _height = height;
|
|
67526
67790
|
let _width = width;
|
|
67527
67791
|
|
|
67792
|
+
const channel_count = formatToChannelCount(texture.format);
|
|
67793
|
+
|
|
67528
67794
|
// TODO take channel count into account
|
|
67529
67795
|
|
|
67530
67796
|
if (_width === undefined || _height === undefined) {
|
|
@@ -67559,34 +67825,57 @@ function convertTexture2Sampler2D(
|
|
|
67559
67825
|
|
|
67560
67826
|
}
|
|
67561
67827
|
|
|
67562
|
-
// TODO add special case for DataTexture
|
|
67563
67828
|
|
|
67564
|
-
|
|
67829
|
+
let data;
|
|
67565
67830
|
|
|
67566
|
-
|
|
67831
|
+
if (texture.isDataTexture === true) {
|
|
67567
67832
|
|
|
67568
|
-
//
|
|
67569
|
-
|
|
67833
|
+
// special case
|
|
67834
|
+
|
|
67835
|
+
const source = new Sampler2D(texture.image.data, channel_count, texture.image.width, texture.image.height);
|
|
67836
|
+
|
|
67837
|
+
let converted = sampler2d_ensure_uint8_RGBA(source);
|
|
67838
|
+
|
|
67839
|
+
if (converted.width !== _width || converted.height !== _height) {
|
|
67840
|
+
const target = Sampler2D.uint8(4, _width, _height);
|
|
67841
|
+
|
|
67842
|
+
sampler2d_scale(converted, target);
|
|
67843
|
+
|
|
67844
|
+
converted = target;
|
|
67845
|
+
}
|
|
67846
|
+
|
|
67847
|
+
data = converted.data;
|
|
67848
|
+
|
|
67849
|
+
} else {
|
|
67850
|
+
const built = WebGLRendererPool.global.use(renderer => {
|
|
67851
|
+
|
|
67852
|
+
const ctx = renderer.getContext();
|
|
67853
|
+
|
|
67854
|
+
//support for compressed textures
|
|
67855
|
+
ctx.getExtension("WEBGL_compressed_texture_s3tc");
|
|
67856
|
+
|
|
67857
|
+
return processTexture(renderer, _width, _height, {
|
|
67858
|
+
vertexShader: CopyShader.vertexShader,
|
|
67859
|
+
fragmentShader: CopyShader.fragmentShader,
|
|
67860
|
+
uniforms: {
|
|
67861
|
+
tDiffuse: {
|
|
67862
|
+
value: texture,
|
|
67863
|
+
type: 't'
|
|
67864
|
+
},
|
|
67865
|
+
opacity: { value: 1.0 }
|
|
67866
|
+
}
|
|
67867
|
+
});
|
|
67570
67868
|
|
|
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
67869
|
});
|
|
67582
67870
|
|
|
67583
|
-
|
|
67871
|
+
data = built.array;
|
|
67872
|
+
}
|
|
67584
67873
|
|
|
67585
67874
|
if (flipY) {
|
|
67586
|
-
|
|
67875
|
+
sampler2d_flipY_in_place(data, _width, _height);
|
|
67587
67876
|
}
|
|
67588
67877
|
|
|
67589
|
-
return new Sampler2D(
|
|
67878
|
+
return new Sampler2D(data, 4, _width, _height);
|
|
67590
67879
|
}
|
|
67591
67880
|
|
|
67592
67881
|
/**
|
|
@@ -74779,7 +75068,7 @@ class SGMeshSystem extends System {
|
|
|
74779
75068
|
}
|
|
74780
75069
|
}
|
|
74781
75070
|
|
|
74782
|
-
const stack$
|
|
75071
|
+
const stack$4 = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
74783
75072
|
|
|
74784
75073
|
/**
|
|
74785
75074
|
*
|
|
@@ -74803,20 +75092,20 @@ function bvh_query_leaves_generic(
|
|
|
74803
75092
|
*
|
|
74804
75093
|
* @type {number}
|
|
74805
75094
|
*/
|
|
74806
|
-
const stack_top = stack$
|
|
75095
|
+
const stack_top = stack$4.pointer++;
|
|
74807
75096
|
|
|
74808
|
-
stack$
|
|
75097
|
+
stack$4[stack_top] = root;
|
|
74809
75098
|
|
|
74810
75099
|
let result_cursor = result_offset;
|
|
74811
75100
|
|
|
74812
|
-
while (stack$
|
|
74813
|
-
stack$
|
|
75101
|
+
while (stack$4.pointer > stack_top) {
|
|
75102
|
+
stack$4.pointer--;
|
|
74814
75103
|
|
|
74815
75104
|
/**
|
|
74816
75105
|
*
|
|
74817
75106
|
* @type {number}
|
|
74818
75107
|
*/
|
|
74819
|
-
const node = stack$
|
|
75108
|
+
const node = stack$4[stack$4.pointer];
|
|
74820
75109
|
|
|
74821
75110
|
// test node against the ray
|
|
74822
75111
|
const pass = query.evaluate(node, bvh);
|
|
@@ -74834,8 +75123,8 @@ function bvh_query_leaves_generic(
|
|
|
74834
75123
|
const child2 = bvh.node_get_child2(node);
|
|
74835
75124
|
|
|
74836
75125
|
// write to stack in reverse order, so that fist child ends up being visited first
|
|
74837
|
-
stack$
|
|
74838
|
-
stack$
|
|
75126
|
+
stack$4[stack$4.pointer++] = child2;
|
|
75127
|
+
stack$4[stack$4.pointer++] = child1;
|
|
74839
75128
|
|
|
74840
75129
|
} else {
|
|
74841
75130
|
// leaf node
|
|
@@ -75143,85 +75432,11 @@ class RuntimeDrawMethodOptimizer {
|
|
|
75143
75432
|
}
|
|
75144
75433
|
}
|
|
75145
75434
|
|
|
75146
|
-
const stack$
|
|
75435
|
+
const stack$3 = [];
|
|
75147
75436
|
|
|
75148
75437
|
/**
|
|
75149
75438
|
* @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
|
|
75439
|
+
* @param {T[]|Uint32Array} data
|
|
75225
75440
|
* @param {function(T,T):number} compare_function
|
|
75226
75441
|
* @param {*} compare_function_context
|
|
75227
75442
|
* @param {number} start
|
|
@@ -75240,14 +75455,14 @@ function array_quick_sort_by_comparator(
|
|
|
75240
75455
|
let stackPointer = 2;
|
|
75241
75456
|
let i, j;
|
|
75242
75457
|
|
|
75243
|
-
stack$
|
|
75244
|
-
stack$
|
|
75458
|
+
stack$3[0] = start;
|
|
75459
|
+
stack$3[1] = end;
|
|
75245
75460
|
|
|
75246
75461
|
while (stackPointer > 0) {
|
|
75247
75462
|
stackPointer -= 2;
|
|
75248
75463
|
|
|
75249
|
-
const right = stack$
|
|
75250
|
-
const left = stack$
|
|
75464
|
+
const right = stack$3[stackPointer + 1];
|
|
75465
|
+
const left = stack$3[stackPointer];
|
|
75251
75466
|
|
|
75252
75467
|
i = left;
|
|
75253
75468
|
j = right;
|
|
@@ -75283,12 +75498,12 @@ function array_quick_sort_by_comparator(
|
|
|
75283
75498
|
|
|
75284
75499
|
/* recursion */
|
|
75285
75500
|
if (left < j) {
|
|
75286
|
-
stack$
|
|
75287
|
-
stack$
|
|
75501
|
+
stack$3[stackPointer++] = left;
|
|
75502
|
+
stack$3[stackPointer++] = j;
|
|
75288
75503
|
}
|
|
75289
75504
|
if (i < right) {
|
|
75290
|
-
stack$
|
|
75291
|
-
stack$
|
|
75505
|
+
stack$3[stackPointer++] = i;
|
|
75506
|
+
stack$3[stackPointer++] = right;
|
|
75292
75507
|
}
|
|
75293
75508
|
}
|
|
75294
75509
|
}
|
|
@@ -76209,6 +76424,12 @@ function textureImagesEqual(a, b) {
|
|
|
76209
76424
|
|
|
76210
76425
|
}
|
|
76211
76426
|
|
|
76427
|
+
if (isTypedArray(a.data) && isTypedArray(b.data)) {
|
|
76428
|
+
if (!textureMipmapEqual(a, b)) {
|
|
76429
|
+
return false;
|
|
76430
|
+
}
|
|
76431
|
+
}
|
|
76432
|
+
|
|
76212
76433
|
// assume equivalent
|
|
76213
76434
|
return true;
|
|
76214
76435
|
}
|
|
@@ -88135,7 +88356,7 @@ class ColorAndDepthFrameBuffer extends FrameBuffer {
|
|
|
88135
88356
|
|
|
88136
88357
|
const target = new WebGLMultisampleRenderTarget(size.x, size.y,{ignoreDepth: false});
|
|
88137
88358
|
|
|
88138
|
-
target.texture.format = RGBFormat; // note, three.js required RGBA render texture, even though RGB would do here
|
|
88359
|
+
target.texture.format = RGBFormat$1; // note, three.js required RGBA render texture, even though RGB would do here
|
|
88139
88360
|
target.texture.minFilter = NearestFilter;
|
|
88140
88361
|
target.texture.magFilter = NearestFilter;
|
|
88141
88362
|
target.texture.generateMipmaps = false;
|
|
@@ -88154,7 +88375,7 @@ class ColorAndDepthFrameBuffer extends FrameBuffer {
|
|
|
88154
88375
|
}
|
|
88155
88376
|
}
|
|
88156
88377
|
|
|
88157
|
-
const stack$
|
|
88378
|
+
const stack$2 = [];
|
|
88158
88379
|
|
|
88159
88380
|
class ThreeBypassRenderer {
|
|
88160
88381
|
constructor() {
|
|
@@ -88231,13 +88452,13 @@ class ThreeBypassRenderer {
|
|
|
88231
88452
|
const object3D = input[i];
|
|
88232
88453
|
|
|
88233
88454
|
if (input_filter(object3D)) {
|
|
88234
|
-
stack$
|
|
88455
|
+
stack$2[stack_top++] = object3D;
|
|
88235
88456
|
}
|
|
88236
88457
|
|
|
88237
88458
|
}
|
|
88238
88459
|
|
|
88239
88460
|
while (stack_top > 0) {
|
|
88240
|
-
const object3D = stack$
|
|
88461
|
+
const object3D = stack$2[--stack_top];
|
|
88241
88462
|
|
|
88242
88463
|
if (
|
|
88243
88464
|
object_filter(object3D)
|
|
@@ -88276,7 +88497,7 @@ class ThreeBypassRenderer {
|
|
|
88276
88497
|
for (i = 0; i < child_count; i++) {
|
|
88277
88498
|
const child = children[i];
|
|
88278
88499
|
|
|
88279
|
-
stack$
|
|
88500
|
+
stack$2[stack_top++] = child;
|
|
88280
88501
|
}
|
|
88281
88502
|
}
|
|
88282
88503
|
|
|
@@ -105800,6 +106021,82 @@ function computeBinaryDataTypeByPrecision(type, precision) {
|
|
|
105800
106021
|
throw new Error(`Unsupported numeric type(=${type}) and precision(=${precision}) combination`);
|
|
105801
106022
|
}
|
|
105802
106023
|
|
|
106024
|
+
const stack$1 = [];
|
|
106025
|
+
|
|
106026
|
+
/**
|
|
106027
|
+
* @template T
|
|
106028
|
+
* @param {T[]|ArrayLike<number>|Uint32Array} data
|
|
106029
|
+
* @param {function(T):number} score_function
|
|
106030
|
+
* @param {*} score_function_context
|
|
106031
|
+
* @param {number} start
|
|
106032
|
+
* @param {number} end
|
|
106033
|
+
* @param {function(T[],number, number):*} [swap_operator]
|
|
106034
|
+
* @param {*} [swap_context]
|
|
106035
|
+
*/
|
|
106036
|
+
function arrayQuickSort(
|
|
106037
|
+
data,
|
|
106038
|
+
score_function, score_function_context,
|
|
106039
|
+
start, end,
|
|
106040
|
+
swap_operator = array_swap_one, swap_context = undefined
|
|
106041
|
+
) {
|
|
106042
|
+
if (start >= end) {
|
|
106043
|
+
// section of 0 size, nothing to sort
|
|
106044
|
+
return;
|
|
106045
|
+
}
|
|
106046
|
+
|
|
106047
|
+
let stackPointer = 2;
|
|
106048
|
+
let i, j;
|
|
106049
|
+
|
|
106050
|
+
stack$1[0] = start;
|
|
106051
|
+
stack$1[1] = end;
|
|
106052
|
+
|
|
106053
|
+
while (stackPointer > 0) {
|
|
106054
|
+
stackPointer -= 2;
|
|
106055
|
+
|
|
106056
|
+
const right = stack$1[stackPointer + 1];
|
|
106057
|
+
const left = stack$1[stackPointer];
|
|
106058
|
+
|
|
106059
|
+
i = left;
|
|
106060
|
+
j = right;
|
|
106061
|
+
|
|
106062
|
+
const pivotIndex = (left + right) >> 1;
|
|
106063
|
+
|
|
106064
|
+
const pivot = score_function.call(score_function_context, data[pivotIndex]);
|
|
106065
|
+
|
|
106066
|
+
/* partition */
|
|
106067
|
+
while (i <= j) {
|
|
106068
|
+
while (score_function.call(score_function_context, data[i]) < pivot) {
|
|
106069
|
+
i++;
|
|
106070
|
+
}
|
|
106071
|
+
|
|
106072
|
+
while (score_function.call(score_function_context, data[j]) > pivot) {
|
|
106073
|
+
j--;
|
|
106074
|
+
}
|
|
106075
|
+
|
|
106076
|
+
if (i <= j) {
|
|
106077
|
+
|
|
106078
|
+
if (i !== j) {
|
|
106079
|
+
//do swap
|
|
106080
|
+
swap_operator.call(swap_context, data, i, j);
|
|
106081
|
+
}
|
|
106082
|
+
|
|
106083
|
+
i++;
|
|
106084
|
+
j--;
|
|
106085
|
+
}
|
|
106086
|
+
}
|
|
106087
|
+
|
|
106088
|
+
/* recursion */
|
|
106089
|
+
if (left < j) {
|
|
106090
|
+
stack$1[stackPointer++] = left;
|
|
106091
|
+
stack$1[stackPointer++] = j;
|
|
106092
|
+
}
|
|
106093
|
+
if (i < right) {
|
|
106094
|
+
stack$1[stackPointer++] = i;
|
|
106095
|
+
stack$1[stackPointer++] = right;
|
|
106096
|
+
}
|
|
106097
|
+
}
|
|
106098
|
+
}
|
|
106099
|
+
|
|
105803
106100
|
/**
|
|
105804
106101
|
*
|
|
105805
106102
|
* @param {number[]|Float32Array|Float64Array} source
|