@woosh/meep-engine 2.108.4 → 2.109.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/meep.cjs +101 -61
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +101 -61
- package/package.json +1 -1
- package/src/core/assert.d.ts +2 -2
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +1 -1
- package/src/core/binary/BitSet.d.ts +6 -0
- package/src/core/binary/BitSet.d.ts.map +1 -1
- package/src/core/binary/BitSet.js +14 -42
- package/src/core/binary/align_32.d.ts +7 -0
- package/src/core/binary/align_32.d.ts.map +1 -0
- package/src/core/binary/align_32.js +8 -0
- package/src/core/binary/align_32.spec.d.ts +2 -0
- package/src/core/binary/align_32.spec.d.ts.map +1 -0
- package/src/core/binary/align_32.spec.js +11 -0
- package/src/core/binary/align_4.js +2 -1
- package/src/core/binary/align_4.spec.d.ts +2 -0
- package/src/core/binary/align_4.spec.d.ts.map +1 -0
- package/src/core/binary/align_4.spec.js +20 -0
- package/src/core/binary/{de_interleave_bits_by_2.d.ts → de_interleave_2_bits.d.ts} +1 -1
- package/src/core/binary/de_interleave_2_bits.d.ts.map +1 -0
- package/src/core/binary/de_interleave_2_bits.spec.js +1 -1
- package/src/core/binary/hex2dec.spec.d.ts +2 -0
- package/src/core/binary/hex2dec.spec.d.ts.map +1 -0
- package/src/core/binary/hex2dec.spec.js +22 -0
- package/src/core/binary/lsb_32.d.ts +9 -0
- package/src/core/binary/lsb_32.d.ts.map +1 -0
- package/src/core/binary/lsb_32.js +12 -0
- package/src/core/binary/msb_32.d.ts +2 -0
- package/src/core/binary/msb_32.d.ts.map +1 -0
- package/src/core/binary/msb_32.js +20 -0
- package/src/core/binary/msb_lut_de_bruijn.d.ts +7 -0
- package/src/core/binary/msb_lut_de_bruijn.d.ts.map +1 -0
- package/src/core/binary/msb_lut_de_bruijn.js +9 -0
- package/src/core/binary/split_by_2.spec.d.ts +2 -0
- package/src/core/binary/split_by_2.spec.d.ts.map +1 -0
- package/src/core/binary/split_by_2.spec.js +22 -0
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts +4 -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 +16 -7
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js +12 -7
- package/src/core/geom/2d/circle/circle_circumference.d.ts +7 -0
- package/src/core/geom/2d/circle/circle_circumference.d.ts.map +1 -0
- package/src/core/geom/2d/circle/circle_circumference.js +12 -0
- package/src/core/geom/2d/compute_polygon_area_2d.d.ts.map +1 -1
- package/src/core/geom/2d/compute_polygon_area_2d.js +6 -4
- package/src/core/geom/2d/lt-grid/LooseTightGrid.js +1 -1
- package/src/core/geom/2d/triangle2d_get_barycentric.d.ts +2 -2
- package/src/core/geom/2d/triangle2d_get_barycentric.js +2 -2
- package/src/core/geom/3d/Ray3.d.ts +19 -0
- package/src/core/geom/3d/Ray3.d.ts.map +1 -0
- package/src/core/geom/3d/Ray3.js +27 -0
- package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.d.ts +10 -0
- package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.d.ts.map +1 -0
- package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.js +35 -0
- package/src/core/geom/3d/sphere/harmonics/compute_legendre_polynomial.d.ts +1 -0
- package/src/core/geom/3d/sphere/harmonics/compute_legendre_polynomial.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/compute_legendre_polynomial.js +0 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.d.ts +9 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_convolve_with_cosine_kernel.js +26 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +2 -4
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.js +94 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/{sh3_rotate.js → sh3_rotate_filament.js} +5 -2
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.d.ts +12 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.js +40 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.d.ts +2 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_vector_accumulate.spec.js +27 -0
- package/src/core/geom/3d/sphere/harmonics/sh_compute_K.d.ts +3 -3
- package/src/core/geom/3d/sphere/harmonics/sh_compute_K.js +3 -3
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.js +29 -14
- package/src/core/geom/Quaternion.js +1 -1
- package/src/core/geom/vec/vector_copy.d.ts +10 -0
- package/src/core/geom/vec/vector_copy.d.ts.map +1 -0
- package/src/core/geom/vec/vector_copy.js +13 -0
- package/src/core/{math/vector_nd_dot.d.ts → geom/vec/vector_dot.d.ts} +2 -2
- package/src/core/geom/vec/vector_dot.d.ts.map +1 -0
- package/src/core/{math/vector_nd_dot.js → geom/vec/vector_dot.js} +1 -1
- package/src/core/{math/vector_nd_normalize.d.ts → geom/vec/vector_normalize.d.ts} +2 -2
- package/src/core/geom/vec/vector_normalize.d.ts.map +1 -0
- package/src/core/{math/vector_nd_normalize.js → geom/vec/vector_normalize.js} +1 -1
- package/src/core/geom/vec/vector_normalize.spec.d.ts +2 -0
- package/src/core/geom/vec/vector_normalize.spec.d.ts.map +1 -0
- package/src/core/{math/vector_nd_normalize.spec.js → geom/vec/vector_normalize.spec.js} +3 -3
- package/src/core/geom/vec/vector_scale_array.d.ts +11 -0
- package/src/core/geom/vec/vector_scale_array.d.ts.map +1 -0
- package/src/core/geom/vec/vector_scale_array.js +31 -0
- package/src/core/geom/vec3/v3_dot_array_array.js +2 -0
- package/src/core/geom/vec3/v3_matrix4_multiply.d.ts +10 -0
- package/src/core/geom/vec3/v3_matrix4_multiply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_matrix4_multiply.js +27 -0
- package/src/core/geom/vec3/v3_shift_along_direction.d.ts +14 -0
- package/src/core/geom/vec3/v3_shift_along_direction.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_shift_along_direction.js +23 -0
- package/src/core/math/compute_legendre_polynomial.d.ts +10 -0
- package/src/core/math/compute_legendre_polynomial.d.ts.map +1 -0
- package/src/core/math/compute_legendre_polynomial.js +46 -0
- package/src/core/math/statistics/softmax.d.ts +11 -0
- package/src/core/math/statistics/softmax.d.ts.map +1 -0
- package/src/core/math/statistics/softmax.js +24 -0
- package/src/core/math/statistics/softmax.spec.d.ts +2 -0
- package/src/core/math/statistics/softmax.spec.d.ts.map +1 -0
- package/src/core/math/statistics/softmax.spec.js +9 -0
- package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstance.js +18 -0
- package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform.js +19 -4
- package/src/engine/graphics/ecs/camera/CameraSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/CameraSystem.js +25 -13
- package/src/engine/graphics/geometry/decode_attribute_value.d.ts +10 -0
- package/src/engine/graphics/geometry/decode_attribute_value.d.ts.map +1 -0
- package/src/engine/graphics/geometry/decode_attribute_value.js +28 -0
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal.d.ts +11 -0
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal.d.ts.map +1 -0
- package/src/engine/graphics/geometry/geometry_construct_triangle_normal.js +31 -0
- package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts.map +1 -1
- package/src/engine/graphics/sh3/fromCubeRenderTarget.js +14 -17
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +3 -2
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +21 -97
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +8 -15
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts +1 -0
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.js +6 -2
- package/src/engine/graphics/sh3/path_tracer/{GeometryBVHBatched.d.ts → BufferedGeometryBVH.d.ts} +9 -2
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{GeometryBVHBatched.js → BufferedGeometryBVH.js} +84 -5
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts +6 -4
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +54 -8
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +6 -10
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +41 -47
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts +11 -0
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +102 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts +9 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.js +17 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts +31 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.js +85 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureFilter.d.ts +14 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureFilter.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureFilter.js +17 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureWrapping.d.ts +7 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureWrapping.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/TextureWrapping.js +9 -0
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +104 -9
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts +1 -2
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +50 -23
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +79 -29
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts +11 -1
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts.map +1 -1
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +33 -16
- package/src/engine/graphics/texture/sampler/one_pixel_sampler_uint8.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/one_pixel_sampler_uint8.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/one_pixel_sampler_uint8.js +10 -0
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts +8 -0
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/sampler_multiply_vector.js +23 -0
- package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.d.ts.map +1 -1
- package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +6 -6
- package/src/core/binary/de_interleave_bits_by_2.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts.map +0 -1
- package/src/core/math/vector_nd_dot.d.ts.map +0 -1
- package/src/core/math/vector_nd_normalize.d.ts.map +0 -1
- package/src/core/math/vector_nd_normalize.spec.d.ts +0 -2
- package/src/core/math/vector_nd_normalize.spec.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.d.ts.map +0 -1
- /package/src/core/binary/{de_interleave_bits_by_2.js → de_interleave_2_bits.js} +0 -0
package/build/meep.module.js
CHANGED
|
@@ -555,7 +555,7 @@ assert.isArray = function (value, name = 'value') {
|
|
|
555
555
|
|
|
556
556
|
/**
|
|
557
557
|
* @template T
|
|
558
|
-
* @param {ArrayLike<T>|T[]} value
|
|
558
|
+
* @param {ArrayLike<T>|T[]|Uint32Array|Float32Array} value
|
|
559
559
|
* @param {string} name
|
|
560
560
|
*/
|
|
561
561
|
assert.isArrayLike = function (value, name = 'value') {
|
|
@@ -3606,7 +3606,7 @@ let Quaternion$1 = class Quaternion {
|
|
|
3606
3606
|
/**
|
|
3607
3607
|
*
|
|
3608
3608
|
* @param {Quaternion} other
|
|
3609
|
-
* @param {number} max_delta
|
|
3609
|
+
* @param {number} max_delta in radians
|
|
3610
3610
|
*/
|
|
3611
3611
|
rotateTowards(other, max_delta) {
|
|
3612
3612
|
Quaternion.rotateTowards(this, this, other, max_delta);
|
|
@@ -4985,6 +4985,19 @@ class Transform {
|
|
|
4985
4985
|
return result;
|
|
4986
4986
|
}
|
|
4987
4987
|
|
|
4988
|
+
/**
|
|
4989
|
+
*
|
|
4990
|
+
* @param {number[]|Float32Array} mat
|
|
4991
|
+
* @returns {Transform}
|
|
4992
|
+
*/
|
|
4993
|
+
static fromMatrix(mat) {
|
|
4994
|
+
const result = new Transform();
|
|
4995
|
+
|
|
4996
|
+
result.fromMatrix4(mat);
|
|
4997
|
+
|
|
4998
|
+
return result;
|
|
4999
|
+
}
|
|
5000
|
+
|
|
4988
5001
|
/**
|
|
4989
5002
|
* Multiply two transforms, result it written into this one
|
|
4990
5003
|
* @param {Transform} a
|
|
@@ -4998,17 +5011,18 @@ class Transform {
|
|
|
4998
5011
|
|
|
4999
5012
|
/**
|
|
5000
5013
|
*
|
|
5001
|
-
* @param {mat4|number[]|Float32Array}
|
|
5014
|
+
* @param {mat4|number[]|Float32Array} matrix
|
|
5002
5015
|
*/
|
|
5003
|
-
fromMatrix4(
|
|
5016
|
+
fromMatrix4(matrix) {
|
|
5017
|
+
|
|
5004
5018
|
// we know we are changing the matrix, so we're going to need to disable the flag that sets matrix from position/rotation/scale changes
|
|
5005
5019
|
const ad = this.getFlag(TransformFlags.AutomaticChangeDetection);
|
|
5006
5020
|
|
|
5007
5021
|
this.clearFlag(TransformFlags.AutomaticChangeDetection);
|
|
5008
5022
|
|
|
5009
|
-
this.matrix.set(
|
|
5023
|
+
this.matrix.set(matrix);
|
|
5010
5024
|
|
|
5011
|
-
decompose_matrix_4_array(
|
|
5025
|
+
decompose_matrix_4_array(matrix, this.position, this.rotation, this.scale);
|
|
5012
5026
|
|
|
5013
5027
|
// restore value of the flag
|
|
5014
5028
|
this.writeFlag(TransformFlags.AutomaticChangeDetection, ad);
|
|
@@ -59939,7 +59953,7 @@ const DEFAULT_INITIAL_CAPACITY_POWER = 4;
|
|
|
59939
59953
|
* @readonly
|
|
59940
59954
|
* @type {number}
|
|
59941
59955
|
*/
|
|
59942
|
-
const DEFAULT_INITIAL_CAPACITY = 2 ** DEFAULT_INITIAL_CAPACITY_POWER;
|
|
59956
|
+
const DEFAULT_INITIAL_CAPACITY$1 = 2 ** DEFAULT_INITIAL_CAPACITY_POWER;
|
|
59943
59957
|
|
|
59944
59958
|
/**
|
|
59945
59959
|
* @readonly
|
|
@@ -60068,7 +60082,7 @@ class HashMap {
|
|
|
60068
60082
|
constructor({
|
|
60069
60083
|
keyHashFunction = invokeObjectHash,
|
|
60070
60084
|
keyEqualityFunction = invokeObjectEquals,
|
|
60071
|
-
capacity = DEFAULT_INITIAL_CAPACITY,
|
|
60085
|
+
capacity = DEFAULT_INITIAL_CAPACITY$1,
|
|
60072
60086
|
loadFactor = DEFAULT_LOAD_FACTOR
|
|
60073
60087
|
} = {}) {
|
|
60074
60088
|
|
|
@@ -69341,6 +69355,36 @@ function computeSystemName(system) {
|
|
|
69341
69355
|
return system.constructor.name;
|
|
69342
69356
|
}
|
|
69343
69357
|
|
|
69358
|
+
/**
|
|
69359
|
+
*
|
|
69360
|
+
* @param {Object3D} object
|
|
69361
|
+
*/
|
|
69362
|
+
function threeUpdateMatrix(object) {
|
|
69363
|
+
object.updateMatrix();
|
|
69364
|
+
|
|
69365
|
+
const children = object.children;
|
|
69366
|
+
for (let i = 0, childCount = children.length; i < childCount; i++) {
|
|
69367
|
+
const child = children[i];
|
|
69368
|
+
|
|
69369
|
+
threeUpdateMatrix(child);
|
|
69370
|
+
}
|
|
69371
|
+
}
|
|
69372
|
+
|
|
69373
|
+
/**
|
|
69374
|
+
*
|
|
69375
|
+
* @param {Object3D} object3
|
|
69376
|
+
*/
|
|
69377
|
+
function threeUpdateTransform(object3) {
|
|
69378
|
+
|
|
69379
|
+
/**
|
|
69380
|
+
signal that transformation matrix should be updated
|
|
69381
|
+
@see https://threejs.org/docs/index.html#api/core/Object3D.matrixWorldNeedsUpdate
|
|
69382
|
+
*/
|
|
69383
|
+
threeUpdateMatrix(object3);
|
|
69384
|
+
|
|
69385
|
+
object3.updateMatrixWorld(false);
|
|
69386
|
+
}
|
|
69387
|
+
|
|
69344
69388
|
/**
|
|
69345
69389
|
*
|
|
69346
69390
|
* @param {Camera} c
|
|
@@ -70087,50 +70131,43 @@ function set_camera_aspect_ratio(camera, width, height) {
|
|
|
70087
70131
|
|
|
70088
70132
|
/**
|
|
70089
70133
|
*
|
|
70090
|
-
* @param {
|
|
70134
|
+
* @param {Camera} camera
|
|
70091
70135
|
*/
|
|
70092
|
-
function
|
|
70093
|
-
object.updateMatrix();
|
|
70136
|
+
function update_camera_transform(camera) {
|
|
70094
70137
|
|
|
70095
|
-
const
|
|
70096
|
-
for (let i = 0, childCount = children.length; i < childCount; i++) {
|
|
70097
|
-
const child = children[i];
|
|
70138
|
+
const three_camera = camera.object;
|
|
70098
70139
|
|
|
70099
|
-
|
|
70140
|
+
if (three_camera === null) {
|
|
70141
|
+
return;
|
|
70100
70142
|
}
|
|
70143
|
+
|
|
70144
|
+
three_camera.updateProjectionMatrix();
|
|
70145
|
+
threeUpdateTransform(three_camera);
|
|
70101
70146
|
}
|
|
70102
70147
|
|
|
70103
70148
|
/**
|
|
70104
70149
|
*
|
|
70105
|
-
* @param {
|
|
70150
|
+
* @param {THREE.Camera} object
|
|
70151
|
+
* @param {Quaternion} rotation
|
|
70106
70152
|
*/
|
|
70107
|
-
function
|
|
70153
|
+
function three_camera_set_transform_rotation(object, rotation) {
|
|
70108
70154
|
|
|
70109
|
-
|
|
70110
|
-
|
|
70111
|
-
|
|
70155
|
+
/*
|
|
70156
|
+
NOTE: I'm not sure why, but three.js camera points in the opposite direction to normal objects
|
|
70157
|
+
See: https://github.com/mrdoob/three.js/blob/412b99a7f26e117ea97f40eb53d010ab81aa3279/src/core/Object3D.js#L282
|
|
70112
70158
|
*/
|
|
70113
|
-
threeUpdateMatrix(object3);
|
|
70114
70159
|
|
|
70115
|
-
|
|
70116
|
-
}
|
|
70117
|
-
|
|
70118
|
-
/**
|
|
70119
|
-
*
|
|
70120
|
-
* @param {Camera} camera
|
|
70121
|
-
*/
|
|
70122
|
-
function update_camera_transform(camera) {
|
|
70160
|
+
invertQuaternionOrientation(object.quaternion, rotation);
|
|
70123
70161
|
|
|
70124
|
-
|
|
70162
|
+
object.rotation.setFromQuaternion(object.quaternion);
|
|
70125
70163
|
|
|
70126
|
-
|
|
70127
|
-
|
|
70128
|
-
|
|
70164
|
+
// rotation.__setThreeEuler(camera.object.rotation); // seems unnecessary, based on Object3D.lookAt implementation
|
|
70165
|
+
// camera.object.quaternion.set(rotation.x, rotation.y, rotation.z, rotation.w);
|
|
70166
|
+
|
|
70167
|
+
object.updateProjectionMatrix();
|
|
70168
|
+
threeUpdateTransform(object);
|
|
70169
|
+
}
|
|
70129
70170
|
|
|
70130
|
-
three_camera.updateProjectionMatrix();
|
|
70131
|
-
threeUpdateTransform(three_camera);
|
|
70132
|
-
}
|
|
70133
|
-
|
|
70134
70171
|
class CameraSystem extends System {
|
|
70135
70172
|
/**
|
|
70136
70173
|
*
|
|
@@ -70219,19 +70256,7 @@ class CameraSystem extends System {
|
|
|
70219
70256
|
function synchronizeRotation() {
|
|
70220
70257
|
const rotation = transform.rotation;
|
|
70221
70258
|
|
|
70222
|
-
|
|
70223
|
-
NOTE: I'm not sure why, but three.js camera points in the opposite direction to normal objects
|
|
70224
|
-
See: https://github.com/mrdoob/three.js/blob/412b99a7f26e117ea97f40eb53d010ab81aa3279/src/core/Object3D.js#L282
|
|
70225
|
-
*/
|
|
70226
|
-
|
|
70227
|
-
invertQuaternionOrientation(camera.object.quaternion, rotation);
|
|
70228
|
-
|
|
70229
|
-
camera.object.rotation.setFromQuaternion(camera.object.quaternion);
|
|
70230
|
-
|
|
70231
|
-
// rotation.__setThreeEuler(camera.object.rotation); // seems unnecessary, based on Object3D.lookAt implementation
|
|
70232
|
-
// camera.object.quaternion.set(rotation.x, rotation.y, rotation.z, rotation.w);
|
|
70233
|
-
|
|
70234
|
-
update_camera_transform(camera);
|
|
70259
|
+
three_camera_set_transform_rotation(camera.object, rotation);
|
|
70235
70260
|
}
|
|
70236
70261
|
|
|
70237
70262
|
function rebuild() {
|
|
@@ -70750,16 +70775,25 @@ const EntityFlags = {
|
|
|
70750
70775
|
WatchDestruction: 4
|
|
70751
70776
|
};
|
|
70752
70777
|
|
|
70778
|
+
/**
|
|
70779
|
+
* Align to the nearest number divisible by 32, rounding up
|
|
70780
|
+
* @param {number} n
|
|
70781
|
+
* @returns {number}
|
|
70782
|
+
*/
|
|
70783
|
+
function align_32(n) {
|
|
70784
|
+
return ((n + 31) >>> 5) << 5
|
|
70785
|
+
}
|
|
70786
|
+
|
|
70753
70787
|
/**
|
|
70754
70788
|
* de Bruijn sequence
|
|
70755
70789
|
* @see https://graphics.stanford.edu/~seander/bithacks.html
|
|
70756
70790
|
* @type {Uint8Array}
|
|
70757
70791
|
*/
|
|
70758
|
-
const
|
|
70792
|
+
const msb_lut_de_bruijn = new Uint8Array([
|
|
70759
70793
|
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
|
|
70760
70794
|
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
|
|
70761
|
-
]);
|
|
70762
|
-
|
|
70795
|
+
]);
|
|
70796
|
+
|
|
70763
70797
|
/**
|
|
70764
70798
|
* Get index of the least significant set bit
|
|
70765
70799
|
* Also known as ctz32 or "count trailing zeroes"
|
|
@@ -70768,9 +70802,9 @@ const msb_lut = new Uint8Array([
|
|
|
70768
70802
|
* @returns {number}
|
|
70769
70803
|
*/
|
|
70770
70804
|
function lsb_32(v) {
|
|
70771
|
-
return
|
|
70772
|
-
}
|
|
70773
|
-
|
|
70805
|
+
return msb_lut_de_bruijn[((v & -v) * 0x077CB531) >>> 27];
|
|
70806
|
+
}
|
|
70807
|
+
|
|
70774
70808
|
/**
|
|
70775
70809
|
* Used for overallocating space when bit set needs to grow
|
|
70776
70810
|
* @constant
|
|
@@ -70791,12 +70825,20 @@ const SHRINK_FACTOR$1 = 0.5;
|
|
|
70791
70825
|
*/
|
|
70792
70826
|
const RESIZE_COUNT_THRESHOLD = 128;
|
|
70793
70827
|
|
|
70828
|
+
/**
|
|
70829
|
+
* @readonly
|
|
70830
|
+
* @type {number}
|
|
70831
|
+
*/
|
|
70832
|
+
const DEFAULT_INITIAL_CAPACITY = 64;
|
|
70833
|
+
|
|
70794
70834
|
class BitSet {
|
|
70795
70835
|
/**
|
|
70796
70836
|
* Dynamically sized bit field
|
|
70797
70837
|
* @constructor
|
|
70838
|
+
* @param {number} [initial_capacity]
|
|
70798
70839
|
*/
|
|
70799
|
-
constructor() {
|
|
70840
|
+
constructor(initial_capacity = DEFAULT_INITIAL_CAPACITY) {
|
|
70841
|
+
|
|
70800
70842
|
/**
|
|
70801
70843
|
* Number of bits currently in use
|
|
70802
70844
|
* @private
|
|
@@ -70809,7 +70851,7 @@ class BitSet {
|
|
|
70809
70851
|
* @private
|
|
70810
70852
|
* @type {number}
|
|
70811
70853
|
*/
|
|
70812
|
-
this.__capacity =
|
|
70854
|
+
this.__capacity = align_32(initial_capacity);
|
|
70813
70855
|
|
|
70814
70856
|
/**
|
|
70815
70857
|
* Uint32-backed storage
|
|
@@ -71335,9 +71377,7 @@ class BitSet {
|
|
|
71335
71377
|
* @returns {BitSet}
|
|
71336
71378
|
*/
|
|
71337
71379
|
static fixedSize(x) {
|
|
71338
|
-
const r = new BitSet();
|
|
71339
|
-
|
|
71340
|
-
r.setCapacity(x);
|
|
71380
|
+
const r = new BitSet(x);
|
|
71341
71381
|
|
|
71342
71382
|
//prevent resizing
|
|
71343
71383
|
r.__shrinkFactor = 0;
|
package/package.json
CHANGED
package/src/core/assert.d.ts
CHANGED
|
@@ -79,10 +79,10 @@ export namespace assert {
|
|
|
79
79
|
export function isArray<T>(value: T[], name?: string): void;
|
|
80
80
|
/**
|
|
81
81
|
* @template T
|
|
82
|
-
* @param {ArrayLike<T>|T[]} value
|
|
82
|
+
* @param {ArrayLike<T>|T[]|Uint32Array|Float32Array} value
|
|
83
83
|
* @param {string} name
|
|
84
84
|
*/
|
|
85
|
-
export function isArrayLike<T>(value: ArrayLike<T> | T[], name?: string): void;
|
|
85
|
+
export function isArrayLike<T>(value: Uint32Array | Float32Array | ArrayLike<T> | T[], name?: string): void;
|
|
86
86
|
/**
|
|
87
87
|
*
|
|
88
88
|
* @param {*} value
|
package/src/core/assert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../src/core/assert.js"],"names":[],"mappings":"AA+BA,6CAIC;;IAsJD;;;;;OAKG;IACH,kEAQC;;;;;;;;;;;;;;;IAmBD;;;;;;OAMG;IACH,uGAGC;IAGD;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,2DAMC;IAED;;;;OAIG;IACH,4DAMC;IAED;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,2DAMC;IAED;;;;OAIG;IACH,sEAMC;IAED;;;;OAIG;IACH,4DAKC;IAED;;;;OAIG;IACH
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../src/core/assert.js"],"names":[],"mappings":"AA+BA,6CAIC;;IAsJD;;;;;OAKG;IACH,kEAQC;;;;;;;;;;;;;;;IAmBD;;;;;;OAMG;IACH,uGAGC;IAGD;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,2DAMC;IAED;;;;OAIG;IACH,4DAMC;IAED;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,2DAMC;IAED;;;;OAIG;IACH,sEAMC;IAED;;;;OAIG;IACH,4DAKC;IAED;;;;OAIG;IACH,4GAKC;IAGD;;;;OAIG;IACH,yDAMC;IAED;;;;OAIG;IACH,wDAIC;IAED;;;;OAIG;IACH,yDAMC;IAED;;;;OAIG;IACH,2DAIC;IAED;;;;OAIG;IACH,mEAIC;IAED;;;;;OAKG;IACH,2EAgBC;;AA/ZD,wDAEC;AAED,6CAEC;AAfD,qDAOC;AAUD;;;;;GAKG;AACH,kCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAIhB;AAQD;;;;;GAKG;AACH,gCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AAyBD;;;;;GAKG;AACH,uCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AA5CD;;;;;GAKG;AACH,6BAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AAyBD;;;;;GAKG;AACH,oCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AAKD;;;;;GAKG;AACH,0CAHW,MAAM,cACN,MAAM,QAehB;AAED;;;;;GAKG;AACH,iEAFW,MAAM,QAIhB;AAED;;;;;GAKG;AACH,mEAFW,MAAM,QAIhB;AAED;;;;;GAKG;AACH,+IAFW,MAAM,QAMhB"}
|
package/src/core/assert.js
CHANGED
|
@@ -334,7 +334,7 @@ assert.isArray = function (value, name = 'value') {
|
|
|
334
334
|
|
|
335
335
|
/**
|
|
336
336
|
* @template T
|
|
337
|
-
* @param {ArrayLike<T>|T[]} value
|
|
337
|
+
* @param {ArrayLike<T>|T[]|Uint32Array|Float32Array} value
|
|
338
338
|
* @param {string} name
|
|
339
339
|
*/
|
|
340
340
|
assert.isArrayLike = function (value, name = 'value') {
|
|
@@ -5,6 +5,12 @@ export class BitSet {
|
|
|
5
5
|
* @returns {BitSet}
|
|
6
6
|
*/
|
|
7
7
|
static fixedSize(x: number): BitSet;
|
|
8
|
+
/**
|
|
9
|
+
* Dynamically sized bit field
|
|
10
|
+
* @constructor
|
|
11
|
+
* @param {number} [initial_capacity]
|
|
12
|
+
*/
|
|
13
|
+
constructor(initial_capacity?: number);
|
|
8
14
|
/**
|
|
9
15
|
* Number of bits currently in use
|
|
10
16
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitSet.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/BitSet.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BitSet.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/BitSet.js"],"names":[],"mappings":"AAgCA;IAyiBI;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CASlB;IApjBD;;;;OAIG;IACH,+BAFW,MAAM,EA8BhB;IAzBG;;;;OAIG;IACH,iBAAiB;IAEjB;;;;OAIG;IACH,mBAA4C;IAE5C;;;;OAIG;IACH,sBAA0D;IAE1D;;OAEG;IACH,gBAFU,MAAM,CAEmB;IAGvC,sBAEC;IAED;;;OAGG;IACH,mBAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,uBAFW,MAAM,QAUhB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAsBC;IAED,uBAMC;IAED;;;;OAIG;IACH,oBAyBC;IAED;;;;OAIG;IACH,oCAqCC;IAED;;;;OAIG;IACH,4BAFa,MAAM,CAuDlB;IAED;;;;OAIG;IACH,8BAFa,MAAM,CAkDlB;IAED;;;;OAIG;IACH,0BAFW,OAAO,QAmCjB;IAED;;;OAGG;IACH,2BAEC;IAED;;;;OAIG;IACH,qBAHW,MAAM,YACN,MAAM,QAWhB;IAED;;;;OAIG;IACH,uBAHW,MAAM,YACN,MAAM,QAShB;IAED;;;OAGG;IACH,SAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAFa,OAAO,CAkBnB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,gBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAQhB;IAED;;OAEG;IACH,cAgBC;IAED;;;OAGG;IACH,YAFW,MAAM,QAoChB;CAeJ"}
|
|
@@ -1,43 +1,8 @@
|
|
|
1
1
|
import { assert } from "../assert.js";
|
|
2
2
|
import { max3 } from "../math/max3.js";
|
|
3
3
|
import { min2 } from "../math/min2.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* de Bruijn sequence
|
|
7
|
-
* @see https://graphics.stanford.edu/~seander/bithacks.html
|
|
8
|
-
* @type {Uint8Array}
|
|
9
|
-
*/
|
|
10
|
-
const msb_lut = new Uint8Array([
|
|
11
|
-
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
|
|
12
|
-
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
|
|
13
|
-
]);
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* get most significant set bit
|
|
17
|
-
* @see https://graphics.stanford.edu/~seander/bithacks.html
|
|
18
|
-
* @param {number} v 32 bit integer
|
|
19
|
-
* @returns {number} integer position of most significant bit
|
|
20
|
-
*/
|
|
21
|
-
function msb_32(v) {
|
|
22
|
-
v |= v >>> 1;
|
|
23
|
-
v |= v >>> 2;
|
|
24
|
-
v |= v >>> 4;
|
|
25
|
-
v |= v >>> 8;
|
|
26
|
-
v |= v >>> 16;
|
|
27
|
-
v = (v >>> 1) + 1;
|
|
28
|
-
return msb_lut[(v * 0x077CB531) >>> 27];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Get index of the least significant set bit
|
|
33
|
-
* Also known as ctz32 or "count trailing zeroes"
|
|
34
|
-
* @see https://graphics.stanford.edu/~seander/bithacks.html
|
|
35
|
-
* @param {number} v
|
|
36
|
-
* @returns {number}
|
|
37
|
-
*/
|
|
38
|
-
function lsb_32(v) {
|
|
39
|
-
return msb_lut[((v & -v) * 0x077CB531) >>> 27];
|
|
40
|
-
}
|
|
4
|
+
import { align_32 } from "./align_32.js";
|
|
5
|
+
import { lsb_32 } from "./lsb_32.js";
|
|
41
6
|
|
|
42
7
|
/**
|
|
43
8
|
* Used for overallocating space when bit set needs to grow
|
|
@@ -59,12 +24,21 @@ const SHRINK_FACTOR = 0.5;
|
|
|
59
24
|
*/
|
|
60
25
|
const RESIZE_COUNT_THRESHOLD = 128;
|
|
61
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @readonly
|
|
29
|
+
* @type {number}
|
|
30
|
+
*/
|
|
31
|
+
const DEFAULT_INITIAL_CAPACITY = 64;
|
|
32
|
+
|
|
62
33
|
export class BitSet {
|
|
63
34
|
/**
|
|
64
35
|
* Dynamically sized bit field
|
|
65
36
|
* @constructor
|
|
37
|
+
* @param {number} [initial_capacity]
|
|
66
38
|
*/
|
|
67
|
-
constructor() {
|
|
39
|
+
constructor(initial_capacity = DEFAULT_INITIAL_CAPACITY) {
|
|
40
|
+
assert.isNonNegativeInteger(initial_capacity, 'initial_capacity');
|
|
41
|
+
|
|
68
42
|
/**
|
|
69
43
|
* Number of bits currently in use
|
|
70
44
|
* @private
|
|
@@ -77,7 +51,7 @@ export class BitSet {
|
|
|
77
51
|
* @private
|
|
78
52
|
* @type {number}
|
|
79
53
|
*/
|
|
80
|
-
this.__capacity =
|
|
54
|
+
this.__capacity = align_32(initial_capacity);
|
|
81
55
|
|
|
82
56
|
/**
|
|
83
57
|
* Uint32-backed storage
|
|
@@ -615,9 +589,7 @@ export class BitSet {
|
|
|
615
589
|
* @returns {BitSet}
|
|
616
590
|
*/
|
|
617
591
|
static fixedSize(x) {
|
|
618
|
-
const r = new BitSet();
|
|
619
|
-
|
|
620
|
-
r.setCapacity(x);
|
|
592
|
+
const r = new BitSet(x);
|
|
621
593
|
|
|
622
594
|
//prevent resizing
|
|
623
595
|
r.__shrinkFactor = 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"align_32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/align_32.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,4BAHW,MAAM,GACJ,MAAM,CAIlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"align_32.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/align_32.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { align_32 } from "./align_32.js";
|
|
2
|
+
|
|
3
|
+
test("basics", () => {
|
|
4
|
+
expect(align_32(0)).toBe(0);
|
|
5
|
+
expect(align_32(1)).toBe(32);
|
|
6
|
+
expect(align_32(31)).toBe(32);
|
|
7
|
+
expect(align_32(32)).toBe(32);
|
|
8
|
+
expect(align_32(33)).toBe(64);
|
|
9
|
+
expect(align_32(63)).toBe(64);
|
|
10
|
+
expect(align_32(64)).toBe(64);
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"align_4.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/align_4.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { align_4 } from "./align_4.js";
|
|
2
|
+
|
|
3
|
+
test("basics", () => {
|
|
4
|
+
|
|
5
|
+
expect(align_4(0)).toBe(0);
|
|
6
|
+
expect(align_4(1)).toBe(4);
|
|
7
|
+
expect(align_4(3)).toBe(4);
|
|
8
|
+
expect(align_4(4)).toBe(4);
|
|
9
|
+
|
|
10
|
+
expect(align_4(5)).toBe(8);
|
|
11
|
+
expect(align_4(6)).toBe(8);
|
|
12
|
+
expect(align_4(7)).toBe(8);
|
|
13
|
+
expect(align_4(8)).toBe(8);
|
|
14
|
+
|
|
15
|
+
expect(align_4(9)).toBe(12);
|
|
16
|
+
expect(align_4(10)).toBe(12);
|
|
17
|
+
expect(align_4(11)).toBe(12);
|
|
18
|
+
expect(align_4(12)).toBe(12);
|
|
19
|
+
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"de_interleave_2_bits.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/de_interleave_2_bits.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAHW,MAAM,GACJ,MAAM,CAWlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex2dec.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/hex2dec.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { hex2dec } from "./hex2dec.js";
|
|
2
|
+
|
|
3
|
+
test("basics", () => {
|
|
4
|
+
|
|
5
|
+
expect(hex2dec("0")).toBe(0)
|
|
6
|
+
expect(hex2dec("1")).toBe(1)
|
|
7
|
+
expect(hex2dec("2")).toBe(2)
|
|
8
|
+
expect(hex2dec("3")).toBe(3)
|
|
9
|
+
expect(hex2dec("4")).toBe(4)
|
|
10
|
+
expect(hex2dec("5")).toBe(5)
|
|
11
|
+
expect(hex2dec("6")).toBe(6)
|
|
12
|
+
expect(hex2dec("7")).toBe(7)
|
|
13
|
+
expect(hex2dec("8")).toBe(8)
|
|
14
|
+
expect(hex2dec("9")).toBe(9)
|
|
15
|
+
expect(hex2dec("A")).toBe(0xA)
|
|
16
|
+
expect(hex2dec("B")).toBe(0xB)
|
|
17
|
+
expect(hex2dec("C")).toBe(0xC)
|
|
18
|
+
expect(hex2dec("D")).toBe(0xD)
|
|
19
|
+
expect(hex2dec("E")).toBe(0xE)
|
|
20
|
+
expect(hex2dec("F")).toBe(0xF)
|
|
21
|
+
|
|
22
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get index of the least significant set bit
|
|
3
|
+
* Also known as ctz32 or "count trailing zeroes"
|
|
4
|
+
* @see https://graphics.stanford.edu/~seander/bithacks.html
|
|
5
|
+
* @param {number} v
|
|
6
|
+
* @returns {number}
|
|
7
|
+
*/
|
|
8
|
+
export function lsb_32(v: number): number;
|
|
9
|
+
//# sourceMappingURL=lsb_32.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsb_32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/lsb_32.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,0BAHW,MAAM,GACJ,MAAM,CAIlB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { msb_lut_de_bruijn } from "./msb_lut_de_bruijn.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get index of the least significant set bit
|
|
5
|
+
* Also known as ctz32 or "count trailing zeroes"
|
|
6
|
+
* @see https://graphics.stanford.edu/~seander/bithacks.html
|
|
7
|
+
* @param {number} v
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
export function lsb_32(v) {
|
|
11
|
+
return msb_lut_de_bruijn[((v & -v) * 0x077CB531) >>> 27];
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msb_32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/msb_32.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { msb_lut_de_bruijn } from "./msb_lut_de_bruijn.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* get most significant set bit
|
|
5
|
+
* @see https://graphics.stanford.edu/~seander/bithacks.html
|
|
6
|
+
* @param {number} x 32 bit integer
|
|
7
|
+
* @returns {number} integer position of most significant bit
|
|
8
|
+
*/
|
|
9
|
+
function msb_32(x) {
|
|
10
|
+
let v = x;
|
|
11
|
+
|
|
12
|
+
v |= v >>> 1;
|
|
13
|
+
v |= v >>> 2;
|
|
14
|
+
v |= v >>> 4;
|
|
15
|
+
v |= v >>> 8;
|
|
16
|
+
v |= v >>> 16;
|
|
17
|
+
v = (v >>> 1) + 1;
|
|
18
|
+
|
|
19
|
+
return msb_lut_de_bruijn[(v * 0x077CB531) >>> 27];
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msb_lut_de_bruijn.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/msb_lut_de_bruijn.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,gCAFU,UAAU,CAKjB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* de Bruijn sequence
|
|
3
|
+
* @see https://graphics.stanford.edu/~seander/bithacks.html
|
|
4
|
+
* @type {Uint8Array}
|
|
5
|
+
*/
|
|
6
|
+
export const msb_lut_de_bruijn = new Uint8Array([
|
|
7
|
+
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
|
|
8
|
+
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
|
|
9
|
+
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_by_2.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/split_by_2.spec.js"],"names":[],"mappings":""}
|