@woosh/meep-engine 2.109.4 → 2.109.6
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 +115 -17
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +115 -17
- package/package.json +1 -1
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +58 -4
- package/src/core/collection/queue/Deque.spec.js +29 -0
- package/src/core/geom/3d/Ray3.d.ts +23 -10
- package/src/core/geom/3d/Ray3.d.ts.map +1 -1
- package/src/core/geom/3d/Ray3.js +59 -20
- package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.d.ts +2 -2
- package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.d.ts.map +1 -1
- package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.js +42 -27
- package/src/core/geom/3d/tetrahedra/triangle/prototype.js +0 -2
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.js +5 -2
- package/src/core/geom/vec3/v3_matrix4_rotate.d.ts +10 -0
- package/src/core/geom/vec3/v3_matrix4_rotate.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_matrix4_rotate.js +27 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +1 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +5 -3
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.js +2 -1
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts +9 -4
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +61 -6
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts +11 -4
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +28 -36
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +17 -8
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +83 -44
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts +3 -3
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +40 -33
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +43 -40
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts +14 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.js +34 -1
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.d.ts +21 -0
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.js +107 -0
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +22 -122
- package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.d.ts +0 -9
- package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.js +2 -28
- package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.d.ts +0 -9
- package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.js +0 -39
- package/src/engine/graphics/sh3/path_tracer/sampling/getCosineDirection.d.ts +10 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/getCosineDirection.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/getCosineDirection.js +41 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.d.ts +10 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.js +45 -0
- 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 +28 -8
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +7 -5
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +62 -13
- package/src/engine/graphics/texture/virtual/prototype.js +4 -3
- package/src/engine/graphics/three/material/iterate_three_material_textures.d.ts +10 -0
- package/src/engine/graphics/three/material/iterate_three_material_textures.d.ts.map +1 -0
- package/src/engine/graphics/three/material/iterate_three_material_textures.js +33 -0
- package/src/core/math/max4.d.ts +0 -10
- package/src/core/math/max4.d.ts.map +0 -1
- package/src/core/math/max4.js +0 -24
- package/src/core/math/min4.d.ts +0 -10
- package/src/core/math/min4.d.ts.map +0 -1
- package/src/core/math/min4.js +0 -23
package/build/meep.cjs
CHANGED
|
@@ -67735,6 +67735,60 @@ function sampler2d_ensure_uint8_RGBA(input) {
|
|
|
67735
67735
|
const DEFAULT_TEXTURE_WIDTH = 512;
|
|
67736
67736
|
const DEFAULT_TEXTURE_HEIGHT = 512;
|
|
67737
67737
|
|
|
67738
|
+
/**
|
|
67739
|
+
*
|
|
67740
|
+
* @param {THREE.DataTexture} texture
|
|
67741
|
+
* @param {number} channel_count
|
|
67742
|
+
* @param {number} _width
|
|
67743
|
+
* @param {number} _height
|
|
67744
|
+
* @returns {Sampler2D}
|
|
67745
|
+
*/
|
|
67746
|
+
function data_texture_to_sampler(texture, channel_count, _width, _height) {
|
|
67747
|
+
const source = new Sampler2D(texture.image.data, channel_count, texture.image.width, texture.image.height);
|
|
67748
|
+
|
|
67749
|
+
let converted = sampler2d_ensure_uint8_RGBA(source);
|
|
67750
|
+
|
|
67751
|
+
if (converted.width !== _width || converted.height !== _height) {
|
|
67752
|
+
const target = Sampler2D.uint8(4, _width, _height);
|
|
67753
|
+
|
|
67754
|
+
sampler2d_scale(converted, target);
|
|
67755
|
+
|
|
67756
|
+
converted = target;
|
|
67757
|
+
}
|
|
67758
|
+
return converted;
|
|
67759
|
+
}
|
|
67760
|
+
|
|
67761
|
+
/**
|
|
67762
|
+
*
|
|
67763
|
+
* @param {THREE.Texture} texture
|
|
67764
|
+
* @param {number} channel_count
|
|
67765
|
+
* @param {number} _width
|
|
67766
|
+
* @param {number} _height
|
|
67767
|
+
* @returns {Sampler2D}
|
|
67768
|
+
*/
|
|
67769
|
+
function html_image_texture_to_sampler(texture, channel_count, _width, _height) {
|
|
67770
|
+
/**
|
|
67771
|
+
*
|
|
67772
|
+
* @type {Image}
|
|
67773
|
+
*/
|
|
67774
|
+
const img = texture.image;
|
|
67775
|
+
|
|
67776
|
+
const canvas = document.createElement('canvas');
|
|
67777
|
+
|
|
67778
|
+
canvas.width = _width;
|
|
67779
|
+
canvas.height = _height;
|
|
67780
|
+
|
|
67781
|
+
const ctx = canvas.getContext('2d');
|
|
67782
|
+
|
|
67783
|
+
ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, _width, _height);
|
|
67784
|
+
|
|
67785
|
+
const result = Sampler2D.uint8(4, _width, _height);
|
|
67786
|
+
|
|
67787
|
+
canvasDataToSampler(result, ctx);
|
|
67788
|
+
|
|
67789
|
+
return result;
|
|
67790
|
+
}
|
|
67791
|
+
|
|
67738
67792
|
/**
|
|
67739
67793
|
*
|
|
67740
67794
|
* @param {Texture} texture
|
|
@@ -67754,8 +67808,6 @@ function convertTexture2Sampler2D(
|
|
|
67754
67808
|
|
|
67755
67809
|
const channel_count = formatToChannelCount(texture.format);
|
|
67756
67810
|
|
|
67757
|
-
// TODO take channel count into account
|
|
67758
|
-
|
|
67759
67811
|
if (_width === undefined || _height === undefined) {
|
|
67760
67812
|
|
|
67761
67813
|
//figure out texture size
|
|
@@ -67794,21 +67846,14 @@ function convertTexture2Sampler2D(
|
|
|
67794
67846
|
if (texture.isDataTexture === true) {
|
|
67795
67847
|
|
|
67796
67848
|
// special case
|
|
67849
|
+
const converted = data_texture_to_sampler(texture, channel_count, _width, _height);
|
|
67797
67850
|
|
|
67798
|
-
|
|
67799
|
-
|
|
67800
|
-
let converted = sampler2d_ensure_uint8_RGBA(source);
|
|
67801
|
-
|
|
67802
|
-
if (converted.width !== _width || converted.height !== _height) {
|
|
67803
|
-
const target = Sampler2D.uint8(4, _width, _height);
|
|
67851
|
+
data = converted.data;
|
|
67804
67852
|
|
|
67805
|
-
|
|
67806
|
-
|
|
67807
|
-
converted = target;
|
|
67808
|
-
}
|
|
67853
|
+
} else if (texture.image instanceof Image) {
|
|
67854
|
+
const converted = html_image_texture_to_sampler(texture, channel_count, _width, _height);
|
|
67809
67855
|
|
|
67810
67856
|
data = converted.data;
|
|
67811
|
-
|
|
67812
67857
|
} else {
|
|
67813
67858
|
const built = WebGLRendererPool.global.use(renderer => {
|
|
67814
67859
|
|
|
@@ -84852,7 +84897,7 @@ class Deque {
|
|
|
84852
84897
|
* @type {T[]}
|
|
84853
84898
|
* @private
|
|
84854
84899
|
*/
|
|
84855
|
-
#data=EMPTY_ARRAY;
|
|
84900
|
+
#data = EMPTY_ARRAY;
|
|
84856
84901
|
/**
|
|
84857
84902
|
*
|
|
84858
84903
|
* @type {number}
|
|
@@ -84942,8 +84987,8 @@ class Deque {
|
|
|
84942
84987
|
|
|
84943
84988
|
let new_length = length * 2;
|
|
84944
84989
|
|
|
84945
|
-
// bigger than Integer.MAX_VALUE
|
|
84946
84990
|
if (new_length > UINT32_MAX) {
|
|
84991
|
+
// clamp to max uint32 value
|
|
84947
84992
|
new_length = UINT32_MAX;
|
|
84948
84993
|
}
|
|
84949
84994
|
|
|
@@ -84973,7 +85018,7 @@ class Deque {
|
|
|
84973
85018
|
* @return {boolean}
|
|
84974
85019
|
*/
|
|
84975
85020
|
isEmpty() {
|
|
84976
|
-
return this
|
|
85021
|
+
return this.#status === STATUS_EMPTY;
|
|
84977
85022
|
}
|
|
84978
85023
|
|
|
84979
85024
|
clear() {
|
|
@@ -85082,9 +85127,10 @@ class Deque {
|
|
|
85082
85127
|
|
|
85083
85128
|
const data = this.#data;
|
|
85084
85129
|
const capacity = data.length;
|
|
85130
|
+
const head = this.#head;
|
|
85085
85131
|
|
|
85086
85132
|
for (let i = 0; i < size; i++) {
|
|
85087
|
-
const index = (
|
|
85133
|
+
const index = (head + i) % capacity;
|
|
85088
85134
|
|
|
85089
85135
|
const el = data[index];
|
|
85090
85136
|
|
|
@@ -85169,6 +85215,58 @@ class Deque {
|
|
|
85169
85215
|
const last = this.#circular_previous_position(this.#tail);
|
|
85170
85216
|
return this.#data[last];
|
|
85171
85217
|
}
|
|
85218
|
+
|
|
85219
|
+
/**
|
|
85220
|
+
* Retrieved element by position from head. Where element at the head is position 0
|
|
85221
|
+
* @param {number} index
|
|
85222
|
+
* @returns {T|undefined} undefined if indexing element that is past the end, otherwise returns element at the position given
|
|
85223
|
+
*/
|
|
85224
|
+
getElementByIndex(index) {
|
|
85225
|
+
|
|
85226
|
+
if (index >= this.size()) {
|
|
85227
|
+
// overflow
|
|
85228
|
+
return undefined;
|
|
85229
|
+
}
|
|
85230
|
+
|
|
85231
|
+
const data = this.#data;
|
|
85232
|
+
|
|
85233
|
+
/**
|
|
85234
|
+
*
|
|
85235
|
+
* @type {number}
|
|
85236
|
+
*/
|
|
85237
|
+
const position = (this.#head + index) % data.length;
|
|
85238
|
+
|
|
85239
|
+
return data[position];
|
|
85240
|
+
}
|
|
85241
|
+
|
|
85242
|
+
/**
|
|
85243
|
+
* Returns a copy of this queue represented as an array without gaps, with the head of the queue (first element) being at position 0
|
|
85244
|
+
* @param {T[]} [result]
|
|
85245
|
+
* @param {number} [result_offset]
|
|
85246
|
+
* @returns {T[]}
|
|
85247
|
+
*/
|
|
85248
|
+
toArray(result = [], result_offset = 0) {
|
|
85249
|
+
const size = this.size();
|
|
85250
|
+
|
|
85251
|
+
for (let i = 0; i < size; i++) {
|
|
85252
|
+
result[i] = this.getElementByIndex(i);
|
|
85253
|
+
}
|
|
85254
|
+
|
|
85255
|
+
return result;
|
|
85256
|
+
}
|
|
85257
|
+
|
|
85258
|
+
/**
|
|
85259
|
+
*
|
|
85260
|
+
* @returns {Generator<T,void>}
|
|
85261
|
+
*/
|
|
85262
|
+
* [Symbol.iterator]() {
|
|
85263
|
+
|
|
85264
|
+
const size = this.size();
|
|
85265
|
+
|
|
85266
|
+
for (let i = 0; i < size; i++) {
|
|
85267
|
+
yield this.getElementByIndex(i);
|
|
85268
|
+
}
|
|
85269
|
+
}
|
|
85172
85270
|
}
|
|
85173
85271
|
|
|
85174
85272
|
/*
|