@woosh/meep-engine 2.109.6 → 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 +203 -174
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +203 -174
- 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/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/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
|
@@ -20,6 +20,11 @@ export class LightProbeVolumeSerializationAdapter extends BinaryClassSerializati
|
|
|
20
20
|
// probe values
|
|
21
21
|
buffer.writeFloat32Array(value.harmonics, 0, count * 27);
|
|
22
22
|
|
|
23
|
+
// depth
|
|
24
|
+
const depth_resolution = value.depth_map_resolution;
|
|
25
|
+
buffer.writeUint32(depth_resolution);
|
|
26
|
+
buffer.writeFloat32Array(value.depth, 0, depth_resolution * depth_resolution * count);
|
|
27
|
+
|
|
23
28
|
value.mesh.serialize(buffer);
|
|
24
29
|
}
|
|
25
30
|
|
|
@@ -38,6 +43,9 @@ export class LightProbeVolumeSerializationAdapter extends BinaryClassSerializati
|
|
|
38
43
|
buffer.readFloat32Array(value.points, 0, count * 3);
|
|
39
44
|
buffer.readFloat32Array(value.harmonics, 0, count * 27);
|
|
40
45
|
|
|
46
|
+
// depth
|
|
47
|
+
const depth_resolution = buffer.readUint32();
|
|
48
|
+
buffer.readFloat32Array(value.depth, 0, depth_resolution * depth_resolution * count);
|
|
41
49
|
|
|
42
50
|
value.mesh.deserialize(buffer);
|
|
43
51
|
}
|
|
@@ -30,9 +30,9 @@ export class BufferedGeometryBVH {
|
|
|
30
30
|
private __triangle_count;
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
33
|
-
* @param {THREE.BufferGeometry}
|
|
33
|
+
* @param {THREE.BufferGeometry} geo
|
|
34
34
|
*/
|
|
35
|
-
build(
|
|
35
|
+
build(geo: THREE.BufferGeometry): void;
|
|
36
36
|
/**
|
|
37
37
|
* Tests ray for occlusion
|
|
38
38
|
* Returns true if ray hits anything at all
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BufferedGeometryBVH.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BufferedGeometryBVH.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js"],"names":[],"mappings":"AAyBA;IAkBI;;;OAGG;IACH,eAFW,KAAK,GAAC,MAAM,EAAE,QAIxB;IAIG;;;;OAIG;IACH,mBAAsB;IAEtB;;;;OAIG;IACH,yBAA4B;IAE5B;;;;OAIG;IACH,6BAAgC;IAGhC;;;;OAIG;IACH,yBAAyB;IAG7B;;;OAGG;IACH,WAFW,MAAM,cAAc,QAwC9B;IAED;;;;;OAKG;IACH,qBAFa,OAAO,CAkDnB;IAED;;;;;OAKG;IACH,gBAJW,MAAM,EAAE,OACR,MAAM,EAAE,OAAK,GACX,MAAM,CA2ElB;;CACJ;sBAnQqB,wCAAwC"}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
computeTriangleRayIntersectionBarycentricGeometry
|
|
9
9
|
} from "../../../../core/geom/3d/triangle/computeTriangleRayIntersectionBarycentricGeometry.js";
|
|
10
10
|
import Vector4 from "../../../../core/geom/Vector4.js";
|
|
11
|
+
import { makeGeometryIndexed } from "../../geometry/buffered/makeGeometryIndexed.js";
|
|
11
12
|
import { computeBoundingSphereFromVertexData } from "../../geometry/computeBoundingSphereFromVertexData.js";
|
|
12
13
|
import { construct_ray_hit_from_geometry } from "./geometry/construct_ray_hit_from_geometry.js";
|
|
13
14
|
|
|
@@ -82,16 +83,18 @@ export class BufferedGeometryBVH {
|
|
|
82
83
|
|
|
83
84
|
/**
|
|
84
85
|
*
|
|
85
|
-
* @param {THREE.BufferGeometry}
|
|
86
|
+
* @param {THREE.BufferGeometry} geo
|
|
86
87
|
*/
|
|
87
|
-
build(
|
|
88
|
-
|
|
88
|
+
build(geo) {
|
|
89
|
+
makeGeometryIndexed(geo);
|
|
89
90
|
|
|
90
|
-
|
|
91
|
+
this.__geometry = geo;
|
|
92
|
+
|
|
93
|
+
const index = geo.getIndex();
|
|
91
94
|
const index_array = index.array;
|
|
92
95
|
|
|
93
96
|
|
|
94
|
-
const attribute_position =
|
|
97
|
+
const attribute_position = geo.getAttribute('position');
|
|
95
98
|
const array_positions = attribute_position.array;
|
|
96
99
|
|
|
97
100
|
this.__geometry_positions = array_positions;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {EntityComponentDataset} ecd
|
|
4
|
+
* @param {PathTracedScene} scene
|
|
5
|
+
*/
|
|
6
|
+
export function populate_path_traced_scene_from_ecd(ecd: EntityComponentDataset, scene: PathTracedScene): void;
|
|
7
|
+
//# sourceMappingURL=populate_path_traced_scene_from_ecd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"populate_path_traced_scene_from_ecd.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/populate_path_traced_scene_from_ecd.js"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,+GAqCC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
3
|
+
import { Light } from "../../ecs/light/Light.js";
|
|
4
|
+
import { LightType } from "../../ecs/light/LightType.js";
|
|
5
|
+
import { ShadedGeometry } from "../../ecs/mesh-v2/ShadedGeometry.js";
|
|
6
|
+
import { DirectionalLight } from "../../render/forward_plus/model/DirectionalLight.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {EntityComponentDataset} ecd
|
|
11
|
+
* @param {PathTracedScene} scene
|
|
12
|
+
*/
|
|
13
|
+
export function populate_path_traced_scene_from_ecd(ecd, scene) {
|
|
14
|
+
assert.defined(ecd, 'ecd');
|
|
15
|
+
assert.defined(scene, 'scene');
|
|
16
|
+
|
|
17
|
+
ecd.traverseEntities([ShadedGeometry, Transform],
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {ShadedGeometry} sg
|
|
21
|
+
* @param {Transform} transform
|
|
22
|
+
*/
|
|
23
|
+
(sg, transform) => {
|
|
24
|
+
|
|
25
|
+
scene.createMesh(sg.geometry, sg.material, transform.matrix)
|
|
26
|
+
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
ecd.traverseEntities([Light, Transform],
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param {Light} light
|
|
34
|
+
* @param {Transform} transform
|
|
35
|
+
*/
|
|
36
|
+
(light, transform) => {
|
|
37
|
+
|
|
38
|
+
if (light.type.getValue() === LightType.DIRECTION) {
|
|
39
|
+
|
|
40
|
+
const l = new DirectionalLight();
|
|
41
|
+
|
|
42
|
+
l.color.copy(light.color);
|
|
43
|
+
l.direction.copy(transform.forward);
|
|
44
|
+
l.intensity.copy(light.intensity);
|
|
45
|
+
|
|
46
|
+
scene.addLight(l);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -67,8 +67,8 @@ vCanvas.css({
|
|
|
67
67
|
* How many rays to use per-pixel
|
|
68
68
|
* @type {number}
|
|
69
69
|
*/
|
|
70
|
-
const PIXEL_SAMPLE_COUNT =
|
|
71
|
-
const PIXEL_RENDER_RATIO =
|
|
70
|
+
const PIXEL_SAMPLE_COUNT = 1;
|
|
71
|
+
const PIXEL_RENDER_RATIO = 0.5;
|
|
72
72
|
|
|
73
73
|
const scene = new PathTracedScene();
|
|
74
74
|
const pt = new PathTracer();
|
|
@@ -201,6 +201,42 @@ async function prepare_gi_box_scene(scene, camera) {
|
|
|
201
201
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
/**
|
|
205
|
+
*
|
|
206
|
+
* @param {PathTracedScene} scene
|
|
207
|
+
* @param {THREE.Camera} camera
|
|
208
|
+
* @returns {Promise<void>}
|
|
209
|
+
*/
|
|
210
|
+
async function prepare_attic_scene(scene, camera) {
|
|
211
|
+
const path = 'data/models/samples/the_attic_environment/scene1.gltf';
|
|
212
|
+
await prepare_scene_gltf({
|
|
213
|
+
scene: scene,
|
|
214
|
+
camera: camera,
|
|
215
|
+
url: path,
|
|
216
|
+
sun: {
|
|
217
|
+
direction: new Vector3(1.2, -1, 0.2)
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const transform = Transform.fromJSON({
|
|
222
|
+
"position": {
|
|
223
|
+
"x": -11.027168212431539,
|
|
224
|
+
"y": 1.0396201881596159,
|
|
225
|
+
"z": -2.9677969519799223
|
|
226
|
+
},
|
|
227
|
+
"rotation": {
|
|
228
|
+
"x": 0.024907147178871554,
|
|
229
|
+
"y": -0.08487115365830479,
|
|
230
|
+
"z": 0.0021222209892540838,
|
|
231
|
+
"w": 0.9960783189459508
|
|
232
|
+
},
|
|
233
|
+
"scale": { "x": 1, "y": 1, "z": 1 }
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
set_camera_from_transform(camera, transform);
|
|
237
|
+
|
|
238
|
+
}
|
|
239
|
+
|
|
204
240
|
/**
|
|
205
241
|
*
|
|
206
242
|
* @param {PathTracedScene} scene
|
|
@@ -505,8 +541,9 @@ async function start_renderer(camera) {
|
|
|
505
541
|
// await prepare_scene_lucy(scene, camera);
|
|
506
542
|
// await prepare_scene_rtiow(pt, camera);
|
|
507
543
|
// await prepare_scene_sphere_01(pt, camera);
|
|
508
|
-
await prepare_gi_box_scene(scene, camera);
|
|
544
|
+
// await prepare_gi_box_scene(scene, camera);
|
|
509
545
|
// await prepare_sponza(scene, camera);
|
|
546
|
+
await prepare_attic_scene(scene, camera);
|
|
510
547
|
// await prepare_scene_gltf({scene, camera, path, url: path});
|
|
511
548
|
|
|
512
549
|
|
package/src/engine/graphics/sh3/path_tracer/sorting/build_bvh_nodes_distances_along_ray.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_bvh_nodes_distances_along_ray.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/sorting/build_bvh_nodes_distances_along_ray.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AACH,4DAXW,MAAM,EAAE,iBACR,MAAM,uBAEN,MAAM,EAAE,oBACR,MAAM,kBACN,MAAM,kBACN,MAAM,kBACN,MAAM,kBACN,MAAM,gBACN,MAAM,QA4BhB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ELEMENT_WORD_COUNT } from "
|
|
1
|
+
import { ELEMENT_WORD_COUNT } from "../../../../../core/bvh2/bvh3/BVH.js";
|
|
2
2
|
import {
|
|
3
3
|
aabb3_compute_distance_above_plane_min
|
|
4
|
-
} from "
|
|
4
|
+
} from "../../../../../core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
package/src/engine/graphics/sh3/path_tracer/sorting/build_bvh_nodes_distances_sqr_to_point.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_bvh_nodes_distances_sqr_to_point.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/sorting/build_bvh_nodes_distances_sqr_to_point.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,+DAVW,MAAM,EAAE,iBACR,MAAM,uBAEN,MAAM,EAAE,oBACR,MAAM,kBACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QA2BhB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ELEMENT_WORD_COUNT } from "
|
|
1
|
+
import { ELEMENT_WORD_COUNT } from "../../../../../core/bvh2/bvh3/BVH.js";
|
|
2
2
|
import {
|
|
3
3
|
aabb3_unsigned_distance_sqr_to_point
|
|
4
|
-
} from "
|
|
4
|
+
} from "../../../../../core/geom/3d/aabb/aabb3_unsigned_distance_sqr_to_point.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
package/src/engine/graphics/sh3/path_tracer/sorting/sort_bvh_nodes_by_distance_to_point.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort_bvh_nodes_by_distance_to_point.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/sorting/sort_bvh_nodes_by_distance_to_point.js"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,yEAPW,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,kBACN,MAAM,SACN,MAAM,SACN,MAAM,SACN,MAAM,QA+BhB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ELEMENT_WORD_COUNT } from "
|
|
2
|
-
import { arrayQuickSort } from "
|
|
1
|
+
import { ELEMENT_WORD_COUNT } from "../../../../../core/bvh2/bvh3/BVH.js";
|
|
2
|
+
import { arrayQuickSort } from "../../../../../core/collection/array/arrayQuickSort.js";
|
|
3
3
|
import {
|
|
4
4
|
aabb3_unsigned_distance_sqr_to_point
|
|
5
|
-
} from "
|
|
5
|
+
} from "../../../../../core/geom/3d/aabb/aabb3_unsigned_distance_sqr_to_point.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -52,6 +52,8 @@ import { three_object_to_entity_composition } from "../ecs/mesh-v2/three_object_
|
|
|
52
52
|
import { GizmoRenderingPlugin } from "../render/gizmo/GizmoRenderingPlugin.js";
|
|
53
53
|
import { MaterialTransformer } from "./gi/material/MaterialTransformer.js";
|
|
54
54
|
import { build_probes_for_scene } from "./lpv/build_probes_for_scene.js";
|
|
55
|
+
import { OctahedralDepthDebuggerWidget } from "./lpv/depth/octahedral/OctahedralDepthDebuggerWidget.js";
|
|
56
|
+
import { VLPDepthMapVisualisation } from "./lpv/depth/octahedral/v2/VLPDepthMapVisualisation.js";
|
|
55
57
|
import { LightProbeVolume } from "./lpv/LightProbeVolume.js";
|
|
56
58
|
import { LightProbeVolumeSerializationAdapter } from "./lpv/serialization/LightProbeVolumeSerializationAdapter.js";
|
|
57
59
|
|
|
@@ -218,7 +220,7 @@ async function getVolume({
|
|
|
218
220
|
const adapter = new LightProbeVolumeSerializationAdapter();
|
|
219
221
|
|
|
220
222
|
if (await engine.storage.promiseContains(key)
|
|
221
|
-
&& false // TODO re-enable
|
|
223
|
+
// && false // TODO re-enable
|
|
222
224
|
) {
|
|
223
225
|
const data = await engine.storage.promiseLoadBinary(key);
|
|
224
226
|
|
|
@@ -360,7 +362,6 @@ async function main(engine) {
|
|
|
360
362
|
|
|
361
363
|
|
|
362
364
|
// const path = 'data/models/samples/sd_macross_city_standoff_diorama/scene.gltf';
|
|
363
|
-
// const path = 'data/models/LowPolyTownshipSet/Small_house/Small_house.gltf';
|
|
364
365
|
// const path = 'data/models/sibenik/2/model.gltf';
|
|
365
366
|
// const path = 'data/models/vokselia_spawn/model.gltf';
|
|
366
367
|
// const path = 'data/models/LowPolyTownshipSet/Town_Hall/model.gltf';
|
|
@@ -370,16 +371,17 @@ async function main(engine) {
|
|
|
370
371
|
// const path = 'data/models/samples/cornell_box/scene.gltf';
|
|
371
372
|
// const path = 'data/models/Slaughter Mech/Slaugter Mech.gltf';
|
|
372
373
|
// const path = 'data/models/samples/gi_box_01/model-thick-1.glb';
|
|
373
|
-
// const path = 'data/models/sibenik/3-window-less/model.gltf';
|
|
374
374
|
// const path = 'data/models/samples/ancient_bath_house_-_modular_set/scene.gltf';
|
|
375
375
|
// const path = 'data/models/samples/environment_-_library/scene.gltf';
|
|
376
|
-
// const path = 'data/models/samples/the_attic_environment/scene1.gltf';
|
|
377
|
-
// const path = 'data/models/samples/cyberpunk_bike/scene.gltf';
|
|
378
|
-
const path = 'data/models/sponza-pbr/gltf/sponza.glb';
|
|
379
|
-
// const path = 'data/models/samples/gi_box_01/model.glb';
|
|
380
376
|
// const path = 'data/models/Scans/green_car_wreck/scene.gltf';
|
|
381
377
|
// const path = 'data/models/pica_pica/pica_pica.gltf';
|
|
378
|
+
// const path = 'data/models/sibenik/3-window-less/model.gltf';
|
|
382
379
|
// const path = 'data/models/samples/low_poly_classroom/no-glass/model.gltf';
|
|
380
|
+
// const path = 'data/models/samples/the_attic_environment/scene1.gltf';
|
|
381
|
+
// const path = 'data/models/LowPolyTownshipSet/Small_house/Small_house.gltf';
|
|
382
|
+
// const path = 'data/models/samples/cyberpunk_bike/scene.gltf';
|
|
383
|
+
// const path = 'data/models/sponza-pbr/gltf/sponza.glb';
|
|
384
|
+
const path = 'data/models/samples/gi_box_01/model.glb';
|
|
383
385
|
|
|
384
386
|
const mesh_asset = await engine.assetManager.promise(path, 'model/gltf+json');
|
|
385
387
|
const gltf = mesh_asset.gltf;
|
|
@@ -498,6 +500,8 @@ async function main(engine) {
|
|
|
498
500
|
opacity: 0.5
|
|
499
501
|
});
|
|
500
502
|
|
|
503
|
+
const depth_viz = VLPDepthMapVisualisation.from(volume).build();
|
|
504
|
+
|
|
501
505
|
// volume.visualize_mesh({ ecd, opacity: 0.5 });
|
|
502
506
|
|
|
503
507
|
const gui = new GUI();
|
|
@@ -536,12 +540,41 @@ async function main(engine) {
|
|
|
536
540
|
}
|
|
537
541
|
}, "mesh_vis").name("Visualise Mesh");
|
|
538
542
|
|
|
543
|
+
gui.add({
|
|
544
|
+
get depth_vis() {
|
|
545
|
+
return depth_viz.isBuilt
|
|
546
|
+
},
|
|
547
|
+
set depth_vis(v) {
|
|
548
|
+
if (v) {
|
|
549
|
+
depth_viz.build(ecd);
|
|
550
|
+
} else {
|
|
551
|
+
depth_viz.destroy();
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}, "depth_vis").name("Visualise Depth");
|
|
555
|
+
|
|
556
|
+
// makeDebugGizmo(engine, mesh_bounds.getCenter());
|
|
557
|
+
|
|
539
558
|
|
|
540
559
|
// mesh_entity.addEventListener(SGMeshEvents.AssetLoaded, build);
|
|
541
560
|
//
|
|
542
561
|
// mesh_entity.build(ecd);
|
|
543
562
|
}
|
|
544
563
|
|
|
564
|
+
/**
|
|
565
|
+
*
|
|
566
|
+
* @param {Engine} engine
|
|
567
|
+
* @param {Vector3} position
|
|
568
|
+
*/
|
|
569
|
+
function makeDebugGizmo(engine, position) {
|
|
570
|
+
|
|
571
|
+
const widget = new OctahedralDepthDebuggerWidget();
|
|
572
|
+
|
|
573
|
+
widget.entity.getComponentSafe(Transform).position.copy(position);
|
|
574
|
+
|
|
575
|
+
widget.build(engine.entityManager.dataset, engine);
|
|
576
|
+
}
|
|
577
|
+
|
|
545
578
|
new EngineHarness().initialize({
|
|
546
579
|
configuration(config, engine) {
|
|
547
580
|
config.addSystem(new ShadedGeometrySystem(engine));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SH3VisualisationMaterial.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/shader/SH3VisualisationMaterial.js"],"names":[],"mappings":"AAIA;IAEI,cAoBC;CAEJ;+BA5BuC,OAAO"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ShaderMaterial, Vector3 } from "three";
|
|
2
|
+
import shader_fg from './visualize.frag.glsl';
|
|
3
|
+
import shader_vx from './visualize.vert.glsl';
|
|
4
|
+
|
|
5
|
+
export class SH3VisualisationMaterial extends ShaderMaterial {
|
|
6
|
+
|
|
7
|
+
constructor() {
|
|
8
|
+
const sh = [];
|
|
9
|
+
|
|
10
|
+
for (let i = 0; i < 9; i++) {
|
|
11
|
+
sh.push(new Vector3());
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
super({
|
|
15
|
+
fragmentShader: shader_fg,
|
|
16
|
+
vertexShader: shader_vx,
|
|
17
|
+
lights: false,
|
|
18
|
+
uniforms: {
|
|
19
|
+
intensity: {
|
|
20
|
+
value: 1,
|
|
21
|
+
},
|
|
22
|
+
sh: {
|
|
23
|
+
value: sh
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#define RECIPROCAL_PI 0.318309886
|
|
2
|
+
|
|
3
|
+
vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {
|
|
4
|
+
// matrix is assumed to be orthogonal
|
|
5
|
+
return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf
|
|
9
|
+
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
10
|
+
// normal is assumed to have unit length
|
|
11
|
+
float x = normal.x, y = normal.y, z = normal.z;
|
|
12
|
+
|
|
13
|
+
// band 0
|
|
14
|
+
vec3 result = shCoefficients[ 0 ] * 0.8862269254527579;
|
|
15
|
+
|
|
16
|
+
// band 1
|
|
17
|
+
result -= shCoefficients[ 1 ] * 1.0233267079464885 * y;
|
|
18
|
+
result += shCoefficients[ 2 ] * 1.0233267079464885 * z;
|
|
19
|
+
result -= shCoefficients[ 3 ] * 1.0233267079464885 * x;
|
|
20
|
+
|
|
21
|
+
// band 2
|
|
22
|
+
result += shCoefficients[ 4 ] * 0.8580855308097834 * x * y;
|
|
23
|
+
result -= shCoefficients[ 5 ] * 0.8580855308097834 * y * z;
|
|
24
|
+
result += shCoefficients[ 6 ] * ( 0.7431238683011272 * z * z - 0.24770795610037571 );
|
|
25
|
+
result -= shCoefficients[ 7 ] * 0.8580855308097834 * x * z;
|
|
26
|
+
result += shCoefficients[ 8 ] * 0.4290427654048917 * ( x * x - y * y );
|
|
27
|
+
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
uniform vec3 sh[ 9 ]; // sh coefficients
|
|
32
|
+
uniform float intensity; // light probe intensity
|
|
33
|
+
varying vec3 vNormal;
|
|
34
|
+
|
|
35
|
+
void main() {
|
|
36
|
+
vec3 normal = normalize( vNormal );
|
|
37
|
+
vec3 worldNormal = normalize(inverseTransformDirection( normal, viewMatrix ));
|
|
38
|
+
vec3 irradiance = shGetIrradianceAt( worldNormal, sh );
|
|
39
|
+
vec3 outgoingLight = 1.0 * irradiance * intensity;
|
|
40
|
+
gl_FragColor = linearToOutputTexel( vec4( outgoingLight, 1.0 ) );
|
|
41
|
+
}
|
|
@@ -3,7 +3,7 @@ import Entity from "../../ecs/Entity.js";
|
|
|
3
3
|
import { Transform } from "../../ecs/transform/Transform.js";
|
|
4
4
|
import { ShadedGeometry } from "../ecs/mesh-v2/ShadedGeometry.js";
|
|
5
5
|
import { ShadedGeometryFlags } from "../ecs/mesh-v2/ShadedGeometryFlags.js";
|
|
6
|
-
import { SH3VisualisationMaterial } from "./SH3VisualisationMaterial.js";
|
|
6
|
+
import { SH3VisualisationMaterial } from "./shader/SH3VisualisationMaterial.js";
|
|
7
7
|
|
|
8
8
|
const geometry = new OctahedronBufferGeometry(1, 5);
|
|
9
9
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Useful tool for previewing textures
|
|
3
|
+
* @param {THREE.Texture} texture
|
|
4
|
+
* @param {number} resolution
|
|
5
|
+
* @param {boolean} flipY
|
|
6
|
+
*/
|
|
7
|
+
export function debug_preview_texture({ texture, resolution, flipY }: THREE.Texture): void;
|
|
8
|
+
//# sourceMappingURL=debug_preview_texture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug_preview_texture.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/texture/debug_preview_texture.js"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,sEAJW,MAAM,OAAO,QA+BvB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FrameRunner } from "../FrameRunner.js";
|
|
2
|
+
import { WebGLRendererPool } from "../render/RendererPool.js";
|
|
3
|
+
import { buildCanvasViewFromTexture } from "../render/visibility/hiz/buildCanvasViewFromTexture.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Useful tool for previewing textures
|
|
7
|
+
* @param {THREE.Texture} texture
|
|
8
|
+
* @param {number} resolution
|
|
9
|
+
* @param {boolean} flipY
|
|
10
|
+
*/
|
|
11
|
+
export function debug_preview_texture({
|
|
12
|
+
texture,
|
|
13
|
+
resolution = 512,
|
|
14
|
+
flipY = true
|
|
15
|
+
}) {
|
|
16
|
+
|
|
17
|
+
const preview = buildCanvasViewFromTexture({
|
|
18
|
+
width: resolution,
|
|
19
|
+
height: resolution,
|
|
20
|
+
texture: texture,
|
|
21
|
+
renderer: WebGLRendererPool.global.get(),
|
|
22
|
+
flipY: flipY
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const runner = new FrameRunner(() => {
|
|
26
|
+
|
|
27
|
+
preview.render();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
runner.startup();
|
|
31
|
+
|
|
32
|
+
document.body.appendChild(
|
|
33
|
+
preview.view.el
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
preview.view.link();
|
|
37
|
+
|
|
38
|
+
}
|
package/src/view/View.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../../src/view/View.js"],"names":[],"mappings":"wBAsBU,MAAM;;;;;;;AAchB;;;GAGG;AACH;IAEI;;;;OAIG;IACH,iBAAc;IAEd;;;OAGG;IACH,OAFU,SAAS,GAAC,MAAM,CAEJ;IAEtB;;;OAGG;IACH,mBAFU,OAAO,CAEY;IAE7B;;;OAGG;IACH,mBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,0BAFU,OAAO,CAEuB;IAExC;;;MAGE;IAEF;;;OAGG;IACH,UAFU,IAAI,EAAE,CAEF;IAEd;;;OAGG;IACH,QAFU,IAAI,GAAC,IAAI,CAEL;IAUV;;;OAGG;IACH,IAFU,OAAO,qBAAiB,IAAI,CAExB;IAUlB;;OAEG;IACH,wBAEC;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,0BASC;IAED;;;OAGG;IACH,uBAEC;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,SAAS,GACd,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,SAAS,GACd,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,SAAS,SAChB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,SAAS,GACd,OAAO,CAInB;IAED;;;;;OAKG;IACH,6BAIC;IAED;;;;;OAKG;IACH,wBAKC;IAED;;;OAGG;IACH,0BAQC;IA8BD;;OAEG;IACH,aA+BC;IAED;;OAEG;IACH,eA6BC;IAED;;;OAGG;IACH,sBAFW,IAAI,EAAE,QAMhB;IAED;;;;OAIG;IACH,gBAHW,IAAI,GACF,IAAI,
|
|
1
|
+
{"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../../src/view/View.js"],"names":[],"mappings":"wBAsBU,MAAM;;;;;;;AAchB;;;GAGG;AACH;IAEI;;;;OAIG;IACH,iBAAc;IAEd;;;OAGG;IACH,OAFU,SAAS,GAAC,MAAM,CAEJ;IAEtB;;;OAGG;IACH,mBAFU,OAAO,CAEY;IAE7B;;;OAGG;IACH,mBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,gBAFU,OAAO,CAES;IAE1B;;;OAGG;IACH,eAFU,OAAO,CAEQ;IAEzB;;;;OAIG;IACH,0BAFU,OAAO,CAEuB;IAExC;;;MAGE;IAEF;;;OAGG;IACH,UAFU,IAAI,EAAE,CAEF;IAEd;;;OAGG;IACH,QAFU,IAAI,GAAC,IAAI,CAEL;IAUV;;;OAGG;IACH,IAFU,OAAO,qBAAiB,IAAI,CAExB;IAUlB;;OAEG;IACH,wBAEC;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,0BASC;IAED;;;OAGG;IACH,uBAEC;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,SAAS,GACd,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,SAAS,GACd,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,SAAS,SAChB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,SAAS,GACd,OAAO,CAInB;IAED;;;;;OAKG;IACH,6BAIC;IAED;;;;;OAKG;IACH,wBAKC;IAED;;;OAGG;IACH,0BAQC;IA8BD;;OAEG;IACH,aA+BC;IAED;;OAEG;IACH,eA6BC;IAED;;;OAGG;IACH,sBAFW,IAAI,EAAE,QAMhB;IAED;;;;OAIG;IACH,gBAHW,IAAI,GACF,IAAI,CAqBhB;IAED;;;;;;;;OAQG;IACH,uBAPW,OAAO,WACP,MAAM,WACN,MAAM,cACN,MAAM,cACN,MAAM,UACN,OAAO,QAYjB;IAED;;;;;;;OAOG;IACH,kBANW,IAAI,WACJ,MAAM,WACN,MAAM,cACN,MAAM,cACN,MAAM,QAahB;IAED;;;;OAIG;IACH,mBAHW,IAAI,GACF,OAAO,CAmBnB;IAED;;;;OAIG;IACH,gBAHW,IAAI,GACF,OAAO,CAInB;IAED,0BAUC;IAED;;;;;OAKG;IACH,kBAJW,KAAK,WACL,MAAM,WACN,MAAM,QAkBhB;IAED;;;;OAIG;IACH,4BAHW,KAAK,GACH,KAAK,CAUjB;IAED,4BAaC;IAED;;;;;OAKG;IACH,6BAJW,OAAO,UACP,OAAO,GACL,OAAO,CAanB;IAED;;;;;OAKG;IACH,6BAJW,OAAO,UACP,OAAO,GACL,OAAO,CAanB;IAED;;;OAGG;IACH,2BAFW,OAAO,QAgBjB;IAED,gBAeC;IAED;;;;;;;OAOG;IACH,mBALW,MAAM,qCAGJ,IAAI,CAWhB;IAED;;;;;;OAMG;IACH,qBALW,MAAM,qCAGJ,OAAO,CAwBnB;IAED;;;;;;OAMG;IACH,eAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,kBAFW,MAAM,EAAE,QAalB;IAED;;;;;;OAMG;IACH,kBAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,EAAE,CA0BpB;IAED;;;;;;;;OAQG;IACH,eAJW,MAAM,QACN,OAAO,GACL,IAAI,CAMhB;IAED;;;OAGG;IACH,qBAMC;IAED;;;OAGG;IACH,sBAMC;IAED;;;;OAIG;IACH,8BAHW,OAAO,QA6BjB;IAGL;;;OAGG;IACH,iBAFU,OAAO,CAEI;;CANpB;oBApwBmB,yBAAyB;oBADzB,yBAAyB;mBAN1B,iCAAiC;kBAGlC,+BAA+B"}
|
package/src/view/View.js
CHANGED
|
@@ -358,6 +358,8 @@ class View {
|
|
|
358
358
|
assert.notNull(child, 'child');
|
|
359
359
|
assert.isInstanceOf(child, View, 'child');
|
|
360
360
|
assert.equal(child.isLinked, false, 'child is already linked somewhere');
|
|
361
|
+
assert.notEqual(child, this, 'cannot add self as a child');
|
|
362
|
+
assert.notEqual(this.parent, child, 'cannot add existing parent as a child')
|
|
361
363
|
|
|
362
364
|
child.parent = this;
|
|
363
365
|
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {number[]|Float32Array} result sh3
|
|
4
|
-
* @param {number[]} sh input
|
|
5
|
-
* @param {number[]} rotation 3x3 rotation matrix
|
|
6
|
-
*/
|
|
7
|
-
export function sh3_rotate_filament(result: number[] | Float32Array, sh: number[], rotation: number[]): void;
|
|
8
|
-
//# sourceMappingURL=sh3_rotate_filament.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sh3_rotate_filament.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh3_rotate_filament.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,4CAJW,MAAM,EAAE,GAAC,YAAY,MACrB,MAAM,EAAE,YACR,MAAM,EAAE,QAuBlB"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { sh_rotate_band1 } from "./sh_rotate_band1.js";
|
|
2
|
-
import { sh_rotate_band2 } from "./sh_rotate_band2.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @param {number[]|Float32Array} result sh3
|
|
7
|
-
* @param {number[]} sh input
|
|
8
|
-
* @param {number[]} rotation 3x3 rotation matrix
|
|
9
|
-
*/
|
|
10
|
-
export function sh3_rotate_filament(result, sh, rotation) {
|
|
11
|
-
|
|
12
|
-
// Adapted from filament https://github.com/google/filament/blob/e2da13f81734ccd6d6f9935061b771801682619e/libs/ibl/src/CubemapSH.cpp
|
|
13
|
-
|
|
14
|
-
const b0 = sh[0];
|
|
15
|
-
const band1 = [sh[1], sh[2], sh[3]];
|
|
16
|
-
const b1 = sh_rotate_band1(band1, rotation);
|
|
17
|
-
const band2 = [sh[4], sh[5], sh[6], sh[7], sh[8]];
|
|
18
|
-
const b2 = sh_rotate_band2(band2, rotation);
|
|
19
|
-
|
|
20
|
-
result[0] = b0;
|
|
21
|
-
|
|
22
|
-
result[1] = b1[0];
|
|
23
|
-
result[2] = b1[1];
|
|
24
|
-
result[3] = b1[2];
|
|
25
|
-
|
|
26
|
-
result[4] = b2[0];
|
|
27
|
-
result[5] = b2[1];
|
|
28
|
-
result[6] = b2[2];
|
|
29
|
-
result[7] = b2[3];
|
|
30
|
-
result[8] = b2[4];
|
|
31
|
-
}
|
|
32
|
-
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* utilities to rotate very low order spherical harmonics (up to 3rd band)
|
|
3
|
-
* @param {number[]} band1 vec3
|
|
4
|
-
* @param {number[]} M 3x3 matrix
|
|
5
|
-
* @returns {number[]}
|
|
6
|
-
*/
|
|
7
|
-
export function sh_rotate_band1(band1: number[], M: number[]): number[];
|
|
8
|
-
//# sourceMappingURL=sh_rotate_band1.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sh_rotate_band1.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh_rotate_band1.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,uCAJW,MAAM,EAAE,KACR,MAAM,EAAE,GACN,MAAM,EAAE,CAoCpB"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { mat3 } from "gl-matrix";
|
|
2
|
-
import { m3_multiply_vec3 } from "../../../mat3/m3_multiply_vec3.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* utilities to rotate very low order spherical harmonics (up to 3rd band)
|
|
6
|
-
* @param {number[]} band1 vec3
|
|
7
|
-
* @param {number[]} M 3x3 matrix
|
|
8
|
-
* @returns {number[]}
|
|
9
|
-
*/
|
|
10
|
-
export function sh_rotate_band1(band1, M) {
|
|
11
|
-
|
|
12
|
-
// inverse() is not constexpr -- so we pre-calculate it in mathematica
|
|
13
|
-
//
|
|
14
|
-
// constexpr float3 N0{ 1, 0, 0 };
|
|
15
|
-
// constexpr float3 N1{ 0, 1, 0 };
|
|
16
|
-
// constexpr float3 N2{ 0, 0, 1 };
|
|
17
|
-
//
|
|
18
|
-
// constexpr mat3f A1 = { // this is the projection of N0, N1, N2 to SH space
|
|
19
|
-
// float3{ -N0.y, N0.z, -N0.x },
|
|
20
|
-
// float3{ -N1.y, N1.z, -N1.x },
|
|
21
|
-
// float3{ -N2.y, N2.z, -N2.x }
|
|
22
|
-
// };
|
|
23
|
-
//
|
|
24
|
-
// const mat3f invA1 = inverse(A1);
|
|
25
|
-
|
|
26
|
-
const invA1TimesK = [
|
|
27
|
-
0, -1, 0,
|
|
28
|
-
0, 0, 1,
|
|
29
|
-
-1, 0, 0
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
const R1OverK = [
|
|
33
|
-
-M[1], M[2], -M[0],
|
|
34
|
-
-M[4], M[5], -M[3],
|
|
35
|
-
-M[7], M[8], -M[6]
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
m3_multiply_vec3(invA1TimesK, invA1TimesK, band1);
|
|
40
|
-
|
|
41
|
-
mat3.multiply(R1OverK, R1OverK, invA1TimesK);
|
|
42
|
-
|
|
43
|
-
return R1OverK;
|
|
44
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sh_rotate_band2.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh_rotate_band2.js"],"names":[],"mappings":"AAuCA;;;;;GAKG;AACH,uCAJW,MAAM,EAAE,KACR,MAAM,EAAE,GACP,MAAM,EAAE,CA0CnB"}
|