@woosh/meep-engine 2.108.0 → 2.108.2
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 +178 -127
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +178 -127
- package/editor/tools/paint/TerrainHeightPaintTool.js +5 -5
- package/package.json +1 -1
- package/src/core/binary/float_to_uint8.d.ts +7 -0
- package/src/core/binary/float_to_uint8.d.ts.map +1 -0
- package/src/core/binary/{float2uint8.js → float_to_uint8.js} +1 -1
- package/src/core/binary/uint8_to_float.d.ts +7 -0
- package/src/core/binary/uint8_to_float.d.ts.map +1 -0
- package/src/core/binary/{uint82float.js → uint8_to_float.js} +1 -1
- package/src/core/binary/uint8_to_float.spec.d.ts +2 -0
- package/src/core/binary/uint8_to_float.spec.d.ts.map +1 -0
- package/src/core/binary/uint8_to_float.spec.js +7 -0
- package/src/core/codegen/codeToBlob.d.ts +8 -0
- package/src/core/codegen/codeToBlob.d.ts.map +1 -0
- package/src/core/codegen/codeToBlob.js +36 -0
- package/src/core/codegen/codeToURL.d.ts +8 -0
- package/src/core/codegen/codeToURL.d.ts.map +1 -0
- package/src/core/codegen/codeToURL.js +22 -0
- package/src/core/collection/array/array_shuffle.d.ts +8 -0
- package/src/core/collection/array/array_shuffle.d.ts.map +1 -0
- package/src/core/collection/array/array_shuffle.js +22 -0
- package/src/core/collection/array/array_shuffle.spec.d.ts +2 -0
- package/src/core/collection/array/array_shuffle.spec.d.ts.map +1 -0
- package/src/core/collection/array/{randomizeArrayElementOrder.spec.js → array_shuffle.spec.js} +4 -4
- package/src/core/collection/array/iterator/ArrayIteratorRandom.js +2 -2
- package/src/core/collection/array/randomMultipleFromArray.js +2 -2
- package/src/core/color/Color.js +9 -9
- package/src/core/color/hsv/hsv2rgb.js +4 -4
- package/src/core/color/rgb2uint24.js +4 -4
- package/src/core/color/sRGB/linear_to_sRGB.d.ts +1 -0
- package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
- package/src/core/color/sRGB/linear_to_sRGB.js +4 -4
- package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +4 -1
- package/src/core/geom/3d/aabb/aabb3_intersects_ray.js +3 -3
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitSphereShape3D.js +14 -14
- package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.js +2 -0
- package/src/core/geom/Vector3.js +3 -3
- package/src/core/geom/random/randomPointInSphere.d.ts +1 -1
- package/src/core/geom/random/randomPointInSphere.js +2 -2
- package/src/core/geom/random/randomPointOnSphere.d.ts +3 -3
- package/src/core/geom/random/randomPointOnSphere.d.ts.map +1 -1
- package/src/core/geom/random/randomPointOnSphere.js +5 -9
- package/src/core/process/task/util/randomCountTask.js +3 -3
- package/src/core/process/worker/WorkerBuilder.d.ts.map +1 -1
- package/src/core/process/worker/WorkerBuilder.js +5 -35
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +7 -1
- package/src/engine/asset/loaders/ArrayBufferLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/ArrayBufferLoader.js +17 -10
- package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.js +3 -0
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +4 -4
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.js +4 -0
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts.map +1 -1
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +7 -7
- package/src/engine/graphics/impostors/octahedral/bake/prepare_bake_material.js +3 -3
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.d.ts.map +1 -1
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +9 -6
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +4 -5
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +14 -6
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.d.ts +10 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples.js +20 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.d.ts +10 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/generate_stratified_samples_2d.js +31 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.d.ts +9 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/sampling/make_stratified_sample.js +21 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.js +2 -3
- package/src/engine/graphics/sh3/path_tracer/vec3_uint8_to_float.js +4 -4
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +74 -6
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +2 -2
- package/src/engine/network/convertPathToURL.d.ts +3 -1
- package/src/engine/network/convertPathToURL.d.ts.map +1 -1
- package/src/engine/network/convertPathToURL.js +68 -51
- package/src/engine/physics/fluid/SliceVisualiser.d.ts.map +1 -1
- package/src/engine/physics/fluid/SliceVisualiser.js +4 -4
- package/src/generation/filtering/numeric/CellFilterCache.d.ts.map +1 -1
- package/src/generation/filtering/numeric/CellFilterCache.js +1 -0
- package/src/core/binary/float2uint8.d.ts +0 -7
- package/src/core/binary/float2uint8.d.ts.map +0 -1
- package/src/core/binary/uint82float.d.ts +0 -7
- package/src/core/binary/uint82float.d.ts.map +0 -1
- package/src/core/binary/uint82float.spec.d.ts +0 -2
- package/src/core/binary/uint82float.spec.d.ts.map +0 -1
- package/src/core/binary/uint82float.spec.js +0 -7
- package/src/core/collection/array/randomizeArrayElementOrder.d.ts +0 -8
- package/src/core/collection/array/randomizeArrayElementOrder.d.ts.map +0 -1
- package/src/core/collection/array/randomizeArrayElementOrder.js +0 -24
- package/src/core/collection/array/randomizeArrayElementOrder.spec.d.ts +0 -2
- package/src/core/collection/array/randomizeArrayElementOrder.spec.d.ts.map +0 -1
package/build/meep.cjs
CHANGED
|
@@ -2870,10 +2870,10 @@ let Vector3$1 = class Vector3 {
|
|
|
2870
2870
|
}
|
|
2871
2871
|
|
|
2872
2872
|
/**
|
|
2873
|
-
*
|
|
2873
|
+
* Convert spherical coordinates to cartesian
|
|
2874
2874
|
* @param {number} radius
|
|
2875
|
-
* @param {number} phi
|
|
2876
|
-
* @param {number} theta
|
|
2875
|
+
* @param {number} phi Also known as Azimuth
|
|
2876
|
+
* @param {number} theta Also known as Elevation
|
|
2877
2877
|
*/
|
|
2878
2878
|
setFromSphericalCoords(radius, phi, theta) {
|
|
2879
2879
|
|
|
@@ -49540,7 +49540,7 @@ class Sampler2D {
|
|
|
49540
49540
|
*
|
|
49541
49541
|
* @param {number} u
|
|
49542
49542
|
* @param {number} v
|
|
49543
|
-
* @param {number[]} result
|
|
49543
|
+
* @param {number[]|Float32Array} result
|
|
49544
49544
|
* @param {number} result_offset
|
|
49545
49545
|
*/
|
|
49546
49546
|
sampleBilinearUV(u, v, result, result_offset = 0) {
|
|
@@ -49670,7 +49670,7 @@ class Sampler2D {
|
|
|
49670
49670
|
*
|
|
49671
49671
|
* @param {number} u
|
|
49672
49672
|
* @param {number} v
|
|
49673
|
-
* @param {ArrayLike<number>} result
|
|
49673
|
+
* @param {number[]|ArrayLike<number>} result
|
|
49674
49674
|
*/
|
|
49675
49675
|
sampleNearestUV(u, v, result) {
|
|
49676
49676
|
const w = this.width;
|
|
@@ -50290,7 +50290,7 @@ const WHITE_PIXEL_DATA_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEA
|
|
|
50290
50290
|
* @param {number} v
|
|
50291
50291
|
* @returns {number}
|
|
50292
50292
|
*/
|
|
50293
|
-
function
|
|
50293
|
+
function float_to_uint8(v) {
|
|
50294
50294
|
return Math.round(v * 255);
|
|
50295
50295
|
}
|
|
50296
50296
|
|
|
@@ -50299,7 +50299,7 @@ function float2uint8(v) {
|
|
|
50299
50299
|
* @param {number} v
|
|
50300
50300
|
* @returns {number}
|
|
50301
50301
|
*/
|
|
50302
|
-
function
|
|
50302
|
+
function uint8_to_float(v) {
|
|
50303
50303
|
return v / 255;
|
|
50304
50304
|
}
|
|
50305
50305
|
|
|
@@ -51698,7 +51698,7 @@ class TerrainOverlay {
|
|
|
51698
51698
|
for (let i = 0; i < 4; i++) {
|
|
51699
51699
|
const v = this.sampler.readChannel(x, y, i);
|
|
51700
51700
|
|
|
51701
|
-
result[i] =
|
|
51701
|
+
result[i] = uint8_to_float(v);
|
|
51702
51702
|
}
|
|
51703
51703
|
}
|
|
51704
51704
|
|
|
@@ -51745,7 +51745,7 @@ class TerrainOverlay {
|
|
|
51745
51745
|
paintPoint(x, y, vec4) {
|
|
51746
51746
|
for (let i = 0; i < 4; i++) {
|
|
51747
51747
|
|
|
51748
|
-
this.sampler.writeChannel(x, y, i,
|
|
51748
|
+
this.sampler.writeChannel(x, y, i, float_to_uint8(vec4[i]));
|
|
51749
51749
|
|
|
51750
51750
|
}
|
|
51751
51751
|
|
|
@@ -53222,7 +53222,7 @@ function aabb3_intersects_ray(
|
|
|
53222
53222
|
const diff_x = origin_x - center_x;
|
|
53223
53223
|
|
|
53224
53224
|
|
|
53225
|
-
if (diff_x * direction_x >= 0
|
|
53225
|
+
if (diff_x * direction_x >= 0 && abs(diff_x) > extents_x) {
|
|
53226
53226
|
return false;
|
|
53227
53227
|
}
|
|
53228
53228
|
|
|
@@ -53234,7 +53234,7 @@ function aabb3_intersects_ray(
|
|
|
53234
53234
|
const diff_y = origin_y - center_y;
|
|
53235
53235
|
|
|
53236
53236
|
|
|
53237
|
-
if (diff_y * direction_y >= 0
|
|
53237
|
+
if (diff_y * direction_y >= 0 && abs(diff_y) > extents_y) {
|
|
53238
53238
|
return false;
|
|
53239
53239
|
}
|
|
53240
53240
|
|
|
@@ -53246,7 +53246,7 @@ function aabb3_intersects_ray(
|
|
|
53246
53246
|
const diff_z = origin_z - center_z;
|
|
53247
53247
|
|
|
53248
53248
|
|
|
53249
|
-
if (diff_z * direction_z >= 0
|
|
53249
|
+
if (diff_z * direction_z >= 0 && abs(diff_z) > extents_z) {
|
|
53250
53250
|
return false;
|
|
53251
53251
|
}
|
|
53252
53252
|
|
|
@@ -53526,9 +53526,9 @@ function hsv2rgb(h, s, v) {
|
|
|
53526
53526
|
break;
|
|
53527
53527
|
}
|
|
53528
53528
|
return {
|
|
53529
|
-
r:
|
|
53530
|
-
g:
|
|
53531
|
-
b:
|
|
53529
|
+
r: float_to_uint8(r),
|
|
53530
|
+
g: float_to_uint8(g),
|
|
53531
|
+
b: float_to_uint8(b)
|
|
53532
53532
|
};
|
|
53533
53533
|
}
|
|
53534
53534
|
|
|
@@ -53619,9 +53619,9 @@ function parse_color(c) {
|
|
|
53619
53619
|
* @returns {number}
|
|
53620
53620
|
*/
|
|
53621
53621
|
function rgb2uint24(r, g, b) {
|
|
53622
|
-
const _r =
|
|
53623
|
-
const _g =
|
|
53624
|
-
const _b =
|
|
53622
|
+
const _r = float_to_uint8(r);
|
|
53623
|
+
const _g = float_to_uint8(g);
|
|
53624
|
+
const _b = float_to_uint8(b);
|
|
53625
53625
|
|
|
53626
53626
|
return (_b & 0xFF)
|
|
53627
53627
|
| (_g & 0xFF) << 8
|
|
@@ -53640,7 +53640,7 @@ function rgb_to_luminance(r, g, b) {
|
|
|
53640
53640
|
return 0.299 * r + 0.587 * g + 0.114 * b;
|
|
53641
53641
|
}
|
|
53642
53642
|
|
|
53643
|
-
function
|
|
53643
|
+
function convert_channel_linear_to_sRGB(c) {
|
|
53644
53644
|
if (c < 0.0031308) {
|
|
53645
53645
|
return c * 12.92;
|
|
53646
53646
|
} else {
|
|
@@ -53663,9 +53663,9 @@ function linear_to_sRGB(
|
|
|
53663
53663
|
const g = input[input_offset + 1];
|
|
53664
53664
|
const b = input[input_offset + 2];
|
|
53665
53665
|
|
|
53666
|
-
output[output_offset] =
|
|
53667
|
-
output[output_offset + 1] =
|
|
53668
|
-
output[output_offset + 2] =
|
|
53666
|
+
output[output_offset] = convert_channel_linear_to_sRGB(r);
|
|
53667
|
+
output[output_offset + 1] = convert_channel_linear_to_sRGB(g);
|
|
53668
|
+
output[output_offset + 2] = convert_channel_linear_to_sRGB(b);
|
|
53669
53669
|
}
|
|
53670
53670
|
|
|
53671
53671
|
/**
|
|
@@ -53839,9 +53839,9 @@ class Color {
|
|
|
53839
53839
|
*/
|
|
53840
53840
|
setRGBUint8(r, g, b) {
|
|
53841
53841
|
this.setRGB(
|
|
53842
|
-
|
|
53843
|
-
|
|
53844
|
-
|
|
53842
|
+
uint8_to_float(r),
|
|
53843
|
+
uint8_to_float(g),
|
|
53844
|
+
uint8_to_float(b),
|
|
53845
53845
|
);
|
|
53846
53846
|
}
|
|
53847
53847
|
|
|
@@ -54134,9 +54134,9 @@ class Color {
|
|
|
54134
54134
|
*/
|
|
54135
54135
|
toHex() {
|
|
54136
54136
|
return '#' + rgb2hex(
|
|
54137
|
-
|
|
54138
|
-
|
|
54139
|
-
|
|
54137
|
+
float_to_uint8(this.r),
|
|
54138
|
+
float_to_uint8(this.g),
|
|
54139
|
+
float_to_uint8(this.b)
|
|
54140
54140
|
);
|
|
54141
54141
|
}
|
|
54142
54142
|
|
|
@@ -54145,7 +54145,7 @@ class Color {
|
|
|
54145
54145
|
* @returns {string}
|
|
54146
54146
|
*/
|
|
54147
54147
|
toCssRGBAString() {
|
|
54148
|
-
return `rgba(${
|
|
54148
|
+
return `rgba(${float_to_uint8(this.r)},${float_to_uint8(this.g)},${float_to_uint8(this.b)},${this.a})`;
|
|
54149
54149
|
}
|
|
54150
54150
|
|
|
54151
54151
|
/**
|
|
@@ -56761,11 +56761,13 @@ class AABB3 {
|
|
|
56761
56761
|
* Get center position of the box
|
|
56762
56762
|
* @param {Vector3} target where to write result
|
|
56763
56763
|
*/
|
|
56764
|
-
getCenter(target) {
|
|
56764
|
+
getCenter(target = new Vector3$1()) {
|
|
56765
56765
|
const x = this.getCenterX();
|
|
56766
56766
|
const y = this.getCenterY();
|
|
56767
56767
|
const z = this.getCenterZ();
|
|
56768
56768
|
target.set(x, y, z);
|
|
56769
|
+
|
|
56770
|
+
return target;
|
|
56769
56771
|
}
|
|
56770
56772
|
|
|
56771
56773
|
|
|
@@ -63070,72 +63072,137 @@ const ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
|
|
|
63070
63072
|
* @param {string} path
|
|
63071
63073
|
* @return {string}
|
|
63072
63074
|
*/
|
|
63073
|
-
function
|
|
63074
|
-
|
|
63075
|
-
|
|
63075
|
+
function localPathToGlobal(path) {
|
|
63076
|
+
/**
|
|
63077
|
+
* @type {Window|DedicatedWorkerGlobalScope}
|
|
63078
|
+
*/
|
|
63079
|
+
let scope;
|
|
63076
63080
|
|
|
63077
|
-
|
|
63078
|
-
|
|
63079
|
-
|
|
63080
|
-
|
|
63081
|
+
if (ENVIRONMENT_IS_WEB) {
|
|
63082
|
+
scope = window;
|
|
63083
|
+
} else if (ENVIRONMENT_IS_WORKER) {
|
|
63084
|
+
scope = self;
|
|
63085
|
+
} else if (ENVIRONMENT_IS_NODE) {
|
|
63081
63086
|
|
|
63082
|
-
|
|
63083
|
-
scope = window;
|
|
63084
|
-
} else if (ENVIRONMENT_IS_WORKER) {
|
|
63085
|
-
scope = self;
|
|
63086
|
-
} else if (ENVIRONMENT_IS_NODE) {
|
|
63087
|
+
let normalized_path = `${process.cwd()}/`.replace(/\\/g, '/');
|
|
63087
63088
|
|
|
63088
|
-
|
|
63089
|
+
// remove multiple sequential slashes
|
|
63090
|
+
normalized_path = normalized_path.replace(/\/+/g, '/');
|
|
63089
63091
|
|
|
63090
|
-
|
|
63091
|
-
|
|
63092
|
+
if (normalized_path[0] !== '/') {
|
|
63093
|
+
// Windows drive letter must be prefixed with a slash.
|
|
63094
|
+
normalized_path = `/${normalized_path}`;
|
|
63095
|
+
}
|
|
63092
63096
|
|
|
63093
|
-
|
|
63094
|
-
|
|
63095
|
-
|
|
63097
|
+
scope = {
|
|
63098
|
+
location: {
|
|
63099
|
+
pathname: normalized_path,
|
|
63100
|
+
host: '',
|
|
63101
|
+
protocol: 'file:'
|
|
63096
63102
|
}
|
|
63103
|
+
};
|
|
63104
|
+
} else {
|
|
63105
|
+
throw new Error('Unknown environment');
|
|
63106
|
+
}
|
|
63097
63107
|
|
|
63098
|
-
|
|
63099
|
-
|
|
63100
|
-
|
|
63101
|
-
|
|
63102
|
-
|
|
63103
|
-
|
|
63104
|
-
|
|
63108
|
+
const location = scope.location;
|
|
63109
|
+
const pathname = location.pathname;
|
|
63110
|
+
|
|
63111
|
+
let directoryPath;
|
|
63112
|
+
|
|
63113
|
+
/*
|
|
63114
|
+
path name contains file name also, there are two options here, "a/b" or "a/b/" second is a directory
|
|
63115
|
+
we need to extract directory to load relative path
|
|
63116
|
+
*/
|
|
63117
|
+
|
|
63118
|
+
if (pathname.endsWith('/')) {
|
|
63119
|
+
//path is to a directory, strip last slash
|
|
63120
|
+
directoryPath = pathname.substring(0, pathname.length - 1);
|
|
63121
|
+
} else {
|
|
63122
|
+
//path is to a file
|
|
63123
|
+
const i = pathname.lastIndexOf('/');
|
|
63124
|
+
|
|
63125
|
+
if (i === -1) {
|
|
63126
|
+
//root level file
|
|
63127
|
+
directoryPath = "";
|
|
63105
63128
|
} else {
|
|
63106
|
-
|
|
63129
|
+
directoryPath = pathname.substring(0, i);
|
|
63107
63130
|
}
|
|
63131
|
+
}
|
|
63108
63132
|
|
|
63109
|
-
|
|
63110
|
-
|
|
63133
|
+
const urlBase = location.protocol + "//" + location.host + directoryPath + "/";
|
|
63134
|
+
return urlBase + path;
|
|
63135
|
+
}
|
|
63111
63136
|
|
|
63112
|
-
|
|
63137
|
+
/**
|
|
63138
|
+
* Given a path, which may be a local path, produce a fully qualified URL
|
|
63139
|
+
* @example '/path' -> 'http://example.com/path'
|
|
63140
|
+
* @example 'some/local/path' -> 'http://example.com/current_path/some/local/path'
|
|
63141
|
+
* @param {string} path
|
|
63142
|
+
* @return {string}
|
|
63143
|
+
*/
|
|
63144
|
+
function convertPathToURL(path) {
|
|
63113
63145
|
|
|
63114
|
-
|
|
63115
|
-
path name contains file name also, there are two options here, "a/b" or "a/b/" second is a directory
|
|
63116
|
-
we need to extract directory to load relative path
|
|
63117
|
-
*/
|
|
63146
|
+
const is_global = isGlobalPath(path);
|
|
63118
63147
|
|
|
63119
|
-
|
|
63120
|
-
//path is to a directory, strip last slash
|
|
63121
|
-
directoryPath = pathname.substring(0, pathname.length - 1);
|
|
63122
|
-
} else {
|
|
63123
|
-
//path is to a file
|
|
63124
|
-
const i = pathname.lastIndexOf('/');
|
|
63148
|
+
let result = path;
|
|
63125
63149
|
|
|
63126
|
-
|
|
63127
|
-
|
|
63128
|
-
|
|
63129
|
-
|
|
63130
|
-
|
|
63131
|
-
|
|
63150
|
+
if (!is_global) {
|
|
63151
|
+
result = localPathToGlobal(path);
|
|
63152
|
+
}
|
|
63153
|
+
|
|
63154
|
+
return result;
|
|
63155
|
+
}
|
|
63156
|
+
|
|
63157
|
+
/**
|
|
63158
|
+
*
|
|
63159
|
+
* @param {string} code
|
|
63160
|
+
* @param {string} [mime_type]
|
|
63161
|
+
* @return {Blob}
|
|
63162
|
+
*/
|
|
63163
|
+
function codeToBlob(code, mime_type = 'application/javascript') {
|
|
63164
|
+
|
|
63165
|
+
let blob;
|
|
63166
|
+
|
|
63167
|
+
if (typeof globalThis.Blob !== "undefined") {
|
|
63168
|
+
blob = new Blob([code], { type: mime_type });
|
|
63169
|
+
} else {
|
|
63170
|
+
// Backwards-compatibility
|
|
63171
|
+
const BlobBuilder = globalThis.BlobBuilder
|
|
63172
|
+
|| globalThis.BlobBuilder
|
|
63173
|
+
|| globalThis.WebKitBlobBuilder
|
|
63174
|
+
|| globalThis.MozBlobBuilder;
|
|
63175
|
+
|
|
63176
|
+
if (BlobBuilder !== undefined) {
|
|
63177
|
+
blob = new BlobBuilder();
|
|
63178
|
+
blob.append(code);
|
|
63179
|
+
blob = blob.getBlob();
|
|
63180
|
+
} else {
|
|
63181
|
+
throw new Error(`No BlobBuilder interface supported in current context`);
|
|
63132
63182
|
}
|
|
63133
63183
|
|
|
63134
|
-
const urlBase = location.protocol + "//" + location.host + directoryPath + "/";
|
|
63135
|
-
path = urlBase + path;
|
|
63136
63184
|
}
|
|
63137
63185
|
|
|
63138
|
-
|
|
63186
|
+
|
|
63187
|
+
return blob;
|
|
63188
|
+
}
|
|
63189
|
+
|
|
63190
|
+
/**
|
|
63191
|
+
*
|
|
63192
|
+
* @param {string} code
|
|
63193
|
+
* @param {string} [mime_type]
|
|
63194
|
+
* @return {string}
|
|
63195
|
+
*/
|
|
63196
|
+
function codeToURL(code, mime_type = 'application/javascript') {
|
|
63197
|
+
|
|
63198
|
+
const blob = codeToBlob(code, mime_type);
|
|
63199
|
+
|
|
63200
|
+
if (blob !== undefined && URL.createObjectURL !== undefined) {
|
|
63201
|
+
return URL.createObjectURL(blob);
|
|
63202
|
+
} else {
|
|
63203
|
+
// build data URL in a slowest way possible
|
|
63204
|
+
return `data:${mime_type},${encodeURIComponent(code)}`;
|
|
63205
|
+
}
|
|
63139
63206
|
}
|
|
63140
63207
|
|
|
63141
63208
|
class Line {
|
|
@@ -63591,6 +63658,7 @@ class WorkerProxy {
|
|
|
63591
63658
|
|
|
63592
63659
|
const RxMatchFunctionName = /(function\s*)([a-zA-Z0-9_]+)?(\s*\([^\]]*\)\s*\{.*)/g;
|
|
63593
63660
|
|
|
63661
|
+
|
|
63594
63662
|
class WorkerBuilder {
|
|
63595
63663
|
|
|
63596
63664
|
imports = [];
|
|
@@ -63633,9 +63701,9 @@ class WorkerBuilder {
|
|
|
63633
63701
|
* @param {string} path
|
|
63634
63702
|
*/
|
|
63635
63703
|
importScript(path) {
|
|
63636
|
-
|
|
63704
|
+
const qualified_path = convertPathToURL(path);
|
|
63637
63705
|
|
|
63638
|
-
this.imports.push(
|
|
63706
|
+
this.imports.push(qualified_path);
|
|
63639
63707
|
}
|
|
63640
63708
|
|
|
63641
63709
|
/**
|
|
@@ -63645,7 +63713,7 @@ class WorkerBuilder {
|
|
|
63645
63713
|
build() {
|
|
63646
63714
|
const codeLines = [];
|
|
63647
63715
|
|
|
63648
|
-
codeLines.push('var globalScope =
|
|
63716
|
+
codeLines.push('var globalScope = globalThis;');
|
|
63649
63717
|
|
|
63650
63718
|
//handle imports
|
|
63651
63719
|
this.imports.forEach(function (url) {
|
|
@@ -63746,37 +63814,6 @@ class WorkerBuilder {
|
|
|
63746
63814
|
|
|
63747
63815
|
return new WorkerProxy(workerURL, this.methods);
|
|
63748
63816
|
}
|
|
63749
|
-
}
|
|
63750
|
-
/**
|
|
63751
|
-
*
|
|
63752
|
-
* @param {string} code
|
|
63753
|
-
* @return {string}
|
|
63754
|
-
*/
|
|
63755
|
-
function codeToURL(code) {
|
|
63756
|
-
const js_mime = 'application/javascript';
|
|
63757
|
-
|
|
63758
|
-
let blob;
|
|
63759
|
-
|
|
63760
|
-
if (typeof window === 'object') {
|
|
63761
|
-
if (typeof window.Blob !== "undefined") {
|
|
63762
|
-
blob = new Blob([code], {type: js_mime});
|
|
63763
|
-
} else {
|
|
63764
|
-
// Backwards-compatibility
|
|
63765
|
-
const BlobBuilder = window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
|
|
63766
|
-
if (BlobBuilder !== undefined) {
|
|
63767
|
-
blob = new BlobBuilder();
|
|
63768
|
-
blob.append(code);
|
|
63769
|
-
blob = blob.getBlob();
|
|
63770
|
-
}
|
|
63771
|
-
}
|
|
63772
|
-
}
|
|
63773
|
-
|
|
63774
|
-
if (blob !== undefined && URL.createObjectURL !== undefined) {
|
|
63775
|
-
return URL.createObjectURL(blob);
|
|
63776
|
-
} else {
|
|
63777
|
-
// build data URL in a slowest way possible
|
|
63778
|
-
return `data:${js_mime},${encodeURIComponent(code)}`;
|
|
63779
|
-
}
|
|
63780
63817
|
}
|
|
63781
63818
|
|
|
63782
63819
|
/**
|
|
@@ -67691,20 +67728,19 @@ class AssetLoader {
|
|
|
67691
67728
|
function observeResponseProgress(input, progress) {
|
|
67692
67729
|
let response = input;
|
|
67693
67730
|
|
|
67694
|
-
|
|
67695
|
-
if (typeof ReadableStream === 'undefined' || response.body.getReader === undefined) {
|
|
67731
|
+
// Workaround: Checking if response.body === undefined for Alipay browser
|
|
67732
|
+
if (typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined) {
|
|
67696
67733
|
|
|
67697
67734
|
return response;
|
|
67698
67735
|
|
|
67699
67736
|
}
|
|
67700
67737
|
|
|
67701
|
-
|
|
67702
|
-
|
|
67703
|
-
|
|
67704
|
-
const reader = response.body.getReader();
|
|
67738
|
+
// Nginx needs X-File-Size check
|
|
67739
|
+
// https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content
|
|
67740
|
+
const contentLength = response.headers.get('Content-Length') || response.headers.get('X-File-Size');
|
|
67705
67741
|
|
|
67706
|
-
const contentLength = response.headers.get('Content-Length');
|
|
67707
67742
|
const total = contentLength ? parseInt(contentLength) : 0;
|
|
67743
|
+
|
|
67708
67744
|
let loaded = 0;
|
|
67709
67745
|
|
|
67710
67746
|
// periodically read data into the new stream tracking while download progress
|
|
@@ -67712,6 +67748,11 @@ function observeResponseProgress(input, progress) {
|
|
|
67712
67748
|
type: "bytes",
|
|
67713
67749
|
start(controller) {
|
|
67714
67750
|
|
|
67751
|
+
/**
|
|
67752
|
+
* @type {ReadableStreamDefaultReader<Uint8Array>}
|
|
67753
|
+
*/
|
|
67754
|
+
const reader = response.body.getReader();
|
|
67755
|
+
|
|
67715
67756
|
pump();
|
|
67716
67757
|
|
|
67717
67758
|
function pump() {
|
|
@@ -67729,6 +67770,7 @@ function observeResponseProgress(input, progress) {
|
|
|
67729
67770
|
progress(loaded, total);
|
|
67730
67771
|
|
|
67731
67772
|
controller.enqueue(value);
|
|
67773
|
+
|
|
67732
67774
|
pump();
|
|
67733
67775
|
|
|
67734
67776
|
});
|
|
@@ -67800,16 +67842,13 @@ class ArrayBufferLoader extends AssetLoader {
|
|
|
67800
67842
|
|
|
67801
67843
|
let response = await fetch(request);
|
|
67802
67844
|
|
|
67803
|
-
|
|
67845
|
+
const response_status = response.status;
|
|
67804
67846
|
|
|
67805
|
-
|
|
67847
|
+
if (response_status !== 200 && response_status !== 0) {
|
|
67806
67848
|
|
|
67807
|
-
|
|
67808
|
-
|
|
67809
|
-
// Some browsers return HTTP Status 0 when using non-http protocol
|
|
67810
|
-
// e.g. 'file://' or 'data://'. Handle as success.
|
|
67849
|
+
throw Error(`fetch for "${response.url}" responded with ${response_status}: ${response.statusText}`);
|
|
67811
67850
|
|
|
67812
|
-
|
|
67851
|
+
}
|
|
67813
67852
|
|
|
67814
67853
|
try {
|
|
67815
67854
|
response = observeResponseProgress(response, progress);
|
|
@@ -75592,6 +75631,9 @@ const TextureAttachmentsByMaterialType = {
|
|
|
75592
75631
|
taDisplacement,
|
|
75593
75632
|
taAlphaMap
|
|
75594
75633
|
],
|
|
75634
|
+
MeshBasicMaterial: [
|
|
75635
|
+
taDiffuse
|
|
75636
|
+
],
|
|
75595
75637
|
MeshStandardMaterial: [
|
|
75596
75638
|
taDiffuse,
|
|
75597
75639
|
taAlphaMap,
|
|
@@ -105068,6 +105110,9 @@ class TopDownCameraController {
|
|
|
105068
105110
|
|
|
105069
105111
|
this.distance = eye.distanceTo(target);
|
|
105070
105112
|
|
|
105113
|
+
// ensure we can maintain this distance
|
|
105114
|
+
this.distanceMax = max2(this.distance, this.distanceMax);
|
|
105115
|
+
|
|
105071
105116
|
this.target.copy(target);
|
|
105072
105117
|
}
|
|
105073
105118
|
|
|
@@ -115604,6 +115649,12 @@ function setLocale(engine) {
|
|
|
115604
115649
|
return engine.localization.loadLocale(locale);
|
|
115605
115650
|
}
|
|
115606
115651
|
|
|
115652
|
+
/**
|
|
115653
|
+
* Equal to ~ 5500 K light color
|
|
115654
|
+
* @type {Readonly<Color>}
|
|
115655
|
+
*/
|
|
115656
|
+
const DEFAULT_SUNLIGHT_COLOR = Object.freeze(new Color(1, 0.93, 0.87));
|
|
115657
|
+
|
|
115607
115658
|
class EngineHarness {
|
|
115608
115659
|
constructor() {
|
|
115609
115660
|
/**
|
|
@@ -115881,7 +115932,7 @@ class EngineHarness {
|
|
|
115881
115932
|
ecd = engine.entityManager.dataset,
|
|
115882
115933
|
shadowmapResolution = 1024,
|
|
115883
115934
|
castShadow = true,
|
|
115884
|
-
sun =
|
|
115935
|
+
sun = DEFAULT_SUNLIGHT_COLOR,
|
|
115885
115936
|
sunIntensity = 0.9,
|
|
115886
115937
|
sunDirection = new Vector3$1(0.1, -1, 0.1),
|
|
115887
115938
|
ambient = Color.white,
|