@woosh/meep-engine 2.164.0 → 2.165.1
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/README.md +137 -108
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/samples/generation/SampleGenerator0.js +3 -3
- package/samples/generation/filters/SampleGroundMoistureFilter.js +63 -56
- package/samples/generation/filters/SampleNoise20_0.js +6 -1
- package/samples/generation/themes/SampleTheme0.js +47 -47
- package/src/core/binary/BitImage2.d.ts +91 -0
- package/src/core/binary/BitImage2.d.ts.map +1 -0
- package/src/core/binary/BitImage2.js +242 -0
- package/src/core/color/YCoCg/rgb_to_ycocg.d.ts +17 -0
- package/src/core/color/YCoCg/rgb_to_ycocg.d.ts.map +1 -0
- package/src/core/color/YCoCg/rgb_to_ycocg.js +20 -0
- package/src/core/color/YCoCg/ycocg_to_rgb.d.ts +14 -0
- package/src/core/color/YCoCg/ycocg_to_rgb.d.ts.map +1 -0
- package/src/core/color/YCoCg/ycocg_to_rgb.js +17 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts +22 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts.map +1 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.js +69 -0
- package/src/core/geom/2d/packing/skyline.d.ts +116 -0
- package/src/core/geom/2d/packing/skyline.d.ts.map +1 -0
- package/src/core/geom/2d/packing/skyline.js +258 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +18 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +86 -0
- package/src/core/geom/3d/atlas/ATLAS_PORT_PLAN.md +486 -0
- package/src/core/geom/3d/atlas/BFF_PLAN.md +174 -0
- package/src/core/geom/3d/atlas/Chart.d.ts +58 -0
- package/src/core/geom/3d/atlas/Chart.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/Chart.js +77 -0
- package/src/core/geom/3d/atlas/REVIEW_02.md +392 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts +73 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.js +315 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.d.ts +17 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.js +16 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts +25 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.js +188 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts +17 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.js +107 -0
- package/src/core/geom/3d/atlas/atlas_generate.d.ts +39 -0
- package/src/core/geom/3d/atlas/atlas_generate.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_generate.js +43 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts +84 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.js +266 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts +25 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.js +36 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts +22 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.js +62 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts +9 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.js +33 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts +9 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.js +50 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts +27 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.js +39 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts +22 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.js +57 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts +36 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.js +46 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts +62 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.js +551 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts +22 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.js +73 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts +37 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.js +270 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts +23 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.js +224 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts +14 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.js +38 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts +22 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.js +86 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts +20 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.js +183 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts +27 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.js +66 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts +31 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.js +40 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts +23 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.js +136 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts +24 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.js +77 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts +27 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +113 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts +44 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.js +275 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts +22 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.js +199 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts +32 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts.map +1 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.js +64 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts +20 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.js +66 -0
- 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 +13 -11
- package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.js +4 -3
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +4 -3
- package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.js +4 -3
- package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.js +10 -6
- package/src/core/geom/3d/topology/struct/TopoMesh.js +2 -2
- package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts +0 -2
- package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/TopoTriangle.js +2 -2
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +8 -27
- package/src/core/geom/vec3/v3_cotangent.d.ts +20 -0
- package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_cotangent.js +29 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.d.ts +19 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.js +30 -0
- package/src/core/geom/vec3/v3_multiply.d.ts +16 -0
- package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_multiply.js +19 -0
- package/src/core/math/linalg/cg/cg_solve.d.ts +24 -0
- package/src/core/math/linalg/cg/cg_solve.d.ts.map +1 -0
- package/src/core/math/linalg/cg/cg_solve.js +106 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts +21 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts.map +1 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.js +59 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts +19 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts.map +1 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.js +117 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts +50 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.js +88 -0
- package/src/core/math/linalg/sparse/spm_matvec.d.ts +9 -0
- package/src/core/math/linalg/sparse/spm_matvec.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/spm_matvec.js +22 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts +12 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.js +29 -0
- package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.d.ts +39 -0
- package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.js +22 -1
- package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.js +32 -9
- package/src/core/math/physics/mie/compute_mie_phase.d.ts +2 -3
- package/src/core/math/physics/mie/compute_mie_phase.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_mie_phase.js +1 -3
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts +0 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts.map +1 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.js +0 -7
- package/src/engine/REVIEW_2026_07_03.md +211 -0
- package/src/engine/animation/curve/actionProcessorOperations/curveActions.d.ts.map +1 -1
- package/src/engine/animation/curve/actionProcessorOperations/curveActions.js +3 -2
- package/src/engine/animation/curve/compression/sample_animation_curve_to_float_array.js +1 -1
- package/src/engine/animation/keyed2/AnimationTrackPlayback.d.ts.map +1 -1
- package/src/engine/animation/keyed2/AnimationTrackPlayback.js +3 -1
- package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.js +2 -2
- package/src/engine/asset/preloader/AssetPreloader.d.ts.map +1 -1
- package/src/engine/asset/preloader/AssetPreloader.js +6 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +5 -2
- package/src/engine/ecs/Entity.js +1 -1
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +1 -0
- package/src/engine/ecs/EntityManager.js +1 -1
- package/src/engine/ecs/EntityObserver.js +1 -1
- package/src/engine/ecs/animation/AnimationClip.js +1 -1
- package/src/engine/ecs/attachment/AttachmentSystem.js +2 -2
- package/src/engine/ecs/attachment/TransformAttachmentBinding.d.ts.map +1 -1
- package/src/engine/ecs/attachment/TransformAttachmentBinding.js +14 -3
- package/src/engine/ecs/fow/FogOfWar.js +2 -2
- package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.d.ts.map +1 -1
- package/src/engine/ecs/fow/shader/screenSpaceFogOfWarShader.js +8 -0
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +3 -3
- package/src/engine/ecs/gui/position/ViewportPosition.d.ts +3 -1
- package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
- package/src/engine/ecs/gui/position/ViewportPosition.js +4 -1
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts +10 -0
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +43 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts +93 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectDeSerializer.js +315 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.d.ts +48 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/BinaryObjectSerializer.js +331 -0
- package/src/engine/ecs/storage/binary/object-v2/DESIGN.md +199 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.d.ts +53 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectBinaryFormat.js +57 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.d.ts +53 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/ObjectSerializationAdapter.js +56 -0
- package/src/engine/ecs/storage/binary/object-v2/README.md +110 -0
- package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.d.ts +13 -0
- package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/objectStringCodec.js +48 -0
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts +29 -0
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts.map +1 -0
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.js +44 -0
- package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/Terrain.js +4 -3
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +2 -2
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +9 -8
- package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics/GraphicsEngine.js +2 -1
- package/src/engine/graphics/camera/makeScreenScissorFrustum.d.ts.map +1 -1
- package/src/engine/graphics/camera/makeScreenScissorFrustum.js +11 -10
- package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.d.ts.map +1 -1
- package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.js +3 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.d.ts +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/readAnimationGraphDefinitionFromJSON.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/writeAnimationGraphDefinitionToJSON.js +2 -0
- package/src/engine/graphics/ecs/camera/Camera.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/Camera.js +4 -0
- package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.js +7 -2
- package/src/engine/graphics/ecs/camera/set_camera_aspect_ratio.js +1 -1
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +2 -2
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +2 -2
- package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.js +4 -1
- package/src/engine/graphics/ecs/light/binding/LightBinding.js +2 -2
- package/src/engine/graphics/ecs/mesh/MeshSystem.js +1 -1
- package/src/engine/graphics/ecs/mesh/SkeletonUtils.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +2 -2
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +0 -1
- package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.js +1 -1
- package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +8 -7
- package/src/engine/graphics/ecs/water/WaterSystem.d.ts +6 -0
- package/src/engine/graphics/ecs/water/WaterSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/WaterSystem.js +12 -1
- package/src/engine/graphics/geometry/MikkT/AvgTSpace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/AvgTSpace.js +11 -6
- package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +2 -3
- package/src/engine/graphics/geometry/MikkT/CalcTexArea.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/CalcTexArea.js +3 -4
- package/src/engine/graphics/geometry/MikkT/DegenEpilogue.js +4 -4
- package/src/engine/graphics/geometry/MikkT/EvalTspace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/EvalTspace.js +11 -8
- package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +7 -8
- package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +8 -8
- package/src/engine/graphics/geometry/MikkT/InitTriInfo.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/InitTriInfo.js +30 -25
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +7 -7
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts +0 -1
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.js +6 -4
- package/src/engine/graphics/geometry/MikkT/STSpace.d.ts +0 -2
- package/src/engine/graphics/geometry/MikkT/STSpace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/STSpace.js +3 -3
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts +0 -2
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.js +0 -1
- package/src/engine/graphics/geometry/buffered/ensureGeometryBoundingSphere.js +1 -1
- package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.d.ts.map +1 -1
- package/src/engine/graphics/geometry/buffered/query/bvh32_geometry_nearest.js +0 -15
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +10 -10
- package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts +0 -2
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +4 -3
- package/src/engine/graphics/impostors/octahedral/grid/HemiOctahedralUvEncoder.js +2 -2
- package/src/engine/graphics/impostors/octahedral/grid/UvEncoder.d.ts +17 -7
- package/src/engine/graphics/impostors/voxel/VoxelImpostorBaker.js +2 -2
- package/src/engine/graphics/material/SplatMaterial.js +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +3 -2
- package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +1 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +3 -3
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +4 -3
- package/src/engine/graphics/particles/particular/group/ParticleGroup.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/group/ParticleGroup.js +3 -2
- package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts +0 -2
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/model/Decal.js +3 -3
- package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
- package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +4 -3
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +6 -4
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts +1 -8
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +2 -14
- package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.d.ts +9 -0
- package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.d.ts.map +1 -0
- package/src/engine/graphics/sh3/gi/material/ProbeResolutionStage.js +14 -0
- package/src/engine/graphics/sh3/lightmap/ARTIFACTS_PLAN.md +146 -0
- package/src/engine/graphics/sh3/lightmap/CODE_REVIEW.md +121 -0
- package/src/engine/graphics/sh3/lightmap/LIGHTMAPPER_REVIEW.md +183 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts +90 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.js +681 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts +32 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.js +155 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts +49 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.js +136 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts +19 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.js +89 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts +54 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.js +168 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts +30 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.js +145 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts +38 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.js +152 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts +2 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.js +186 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGrid.d.ts +69 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGrid.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGrid.js +173 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.d.ts +24 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/LightProbeGridBaker.js +88 -0
- package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.d.ts +20 -0
- package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.js +79 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.d.ts +11 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.js +84 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.d.ts +29 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/light_probe_grid_textures.js +160 -0
- package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.d.ts +23 -0
- package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/LightProbeGridMaterialTransformer.js +228 -0
- package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.d.ts +2 -0
- package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/chunk_lpg_get_irradiance_at.js +24 -0
- package/src/engine/graphics/sh3/lpg/material/common.d.ts +3 -0
- package/src/engine/graphics/sh3/lpg/material/common.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/common.js +73 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_fragment_shader.js +42 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/build_vertex_shader.js +49 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.d.ts +9 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_fragment/space_fragment_transform_shader.js +12 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_fragment_shader.js +30 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.d.ts +6 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/build_vertex_shader.js +41 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.d.ts +3 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.frag.js +15 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.d.ts +3 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/preamble.vert.js +9 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.d.ts +9 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/material/space_vertex/space_vertex_transform_shader.js +12 -0
- package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts +20 -0
- package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.js +59 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/material/MaterialConverter.js +8 -0
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.js +6 -4
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +3 -3
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +5 -4
- package/src/engine/graphics/sh3/prototypeLightProbeGrid.d.ts +2 -0
- package/src/engine/graphics/sh3/prototypeLightProbeGrid.d.ts.map +1 -0
- package/src/engine/graphics/sh3/prototypeLightProbeGrid.js +170 -0
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +2 -2
- package/src/engine/graphics/texture/atlas/AtlasLookupTexture.js +1 -1
- package/src/engine/graphics/texture/atlas/CachingTextureAtlas.js +1 -1
- package/src/engine/graphics/texture/sampler/resize/sampler2d_scale_down_lanczos.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +3 -3
- package/src/engine/graphics/util/build_max_height_pyramid.d.ts.map +1 -1
- package/src/engine/graphics/util/build_max_height_pyramid.js +5 -2
- package/src/engine/grid/transform2grid/Transform2GridPositionSystem.js +1 -1
- package/src/engine/input/devices/KeyboardDevice.d.ts +61 -14
- package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
- package/src/engine/input/devices/KeyboardDevice.js +41 -15
- package/src/engine/input/devices/isHTMLElementFocusable.d.ts.map +1 -1
- package/src/engine/input/devices/isHTMLElementFocusable.js +2 -9
- package/src/engine/input/ecs/components/InputBinding.d.ts +7 -1
- package/src/engine/input/ecs/components/InputBinding.d.ts.map +1 -1
- package/src/engine/input/ecs/components/InputBinding.js +8 -1
- package/src/engine/input/ecs/systems/InputControllerSystem.js +1 -1
- package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts +2 -1
- package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.js +6 -2
- package/src/engine/intelligence/behavior/selector/WeightedElement.js +1 -1
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.d.ts.map +1 -1
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.js +2 -4
- package/src/engine/logging/elastic/ElasticSearchLogger.d.ts +1 -2
- package/src/engine/logging/elastic/ElasticSearchLogger.d.ts.map +1 -1
- package/src/engine/logging/elastic/ElasticSearchLogger.js +14 -10
- package/src/engine/navigation/ecs/path_following/PathFollower.js +1 -1
- package/src/engine/navigation/grid/find_path_on_grid_astar.d.ts.map +1 -1
- package/src/engine/navigation/grid/find_path_on_grid_astar.js +5 -2
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +17 -0
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
- package/src/engine/scene/SceneManager.d.ts.map +1 -1
- package/src/engine/scene/SceneManager.js +4 -2
- package/src/engine/simulation/Ticker.d.ts.map +1 -1
- package/src/engine/simulation/Ticker.js +9 -0
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +6 -1
- package/src/engine/sound/material/concrete/json/serializeSoundMaterialToJSON.js +1 -1
- package/src/engine/sound/simulation/prototypeAcousticSolver.js +261 -143
- package/src/generation/theme/ThemeEngine.d.ts +9 -0
- package/src/generation/theme/ThemeEngine.d.ts.map +1 -1
- package/src/generation/theme/ThemeEngine.js +37 -2
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { BoxBufferGeometry, MeshStandardMaterial, SphereBufferGeometry } from "three";
|
|
2
|
+
import Quaternion from "../../../../core/geom/Quaternion.js";
|
|
3
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
4
|
+
import Tag from "../../../ecs/components/Tag.js";
|
|
5
|
+
import Entity from "../../../ecs/Entity.js";
|
|
6
|
+
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
7
|
+
import { EngineHarness } from "../../../EngineHarness.js";
|
|
8
|
+
import { Light } from "../../ecs/light/Light.js";
|
|
9
|
+
import LightSystem from "../../ecs/light/LightSystem.js";
|
|
10
|
+
import { ShadedGeometry } from "../../ecs/mesh-v2/ShadedGeometry.js";
|
|
11
|
+
import { ShadedGeometryFlags } from "../../ecs/mesh-v2/ShadedGeometryFlags.js";
|
|
12
|
+
import { ShadedGeometrySystem } from "../../ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
13
|
+
import { bake_lightmap_for_scene } from "./bake_lightmap_for_scene.js";
|
|
14
|
+
|
|
15
|
+
const harness = new EngineHarness();
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Add one coloured {@link ShadedGeometry} entity to the scene.
|
|
19
|
+
*
|
|
20
|
+
* @param {EntityComponentDataset} ecd
|
|
21
|
+
* @param {THREE.BufferGeometry} geometry
|
|
22
|
+
* @param {number} color hex colour
|
|
23
|
+
* @param {Vector3} position
|
|
24
|
+
* @param {Quaternion} [rotation]
|
|
25
|
+
*/
|
|
26
|
+
function spawn(ecd, geometry, color, position, rotation) {
|
|
27
|
+
const material = new MeshStandardMaterial({ color, roughness: 1, metalness: 0 });
|
|
28
|
+
|
|
29
|
+
const sg = ShadedGeometry.from(geometry, material);
|
|
30
|
+
sg.setFlag(ShadedGeometryFlags.CastShadow);
|
|
31
|
+
sg.setFlag(ShadedGeometryFlags.ReceiveShadow);
|
|
32
|
+
sg.setFlag(ShadedGeometryFlags.Visible);
|
|
33
|
+
|
|
34
|
+
const transform = new Transform();
|
|
35
|
+
transform.position.copy(position);
|
|
36
|
+
if (rotation !== undefined) {
|
|
37
|
+
transform.rotation.copy(rotation);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
new Entity()
|
|
41
|
+
.add(sg)
|
|
42
|
+
.add(transform)
|
|
43
|
+
.add(Tag.fromJSON(["LightmapTarget"]))
|
|
44
|
+
.build(ecd);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Add a coloured light. DIRECTION lights bake crisp shadows; POINT lights add
|
|
49
|
+
* coloured bounce. Both are read by the path-traced bake.
|
|
50
|
+
*
|
|
51
|
+
* @param {EntityComponentDataset} ecd
|
|
52
|
+
* @param {number} type one of {@link Light.Type}
|
|
53
|
+
* @param {number[]} color linear [r, g, b] in 0..1
|
|
54
|
+
* @param {number} intensity
|
|
55
|
+
* @param {Object} placement
|
|
56
|
+
* @param {Vector3} [placement.position]
|
|
57
|
+
* @param {Vector3} [placement.direction]
|
|
58
|
+
* @param {number} [placement.distance] point-light influence radius
|
|
59
|
+
*/
|
|
60
|
+
function spawn_light(ecd, type, color, intensity, { position, direction, distance = 30 }) {
|
|
61
|
+
const light = new Light();
|
|
62
|
+
light.type.set(type);
|
|
63
|
+
light.color.setRGB(color[0], color[1], color[2]);
|
|
64
|
+
light.intensity.set(intensity);
|
|
65
|
+
light.distance.set(distance);
|
|
66
|
+
light.castShadow.set(true);
|
|
67
|
+
|
|
68
|
+
const transform = new Transform();
|
|
69
|
+
if (position !== undefined) {
|
|
70
|
+
transform.position.copy(position);
|
|
71
|
+
}
|
|
72
|
+
if (direction !== undefined) {
|
|
73
|
+
transform.rotation.lookRotation(direction.clone().normalize());
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
new Entity()
|
|
77
|
+
.add(light)
|
|
78
|
+
.add(transform)
|
|
79
|
+
.add(Tag.fromJSON(["Light"]))
|
|
80
|
+
.build(ecd);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {Engine} engine
|
|
85
|
+
*/
|
|
86
|
+
async function main(engine) {
|
|
87
|
+
const em = engine.entityManager;
|
|
88
|
+
|
|
89
|
+
await em.addSystem(new ShadedGeometrySystem(engine));
|
|
90
|
+
await em.addSystem(new LightSystem(engine, { shadowResolution: 2048 }));
|
|
91
|
+
|
|
92
|
+
// camera + orbital/keyboard controls; no terrain (we build our own platform),
|
|
93
|
+
// no engine lights (we place our own so we can dim them after the bake)
|
|
94
|
+
await EngineHarness.buildBasics({
|
|
95
|
+
engine,
|
|
96
|
+
focus: new Vector3(0, 1.5, 0),
|
|
97
|
+
pitch: 0.95,
|
|
98
|
+
yaw: 0.6,
|
|
99
|
+
distance: 18,
|
|
100
|
+
enableTerrain: false,
|
|
101
|
+
enableWater: false,
|
|
102
|
+
enableLights: false,
|
|
103
|
+
cameraController: true,
|
|
104
|
+
showFps: true,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const ecd = em.dataset;
|
|
108
|
+
|
|
109
|
+
// --- platform ---
|
|
110
|
+
spawn(ecd, new BoxBufferGeometry(16, 1, 16), 0xA1A1A1, new Vector3(0, -0.5, 0));
|
|
111
|
+
|
|
112
|
+
// --- a few shapes ---
|
|
113
|
+
spawn(ecd, new BoxBufferGeometry(2, 2, 2), 0xe23b3b, new Vector3(-4, 1, -2));
|
|
114
|
+
spawn(ecd, new BoxBufferGeometry(2, 4, 2), 0x3bd16f, new Vector3(3.5, 2, 2));
|
|
115
|
+
spawn(ecd, new SphereBufferGeometry(1.5, 32, 24), 0x4f86ff, new Vector3(0, 1.5, 3.5));
|
|
116
|
+
spawn(
|
|
117
|
+
ecd,
|
|
118
|
+
new BoxBufferGeometry(2.5, 2.5, 2.5),
|
|
119
|
+
0xf0c020,
|
|
120
|
+
new Vector3(2.5, 1.25, -3.5),
|
|
121
|
+
Quaternion.fromEulerAngles(0, Math.PI / 5, 0)
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
// --- lights (baked) ---
|
|
125
|
+
spawn_light(ecd, Light.Type.DIRECTION, [1.0, 0.95, 0.88], 1.6, { direction: new Vector3(-0.6, -1, -0.35) });
|
|
126
|
+
spawn_light(ecd, Light.Type.POINT, [1.0, 0.3, 0.18], 1, { position: new Vector3(-4, 2.5, 4), distance: 16 });
|
|
127
|
+
spawn_light(ecd, Light.Type.POINT, [0.18, 0.42, 1.0], 1, { position: new Vector3(5, 3, -5), distance: 16 });
|
|
128
|
+
|
|
129
|
+
const status = make_status_overlay();
|
|
130
|
+
|
|
131
|
+
// give the ECS one frame to settle transforms before baking
|
|
132
|
+
requestAnimationFrame(() => {
|
|
133
|
+
const group = bake_lightmap_for_scene({
|
|
134
|
+
ecd,
|
|
135
|
+
lightmap_resolution: 1024,
|
|
136
|
+
samples_per_texel: 1024,
|
|
137
|
+
min_bounce: 1,
|
|
138
|
+
max_bounce: 4,
|
|
139
|
+
padding: 2,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// expose for console poking
|
|
143
|
+
window.lightmap_bake = group;
|
|
144
|
+
|
|
145
|
+
// engine.executor.runGroup(group);
|
|
146
|
+
|
|
147
|
+
// progress readout
|
|
148
|
+
function poll() {
|
|
149
|
+
const p = group.computeProgress();
|
|
150
|
+
status.textContent = `Baking lightmap… ${(p * 100).toFixed(1)}%`;
|
|
151
|
+
if (p < 1) {
|
|
152
|
+
requestAnimationFrame(poll);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
poll();
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @returns {HTMLDivElement}
|
|
162
|
+
*/
|
|
163
|
+
function make_status_overlay() {
|
|
164
|
+
const el = document.createElement("div");
|
|
165
|
+
el.style.position = "fixed";
|
|
166
|
+
el.style.left = "8px";
|
|
167
|
+
el.style.top = "8px";
|
|
168
|
+
el.style.zIndex = "1000";
|
|
169
|
+
el.style.padding = "6px 10px";
|
|
170
|
+
el.style.font = "13px monospace";
|
|
171
|
+
el.style.color = "#fff";
|
|
172
|
+
el.style.background = "rgba(0,0,0,0.55)";
|
|
173
|
+
el.style.borderRadius = "4px";
|
|
174
|
+
el.style.pointerEvents = "none";
|
|
175
|
+
el.textContent = "Preparing bake…";
|
|
176
|
+
document.body.appendChild(el);
|
|
177
|
+
return el;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
harness.initialize({
|
|
181
|
+
configuration(config) {
|
|
182
|
+
|
|
183
|
+
// config.addPlugin(AmbientOcclusionPostProcessEffect)
|
|
184
|
+
|
|
185
|
+
},
|
|
186
|
+
}).then(main);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dense irradiance field representation.
|
|
3
|
+
*
|
|
4
|
+
* Light probes are placed on a regular 3d grid spanning {@link #bounds}, probes on each axis are placed so that the
|
|
5
|
+
* first and the last layer lie exactly on the bounding box faces (spacing = extent / (resolution - 1)).
|
|
6
|
+
* Probe order matches WebGL 3d texture raster order: X varies fastest, then Y, then Z.
|
|
7
|
+
*
|
|
8
|
+
* Unlike {@link LightProbeVolume} there is no connectivity structure and no depth data, the field is intended to be
|
|
9
|
+
* uploaded into 3d textures and sampled with hardware trilinear filtering.
|
|
10
|
+
*
|
|
11
|
+
* @see "Irradiance Volumes" by G.Greger, 1998
|
|
12
|
+
*/
|
|
13
|
+
export class LightProbeGrid {
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @return {number}
|
|
17
|
+
*/
|
|
18
|
+
get version(): number;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @return {AABB3}
|
|
22
|
+
*/
|
|
23
|
+
get bounds(): AABB3;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @return {number}
|
|
27
|
+
*/
|
|
28
|
+
get resolution_x(): number;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @return {number}
|
|
32
|
+
*/
|
|
33
|
+
get resolution_y(): number;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @return {number}
|
|
37
|
+
*/
|
|
38
|
+
get resolution_z(): number;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @return {number}
|
|
42
|
+
*/
|
|
43
|
+
get count(): number;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @return {Float32Array}
|
|
47
|
+
*/
|
|
48
|
+
get harmonics(): Float32Array;
|
|
49
|
+
clear(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Allocate probe storage for a given region and grid resolution. Existing data is discarded.
|
|
52
|
+
* @param {AABB3} bounds
|
|
53
|
+
* @param {number} resolution_x number of probe layers along X, at least 2
|
|
54
|
+
* @param {number} resolution_y
|
|
55
|
+
* @param {number} resolution_z
|
|
56
|
+
*/
|
|
57
|
+
build(bounds: AABB3, resolution_x: number, resolution_y: number, resolution_z: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* World-space position of a probe
|
|
60
|
+
* @param {number[]|Float32Array} result probe position is written here as [x, y, z]
|
|
61
|
+
* @param {number} result_offset
|
|
62
|
+
* @param {number} index probe index
|
|
63
|
+
*/
|
|
64
|
+
probe_position(result: number[] | Float32Array, result_offset: number, index: number): void;
|
|
65
|
+
incrementVersion(): void;
|
|
66
|
+
#private;
|
|
67
|
+
}
|
|
68
|
+
import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
|
|
69
|
+
//# sourceMappingURL=LightProbeGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightProbeGrid.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpg/LightProbeGrid.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH;IAkBI;;;OAGG;IACH,sBAEC;IAED;;;OAGG;IACH,oBAEC;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,oBAEC;IAED;;;OAGG;IACH,8BAEC;IAED,cAUC;IAED;;;;;;OAMG;IACH,cALW,KAAK,gBACL,MAAM,gBACN,MAAM,gBACN,MAAM,QAoChB;IAED;;;;;OAKG;IACH,uBAJW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,SACN,MAAM,QAmBhB;IAED,yBAEC;;CACJ;sBA3KqB,wCAAwC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Dense irradiance field representation.
|
|
6
|
+
*
|
|
7
|
+
* Light probes are placed on a regular 3d grid spanning {@link #bounds}, probes on each axis are placed so that the
|
|
8
|
+
* first and the last layer lie exactly on the bounding box faces (spacing = extent / (resolution - 1)).
|
|
9
|
+
* Probe order matches WebGL 3d texture raster order: X varies fastest, then Y, then Z.
|
|
10
|
+
*
|
|
11
|
+
* Unlike {@link LightProbeVolume} there is no connectivity structure and no depth data, the field is intended to be
|
|
12
|
+
* uploaded into 3d textures and sampled with hardware trilinear filtering.
|
|
13
|
+
*
|
|
14
|
+
* @see "Irradiance Volumes" by G.Greger, 1998
|
|
15
|
+
*/
|
|
16
|
+
export class LightProbeGrid {
|
|
17
|
+
#version = 0;
|
|
18
|
+
|
|
19
|
+
#bounds = new AABB3(0, 0, 0, 0, 0, 0);
|
|
20
|
+
|
|
21
|
+
#resolution_x = 0;
|
|
22
|
+
#resolution_y = 0;
|
|
23
|
+
#resolution_z = 0;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Probe irradiance color data
|
|
27
|
+
* Base-2 spherical harmonics, 4 coefficients per color channel for a total of 12 coefficients per probe
|
|
28
|
+
* Layout is coefficient-major with an RGB triplet per coefficient, matching the first 4 coefficients of
|
|
29
|
+
* {@link LightProbeVolume#harmonics}
|
|
30
|
+
* @type {Float32Array}
|
|
31
|
+
*/
|
|
32
|
+
#sh2_rgb = new Float32Array(0);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @return {number}
|
|
37
|
+
*/
|
|
38
|
+
get version() {
|
|
39
|
+
return this.#version;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @return {AABB3}
|
|
45
|
+
*/
|
|
46
|
+
get bounds() {
|
|
47
|
+
return this.#bounds;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @return {number}
|
|
53
|
+
*/
|
|
54
|
+
get resolution_x() {
|
|
55
|
+
return this.#resolution_x;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @return {number}
|
|
61
|
+
*/
|
|
62
|
+
get resolution_y() {
|
|
63
|
+
return this.#resolution_y;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @return {number}
|
|
69
|
+
*/
|
|
70
|
+
get resolution_z() {
|
|
71
|
+
return this.#resolution_z;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @return {number}
|
|
77
|
+
*/
|
|
78
|
+
get count() {
|
|
79
|
+
return this.#resolution_x * this.#resolution_y * this.#resolution_z;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @return {Float32Array}
|
|
85
|
+
*/
|
|
86
|
+
get harmonics() {
|
|
87
|
+
return this.#sh2_rgb;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
clear() {
|
|
91
|
+
this.#bounds.setBounds(0, 0, 0, 0, 0, 0);
|
|
92
|
+
|
|
93
|
+
this.#resolution_x = 0;
|
|
94
|
+
this.#resolution_y = 0;
|
|
95
|
+
this.#resolution_z = 0;
|
|
96
|
+
|
|
97
|
+
this.#sh2_rgb = new Float32Array(0);
|
|
98
|
+
|
|
99
|
+
this.#version++;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Allocate probe storage for a given region and grid resolution. Existing data is discarded.
|
|
104
|
+
* @param {AABB3} bounds
|
|
105
|
+
* @param {number} resolution_x number of probe layers along X, at least 2
|
|
106
|
+
* @param {number} resolution_y
|
|
107
|
+
* @param {number} resolution_z
|
|
108
|
+
*/
|
|
109
|
+
build(bounds, resolution_x, resolution_y, resolution_z) {
|
|
110
|
+
assert.isInstanceOf(bounds, AABB3, 'bounds');
|
|
111
|
+
|
|
112
|
+
assert.isNonNegativeInteger(resolution_x, 'resolution_x');
|
|
113
|
+
assert.isNonNegativeInteger(resolution_y, 'resolution_y');
|
|
114
|
+
assert.isNonNegativeInteger(resolution_z, 'resolution_z');
|
|
115
|
+
|
|
116
|
+
assert.greaterThanOrEqual(resolution_x, 2, 'resolution_x');
|
|
117
|
+
assert.greaterThanOrEqual(resolution_y, 2, 'resolution_y');
|
|
118
|
+
assert.greaterThanOrEqual(resolution_z, 2, 'resolution_z');
|
|
119
|
+
|
|
120
|
+
this.#bounds.copy(bounds);
|
|
121
|
+
|
|
122
|
+
this.#resolution_x = resolution_x;
|
|
123
|
+
this.#resolution_y = resolution_y;
|
|
124
|
+
this.#resolution_z = resolution_z;
|
|
125
|
+
|
|
126
|
+
const count = this.count;
|
|
127
|
+
|
|
128
|
+
const data = new Float32Array(count * 12);
|
|
129
|
+
|
|
130
|
+
// neutral-ambient placeholder for not-yet-baked probes: DC coefficient only, band-1 stays zero.
|
|
131
|
+
// Filling all 12 coefficients would reconstruct a directional gradient (negative for some normals), not white.
|
|
132
|
+
for (let i = 0; i < count; i++) {
|
|
133
|
+
const offset = i * 12;
|
|
134
|
+
|
|
135
|
+
data[offset] = 1;
|
|
136
|
+
data[offset + 1] = 1;
|
|
137
|
+
data[offset + 2] = 1;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this.#sh2_rgb = data;
|
|
141
|
+
|
|
142
|
+
this.#version++;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* World-space position of a probe
|
|
147
|
+
* @param {number[]|Float32Array} result probe position is written here as [x, y, z]
|
|
148
|
+
* @param {number} result_offset
|
|
149
|
+
* @param {number} index probe index
|
|
150
|
+
*/
|
|
151
|
+
probe_position(result, result_offset, index) {
|
|
152
|
+
assert.isNonNegativeInteger(index, 'index');
|
|
153
|
+
assert.lessThan(index, this.count, 'index');
|
|
154
|
+
|
|
155
|
+
const resolution_x = this.#resolution_x;
|
|
156
|
+
const resolution_y = this.#resolution_y;
|
|
157
|
+
const resolution_z = this.#resolution_z;
|
|
158
|
+
|
|
159
|
+
const x = index % resolution_x;
|
|
160
|
+
const y = ((index / resolution_x) | 0) % resolution_y;
|
|
161
|
+
const z = (index / (resolution_x * resolution_y)) | 0;
|
|
162
|
+
|
|
163
|
+
const bounds = this.#bounds;
|
|
164
|
+
|
|
165
|
+
result[result_offset] = bounds.x0 + (x / (resolution_x - 1)) * bounds.getExtentsX();
|
|
166
|
+
result[result_offset + 1] = bounds.y0 + (y / (resolution_y - 1)) * bounds.getExtentsY();
|
|
167
|
+
result[result_offset + 2] = bounds.z0 + (z / (resolution_z - 1)) * bounds.getExtentsZ();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
incrementVersion() {
|
|
171
|
+
this.#version++;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class LightProbeGridBaker {
|
|
2
|
+
/**
|
|
3
|
+
* Renderer used to bake probes. Exposed so callers (and tests) can configure the underlying scene.
|
|
4
|
+
* @return {ProbeRenderer}
|
|
5
|
+
*/
|
|
6
|
+
get renderer(): ProbeRenderer;
|
|
7
|
+
/**
|
|
8
|
+
* Bake light probes
|
|
9
|
+
* @returns {TaskGroup}
|
|
10
|
+
* @param {LightProbeGrid} grid
|
|
11
|
+
* @param {EntityComponentDataset} ecd
|
|
12
|
+
*/
|
|
13
|
+
bake(grid: LightProbeGrid, ecd: EntityComponentDataset): TaskGroup;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param {ProbeRenderer} renderer
|
|
17
|
+
* @param {LightProbeGrid} grid
|
|
18
|
+
* @param {number} probe_index
|
|
19
|
+
*/
|
|
20
|
+
bake_probe(renderer: ProbeRenderer, grid: LightProbeGrid, probe_index: number): void;
|
|
21
|
+
#private;
|
|
22
|
+
}
|
|
23
|
+
import TaskGroup from "../../../../core/process/task/TaskGroup.js";
|
|
24
|
+
//# sourceMappingURL=LightProbeGridBaker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LightProbeGridBaker.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpg/LightProbeGridBaker.js"],"names":[],"mappings":"AAWA;IAII;;;OAGG;IACH,8BAEC;IAED;;;;;OAKG;IACH,yDAJa,SAAS,CA2CrB;IAED;;;;;OAKG;IACH,uEAFW,MAAM,QAYhB;;CACJ;sBArFqB,4CAA4C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
3
|
+
import TaskGroup from "../../../../core/process/task/TaskGroup.js";
|
|
4
|
+
import { actionTask } from "../../../../core/process/task/util/actionTask.js";
|
|
5
|
+
import { countTask } from "../../../../core/process/task/util/countTask.js";
|
|
6
|
+
import { promiseTask } from "../../../../core/process/task/util/promiseTask.js";
|
|
7
|
+
import { PathTracerProbeRenderer } from "../lpv/PathTracerProbeRenderer.js";
|
|
8
|
+
|
|
9
|
+
const __position = new Float32Array(3);
|
|
10
|
+
const __sh3_rgb = new Float64Array(27);
|
|
11
|
+
|
|
12
|
+
export class LightProbeGridBaker {
|
|
13
|
+
|
|
14
|
+
#ren = new PathTracerProbeRenderer();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Renderer used to bake probes. Exposed so callers (and tests) can configure the underlying scene.
|
|
18
|
+
* @return {ProbeRenderer}
|
|
19
|
+
*/
|
|
20
|
+
get renderer() {
|
|
21
|
+
return this.#ren;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Bake light probes
|
|
26
|
+
* @returns {TaskGroup}
|
|
27
|
+
* @param {LightProbeGrid} grid
|
|
28
|
+
* @param {EntityComponentDataset} ecd
|
|
29
|
+
*/
|
|
30
|
+
bake(grid, ecd) {
|
|
31
|
+
const renderer = this.#ren;
|
|
32
|
+
|
|
33
|
+
// async IIFE (not a Promise executor): a throw in build_scene/bake_start rejects the task rather than
|
|
34
|
+
// leaving the promise unsettled and hanging the bake forever
|
|
35
|
+
const tPrepare = promiseTask((async () => {
|
|
36
|
+
renderer.build_scene(ecd);
|
|
37
|
+
await renderer.bake_start(ecd);
|
|
38
|
+
})(), 'Prepare');
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const probe_count = grid.count;
|
|
42
|
+
|
|
43
|
+
const tBakeIrradiance = countTask(0, probe_count, (probe_index) => {
|
|
44
|
+
this.bake_probe(renderer, grid, probe_index);
|
|
45
|
+
|
|
46
|
+
});
|
|
47
|
+
tBakeIrradiance.estimatedDuration = probe_count;
|
|
48
|
+
|
|
49
|
+
tBakeIrradiance.promise().then(() => {
|
|
50
|
+
|
|
51
|
+
const duration = tBakeIrradiance.__executedCpuTime;
|
|
52
|
+
|
|
53
|
+
console.log(`Baked ${probe_count} probes in ${duration}ms, ~${(duration / probe_count).toFixed(2)}ms per probe`);
|
|
54
|
+
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const tFinish = actionTask(() => {
|
|
58
|
+
renderer.bake_end();
|
|
59
|
+
|
|
60
|
+
grid.incrementVersion();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
tFinish.addDependency(tBakeIrradiance);
|
|
64
|
+
tBakeIrradiance.addDependency(tPrepare);
|
|
65
|
+
|
|
66
|
+
return new TaskGroup([
|
|
67
|
+
tPrepare, tBakeIrradiance, tFinish
|
|
68
|
+
], "LightProbeGrid Bake");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @param {ProbeRenderer} renderer
|
|
74
|
+
* @param {LightProbeGrid} grid
|
|
75
|
+
* @param {number} probe_index
|
|
76
|
+
*/
|
|
77
|
+
bake_probe(renderer, grid, probe_index) {
|
|
78
|
+
assert.isNonNegativeInteger(probe_index, 'probe_index');
|
|
79
|
+
|
|
80
|
+
grid.probe_position(__position, 0, probe_index);
|
|
81
|
+
|
|
82
|
+
// render a full SH3 probe with the shared facilities
|
|
83
|
+
renderer.bake(__position, 0, __sh3_rgb, 0);
|
|
84
|
+
|
|
85
|
+
// keep only bands 0 and 1: the coefficient-major layout puts them in the first 12 values
|
|
86
|
+
array_copy(__sh3_rgb, 0, grid.harmonics, probe_index * 12, 12);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {LightProbeGrid} grid
|
|
4
|
+
* @param {EntityComponentDataset} ecd
|
|
5
|
+
* @param {Engine} engine
|
|
6
|
+
* @return {Promise<void>}
|
|
7
|
+
*/
|
|
8
|
+
export function light_probe_grid_bake_via_task(grid: LightProbeGrid, ecd: EntityComponentDataset, engine: Engine): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {LightProbeGrid} [grid]
|
|
12
|
+
* @param {Engine} engine
|
|
13
|
+
* @param {EntityComponentDataset} ecd
|
|
14
|
+
* @param {AABB3} bounds
|
|
15
|
+
* @param {number} [spacing] desired distance between probes, in world units
|
|
16
|
+
* @returns {Promise<LightProbeGrid>}
|
|
17
|
+
*/
|
|
18
|
+
export function build_light_probe_grid_for_scene({ grid, engine, ecd, bounds, spacing }?: LightProbeGrid): Promise<LightProbeGrid>;
|
|
19
|
+
import { LightProbeGrid } from "./LightProbeGrid.js";
|
|
20
|
+
//# sourceMappingURL=build_light_probe_grid_for_scene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_light_probe_grid_for_scene.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpg/build_light_probe_grid_for_scene.js"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,qDALW,cAAc,gDAGb,QAAQ,IAAI,CAAC,CA2BxB;AAED;;;;;;;;GAQG;AACH,0FAPW,cAAc,GAKZ,QAAQ,cAAc,CAAC,CA2BnC;+BAvE8B,qBAAqB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
|
|
2
|
+
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
3
|
+
import { max2 } from "../../../../core/math/max2.js";
|
|
4
|
+
import Entity from "../../../ecs/Entity.js";
|
|
5
|
+
import GUIElement from "../../../ecs/gui/GUIElement.js";
|
|
6
|
+
import ViewportPosition from "../../../ecs/gui/position/ViewportPosition.js";
|
|
7
|
+
import { makeSimpleTaskProgressView } from "../../../makeSimpleTaskProgressView.js";
|
|
8
|
+
import { LightProbeGrid } from "./LightProbeGrid.js";
|
|
9
|
+
import { LightProbeGridBaker } from "./LightProbeGridBaker.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {LightProbeGrid} grid
|
|
14
|
+
* @param {EntityComponentDataset} ecd
|
|
15
|
+
* @param {Engine} engine
|
|
16
|
+
* @return {Promise<void>}
|
|
17
|
+
*/
|
|
18
|
+
export async function light_probe_grid_bake_via_task(grid, ecd, engine) {
|
|
19
|
+
const baker = new LightProbeGridBaker();
|
|
20
|
+
const task = baker.bake(grid, ecd);
|
|
21
|
+
|
|
22
|
+
const progress = makeSimpleTaskProgressView({
|
|
23
|
+
task,
|
|
24
|
+
localization: engine.localization,
|
|
25
|
+
size: new Vector2(512, 64)
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const progress_entity = new Entity();
|
|
29
|
+
progress_entity
|
|
30
|
+
.add(GUIElement.fromView(progress))
|
|
31
|
+
.add(ViewportPosition.fromJSON({
|
|
32
|
+
position: new Vector2(0, 1),
|
|
33
|
+
anchor: new Vector2(0, 1),
|
|
34
|
+
offset: new Vector2(16, -16)
|
|
35
|
+
}))
|
|
36
|
+
.build(ecd);
|
|
37
|
+
|
|
38
|
+
task.promise().finally(() => progress_entity.destroy())
|
|
39
|
+
|
|
40
|
+
engine.executor.runGroup(task);
|
|
41
|
+
|
|
42
|
+
await task.promise();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param {LightProbeGrid} [grid]
|
|
48
|
+
* @param {Engine} engine
|
|
49
|
+
* @param {EntityComponentDataset} ecd
|
|
50
|
+
* @param {AABB3} bounds
|
|
51
|
+
* @param {number} [spacing] desired distance between probes, in world units
|
|
52
|
+
* @returns {Promise<LightProbeGrid>}
|
|
53
|
+
*/
|
|
54
|
+
export async function build_light_probe_grid_for_scene(
|
|
55
|
+
{
|
|
56
|
+
grid = new LightProbeGrid(),
|
|
57
|
+
engine,
|
|
58
|
+
ecd,
|
|
59
|
+
bounds,
|
|
60
|
+
spacing = 1
|
|
61
|
+
}
|
|
62
|
+
) {
|
|
63
|
+
|
|
64
|
+
const grid_bounds = new AABB3(0, 0, 0, 0, 0, 0);
|
|
65
|
+
grid_bounds.copy(bounds);
|
|
66
|
+
|
|
67
|
+
// push probe layers slightly past the geometry so that boundary surfaces are not sampled exactly at a probe shell
|
|
68
|
+
grid_bounds.grow(spacing * 1.05);
|
|
69
|
+
|
|
70
|
+
const resolution_x = max2(2, Math.ceil(grid_bounds.getExtentsX() / spacing) + 1);
|
|
71
|
+
const resolution_y = max2(2, Math.ceil(grid_bounds.getExtentsY() / spacing) + 1);
|
|
72
|
+
const resolution_z = max2(2, Math.ceil(grid_bounds.getExtentsZ() / spacing) + 1);
|
|
73
|
+
|
|
74
|
+
grid.build(grid_bounds, resolution_x, resolution_y, resolution_z);
|
|
75
|
+
|
|
76
|
+
await light_probe_grid_bake_via_task(grid, ecd, engine);
|
|
77
|
+
|
|
78
|
+
return grid;
|
|
79
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {Engine} engine
|
|
4
|
+
* @param {string} path
|
|
5
|
+
* @param {LightProbeGrid} [grid]
|
|
6
|
+
* @param {number} [spacing] only used when building, if loading this parameter is ignored
|
|
7
|
+
* @return {Promise<LightProbeGrid>}
|
|
8
|
+
*/
|
|
9
|
+
export function light_probe_grid_obtain_storage_cached({ engine, path, grid, spacing }: Engine): Promise<LightProbeGrid>;
|
|
10
|
+
import { LightProbeGrid } from "./LightProbeGrid.js";
|
|
11
|
+
//# sourceMappingURL=light_probe_grid_obtain_storage_cached.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"light_probe_grid_obtain_storage_cached.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/lpg/light_probe_grid_obtain_storage_cached.js"],"names":[],"mappings":"AASA;;;;;;;GAOG;AACH,iGAFY,QAAQ,cAAc,CAAC,CAoElC;+BA7E8B,qBAAqB"}
|