@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
|
@@ -38,6 +38,7 @@ import { DirectionalLight } from "../../render/forward_plus/model/DirectionalLig
|
|
|
38
38
|
import { sampler2d_scale } from "../../texture/sampler/resize/sampler2d_scale.js";
|
|
39
39
|
import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
|
|
40
40
|
import sampler2D2Canvas from "../../texture/sampler/Sampler2D2Canvas.js";
|
|
41
|
+
import { PathTracedScene } from "./PathTracedScene.js";
|
|
41
42
|
import { PathTracer } from "./PathTracer.js";
|
|
42
43
|
|
|
43
44
|
document.body.style.margin = 0;
|
|
@@ -71,45 +72,11 @@ vCanvas.css({
|
|
|
71
72
|
* How many rays to use per-pixel
|
|
72
73
|
* @type {number}
|
|
73
74
|
*/
|
|
74
|
-
const PIXEL_SAMPLE_COUNT =
|
|
75
|
+
const PIXEL_SAMPLE_COUNT = 256;
|
|
75
76
|
|
|
77
|
+
const scene = new PathTracedScene();
|
|
76
78
|
const pt = new PathTracer();
|
|
77
79
|
|
|
78
|
-
const gltfLoader = new GLTFLoader();
|
|
79
|
-
// const gltf_url = 'data/models/LowPolyTownshipSet/Town_Hall/model.gltf';
|
|
80
|
-
// const gltf_url = 'data/models/road_bike/road_bike.gltf';
|
|
81
|
-
// const gltf_url = 'data/models/sponza-pbr/gltf/sponza.glb';
|
|
82
|
-
// const gltf_url = 'data/models/sibenik/model.gltf';
|
|
83
|
-
// gltfLoader.load(gltf_url, (gltf) => {
|
|
84
|
-
//
|
|
85
|
-
// gltf.scene.updateMatrixWorld();
|
|
86
|
-
//
|
|
87
|
-
// gltf.scene.traverse(m => {
|
|
88
|
-
//
|
|
89
|
-
// if (m.isMesh) {
|
|
90
|
-
//
|
|
91
|
-
// pt.addMesh(
|
|
92
|
-
// m.geometry,
|
|
93
|
-
// m.material,
|
|
94
|
-
// m.matrixWorld.elements
|
|
95
|
-
// );
|
|
96
|
-
//
|
|
97
|
-
// }
|
|
98
|
-
// });
|
|
99
|
-
//
|
|
100
|
-
// trace_image(vCanvas);
|
|
101
|
-
// });
|
|
102
|
-
|
|
103
|
-
//
|
|
104
|
-
// pt.addMesh(
|
|
105
|
-
// new TorusKnotBufferGeometry(1, 0.3, 128, 128),
|
|
106
|
-
// new MeshStandardMaterial({ color: '#FF0000' }),
|
|
107
|
-
// Transform.fromJSON({
|
|
108
|
-
// scale: 0.5
|
|
109
|
-
// }).matrix
|
|
110
|
-
// );
|
|
111
|
-
//
|
|
112
|
-
|
|
113
80
|
function make_sun({
|
|
114
81
|
temperature = 5000, // around clear-sky day
|
|
115
82
|
color = '#FFFFFF',
|
|
@@ -193,20 +160,20 @@ function promise_gltf(url) {
|
|
|
193
160
|
|
|
194
161
|
/**
|
|
195
162
|
*
|
|
196
|
-
* @param {
|
|
163
|
+
* @param {PathTracedScene} scene
|
|
197
164
|
* @param {THREE.Camera} camera
|
|
198
165
|
* @param {string} url
|
|
199
166
|
* @param zoom
|
|
200
167
|
* @return {Promise<void>}
|
|
201
168
|
*/
|
|
202
|
-
async function prepare_scene_gltf(
|
|
169
|
+
async function prepare_scene_gltf(scene, camera, url, zoom = 1) {
|
|
203
170
|
const gltf = await promise_gltf(url);
|
|
204
171
|
|
|
205
172
|
|
|
206
173
|
const ground_material = new MeshStandardMaterial({
|
|
207
174
|
color: '#ffceae'
|
|
208
175
|
});
|
|
209
|
-
|
|
176
|
+
scene.addMesh(new PlaneBufferGeometry(), ground_material, Transform.fromJSON({
|
|
210
177
|
position: new Vector3(0, 0, 0),
|
|
211
178
|
scale: 5000,
|
|
212
179
|
rotation: Quaternion.fromEulerAngles(-Math.PI / 2, 0, 0)
|
|
@@ -217,7 +184,7 @@ async function prepare_scene_gltf(pt, camera, url, zoom = 1) {
|
|
|
217
184
|
|
|
218
185
|
gltf.scene.traverse((m) => {
|
|
219
186
|
if (m.isMesh) {
|
|
220
|
-
|
|
187
|
+
scene.addMesh(m.geometry, m.material, m.matrixWorld.elements);
|
|
221
188
|
}
|
|
222
189
|
});
|
|
223
190
|
|
|
@@ -228,7 +195,7 @@ async function prepare_scene_gltf(pt, camera, url, zoom = 1) {
|
|
|
228
195
|
|
|
229
196
|
box3.getBoundingSphere(sphere);
|
|
230
197
|
|
|
231
|
-
|
|
198
|
+
scene.addLight(make_sun());
|
|
232
199
|
|
|
233
200
|
camera.position.set(1, 1.3, 1)
|
|
234
201
|
.normalize()
|
|
@@ -239,11 +206,11 @@ async function prepare_scene_gltf(pt, camera, url, zoom = 1) {
|
|
|
239
206
|
|
|
240
207
|
/**
|
|
241
208
|
*
|
|
242
|
-
* @param {
|
|
209
|
+
* @param {PathTracedScene} scene
|
|
243
210
|
* @param {THREE.Camera} camera
|
|
244
211
|
* @return {Promise<void>}
|
|
245
212
|
*/
|
|
246
|
-
async function prepare_scene_lucy(
|
|
213
|
+
async function prepare_scene_lucy(scene, camera) {
|
|
247
214
|
|
|
248
215
|
|
|
249
216
|
const lucy_geom = await promise_ply("data/models/stanford/Lucy100k.ply")
|
|
@@ -251,7 +218,7 @@ async function prepare_scene_lucy(pt, camera) {
|
|
|
251
218
|
const lucy_material = new MeshStandardMaterial({
|
|
252
219
|
color: '#95c9ff'
|
|
253
220
|
});
|
|
254
|
-
|
|
221
|
+
scene.addMesh(lucy_geom, lucy_material, Transform.fromJSON({
|
|
255
222
|
position: new Vector3(0, 0, 0),
|
|
256
223
|
scale: 1,
|
|
257
224
|
// rotation: Quaternion.fromEulerAngles(-Math.PI / 2, 0, 0)
|
|
@@ -260,14 +227,14 @@ async function prepare_scene_lucy(pt, camera) {
|
|
|
260
227
|
const ground_material = new MeshStandardMaterial({
|
|
261
228
|
color: '#ffceae'
|
|
262
229
|
});
|
|
263
|
-
|
|
230
|
+
scene.addMesh(new PlaneBufferGeometry(), ground_material, Transform.fromJSON({
|
|
264
231
|
position: new Vector3(0, -800, 0),
|
|
265
232
|
scale: 5000,
|
|
266
233
|
rotation: Quaternion.fromEulerAngles(-Math.PI / 2, 0, 0)
|
|
267
234
|
}).matrix);
|
|
268
235
|
|
|
269
236
|
|
|
270
|
-
|
|
237
|
+
scene.addLight(make_sun());
|
|
271
238
|
|
|
272
239
|
camera.position.set(0, 0, -2300);
|
|
273
240
|
camera.lookAt(0, 0, 0);
|
|
@@ -287,7 +254,7 @@ async function prepare_scene_rtiow(pt, camera) {
|
|
|
287
254
|
const ground_material = new MeshStandardMaterial({
|
|
288
255
|
color: '#ffffff'
|
|
289
256
|
});
|
|
290
|
-
|
|
257
|
+
scene.addMesh(new PlaneBufferGeometry(), ground_material, Transform.fromJSON({
|
|
291
258
|
position: new Vector3(0, 0, 0),
|
|
292
259
|
scale: 50,
|
|
293
260
|
rotation: Quaternion.fromEulerAngles(-Math.PI / 2, 0, 0)
|
|
@@ -314,7 +281,7 @@ async function prepare_scene_rtiow(pt, camera) {
|
|
|
314
281
|
const mat = new Float32Array(16);
|
|
315
282
|
mat4.fromRotationTranslationScale(mat, [0, 0, 0, 1], center, [radius, radius, radius])
|
|
316
283
|
|
|
317
|
-
|
|
284
|
+
scene.addMesh(sphere_geo, material, mat);
|
|
318
285
|
|
|
319
286
|
spheres.push([
|
|
320
287
|
center[0],
|
|
@@ -379,7 +346,7 @@ async function prepare_scene_rtiow(pt, camera) {
|
|
|
379
346
|
}
|
|
380
347
|
|
|
381
348
|
|
|
382
|
-
|
|
349
|
+
scene.addLight(make_sun());
|
|
383
350
|
|
|
384
351
|
camera.position.set(13, 2, 3);
|
|
385
352
|
camera.lookAt(0, 0, 0);
|
|
@@ -392,9 +359,10 @@ async function prepare_scene_rtiow(pt, camera) {
|
|
|
392
359
|
* @param {Sampler2D} target
|
|
393
360
|
* @param {PathTracer} pt
|
|
394
361
|
* @param {Camera} camera
|
|
362
|
+
* @param {PathTracedScene} scene
|
|
395
363
|
* @param {{current:number, total:number}} progress
|
|
396
364
|
*/
|
|
397
|
-
function* render(target, pt, camera, progress = { current: 0, total: 0 }) {
|
|
365
|
+
function* render(target, pt, camera, scene, progress = { current: 0, total: 0 }) {
|
|
398
366
|
const random = seededRandom(0);
|
|
399
367
|
|
|
400
368
|
// update camera
|
|
@@ -476,7 +444,7 @@ function* render(target, pt, camera, progress = { current: 0, total: 0 }) {
|
|
|
476
444
|
ray_direction.x, ray_direction.y, ray_direction.z
|
|
477
445
|
);
|
|
478
446
|
|
|
479
|
-
pt.path_trace(pixel_color, ray, Infinity, 3, random);
|
|
447
|
+
pt.path_trace(pixel_color, ray, Infinity, 3, 7, random, scene);
|
|
480
448
|
|
|
481
449
|
pixel_accummulation[0] += pixel_color[0];
|
|
482
450
|
pixel_accummulation[1] += pixel_color[1];
|
|
@@ -528,12 +496,12 @@ async function start_renderer(camera) {
|
|
|
528
496
|
const path = 'data/models/pica_pica/pica_pica.gltf';
|
|
529
497
|
// const path = 'data/models/road_bike/road_bike.gltf'; //large CAD-type model
|
|
530
498
|
|
|
531
|
-
// await prepare_scene_lucy(
|
|
499
|
+
// await prepare_scene_lucy(scene, camera);
|
|
532
500
|
// await prepare_scene_rtiow(pt, camera);
|
|
533
501
|
// await prepare_scene_sphere_01(pt, camera);
|
|
534
|
-
await prepare_scene_gltf(
|
|
502
|
+
await prepare_scene_gltf(scene, camera, path);
|
|
535
503
|
|
|
536
|
-
await
|
|
504
|
+
await scene.build();
|
|
537
505
|
// pt.optimize();
|
|
538
506
|
|
|
539
507
|
const pixelRatio = 1;
|
|
@@ -548,7 +516,7 @@ async function start_renderer(camera) {
|
|
|
548
516
|
function make_render_task() {
|
|
549
517
|
const progress_v = { current: 0, total: 0 };
|
|
550
518
|
|
|
551
|
-
const it = render(scaled_rt, pt, camera, progress_v);
|
|
519
|
+
const it = render(scaled_rt, pt, camera, scene, progress_v);
|
|
552
520
|
|
|
553
521
|
return new Task({
|
|
554
522
|
name: 'render',
|
|
@@ -577,9 +545,9 @@ async function start_renderer(camera) {
|
|
|
577
545
|
const t = make_render_task();
|
|
578
546
|
|
|
579
547
|
|
|
580
|
-
const vProgress =makeSimpleTaskProgressView({
|
|
548
|
+
const vProgress = makeSimpleTaskProgressView({
|
|
581
549
|
task: t,
|
|
582
|
-
size:vContainer.size,
|
|
550
|
+
size: vContainer.size,
|
|
583
551
|
localization: loc
|
|
584
552
|
})
|
|
585
553
|
|
|
@@ -632,7 +600,7 @@ vCanvas.el.addEventListener(MouseEvents.Click, (evt) => {
|
|
|
632
600
|
|
|
633
601
|
const out = [];
|
|
634
602
|
|
|
635
|
-
|
|
603
|
+
scene.trace(out, ray, 0, Infinity);
|
|
636
604
|
|
|
637
605
|
console.log(pointer, out, ray, pt);
|
|
638
606
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"random_in_hemisphere.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/random_in_hemisphere.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,+DALW,MAAM,EAAE,iBACR,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,
|
|
1
|
+
{"version":3,"file":"random_in_hemisphere.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/random_in_hemisphere.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,+DALW,MAAM,EAAE,iBACR,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,QAoChB"}
|
|
@@ -8,7 +8,13 @@ import { v3_dot } from "../../../../core/geom/vec3/v3_dot.js";
|
|
|
8
8
|
* @param {number[]} normal
|
|
9
9
|
* @param {number} normal_offset
|
|
10
10
|
*/
|
|
11
|
-
export function random_in_hemisphere(
|
|
11
|
+
export function random_in_hemisphere(
|
|
12
|
+
random,
|
|
13
|
+
result,
|
|
14
|
+
result_offset,
|
|
15
|
+
normal,
|
|
16
|
+
normal_offset
|
|
17
|
+
) {
|
|
12
18
|
const nx = normal[normal_offset + 0];
|
|
13
19
|
const ny = normal[normal_offset + 1];
|
|
14
20
|
const nz = normal[normal_offset + 2];
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* @param {number} a vertex index 0
|
|
6
6
|
* @param {number} b vertex index 0
|
|
7
7
|
* @param {number} c vertex index 0
|
|
8
|
-
* @param {number[]} attribute_array
|
|
8
|
+
* @param {number[]|ArrayLike<number>|Float32Array} attribute_array
|
|
9
9
|
* @param {number} dimensions
|
|
10
10
|
* @param {number} u Barycentric coordinate
|
|
11
11
|
* @param {number} v Barycentric coordinate
|
|
12
12
|
*/
|
|
13
|
-
export function sample_triangle_attribute(out: number[], out_offset: number, a: number, b: number, c: number, attribute_array: number[], dimensions: number, u: number, v: number): void;
|
|
13
|
+
export function sample_triangle_attribute(out: number[], out_offset: number, a: number, b: number, c: number, attribute_array: number[] | ArrayLike<number> | Float32Array, dimensions: number, u: number, v: number): void;
|
|
14
14
|
//# sourceMappingURL=sample_triangle_attribute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sample_triangle_attribute.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,+CAVW,MAAM,EAAE,cACR,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,mBACN,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"sample_triangle_attribute.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,+CAVW,MAAM,EAAE,cACR,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,mBACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,cACvC,MAAM,KACN,MAAM,KACN,MAAM,QAwBhB"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param {number} a vertex index 0
|
|
6
6
|
* @param {number} b vertex index 0
|
|
7
7
|
* @param {number} c vertex index 0
|
|
8
|
-
* @param {number[]} attribute_array
|
|
8
|
+
* @param {number[]|ArrayLike<number>|Float32Array} attribute_array
|
|
9
9
|
* @param {number} dimensions
|
|
10
10
|
* @param {number} u Barycentric coordinate
|
|
11
11
|
* @param {number} v Barycentric coordinate
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SoftwareTextureCache.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/texture/SoftwareTextureCache.js"],"names":[],"mappings":"AAAA;CAEC"}
|
package/src/engine/graphics/sh3/path_tracer/texture/apply_texture_clamping_to_coordinate.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply_texture_clamping_to_coordinate.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/texture/apply_texture_clamping_to_coordinate.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,+DAJW,MAAM,KACN,MAAM,GACL,MAAM,CAcjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClampToEdgeWrapping, RepeatWrapping } from "three";
|
|
2
|
-
import { clamp01 } from "
|
|
2
|
+
import { clamp01 } from "../../../../../core/math/clamp01.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
@@ -10,7 +10,7 @@ import { clamp01 } from "../../../../core/math/clamp01.js";
|
|
|
10
10
|
export function apply_texture_clamping_to_coordinate(clamping, v) {
|
|
11
11
|
|
|
12
12
|
switch (clamping) {
|
|
13
|
-
case
|
|
13
|
+
case RepeatWrapping:
|
|
14
14
|
return v % 1;
|
|
15
15
|
case ClampToEdgeWrapping:
|
|
16
16
|
return clamp01(v);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]} out
|
|
4
|
+
* @param {PathTracedMesh} mesh
|
|
5
|
+
* @param {Map<number, Sampler2D>} textures
|
|
6
|
+
* @param {number} primitive_id
|
|
7
|
+
* @param {number} u
|
|
8
|
+
* @param {number} v
|
|
9
|
+
*/
|
|
10
|
+
export function sample_material(out: number[], mesh: PathTracedMesh, textures: Map<number, Sampler2D>, primitive_id: number, u: number, v: number): void;
|
|
11
|
+
//# sourceMappingURL=sample_material.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample_material.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/texture/sample_material.js"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH,qCAPW,MAAM,EAAE,kCAER,IAAI,MAAM,YAAY,gBACtB,MAAM,KACN,MAAM,KACN,MAAM,QAqEhB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { vec3 } from "gl-matrix";
|
|
2
|
+
import { array_copy } from "../../../../../core/collection/array/array_copy.js";
|
|
3
|
+
import { transform_normal_m4 } from "../ray_hit_apply_transform.js";
|
|
4
|
+
import { sample_triangle_attribute } from "../sample_triangle_attribute.js";
|
|
5
|
+
import { sample_texture } from "./sample_texture.js";
|
|
6
|
+
|
|
7
|
+
const texture_uv = [0, 0];
|
|
8
|
+
const color = [1, 1, 1];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {number[]} out
|
|
13
|
+
* @param {PathTracedMesh} mesh
|
|
14
|
+
* @param {Map<number, Sampler2D>} textures
|
|
15
|
+
* @param {number} primitive_id
|
|
16
|
+
* @param {number} u
|
|
17
|
+
* @param {number} v
|
|
18
|
+
*/
|
|
19
|
+
export function sample_material(
|
|
20
|
+
out,
|
|
21
|
+
mesh, textures,
|
|
22
|
+
primitive_id,
|
|
23
|
+
u, v
|
|
24
|
+
) {
|
|
25
|
+
|
|
26
|
+
const geometry = mesh.geometry;
|
|
27
|
+
const index_attribute = geometry.getIndex();
|
|
28
|
+
const index_array = index_attribute.array;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// sample surface normal
|
|
32
|
+
const index_offset = primitive_id * 3;
|
|
33
|
+
|
|
34
|
+
const index_0 = index_array[index_offset];
|
|
35
|
+
const index_1 = index_array[index_offset + 1];
|
|
36
|
+
const index_2 = index_array[index_offset + 2];
|
|
37
|
+
|
|
38
|
+
const normal_attribute = geometry.getAttribute('normal');
|
|
39
|
+
|
|
40
|
+
if (normal_attribute !== undefined) {
|
|
41
|
+
// vertex normals are present, use those
|
|
42
|
+
const normal_array = normal_attribute.array;
|
|
43
|
+
|
|
44
|
+
sample_triangle_attribute(out, 3, index_0, index_1, index_2, normal_array, 3, u, v);
|
|
45
|
+
|
|
46
|
+
// apply transform
|
|
47
|
+
transform_normal_m4(out, 3, out, 3, mesh.transform);
|
|
48
|
+
} else {
|
|
49
|
+
// copy hit normal
|
|
50
|
+
array_copy(hit, 3, out, 3, 3);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
const uv_attribute = geometry.getAttribute('uv');
|
|
55
|
+
|
|
56
|
+
if (uv_attribute !== undefined) {
|
|
57
|
+
const uv_array = uv_attribute.array;
|
|
58
|
+
sample_triangle_attribute(texture_uv, 0, index_0, index_1, index_2, uv_array, 2, u, v);
|
|
59
|
+
} else {
|
|
60
|
+
// default texture uv
|
|
61
|
+
texture_uv[0] = 0;
|
|
62
|
+
texture_uv[1] = 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const material = mesh.material;
|
|
66
|
+
|
|
67
|
+
if (material.isMeshStandardMaterial) {
|
|
68
|
+
const material_color = material.color;
|
|
69
|
+
|
|
70
|
+
out[0] *= material_color.r;
|
|
71
|
+
out[1] *= material_color.g;
|
|
72
|
+
out[2] *= material_color.b;
|
|
73
|
+
|
|
74
|
+
const diffuse_map = material.map;
|
|
75
|
+
|
|
76
|
+
if (diffuse_map !== null) {
|
|
77
|
+
const sampler2D = textures.get(diffuse_map.id);
|
|
78
|
+
|
|
79
|
+
sample_texture(color, sampler2D, diffuse_map, texture_uv[0], texture_uv[1]);
|
|
80
|
+
|
|
81
|
+
vec3.multiply(out, out, color);
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
// unsupported
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]|Float32Array} out
|
|
4
|
+
* @param {Sampler2D} sampler
|
|
5
|
+
* @param {Texture} texture
|
|
6
|
+
* @param {number} u
|
|
7
|
+
* @param {number} v
|
|
8
|
+
*/
|
|
9
|
+
export function sample_texture(out: number[] | Float32Array, sampler: Sampler2D, texture: Texture, u: number, v: number): void;
|
|
10
|
+
//# sourceMappingURL=sample_texture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample_texture.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/texture/sample_texture.js"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,oCANW,MAAM,EAAE,GAAC,YAAY,2CAGrB,MAAM,KACN,MAAM,QAoChB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LinearEncoding,
|
|
3
|
+
LinearFilter,
|
|
4
|
+
LinearMipmapLinearFilter,
|
|
5
|
+
NearestFilter,
|
|
6
|
+
NearestMipMapLinearFilter,
|
|
7
|
+
sRGBEncoding,
|
|
8
|
+
UnsignedByteType
|
|
9
|
+
} from "three";
|
|
10
|
+
import { linear_to_sRGB } from "../../../../../core/color/sRGB/linear_to_sRGB.js";
|
|
11
|
+
import { vec3_uint8_to_float } from "../vec3_uint8_to_float.js";
|
|
12
|
+
import { apply_texture_clamping_to_coordinate } from "./apply_texture_clamping_to_coordinate.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param {number[]|Float32Array} out
|
|
17
|
+
* @param {Sampler2D} sampler
|
|
18
|
+
* @param {Texture} texture
|
|
19
|
+
* @param {number} u
|
|
20
|
+
* @param {number} v
|
|
21
|
+
*/
|
|
22
|
+
export function sample_texture(out, sampler, texture, u, v) {
|
|
23
|
+
// TODO apply texture matrix transform
|
|
24
|
+
|
|
25
|
+
const _u = apply_texture_clamping_to_coordinate(texture.wrapS, u);
|
|
26
|
+
const _v = apply_texture_clamping_to_coordinate(texture.wrapT, v);
|
|
27
|
+
|
|
28
|
+
const magFilter = texture.magFilter;
|
|
29
|
+
|
|
30
|
+
switch (magFilter) {
|
|
31
|
+
default:
|
|
32
|
+
case NearestFilter:
|
|
33
|
+
case NearestMipMapLinearFilter:
|
|
34
|
+
sampler.sampleNearestUV(_u, _v, out);
|
|
35
|
+
break;
|
|
36
|
+
|
|
37
|
+
case LinearFilter:
|
|
38
|
+
case LinearMipmapLinearFilter:
|
|
39
|
+
|
|
40
|
+
sampler.sampleBilinearUV(_u, _v, out);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (texture.type === UnsignedByteType) {
|
|
45
|
+
vec3_uint8_to_float(out, out);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const texture_encoding = texture.encoding;
|
|
49
|
+
|
|
50
|
+
if (texture_encoding === LinearEncoding) {
|
|
51
|
+
// nothing
|
|
52
|
+
} else if (texture_encoding === sRGBEncoding) {
|
|
53
|
+
// convert value to sRGB
|
|
54
|
+
linear_to_sRGB(out, 0, out, 0);
|
|
55
|
+
}
|
|
56
|
+
}
|