@woosh/meep-engine 2.107.0 → 2.108.0
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 +78 -46
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +78 -47
- package/package.json +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/collection/array/isArrayEqualStrict.d.ts.map +1 -1
- package/src/core/collection/array/isArrayEqualStrict.js +2 -2
- package/src/core/color/Color.d.ts.map +1 -1
- package/src/core/color/Color.js +7 -2
- 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/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/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 +15 -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 +1 -0
- 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/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/engine/EngineHarness.d.ts +10 -1
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +16 -11
- 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.js +2 -0
- package/src/engine/graphics/GraphicsEngine.js +1 -1
- 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/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/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 +123 -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 +26 -58
- 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/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 +56 -0
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +87 -195
- 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/input/ecs/systems/InputControllerSystem.js +1 -1
- package/src/view/elements/ColorPickerView.d.ts.map +1 -1
- package/src/view/elements/ColorPickerView.js +7 -7
- 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
|
@@ -1,122 +1,7 @@
|
|
|
1
1
|
//
|
|
2
|
-
import { seededRandom } from "../math/random/seededRandom.js";
|
|
3
|
-
import { SquareMatrix } from "./SquareMatrix.js";
|
|
4
|
-
import { BinaryDataType } from "../binary/type/BinaryDataType.js";
|
|
5
|
-
import { BitSet } from "../binary/BitSet.js";
|
|
6
|
-
import FastBinaryHeap from "../collection/heap/FastBinaryHeap.js";
|
|
7
2
|
import { randomIntegerBetween } from "../math/random/randomIntegerBetween.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @template N
|
|
11
|
-
* @param {N} n0
|
|
12
|
-
* @param {N} n1
|
|
13
|
-
* @param {Graph<N>} graph
|
|
14
|
-
* @returns {number}
|
|
15
|
-
*/
|
|
16
|
-
function node_distance(n0, n1, graph) {
|
|
17
|
-
const path = graph.findPath(n0, n1);
|
|
18
|
-
|
|
19
|
-
if (path === null) {
|
|
20
|
-
return Number.POSITIVE_INFINITY;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return path.length;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Produce a distance matrix from an input graph, tracing distances from each node to every node specified in target vector
|
|
28
|
-
* @see "A Fast Algorithm to Find All-Pairs Shortest Paths in Complex Networks" by Wei Peng et Al. 2012
|
|
29
|
-
* @template T
|
|
30
|
-
* @param {Graph<T>} graph
|
|
31
|
-
* @param {T[]} node_array graph nodes as an array
|
|
32
|
-
* @param {number[]} targets node indices, distances to which need to be calculated
|
|
33
|
-
* @param {Map<T, number>} node_index_map
|
|
34
|
-
* @returns {SquareMatrix}
|
|
35
|
-
*/
|
|
36
|
-
function build_distance_matrix(graph, node_array, targets, node_index_map) {
|
|
37
|
-
const node_count = node_array.length;
|
|
38
|
-
|
|
39
|
-
const m_distances = new SquareMatrix(node_count, BinaryDataType.Float32);
|
|
40
|
-
|
|
41
|
-
const flags = BitSet.fixedSize(node_count);
|
|
42
|
-
|
|
43
|
-
// initialize distances
|
|
44
|
-
m_distances.fill(Number.POSITIVE_INFINITY);
|
|
45
|
-
|
|
46
|
-
let source_node;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param {number} other_node
|
|
51
|
-
* @returns {number}
|
|
52
|
-
*/
|
|
53
|
-
function score(other_node) {
|
|
54
|
-
return m_distances.getCellValue(source_node, other_node);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
for (let i = 0; i < targets.length; i++) {
|
|
58
|
-
source_node = targets[i];
|
|
59
|
-
|
|
60
|
-
// distance to self is always 0
|
|
61
|
-
m_distances.setCellValue(source_node, source_node, 0);
|
|
62
|
-
|
|
63
|
-
const heap = new FastBinaryHeap(score);
|
|
64
|
-
heap.push(source_node);
|
|
65
|
-
|
|
66
|
-
while (!heap.isEmpty()) {
|
|
67
|
-
const t = heap.pop();
|
|
68
|
-
|
|
69
|
-
const distance_to_this_node = m_distances.getCellValue(source_node, t);
|
|
70
|
-
if (flags.get(t)) {
|
|
71
|
-
// already visited
|
|
72
|
-
for (let v = 0; v < node_count; v++) {
|
|
73
|
-
const shortcut_distance = distance_to_this_node + m_distances.getCellValue(t, v);
|
|
74
|
-
|
|
75
|
-
if (shortcut_distance < m_distances.getCellValue(source_node, v)) {
|
|
76
|
-
m_distances.setCellValue(source_node, v, shortcut_distance)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
// not visited yet
|
|
82
|
-
const t_node = node_array[t];
|
|
83
|
-
|
|
84
|
-
const t_node_container = graph.getNodeContainer(t_node);
|
|
85
|
-
|
|
86
|
-
const node_edges = t_node_container.getEdges();
|
|
87
|
-
const node_edge_count = node_edges.length;
|
|
88
|
-
|
|
89
|
-
for (let i1 = 0; i1 < node_edge_count; i1++) {
|
|
90
|
-
|
|
91
|
-
const node_edge = node_edges[i1];
|
|
92
|
-
|
|
93
|
-
const neighbour_node = node_edge.other(t_node);
|
|
94
|
-
|
|
95
|
-
const neighbour_node_index = node_index_map.get(neighbour_node);
|
|
96
|
-
|
|
97
|
-
if (neighbour_node_index === -1) {
|
|
98
|
-
// not in the input set
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const transition_cost = node_edge.weight + 1e-5;
|
|
103
|
-
|
|
104
|
-
const distance_to_neighbour = distance_to_this_node + transition_cost;
|
|
105
|
-
|
|
106
|
-
if (distance_to_neighbour < m_distances.getCellValue(source_node, neighbour_node_index)) {
|
|
107
|
-
m_distances.setCellValue(source_node, neighbour_node_index, distance_to_neighbour);
|
|
108
|
-
|
|
109
|
-
heap.push(neighbour_node_index);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
flags.set(source_node, true);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return m_distances;
|
|
119
|
-
}
|
|
3
|
+
import { seededRandom } from "../math/random/seededRandom.js";
|
|
4
|
+
import { graph_compute_distance_matrix } from "./graph_compute_distance_matrix.js";
|
|
120
5
|
|
|
121
6
|
|
|
122
7
|
/**
|
|
@@ -172,7 +57,7 @@ export function graph_k_means_cluster_detailed(
|
|
|
172
57
|
clusters[i] = [node_index];
|
|
173
58
|
}
|
|
174
59
|
|
|
175
|
-
const m_distances =
|
|
60
|
+
const m_distances = graph_compute_distance_matrix(graph, node_array, clusters_seeds, node_index_map);
|
|
176
61
|
|
|
177
62
|
for (let node_index = 0; node_index < total_node_count; node_index++) {
|
|
178
63
|
|
|
@@ -218,7 +103,7 @@ export function graph_k_means_cluster(graph, k, random_seed) {
|
|
|
218
103
|
|
|
219
104
|
/**
|
|
220
105
|
*
|
|
221
|
-
* @type {
|
|
106
|
+
* @type {Uint8Array}
|
|
222
107
|
*/
|
|
223
108
|
const node_cluster_assignments = new Uint8Array(node_count);
|
|
224
109
|
// fill with "UNASSIGNED" value
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* @param {Graph<MultiNode<T>>} graph
|
|
6
6
|
* @param {number} max_node_limit Maximum number of "source" nodes per joined node
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
9
|
-
//# sourceMappingURL=
|
|
8
|
+
export function mn_graph_coarsen<T>(graph: Graph<MultiNode<T>>, max_node_limit: number): void;
|
|
9
|
+
//# sourceMappingURL=mn_graph_coarsen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mn_graph_coarsen.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/mn_graph_coarsen.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,gFAFW,MAAM,QAuBhB"}
|
|
@@ -9,7 +9,7 @@ import { WeightedEdge } from "./WeightedEdge.js";
|
|
|
9
9
|
* @param {Graph<MultiNode<T>>} graph
|
|
10
10
|
* @param {number} max_node_limit Maximum number of "source" nodes per joined node
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
12
|
+
export function mn_graph_coarsen(graph, max_node_limit) {
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mn_graph_coarsen.spec.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/mn_graph_coarsen.spec.js"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mn_graph_coarsen } from "./mn_graph_coarsen.js";
|
|
2
2
|
import { MultiNode } from "./MultiNode.js";
|
|
3
|
+
import { Graph } from "./v2/Graph.js";
|
|
3
4
|
import { WeightedEdge } from "./WeightedEdge.js";
|
|
4
|
-
import { coarsen_graph } from "./coarsen_graph.js";
|
|
5
5
|
|
|
6
6
|
test('coarsen 2 node graph with 1 edge', () => {
|
|
7
7
|
const graph = new Graph();
|
|
@@ -13,7 +13,7 @@ test('coarsen 2 node graph with 1 edge', () => {
|
|
|
13
13
|
|
|
14
14
|
graph.addEdge(new WeightedEdge(n0, n1));
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
mn_graph_coarsen(graph, 2);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
test('coarsen chain, all nodes must still be linked', () => {
|
|
@@ -37,7 +37,7 @@ test('coarsen chain, all nodes must still be linked', () => {
|
|
|
37
37
|
g.addEdge(new WeightedEdge(n0, n1));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
mn_graph_coarsen(g, 100);
|
|
41
41
|
|
|
42
42
|
expect(g.getNodeCount()).toBe(1);
|
|
43
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mn_graph_collapse_weighted_edge.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/mn_graph_collapse_weighted_edge.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mn_graph_collapse_weighted_edge.d.ts","sourceRoot":"","sources":["../../../../src/core/graph/mn_graph_collapse_weighted_edge.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,+HAJW,MAAM,2BAEJ,OAAO,CAyEnB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Multi-node graph function
|
|
2
3
|
* @template N
|
|
3
4
|
* @param {Graph<MultiNode<N>>} graph
|
|
4
5
|
* @param {WeightedEdge<MultiNode<N>>} edge
|
|
@@ -6,7 +7,12 @@
|
|
|
6
7
|
* @param {BinaryHeap<Edge>} heap
|
|
7
8
|
* @returns {boolean} whether collapse was performed or rejected
|
|
8
9
|
*/
|
|
9
|
-
export function mn_graph_collapse_weighted_edge(
|
|
10
|
+
export function mn_graph_collapse_weighted_edge(
|
|
11
|
+
graph,
|
|
12
|
+
edge,
|
|
13
|
+
source_limit,
|
|
14
|
+
heap
|
|
15
|
+
) {
|
|
10
16
|
|
|
11
17
|
const successor_node = edge.first;
|
|
12
18
|
const victim_node = edge.second;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brdf_burley.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/brdf_burley.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"brdf_burley.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/brdf_burley.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;GAaG;AACH,iCANW,MAAM,OACN,MAAM,OACN,MAAM,aACN,MAAM,GACJ,MAAM,CASlB"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { PI_RECIPROCAL } from "../../PI_RECIPROCAL.js";
|
|
2
|
+
import { fresnel_Schlick } from "./fresnel_Schlick.js";
|
|
2
3
|
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {number} u
|
|
7
|
+
* @param {number} f0
|
|
8
|
+
* @param {number} f90
|
|
9
|
+
* @return {number}
|
|
10
|
+
*/
|
|
3
11
|
function F_Schlick(u, f0, f90) {
|
|
4
12
|
|
|
5
|
-
return f0 + (f90 - f0) *
|
|
13
|
+
return f0 + (f90 - f0) * fresnel_Schlick(u);
|
|
6
14
|
}
|
|
7
15
|
|
|
8
16
|
/**
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* @param {number} roughness
|
|
6
6
|
* @returns {number}
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
9
|
-
//# sourceMappingURL=
|
|
8
|
+
export function diffuse_GGX(NoH: number, roughness: number): number;
|
|
9
|
+
//# sourceMappingURL=diffuse_GGX.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diffuse_GGX.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/diffuse_GGX.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,iCAJW,MAAM,aACN,MAAM,GACJ,MAAM,CAQlB"}
|
|
@@ -7,7 +7,7 @@ import { PI_RECIPROCAL } from "../../PI_RECIPROCAL.js";
|
|
|
7
7
|
* @param {number} roughness
|
|
8
8
|
* @returns {number}
|
|
9
9
|
*/
|
|
10
|
-
export function
|
|
10
|
+
export function diffuse_GGX(NoH, roughness) {
|
|
11
11
|
const a = NoH * roughness;
|
|
12
12
|
|
|
13
13
|
const k = roughness / (1 - NoH * NoH + a * a);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fresnel_Schlick.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/fresnel_Schlick.js"],"names":[],"mappings":"AAEA,+DAAyD;0CAFf,gCAAgC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Optimized variant (presented by Epic at SIGGRAPH '13)
|
|
4
|
+
* https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf
|
|
5
|
+
* @param {number} dotVH
|
|
6
|
+
* @return {number}
|
|
7
|
+
*/
|
|
8
|
+
export function fresnel_Schlick_optimized(dotVH: number): number;
|
|
9
|
+
//# sourceMappingURL=fresnel_Schlick_optimized.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fresnel_Schlick_optimized.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/fresnel_Schlick_optimized.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,iDAHW,MAAM,GACL,MAAM,CAIjB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { exp2 } from "../../exp2.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Optimized variant (presented by Epic at SIGGRAPH '13)
|
|
6
|
+
* https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf
|
|
7
|
+
* @param {number} dotVH
|
|
8
|
+
* @return {number}
|
|
9
|
+
*/
|
|
10
|
+
export function fresnel_Schlick_optimized(dotVH) {
|
|
11
|
+
return exp2((-5.55473 * dotVH - 6.98316) * dotVH);
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Original approximation by Christophe Schlick '94
|
|
4
|
+
* NOTE: prefer to use {@link fresnel_Schlick_optimized} instead, this primarily exists for reference purposes
|
|
5
|
+
* @param dotVH
|
|
6
|
+
* @return {number}
|
|
7
|
+
*/
|
|
8
|
+
declare function fresnel_Schlick_original(dotVH: any): number;
|
|
9
|
+
//# sourceMappingURL=fresnel_Schlick_original.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fresnel_Schlick_original.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/brdf/fresnel_Schlick_original.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,uDAFY,MAAM,CAIjB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Original approximation by Christophe Schlick '94
|
|
4
|
+
* NOTE: prefer to use {@link fresnel_Schlick_optimized} instead, this primarily exists for reference purposes
|
|
5
|
+
* @param dotVH
|
|
6
|
+
* @return {number}
|
|
7
|
+
*/
|
|
8
|
+
function fresnel_Schlick_original(dotVH) {
|
|
9
|
+
return Math.pow(1.0 - dotVH, 5.0)
|
|
10
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bsdf_schlick.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/bsdf/bsdf_schlick.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bsdf_schlick.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/bsdf/bsdf_schlick.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,iCALW,MAAM,OACN,MAAM,SACN,MAAM,GACJ,MAAM,CAMlB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { fresnel_Schlick } from "../brdf/fresnel_Schlick.js";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
*
|
|
@@ -9,14 +8,7 @@ import { exp2 } from "../../exp2.js";
|
|
|
9
8
|
* @returns {number}
|
|
10
9
|
*/
|
|
11
10
|
export function bsdf_schlick(f0, f90, dotVH) {
|
|
11
|
+
const fresnel = fresnel_Schlick(dotVH);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
// float fresnel = pow( 1.0 - dotVH, 5.0 );
|
|
15
|
-
|
|
16
|
-
// Optimized variant (presented by Epic at SIGGRAPH '13)
|
|
17
|
-
// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf
|
|
18
|
-
|
|
19
|
-
const fresnel = exp2(((-5.55473) * dotVH - 6.98316) * dotVH);
|
|
20
|
-
|
|
21
|
-
return ((f0 * (1.0 - fresnel)) + (f90 * fresnel));
|
|
13
|
+
return f0 * (1.0 - fresnel) + f90 * fresnel;
|
|
22
14
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ior_to_reflectivity.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/physics/ior_to_reflectivity.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,yCAHW,MAAM,GACL,MAAM,CAIjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Probability Distribution Functions
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the PDF for a particular GGX sample after reflecting the view vector
|
|
3
|
+
* about a microfacet normal (includes the Jacobian for going from half vector to lighting vector)
|
|
4
|
+
*
|
|
5
|
+
* N = surface normal
|
|
6
|
+
* L = light direction
|
|
7
|
+
* V = view direction
|
|
8
|
+
* H = normalize( V + L )
|
|
9
|
+
*
|
|
10
|
+
* @param {number} nDotH dot product of N and H
|
|
11
|
+
* @param {number} hDotV dot product of H and V
|
|
12
|
+
* @param {number} roughness
|
|
13
|
+
* @returns {number}
|
|
14
|
+
*/
|
|
15
|
+
export function pdf_GGX(nDotH: number, hDotV: number, roughness: number): number;
|
|
16
|
+
//# sourceMappingURL=pdf_GGX.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf_GGX.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/pdf/pdf_GGX.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,+BALW,MAAM,SACN,MAAM,aACN,MAAM,GACJ,MAAM,CAYlB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the PDF for a particular GGX sample after reflecting the view vector
|
|
3
|
+
* about a microfacet normal (includes the Jacobian for going from half vector to lighting vector)
|
|
4
|
+
*
|
|
5
|
+
* N = surface normal
|
|
6
|
+
* L = light direction
|
|
7
|
+
* V = view direction
|
|
8
|
+
* H = normalize( V + L )
|
|
9
|
+
*
|
|
10
|
+
* @param {number} nDotH dot product of N and H
|
|
11
|
+
* @param {number} hDotV dot product of H and V
|
|
12
|
+
* @param {number} roughness
|
|
13
|
+
* @returns {number}
|
|
14
|
+
*/
|
|
15
|
+
export function pdf_GGX(nDotH, hDotV, roughness) {
|
|
16
|
+
const m2 = roughness * roughness;
|
|
17
|
+
|
|
18
|
+
const X = nDotH * nDotH * (m2 - 1) + 1;
|
|
19
|
+
|
|
20
|
+
const d = m2 / (Math.PI * X * X);
|
|
21
|
+
|
|
22
|
+
const pM = d * nDotH;
|
|
23
|
+
|
|
24
|
+
return pM / (4 * hDotV);
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflectivity_to_ior.d.ts","sourceRoot":"","sources":["../../../../../src/core/math/physics/reflectivity_to_ior.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAHW,MAAM,GACL,MAAM,CAIjB"}
|
|
@@ -58,12 +58,20 @@ export class EngineHarness {
|
|
|
58
58
|
* @param {EntityComponentDataset} [param.ecd]
|
|
59
59
|
* @param {number} [param.shadowmapResolution]
|
|
60
60
|
* @param {boolean} [param.castShadow]
|
|
61
|
+
* @param {Color} [param.sun]
|
|
62
|
+
* @param {number} [param.sunIntensity]
|
|
63
|
+
* @param {Color} [param.ambient]
|
|
64
|
+
* @param {number} [param.ambientIntensity]
|
|
61
65
|
*/
|
|
62
|
-
static buildLights({ engine, ecd, shadowmapResolution, castShadow }: {
|
|
66
|
+
static buildLights({ engine, ecd, shadowmapResolution, castShadow, sun, sunIntensity, sunDirection, ambient, ambientIntensity }: {
|
|
63
67
|
engine: Engine;
|
|
64
68
|
ecd?: EntityComponentDataset;
|
|
65
69
|
shadowmapResolution?: number;
|
|
66
70
|
castShadow?: boolean;
|
|
71
|
+
sun?: Color;
|
|
72
|
+
sunIntensity?: number;
|
|
73
|
+
ambient?: Color;
|
|
74
|
+
ambientIntensity?: number;
|
|
67
75
|
}): Promise<void>;
|
|
68
76
|
/**
|
|
69
77
|
* @param {Object} param
|
|
@@ -120,5 +128,6 @@ import Engine from "./Engine.js";
|
|
|
120
128
|
import { EngineConfiguration } from "./EngineConfiguration.js";
|
|
121
129
|
import Vector3 from "../core/geom/Vector3.js";
|
|
122
130
|
import Entity from "./ecs/Entity.js";
|
|
131
|
+
import { Color } from "../core/color/Color.js";
|
|
123
132
|
import Terrain from "./ecs/terrain/ecs/Terrain.js";
|
|
124
133
|
//# sourceMappingURL=EngineHarness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineHarness.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineHarness.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EngineHarness.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineHarness.js"],"names":[],"mappings":"AAuDA;IAmBI;;;OAGG;IACH,6BAFW,MAAM,QAYhB;IAkED;;;;;;;;;;;;;OAaG;IACH;QAZyB,MAAM,EAApB,MAAM;QACyB,GAAG;QAClB,MAAM,GAAtB,OAAO;QACQ,QAAQ,GAAvB,MAAM;QACS,KAAK,GAApB,MAAM;QACS,GAAG,GAAlB,MAAM;QACU,QAAQ,GAAxB,OAAO;QACQ,WAAW,GAA1B,MAAM;QACS,WAAW,GAA1B,MAAM;QACS,WAAW,GAA1B,MAAM;QACJ,MAAM,CA+DlB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,oQAnBW,MAAM,iBAmFhB;IAGD;;;;;;;;;;OAUG;IACH;QATyB,MAAM,EAApB,MAAM;QACyB,GAAG;QACnB,mBAAmB,GAAlC,MAAM;QACU,UAAU,GAA1B,OAAO;QACO,GAAG,GAAjB,KAAK;QACU,YAAY,GAA3B,MAAM;QACQ,OAAO,GAArB,KAAK;QACU,gBAAgB,GAA/B,MAAM;sBAqDhB;IAED;;;;;;;OAOG;IACH;QAN0B,YAAY,GAA3B,MAAM;QACQ,MAAM,EAApB,MAAM;QACS,WAAW,GAA1B,MAAM;QACyB,GAAG;QAChC,MAAM,CA2ClB;IAGD;;;;;;;;;;;OAWG;IACH,mGAVW,MAAM,GAQJ,OAAO,CAuDnB;IA3bG;;;OAGG;IACH,QAFU,MAAM,CAEiC;IAMjD;;;OAGG;IACH,YAFU,eAAQ,IAAI,CAET;IAmBjB;;;;OAIG;IACH,8DAJmB,mBAAmB,UAAQ,MAAM,WAEvC,QAAQ,MAAM,CAAC,CA2D3B;CA6VJ;;IAID;;;OAGG;IACH,uCAMC;;mBApfkB,aAAa;oCACI,0BAA0B;oBAX1C,yBAAyB;mBAK1B,iBAAiB;sBATd,wBAAwB;oBAW1B,8BAA8B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Stats from "three/examples/jsm/libs/stats.module.js";
|
|
2
|
+
import { Color } from "../core/color/Color.js";
|
|
2
3
|
|
|
3
4
|
import { noop } from "../core/function/noop.js";
|
|
4
5
|
import Vector2 from "../core/geom/Vector2.js";
|
|
@@ -322,12 +323,21 @@ export class EngineHarness {
|
|
|
322
323
|
* @param {EntityComponentDataset} [param.ecd]
|
|
323
324
|
* @param {number} [param.shadowmapResolution]
|
|
324
325
|
* @param {boolean} [param.castShadow]
|
|
326
|
+
* @param {Color} [param.sun]
|
|
327
|
+
* @param {number} [param.sunIntensity]
|
|
328
|
+
* @param {Color} [param.ambient]
|
|
329
|
+
* @param {number} [param.ambientIntensity]
|
|
325
330
|
*/
|
|
326
331
|
static async buildLights({
|
|
327
332
|
engine,
|
|
328
333
|
ecd = engine.entityManager.dataset,
|
|
329
334
|
shadowmapResolution = 1024,
|
|
330
|
-
castShadow = true
|
|
335
|
+
castShadow = true,
|
|
336
|
+
sun = Color.white,
|
|
337
|
+
sunIntensity = 0.9,
|
|
338
|
+
sunDirection = new Vector3(0.1, -1, 0.1),
|
|
339
|
+
ambient = Color.white,
|
|
340
|
+
ambientIntensity = 0.1
|
|
331
341
|
}) {
|
|
332
342
|
const em = engine.entityManager;
|
|
333
343
|
|
|
@@ -343,18 +353,13 @@ export class EngineHarness {
|
|
|
343
353
|
|
|
344
354
|
const key = new Light();
|
|
345
355
|
key.type.set(Light.Type.DIRECTION);
|
|
346
|
-
key.color.
|
|
347
|
-
key.intensity.set(
|
|
356
|
+
key.color.copy(sun);
|
|
357
|
+
key.intensity.set(sunIntensity);
|
|
348
358
|
key.castShadow.set(castShadow);
|
|
349
359
|
|
|
350
360
|
const transform = new Transform();
|
|
351
361
|
transform.position.set(30, 70, 30);
|
|
352
|
-
transform.rotation.
|
|
353
|
-
-0.18780341950959473,
|
|
354
|
-
0.8049745556929917,
|
|
355
|
-
-0.4533975611897181,
|
|
356
|
-
-0.3334313787830773
|
|
357
|
-
);
|
|
362
|
+
transform.rotation.lookRotation(sunDirection);
|
|
358
363
|
|
|
359
364
|
new Entity()
|
|
360
365
|
.add(key)
|
|
@@ -365,8 +370,8 @@ export class EngineHarness {
|
|
|
365
370
|
|
|
366
371
|
const fill = new Light();
|
|
367
372
|
fill.type.set(Light.Type.AMBIENT);
|
|
368
|
-
fill.color.
|
|
369
|
-
fill.intensity.set(
|
|
373
|
+
fill.color.copy(ambient);
|
|
374
|
+
fill.intensity.set(ambientIntensity);
|
|
370
375
|
|
|
371
376
|
|
|
372
377
|
new Entity()
|
|
@@ -11,16 +11,37 @@ export class PNGReader {
|
|
|
11
11
|
* @constructor
|
|
12
12
|
*/
|
|
13
13
|
constructor(bytes: ArrayBuffer);
|
|
14
|
+
/**
|
|
15
|
+
* current pointer
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
14
18
|
i: number;
|
|
19
|
+
/**
|
|
20
|
+
* bytes buffer
|
|
21
|
+
* @type {Uint8Array}
|
|
22
|
+
*/
|
|
15
23
|
bytes: Uint8Array;
|
|
24
|
+
/**
|
|
25
|
+
* Output object
|
|
26
|
+
* @type {PNG}
|
|
27
|
+
*/
|
|
16
28
|
png: PNG;
|
|
17
29
|
dataChunks: any[];
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {BinaryBuffer}
|
|
33
|
+
*/
|
|
18
34
|
buffer: BinaryBuffer;
|
|
19
35
|
/**
|
|
20
36
|
* Whether CRC should be performed or not
|
|
21
37
|
* @type {boolean}
|
|
22
38
|
*/
|
|
23
39
|
crc_enabled: boolean;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @type {Uint8Array}
|
|
43
|
+
*/
|
|
44
|
+
header: Uint8Array;
|
|
24
45
|
/**
|
|
25
46
|
*
|
|
26
47
|
* @param {number} length
|
|
@@ -31,7 +52,6 @@ export class PNGReader {
|
|
|
31
52
|
* http://www.w3.org/TR/2003/REC-PNG-20031110/#5PNG-file-signature
|
|
32
53
|
*/
|
|
33
54
|
decodeHeader(): void;
|
|
34
|
-
header: Uint8Array;
|
|
35
55
|
/**
|
|
36
56
|
* http://www.w3.org/TR/2003/REC-PNG-20031110/#5Chunk-layout
|
|
37
57
|
*
|
|
@@ -119,7 +139,10 @@ export class PNGReader {
|
|
|
119
139
|
* Uncompress IDAT chunks
|
|
120
140
|
*/
|
|
121
141
|
decodePixels(): void;
|
|
122
|
-
|
|
142
|
+
/**
|
|
143
|
+
* @param {Uint8Array} data
|
|
144
|
+
*/
|
|
145
|
+
interlaceNone(data: Uint8Array): void;
|
|
123
146
|
/**
|
|
124
147
|
* De-interlace image according to Adam 7 scheme
|
|
125
148
|
* @param {Uint8Array} data
|
|
@@ -168,15 +191,6 @@ export class PNGReader {
|
|
|
168
191
|
unFilterPaeth(scanline: any, scanline_offset: any, pixels: any, bpp: any, of: any, length: any): void;
|
|
169
192
|
/**
|
|
170
193
|
* Parse the PNG file
|
|
171
|
-
*
|
|
172
|
-
* reader.parse(options, callback)
|
|
173
|
-
* OR
|
|
174
|
-
* reader.parse(callback)
|
|
175
|
-
*
|
|
176
|
-
* OPTIONS:
|
|
177
|
-
* option | type | default
|
|
178
|
-
* ----------------------------
|
|
179
|
-
* data boolean true should it read the pixel data
|
|
180
194
|
* @returns {PNG}
|
|
181
195
|
*/
|
|
182
196
|
parse(): PNG;
|