@woosh/meep-engine 2.107.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/bundle-worker-image-decoder.js +1 -1
- package/build/meep.cjs +255 -172
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +255 -173
- 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/int32_to_binary_string.d.ts +3 -2
- package/src/core/binary/int32_to_binary_string.d.ts.map +1 -1
- package/src/core/binary/int32_to_binary_string.js +18 -14
- package/src/core/binary/split_by_3.spec.d.ts +2 -0
- package/src/core/binary/split_by_3.spec.d.ts.map +1 -0
- package/src/core/binary/split_by_3.spec.js +22 -0
- package/src/core/binary/to_half_float_uint16.d.ts.map +1 -1
- package/src/core/binary/to_half_float_uint16.js +7 -5
- 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/isArrayEqualStrict.d.ts.map +1 -1
- package/src/core/collection/array/isArrayEqualStrict.js +2 -2
- package/src/core/collection/array/iterator/ArrayIteratorRandom.js +2 -2
- package/src/core/collection/array/randomMultipleFromArray.js +2 -2
- package/src/core/color/Color.d.ts.map +1 -1
- package/src/core/color/Color.js +16 -11
- package/src/core/color/hsv/hsv2rgb.js +4 -4
- package/src/core/color/hsv/rgb2hsv.d.ts +3 -3
- package/src/core/color/hsv/rgb2hsv.d.ts.map +1 -1
- package/src/core/color/hsv/rgb2hsv.js +11 -18
- package/src/core/color/rgb2uint24.js +4 -4
- package/src/core/color/rgb_to_luminance.d.ts +9 -0
- package/src/core/color/rgb_to_luminance.d.ts.map +1 -0
- package/src/core/color/rgb_to_luminance.js +10 -0
- 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/README.md +16 -2
- package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.d.ts +6 -0
- package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/SH3_COEFFICIENTS.js +17 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_basis_at.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_basis_at.js +21 -9
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts +3 -3
- 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 +35 -206
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate.js +29 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.js +10 -10
- package/src/core/geom/3d/sphere/harmonics/sh_index.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh_index.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh_index.js +9 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.js +44 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts +8 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.js +86 -0
- package/src/core/geom/3d/sphere/in_sphere3d_robust.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/in_sphere3d_robust.js +2 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts +20 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +53 -7
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.spec.js +2 -2
- package/src/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.d.ts +1 -1
- package/src/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.js +12 -7
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.d.ts +13 -0
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_build_from_grid.js +135 -0
- package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +38 -24
- package/src/core/geom/3d/tetrahedra/{compute_circumsphere.d.ts → tetrahedron_compute_circumsphere.d.ts} +3 -5
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/{compute_circumsphere.js → tetrahedron_compute_circumsphere.js} +2 -4
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.js +3 -1
- package/src/core/geom/Vector3.d.ts.map +1 -1
- package/src/core/geom/Vector3.js +4 -3
- package/src/core/geom/mat3/m3_multiply_vec3.d.ts +8 -0
- package/src/core/geom/mat3/m3_multiply_vec3.d.ts.map +1 -0
- package/src/core/geom/mat3/m3_multiply_vec3.js +21 -0
- 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/geom/vec2/v2_cross_product.d.ts +15 -0
- package/src/core/geom/vec2/v2_cross_product.d.ts.map +1 -0
- package/src/core/geom/vec2/v2_cross_product.js +21 -0
- package/src/core/geom/vec3/v3_slerp.d.ts +1 -0
- package/src/core/geom/vec3/v3_slerp.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_slerp.js +1 -0
- package/src/core/graph/MultiNode.d.ts +1 -1
- package/src/core/graph/MultiNode.js +1 -1
- package/src/core/graph/WeightedEdge.d.ts +6 -4
- package/src/core/graph/WeightedEdge.d.ts.map +1 -1
- package/src/core/graph/WeightedEdge.js +3 -0
- package/src/core/graph/coloring/colorizeGraph.js +19 -19
- package/src/core/graph/convert_graph_to_dot_string.d.ts +1 -1
- package/src/core/graph/convert_graph_to_dot_string.d.ts.map +1 -1
- package/src/core/graph/convert_graph_to_dot_string.js +10 -6
- package/src/core/graph/graph_compute_adjacency_matrix.d.ts +9 -0
- package/src/core/graph/graph_compute_adjacency_matrix.d.ts.map +1 -0
- package/src/core/graph/{graph_adjacency_matrix.js → graph_compute_adjacency_matrix.js} +1 -2
- package/src/core/graph/graph_compute_degree_matrix.d.ts +10 -0
- package/src/core/graph/graph_compute_degree_matrix.d.ts.map +1 -0
- package/src/core/graph/graph_compute_degree_matrix.js +23 -0
- package/src/core/graph/graph_compute_distance_matrix.d.ts +13 -0
- package/src/core/graph/graph_compute_distance_matrix.d.ts.map +1 -0
- package/src/core/graph/graph_compute_distance_matrix.js +103 -0
- package/src/core/graph/{graph_laplacian_matrix.d.ts → graph_compute_laplacian_matrix.d.ts} +2 -2
- package/src/core/graph/graph_compute_laplacian_matrix.d.ts.map +1 -0
- package/src/core/graph/{graph_laplacian_matrix.js → graph_compute_laplacian_matrix.js} +6 -6
- package/src/core/graph/graph_k_means_cluster.d.ts.map +1 -1
- package/src/core/graph/graph_k_means_cluster.js +4 -119
- package/src/core/graph/{coarsen_graph.d.ts → mn_graph_coarsen.d.ts} +2 -2
- package/src/core/graph/mn_graph_coarsen.d.ts.map +1 -0
- package/src/core/graph/{coarsen_graph.js → mn_graph_coarsen.js} +1 -1
- package/src/core/graph/mn_graph_coarsen.spec.d.ts +2 -0
- package/src/core/graph/mn_graph_coarsen.spec.d.ts.map +1 -0
- package/src/core/graph/{coarsen_graph.spec.js → mn_graph_coarsen.spec.js} +4 -4
- package/src/core/graph/mn_graph_collapse_weighted_edge.d.ts +1 -0
- package/src/core/graph/mn_graph_collapse_weighted_edge.d.ts.map +1 -1
- package/src/core/graph/mn_graph_collapse_weighted_edge.js +7 -1
- package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
- package/src/core/math/physics/brdf/brdf_burley.js +9 -1
- package/src/core/math/physics/brdf/{D_GGX.d.ts → diffuse_GGX.d.ts} +2 -2
- package/src/core/math/physics/brdf/diffuse_GGX.d.ts.map +1 -0
- package/src/core/math/physics/brdf/{D_GGX.js → diffuse_GGX.js} +1 -1
- package/src/core/math/physics/brdf/fresnel_Schlick.d.ts +3 -0
- package/src/core/math/physics/brdf/fresnel_Schlick.d.ts.map +1 -0
- package/src/core/math/physics/brdf/fresnel_Schlick.js +3 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_optimized.d.ts +9 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_optimized.d.ts.map +1 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_optimized.js +12 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_original.d.ts +9 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_original.d.ts.map +1 -0
- package/src/core/math/physics/brdf/fresnel_Schlick_original.js +10 -0
- package/src/core/math/physics/bsdf/bsdf_schlick.d.ts.map +1 -1
- package/src/core/math/physics/bsdf/bsdf_schlick.js +3 -11
- package/src/core/math/physics/ior_to_reflectivity.d.ts +7 -0
- package/src/core/math/physics/ior_to_reflectivity.d.ts.map +1 -0
- package/src/core/math/physics/ior_to_reflectivity.js +9 -0
- package/src/core/math/physics/pdf/README.md +1 -0
- package/src/core/math/physics/pdf/pdf_GGX.d.ts +16 -0
- package/src/core/math/physics/pdf/pdf_GGX.d.ts.map +1 -0
- package/src/core/math/physics/pdf/pdf_GGX.js +25 -0
- package/src/core/math/physics/reflectivity_to_ior.d.ts +7 -0
- package/src/core/math/physics/reflectivity_to_ior.d.ts.map +1 -0
- package/src/core/math/physics/reflectivity_to_ior.js +8 -0
- 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 +10 -1
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +22 -11
- 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/image/png/PNGReader.d.ts +25 -11
- package/src/engine/asset/loaders/image/png/PNGReader.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/png/PNGReader.js +38 -24
- package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/TextureAttachmensByMaterialType.js +5 -0
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +4 -4
- package/src/engine/graphics/GraphicsEngine.js +1 -1
- 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/light/LightSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/LightSystem.js +2 -3
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts +6 -0
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +22 -11
- 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/render/forward_plus/model/DirectionalLight.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/model/DirectionalLight.js +25 -25
- 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/fromCubeRenderTarget.d.ts +9 -0
- package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts.map +1 -0
- package/src/engine/graphics/sh3/fromCubeRenderTarget.js +145 -0
- package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.d.ts +8 -0
- package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/tetrahedral_mesh_to_texture.js +51 -0
- package/src/engine/graphics/sh3/{LightProbeVolume.d.ts → lpv/LightProbeVolume.d.ts} +18 -7
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +340 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.d.ts +18 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.js +44 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +12 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +122 -0
- package/src/engine/graphics/sh3/lpv/ProbeRenderer.d.ts +29 -0
- package/src/engine/graphics/sh3/lpv/ProbeRenderer.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/ProbeRenderer.js +35 -0
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts +27 -0
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/WebGLCubeProbeRenderer.js +158 -0
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts +11 -0
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +127 -0
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts +12 -0
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +89 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +90 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +352 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts +5 -91
- package/src/engine/graphics/sh3/path_tracer/PathTracer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +41 -477
- package/src/engine/graphics/sh3/path_tracer/make_one_vector3.d.ts +1 -0
- package/src/engine/graphics/sh3/path_tracer/make_one_vector3.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/make_one_vector3.js +6 -3
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +38 -62
- package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.js +7 -1
- package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts +2 -2
- package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js +1 -1
- 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/SoftwareTextureCache.d.ts +3 -0
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.js +3 -0
- package/src/engine/graphics/sh3/path_tracer/texture/apply_texture_clamping_to_coordinate.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{apply_texture_clamping_to_coordinate.js → texture/apply_texture_clamping_to_coordinate.js} +2 -2
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts +11 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +86 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.d.ts +10 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_texture.js +55 -0
- package/src/engine/graphics/sh3/path_tracer/vec3_uint8_to_float.js +4 -4
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +145 -185
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts +5 -5
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.d.ts.map +1 -1
- package/src/engine/graphics/sh3/sky/hosek/sky_hosek_compute_irradiance_by_direction.js +8 -8
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts +13 -0
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.d.ts.map +1 -0
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +54 -0
- package/src/engine/graphics/texture/AttributeDataTexture.d.ts +2 -2
- package/src/engine/graphics/texture/AttributeDataTexture.d.ts.map +1 -1
- package/src/engine/graphics/texture/AttributeDataTexture.js +11 -11
- 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/input/ecs/systems/InputControllerSystem.js +1 -1
- 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/view/elements/ColorPickerView.d.ts.map +1 -1
- package/src/view/elements/ColorPickerView.js +7 -7
- 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/src/core/geom/3d/tetrahedra/compute_circumsphere.d.ts.map +0 -1
- package/src/core/graph/coarsen_graph.d.ts.map +0 -1
- package/src/core/graph/coarsen_graph.spec.d.ts +0 -2
- package/src/core/graph/coarsen_graph.spec.d.ts.map +0 -1
- package/src/core/graph/graph_adjacency_matrix.d.ts +0 -9
- package/src/core/graph/graph_adjacency_matrix.d.ts.map +0 -1
- package/src/core/graph/graph_degree_matrix.d.ts +0 -9
- package/src/core/graph/graph_degree_matrix.d.ts.map +0 -1
- package/src/core/graph/graph_degree_matrix.js +0 -18
- package/src/core/graph/graph_laplacian_matrix.d.ts.map +0 -1
- package/src/core/math/physics/brdf/D_GGX.d.ts.map +0 -1
- package/src/engine/graphics/sh3/LightProbeVolume.d.ts.map +0 -1
- package/src/engine/graphics/sh3/LightProbeVolume.js +0 -609
- package/src/engine/graphics/sh3/path_tracer/apply_texture_clamping_to_coordinate.d.ts.map +0 -1
- package/src/engine/graphics/sh3/visualise_probe.d.ts +0 -12
- package/src/engine/graphics/sh3/visualise_probe.d.ts.map +0 -1
- package/src/engine/graphics/sh3/visualise_probe.js +0 -40
- /package/src/engine/graphics/sh3/path_tracer/{apply_texture_clamping_to_coordinate.d.ts → texture/apply_texture_clamping_to_coordinate.d.ts} +0 -0
package/build/meep.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
|
-
* @param {Array} a
|
|
6
|
-
* @param {Array} b
|
|
5
|
+
* @param {Array|Uint8Array} a
|
|
6
|
+
* @param {Array|Uint8Array} b
|
|
7
7
|
* @returns {boolean}
|
|
8
8
|
*/
|
|
9
9
|
function isArrayEqualStrict(a, b) {
|
|
@@ -2049,6 +2049,7 @@ function v3_lerp(
|
|
|
2049
2049
|
|
|
2050
2050
|
/**
|
|
2051
2051
|
* Spherical linear interpolation
|
|
2052
|
+
* NOTE: vectors are assumed to be normalized
|
|
2052
2053
|
* @see https://en.wikipedia.org/wiki/Slerp
|
|
2053
2054
|
* @param {Vector3} result
|
|
2054
2055
|
* @param {number} a_x
|
|
@@ -2671,6 +2672,7 @@ let Vector3$1 = class Vector3 {
|
|
|
2671
2672
|
const y = this.y;
|
|
2672
2673
|
const z = this.z;
|
|
2673
2674
|
|
|
2675
|
+
// This is just 3x3 matrix multiplication
|
|
2674
2676
|
const _x = m4[0] * x + m4[4] * y + m4[8] * z;
|
|
2675
2677
|
const _y = m4[1] * x + m4[5] * y + m4[9] * z;
|
|
2676
2678
|
const _z = m4[2] * x + m4[6] * y + m4[10] * z;
|
|
@@ -2868,10 +2870,10 @@ let Vector3$1 = class Vector3 {
|
|
|
2868
2870
|
}
|
|
2869
2871
|
|
|
2870
2872
|
/**
|
|
2871
|
-
*
|
|
2873
|
+
* Convert spherical coordinates to cartesian
|
|
2872
2874
|
* @param {number} radius
|
|
2873
|
-
* @param {number} phi
|
|
2874
|
-
* @param {number} theta
|
|
2875
|
+
* @param {number} phi Also known as Azimuth
|
|
2876
|
+
* @param {number} theta Also known as Elevation
|
|
2875
2877
|
*/
|
|
2876
2878
|
setFromSphericalCoords(radius, phi, theta) {
|
|
2877
2879
|
|
|
@@ -49538,7 +49540,7 @@ class Sampler2D {
|
|
|
49538
49540
|
*
|
|
49539
49541
|
* @param {number} u
|
|
49540
49542
|
* @param {number} v
|
|
49541
|
-
* @param {number[]} result
|
|
49543
|
+
* @param {number[]|Float32Array} result
|
|
49542
49544
|
* @param {number} result_offset
|
|
49543
49545
|
*/
|
|
49544
49546
|
sampleBilinearUV(u, v, result, result_offset = 0) {
|
|
@@ -49668,7 +49670,7 @@ class Sampler2D {
|
|
|
49668
49670
|
*
|
|
49669
49671
|
* @param {number} u
|
|
49670
49672
|
* @param {number} v
|
|
49671
|
-
* @param {ArrayLike<number>} result
|
|
49673
|
+
* @param {number[]|ArrayLike<number>} result
|
|
49672
49674
|
*/
|
|
49673
49675
|
sampleNearestUV(u, v, result) {
|
|
49674
49676
|
const w = this.width;
|
|
@@ -50288,7 +50290,7 @@ const WHITE_PIXEL_DATA_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEA
|
|
|
50288
50290
|
* @param {number} v
|
|
50289
50291
|
* @returns {number}
|
|
50290
50292
|
*/
|
|
50291
|
-
function
|
|
50293
|
+
function float_to_uint8(v) {
|
|
50292
50294
|
return Math.round(v * 255);
|
|
50293
50295
|
}
|
|
50294
50296
|
|
|
@@ -50297,7 +50299,7 @@ function float2uint8(v) {
|
|
|
50297
50299
|
* @param {number} v
|
|
50298
50300
|
* @returns {number}
|
|
50299
50301
|
*/
|
|
50300
|
-
function
|
|
50302
|
+
function uint8_to_float(v) {
|
|
50301
50303
|
return v / 255;
|
|
50302
50304
|
}
|
|
50303
50305
|
|
|
@@ -51696,7 +51698,7 @@ class TerrainOverlay {
|
|
|
51696
51698
|
for (let i = 0; i < 4; i++) {
|
|
51697
51699
|
const v = this.sampler.readChannel(x, y, i);
|
|
51698
51700
|
|
|
51699
|
-
result[i] =
|
|
51701
|
+
result[i] = uint8_to_float(v);
|
|
51700
51702
|
}
|
|
51701
51703
|
}
|
|
51702
51704
|
|
|
@@ -51743,7 +51745,7 @@ class TerrainOverlay {
|
|
|
51743
51745
|
paintPoint(x, y, vec4) {
|
|
51744
51746
|
for (let i = 0; i < 4; i++) {
|
|
51745
51747
|
|
|
51746
|
-
this.sampler.writeChannel(x, y, i,
|
|
51748
|
+
this.sampler.writeChannel(x, y, i, float_to_uint8(vec4[i]));
|
|
51747
51749
|
|
|
51748
51750
|
}
|
|
51749
51751
|
|
|
@@ -53220,7 +53222,7 @@ function aabb3_intersects_ray(
|
|
|
53220
53222
|
const diff_x = origin_x - center_x;
|
|
53221
53223
|
|
|
53222
53224
|
|
|
53223
|
-
if (diff_x * direction_x >= 0
|
|
53225
|
+
if (diff_x * direction_x >= 0 && abs(diff_x) > extents_x) {
|
|
53224
53226
|
return false;
|
|
53225
53227
|
}
|
|
53226
53228
|
|
|
@@ -53232,7 +53234,7 @@ function aabb3_intersects_ray(
|
|
|
53232
53234
|
const diff_y = origin_y - center_y;
|
|
53233
53235
|
|
|
53234
53236
|
|
|
53235
|
-
if (diff_y * direction_y >= 0
|
|
53237
|
+
if (diff_y * direction_y >= 0 && abs(diff_y) > extents_y) {
|
|
53236
53238
|
return false;
|
|
53237
53239
|
}
|
|
53238
53240
|
|
|
@@ -53244,7 +53246,7 @@ function aabb3_intersects_ray(
|
|
|
53244
53246
|
const diff_z = origin_z - center_z;
|
|
53245
53247
|
|
|
53246
53248
|
|
|
53247
|
-
if (diff_z * direction_z >= 0
|
|
53249
|
+
if (diff_z * direction_z >= 0 && abs(diff_z) > extents_z) {
|
|
53248
53250
|
return false;
|
|
53249
53251
|
}
|
|
53250
53252
|
|
|
@@ -53400,20 +53402,15 @@ function rgb2hex(r, g, b) {
|
|
|
53400
53402
|
|
|
53401
53403
|
/**
|
|
53402
53404
|
*
|
|
53403
|
-
* @param {number} r 0 to
|
|
53404
|
-
* @param {number} g 0 to
|
|
53405
|
-
* @param {number} b 0 to
|
|
53405
|
+
* @param {number} r 0 to 1
|
|
53406
|
+
* @param {number} g 0 to 1
|
|
53407
|
+
* @param {number} b 0 to 1
|
|
53406
53408
|
* @returns {{h: number, s: number, v: number}}
|
|
53407
53409
|
*/
|
|
53408
53410
|
function rgb2hsv(r, g, b) {
|
|
53409
53411
|
|
|
53410
|
-
const
|
|
53411
|
-
const
|
|
53412
|
-
const _b = uint82float(b);
|
|
53413
|
-
|
|
53414
|
-
|
|
53415
|
-
const max = Math.max(_r, _g, _b);
|
|
53416
|
-
const min = Math.min(_r, _g, _b);
|
|
53412
|
+
const max = Math.max(r, g, b);
|
|
53413
|
+
const min = Math.min(r, g, b);
|
|
53417
53414
|
|
|
53418
53415
|
let h, s, v = max;
|
|
53419
53416
|
|
|
@@ -53425,14 +53422,14 @@ function rgb2hsv(r, g, b) {
|
|
|
53425
53422
|
h = 0; // achromatic
|
|
53426
53423
|
} else {
|
|
53427
53424
|
switch (max) {
|
|
53428
|
-
case
|
|
53429
|
-
h = (
|
|
53425
|
+
case r:
|
|
53426
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
53430
53427
|
break;
|
|
53431
|
-
case
|
|
53432
|
-
h = (
|
|
53428
|
+
case g:
|
|
53429
|
+
h = (b - r) / d + 2;
|
|
53433
53430
|
break;
|
|
53434
|
-
case
|
|
53435
|
-
h = (
|
|
53431
|
+
case b:
|
|
53432
|
+
h = (r - g) / d + 4;
|
|
53436
53433
|
break;
|
|
53437
53434
|
}
|
|
53438
53435
|
|
|
@@ -53529,9 +53526,9 @@ function hsv2rgb(h, s, v) {
|
|
|
53529
53526
|
break;
|
|
53530
53527
|
}
|
|
53531
53528
|
return {
|
|
53532
|
-
r:
|
|
53533
|
-
g:
|
|
53534
|
-
b:
|
|
53529
|
+
r: float_to_uint8(r),
|
|
53530
|
+
g: float_to_uint8(g),
|
|
53531
|
+
b: float_to_uint8(b)
|
|
53535
53532
|
};
|
|
53536
53533
|
}
|
|
53537
53534
|
|
|
@@ -53622,9 +53619,9 @@ function parse_color(c) {
|
|
|
53622
53619
|
* @returns {number}
|
|
53623
53620
|
*/
|
|
53624
53621
|
function rgb2uint24(r, g, b) {
|
|
53625
|
-
const _r =
|
|
53626
|
-
const _g =
|
|
53627
|
-
const _b =
|
|
53622
|
+
const _r = float_to_uint8(r);
|
|
53623
|
+
const _g = float_to_uint8(g);
|
|
53624
|
+
const _b = float_to_uint8(b);
|
|
53628
53625
|
|
|
53629
53626
|
return (_b & 0xFF)
|
|
53630
53627
|
| (_g & 0xFF) << 8
|
|
@@ -53632,7 +53629,18 @@ function rgb2uint24(r, g, b) {
|
|
|
53632
53629
|
;
|
|
53633
53630
|
}
|
|
53634
53631
|
|
|
53635
|
-
|
|
53632
|
+
/**
|
|
53633
|
+
*
|
|
53634
|
+
* @param {number} r
|
|
53635
|
+
* @param {number} g
|
|
53636
|
+
* @param {number} b
|
|
53637
|
+
* @return {number}
|
|
53638
|
+
*/
|
|
53639
|
+
function rgb_to_luminance(r, g, b) {
|
|
53640
|
+
return 0.299 * r + 0.587 * g + 0.114 * b;
|
|
53641
|
+
}
|
|
53642
|
+
|
|
53643
|
+
function convert_channel_linear_to_sRGB(c) {
|
|
53636
53644
|
if (c < 0.0031308) {
|
|
53637
53645
|
return c * 12.92;
|
|
53638
53646
|
} else {
|
|
@@ -53655,9 +53663,9 @@ function linear_to_sRGB(
|
|
|
53655
53663
|
const g = input[input_offset + 1];
|
|
53656
53664
|
const b = input[input_offset + 2];
|
|
53657
53665
|
|
|
53658
|
-
output[output_offset] =
|
|
53659
|
-
output[output_offset + 1] =
|
|
53660
|
-
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);
|
|
53661
53669
|
}
|
|
53662
53670
|
|
|
53663
53671
|
/**
|
|
@@ -53831,9 +53839,9 @@ class Color {
|
|
|
53831
53839
|
*/
|
|
53832
53840
|
setRGBUint8(r, g, b) {
|
|
53833
53841
|
this.setRGB(
|
|
53834
|
-
|
|
53835
|
-
|
|
53836
|
-
|
|
53842
|
+
uint8_to_float(r),
|
|
53843
|
+
uint8_to_float(g),
|
|
53844
|
+
uint8_to_float(b),
|
|
53837
53845
|
);
|
|
53838
53846
|
}
|
|
53839
53847
|
|
|
@@ -54086,11 +54094,15 @@ class Color {
|
|
|
54086
54094
|
* @return {number}
|
|
54087
54095
|
*/
|
|
54088
54096
|
computeLuminance() {
|
|
54089
|
-
return
|
|
54097
|
+
return rgb_to_luminance(this.r, this.g, this.b);
|
|
54090
54098
|
}
|
|
54091
54099
|
|
|
54092
54100
|
getHSV() {
|
|
54093
|
-
return rgb2hsv(
|
|
54101
|
+
return rgb2hsv(
|
|
54102
|
+
this.r,
|
|
54103
|
+
this.g,
|
|
54104
|
+
this.b
|
|
54105
|
+
);
|
|
54094
54106
|
}
|
|
54095
54107
|
|
|
54096
54108
|
/**
|
|
@@ -54122,9 +54134,9 @@ class Color {
|
|
|
54122
54134
|
*/
|
|
54123
54135
|
toHex() {
|
|
54124
54136
|
return '#' + rgb2hex(
|
|
54125
|
-
|
|
54126
|
-
|
|
54127
|
-
|
|
54137
|
+
float_to_uint8(this.r),
|
|
54138
|
+
float_to_uint8(this.g),
|
|
54139
|
+
float_to_uint8(this.b)
|
|
54128
54140
|
);
|
|
54129
54141
|
}
|
|
54130
54142
|
|
|
@@ -54133,7 +54145,7 @@ class Color {
|
|
|
54133
54145
|
* @returns {string}
|
|
54134
54146
|
*/
|
|
54135
54147
|
toCssRGBAString() {
|
|
54136
|
-
return `rgba(${
|
|
54148
|
+
return `rgba(${float_to_uint8(this.r)},${float_to_uint8(this.g)},${float_to_uint8(this.b)},${this.a})`;
|
|
54137
54149
|
}
|
|
54138
54150
|
|
|
54139
54151
|
/**
|
|
@@ -56749,11 +56761,13 @@ class AABB3 {
|
|
|
56749
56761
|
* Get center position of the box
|
|
56750
56762
|
* @param {Vector3} target where to write result
|
|
56751
56763
|
*/
|
|
56752
|
-
getCenter(target) {
|
|
56764
|
+
getCenter(target = new Vector3$1()) {
|
|
56753
56765
|
const x = this.getCenterX();
|
|
56754
56766
|
const y = this.getCenterY();
|
|
56755
56767
|
const z = this.getCenterZ();
|
|
56756
56768
|
target.set(x, y, z);
|
|
56769
|
+
|
|
56770
|
+
return target;
|
|
56757
56771
|
}
|
|
56758
56772
|
|
|
56759
56773
|
|
|
@@ -63058,72 +63072,137 @@ const ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
|
|
|
63058
63072
|
* @param {string} path
|
|
63059
63073
|
* @return {string}
|
|
63060
63074
|
*/
|
|
63061
|
-
function
|
|
63075
|
+
function localPathToGlobal(path) {
|
|
63076
|
+
/**
|
|
63077
|
+
* @type {Window|DedicatedWorkerGlobalScope}
|
|
63078
|
+
*/
|
|
63079
|
+
let scope;
|
|
63062
63080
|
|
|
63063
|
-
if (
|
|
63081
|
+
if (ENVIRONMENT_IS_WEB) {
|
|
63082
|
+
scope = window;
|
|
63083
|
+
} else if (ENVIRONMENT_IS_WORKER) {
|
|
63084
|
+
scope = self;
|
|
63085
|
+
} else if (ENVIRONMENT_IS_NODE) {
|
|
63064
63086
|
|
|
63065
|
-
|
|
63066
|
-
* @type {Window|DedicatedWorkerGlobalScope}
|
|
63067
|
-
*/
|
|
63068
|
-
let scope;
|
|
63087
|
+
let normalized_path = `${process.cwd()}/`.replace(/\\/g, '/');
|
|
63069
63088
|
|
|
63070
|
-
|
|
63071
|
-
|
|
63072
|
-
} else if (ENVIRONMENT_IS_WORKER) {
|
|
63073
|
-
scope = self;
|
|
63074
|
-
} else if (ENVIRONMENT_IS_NODE) {
|
|
63089
|
+
// remove multiple sequential slashes
|
|
63090
|
+
normalized_path = normalized_path.replace(/\/+/g, '/');
|
|
63075
63091
|
|
|
63076
|
-
|
|
63077
|
-
|
|
63078
|
-
|
|
63079
|
-
|
|
63092
|
+
if (normalized_path[0] !== '/') {
|
|
63093
|
+
// Windows drive letter must be prefixed with a slash.
|
|
63094
|
+
normalized_path = `/${normalized_path}`;
|
|
63095
|
+
}
|
|
63080
63096
|
|
|
63081
|
-
|
|
63082
|
-
|
|
63083
|
-
|
|
63097
|
+
scope = {
|
|
63098
|
+
location: {
|
|
63099
|
+
pathname: normalized_path,
|
|
63100
|
+
host: '',
|
|
63101
|
+
protocol: 'file:'
|
|
63084
63102
|
}
|
|
63103
|
+
};
|
|
63104
|
+
} else {
|
|
63105
|
+
throw new Error('Unknown environment');
|
|
63106
|
+
}
|
|
63085
63107
|
|
|
63086
|
-
|
|
63087
|
-
|
|
63088
|
-
|
|
63089
|
-
|
|
63090
|
-
|
|
63091
|
-
|
|
63092
|
-
|
|
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 = "";
|
|
63093
63128
|
} else {
|
|
63094
|
-
|
|
63129
|
+
directoryPath = pathname.substring(0, i);
|
|
63095
63130
|
}
|
|
63131
|
+
}
|
|
63096
63132
|
|
|
63097
|
-
|
|
63098
|
-
|
|
63133
|
+
const urlBase = location.protocol + "//" + location.host + directoryPath + "/";
|
|
63134
|
+
return urlBase + path;
|
|
63135
|
+
}
|
|
63099
63136
|
|
|
63100
|
-
|
|
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) {
|
|
63101
63145
|
|
|
63102
|
-
|
|
63103
|
-
path name contains file name also, there are two options here, "a/b" or "a/b/" second is a directory
|
|
63104
|
-
we need to extract directory to load relative path
|
|
63105
|
-
*/
|
|
63146
|
+
const is_global = isGlobalPath(path);
|
|
63106
63147
|
|
|
63107
|
-
|
|
63108
|
-
//path is to a directory, strip last slash
|
|
63109
|
-
directoryPath = pathname.substring(0, pathname.length - 1);
|
|
63110
|
-
} else {
|
|
63111
|
-
//path is to a file
|
|
63112
|
-
const i = pathname.lastIndexOf('/');
|
|
63148
|
+
let result = path;
|
|
63113
63149
|
|
|
63114
|
-
|
|
63115
|
-
|
|
63116
|
-
|
|
63117
|
-
|
|
63118
|
-
|
|
63119
|
-
|
|
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`);
|
|
63120
63182
|
}
|
|
63121
63183
|
|
|
63122
|
-
const urlBase = location.protocol + "//" + location.host + directoryPath + "/";
|
|
63123
|
-
path = urlBase + path;
|
|
63124
63184
|
}
|
|
63125
63185
|
|
|
63126
|
-
|
|
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
|
+
}
|
|
63127
63206
|
}
|
|
63128
63207
|
|
|
63129
63208
|
class Line {
|
|
@@ -63579,6 +63658,7 @@ class WorkerProxy {
|
|
|
63579
63658
|
|
|
63580
63659
|
const RxMatchFunctionName = /(function\s*)([a-zA-Z0-9_]+)?(\s*\([^\]]*\)\s*\{.*)/g;
|
|
63581
63660
|
|
|
63661
|
+
|
|
63582
63662
|
class WorkerBuilder {
|
|
63583
63663
|
|
|
63584
63664
|
imports = [];
|
|
@@ -63621,9 +63701,9 @@ class WorkerBuilder {
|
|
|
63621
63701
|
* @param {string} path
|
|
63622
63702
|
*/
|
|
63623
63703
|
importScript(path) {
|
|
63624
|
-
|
|
63704
|
+
const qualified_path = convertPathToURL(path);
|
|
63625
63705
|
|
|
63626
|
-
this.imports.push(
|
|
63706
|
+
this.imports.push(qualified_path);
|
|
63627
63707
|
}
|
|
63628
63708
|
|
|
63629
63709
|
/**
|
|
@@ -63633,7 +63713,7 @@ class WorkerBuilder {
|
|
|
63633
63713
|
build() {
|
|
63634
63714
|
const codeLines = [];
|
|
63635
63715
|
|
|
63636
|
-
codeLines.push('var globalScope =
|
|
63716
|
+
codeLines.push('var globalScope = globalThis;');
|
|
63637
63717
|
|
|
63638
63718
|
//handle imports
|
|
63639
63719
|
this.imports.forEach(function (url) {
|
|
@@ -63734,37 +63814,6 @@ class WorkerBuilder {
|
|
|
63734
63814
|
|
|
63735
63815
|
return new WorkerProxy(workerURL, this.methods);
|
|
63736
63816
|
}
|
|
63737
|
-
}
|
|
63738
|
-
/**
|
|
63739
|
-
*
|
|
63740
|
-
* @param {string} code
|
|
63741
|
-
* @return {string}
|
|
63742
|
-
*/
|
|
63743
|
-
function codeToURL(code) {
|
|
63744
|
-
const js_mime = 'application/javascript';
|
|
63745
|
-
|
|
63746
|
-
let blob;
|
|
63747
|
-
|
|
63748
|
-
if (typeof window === 'object') {
|
|
63749
|
-
if (typeof window.Blob !== "undefined") {
|
|
63750
|
-
blob = new Blob([code], {type: js_mime});
|
|
63751
|
-
} else {
|
|
63752
|
-
// Backwards-compatibility
|
|
63753
|
-
const BlobBuilder = window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
|
|
63754
|
-
if (BlobBuilder !== undefined) {
|
|
63755
|
-
blob = new BlobBuilder();
|
|
63756
|
-
blob.append(code);
|
|
63757
|
-
blob = blob.getBlob();
|
|
63758
|
-
}
|
|
63759
|
-
}
|
|
63760
|
-
}
|
|
63761
|
-
|
|
63762
|
-
if (blob !== undefined && URL.createObjectURL !== undefined) {
|
|
63763
|
-
return URL.createObjectURL(blob);
|
|
63764
|
-
} else {
|
|
63765
|
-
// build data URL in a slowest way possible
|
|
63766
|
-
return `data:${js_mime},${encodeURIComponent(code)}`;
|
|
63767
|
-
}
|
|
63768
63817
|
}
|
|
63769
63818
|
|
|
63770
63819
|
/**
|
|
@@ -67679,20 +67728,19 @@ class AssetLoader {
|
|
|
67679
67728
|
function observeResponseProgress(input, progress) {
|
|
67680
67729
|
let response = input;
|
|
67681
67730
|
|
|
67682
|
-
|
|
67683
|
-
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) {
|
|
67684
67733
|
|
|
67685
67734
|
return response;
|
|
67686
67735
|
|
|
67687
67736
|
}
|
|
67688
67737
|
|
|
67689
|
-
|
|
67690
|
-
|
|
67691
|
-
|
|
67692
|
-
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');
|
|
67693
67741
|
|
|
67694
|
-
const contentLength = response.headers.get('Content-Length');
|
|
67695
67742
|
const total = contentLength ? parseInt(contentLength) : 0;
|
|
67743
|
+
|
|
67696
67744
|
let loaded = 0;
|
|
67697
67745
|
|
|
67698
67746
|
// periodically read data into the new stream tracking while download progress
|
|
@@ -67700,6 +67748,11 @@ function observeResponseProgress(input, progress) {
|
|
|
67700
67748
|
type: "bytes",
|
|
67701
67749
|
start(controller) {
|
|
67702
67750
|
|
|
67751
|
+
/**
|
|
67752
|
+
* @type {ReadableStreamDefaultReader<Uint8Array>}
|
|
67753
|
+
*/
|
|
67754
|
+
const reader = response.body.getReader();
|
|
67755
|
+
|
|
67703
67756
|
pump();
|
|
67704
67757
|
|
|
67705
67758
|
function pump() {
|
|
@@ -67717,6 +67770,7 @@ function observeResponseProgress(input, progress) {
|
|
|
67717
67770
|
progress(loaded, total);
|
|
67718
67771
|
|
|
67719
67772
|
controller.enqueue(value);
|
|
67773
|
+
|
|
67720
67774
|
pump();
|
|
67721
67775
|
|
|
67722
67776
|
});
|
|
@@ -67788,16 +67842,13 @@ class ArrayBufferLoader extends AssetLoader {
|
|
|
67788
67842
|
|
|
67789
67843
|
let response = await fetch(request);
|
|
67790
67844
|
|
|
67791
|
-
|
|
67845
|
+
const response_status = response.status;
|
|
67792
67846
|
|
|
67793
|
-
|
|
67847
|
+
if (response_status !== 200 && response_status !== 0) {
|
|
67794
67848
|
|
|
67795
|
-
|
|
67849
|
+
throw Error(`fetch for "${response.url}" responded with ${response_status}: ${response.statusText}`);
|
|
67796
67850
|
|
|
67797
|
-
|
|
67798
|
-
// e.g. 'file://' or 'data://'. Handle as success.
|
|
67799
|
-
|
|
67800
|
-
if (response.status === 0) ;
|
|
67851
|
+
}
|
|
67801
67852
|
|
|
67802
67853
|
try {
|
|
67803
67854
|
response = observeResponseProgress(response, progress);
|
|
@@ -75580,6 +75631,9 @@ const TextureAttachmentsByMaterialType = {
|
|
|
75580
75631
|
taDisplacement,
|
|
75581
75632
|
taAlphaMap
|
|
75582
75633
|
],
|
|
75634
|
+
MeshBasicMaterial: [
|
|
75635
|
+
taDiffuse
|
|
75636
|
+
],
|
|
75583
75637
|
MeshStandardMaterial: [
|
|
75584
75638
|
taDiffuse,
|
|
75585
75639
|
taAlphaMap,
|
|
@@ -75665,7 +75719,9 @@ const TextureAttachmentsByMaterialType = {
|
|
|
75665
75719
|
}
|
|
75666
75720
|
})
|
|
75667
75721
|
]
|
|
75668
|
-
};
|
|
75722
|
+
};
|
|
75723
|
+
|
|
75724
|
+
TextureAttachmentsByMaterialType.MeshPhysicalMaterial = TextureAttachmentsByMaterialType.MeshStandardMaterial;
|
|
75669
75725
|
|
|
75670
75726
|
/**
|
|
75671
75727
|
* Transfer bitmap contents to Sampler2D, effectively moving data to CPU, making it readable
|
|
@@ -90632,6 +90688,7 @@ class GraphicsEngine {
|
|
|
90632
90688
|
const camera = this.camera;
|
|
90633
90689
|
|
|
90634
90690
|
if (scene.children.indexOf(camera) < 0) {
|
|
90691
|
+
// console.log("added camera");
|
|
90635
90692
|
scene.add(camera);
|
|
90636
90693
|
}
|
|
90637
90694
|
|
|
@@ -105053,6 +105110,9 @@ class TopDownCameraController {
|
|
|
105053
105110
|
|
|
105054
105111
|
this.distance = eye.distanceTo(target);
|
|
105055
105112
|
|
|
105113
|
+
// ensure we can maintain this distance
|
|
105114
|
+
this.distanceMax = max2(this.distance, this.distanceMax);
|
|
105115
|
+
|
|
105056
105116
|
this.target.copy(target);
|
|
105057
105117
|
}
|
|
105058
105118
|
|
|
@@ -112371,6 +112431,27 @@ function scene_object_filter(object3D) {
|
|
|
112371
112431
|
return true;
|
|
112372
112432
|
}
|
|
112373
112433
|
|
|
112434
|
+
/**
|
|
112435
|
+
*
|
|
112436
|
+
* @param {LightShadow} shadow
|
|
112437
|
+
* @param {number} resolution
|
|
112438
|
+
*/
|
|
112439
|
+
function three_set_shadow_resolution(shadow, resolution) {
|
|
112440
|
+
const mapSize = shadow.mapSize;
|
|
112441
|
+
|
|
112442
|
+
if (mapSize.width !== resolution || mapSize.height !== resolution) {
|
|
112443
|
+
|
|
112444
|
+
mapSize.width = mapSize.height = resolution;
|
|
112445
|
+
|
|
112446
|
+
//destroy old map
|
|
112447
|
+
if (shadow.map !== null) {
|
|
112448
|
+
shadow.map.dispose(); // important
|
|
112449
|
+
shadow.map = null;
|
|
112450
|
+
}
|
|
112451
|
+
|
|
112452
|
+
}
|
|
112453
|
+
}
|
|
112454
|
+
|
|
112374
112455
|
class ThreeLightBinding extends LightBinding {
|
|
112375
112456
|
|
|
112376
112457
|
constructor() {
|
|
@@ -112635,17 +112716,7 @@ class ThreeLightBinding extends LightBinding {
|
|
|
112635
112716
|
shadow.radius = 1;
|
|
112636
112717
|
shadow.blurSamples = 8;
|
|
112637
112718
|
|
|
112638
|
-
|
|
112639
|
-
|
|
112640
|
-
shadow.mapSize.width = shadow.mapSize.height = resolution;
|
|
112641
|
-
|
|
112642
|
-
//destroy old map
|
|
112643
|
-
if (shadow.map !== null) {
|
|
112644
|
-
shadow.map.dispose(); // important
|
|
112645
|
-
shadow.map = null;
|
|
112646
|
-
}
|
|
112647
|
-
|
|
112648
|
-
}
|
|
112719
|
+
three_set_shadow_resolution(shadow, resolution);
|
|
112649
112720
|
|
|
112650
112721
|
}
|
|
112651
112722
|
}
|
|
@@ -113273,7 +113344,7 @@ class LightSystem extends AbstractContextSystem {
|
|
|
113273
113344
|
|
|
113274
113345
|
l.castShadow = true;
|
|
113275
113346
|
|
|
113276
|
-
|
|
113347
|
+
three_update_shadow_camera_extents(this.__camera_object, l, this.__graphics);
|
|
113277
113348
|
|
|
113278
113349
|
} else {
|
|
113279
113350
|
|
|
@@ -113324,9 +113395,8 @@ const scratch_aabb3 = new AABB3();
|
|
|
113324
113395
|
* @author Alex Goldring 02.06.2016 (Komrade)
|
|
113325
113396
|
* @param {Camera} camera
|
|
113326
113397
|
* @param {Light} light
|
|
113327
|
-
* @param {GraphicsEngine} graphics
|
|
113328
113398
|
*/
|
|
113329
|
-
function
|
|
113399
|
+
function three_update_shadow_camera_extents(camera, light) {
|
|
113330
113400
|
|
|
113331
113401
|
|
|
113332
113402
|
// Fit shadow camera's ortho frustum to camera frustum
|
|
@@ -114548,6 +114618,8 @@ class InputControllerSystem extends System {
|
|
|
114548
114618
|
|
|
114549
114619
|
this.devices = devices;
|
|
114550
114620
|
|
|
114621
|
+
// console.log("Input Controller System started. Devices: ", devices);
|
|
114622
|
+
|
|
114551
114623
|
const self = this;
|
|
114552
114624
|
|
|
114553
114625
|
this.enabled.onChanged.add(function (v) {
|
|
@@ -115577,6 +115649,12 @@ function setLocale(engine) {
|
|
|
115577
115649
|
return engine.localization.loadLocale(locale);
|
|
115578
115650
|
}
|
|
115579
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
|
+
|
|
115580
115658
|
class EngineHarness {
|
|
115581
115659
|
constructor() {
|
|
115582
115660
|
/**
|
|
@@ -115844,12 +115922,21 @@ class EngineHarness {
|
|
|
115844
115922
|
* @param {EntityComponentDataset} [param.ecd]
|
|
115845
115923
|
* @param {number} [param.shadowmapResolution]
|
|
115846
115924
|
* @param {boolean} [param.castShadow]
|
|
115925
|
+
* @param {Color} [param.sun]
|
|
115926
|
+
* @param {number} [param.sunIntensity]
|
|
115927
|
+
* @param {Color} [param.ambient]
|
|
115928
|
+
* @param {number} [param.ambientIntensity]
|
|
115847
115929
|
*/
|
|
115848
115930
|
static async buildLights({
|
|
115849
115931
|
engine,
|
|
115850
115932
|
ecd = engine.entityManager.dataset,
|
|
115851
115933
|
shadowmapResolution = 1024,
|
|
115852
|
-
castShadow = true
|
|
115934
|
+
castShadow = true,
|
|
115935
|
+
sun = DEFAULT_SUNLIGHT_COLOR,
|
|
115936
|
+
sunIntensity = 0.9,
|
|
115937
|
+
sunDirection = new Vector3$1(0.1, -1, 0.1),
|
|
115938
|
+
ambient = Color.white,
|
|
115939
|
+
ambientIntensity = 0.1
|
|
115853
115940
|
}) {
|
|
115854
115941
|
const em = engine.entityManager;
|
|
115855
115942
|
|
|
@@ -115865,18 +115952,13 @@ class EngineHarness {
|
|
|
115865
115952
|
|
|
115866
115953
|
const key = new Light();
|
|
115867
115954
|
key.type.set(Light.Type.DIRECTION);
|
|
115868
|
-
key.color.
|
|
115869
|
-
key.intensity.set(
|
|
115955
|
+
key.color.copy(sun);
|
|
115956
|
+
key.intensity.set(sunIntensity);
|
|
115870
115957
|
key.castShadow.set(castShadow);
|
|
115871
115958
|
|
|
115872
115959
|
const transform = new Transform();
|
|
115873
115960
|
transform.position.set(30, 70, 30);
|
|
115874
|
-
transform.rotation.
|
|
115875
|
-
-0.18780341950959473,
|
|
115876
|
-
0.8049745556929917,
|
|
115877
|
-
-0.4533975611897181,
|
|
115878
|
-
-0.3334313787830773
|
|
115879
|
-
);
|
|
115961
|
+
transform.rotation.lookRotation(sunDirection);
|
|
115880
115962
|
|
|
115881
115963
|
new Entity()
|
|
115882
115964
|
.add(key)
|
|
@@ -115887,8 +115969,8 @@ class EngineHarness {
|
|
|
115887
115969
|
|
|
115888
115970
|
const fill = new Light();
|
|
115889
115971
|
fill.type.set(Light.Type.AMBIENT);
|
|
115890
|
-
fill.color.
|
|
115891
|
-
fill.intensity.set(
|
|
115972
|
+
fill.color.copy(ambient);
|
|
115973
|
+
fill.intensity.set(ambientIntensity);
|
|
115892
115974
|
|
|
115893
115975
|
|
|
115894
115976
|
new Entity()
|
|
@@ -117692,6 +117774,7 @@ exports.findSignalHandlerIndexByHandle = findSignalHandlerIndexByHandle;
|
|
|
117692
117774
|
exports.findSignalHandlerIndexByHandleAndContext = findSignalHandlerIndexByHandleAndContext;
|
|
117693
117775
|
exports.find_path_on_grid_astar = find_path_on_grid_astar;
|
|
117694
117776
|
exports.quat3_createFromAxisAngle = quat3_createFromAxisAngle;
|
|
117777
|
+
exports.three_update_shadow_camera_extents = three_update_shadow_camera_extents;
|
|
117695
117778
|
exports.v2_angle_between = v2_angle_between;
|
|
117696
117779
|
exports.v2_bearing_angle_towards = v2_bearing_angle_towards;
|
|
117697
117780
|
exports.v2_distance = v2_distance;
|