@woosh/meep-engine 2.109.4 → 2.109.5
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 +109 -14
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +109 -14
- package/package.json +1 -1
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +52 -1
- 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/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);
|
|
67804
|
-
|
|
67805
|
-
sampler2d_scale(converted, target);
|
|
67851
|
+
data = converted.data;
|
|
67806
67852
|
|
|
67807
|
-
|
|
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}
|
|
@@ -85169,6 +85214,56 @@ class Deque {
|
|
|
85169
85214
|
const last = this.#circular_previous_position(this.#tail);
|
|
85170
85215
|
return this.#data[last];
|
|
85171
85216
|
}
|
|
85217
|
+
|
|
85218
|
+
/**
|
|
85219
|
+
* Retrieved element by position from head. Where element at the head is position 0
|
|
85220
|
+
* @param {number} index
|
|
85221
|
+
* @returns {T|undefined} undefined if indexing element that is past the end, otherwise returns element at the position given
|
|
85222
|
+
*/
|
|
85223
|
+
getElementByIndex(index) {
|
|
85224
|
+
|
|
85225
|
+
if (index >= this.size()) {
|
|
85226
|
+
// overflow
|
|
85227
|
+
return undefined;
|
|
85228
|
+
}
|
|
85229
|
+
|
|
85230
|
+
/**
|
|
85231
|
+
*
|
|
85232
|
+
* @type {number}
|
|
85233
|
+
*/
|
|
85234
|
+
const position = (this.#head + index) % this.#data.length;
|
|
85235
|
+
|
|
85236
|
+
return this.#data[position];
|
|
85237
|
+
}
|
|
85238
|
+
|
|
85239
|
+
/**
|
|
85240
|
+
* Returns a copy of this queue represented as an array without gaps, with the head of the queue (first element) being at position 0
|
|
85241
|
+
* @param {T[]} [result]
|
|
85242
|
+
* @param {number} [result_offset]
|
|
85243
|
+
* @returns {T[]}
|
|
85244
|
+
*/
|
|
85245
|
+
toArray(result = [], result_offset = 0) {
|
|
85246
|
+
const size = this.size();
|
|
85247
|
+
|
|
85248
|
+
for (let i = 0; i < size; i++) {
|
|
85249
|
+
result[i] = this.getElementByIndex(i);
|
|
85250
|
+
}
|
|
85251
|
+
|
|
85252
|
+
return result;
|
|
85253
|
+
}
|
|
85254
|
+
|
|
85255
|
+
/**
|
|
85256
|
+
*
|
|
85257
|
+
* @returns {Generator<T,void>}
|
|
85258
|
+
*/
|
|
85259
|
+
* [Symbol.iterator]() {
|
|
85260
|
+
|
|
85261
|
+
const size = this.size();
|
|
85262
|
+
|
|
85263
|
+
for (let i = 0; i < size; i++) {
|
|
85264
|
+
yield this.getElementByIndex(i);
|
|
85265
|
+
}
|
|
85266
|
+
}
|
|
85172
85267
|
}
|
|
85173
85268
|
|
|
85174
85269
|
/*
|