@woosh/meep-engine 2.108.4 → 2.109.0
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 +73 -48
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +73 -48
- 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/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/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 +25 -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/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/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/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/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +0 -86
- 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 +62 -28
- 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/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/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);
|
|
@@ -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() {
|
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') {
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"split_by_2.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/split_by_2.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { int32_to_binary_string } from "./int32_to_binary_string.js";
|
|
2
|
+
import { split_by_2 } from "./split_by_2.js";
|
|
3
|
+
|
|
4
|
+
test("zero", () => {
|
|
5
|
+
|
|
6
|
+
expect(split_by_2(0)).toEqual(0);
|
|
7
|
+
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
test("max value", () => {
|
|
11
|
+
|
|
12
|
+
expect(
|
|
13
|
+
int32_to_binary_string(split_by_2(0xFFFFFFFF))
|
|
14
|
+
).toEqual("01010101 01010101 01010101 01010101");
|
|
15
|
+
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("max 16bit value", () => {
|
|
19
|
+
expect(
|
|
20
|
+
int32_to_binary_string(split_by_2(0b1111111111111111))
|
|
21
|
+
).toEqual("01010101 01010101 01010101 01010101");
|
|
22
|
+
});
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* @param {BVH} bvh
|
|
5
5
|
* @param {number[]|Float32Array} index_array
|
|
6
6
|
* @param {number[]|Float32Array} position_array
|
|
7
|
+
* @param {Uint32Array} [morton_codes]
|
|
8
|
+
* @param {AABB3} [bounds]
|
|
7
9
|
*/
|
|
8
|
-
export function ebvh_build_for_geometry_morton(bvh: BVH, index_array: number[] | Float32Array, position_array: number[] | Float32Array): void;
|
|
10
|
+
export function ebvh_build_for_geometry_morton(bvh: BVH, index_array: number[] | Float32Array, position_array: number[] | Float32Array, morton_codes?: Uint32Array, bounds?: AABB3): void;
|
|
11
|
+
import { AABB3 } from "../../geom/3d/aabb/AABB3.js";
|
|
9
12
|
//# sourceMappingURL=ebvh_build_for_geometry_morton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ebvh_build_for_geometry_morton.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js"],"names":[],"mappings":"AAWA
|
|
1
|
+
{"version":3,"file":"ebvh_build_for_geometry_morton.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,sEALW,MAAM,EAAE,GAAC,YAAY,kBACrB,MAAM,EAAE,GAAC,YAAY,iBACrB,WAAW,WACX,KAAK,QA2Ff;sBA1GqB,6BAA6B"}
|
|
@@ -15,8 +15,16 @@ import { ebvh_build_hierarchy } from "./ebvh_build_hierarchy.js";
|
|
|
15
15
|
* @param {BVH} bvh
|
|
16
16
|
* @param {number[]|Float32Array} index_array
|
|
17
17
|
* @param {number[]|Float32Array} position_array
|
|
18
|
+
* @param {Uint32Array} [morton_codes]
|
|
19
|
+
* @param {AABB3} [bounds]
|
|
18
20
|
*/
|
|
19
|
-
export function ebvh_build_for_geometry_morton(
|
|
21
|
+
export function ebvh_build_for_geometry_morton(
|
|
22
|
+
bvh,
|
|
23
|
+
index_array,
|
|
24
|
+
position_array,
|
|
25
|
+
morton_codes = new Uint32Array(index_array.length / 3),
|
|
26
|
+
bounds = new AABB3()
|
|
27
|
+
) {
|
|
20
28
|
assert.defined(bvh, 'bvh');
|
|
21
29
|
|
|
22
30
|
assert.defined(index_array, 'index_array');
|
|
@@ -25,16 +33,19 @@ export function ebvh_build_for_geometry_morton(bvh, index_array, position_array)
|
|
|
25
33
|
assert.defined(position_array, 'position_array');
|
|
26
34
|
assert.isArrayLike(position_array, 'position_array');
|
|
27
35
|
|
|
36
|
+
assert.isArrayLike(morton_codes, 'morton_codes');
|
|
37
|
+
|
|
28
38
|
// clear out existing BVH
|
|
29
39
|
bvh.release_all();
|
|
30
40
|
|
|
31
|
-
const aabb3 = new AABB3();
|
|
32
|
-
|
|
33
41
|
// get bounds for the entire geometry
|
|
34
|
-
aabb3_from_v3_array(
|
|
42
|
+
aabb3_from_v3_array(bounds, position_array, position_array.length);
|
|
35
43
|
|
|
36
44
|
// allocate nodes
|
|
37
45
|
const tri_count = index_array.length / 3;
|
|
46
|
+
|
|
47
|
+
assert.greaterThanOrEqual(morton_codes.length, tri_count);
|
|
48
|
+
|
|
38
49
|
const node_leaf_count = tri_count;
|
|
39
50
|
const node_bin_count = max2(0, node_leaf_count - 1);
|
|
40
51
|
|
|
@@ -59,9 +70,7 @@ export function ebvh_build_for_geometry_morton(bvh, index_array, position_array)
|
|
|
59
70
|
sorted_triangle_order[i] = i;
|
|
60
71
|
}
|
|
61
72
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
build_triangle_morton_codes(morton_codes, tri_count, index_array, position_array, aabb3.x0, aabb3.y0, aabb3.z0, aabb3.x1, aabb3.y1, aabb3.z1);
|
|
73
|
+
build_triangle_morton_codes(morton_codes, tri_count, index_array, position_array, bounds.x0, bounds.y0, bounds.z0, bounds.x1, bounds.y1, bounds.z1);
|
|
65
74
|
|
|
66
75
|
// sort leaves by morton codes
|
|
67
76
|
array_quick_sort_by_lookup(sorted_triangle_order, morton_codes, 0, tri_count - 1);
|
|
@@ -35,8 +35,8 @@ export function ebvh_build_hierarchy(
|
|
|
35
35
|
let cursor = 0;
|
|
36
36
|
|
|
37
37
|
while (cursor + 1 < unprocessed_node_count) {
|
|
38
|
-
const child_1 = unprocessed_nodes[cursor++];
|
|
39
38
|
const child_2 = unprocessed_nodes[cursor++];
|
|
39
|
+
const child_1 = unprocessed_nodes[cursor++];
|
|
40
40
|
|
|
41
41
|
const parent = node_pool[used_index++];
|
|
42
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bvh_query_user_data_ray.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH,wDAXW,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"bvh_query_user_data_ray.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/bvh3/query/bvh_query_user_data_ray.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;GAaG;AACH,wDAXW,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,GACJ,MAAM,CA6ElB"}
|
|
@@ -29,14 +29,19 @@ export function bvh_query_user_data_ray(
|
|
|
29
29
|
return 0;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Move stack pointer to local variable scope to avoid de-referencing inside the loop
|
|
34
|
+
* @type {number}
|
|
35
|
+
*/
|
|
36
|
+
let pointer = stack.pointer;
|
|
32
37
|
|
|
33
38
|
/**
|
|
34
39
|
*
|
|
35
40
|
* @type {number}
|
|
36
41
|
*/
|
|
37
|
-
const stack_top =
|
|
42
|
+
const stack_top = pointer;
|
|
38
43
|
|
|
39
|
-
stack[
|
|
44
|
+
stack[pointer++] = root;
|
|
40
45
|
|
|
41
46
|
let result_cursor = result_offset;
|
|
42
47
|
|
|
@@ -47,13 +52,13 @@ export function bvh_query_user_data_ray(
|
|
|
47
52
|
const uint32 = bvh.__data_uint32;
|
|
48
53
|
|
|
49
54
|
do {
|
|
50
|
-
|
|
55
|
+
--pointer;
|
|
51
56
|
|
|
52
57
|
/**
|
|
53
58
|
*
|
|
54
59
|
* @type {number}
|
|
55
60
|
*/
|
|
56
|
-
const node = stack[
|
|
61
|
+
const node = stack[pointer];
|
|
57
62
|
|
|
58
63
|
const address = node * ELEMENT_WORD_COUNT;
|
|
59
64
|
|
|
@@ -77,15 +82,15 @@ export function bvh_query_user_data_ray(
|
|
|
77
82
|
// this is not a leaf node, push children onto traversal stack
|
|
78
83
|
const child_2 = uint32[address + COLUMN_CHILD_2];
|
|
79
84
|
|
|
80
|
-
stack[
|
|
81
|
-
stack[
|
|
85
|
+
stack[pointer++] = child_2;
|
|
86
|
+
stack[pointer++] = child_1;
|
|
82
87
|
|
|
83
88
|
} else {
|
|
84
89
|
// leaf node
|
|
85
90
|
|
|
86
91
|
result[result_cursor++] = uint32[address + COLUMN_USER_DATA];
|
|
87
92
|
}
|
|
88
|
-
} while (
|
|
93
|
+
} while (pointer > stack_top);
|
|
89
94
|
|
|
90
95
|
return result_cursor - result_offset;
|
|
91
96
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle_circumference.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/circle/circle_circumference.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,6CAHW,MAAM,GACJ,MAAM,CAMlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute_polygon_area_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/compute_polygon_area_2d.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,gDAJW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,eAClC,MAAM,GACJ,MAAM,
|
|
1
|
+
{"version":3,"file":"compute_polygon_area_2d.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/2d/compute_polygon_area_2d.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,gDAJW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,eAClC,MAAM,GACJ,MAAM,CA6BlB"}
|
|
@@ -8,11 +8,13 @@ export function compute_polygon_area_2d(points, point_count) {
|
|
|
8
8
|
let sum = 0;
|
|
9
9
|
|
|
10
10
|
for (let i = 0; i < point_count - 1; i++) {
|
|
11
|
-
const
|
|
12
|
-
const y0 = points[(i) * 2 + 1];
|
|
11
|
+
const i2 = i * 2;
|
|
13
12
|
|
|
14
|
-
const
|
|
15
|
-
const
|
|
13
|
+
const x0 = points[i2];
|
|
14
|
+
const y0 = points[i2 + 1];
|
|
15
|
+
|
|
16
|
+
const x1 = points[i2 + 2];
|
|
17
|
+
const y1 = points[i2 + 3];
|
|
16
18
|
|
|
17
19
|
sum += x0 * y1 - y0 * x1;
|
|
18
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assert } from "../../../assert.js";
|
|
2
|
-
import { de_interleave_2_bits } from "../../../binary/
|
|
2
|
+
import { de_interleave_2_bits } from "../../../binary/de_interleave_2_bits.js";
|
|
3
3
|
import { split_by_2 } from "../../../binary/split_by_2.js";
|
|
4
4
|
import { UINT32_MAX } from "../../../binary/UINT32_MAX.js";
|
|
5
5
|
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @param {number} by
|
|
9
9
|
* @param {number} cx
|
|
10
10
|
* @param {number} cy
|
|
11
|
-
* @param {number} px
|
|
12
|
-
* @param {number} py
|
|
11
|
+
* @param {number} px reference point X
|
|
12
|
+
* @param {number} py reference point Y
|
|
13
13
|
*/
|
|
14
14
|
export function triangle2d_get_barycentric(output: number[], output_offset: number, ax: number, ay: number, bx: number, by: number, cx: number, cy: number, px: number, py: number): void;
|
|
15
15
|
//# sourceMappingURL=triangle2d_get_barycentric.d.ts.map
|
|
@@ -10,8 +10,8 @@ import { v2_dot } from "../vec2/v2_dot.js";
|
|
|
10
10
|
* @param {number} by
|
|
11
11
|
* @param {number} cx
|
|
12
12
|
* @param {number} cy
|
|
13
|
-
* @param {number} px
|
|
14
|
-
* @param {number} py
|
|
13
|
+
* @param {number} px reference point X
|
|
14
|
+
* @param {number} py reference point Y
|
|
15
15
|
*/
|
|
16
16
|
export function triangle2d_get_barycentric(
|
|
17
17
|
output, output_offset,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 3D ray
|
|
3
|
+
*/
|
|
4
|
+
export class Ray3 {
|
|
5
|
+
origin: Vector3;
|
|
6
|
+
direction: Vector3;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {number[]|mat4|Float32Array} m4
|
|
10
|
+
*/
|
|
11
|
+
applyMatrix4(m4: number[] | mat4 | Float32Array): void;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {Ray3} other
|
|
15
|
+
*/
|
|
16
|
+
copy(other: Ray3): void;
|
|
17
|
+
}
|
|
18
|
+
import Vector3 from "../Vector3.js";
|
|
19
|
+
//# sourceMappingURL=Ray3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ray3.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/Ray3.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACI,gBAAsB;IACtB,mBAAyB;IAEzB;;;OAGG;IACH,iBAFW,MAAM,EAAE,UAAM,YAAY,QAKpC;IAED;;;OAGG;IACH,YAFW,IAAI,QAKd;CACJ;oBA1BmB,eAAe"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Vector3 from "../Vector3.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 3D ray
|
|
5
|
+
*/
|
|
6
|
+
export class Ray3 {
|
|
7
|
+
origin = new Vector3()
|
|
8
|
+
direction = new Vector3()
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {number[]|mat4|Float32Array} m4
|
|
13
|
+
*/
|
|
14
|
+
applyMatrix4(m4) {
|
|
15
|
+
this.origin.applyMatrix4(m4);
|
|
16
|
+
this.direction.applyDirectionMatrix4(m4);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {Ray3} other
|
|
22
|
+
*/
|
|
23
|
+
copy(other) {
|
|
24
|
+
this.origin.copy(other.origin);
|
|
25
|
+
this.direction.copy(other.direction);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]|ArrayLike<number>|Float32Array} output 6 component vector, [origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]
|
|
4
|
+
* @param {number} output_offset
|
|
5
|
+
* @param {number[]|ArrayLike<number>|Float32Array} input 6 component vector, [origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]
|
|
6
|
+
* @param {number} input_offset
|
|
7
|
+
* @param {number} distance
|
|
8
|
+
*/
|
|
9
|
+
export function ray3_shift_origin_along_direction(output: number[] | ArrayLike<number> | Float32Array, output_offset: number, input: number[] | ArrayLike<number> | Float32Array, input_offset: number, distance: number): void;
|
|
10
|
+
//# sourceMappingURL=ray3_shift_origin_along_direction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ray3_shift_origin_along_direction.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/ray/ray3_shift_origin_along_direction.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,0DANW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,iBACvC,MAAM,SACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,gBACvC,MAAM,YACN,MAAM,QAyBhB"}
|