@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
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
1
2
|
import ImageFilter from "../../filter/ImageFilter.js";
|
|
2
3
|
import { sampler2d_flipY_in_place } from "../../filter/sampler2d_flipY_in_place.js";
|
|
3
4
|
import CopyShader from "../../postprocess/threejs/shaders/CopyShader.js";
|
|
4
5
|
import { WebGLRendererPool } from "../../render/RendererPool.js";
|
|
6
|
+
import { canvasDataToSampler } from "../Canvas2Sampler2D.js";
|
|
5
7
|
import { formatToChannelCount } from "../formatToChannelCount.js";
|
|
6
8
|
import { sampler2d_scale } from "./resize/sampler2d_scale.js";
|
|
7
9
|
import { Sampler2D } from "./Sampler2D.js";
|
|
@@ -11,6 +13,62 @@ import { sampler2d_ensure_uint8_RGBA } from "./sampler2d_ensure_uint8_RGBA.js";
|
|
|
11
13
|
const DEFAULT_TEXTURE_WIDTH = 512;
|
|
12
14
|
const DEFAULT_TEXTURE_HEIGHT = 512;
|
|
13
15
|
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param {THREE.DataTexture} texture
|
|
19
|
+
* @param {number} channel_count
|
|
20
|
+
* @param {number} _width
|
|
21
|
+
* @param {number} _height
|
|
22
|
+
* @returns {Sampler2D}
|
|
23
|
+
*/
|
|
24
|
+
function data_texture_to_sampler(texture, channel_count, _width, _height) {
|
|
25
|
+
const source = new Sampler2D(texture.image.data, channel_count, texture.image.width, texture.image.height);
|
|
26
|
+
|
|
27
|
+
let converted = sampler2d_ensure_uint8_RGBA(source);
|
|
28
|
+
|
|
29
|
+
if (converted.width !== _width || converted.height !== _height) {
|
|
30
|
+
const target = Sampler2D.uint8(4, _width, _height);
|
|
31
|
+
|
|
32
|
+
sampler2d_scale(converted, target);
|
|
33
|
+
|
|
34
|
+
converted = target;
|
|
35
|
+
}
|
|
36
|
+
return converted;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param {THREE.Texture} texture
|
|
42
|
+
* @param {number} channel_count
|
|
43
|
+
* @param {number} _width
|
|
44
|
+
* @param {number} _height
|
|
45
|
+
* @returns {Sampler2D}
|
|
46
|
+
*/
|
|
47
|
+
function html_image_texture_to_sampler(texture, channel_count, _width, _height) {
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @type {Image}
|
|
51
|
+
*/
|
|
52
|
+
const img = texture.image;
|
|
53
|
+
|
|
54
|
+
assert.isInstanceOf(img, Image, 'texture.image', 'Image');
|
|
55
|
+
|
|
56
|
+
const canvas = document.createElement('canvas');
|
|
57
|
+
|
|
58
|
+
canvas.width = _width;
|
|
59
|
+
canvas.height = _height;
|
|
60
|
+
|
|
61
|
+
const ctx = canvas.getContext('2d');
|
|
62
|
+
|
|
63
|
+
ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, _width, _height);
|
|
64
|
+
|
|
65
|
+
const result = Sampler2D.uint8(4, _width, _height);
|
|
66
|
+
|
|
67
|
+
canvasDataToSampler(result, ctx);
|
|
68
|
+
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
|
|
14
72
|
/**
|
|
15
73
|
*
|
|
16
74
|
* @param {Texture} texture
|
|
@@ -30,8 +88,6 @@ export function convertTexture2Sampler2D(
|
|
|
30
88
|
|
|
31
89
|
const channel_count = formatToChannelCount(texture.format);
|
|
32
90
|
|
|
33
|
-
// TODO take channel count into account
|
|
34
|
-
|
|
35
91
|
if (_width === undefined || _height === undefined) {
|
|
36
92
|
|
|
37
93
|
//figure out texture size
|
|
@@ -70,21 +126,14 @@ export function convertTexture2Sampler2D(
|
|
|
70
126
|
if (texture.isDataTexture === true) {
|
|
71
127
|
|
|
72
128
|
// special case
|
|
129
|
+
const converted = data_texture_to_sampler(texture, channel_count, _width, _height);
|
|
73
130
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let converted = sampler2d_ensure_uint8_RGBA(source);
|
|
77
|
-
|
|
78
|
-
if (converted.width !== _width || converted.height !== _height) {
|
|
79
|
-
const target = Sampler2D.uint8(4, _width, _height);
|
|
80
|
-
|
|
81
|
-
sampler2d_scale(converted, target);
|
|
131
|
+
data = converted.data;
|
|
82
132
|
|
|
83
|
-
|
|
84
|
-
|
|
133
|
+
} else if (texture.image instanceof Image) {
|
|
134
|
+
const converted = html_image_texture_to_sampler(texture, channel_count, _width, _height);
|
|
85
135
|
|
|
86
136
|
data = converted.data;
|
|
87
|
-
|
|
88
137
|
} else {
|
|
89
138
|
const built = WebGLRendererPool.global.use(renderer => {
|
|
90
139
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {THREE.Material} material
|
|
4
|
+
* @returns {Generator<{texture:THREE.Texture, name:string}>}
|
|
5
|
+
*/
|
|
6
|
+
export function iterate_three_material_textures(material: THREE.Material): Generator<{
|
|
7
|
+
texture: THREE.Texture;
|
|
8
|
+
name: string;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=iterate_three_material_textures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iterate_three_material_textures.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/three/material/iterate_three_material_textures.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,0DAHW,MAAM,QAAQ,GACZ,UAAU;IAAC,OAAO,EAAC,MAAM,OAAO,CAAC;IAAC,MAAK,MAAM,CAAA;CAAC,CAAC,CA2B3D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TextureAttachmentsByMaterialType } from "../../../asset/loaders/material/TextureAttachmensByMaterialType.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {THREE.Material} material
|
|
6
|
+
* @returns {Generator<{texture:THREE.Texture, name:string}>}
|
|
7
|
+
*/
|
|
8
|
+
export function* iterate_three_material_textures(material) {
|
|
9
|
+
|
|
10
|
+
//patch textures
|
|
11
|
+
const materialType = material.type;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @type {TextureAttachment[]}
|
|
16
|
+
*/
|
|
17
|
+
const attachments = TextureAttachmentsByMaterialType[materialType];
|
|
18
|
+
|
|
19
|
+
if (attachments !== undefined) {
|
|
20
|
+
|
|
21
|
+
for (let i = 0; i < attachments.length; i++) {
|
|
22
|
+
const attachment = attachments[i];
|
|
23
|
+
|
|
24
|
+
const texture = attachment.read(material);
|
|
25
|
+
|
|
26
|
+
if (texture === undefined || texture === null) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
yield { texture, name: attachment.name };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/core/math/max4.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"max4.d.ts","sourceRoot":"","sources":["../../../../src/core/math/max4.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBANW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAgBlB"}
|
package/src/core/math/max4.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {number} a
|
|
4
|
-
* @param {number} b
|
|
5
|
-
* @param {number} c
|
|
6
|
-
* @param {number} d
|
|
7
|
-
* @returns {number}
|
|
8
|
-
*/
|
|
9
|
-
export function max4(a, b, c, d) {
|
|
10
|
-
let v = a;
|
|
11
|
-
|
|
12
|
-
if (b > v) {
|
|
13
|
-
v = b;
|
|
14
|
-
}
|
|
15
|
-
if (c > v) {
|
|
16
|
-
v = c;
|
|
17
|
-
}
|
|
18
|
-
if (d > v) {
|
|
19
|
-
v = d;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return v;
|
|
23
|
-
}
|
|
24
|
-
|
package/src/core/math/min4.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"min4.d.ts","sourceRoot":"","sources":["../../../../src/core/math/min4.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBANW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAgBlB"}
|
package/src/core/math/min4.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {number} a
|
|
4
|
-
* @param {number} b
|
|
5
|
-
* @param {number} c
|
|
6
|
-
* @param {number} d
|
|
7
|
-
* @returns {number}
|
|
8
|
-
*/
|
|
9
|
-
export function min4(a, b, c, d) {
|
|
10
|
-
let v = a;
|
|
11
|
-
|
|
12
|
-
if (b < v) {
|
|
13
|
-
v = b;
|
|
14
|
-
}
|
|
15
|
-
if (c < v) {
|
|
16
|
-
v = c;
|
|
17
|
-
}
|
|
18
|
-
if (d < v) {
|
|
19
|
-
v = d;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return v;
|
|
23
|
-
}
|