@woosh/meep-engine 2.118.9 → 2.118.11
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 +192 -266
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +192 -266
- package/editor/ecs/component/editors/Sampler2DEditor.js +2 -4
- package/package.json +1 -1
- package/samples/terrain/editor.js +3 -3
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts +1 -19
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +10 -78
- package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +9 -7
- package/src/core/collection/array/isArrayEqualStrict.d.ts.map +1 -1
- package/src/core/collection/array/isArrayEqualStrict.js +2 -2
- package/src/core/collection/array/iterator/ArrayIteratorSequential.d.ts.map +1 -1
- package/src/core/collection/array/iterator/ArrayIteratorSequential.js +3 -4
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +1 -1
- package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +0 -8
- package/src/core/geom/3d/morton/{Morton.d.ts → v3_morton_encode.d.ts} +1 -1
- package/src/core/geom/3d/morton/v3_morton_encode.d.ts.map +1 -0
- package/src/core/geom/3d/morton/v3_morton_encode_bounded.js +2 -2
- package/src/core/geom/3d/morton/v3_morton_encode_transformed.js +2 -2
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +7 -10
- package/src/core/geom/Vector3.d.ts.map +1 -1
- package/src/core/geom/Vector3.js +4 -49
- package/src/core/math/sinc.d.ts +8 -0
- package/src/core/math/sinc.d.ts.map +1 -0
- package/src/core/math/sinc.js +13 -0
- package/src/core/process/worker/WorkerProxy.d.ts +12 -3
- package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
- package/src/core/process/worker/WorkerProxy.js +10 -1
- package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.d.ts +2 -17
- package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.d.ts.map +1 -1
- package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.js +2 -118
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.d.ts +0 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +1 -6
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts +5 -5
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js +20 -28
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +2 -2
- package/src/engine/ecs/terrain/tiles/TerrainTile.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +3 -1
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.d.ts +1 -1
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +12 -12
- package/src/engine/graphics/geometry/MikkT/STSpace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/STSpace.js +14 -16
- package/src/engine/graphics/geometry/buffered/build_height_field_geometry.d.ts +17 -0
- package/src/engine/graphics/geometry/buffered/build_height_field_geometry.d.ts.map +1 -0
- package/src/engine/graphics/geometry/buffered/build_height_field_geometry.js +118 -0
- package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.d.ts +2 -2
- package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.d.ts.map +1 -1
- package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.js +1 -1
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.d.ts.map +1 -1
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +2 -2
- package/src/engine/graphics/render/forward_plus/materials/FPlusDebugMaterial.js +3 -3
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +31 -52
- package/src/engine/graphics/texture/sampler/sampler2d_to_texture.d.ts +10 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_texture.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{Sampler2D2Texture.js → sampler2d_to_texture.js} +5 -5
- package/src/engine/graphics/texture/sampler/{copy_Sampler2D_channel_data.d.ts → sampler2d_transfer_data.d.ts} +2 -2
- package/src/engine/graphics/texture/sampler/sampler2d_transfer_data.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{copy_Sampler2D_channel_data.js → sampler2d_transfer_data.js} +1 -1
- package/src/engine/graphics/texture/sampler/writeSampler2DDataToDataTexture.js +2 -2
- package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.js +0 -3
- package/src/engine/intelligence/behavior/selector/WeightedElement.d.ts +6 -3
- package/src/engine/intelligence/behavior/selector/WeightedElement.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedElement.js +9 -12
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.js +20 -23
- package/src/engine/intelligence/mcts/StateNode.d.ts.map +1 -1
- package/src/engine/intelligence/mcts/StateNode.js +76 -102
- package/src/engine/logging/Logger.d.ts.map +1 -1
- package/src/engine/logging/Logger.js +7 -9
- package/src/engine/logging/LoggerBackend.d.ts.map +1 -1
- package/src/engine/logging/LoggerBackend.js +7 -7
- package/src/core/geom/3d/morton/Morton.d.ts.map +0 -1
- package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.d.ts +0 -9
- package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.d.ts.map +0 -1
- package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.js +0 -11
- package/src/engine/graphics/geometry/MikkT/m_getPosition.d.ts +0 -14
- package/src/engine/graphics/geometry/MikkT/m_getPosition.d.ts.map +0 -1
- package/src/engine/graphics/geometry/MikkT/m_getPosition.js +0 -20
- package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.d.ts +0 -21
- package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.d.ts.map +0 -1
- package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.js +0 -22
- package/src/engine/graphics/texture/sampler/Sampler2D2Texture.d.ts +0 -10
- package/src/engine/graphics/texture/sampler/Sampler2D2Texture.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.d.ts.map +0 -1
- /package/src/core/geom/3d/morton/{Morton.js → v3_morton_encode.js} +0 -0
package/build/meep.module.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* @param {Array|Uint8Array} a
|
|
4
|
-
* @param {Array|Uint8Array} b
|
|
3
|
+
* @param {Array|Uint8Array|Float32Array} a
|
|
4
|
+
* @param {Array|Uint8Array|Float32Array} b
|
|
5
5
|
* @returns {boolean}
|
|
6
6
|
*/
|
|
7
7
|
function isArrayEqualStrict(a, b) {
|
|
@@ -2531,10 +2531,10 @@ let Vector3$1 = class Vector3 {
|
|
|
2531
2531
|
* @param {number} [squaredError]
|
|
2532
2532
|
* @return {boolean}
|
|
2533
2533
|
*/
|
|
2534
|
-
isNormalized(squaredError =
|
|
2534
|
+
isNormalized(squaredError = 1e-5) {
|
|
2535
2535
|
const lengthSq = this.lengthSqr();
|
|
2536
2536
|
|
|
2537
|
-
return (lengthSq
|
|
2537
|
+
return epsilonEquals(lengthSq, 1, squaredError);
|
|
2538
2538
|
}
|
|
2539
2539
|
|
|
2540
2540
|
/**
|
|
@@ -2584,10 +2584,6 @@ let Vector3$1 = class Vector3 {
|
|
|
2584
2584
|
return v3_length_sqr(this.x - x, this.y - y, this.z - z);
|
|
2585
2585
|
}
|
|
2586
2586
|
|
|
2587
|
-
distanceToSquared(other) {
|
|
2588
|
-
return v3_length_sqr(this.x - other.x, this.y - other.y, this.z - other.z);
|
|
2589
|
-
}
|
|
2590
|
-
|
|
2591
2587
|
/**
|
|
2592
2588
|
* Angle between two vectors (co-planar) in radians
|
|
2593
2589
|
* @param {Vector3} other
|
|
@@ -2847,31 +2843,6 @@ let Vector3$1 = class Vector3 {
|
|
|
2847
2843
|
this._projectVectors(x0, y0, z0, x1, y1, z1);
|
|
2848
2844
|
}
|
|
2849
2845
|
|
|
2850
|
-
/**
|
|
2851
|
-
* Compute orthogonal vectors given a normal
|
|
2852
|
-
* Orthogonal vectors are normalized vectors pointing at right angles away from the input normal and to one another
|
|
2853
|
-
* @see https://stackoverflow.com/questions/3684269/component-of-a-quaternion-rotation-around-an-axis
|
|
2854
|
-
* @param normal
|
|
2855
|
-
* @param orthonormal1
|
|
2856
|
-
* @param orthonormal2
|
|
2857
|
-
*/
|
|
2858
|
-
static findOrthonormals(normal, orthonormal1, orthonormal2) {
|
|
2859
|
-
throw new Error('Not Implemented');
|
|
2860
|
-
|
|
2861
|
-
// Vector3 w = Vector3.Transform(normal, OrthoX);
|
|
2862
|
-
// float dot = Vector3.Dot(normal, w);
|
|
2863
|
-
// if (Math.Abs(dot) > 0.6)
|
|
2864
|
-
// {
|
|
2865
|
-
// w = Vector3.Transform(normal, OrthoY);
|
|
2866
|
-
// }
|
|
2867
|
-
// w.Normalize();
|
|
2868
|
-
//
|
|
2869
|
-
// orthonormal1 = Vector3.Cross(normal, w);
|
|
2870
|
-
// orthonormal1.Normalize();
|
|
2871
|
-
// orthonormal2 = Vector3.Cross(normal, orthonormal1);
|
|
2872
|
-
// orthonormal2.Normalize();
|
|
2873
|
-
}
|
|
2874
|
-
|
|
2875
2846
|
/**
|
|
2876
2847
|
* Project first vector onto second one
|
|
2877
2848
|
* @param {number} x0
|
|
@@ -3004,24 +2975,6 @@ let Vector3$1 = class Vector3 {
|
|
|
3004
2975
|
this.set(x, y, z);
|
|
3005
2976
|
}
|
|
3006
2977
|
|
|
3007
|
-
/**
|
|
3008
|
-
*
|
|
3009
|
-
* @param {BinaryBuffer} buffer
|
|
3010
|
-
* @deprecated use dedicated method directly instead
|
|
3011
|
-
*/
|
|
3012
|
-
toBinaryBufferFloat32_EqualityEncoded(buffer) {
|
|
3013
|
-
throw new Error('deprecated, use v3_binary_equality_encode')
|
|
3014
|
-
}
|
|
3015
|
-
|
|
3016
|
-
/**
|
|
3017
|
-
* Uses an extra byte for a header. Only writes unique components. Useful for things like scale where all components usually have the same value
|
|
3018
|
-
* @param {BinaryBuffer} buffer
|
|
3019
|
-
* @deprecated use dedicated method directly instead
|
|
3020
|
-
*/
|
|
3021
|
-
fromBinaryBufferFloat32_EqualityEncoded(buffer) {
|
|
3022
|
-
throw new Error('deprecated, use v3_binary_equality_decode')
|
|
3023
|
-
}
|
|
3024
|
-
|
|
3025
2978
|
hash() {
|
|
3026
2979
|
const x = computeHashFloat(this.x);
|
|
3027
2980
|
const y = computeHashFloat(this.y);
|
|
@@ -3109,6 +3062,8 @@ let Vector3$1 = class Vector3 {
|
|
|
3109
3062
|
|
|
3110
3063
|
// Aliases
|
|
3111
3064
|
|
|
3065
|
+
Vector3$1.prototype.distanceToSquared = Vector3$1.prototype.distanceSqrTo;
|
|
3066
|
+
|
|
3112
3067
|
Vector3$1.prototype.lengthSq = Vector3$1.prototype.lengthSqr;
|
|
3113
3068
|
Vector3$1.prototype.fromArray = Vector3$1.prototype.readFromArray;
|
|
3114
3069
|
Vector3$1.prototype.toArray = Vector3$1.prototype.writeToArray;
|
|
@@ -4015,18 +3970,18 @@ let Quaternion$1 = class Quaternion {
|
|
|
4015
3970
|
if (uv_dot < -0.9999999) {
|
|
4016
3971
|
//to vector is opposite, produce a reversal quaternion
|
|
4017
3972
|
|
|
4018
|
-
|
|
3973
|
+
scratch_v3_a.crossVectors(Vector3$1.left, from);
|
|
4019
3974
|
|
|
4020
|
-
if (
|
|
4021
|
-
|
|
3975
|
+
if (scratch_v3_a.lengthSqr() < 0.00001) {
|
|
3976
|
+
scratch_v3_a.crossVectors(Vector3$1.up, from);
|
|
4022
3977
|
}
|
|
4023
3978
|
|
|
4024
|
-
|
|
3979
|
+
scratch_v3_a.normalize();
|
|
4025
3980
|
|
|
4026
3981
|
this.set(
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
3982
|
+
scratch_v3_a.x,
|
|
3983
|
+
scratch_v3_a.y,
|
|
3984
|
+
scratch_v3_a.z,
|
|
4030
3985
|
0
|
|
4031
3986
|
);
|
|
4032
3987
|
|
|
@@ -4558,10 +4513,7 @@ Quaternion$1.prototype.toArray = Quaternion$1.prototype.writeToArray;
|
|
|
4558
4513
|
* @readonly
|
|
4559
4514
|
* @type {Quaternion}
|
|
4560
4515
|
*/
|
|
4561
|
-
Quaternion$1.identity = Object.freeze(new Quaternion$1(0, 0, 0, 1));
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
const tempvec3 = new Vector3$1();
|
|
4516
|
+
Quaternion$1.identity = Object.freeze(new Quaternion$1(0, 0, 0, 1));
|
|
4565
4517
|
|
|
4566
4518
|
/**
|
|
4567
4519
|
* @readonly
|
|
@@ -49010,34 +48962,6 @@ function compute_typed_array_constructor_from_data_type(dt) {
|
|
|
49010
48962
|
return r;
|
|
49011
48963
|
}
|
|
49012
48964
|
|
|
49013
|
-
/**
|
|
49014
|
-
* Useful for computing hashes of large arrays, can pick a relevant stride and skip large chunks of memory while still capturing good amount of unique information from evenly-spaced areas of the array
|
|
49015
|
-
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
49016
|
-
* @param {number} offset
|
|
49017
|
-
* @param {number} length
|
|
49018
|
-
* @param {number} stride
|
|
49019
|
-
* @return {number}
|
|
49020
|
-
*/
|
|
49021
|
-
function computeStridedIntegerArrayHash(
|
|
49022
|
-
array, offset, length, stride
|
|
49023
|
-
) {
|
|
49024
|
-
let hash = length;
|
|
49025
|
-
|
|
49026
|
-
for (let i = offset; i < length; i += stride) {
|
|
49027
|
-
const value = array[i] >>> 0; //force uint32
|
|
49028
|
-
|
|
49029
|
-
/**
|
|
49030
|
-
* Simple hashing scheme, multiplying existing hash by a prime and adding next value
|
|
49031
|
-
* (h<<5) - h === h*31
|
|
49032
|
-
* @type {number}
|
|
49033
|
-
*/
|
|
49034
|
-
hash = ((hash << 5) - hash) + value;
|
|
49035
|
-
}
|
|
49036
|
-
|
|
49037
|
-
// force uint32
|
|
49038
|
-
return hash >>> 0;
|
|
49039
|
-
}
|
|
49040
|
-
|
|
49041
48965
|
/**
|
|
49042
48966
|
*
|
|
49043
48967
|
* @param {*} array
|
|
@@ -49184,6 +49108,62 @@ function is_typed_array_equals(a, b) {
|
|
|
49184
49108
|
return isArrayEqualStrict(a_proxy, b_proxy);
|
|
49185
49109
|
}
|
|
49186
49110
|
|
|
49111
|
+
/**
|
|
49112
|
+
* Useful for computing hashes of large arrays, can pick a relevant stride and skip large chunks of memory while still capturing good amount of unique information from evenly-spaced areas of the array
|
|
49113
|
+
* @template T
|
|
49114
|
+
* @param {T[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
49115
|
+
* @param {number} offset
|
|
49116
|
+
* @param {number} length
|
|
49117
|
+
* @param {number} stride
|
|
49118
|
+
* @param {function(T):number} elementHash
|
|
49119
|
+
* @param {*} [elementHashContext]
|
|
49120
|
+
* @return {number}
|
|
49121
|
+
*/
|
|
49122
|
+
function computeStridedArrayHash(
|
|
49123
|
+
array, offset, length, stride,
|
|
49124
|
+
elementHash, elementHashContext
|
|
49125
|
+
) {
|
|
49126
|
+
|
|
49127
|
+
let hash = length;
|
|
49128
|
+
|
|
49129
|
+
for (let i = offset; i < length; i += stride) {
|
|
49130
|
+
const value = elementHash.call(elementHashContext, array[i]);
|
|
49131
|
+
|
|
49132
|
+
/**
|
|
49133
|
+
* Simple hashing scheme, multiplying existing hash by a prime and adding next value
|
|
49134
|
+
* (h<<5) - h === h*31
|
|
49135
|
+
* @type {number}
|
|
49136
|
+
*/
|
|
49137
|
+
hash = ((hash << 5) - hash) + value;
|
|
49138
|
+
}
|
|
49139
|
+
|
|
49140
|
+
// force uint32
|
|
49141
|
+
return hash >>> 0;
|
|
49142
|
+
}
|
|
49143
|
+
|
|
49144
|
+
/**
|
|
49145
|
+
*
|
|
49146
|
+
* @param {Uint32Array} array
|
|
49147
|
+
* @param {number} offset
|
|
49148
|
+
* @param {number} length
|
|
49149
|
+
* @param {number} [sample_limit]
|
|
49150
|
+
* @returns {number}
|
|
49151
|
+
*/
|
|
49152
|
+
function sparse_typed_array_hash(array, offset, length, sample_limit = 31) {
|
|
49153
|
+
// limit hash evaluation to first 1k of the data to random memory access and keep CPU cache usage more coherent
|
|
49154
|
+
const hash_evaluation_length = min2(length, 1024);
|
|
49155
|
+
|
|
49156
|
+
// compute stride so that we don't have to iterate over the entire buffer, instead picking at most X(509) values to consider
|
|
49157
|
+
const stride = Math.max(1, Math.ceil(hash_evaluation_length / sample_limit));
|
|
49158
|
+
|
|
49159
|
+
// TODO implement fast dedicated float and int paths
|
|
49160
|
+
|
|
49161
|
+
return computeStridedArrayHash(
|
|
49162
|
+
array, 0, hash_evaluation_length, stride,
|
|
49163
|
+
computeHashFloat
|
|
49164
|
+
);
|
|
49165
|
+
}
|
|
49166
|
+
|
|
49187
49167
|
function typedArrayConstructorByInstance(a) {
|
|
49188
49168
|
if (a instanceof Int8Array) {
|
|
49189
49169
|
return Int8Array;
|
|
@@ -49258,19 +49238,19 @@ class Sampler2D {
|
|
|
49258
49238
|
|
|
49259
49239
|
/**
|
|
49260
49240
|
*
|
|
49261
|
-
* @type {
|
|
49241
|
+
* @type {number}
|
|
49262
49242
|
*/
|
|
49263
49243
|
this.width = width;
|
|
49264
49244
|
|
|
49265
49245
|
/**
|
|
49266
49246
|
*
|
|
49267
|
-
* @type {
|
|
49247
|
+
* @type {number}
|
|
49268
49248
|
*/
|
|
49269
49249
|
this.height = height;
|
|
49270
49250
|
|
|
49271
49251
|
/**
|
|
49272
49252
|
* Number of channels
|
|
49273
|
-
* @type {
|
|
49253
|
+
* @type {number}
|
|
49274
49254
|
*/
|
|
49275
49255
|
this.itemSize = itemSize;
|
|
49276
49256
|
|
|
@@ -49287,18 +49267,6 @@ class Sampler2D {
|
|
|
49287
49267
|
this.version = 0;
|
|
49288
49268
|
}
|
|
49289
49269
|
|
|
49290
|
-
/**
|
|
49291
|
-
*
|
|
49292
|
-
* @deprecated
|
|
49293
|
-
* @param {number} x
|
|
49294
|
-
* @param {number}y
|
|
49295
|
-
* @param {Vector1|Vector2|Vector3|Vector4} result
|
|
49296
|
-
* @returns {number}
|
|
49297
|
-
*/
|
|
49298
|
-
get(x, y, result) {
|
|
49299
|
-
throw new Error("Deprecated method, use sampleBilinear instead");
|
|
49300
|
-
}
|
|
49301
|
-
|
|
49302
49270
|
/**
|
|
49303
49271
|
*
|
|
49304
49272
|
* @param {number} u
|
|
@@ -49321,8 +49289,8 @@ class Sampler2D {
|
|
|
49321
49289
|
* @returns {number}
|
|
49322
49290
|
*/
|
|
49323
49291
|
sampleChannelCatmullRomUV(u, v, channel) {
|
|
49324
|
-
const x = u *
|
|
49325
|
-
const y = v *
|
|
49292
|
+
const x = u * this.width - 0.5;
|
|
49293
|
+
const y = v * this.height - 0.5;
|
|
49326
49294
|
|
|
49327
49295
|
return this.sampleChannelCatmullRom(x, y, channel);
|
|
49328
49296
|
}
|
|
@@ -49377,8 +49345,8 @@ class Sampler2D {
|
|
|
49377
49345
|
const texPos12_x = texPos1_x + offset12_x;
|
|
49378
49346
|
const texPos12_y = texPos1_y + offset12_y;
|
|
49379
49347
|
|
|
49380
|
-
|
|
49381
49348
|
let result = 0.0;
|
|
49349
|
+
|
|
49382
49350
|
result += this.sampleChannelBilinear(texPos0_x, texPos0_y, channel) * w0_x * w0_y;
|
|
49383
49351
|
result += this.sampleChannelBilinear(texPos12_x, texPos0_y, channel) * w12_x * w0_y;
|
|
49384
49352
|
result += this.sampleChannelBilinear(texPos3_x, texPos0_y, channel) * w3_x * w0_y;
|
|
@@ -49440,8 +49408,8 @@ class Sampler2D {
|
|
|
49440
49408
|
}
|
|
49441
49409
|
|
|
49442
49410
|
/**
|
|
49443
|
-
*
|
|
49444
|
-
* Bicubic-filtered sampling
|
|
49411
|
+
*
|
|
49412
|
+
* Bicubic-filtered sampling, note values can be negative due to the nature of the cubic curve
|
|
49445
49413
|
* @param {number} x
|
|
49446
49414
|
* @param {number} y
|
|
49447
49415
|
* @param {number} channel
|
|
@@ -49670,7 +49638,11 @@ class Sampler2D {
|
|
|
49670
49638
|
const x = Math.round(u * w - 0.5);
|
|
49671
49639
|
const y = Math.round(v * h - 0.5);
|
|
49672
49640
|
|
|
49673
|
-
this.read(
|
|
49641
|
+
this.read(
|
|
49642
|
+
clamp$1(x, 0, w - 1),
|
|
49643
|
+
clamp$1(y, 0, h - 1),
|
|
49644
|
+
result
|
|
49645
|
+
);
|
|
49674
49646
|
}
|
|
49675
49647
|
|
|
49676
49648
|
/**
|
|
@@ -49725,24 +49697,6 @@ class Sampler2D {
|
|
|
49725
49697
|
}
|
|
49726
49698
|
}
|
|
49727
49699
|
|
|
49728
|
-
/**
|
|
49729
|
-
*
|
|
49730
|
-
* @param {number} u
|
|
49731
|
-
* @param {number} v
|
|
49732
|
-
* @param {Vector4|Vector3|Vector2} [result]
|
|
49733
|
-
* @deprecated
|
|
49734
|
-
*/
|
|
49735
|
-
sample(u, v, result) {
|
|
49736
|
-
|
|
49737
|
-
const temp = [];
|
|
49738
|
-
|
|
49739
|
-
this.sampleBilinear(u * (this.width - 1), v * (this.height - 1), temp, 0);
|
|
49740
|
-
|
|
49741
|
-
result.readFromArray(temp);
|
|
49742
|
-
|
|
49743
|
-
return temp[0];
|
|
49744
|
-
}
|
|
49745
|
-
|
|
49746
49700
|
/**
|
|
49747
49701
|
*
|
|
49748
49702
|
* @param {number} x
|
|
@@ -49872,11 +49826,11 @@ class Sampler2D {
|
|
|
49872
49826
|
|
|
49873
49827
|
/**
|
|
49874
49828
|
*
|
|
49875
|
-
* @param {
|
|
49876
|
-
* @param {
|
|
49877
|
-
* @param {
|
|
49878
|
-
* @param {
|
|
49879
|
-
* @param {Array.<
|
|
49829
|
+
* @param {number} x
|
|
49830
|
+
* @param {number} y
|
|
49831
|
+
* @param {number} width
|
|
49832
|
+
* @param {number} height
|
|
49833
|
+
* @param {Array.<number>} value
|
|
49880
49834
|
*/
|
|
49881
49835
|
fill(x, y, width, height, value) {
|
|
49882
49836
|
|
|
@@ -50054,10 +50008,13 @@ class Sampler2D {
|
|
|
50054
50008
|
computeByteSize() {
|
|
50055
50009
|
let dataSize;
|
|
50056
50010
|
|
|
50057
|
-
|
|
50058
|
-
|
|
50011
|
+
const data = this.data;
|
|
50012
|
+
|
|
50013
|
+
if (Array.isArray(data)) {
|
|
50014
|
+
// Assume IEEE float 64
|
|
50015
|
+
dataSize = 8 * data.length;
|
|
50059
50016
|
} else {
|
|
50060
|
-
dataSize =
|
|
50017
|
+
dataSize = data.buffer.byteLength;
|
|
50061
50018
|
}
|
|
50062
50019
|
|
|
50063
50020
|
return dataSize + 280;
|
|
@@ -50069,6 +50026,11 @@ class Sampler2D {
|
|
|
50069
50026
|
* @return {boolean}
|
|
50070
50027
|
*/
|
|
50071
50028
|
equals(other) {
|
|
50029
|
+
if(this === other){
|
|
50030
|
+
// special case
|
|
50031
|
+
return true;
|
|
50032
|
+
}
|
|
50033
|
+
|
|
50072
50034
|
if (
|
|
50073
50035
|
this.width !== other.width
|
|
50074
50036
|
|| this.height !== other.height
|
|
@@ -50089,9 +50051,7 @@ class Sampler2D {
|
|
|
50089
50051
|
|
|
50090
50052
|
const length = this.data.length;
|
|
50091
50053
|
|
|
50092
|
-
|
|
50093
|
-
|
|
50094
|
-
hash ^= computeStridedIntegerArrayHash(this.data, 0, length, stride);
|
|
50054
|
+
hash ^= sparse_typed_array_hash(this.data, 0, length, 509);
|
|
50095
50055
|
|
|
50096
50056
|
return hash;
|
|
50097
50057
|
}
|
|
@@ -50627,6 +50587,34 @@ Vector1.zero = Object.freeze(new Vector1(0));
|
|
|
50627
50587
|
*/
|
|
50628
50588
|
Vector1.one = Object.freeze(new Vector1(1));
|
|
50629
50589
|
|
|
50590
|
+
/**
|
|
50591
|
+
* Useful for computing hashes of large arrays, can pick a relevant stride and skip large chunks of memory while still capturing good amount of unique information from evenly-spaced areas of the array
|
|
50592
|
+
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
50593
|
+
* @param {number} offset
|
|
50594
|
+
* @param {number} length
|
|
50595
|
+
* @param {number} stride
|
|
50596
|
+
* @return {number}
|
|
50597
|
+
*/
|
|
50598
|
+
function computeStridedIntegerArrayHash(
|
|
50599
|
+
array, offset, length, stride
|
|
50600
|
+
) {
|
|
50601
|
+
let hash = length;
|
|
50602
|
+
|
|
50603
|
+
for (let i = offset; i < length; i += stride) {
|
|
50604
|
+
const value = array[i] >>> 0; //force uint32
|
|
50605
|
+
|
|
50606
|
+
/**
|
|
50607
|
+
* Simple hashing scheme, multiplying existing hash by a prime and adding next value
|
|
50608
|
+
* (h<<5) - h === h*31
|
|
50609
|
+
* @type {number}
|
|
50610
|
+
*/
|
|
50611
|
+
hash = ((hash << 5) - hash) + value;
|
|
50612
|
+
}
|
|
50613
|
+
|
|
50614
|
+
// force uint32
|
|
50615
|
+
return hash >>> 0;
|
|
50616
|
+
}
|
|
50617
|
+
|
|
50630
50618
|
/**
|
|
50631
50619
|
*
|
|
50632
50620
|
* @param {Uint8Array|number[]|ArrayLike<number>|IArguments} data
|
|
@@ -55302,29 +55290,6 @@ function v3_morton_encode_bounded(x, y, z, bounds) {
|
|
|
55302
55290
|
);
|
|
55303
55291
|
}
|
|
55304
55292
|
|
|
55305
|
-
/**
|
|
55306
|
-
* Returns highest value out of 3 supplied
|
|
55307
|
-
* @param {number} a
|
|
55308
|
-
* @param {number} b
|
|
55309
|
-
* @param {number} c
|
|
55310
|
-
* @returns {number}
|
|
55311
|
-
*/
|
|
55312
|
-
function max3(a, b, c) {
|
|
55313
|
-
|
|
55314
|
-
let v = a;
|
|
55315
|
-
|
|
55316
|
-
if (v < b) {
|
|
55317
|
-
v = b;
|
|
55318
|
-
}
|
|
55319
|
-
|
|
55320
|
-
if (v < c) {
|
|
55321
|
-
v = c;
|
|
55322
|
-
}
|
|
55323
|
-
|
|
55324
|
-
return v;
|
|
55325
|
-
|
|
55326
|
-
}
|
|
55327
|
-
|
|
55328
55293
|
/**
|
|
55329
55294
|
* @readonly
|
|
55330
55295
|
* @type {number}
|
|
@@ -55610,73 +55575,6 @@ class BinaryUint32BVH {
|
|
|
55610
55575
|
return result;
|
|
55611
55576
|
}
|
|
55612
55577
|
|
|
55613
|
-
/**
|
|
55614
|
-
*
|
|
55615
|
-
* @param {number} a address
|
|
55616
|
-
* @param {number} b address
|
|
55617
|
-
* @param {number} c address
|
|
55618
|
-
* @returns {number}
|
|
55619
|
-
* @private
|
|
55620
|
-
*/
|
|
55621
|
-
__compute_bounds_area_of_3_boxes(a, b, c) {
|
|
55622
|
-
const float32 = this.__data_float32;
|
|
55623
|
-
|
|
55624
|
-
const x0 = min3(float32[a + 0], float32[b + 0], float32[c + 0]);
|
|
55625
|
-
const y0 = min3(float32[a + 1], float32[b + 1], float32[c + 1]);
|
|
55626
|
-
const z0 = min3(float32[a + 2], float32[b + 2], float32[c + 2]);
|
|
55627
|
-
|
|
55628
|
-
const x1 = max3(float32[a + 3], float32[b + 3], float32[c + 3]);
|
|
55629
|
-
const y1 = max3(float32[a + 4], float32[b + 4], float32[c + 4]);
|
|
55630
|
-
const z1 = max3(float32[a + 5], float32[b + 5], float32[c + 5]);
|
|
55631
|
-
|
|
55632
|
-
return aabb3_compute_half_surface_area(x0, y0, z0, x1, y1, z1);
|
|
55633
|
-
}
|
|
55634
|
-
|
|
55635
|
-
/**
|
|
55636
|
-
*
|
|
55637
|
-
* @param {number} a
|
|
55638
|
-
* @param {number} b
|
|
55639
|
-
* @returns {number}
|
|
55640
|
-
* @private
|
|
55641
|
-
*/
|
|
55642
|
-
__fitness_function_should_swap_leaves_sah(a, b) {
|
|
55643
|
-
const a_0 = max2(a - 1, 0);
|
|
55644
|
-
const a_1 = min2(a + 1, this.__node_count_leaf - 1);
|
|
55645
|
-
|
|
55646
|
-
const leaf_block_offset = this.getLeafBlockAddress();
|
|
55647
|
-
|
|
55648
|
-
const a_c_address = a * BVH_LEAF_NODE_SIZE + leaf_block_offset;
|
|
55649
|
-
const a_0_address = a_0 * BVH_LEAF_NODE_SIZE + leaf_block_offset;
|
|
55650
|
-
const a_1_address = a_1 * BVH_LEAF_NODE_SIZE + leaf_block_offset;
|
|
55651
|
-
|
|
55652
|
-
|
|
55653
|
-
const b_0 = max2(b - 1, 0);
|
|
55654
|
-
const b_1 = min2(b + 1, this.__node_count_leaf - 1);
|
|
55655
|
-
|
|
55656
|
-
const b_c_address = b * BVH_LEAF_NODE_SIZE + leaf_block_offset;
|
|
55657
|
-
const b_0_address = b_0 * BVH_LEAF_NODE_SIZE + leaf_block_offset;
|
|
55658
|
-
const b_1_address = b_1 * BVH_LEAF_NODE_SIZE + leaf_block_offset;
|
|
55659
|
-
|
|
55660
|
-
|
|
55661
|
-
const current_area = this.__compute_bounds_area_of_3_boxes(a_0_address, a_c_address, a_1_address) + this.__compute_bounds_area_of_3_boxes(b_0_address, b_c_address, b_1_address);
|
|
55662
|
-
const swap_area = this.__compute_bounds_area_of_3_boxes(a_0_address, b_c_address, a_1_address) + this.__compute_bounds_area_of_3_boxes(b_0_address, a_c_address, b_1_address);
|
|
55663
|
-
|
|
55664
|
-
return current_area - swap_area;
|
|
55665
|
-
}
|
|
55666
|
-
|
|
55667
|
-
sort_bubble_sah() {
|
|
55668
|
-
const n = this.__node_count_leaf;
|
|
55669
|
-
|
|
55670
|
-
for (let i = 0; i < n; i++) {
|
|
55671
|
-
for (let j = i + 1; j < n; j++) {
|
|
55672
|
-
if (this.__fitness_function_should_swap_leaves_sah(i, j) > 0) {
|
|
55673
|
-
this.__swap_leaves(i, j);
|
|
55674
|
-
}
|
|
55675
|
-
}
|
|
55676
|
-
}
|
|
55677
|
-
}
|
|
55678
|
-
|
|
55679
|
-
|
|
55680
55578
|
/**
|
|
55681
55579
|
* Sort leaf nodes according to their morton codes
|
|
55682
55580
|
* @param {number[]} bounds
|
|
@@ -55690,15 +55588,17 @@ class BinaryUint32BVH {
|
|
|
55690
55588
|
return;
|
|
55691
55589
|
}
|
|
55692
55590
|
|
|
55693
|
-
|
|
55591
|
+
const stack_top = stack$9.pointer;
|
|
55592
|
+
|
|
55593
|
+
let stackPointer = stack_top;
|
|
55694
55594
|
let i, j;
|
|
55695
55595
|
|
|
55696
|
-
stack$9[
|
|
55697
|
-
stack$9[
|
|
55596
|
+
stack$9[stackPointer++] = 0; // first node
|
|
55597
|
+
stack$9[stackPointer++] = this.__node_count_leaf - 1; // last node
|
|
55698
55598
|
|
|
55699
55599
|
const data = this.__data_float32;
|
|
55700
55600
|
|
|
55701
|
-
while (stackPointer >
|
|
55601
|
+
while (stackPointer > stack_top) {
|
|
55702
55602
|
stackPointer -= 2;
|
|
55703
55603
|
|
|
55704
55604
|
const right = stack$9[stackPointer + 1];
|
|
@@ -55707,14 +55607,15 @@ class BinaryUint32BVH {
|
|
|
55707
55607
|
i = left;
|
|
55708
55608
|
j = right;
|
|
55709
55609
|
|
|
55710
|
-
const
|
|
55610
|
+
const pivot_index = (left + right) >> 1;
|
|
55711
55611
|
|
|
55712
|
-
const pivot_address =
|
|
55612
|
+
const pivot_address = pivot_index * BVH_LEAF_NODE_SIZE + leaf_block_address;
|
|
55713
55613
|
|
|
55714
55614
|
const pivot = build_morton(data, pivot_address, bounds);
|
|
55715
55615
|
|
|
55716
55616
|
/* partition */
|
|
55717
55617
|
while (i <= j) {
|
|
55618
|
+
|
|
55718
55619
|
while (build_morton(data, i * BVH_LEAF_NODE_SIZE + leaf_block_address, bounds) < pivot) {
|
|
55719
55620
|
i++;
|
|
55720
55621
|
}
|
|
@@ -55748,7 +55649,7 @@ class BinaryUint32BVH {
|
|
|
55748
55649
|
}
|
|
55749
55650
|
|
|
55750
55651
|
/**
|
|
55751
|
-
*
|
|
55652
|
+
* Does not update intermediate node bounds
|
|
55752
55653
|
* @param {number} i
|
|
55753
55654
|
* @param {number} j
|
|
55754
55655
|
* @private
|
|
@@ -56422,13 +56323,6 @@ class AABB3 {
|
|
|
56422
56323
|
|| (z + tolerance) < this.z0 || (z - tolerance) > this.z1);
|
|
56423
56324
|
}
|
|
56424
56325
|
|
|
56425
|
-
computeMortonCode() {
|
|
56426
|
-
const cx = (this.x0 + this.x1) >> 1;
|
|
56427
|
-
const cy = (this.y0 + this.y1) >> 1;
|
|
56428
|
-
const cz = (this.z0 + this.z1) >> 1;
|
|
56429
|
-
return mortonEncode_magicbits(cx, cy, cz);
|
|
56430
|
-
}
|
|
56431
|
-
|
|
56432
56326
|
/**
|
|
56433
56327
|
*
|
|
56434
56328
|
* @returns {number}
|
|
@@ -57739,7 +57633,7 @@ const m4_tmp = [];
|
|
|
57739
57633
|
class TerrainTile {
|
|
57740
57634
|
gridPosition = new Vector2();
|
|
57741
57635
|
scale = new Vector2(1, 1);
|
|
57742
|
-
size = new Vector2();
|
|
57636
|
+
size = new Vector2(1, 1);
|
|
57743
57637
|
position = new Vector2();
|
|
57744
57638
|
resolution = new ObservedInteger(1);
|
|
57745
57639
|
|
|
@@ -58209,6 +58103,7 @@ class TerrainTile {
|
|
|
58209
58103
|
|
|
58210
58104
|
geometry.boundingSphere = new Sphere(center, radius);
|
|
58211
58105
|
}
|
|
58106
|
+
|
|
58212
58107
|
//pull bounding box from geometry
|
|
58213
58108
|
|
|
58214
58109
|
bb = geometry.boundingBox;
|
|
@@ -58216,6 +58111,7 @@ class TerrainTile {
|
|
|
58216
58111
|
geometry.computeBoundingBox();
|
|
58217
58112
|
bb = geometry.boundingBox;
|
|
58218
58113
|
}
|
|
58114
|
+
|
|
58219
58115
|
}
|
|
58220
58116
|
|
|
58221
58117
|
const x0 = bb.min.x;
|
|
@@ -59113,11 +59009,11 @@ function writeSample2DDataToDataTexture(sampler, texture) {
|
|
|
59113
59009
|
}
|
|
59114
59010
|
} else if (sampler.itemSize === 3) {
|
|
59115
59011
|
if (texture.format !== RGBFormat$1) {
|
|
59116
|
-
throw new Error('itemSize is
|
|
59012
|
+
throw new Error('itemSize is 3 and texture.format is not RGBFormat');
|
|
59117
59013
|
}
|
|
59118
59014
|
} else if (sampler.itemSize === 4) {
|
|
59119
59015
|
if (texture.format !== RGBAFormat) {
|
|
59120
|
-
throw new Error('itemSize is
|
|
59016
|
+
throw new Error('itemSize is 4 and texture.format is not RGBAFormat');
|
|
59121
59017
|
}
|
|
59122
59018
|
} else {
|
|
59123
59019
|
throw new Error('Unsupported itemSize');
|
|
@@ -62620,7 +62516,7 @@ function saturated_value_by_constructor(ctor) {
|
|
|
62620
62516
|
* @param {Sampler2D} source
|
|
62621
62517
|
* @param {Sampler2D} destination
|
|
62622
62518
|
*/
|
|
62623
|
-
function
|
|
62519
|
+
function sampler2d_transfer_data(source, destination) {
|
|
62624
62520
|
if (source.width !== destination.width || source.height !== destination.height) {
|
|
62625
62521
|
throw new Error('Source and destination dimensions do not match');
|
|
62626
62522
|
}
|
|
@@ -62827,7 +62723,7 @@ class TerrainLayer {
|
|
|
62827
62723
|
|
|
62828
62724
|
const source = new Sampler2D(source_data, source_item_size, image.width, image.height);
|
|
62829
62725
|
|
|
62830
|
-
|
|
62726
|
+
sampler2d_transfer_data(source, this.diffuse);
|
|
62831
62727
|
|
|
62832
62728
|
this.onChanged.send0();
|
|
62833
62729
|
|
|
@@ -63646,11 +63542,16 @@ class WorkerProxy {
|
|
|
63646
63542
|
__id_counter = 0;
|
|
63647
63543
|
|
|
63648
63544
|
|
|
63545
|
+
/**
|
|
63546
|
+
*
|
|
63547
|
+
* @param {string} url
|
|
63548
|
+
* @param {Object} methods
|
|
63549
|
+
*/
|
|
63649
63550
|
constructor(url, methods) {
|
|
63650
63551
|
this.url = url;
|
|
63651
63552
|
this.methods = methods;
|
|
63652
63553
|
|
|
63653
|
-
this.__generateAPI(
|
|
63554
|
+
this.__generateAPI();
|
|
63654
63555
|
}
|
|
63655
63556
|
|
|
63656
63557
|
/**
|
|
@@ -63729,6 +63630,10 @@ class WorkerProxy {
|
|
|
63729
63630
|
|
|
63730
63631
|
}
|
|
63731
63632
|
|
|
63633
|
+
/**
|
|
63634
|
+
*
|
|
63635
|
+
* @private
|
|
63636
|
+
*/
|
|
63732
63637
|
__generateAPI() {
|
|
63733
63638
|
|
|
63734
63639
|
|
|
@@ -66109,6 +66014,29 @@ function read_three_planes_to_array(planes, array) {
|
|
|
66109
66014
|
}
|
|
66110
66015
|
}
|
|
66111
66016
|
|
|
66017
|
+
/**
|
|
66018
|
+
* Returns highest value out of 3 supplied
|
|
66019
|
+
* @param {number} a
|
|
66020
|
+
* @param {number} b
|
|
66021
|
+
* @param {number} c
|
|
66022
|
+
* @returns {number}
|
|
66023
|
+
*/
|
|
66024
|
+
function max3(a, b, c) {
|
|
66025
|
+
|
|
66026
|
+
let v = a;
|
|
66027
|
+
|
|
66028
|
+
if (v < b) {
|
|
66029
|
+
v = b;
|
|
66030
|
+
}
|
|
66031
|
+
|
|
66032
|
+
if (v < c) {
|
|
66033
|
+
v = c;
|
|
66034
|
+
}
|
|
66035
|
+
|
|
66036
|
+
return v;
|
|
66037
|
+
|
|
66038
|
+
}
|
|
66039
|
+
|
|
66112
66040
|
/**
|
|
66113
66041
|
*
|
|
66114
66042
|
* @param {number[]|Float32Array} output
|
|
@@ -85587,7 +85515,7 @@ class Deque {
|
|
|
85587
85515
|
|
|
85588
85516
|
/**
|
|
85589
85517
|
*
|
|
85590
|
-
* @param {
|
|
85518
|
+
* @param {T} e
|
|
85591
85519
|
* @returns {boolean}
|
|
85592
85520
|
*/
|
|
85593
85521
|
has(e) {
|
|
@@ -92960,14 +92888,12 @@ const LogLevel = {
|
|
|
92960
92888
|
};
|
|
92961
92889
|
|
|
92962
92890
|
class Logger {
|
|
92963
|
-
|
|
92964
|
-
|
|
92965
|
-
|
|
92966
|
-
|
|
92967
|
-
|
|
92968
|
-
|
|
92969
|
-
this.backends = [];
|
|
92970
|
-
}
|
|
92891
|
+
/**
|
|
92892
|
+
*
|
|
92893
|
+
* @private
|
|
92894
|
+
* @type {LoggerBackend[]}
|
|
92895
|
+
*/
|
|
92896
|
+
backends = [];
|
|
92971
92897
|
|
|
92972
92898
|
/**
|
|
92973
92899
|
* Add a logging backend, this is a structure that handles incoming log messages.
|
|
@@ -115511,14 +115437,14 @@ class InputControllerSystem extends System {
|
|
|
115511
115437
|
}
|
|
115512
115438
|
|
|
115513
115439
|
class LoggerBackend {
|
|
115514
|
-
constructor() {
|
|
115515
115440
|
|
|
115516
|
-
|
|
115517
|
-
|
|
115518
|
-
|
|
115519
|
-
|
|
115520
|
-
|
|
115521
|
-
|
|
115441
|
+
|
|
115442
|
+
/**
|
|
115443
|
+
* @private
|
|
115444
|
+
* @type {LogLevel|number}
|
|
115445
|
+
*/
|
|
115446
|
+
level = LogLevel.Info;
|
|
115447
|
+
|
|
115522
115448
|
|
|
115523
115449
|
/**
|
|
115524
115450
|
*
|