@woosh/meep-engine 2.108.3 → 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 +91 -60
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +91 -60
- 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/formatToChannelCount.d.ts.map +1 -1
- package/src/engine/graphics/texture/formatToChannelCount.js +8 -1
- 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);
|
|
@@ -5462,7 +5476,7 @@ const UnsignedShort5551Type = 1018;
|
|
|
5462
5476
|
const UnsignedShort565Type = 1019;
|
|
5463
5477
|
const UnsignedInt248Type = 1020;
|
|
5464
5478
|
const AlphaFormat = 1021;
|
|
5465
|
-
const RGBFormat = 1022;
|
|
5479
|
+
const RGBFormat$1 = 1022;
|
|
5466
5480
|
const RGBAFormat = 1023;
|
|
5467
5481
|
const LuminanceFormat = 1024;
|
|
5468
5482
|
const LuminanceAlphaFormat = 1025;
|
|
@@ -23394,7 +23408,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
23394
23408
|
( parameters.toneMapping !== NoToneMapping ) ? getToneMappingFunction( 'toneMapping', parameters.toneMapping ) : '',
|
|
23395
23409
|
|
|
23396
23410
|
parameters.dithering ? '#define DITHERING' : '',
|
|
23397
|
-
parameters.format === RGBFormat ? '#define OPAQUE' : '',
|
|
23411
|
+
parameters.format === RGBFormat$1 ? '#define OPAQUE' : '',
|
|
23398
23412
|
|
|
23399
23413
|
ShaderChunk[ 'encodings_pars_fragment' ], // this code is required here because it is used by the various encoding/decoding function defined below
|
|
23400
23414
|
parameters.map ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '',
|
|
@@ -27492,7 +27506,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
27492
27506
|
|
|
27493
27507
|
mipmap = mipmaps[ i ];
|
|
27494
27508
|
|
|
27495
|
-
if ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) {
|
|
27509
|
+
if ( texture.format !== RGBAFormat && texture.format !== RGBFormat$1 ) {
|
|
27496
27510
|
|
|
27497
27511
|
if ( glFormat !== null ) {
|
|
27498
27512
|
|
|
@@ -27703,7 +27717,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
27703
27717
|
|
|
27704
27718
|
const mipmap = mipmaps[ j ];
|
|
27705
27719
|
|
|
27706
|
-
if ( texture.format !== RGBAFormat && texture.format !== RGBFormat ) {
|
|
27720
|
+
if ( texture.format !== RGBAFormat && texture.format !== RGBFormat$1 ) {
|
|
27707
27721
|
|
|
27708
27722
|
if ( glFormat !== null ) {
|
|
27709
27723
|
|
|
@@ -28120,7 +28134,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
28120
28134
|
|
|
28121
28135
|
// Handles WebGL2 RGBFormat fallback - #18858
|
|
28122
28136
|
|
|
28123
|
-
if ( isWebGL2 && texture.format === RGBFormat && ( texture.type === FloatType || texture.type === HalfFloatType ) ) {
|
|
28137
|
+
if ( isWebGL2 && texture.format === RGBFormat$1 && ( texture.type === FloatType || texture.type === HalfFloatType ) ) {
|
|
28124
28138
|
|
|
28125
28139
|
texture.format = RGBAFormat;
|
|
28126
28140
|
|
|
@@ -28465,7 +28479,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
|
|
|
28465
28479
|
}
|
|
28466
28480
|
|
|
28467
28481
|
if ( p === AlphaFormat ) return 6406;
|
|
28468
|
-
if ( p === RGBFormat ) return 6407;
|
|
28482
|
+
if ( p === RGBFormat$1 ) return 6407;
|
|
28469
28483
|
if ( p === RGBAFormat ) return 6408;
|
|
28470
28484
|
if ( p === LuminanceFormat ) return 6409;
|
|
28471
28485
|
if ( p === LuminanceAlphaFormat ) return 6410;
|
|
@@ -29260,7 +29274,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
29260
29274
|
glProjLayer.textureWidth,
|
|
29261
29275
|
glProjLayer.textureHeight,
|
|
29262
29276
|
{
|
|
29263
|
-
format: attributes.alpha ? RGBAFormat : RGBFormat,
|
|
29277
|
+
format: attributes.alpha ? RGBAFormat : RGBFormat$1,
|
|
29264
29278
|
type: UnsignedByteType,
|
|
29265
29279
|
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
29266
29280
|
stencilBuffer: attributes.stencil,
|
|
@@ -34185,7 +34199,7 @@ class VideoTexture extends Texture {
|
|
|
34185
34199
|
|
|
34186
34200
|
super( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
|
|
34187
34201
|
|
|
34188
|
-
this.format = format !== undefined ? format : RGBFormat;
|
|
34202
|
+
this.format = format !== undefined ? format : RGBFormat$1;
|
|
34189
34203
|
|
|
34190
34204
|
this.minFilter = minFilter !== undefined ? minFilter : LinearFilter;
|
|
34191
34205
|
this.magFilter = magFilter !== undefined ? magFilter : LinearFilter;
|
|
@@ -58962,7 +58976,7 @@ function writeSample2DDataToDataTexture(sampler, texture) {
|
|
|
58962
58976
|
throw new Error('itemSize is 2 and texture.format is not RGFormat');
|
|
58963
58977
|
}
|
|
58964
58978
|
} else if (sampler.itemSize === 3) {
|
|
58965
|
-
if (texture.format !== RGBFormat) {
|
|
58979
|
+
if (texture.format !== RGBFormat$1) {
|
|
58966
58980
|
throw new Error('itemSize is 2 and texture.format is not RGBFormat');
|
|
58967
58981
|
}
|
|
58968
58982
|
} else if (sampler.itemSize === 4) {
|
|
@@ -59186,7 +59200,7 @@ function channelCountToThreeTextureFormat(count) {
|
|
|
59186
59200
|
case 2:
|
|
59187
59201
|
return RGFormat;
|
|
59188
59202
|
case 3:
|
|
59189
|
-
return RGBFormat;
|
|
59203
|
+
return RGBFormat$1;
|
|
59190
59204
|
case 4:
|
|
59191
59205
|
return RGBAFormat;
|
|
59192
59206
|
default:
|
|
@@ -62741,7 +62755,7 @@ class TerrainLayers {
|
|
|
62741
62755
|
* @type {DataTexture2DArray}
|
|
62742
62756
|
*/
|
|
62743
62757
|
this.texture = new DataTexture2DArray(new Uint8Array(3), 1, 1, 1);
|
|
62744
|
-
this.texture.format = RGBFormat;
|
|
62758
|
+
this.texture.format = RGBFormat$1;
|
|
62745
62759
|
this.texture.type = UnsignedByteType;
|
|
62746
62760
|
|
|
62747
62761
|
this.texture.wrapS = RepeatWrapping;
|
|
@@ -67532,6 +67546,12 @@ const CopyShader = {
|
|
|
67532
67546
|
|
|
67533
67547
|
};
|
|
67534
67548
|
|
|
67549
|
+
/**
|
|
67550
|
+
* WebGL constant, declared explicitly to avoid issues with later THREE.js versions where it is absent
|
|
67551
|
+
* @type {number}
|
|
67552
|
+
*/
|
|
67553
|
+
const RGBFormat = 1022;
|
|
67554
|
+
|
|
67535
67555
|
/**
|
|
67536
67556
|
*
|
|
67537
67557
|
* @param {number} format
|
|
@@ -69335,6 +69355,36 @@ function computeSystemName(system) {
|
|
|
69335
69355
|
return system.constructor.name;
|
|
69336
69356
|
}
|
|
69337
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
|
+
|
|
69338
69388
|
/**
|
|
69339
69389
|
*
|
|
69340
69390
|
* @param {Camera} c
|
|
@@ -70081,50 +70131,43 @@ function set_camera_aspect_ratio(camera, width, height) {
|
|
|
70081
70131
|
|
|
70082
70132
|
/**
|
|
70083
70133
|
*
|
|
70084
|
-
* @param {
|
|
70134
|
+
* @param {Camera} camera
|
|
70085
70135
|
*/
|
|
70086
|
-
function
|
|
70087
|
-
object.updateMatrix();
|
|
70136
|
+
function update_camera_transform(camera) {
|
|
70088
70137
|
|
|
70089
|
-
const
|
|
70090
|
-
for (let i = 0, childCount = children.length; i < childCount; i++) {
|
|
70091
|
-
const child = children[i];
|
|
70138
|
+
const three_camera = camera.object;
|
|
70092
70139
|
|
|
70093
|
-
|
|
70140
|
+
if (three_camera === null) {
|
|
70141
|
+
return;
|
|
70094
70142
|
}
|
|
70143
|
+
|
|
70144
|
+
three_camera.updateProjectionMatrix();
|
|
70145
|
+
threeUpdateTransform(three_camera);
|
|
70095
70146
|
}
|
|
70096
70147
|
|
|
70097
70148
|
/**
|
|
70098
70149
|
*
|
|
70099
|
-
* @param {
|
|
70150
|
+
* @param {THREE.Camera} object
|
|
70151
|
+
* @param {Quaternion} rotation
|
|
70100
70152
|
*/
|
|
70101
|
-
function
|
|
70153
|
+
function three_camera_set_transform_rotation(object, rotation) {
|
|
70102
70154
|
|
|
70103
|
-
|
|
70104
|
-
|
|
70105
|
-
|
|
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
|
|
70106
70158
|
*/
|
|
70107
|
-
threeUpdateMatrix(object3);
|
|
70108
70159
|
|
|
70109
|
-
|
|
70110
|
-
}
|
|
70111
|
-
|
|
70112
|
-
/**
|
|
70113
|
-
*
|
|
70114
|
-
* @param {Camera} camera
|
|
70115
|
-
*/
|
|
70116
|
-
function update_camera_transform(camera) {
|
|
70160
|
+
invertQuaternionOrientation(object.quaternion, rotation);
|
|
70117
70161
|
|
|
70118
|
-
|
|
70162
|
+
object.rotation.setFromQuaternion(object.quaternion);
|
|
70119
70163
|
|
|
70120
|
-
|
|
70121
|
-
|
|
70122
|
-
|
|
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
|
+
}
|
|
70123
70170
|
|
|
70124
|
-
three_camera.updateProjectionMatrix();
|
|
70125
|
-
threeUpdateTransform(three_camera);
|
|
70126
|
-
}
|
|
70127
|
-
|
|
70128
70171
|
class CameraSystem extends System {
|
|
70129
70172
|
/**
|
|
70130
70173
|
*
|
|
@@ -70213,19 +70256,7 @@ class CameraSystem extends System {
|
|
|
70213
70256
|
function synchronizeRotation() {
|
|
70214
70257
|
const rotation = transform.rotation;
|
|
70215
70258
|
|
|
70216
|
-
|
|
70217
|
-
NOTE: I'm not sure why, but three.js camera points in the opposite direction to normal objects
|
|
70218
|
-
See: https://github.com/mrdoob/three.js/blob/412b99a7f26e117ea97f40eb53d010ab81aa3279/src/core/Object3D.js#L282
|
|
70219
|
-
*/
|
|
70220
|
-
|
|
70221
|
-
invertQuaternionOrientation(camera.object.quaternion, rotation);
|
|
70222
|
-
|
|
70223
|
-
camera.object.rotation.setFromQuaternion(camera.object.quaternion);
|
|
70224
|
-
|
|
70225
|
-
// rotation.__setThreeEuler(camera.object.rotation); // seems unnecessary, based on Object3D.lookAt implementation
|
|
70226
|
-
// camera.object.quaternion.set(rotation.x, rotation.y, rotation.z, rotation.w);
|
|
70227
|
-
|
|
70228
|
-
update_camera_transform(camera);
|
|
70259
|
+
three_camera_set_transform_rotation(camera.object, rotation);
|
|
70229
70260
|
}
|
|
70230
70261
|
|
|
70231
70262
|
function rebuild() {
|
|
@@ -88348,7 +88379,7 @@ class ColorAndDepthFrameBuffer extends FrameBuffer {
|
|
|
88348
88379
|
|
|
88349
88380
|
const target = new WebGLMultisampleRenderTarget(size.x, size.y,{ignoreDepth: false});
|
|
88350
88381
|
|
|
88351
|
-
target.texture.format = RGBFormat; // note, three.js required RGBA render texture, even though RGB would do here
|
|
88382
|
+
target.texture.format = RGBFormat$1; // note, three.js required RGBA render texture, even though RGB would do here
|
|
88352
88383
|
target.texture.minFilter = NearestFilter;
|
|
88353
88384
|
target.texture.magFilter = NearestFilter;
|
|
88354
88385
|
target.texture.generateMipmaps = false;
|
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";
|