@woosh/meep-engine 2.109.5 → 2.109.7
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-terrain.js +1 -1
- package/build/meep.cjs +211 -179
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +211 -179
- package/editor/tools/v2/TransformControls.js +39 -33
- package/package.json +1 -1
- package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/BVH.js +8 -0
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +11 -9
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +8 -5
- package/src/core/geom/3d/Ray3.js +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts +4 -4
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts.map +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +15 -11
- package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.d.ts.map +1 -1
- package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js +13 -7
- package/src/core/geom/3d/normal/octahedron/encoding.spec.js +26 -1
- package/src/core/geom/3d/normal/octahedron/prototype.d.ts +2 -0
- package/src/core/geom/3d/normal/octahedron/prototype.d.ts.map +1 -0
- package/src/core/geom/3d/normal/octahedron/prototype.js +226 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.d.ts +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_bl.js +4 -4
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.d.ts +7 -1
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/triangle/triangle_encode_rasterized_depth.js +6 -0
- package/src/core/geom/vec3/v3_distance.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_distance.js +5 -5
- package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts +10 -0
- package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.d.ts.map +1 -0
- package/src/core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js +34 -0
- package/src/core/model/node-graph/json/serializeNodeGraphToJSON.d.ts +5 -1
- package/src/core/model/node-graph/json/serializeNodeGraphToJSON.d.ts.map +1 -1
- package/src/core/model/node-graph/json/serializeNodeGraphToJSON.js +11 -6
- package/src/engine/asset/loaders/AssetLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/AssetLoader.js +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureEquality.js +6 -1
- package/src/engine/asset/loaders/material/computeTextureHash.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureHash.js +8 -3
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.d.ts.map +1 -1
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +9 -15
- package/src/engine/graphics/geometry/instancing/geometry_copy.d.ts +7 -0
- package/src/engine/graphics/geometry/instancing/geometry_copy.d.ts.map +1 -0
- package/src/engine/graphics/geometry/instancing/geometry_copy.js +15 -0
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +28 -20
- package/src/engine/graphics/impostors/octahedral/ImpostorCaptureType.d.ts +1 -0
- package/src/engine/graphics/impostors/octahedral/ImpostorCaptureType.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorCaptureType.js +4 -0
- package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js +6 -6
- package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +16 -7
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts +3 -2
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +25 -14
- package/src/engine/graphics/render/visibility/hiz/buildCanvasViewFromTexture.js +1 -0
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +48 -33
- package/src/engine/graphics/sh3/gi/material/common.glsl +434 -0
- package/src/engine/graphics/sh3/gi/material/makeLookupTexture3D.d.ts +8 -0
- package/src/engine/graphics/sh3/gi/material/makeLookupTexture3D.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/makeLookupTexture3D.js +35 -0
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.d.ts +8 -0
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.js +28 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_fragment_shader.js +53 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/build_vertex_shader.js +29 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.d.ts +9 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.js +12 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_fragment_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_fragment_shader.js +26 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_vertex_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/build_vertex_shader.js +62 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/preable.frag.glsl +43 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/preable.vert.glsl +9 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.d.ts +9 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.js +12 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +2 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +35 -3
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +67 -8
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +10 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +27 -41
- package/src/engine/graphics/sh3/lpv/depth/octahedral/OctahedralDepthDebuggerWidget.d.ts +17 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/OctahedralDepthDebuggerWidget.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/OctahedralDepthDebuggerWidget.js +100 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts +12 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +58 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/OctahedralDepthVisualizationMaterial.d.ts +11 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/OctahedralDepthVisualizationMaterial.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/OctahedralDepthVisualizationMaterial.js +45 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/visualize.frag.glsl +126 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/shader/visualize.vert.glsl +10 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.d.ts +13 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.js +146 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/visualise.frag.glsl +159 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/visualise.vert.glsl +13 -0
- package/src/engine/graphics/sh3/lpv/depth/sh3_bake_depth.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/{sh3_bake_depth.js → depth/sh3_bake_depth.js} +7 -7
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts +3 -6
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +34 -58
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.js +8 -0
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts +2 -2
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +8 -5
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.d.ts +7 -0
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.js +50 -0
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +40 -3
- package/src/engine/graphics/sh3/path_tracer/sorting/build_bvh_nodes_distances_along_ray.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_along_ray.js → sorting/build_bvh_nodes_distances_along_ray.js} +2 -2
- package/src/engine/graphics/sh3/path_tracer/sorting/build_bvh_nodes_distances_sqr_to_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_sqr_to_point.js → sorting/build_bvh_nodes_distances_sqr_to_point.js} +2 -2
- package/src/engine/graphics/sh3/path_tracer/sorting/sort_bvh_nodes_by_distance_to_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{sort_bvh_nodes_by_distance_to_point.js → sorting/sort_bvh_nodes_by_distance_to_point.js} +3 -3
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +40 -7
- package/src/engine/graphics/sh3/shader/SH3VisualisationMaterial.d.ts.map +1 -0
- package/src/engine/graphics/sh3/shader/SH3VisualisationMaterial.js +29 -0
- package/src/engine/graphics/sh3/shader/visualize.frag.glsl +41 -0
- package/src/engine/graphics/sh3/shader/visualize.vert.glsl +9 -0
- package/src/engine/graphics/sh3/visualise_spherical_harmonic_sphere.js +1 -1
- package/src/engine/graphics/texture/debug_preview_texture.d.ts +8 -0
- package/src/engine/graphics/texture/debug_preview_texture.d.ts.map +1 -0
- package/src/engine/graphics/texture/debug_preview_texture.js +38 -0
- package/src/engine/graphics/texture/virtual/prototype.js +4 -3
- package/src/view/View.d.ts.map +1 -1
- package/src/view/View.js +2 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.js +0 -32
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band1.js +0 -44
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts +0 -8
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.d.ts.map +0 -1
- package/src/core/geom/3d/sphere/harmonics/sh_rotate_band2.js +0 -86
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.d.ts.map +0 -1
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +0 -83
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.d.ts.map +0 -1
- package/src/engine/graphics/sh3/gi/material/build_fragment_shader.js +0 -71
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.d.ts.map +0 -1
- package/src/engine/graphics/sh3/gi/material/build_vertex_shader.js +0 -256
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/ray_reflect.d.ts +0 -2
- package/src/engine/graphics/sh3/path_tracer/ray_reflect.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/ray_reflect.js +0 -27
- package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.d.ts.map +0 -1
- /package/src/engine/graphics/sh3/gi/material/{build_fragment_shader.d.ts → space_fragment/build_fragment_shader.d.ts} +0 -0
- /package/src/engine/graphics/sh3/gi/material/{build_vertex_shader.d.ts → space_fragment/build_vertex_shader.d.ts} +0 -0
- /package/src/engine/graphics/sh3/lpv/{sh3_bake_depth.d.ts → depth/sh3_bake_depth.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_along_ray.d.ts → sorting/build_bvh_nodes_distances_along_ray.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{build_bvh_nodes_distances_sqr_to_point.d.ts → sorting/build_bvh_nodes_distances_sqr_to_point.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{sort_bvh_nodes_by_distance_to_point.d.ts → sorting/sort_bvh_nodes_by_distance_to_point.d.ts} +0 -0
- /package/src/engine/graphics/sh3/{SH3VisualisationMaterial.d.ts → shader/SH3VisualisationMaterial.d.ts} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { insert_after } from "../../../../../../core/primitives/strings/insert_after.js";
|
|
2
|
+
import PREAMBLE_COMMON from "../common.glsl";
|
|
3
|
+
|
|
4
|
+
const PREAMBLE = `
|
|
5
|
+
#ifndef LPV_SHADER_CHUNK_PREAMBLE
|
|
6
|
+
#define LPV_SHADER_CHUNK_PREAMBLE
|
|
7
|
+
|
|
8
|
+
precision highp usampler2D;
|
|
9
|
+
precision highp usampler3D;
|
|
10
|
+
|
|
11
|
+
varying vec3 vWorldPosition;
|
|
12
|
+
|
|
13
|
+
uniform float lpv_f_intensity;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const ACCUMULATION = `
|
|
21
|
+
{
|
|
22
|
+
|
|
23
|
+
vec3 world_normal = normalize(inverseTransformDirection( geometry.normal, viewMatrix ));
|
|
24
|
+
|
|
25
|
+
vec3 probe_irradiance = lpv_sample_irradiance( vWorldPosition, world_normal );
|
|
26
|
+
|
|
27
|
+
irradiance += probe_irradiance * lpv_f_intensity;
|
|
28
|
+
// irradiance += vec3(1.0) * step(probe_irradiance.r,1.0);
|
|
29
|
+
//
|
|
30
|
+
// material.diffuseColor.rgb = vec3(1.0) ;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param {string} source
|
|
40
|
+
*/
|
|
41
|
+
export function build_fragment_shader(source) {
|
|
42
|
+
|
|
43
|
+
let result = PREAMBLE + PREAMBLE_COMMON + source;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
result = insert_after(
|
|
47
|
+
result,
|
|
48
|
+
'#include <lights_fragment_begin>',
|
|
49
|
+
ACCUMULATION
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_vertex_shader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/gi/material/space_fragment/build_vertex_shader.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH,4CAFW,MAAM,UAmBhB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { insert_after } from "../../../../../../core/primitives/strings/insert_after.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const PREAMBLE = `
|
|
5
|
+
varying vec3 vWorldPosition;
|
|
6
|
+
`;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {string} source
|
|
11
|
+
*/
|
|
12
|
+
export function build_vertex_shader(source) {
|
|
13
|
+
|
|
14
|
+
let result = PREAMBLE + source;
|
|
15
|
+
|
|
16
|
+
result = insert_after(
|
|
17
|
+
result,
|
|
18
|
+
'#include <fog_vertex>',
|
|
19
|
+
`
|
|
20
|
+
{
|
|
21
|
+
vWorldPosition = worldPosition.xyz;
|
|
22
|
+
}
|
|
23
|
+
`
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// console.log(result)
|
|
27
|
+
|
|
28
|
+
return result;
|
|
29
|
+
}
|
package/src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space_fragment_transform_shader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/gi/material/space_fragment/space_fragment_transform_shader.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wDAFW;IAAC,YAAY,CAAC;IAAC,cAAc,CAAA;CAAC,QAMxC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { build_fragment_shader } from "./build_fragment_shader.js";
|
|
2
|
+
import { build_vertex_shader } from "./build_vertex_shader.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {{vertexShader, fragmentShader}} shader
|
|
7
|
+
*/
|
|
8
|
+
export function space_fragment_transform_shader(shader) {
|
|
9
|
+
|
|
10
|
+
shader.vertexShader = build_vertex_shader(shader.vertexShader);
|
|
11
|
+
shader.fragmentShader = build_fragment_shader(shader.fragmentShader);
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_fragment_shader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/gi/material/space_vertex/build_fragment_shader.js"],"names":[],"mappings":"AASA;;;GAGG;AACH,8CAFW,MAAM,UAchB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { insert_after } from "../../../../../../core/primitives/strings/insert_after.js";
|
|
2
|
+
|
|
3
|
+
import PREAMBLE from "./preable.frag.glsl";
|
|
4
|
+
|
|
5
|
+
const ACCUMULATION = `
|
|
6
|
+
irradiance += getLightProbeIrradiance(lpv_values, geometryNormal )* lpv_f_intensity;
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {string} source
|
|
13
|
+
*/
|
|
14
|
+
export function build_fragment_shader(source) {
|
|
15
|
+
|
|
16
|
+
let result = PREAMBLE + source;
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
result = insert_after(
|
|
20
|
+
result,
|
|
21
|
+
'#include <lights_fragment_begin>',
|
|
22
|
+
ACCUMULATION
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_vertex_shader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/gi/material/space_vertex/build_vertex_shader.js"],"names":[],"mappings":"AA6CA;;;GAGG;AACH,4CAFW,MAAM,UAchB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { insert_after } from "../../../../../../core/primitives/strings/insert_after.js";
|
|
2
|
+
import PREAMBLE_COMMON from "../common.glsl";
|
|
3
|
+
|
|
4
|
+
import PREAMBLE from "./preable.vert.glsl";
|
|
5
|
+
|
|
6
|
+
const SHADER_CHUNK_ACCUMULATION = `
|
|
7
|
+
{
|
|
8
|
+
// lookup nearby tet
|
|
9
|
+
vec3 lpv_mesh_bounds_min = lpv_v3_bounds_min;
|
|
10
|
+
vec3 lpv_mesh_bounds_max = lpv_v3_bounds_max;
|
|
11
|
+
vec3 lookup_coordinates = (worldPosition.xyz - lpv_mesh_bounds_min) / (lpv_mesh_bounds_max - lpv_mesh_bounds_min) ;
|
|
12
|
+
|
|
13
|
+
uint nearest_tet = lpv_guess_initial_tet( worldPosition.xyz );
|
|
14
|
+
|
|
15
|
+
uint tet;
|
|
16
|
+
vec4 weights;
|
|
17
|
+
lpv_getTetrahedron(worldPosition.xyz, nearest_tet, tet, weights);
|
|
18
|
+
|
|
19
|
+
weights = lvp_mask_weights_by_visibility(worldPosition.xyz, tet, weights);
|
|
20
|
+
|
|
21
|
+
if(tet == INVALID_TET){
|
|
22
|
+
lpv_values = vec3[](
|
|
23
|
+
vec3(0.0, 0.0, 0.0),
|
|
24
|
+
vec3(0.0, 0.0, 0.0),
|
|
25
|
+
vec3(0.0, 0.0, 0.0),
|
|
26
|
+
|
|
27
|
+
vec3(0.0, 0.0, 0.0),
|
|
28
|
+
vec3(0.0, 0.0, 0.0),
|
|
29
|
+
vec3(0.0, 0.0, 0.0),
|
|
30
|
+
|
|
31
|
+
vec3(0.0, 0.0, 0.0),
|
|
32
|
+
vec3(0.0, 0.0, 0.0),
|
|
33
|
+
vec3(0.0, 0.0, 0.0)
|
|
34
|
+
);
|
|
35
|
+
}else{
|
|
36
|
+
|
|
37
|
+
vec3 worldNormal = normalize(inverseTransformDirection( normalize(normal), viewMatrix ));
|
|
38
|
+
|
|
39
|
+
//weights = lpv_bias_weight_by_normal(worldPosition.xyz, normal, tet, weights);
|
|
40
|
+
|
|
41
|
+
lpv_values = lpv_interpolate_probes(weights, tet);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param {string} source
|
|
49
|
+
*/
|
|
50
|
+
export function build_vertex_shader(source) {
|
|
51
|
+
let result = PREAMBLE + PREAMBLE_COMMON + source;
|
|
52
|
+
|
|
53
|
+
result = insert_after(
|
|
54
|
+
result,
|
|
55
|
+
'#include <fog_vertex>',
|
|
56
|
+
SHADER_CHUNK_ACCUMULATION
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// console.log(result)
|
|
60
|
+
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
uniform float lpv_f_intensity;
|
|
2
|
+
|
|
3
|
+
varying vec3[9] lpv_values;
|
|
4
|
+
|
|
5
|
+
// vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
6
|
+
// // normal is assumed to have unit length
|
|
7
|
+
// float x = normal.x, y = normal.y, z = normal.z;
|
|
8
|
+
//
|
|
9
|
+
// // band 0
|
|
10
|
+
// vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|
11
|
+
//
|
|
12
|
+
// // band 1
|
|
13
|
+
// result -= shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|
14
|
+
// result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|
15
|
+
// result -= shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|
16
|
+
//
|
|
17
|
+
// // band 2
|
|
18
|
+
// result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|
19
|
+
// result -= shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|
20
|
+
// result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|
21
|
+
// result -= shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|
22
|
+
// result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|
23
|
+
//
|
|
24
|
+
// return result;
|
|
25
|
+
// }
|
|
26
|
+
//
|
|
27
|
+
// vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {
|
|
28
|
+
//
|
|
29
|
+
// // matrix is assumed to be orthogonal
|
|
30
|
+
//
|
|
31
|
+
// return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );
|
|
32
|
+
//
|
|
33
|
+
// }
|
|
34
|
+
//
|
|
35
|
+
// vec3 lpv_getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
|
36
|
+
//
|
|
37
|
+
// vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
|
38
|
+
//
|
|
39
|
+
// vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|
40
|
+
//
|
|
41
|
+
// return irradiance;
|
|
42
|
+
//
|
|
43
|
+
// }
|
package/src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space_vertex_transform_shader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/gi/material/space_vertex/space_vertex_transform_shader.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,sDAFW;IAAC,YAAY,CAAC;IAAC,cAAc,CAAA;CAAC,QAMxC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { build_fragment_shader } from "./build_fragment_shader.js";
|
|
2
|
+
import { build_vertex_shader } from "./build_vertex_shader.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {{vertexShader, fragmentShader}} shader
|
|
7
|
+
*/
|
|
8
|
+
export function space_vertex_transform_shader(shader) {
|
|
9
|
+
|
|
10
|
+
shader.vertexShader = build_vertex_shader(shader.vertexShader);
|
|
11
|
+
shader.fragmentShader = build_fragment_shader(shader.fragmentShader);
|
|
12
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightProbeVolume.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/LightProbeVolume.js"],"names":[],"mappings":"AAUA;
|
|
1
|
+
{"version":3,"file":"LightProbeVolume.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/LightProbeVolume.js"],"names":[],"mappings":"AAUA;IAiCI,sBAEC;IAED,cAkBC;IAED;;;OAGG;IACH,4BAEC;IAED,uBAEC;IAED,0BAEC;IAED,mCAEC;IAED,sBAEC;IAMD,uBAEC;IAND,oBAEC;IAMD;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,KACN,MAAM,QAgBhB;IAED;;;;;OAKG;IACH,mBAJW,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,QAIhB;IAED;;OAEG;IACH,mBAaC;IAGD;;;;;OAKG;IACH,mCAJW,MAAM,GAEJ,UAAU,CAsBtB;IAGD,yBAEC;;CAEJ;gCAnL+B,wDAAwD;2BAC7D,mCAAmC"}
|
|
@@ -20,11 +20,25 @@ export class LightProbeVolume {
|
|
|
20
20
|
#mesh = new TetrahedralMesh();
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Probe irradiance color data
|
|
24
|
+
* Base-3 spherical harmonics, 9 coefficients per color channel for a total of 27 coefficients per probe
|
|
24
25
|
* @type {number[]}
|
|
25
26
|
*/
|
|
26
27
|
#sh3_rgb = [];
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Resolution of an individual depth map for a probe
|
|
31
|
+
* Depth map is stored as a 2d texture of size RESOLUTION x RESOLUTION
|
|
32
|
+
* @type {number}
|
|
33
|
+
*/
|
|
34
|
+
#probe_depth_resolution = 24;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Octahedral-encoded depth map for each probe
|
|
38
|
+
* @type {number[]}
|
|
39
|
+
*/
|
|
40
|
+
#probe_depth = [];
|
|
41
|
+
|
|
28
42
|
#probe_count = 0;
|
|
29
43
|
|
|
30
44
|
get version() {
|
|
@@ -32,8 +46,18 @@ export class LightProbeVolume {
|
|
|
32
46
|
}
|
|
33
47
|
|
|
34
48
|
clear() {
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
if (this.#probe_positions.length > 0) {
|
|
50
|
+
this.#probe_positions = [];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (this.#sh3_rgb.length > 0) {
|
|
54
|
+
this.#sh3_rgb = [];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (this.#probe_depth.length > 0) {
|
|
58
|
+
this.#probe_depth = [];
|
|
59
|
+
}
|
|
60
|
+
|
|
37
61
|
this.#mesh.clear();
|
|
38
62
|
|
|
39
63
|
this.#probe_count = 0;
|
|
@@ -57,6 +81,14 @@ export class LightProbeVolume {
|
|
|
57
81
|
return this.#sh3_rgb;
|
|
58
82
|
}
|
|
59
83
|
|
|
84
|
+
get depth_map_resolution() {
|
|
85
|
+
return this.#probe_depth_resolution;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
get depth() {
|
|
89
|
+
return this.#probe_depth;
|
|
90
|
+
}
|
|
91
|
+
|
|
60
92
|
get count() {
|
|
61
93
|
return this.#probe_count;
|
|
62
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightProbeVolumeBaker.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LightProbeVolumeBaker.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js"],"names":[],"mappings":"AAmDA;IAGI,8BAAqC;IAGrC;;;;;OAKG;IACH,0DAJa,SAAS,CA6DrB;CACJ;wCAhHuC,8BAA8B;sBAJhD,4CAA4C"}
|
|
@@ -1,9 +1,54 @@
|
|
|
1
|
+
import { v3_distance_sqr } from "../../../../core/geom/vec3/v3_distance_sqr.js";
|
|
2
|
+
import {
|
|
3
|
+
tetrahedral_mesh_find_tets_attached_to_vertex
|
|
4
|
+
} from "../../../../core/geometry/3d/tetrahedra/tetrahedral_mesh_find_tets_attached_to_vertex.js";
|
|
5
|
+
import { max2 } from "../../../../core/math/max2.js";
|
|
1
6
|
import TaskGroup from "../../../../core/process/task/TaskGroup.js";
|
|
2
7
|
import { actionTask } from "../../../../core/process/task/util/actionTask.js";
|
|
3
8
|
import { countTask } from "../../../../core/process/task/util/countTask.js";
|
|
4
9
|
import { promiseTask } from "../../../../core/process/task/util/promiseTask.js";
|
|
5
10
|
import { PathTracerProbeRenderer } from "./PathTracerProbeRenderer.js";
|
|
6
11
|
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {number} vertex_index
|
|
15
|
+
* @param {TetrahedralMesh} mesh
|
|
16
|
+
* @param {number[]} points
|
|
17
|
+
*/
|
|
18
|
+
function find_max_depth_radius_for_point(vertex_index, mesh, points) {
|
|
19
|
+
const tets = [];
|
|
20
|
+
|
|
21
|
+
const count = tetrahedral_mesh_find_tets_attached_to_vertex(
|
|
22
|
+
tets, 0,
|
|
23
|
+
mesh,
|
|
24
|
+
vertex_index
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const ref_x = points[vertex_index * 3];
|
|
28
|
+
const ref_y = points[vertex_index * 3 + 1];
|
|
29
|
+
const ref_z = points[vertex_index * 3 + 2];
|
|
30
|
+
|
|
31
|
+
let radius_sqr = 0;
|
|
32
|
+
|
|
33
|
+
for (let i = 0; i < count; i++) {
|
|
34
|
+
const tet = tets[i];
|
|
35
|
+
|
|
36
|
+
for (let j = 0; j < 4; j++) {
|
|
37
|
+
const v = mesh.getVertexIndex(tet, j);
|
|
38
|
+
|
|
39
|
+
const x = points[v * 3];
|
|
40
|
+
const y = points[v * 3 + 1];
|
|
41
|
+
const z = points[v * 3 + 2];
|
|
42
|
+
|
|
43
|
+
const r2 = v3_distance_sqr(ref_x, ref_y, ref_z, x, y, z);
|
|
44
|
+
|
|
45
|
+
radius_sqr = max2(r2, radius_sqr);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return Math.sqrt(radius_sqr);
|
|
50
|
+
}
|
|
51
|
+
|
|
7
52
|
export class LightProbeVolumeBaker {
|
|
8
53
|
|
|
9
54
|
// this._ren = new WebGLCubeProbeRenderer();
|
|
@@ -29,23 +74,37 @@ export class LightProbeVolumeBaker {
|
|
|
29
74
|
|
|
30
75
|
const probe_count = lpv.count;
|
|
31
76
|
|
|
32
|
-
const
|
|
77
|
+
const tBakeIrradiance = countTask(0, probe_count, (i) => {
|
|
33
78
|
|
|
79
|
+
// Bake color
|
|
34
80
|
renderer.bake(
|
|
35
81
|
lpv.points, i * 3,
|
|
36
82
|
lpv.harmonics, i * 9 * 3
|
|
37
83
|
);
|
|
38
84
|
|
|
85
|
+
|
|
86
|
+
// Bake depth
|
|
87
|
+
const max_distance = find_max_depth_radius_for_point(i, lpv.mesh, lpv.points);
|
|
88
|
+
|
|
89
|
+
const depth_resolution = lpv.depth_map_resolution;
|
|
90
|
+
|
|
91
|
+
renderer.bake_depth_octahedral(
|
|
92
|
+
depth_resolution,
|
|
93
|
+
max_distance*1.05 + 0.00001,
|
|
94
|
+
lpv.points, i * 3,
|
|
95
|
+
lpv.depth, i * depth_resolution * depth_resolution
|
|
96
|
+
);
|
|
97
|
+
|
|
39
98
|
});
|
|
40
|
-
|
|
99
|
+
tBakeIrradiance.estimatedDuration = probe_count;
|
|
41
100
|
|
|
42
|
-
|
|
101
|
+
tBakeIrradiance.promise().then(() => {
|
|
43
102
|
|
|
44
|
-
const duration =
|
|
103
|
+
const duration = tBakeIrradiance.__executedCpuTime;
|
|
45
104
|
|
|
46
105
|
console.log(`Baked ${probe_count} probes in ${duration}ms, ~${(duration / probe_count).toFixed(2)}ms per probe`);
|
|
47
106
|
|
|
48
|
-
})
|
|
107
|
+
});
|
|
49
108
|
|
|
50
109
|
const tFinish = actionTask(() => {
|
|
51
110
|
renderer.bake_end();
|
|
@@ -53,11 +112,11 @@ export class LightProbeVolumeBaker {
|
|
|
53
112
|
lpv.incrementVersion();
|
|
54
113
|
});
|
|
55
114
|
|
|
56
|
-
tFinish.addDependency(
|
|
57
|
-
|
|
115
|
+
tFinish.addDependency(tBakeIrradiance);
|
|
116
|
+
tBakeIrradiance.addDependency(tPrepare);
|
|
58
117
|
|
|
59
118
|
return new TaskGroup([
|
|
60
|
-
tPrepare,
|
|
119
|
+
tPrepare, tBakeIrradiance, tFinish
|
|
61
120
|
], "LightProbeVolume Bake");
|
|
62
121
|
}
|
|
63
122
|
}
|
|
@@ -4,6 +4,16 @@ export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
|
4
4
|
random: () => number;
|
|
5
5
|
scene: PathTracedScene;
|
|
6
6
|
bake_depth(position: any, position_offset: any, output: any, output_offset: any): void;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {number} resolution
|
|
10
|
+
* @param {number} max_depth
|
|
11
|
+
* @param {number[]} position
|
|
12
|
+
* @param {number} position_offset
|
|
13
|
+
* @param {number[]} output
|
|
14
|
+
* @param {number} output_offset
|
|
15
|
+
*/
|
|
16
|
+
bake_depth_octahedral(resolution: number, max_depth: number, position: number[], position_offset: number, output: number[], output_offset: number): void;
|
|
7
17
|
bake(position: any, position_offset: any, output: any, output_offset: any): void;
|
|
8
18
|
bake_start(): void;
|
|
9
19
|
build_scene(ecd: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathTracerProbeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PathTracerProbeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js"],"names":[],"mappings":"AAwBA;IACI,mBAA0B;IAC1B,qBAAmB;IACnB,qBAAyB;IAEzB,uBAA6B;IAE7B,uFAoBC;IAED;;;;;;;;OAQG;IACH,kCAPW,MAAM,aACN,MAAM,YACN,MAAM,EAAE,mBACR,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,QAahB;IAED,iFAqCC;IAKD,mBACC;IAED,4BAKC;CACJ;8BA/G6B,oBAAoB;2BAJvB,8BAA8B;gCADzB,mCAAmC"}
|
|
@@ -8,15 +8,12 @@ import { sh3_vector_accumulate } from "../../../../core/geom/3d/sphere/harmonics
|
|
|
8
8
|
import { randomPointOnSphere } from "../../../../core/geom/random/randomPointOnSphere.js";
|
|
9
9
|
import { vector_scale_array } from "../../../../core/geom/vec/vector_scale_array.js";
|
|
10
10
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
11
|
-
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
12
|
-
import { Light } from "../../ecs/light/Light.js";
|
|
13
|
-
import { LightType } from "../../ecs/light/LightType.js";
|
|
14
|
-
import { ShadedGeometry } from "../../ecs/mesh-v2/ShadedGeometry.js";
|
|
15
|
-
import { DirectionalLight } from "../../render/forward_plus/model/DirectionalLight.js";
|
|
16
11
|
import { PathTracedScene } from "../path_tracer/PathTracedScene.js";
|
|
17
12
|
import { PathTracer } from "../path_tracer/PathTracer.js";
|
|
13
|
+
import { populate_path_traced_scene_from_ecd } from "../path_tracer/populate_path_traced_scene_from_ecd.js";
|
|
14
|
+
import { bake_octahedral_depth_map } from "./depth/octahedral/bake_octahedral_depth_map.js";
|
|
15
|
+
import { sh3_bake_depth } from "./depth/sh3_bake_depth.js";
|
|
18
16
|
import { ProbeRenderer } from "./ProbeRenderer.js";
|
|
19
|
-
import { sh3_bake_depth } from "./sh3_bake_depth.js";
|
|
20
17
|
|
|
21
18
|
const __shared_buffer = new ArrayBuffer((27 + 9) * 8);
|
|
22
19
|
const sh_basis = new Float64Array(__shared_buffer, 0, 9);
|
|
@@ -27,7 +24,7 @@ const sampled_irradiance = new Float32Array(3);
|
|
|
27
24
|
|
|
28
25
|
export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
29
26
|
tracer = new PathTracer();
|
|
30
|
-
sample_count =
|
|
27
|
+
sample_count = 192;
|
|
31
28
|
random = seededRandom(0);
|
|
32
29
|
|
|
33
30
|
scene = new PathTracedScene()
|
|
@@ -54,6 +51,28 @@ export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
|
54
51
|
|
|
55
52
|
}
|
|
56
53
|
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @param {number} resolution
|
|
57
|
+
* @param {number} max_depth
|
|
58
|
+
* @param {number[]} position
|
|
59
|
+
* @param {number} position_offset
|
|
60
|
+
* @param {number[]} output
|
|
61
|
+
* @param {number} output_offset
|
|
62
|
+
*/
|
|
63
|
+
bake_depth_octahedral(
|
|
64
|
+
resolution, max_depth,
|
|
65
|
+
position, position_offset,
|
|
66
|
+
output, output_offset
|
|
67
|
+
) {
|
|
68
|
+
bake_octahedral_depth_map(
|
|
69
|
+
output, output_offset,
|
|
70
|
+
this.scene,
|
|
71
|
+
position, position_offset,
|
|
72
|
+
resolution, max_depth
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
57
76
|
bake(position, position_offset, output, output_offset) {
|
|
58
77
|
|
|
59
78
|
|
|
@@ -102,40 +121,7 @@ export class PathTracerProbeRenderer extends ProbeRenderer {
|
|
|
102
121
|
build_scene(ecd) {
|
|
103
122
|
|
|
104
123
|
const scene = this.scene;
|
|
105
|
-
|
|
106
|
-
ecd.traverseEntities([ShadedGeometry, Transform],
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
-
* @param {ShadedGeometry} sg
|
|
110
|
-
* @param {Transform} transform
|
|
111
|
-
*/
|
|
112
|
-
(sg, transform) => {
|
|
113
|
-
|
|
114
|
-
scene.createMesh(sg.geometry, sg.material, transform.matrix)
|
|
115
|
-
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
ecd.traverseEntities([Light, Transform],
|
|
120
|
-
/**
|
|
121
|
-
*
|
|
122
|
-
* @param {Light} light
|
|
123
|
-
* @param {Transform} transform
|
|
124
|
-
*/
|
|
125
|
-
(light, transform) => {
|
|
126
|
-
|
|
127
|
-
if (light.type.getValue() === LightType.DIRECTION) {
|
|
128
|
-
|
|
129
|
-
const l = new DirectionalLight();
|
|
130
|
-
|
|
131
|
-
l.color.copy(light.color);
|
|
132
|
-
l.direction.copy(transform.forward);
|
|
133
|
-
l.intensity.copy(light.intensity);
|
|
134
|
-
|
|
135
|
-
scene.addLight(l);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
});
|
|
124
|
+
populate_path_traced_scene_from_ecd(ecd, scene);
|
|
139
125
|
|
|
140
126
|
}
|
|
141
127
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class OctahedralDepthDebuggerWidget {
|
|
2
|
+
update(): void;
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @returns {Entity}
|
|
6
|
+
*/
|
|
7
|
+
get entity(): Entity;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {EntityComponentDataset} ecd
|
|
11
|
+
* @param {Engine} engine
|
|
12
|
+
*/
|
|
13
|
+
build(ecd: EntityComponentDataset, engine: Engine): void;
|
|
14
|
+
#private;
|
|
15
|
+
}
|
|
16
|
+
import Entity from "../../../../../ecs/Entity.js";
|
|
17
|
+
//# sourceMappingURL=OctahedralDepthDebuggerWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OctahedralDepthDebuggerWidget.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/sh3/lpv/depth/octahedral/OctahedralDepthDebuggerWidget.js"],"names":[],"mappings":"AAUA;IA6CI,eAYC;IAED;;;OAGG;IACH,qBAEC;IAED;;;;OAIG;IACH,yDAeC;;CAEJ;mBAjGkB,8BAA8B"}
|