@woosh/meep-engine 2.109.1 → 2.109.2
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/meep.cjs +122 -186
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +122 -186
- package/package.json +1 -1
- package/src/core/binary/ctz32.d.ts.map +1 -1
- package/src/core/binary/ctz32.js +12 -11
- package/src/core/binary/reinterpret_int32_as_float32.d.ts +7 -0
- package/src/core/binary/reinterpret_int32_as_float32.d.ts.map +1 -0
- package/src/core/binary/reinterpret_int32_as_float32.js +14 -0
- package/src/core/binary/reverse_bits_uint32.d.ts +8 -0
- package/src/core/binary/reverse_bits_uint32.d.ts.map +1 -0
- package/src/core/binary/reverse_bits_uint32.js +17 -0
- package/src/core/binary/reverse_bits_uint32.spec.d.ts +2 -0
- package/src/core/binary/reverse_bits_uint32.spec.d.ts.map +1 -0
- package/src/core/binary/reverse_bits_uint32.spec.js +18 -0
- package/src/core/bvh2/bvh3/BVH.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/BVH.js +13 -18
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js +3 -1
- 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 +6 -7
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +4 -0
- package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.d.ts +16 -0
- package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/query/backtracking/bvh_backtracking_query_leaves_ray.js +130 -0
- package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.d.ts +2 -0
- package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/query/cache/BVH_QUERY_CACHE_SIZE.js +1 -0
- package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.d.ts +9 -0
- package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.d.ts.map +1 -0
- package/src/core/bvh2/bvh3/query/cache/bvh_query_cache_hash_v3.js +31 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_map.d.ts +9 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_map.d.ts.map +1 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_map.js +79 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_uint.d.ts +8 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_uint.d.ts.map +1 -0
- package/src/core/collection/array/{array_quick_sort_by_lookup.js → array_quick_sort_by_lookup_uint.js} +1 -1
- package/src/core/collection/array/array_shuffle.js +1 -1
- package/src/core/collection/array/array_swap_one.d.ts.map +1 -1
- package/src/core/collection/array/array_swap_one.js +6 -0
- package/src/core/events/signal/Signal.d.ts.map +1 -1
- package/src/core/events/signal/Signal.js +10 -10
- package/src/core/geom/2d/compute_triangle_area_2d.d.ts.map +1 -1
- package/src/core/geom/2d/compute_triangle_area_2d.js +5 -3
- package/src/core/geom/3d/Ray3.d.ts +6 -0
- package/src/core/geom/3d/Ray3.d.ts.map +1 -1
- package/src/core/geom/3d/Ray3.js +24 -0
- package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.d.ts +16 -0
- package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_min.js +29 -0
- package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.d.ts +2 -2
- package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_from_v3_array_transformed.js +6 -6
- package/src/core/geom/3d/aabb/aabb3_overlaps_ray_segment.d.ts +11 -0
- package/src/core/geom/3d/aabb/aabb3_overlaps_ray_segment.d.ts.map +1 -0
- package/src/core/geom/3d/aabb/aabb3_overlaps_ray_segment.js +61 -0
- package/src/core/geom/3d/eulerAnglesFromMatrix.d.ts +2 -2
- package/src/core/geom/3d/eulerAnglesFromMatrix.d.ts.map +1 -1
- package/src/core/geom/3d/eulerAnglesFromMatrix.js +28 -25
- package/src/core/geom/3d/morton/v3_morton_encode_bounded.d.ts +2 -2
- package/src/core/geom/3d/morton/v3_morton_encode_bounded.d.ts.map +1 -1
- package/src/core/geom/3d/morton/v3_morton_encode_bounded.js +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts +2 -2
- 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 +1 -1
- package/src/core/geom/3d/ray/ray3_shift_origin_along_direction.js +2 -2
- package/src/core/geom/3d/sphere/sphere_intersects_ray.js +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedron_compute_circumsphere.js +24 -188
- package/src/core/geom/3d/tetrahedra/triangle/prototype.js +1 -1
- package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.d.ts +11 -0
- package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.js +42 -0
- package/src/core/geom/3d/topology/samples/sampleFloodFill.js +2 -2
- package/src/core/geom/3d/topology/tm_face_area.js +2 -2
- package/src/core/geom/3d/triangle/{computeTriangleSurfaceArea.d.ts → compute_triangle_area_3d.d.ts} +2 -2
- package/src/core/geom/3d/triangle/compute_triangle_area_3d.d.ts.map +1 -0
- package/src/core/geom/3d/triangle/{computeTriangleSurfaceArea.js → compute_triangle_area_3d.js} +2 -4
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +13 -102
- package/src/core/geom/Quaternion.spec.js +2 -2
- package/src/core/geom/Vector1.d.ts.map +1 -1
- package/src/core/geom/Vector1.js +14 -6
- package/src/core/geom/vec3/v3_array_displace_in_direction.d.ts +14 -0
- package/src/core/geom/vec3/v3_array_displace_in_direction.d.ts.map +1 -0
- package/src/core/geom/vec3/{v3_shift_along_direction.js → v3_array_displace_in_direction.js} +1 -1
- package/src/core/geom/vec3/v3_displace_in_direction.d.ts +7 -7
- package/src/core/geom/vec3/v3_displace_in_direction.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_displace_in_direction.js +20 -17
- package/src/core/geom/vec3/v3_displace_in_direction.spec.d.ts +2 -0
- package/src/core/geom/vec3/v3_displace_in_direction.spec.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_displace_in_direction.spec.js +80 -0
- package/src/core/geom/vec4/v4_length.d.ts +10 -0
- package/src/core/geom/vec4/v4_length.d.ts.map +1 -0
- package/src/core/geom/vec4/v4_length.js +13 -0
- package/src/core/geom/vec4/v4_length_sqr.js +2 -1
- package/src/core/graph/eigen/matrix_eigenvalues_in_place.spec.js +31 -1
- package/src/core/math/FLT_EPSILON_64.d.ts +6 -0
- package/src/core/math/FLT_EPSILON_64.d.ts.map +1 -0
- package/src/core/math/FLT_EPSILON_64.js +5 -0
- package/src/core/math/gaussian.d.ts +2 -2
- package/src/core/math/gaussian.js +2 -2
- package/src/core/math/linalg/README.md +1 -0
- package/src/core/math/linalg/lu_factor_linear_system.d.ts +13 -0
- package/src/core/math/linalg/lu_factor_linear_system.d.ts.map +1 -0
- package/src/core/math/linalg/lu_factor_linear_system.js +112 -0
- package/src/core/math/linalg/lu_solve_linear_system.d.ts +14 -0
- package/src/core/math/linalg/lu_solve_linear_system.d.ts.map +1 -0
- package/src/core/math/linalg/lu_solve_linear_system.js +51 -0
- package/src/core/math/linalg/solve_linear_system.d.ts +14 -0
- package/src/core/math/linalg/solve_linear_system.d.ts.map +1 -0
- package/src/core/math/linalg/solve_linear_system.js +52 -0
- package/src/core/math/linalg/solve_linear_system.spec.d.ts +2 -0
- package/src/core/math/linalg/solve_linear_system.spec.d.ts.map +1 -0
- package/src/core/math/linalg/solve_linear_system.spec.js +70 -0
- package/src/core/math/linalg/solve_linear_system_GEPP_2x2.d.ts +10 -0
- package/src/core/math/linalg/solve_linear_system_GEPP_2x2.d.ts.map +1 -0
- package/src/core/math/linalg/solve_linear_system_GEPP_2x2.js +91 -0
- package/src/core/math/solveQuadratic.d.ts.map +1 -1
- package/src/core/math/solveQuadratic.js +2 -0
- package/src/core/math/statistics/gaussian_amplitude.d.ts +8 -0
- package/src/core/math/statistics/gaussian_amplitude.d.ts.map +1 -0
- package/src/core/math/statistics/gaussian_amplitude.js +13 -0
- package/src/core/math/statistics/halton_sequence.js +3 -3
- package/src/core/math/statistics/halton_sequence.spec.js +18 -0
- package/src/core/math/statistics/hammersley_sequence.d.ts +9 -0
- package/src/core/math/statistics/hammersley_sequence.d.ts.map +1 -0
- package/src/core/math/statistics/hammersley_sequence.js +25 -0
- package/src/core/math/statistics/hammersley_sequence_2d.d.ts +9 -0
- package/src/core/math/statistics/hammersley_sequence_2d.d.ts.map +1 -0
- package/src/core/math/statistics/hammersley_sequence_2d.js +17 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.d.ts +8 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.d.ts.map +1 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.js +15 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.d.ts +2 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.d.ts.map +1 -0
- package/src/core/math/statistics/radical_inverse_VdC_base_2.spec.js +9 -0
- package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstance.js +26 -12
- package/src/core/model/node-graph/node/NodeInstance.spec.d.ts +2 -0
- package/src/core/model/node-graph/node/NodeInstance.spec.d.ts.map +1 -0
- package/src/core/model/node-graph/node/NodeInstance.spec.js +82 -0
- package/src/core/model/node-graph/node/NodeInstancePortReference.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstancePortReference.js +9 -0
- package/src/core/model/node-graph/node/NodeInstancePortReference.spec.js +20 -0
- package/src/core/model/node-graph/node/Port.d.ts.map +1 -1
- package/src/core/model/node-graph/node/Port.js +5 -12
- package/src/core/model/node-graph/node/PortDirection.d.ts.map +1 -1
- package/src/core/model/node-graph/node/PortDirection.js +7 -1
- package/src/engine/asset/CORS/CrossOriginConfig.d.ts.map +1 -1
- package/src/engine/asset/CORS/CrossOriginConfig.js +6 -4
- package/src/engine/graphics/geometry/computeMeshSurfaceArea.js +2 -2
- package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js +33 -3
- package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +9 -7
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.d.ts +6 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.d.ts.map +1 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.js +18 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.d.ts +6 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.d.ts.map +1 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.js +266 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.d.ts +7 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.d.ts.map +1 -0
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.js +19 -0
- package/src/engine/graphics/sh3/SH3VisualisationMaterial.js +9 -9
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/gi/material/MaterialTransformer.js +0 -2
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +4 -27
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +36 -158
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts +13 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +63 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +1 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +25 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +4 -29
- package/src/engine/graphics/sh3/lpv/{LightProbeVolumeSerializationAdapter.d.ts → serialization/LightProbeVolumeSerializationAdapter.d.ts} +2 -2
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/{LightProbeVolumeSerializationAdapter.js → serialization/LightProbeVolumeSerializationAdapter.js} +2 -2
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts +13 -0
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/sh3_bake_depth.js +71 -0
- package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.d.ts +2 -0
- package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/worker/lpv_build_worker.js +38 -0
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts +1 -7
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +58 -147
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts +13 -9
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +74 -54
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts +23 -5
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedScene.js +211 -59
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_along_ray.d.ts +15 -0
- package/src/engine/graphics/sh3/path_tracer/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 +46 -0
- package/src/engine/graphics/sh3/path_tracer/build_bvh_nodes_distances_sqr_to_point.d.ts +14 -0
- package/src/engine/graphics/sh3/path_tracer/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 +43 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/compute_triangle_group_aabb3.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{compute_triangle_group_aabb3.js → geometry/compute_triangle_group_aabb3.js} +2 -2
- package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.d.ts +12 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/construct_ray_hit_from_geometry.js +72 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/sample_triangle_attribute.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.d.ts +13 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/geometry/sort_triangles_by_distance_to_point.js +48 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/material/StandardMaterial.js +4 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts +1 -0
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.js +8 -5
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +24 -18
- package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.d.ts +2 -2
- package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{getBiasedNormalSample.js → sampling/getBiasedNormalSample.js} +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/random_in_hemisphere.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/{random_in_hemisphere.js → sampling/random_in_hemisphere.js} +1 -1
- package/src/engine/graphics/sh3/path_tracer/sort_bvh_nodes_by_distance_to_point.d.ts +12 -0
- package/src/engine/graphics/sh3/path_tracer/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 +46 -0
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.d.ts +7 -0
- package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.js +69 -0
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +29 -7
- package/src/engine/graphics/texture/formatToChannelCount.d.ts.map +1 -1
- package/src/engine/graphics/texture/formatToChannelCount.js +14 -1
- package/src/engine/graphics/three/three_object_replace_materials.d.ts +7 -0
- package/src/engine/graphics/three/three_object_replace_materials.d.ts.map +1 -0
- package/src/engine/graphics/three/three_object_replace_materials.js +13 -0
- package/src/core/collection/array/array_quick_sort_by_lookup.d.ts +0 -8
- package/src/core/collection/array/array_quick_sort_by_lookup.d.ts.map +0 -1
- package/src/core/geom/3d/triangle/computeTriangleSurfaceArea.d.ts.map +0 -1
- package/src/core/geom/vec3/v3_shift_along_direction.d.ts +0 -14
- package/src/core/geom/vec3/v3_shift_along_direction.d.ts.map +0 -1
- package/src/engine/graphics/filter/FlipArrayViaCanvas.d.ts +0 -2
- package/src/engine/graphics/filter/FlipArrayViaCanvas.d.ts.map +0 -1
- package/src/engine/graphics/filter/FlipArrayViaCanvas.js +0 -13
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeSerializationAdapter.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/compute_triangle_group_aabb3.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/getBiasedNormalSample.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/random_in_hemisphere.d.ts.map +0 -1
- package/src/engine/graphics/sh3/path_tracer/sample_triangle_attribute.d.ts.map +0 -1
- /package/src/engine/graphics/sh3/path_tracer/{compute_triangle_group_aabb3.d.ts → geometry/compute_triangle_group_aabb3.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{sample_triangle_attribute.d.ts → geometry/sample_triangle_attribute.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{sample_triangle_attribute.js → geometry/sample_triangle_attribute.js} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{getBiasedNormalSample.d.ts → sampling/getBiasedNormalSample.d.ts} +0 -0
- /package/src/engine/graphics/sh3/path_tracer/{random_in_hemisphere.d.ts → sampling/random_in_hemisphere.d.ts} +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { split_by_3 } from "../../../../../core/binary/split_by_3.js";
|
|
2
|
+
import { array_quick_sort_by_comparator } from "../../../../../core/collection/array/array_quick_sort_by_comparator.js";
|
|
3
|
+
import { v3_distance_sqr } from "../../../../../core/geom/vec3/v3_distance_sqr.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {number[]} triangles
|
|
8
|
+
* @param {number} offset
|
|
9
|
+
* @param {number} count
|
|
10
|
+
* @param {number} point_x
|
|
11
|
+
* @param {number} point_y
|
|
12
|
+
* @param {number} point_z
|
|
13
|
+
* @param morton_codes
|
|
14
|
+
* @param bounds
|
|
15
|
+
*/
|
|
16
|
+
export function sort_triangles_by_distance_to_point(
|
|
17
|
+
triangles, offset, count,
|
|
18
|
+
morton_codes, bounds,
|
|
19
|
+
point_x, point_y, point_z,
|
|
20
|
+
) {
|
|
21
|
+
const bounds_x0 = bounds.x0;
|
|
22
|
+
const bounds_y0 = bounds.y0;
|
|
23
|
+
const bounds_z0 = bounds.z0;
|
|
24
|
+
|
|
25
|
+
const bounds_scale_x = bounds.getExtentsX() / 1023;
|
|
26
|
+
const bounds_scale_y = bounds.getExtentsY() / 1023;
|
|
27
|
+
const bounds_scale_z = bounds.getExtentsZ() / 1023;
|
|
28
|
+
|
|
29
|
+
array_quick_sort_by_comparator(triangles, (a, b) => {
|
|
30
|
+
|
|
31
|
+
const morton_a = morton_codes[a];
|
|
32
|
+
const morton_b = morton_codes[b];
|
|
33
|
+
|
|
34
|
+
const ax = bounds_x0 + bounds_scale_x * split_by_3(morton_a);
|
|
35
|
+
const ay = bounds_y0 + bounds_scale_y * split_by_3(morton_a >>> 1);
|
|
36
|
+
const az = bounds_z0 + bounds_scale_z * split_by_3(morton_a >>> 2);
|
|
37
|
+
|
|
38
|
+
const bx = bounds_x0 + bounds_scale_x * split_by_3(morton_b);
|
|
39
|
+
const by = bounds_y0 + bounds_scale_y * split_by_3(morton_b >>> 1);
|
|
40
|
+
const bz = bounds_z0 + bounds_scale_z * split_by_3(morton_b >>> 2);
|
|
41
|
+
|
|
42
|
+
const delta_a = v3_distance_sqr(ax, ay, az, point_x, point_y, point_z);
|
|
43
|
+
const delta_b = v3_distance_sqr(bx, by, bz, point_x, point_y, point_z);
|
|
44
|
+
|
|
45
|
+
return delta_b - delta_a;
|
|
46
|
+
}, undefined, offset, count - 1);
|
|
47
|
+
|
|
48
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardMaterial.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/material/StandardMaterial.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StandardMaterial.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/material/StandardMaterial.js"],"names":[],"mappings":"AAWA;IACI,WAAkB;IAElB,yBAA+C;IAC/C,wBAA6C;IAC7C,0BAAiD;IACjD,2BAAmD;IACnD,2BAAmD;CACtD;gCAlB+B,sBAAsB"}
|
|
@@ -7,7 +7,11 @@ const DEFAULT_EMISSIVE = one_pixel_sampler_uint8([0, 0, 0]);
|
|
|
7
7
|
const DEFAULT_ROUGHNESS = one_pixel_sampler_uint8([255]);
|
|
8
8
|
const DEFAULT_METALNESS = one_pixel_sampler_uint8([0]);
|
|
9
9
|
|
|
10
|
+
let id_counter = 0;
|
|
11
|
+
|
|
10
12
|
export class StandardMaterial {
|
|
13
|
+
id = id_counter++;
|
|
14
|
+
|
|
11
15
|
diffuse = StandardTexture.from(DEFAULT_DIFFUSE)
|
|
12
16
|
normal = StandardTexture.from(DEFAULT_NORMAL)
|
|
13
17
|
emissive = StandardTexture.from(DEFAULT_EMISSIVE)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardTexture.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/material/StandardTexture.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StandardTexture.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/material/StandardTexture.js"],"names":[],"mappings":"AAQA;IAgCI;;;;OAIG;IACH,iCAFa,eAAe,CAQ3B;IA1CD,WAAkB;IAElB;;OAEG;IACH,mBAAO;IACP,kBAAsC;IACtC,qBAA2B;IAC3B,cAA2C;IAC3C,cAA2C;IAE3C;;;OAGG;IACH,YAFW,eAAe,QAQzB;IAED,yBAMC;IAeD;;;;;OAKG;IACH,YAJW,MAAM,EAAE,GAAC,YAAY,KACrB,MAAM,KACN,MAAM,QA6BhB;CACJ;+BAvF8B,mDAAmD"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { LinearFilter, LinearMipmapLinearFilter, NearestFilter, NearestMipMapLinearFilter } from "three";
|
|
2
1
|
import { BinaryDataType } from "../../../../../core/binary/type/BinaryDataType.js";
|
|
3
2
|
import { apply_texture_clamping_to_coordinate } from "../texture/apply_texture_clamping_to_coordinate.js";
|
|
4
3
|
import { vec3_uint8_to_float } from "../vec3_uint8_to_float.js";
|
|
5
4
|
import { TextureFilter } from "./TextureFilter.js";
|
|
6
5
|
import { TextureWrapping } from "./TextureWrapping.js";
|
|
7
6
|
|
|
7
|
+
let id_counter = 0;
|
|
8
|
+
|
|
8
9
|
export class StandardTexture {
|
|
10
|
+
id = id_counter++;
|
|
11
|
+
|
|
9
12
|
/**
|
|
10
13
|
* @type {Sampler2D}
|
|
11
14
|
*/
|
|
@@ -66,13 +69,13 @@ export class StandardTexture {
|
|
|
66
69
|
|
|
67
70
|
switch (magFilter) {
|
|
68
71
|
default:
|
|
69
|
-
case NearestFilter:
|
|
70
|
-
case NearestMipMapLinearFilter:
|
|
72
|
+
case TextureFilter.NearestFilter:
|
|
73
|
+
case TextureFilter.NearestMipMapLinearFilter:
|
|
71
74
|
sampler.sampleNearestUV(_u, _v, out);
|
|
72
75
|
break;
|
|
73
76
|
|
|
74
|
-
case LinearFilter:
|
|
75
|
-
case LinearMipmapLinearFilter:
|
|
77
|
+
case TextureFilter.LinearFilter:
|
|
78
|
+
case TextureFilter.LinearMipmapLinearFilter:
|
|
76
79
|
|
|
77
80
|
sampler.sampleBilinearUV(_u, _v, out);
|
|
78
81
|
break;
|
|
@@ -40,8 +40,10 @@ import { DirectionalLight } from "../../render/forward_plus/model/DirectionalLig
|
|
|
40
40
|
import { sampler2d_scale } from "../../texture/sampler/resize/sampler2d_scale.js";
|
|
41
41
|
import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
|
|
42
42
|
import sampler2D2Canvas from "../../texture/sampler/Sampler2D2Canvas.js";
|
|
43
|
+
import { three_object_replace_materials } from "../../three/three_object_replace_materials.js";
|
|
43
44
|
import { PathTracedScene } from "./PathTracedScene.js";
|
|
44
45
|
import { PathTracer } from "./PathTracer.js";
|
|
46
|
+
import { three_object_to_path_traced_scene } from "./three_object_to_path_traced_scene.js";
|
|
45
47
|
|
|
46
48
|
document.body.style.margin = 0;
|
|
47
49
|
document.body.style.overflow = "hidden";
|
|
@@ -74,11 +76,13 @@ vCanvas.css({
|
|
|
74
76
|
* How many rays to use per-pixel
|
|
75
77
|
* @type {number}
|
|
76
78
|
*/
|
|
77
|
-
const PIXEL_SAMPLE_COUNT =
|
|
79
|
+
const PIXEL_SAMPLE_COUNT = 32;
|
|
78
80
|
|
|
79
81
|
const scene = new PathTracedScene();
|
|
80
82
|
const pt = new PathTracer();
|
|
81
83
|
|
|
84
|
+
window.scene = scene;
|
|
85
|
+
|
|
82
86
|
function make_sun({
|
|
83
87
|
temperature = 5000, // around clear-sky day
|
|
84
88
|
color = '#FFFFFF',
|
|
@@ -114,7 +118,7 @@ function prepare_scene_sphere_01(pt, camera) {
|
|
|
114
118
|
const sphere_geo = new OctahedronBufferGeometry(1, 9);
|
|
115
119
|
makeGeometryIndexed(sphere_geo);
|
|
116
120
|
|
|
117
|
-
pt.
|
|
121
|
+
pt.createMesh(
|
|
118
122
|
sphere_geo,
|
|
119
123
|
// new MeshStandardMaterial({ color: '#FF0000' }),
|
|
120
124
|
new MeshStandardMaterial({ color: '#FFFFFF' }),
|
|
@@ -126,7 +130,7 @@ function prepare_scene_sphere_01(pt, camera) {
|
|
|
126
130
|
const ground_material = new MeshStandardMaterial({
|
|
127
131
|
color: '#FFFFFF'
|
|
128
132
|
});
|
|
129
|
-
pt.
|
|
133
|
+
pt.createMesh(new PlaneBufferGeometry(), ground_material, Transform.fromJSON({
|
|
130
134
|
position: new Vector3(0, -0.5, 0),
|
|
131
135
|
scale: 50,
|
|
132
136
|
rotation: Quaternion.fromEulerAngles(-Math.PI / 2, 0, 0)
|
|
@@ -168,6 +172,7 @@ function promise_gltf(url) {
|
|
|
168
172
|
* @param {number} [zoom]
|
|
169
173
|
* @param {number} [floor_level]
|
|
170
174
|
* @param {Object} [sun]
|
|
175
|
+
* @param {boolean} [no_materials]
|
|
171
176
|
* @return {Promise<void>}
|
|
172
177
|
*/
|
|
173
178
|
async function prepare_scene_gltf({
|
|
@@ -176,7 +181,8 @@ async function prepare_scene_gltf({
|
|
|
176
181
|
url,
|
|
177
182
|
zoom = 1,
|
|
178
183
|
floor_level = 0,
|
|
179
|
-
sun
|
|
184
|
+
sun,
|
|
185
|
+
no_materials = false
|
|
180
186
|
}) {
|
|
181
187
|
const gltf = await promise_gltf(url);
|
|
182
188
|
|
|
@@ -184,23 +190,23 @@ async function prepare_scene_gltf({
|
|
|
184
190
|
const ground_material = new MeshStandardMaterial({
|
|
185
191
|
color: '#ffceae'
|
|
186
192
|
});
|
|
187
|
-
scene.
|
|
193
|
+
scene.createMesh(new PlaneBufferGeometry(), ground_material, Transform.fromJSON({
|
|
188
194
|
position: new Vector3(0, floor_level, 0),
|
|
189
195
|
scale: 5000,
|
|
190
196
|
rotation: Quaternion.fromEulerAngles(-Math.PI / 2, 0, 0)
|
|
191
197
|
}).matrix);
|
|
192
198
|
|
|
193
199
|
|
|
194
|
-
gltf.scene
|
|
200
|
+
const gltf_scene = gltf.scene;
|
|
195
201
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
202
|
+
if (no_materials) {
|
|
203
|
+
three_object_replace_materials(gltf_scene, new MeshStandardMaterial({ color: 'white' }));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
three_object_to_path_traced_scene(gltf_scene, scene);
|
|
201
207
|
|
|
202
208
|
const box3 = new Box3();
|
|
203
|
-
box3.setFromObject(
|
|
209
|
+
box3.setFromObject(gltf_scene);
|
|
204
210
|
|
|
205
211
|
const sphere = new Sphere();
|
|
206
212
|
|
|
@@ -229,7 +235,7 @@ async function prepare_scene_lucy(scene, camera) {
|
|
|
229
235
|
const lucy_material = new MeshStandardMaterial({
|
|
230
236
|
color: '#95c9ff'
|
|
231
237
|
});
|
|
232
|
-
scene.
|
|
238
|
+
scene.createMesh(lucy_geom, lucy_material, Transform.fromJSON({
|
|
233
239
|
position: new Vector3(0, 0, 0),
|
|
234
240
|
scale: 1,
|
|
235
241
|
// rotation: Quaternion.fromEulerAngles(-Math.PI / 2, 0, 0)
|
|
@@ -238,7 +244,7 @@ async function prepare_scene_lucy(scene, camera) {
|
|
|
238
244
|
const ground_material = new MeshStandardMaterial({
|
|
239
245
|
color: '#ffceae'
|
|
240
246
|
});
|
|
241
|
-
scene.
|
|
247
|
+
scene.createMesh(new PlaneBufferGeometry(), ground_material, Transform.fromJSON({
|
|
242
248
|
position: new Vector3(0, -800, 0),
|
|
243
249
|
scale: 5000,
|
|
244
250
|
rotation: Quaternion.fromEulerAngles(-Math.PI / 2, 0, 0)
|
|
@@ -347,7 +353,7 @@ async function prepare_scene_rtiow(pt, camera) {
|
|
|
347
353
|
const ground_material = new MeshStandardMaterial({
|
|
348
354
|
color: '#ffffff'
|
|
349
355
|
});
|
|
350
|
-
scene.
|
|
356
|
+
scene.createMesh(new PlaneBufferGeometry(), ground_material, Transform.fromJSON({
|
|
351
357
|
position: new Vector3(0, 0, 0),
|
|
352
358
|
scale: 50,
|
|
353
359
|
rotation: Quaternion.fromEulerAngles(-Math.PI / 2, 0, 0)
|
|
@@ -374,7 +380,7 @@ async function prepare_scene_rtiow(pt, camera) {
|
|
|
374
380
|
const mat = new Float32Array(16);
|
|
375
381
|
mat4.fromRotationTranslationScale(mat, [0, 0, 0, 1], center, [radius, radius, radius])
|
|
376
382
|
|
|
377
|
-
scene.
|
|
383
|
+
scene.createMesh(sphere_geo, material, mat);
|
|
378
384
|
|
|
379
385
|
spheres.push([
|
|
380
386
|
center[0],
|
|
@@ -597,9 +603,9 @@ async function start_renderer(camera) {
|
|
|
597
603
|
// const path = 'data/models/road_bike/road_bike.gltf'; //large CAD-type model
|
|
598
604
|
|
|
599
605
|
// await prepare_scene_lucy(scene, camera);
|
|
600
|
-
await prepare_scene_rtiow(pt, camera);
|
|
606
|
+
// await prepare_scene_rtiow(pt, camera);
|
|
601
607
|
// await prepare_scene_sphere_01(pt, camera);
|
|
602
|
-
|
|
608
|
+
await prepare_gi_box_scene(scene, camera);
|
|
603
609
|
// await prepare_sponza(scene, camera);
|
|
604
610
|
// await prepare_scene_gltf(scene, camera, path);
|
|
605
611
|
|
|
@@ -11,7 +11,7 @@ export function transform_normal_m4(output: number[], output_offset: number, nor
|
|
|
11
11
|
*
|
|
12
12
|
* @param {number[]} output
|
|
13
13
|
* @param {number[]} hit
|
|
14
|
-
* @param {number[]} m 4x4 matrix
|
|
14
|
+
* @param {number[]|Float32Array} m 4x4 matrix
|
|
15
15
|
*/
|
|
16
|
-
export function ray_hit_apply_transform(output: number[], hit: number[], m: number[]): void;
|
|
16
|
+
export function ray_hit_apply_transform(output: number[], hit: number[], m: number[] | Float32Array): void;
|
|
17
17
|
//# sourceMappingURL=ray_hit_apply_transform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ray_hit_apply_transform.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,4CANW,MAAM,EAAE,iBACR,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,KACN,MAAM,EAAE,QAmBlB;AAED;;;;;GAKG;AACH,gDAJW,MAAM,EAAE,OACR,MAAM,EAAE,KACR,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"ray_hit_apply_transform.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/ray_hit_apply_transform.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,4CANW,MAAM,EAAE,iBACR,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,KACN,MAAM,EAAE,QAmBlB;AAED;;;;;GAKG;AACH,gDAJW,MAAM,EAAE,OACR,MAAM,EAAE,KACR,MAAM,EAAE,GAAC,YAAY,QAuB/B"}
|
|
@@ -31,7 +31,7 @@ export function transform_normal_m4(output, output_offset, normal, normal_offset
|
|
|
31
31
|
*
|
|
32
32
|
* @param {number[]} output
|
|
33
33
|
* @param {number[]} hit
|
|
34
|
-
* @param {number[]} m 4x4 matrix
|
|
34
|
+
* @param {number[]|Float32Array} m 4x4 matrix
|
|
35
35
|
*/
|
|
36
36
|
export function ray_hit_apply_transform(output, hit, m) {
|
|
37
37
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBiasedNormalSample.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.js"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,2CAPW,MAAM,EAAE,cACR,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,SACN,MAAM,gBACK,MAAM,QAsD3B;AAED;;;;;;;GAOG;AACH,wCANW,MAAM,EAAE,cACR,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,gBACK,MAAM,QAgC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random_in_hemisphere.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/sh3/path_tracer/sampling/random_in_hemisphere.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,+DALW,MAAM,EAAE,iBACR,MAAM,UACN,MAAM,EAAE,iBACR,MAAM,QAoChB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {BVH} bvh
|
|
4
|
+
* @param {number[]|Uint32Array} node_list
|
|
5
|
+
* @param {number} node_list_offset
|
|
6
|
+
* @param {number} node_list_size
|
|
7
|
+
* @param {number} ref_x
|
|
8
|
+
* @param {number} ref_y
|
|
9
|
+
* @param {number} ref_z
|
|
10
|
+
*/
|
|
11
|
+
export function sort_bvh_nodes_by_distance_to_point(bvh: BVH, node_list: number[] | Uint32Array, node_list_offset: number, node_list_size: number, ref_x: number, ref_y: number, ref_z: number): void;
|
|
12
|
+
//# sourceMappingURL=sort_bvh_nodes_by_distance_to_point.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort_bvh_nodes_by_distance_to_point.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/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"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ELEMENT_WORD_COUNT } from "../../../../core/bvh2/bvh3/BVH.js";
|
|
2
|
+
import { arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
|
|
3
|
+
import {
|
|
4
|
+
aabb3_unsigned_distance_sqr_to_point
|
|
5
|
+
} from "../../../../core/geom/3d/aabb/aabb3_unsigned_distance_sqr_to_point.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {BVH} bvh
|
|
10
|
+
* @param {number[]|Uint32Array} node_list
|
|
11
|
+
* @param {number} node_list_offset
|
|
12
|
+
* @param {number} node_list_size
|
|
13
|
+
* @param {number} ref_x
|
|
14
|
+
* @param {number} ref_y
|
|
15
|
+
* @param {number} ref_z
|
|
16
|
+
*/
|
|
17
|
+
export function sort_bvh_nodes_by_distance_to_point(
|
|
18
|
+
bvh,
|
|
19
|
+
node_list, node_list_offset, node_list_size,
|
|
20
|
+
ref_x, ref_y, ref_z
|
|
21
|
+
) {
|
|
22
|
+
if (node_list_size <= 1) {
|
|
23
|
+
// no sort necessary
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
For performance, we bind data directly to avoid extra copies required to read out AABB
|
|
29
|
+
*/
|
|
30
|
+
const float32 = bvh.__data_float32;
|
|
31
|
+
arrayQuickSort(node_list, (node) => {
|
|
32
|
+
const address = node * ELEMENT_WORD_COUNT;
|
|
33
|
+
|
|
34
|
+
const aabb_distance_sqr = aabb3_unsigned_distance_sqr_to_point(
|
|
35
|
+
float32[address], float32[address + 1], float32[address + 2],
|
|
36
|
+
float32[address + 3], float32[address + 4], float32[address + 5],
|
|
37
|
+
ref_x, ref_y, ref_z
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return aabb_distance_sqr;
|
|
41
|
+
},
|
|
42
|
+
null,
|
|
43
|
+
node_list_offset, node_list_offset + node_list_size - 1
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -2,8 +2,8 @@ import { vec3 } from "gl-matrix";
|
|
|
2
2
|
import { dataTypeFromTypedArray } from "../../../../../core/binary/type/dataTypeFromTypedArray.js";
|
|
3
3
|
import { decode_attribute_value } from "../../../geometry/decode_attribute_value.js";
|
|
4
4
|
import { geometry_construct_triangle_normal } from "../../../geometry/geometry_construct_triangle_normal.js";
|
|
5
|
+
import { sample_triangle_attribute } from "../geometry/sample_triangle_attribute.js";
|
|
5
6
|
import { transform_normal_m4 } from "../ray_hit_apply_transform.js";
|
|
6
|
-
import { sample_triangle_attribute } from "../sample_triangle_attribute.js";
|
|
7
7
|
|
|
8
8
|
const texture_uv = [0, 0];
|
|
9
9
|
const color = new Float64Array([1, 1, 1]);
|
|
@@ -25,7 +25,7 @@ function sample_color_attribute(
|
|
|
25
25
|
u, v
|
|
26
26
|
) {
|
|
27
27
|
const color_array = color_attribute.array;
|
|
28
|
-
sample_triangle_attribute(color, 0, index_0, index_1, index_2, color_array,
|
|
28
|
+
sample_triangle_attribute(color, 0, index_0, index_1, index_2, color_array, color_attribute.itemSize, u, v);
|
|
29
29
|
|
|
30
30
|
const type = dataTypeFromTypedArray(color_array);
|
|
31
31
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"three_object_to_path_traced_scene.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/sh3/path_tracer/three_object_to_path_traced_scene.js"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH,8DAHW,MAAM,QAAQ,gCA2CxB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { meshopt_optimizeVertexCache } from "../../geometry/optimization/VertexCacheOptimizer.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {THREE.BufferGeometry} geo
|
|
6
|
+
* @returns {THREE.BufferGeometry}
|
|
7
|
+
*/
|
|
8
|
+
function optimize_buffer_geometry(geo) {
|
|
9
|
+
|
|
10
|
+
const clone = geo.clone();
|
|
11
|
+
|
|
12
|
+
const result_index_attribute = clone.getIndex();
|
|
13
|
+
const source_index_attribute = geo.getIndex();
|
|
14
|
+
|
|
15
|
+
meshopt_optimizeVertexCache(
|
|
16
|
+
result_index_attribute.array, source_index_attribute.array,
|
|
17
|
+
source_index_attribute.count, geo.getAttribute("position").count
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return clone;
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {THREE.Object3D} gltf_scene
|
|
27
|
+
* @param {PathTracedScene} scene
|
|
28
|
+
*/
|
|
29
|
+
export function three_object_to_path_traced_scene(gltf_scene, scene) {
|
|
30
|
+
const optimized_geometry = new Map();
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param {THREE.BufferGeometry} geo
|
|
36
|
+
* @returns {THREE.BufferGeometry}
|
|
37
|
+
*/
|
|
38
|
+
function process_geometry(geo) {
|
|
39
|
+
const existing = optimized_geometry.get(geo);
|
|
40
|
+
if (existing !== undefined) {
|
|
41
|
+
return existing;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let result;
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
result = optimize_buffer_geometry(geo);
|
|
48
|
+
} catch (e) {
|
|
49
|
+
// failed to optimize, use original
|
|
50
|
+
result = geo;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
optimized_geometry.set(geo, result);
|
|
54
|
+
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
gltf_scene.updateMatrixWorld();
|
|
59
|
+
|
|
60
|
+
gltf_scene.traverse((m) => {
|
|
61
|
+
if (m.isMesh) {
|
|
62
|
+
scene.createMesh(
|
|
63
|
+
process_geometry(m.geometry),
|
|
64
|
+
m.material,
|
|
65
|
+
m.matrixWorld.elements
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -20,9 +20,11 @@ import { is_typed_array_equals } from "../../../core/collection/array/typed/is_t
|
|
|
20
20
|
import { Color } from "../../../core/color/Color.js";
|
|
21
21
|
import { kelvin_to_rgb } from "../../../core/color/kelvin/kelvin_to_rgb.js";
|
|
22
22
|
import { compose_matrix4_array } from "../../../core/geom/3d/compose_matrix4_array.js";
|
|
23
|
+
import { visualize_tetrahedral_mesh } from "../../../core/geom/3d/tetrahedra/visualize_tetrahedral_mesh.js";
|
|
23
24
|
import Quaternion from "../../../core/geom/Quaternion.js";
|
|
24
25
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
25
26
|
import { max2 } from "../../../core/math/max2.js";
|
|
27
|
+
import { min2 } from "../../../core/math/min2.js";
|
|
26
28
|
import { randomFloatBetween } from "../../../core/math/random/randomFloatBetween.js";
|
|
27
29
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
28
30
|
import { number_pretty_print } from "../../../core/primitives/numbers/number_pretty_print.js";
|
|
@@ -51,7 +53,7 @@ import { GizmoRenderingPlugin } from "../render/gizmo/GizmoRenderingPlugin.js";
|
|
|
51
53
|
import { MaterialTransformer } from "./gi/material/MaterialTransformer.js";
|
|
52
54
|
import { build_probes_for_scene } from "./lpv/build_probes_for_scene.js";
|
|
53
55
|
import { LightProbeVolume } from "./lpv/LightProbeVolume.js";
|
|
54
|
-
import { LightProbeVolumeSerializationAdapter } from "./lpv/LightProbeVolumeSerializationAdapter.js";
|
|
56
|
+
import { LightProbeVolumeSerializationAdapter } from "./lpv/serialization/LightProbeVolumeSerializationAdapter.js";
|
|
55
57
|
|
|
56
58
|
/**
|
|
57
59
|
*
|
|
@@ -355,26 +357,27 @@ async function main(engine) {
|
|
|
355
357
|
const ecd = engine.entityManager.dataset;
|
|
356
358
|
|
|
357
359
|
|
|
360
|
+
// const path = 'data/models/samples/sd_macross_city_standoff_diorama/scene.gltf';
|
|
358
361
|
// const path = 'data/models/LowPolyTownshipSet/Small_house/Small_house.gltf';
|
|
359
362
|
// const path = 'data/models/sibenik/2/model.gltf';
|
|
360
363
|
// const path = 'data/models/vokselia_spawn/model.gltf';
|
|
361
364
|
// const path = 'data/models/LowPolyTownshipSet/Town_Hall/model.gltf';
|
|
362
|
-
// const path = 'data/models/pica_pica/pica_pica.gltf';
|
|
363
365
|
// const path = 'data/models/samples/low_poly_classroom/no-glass/model.gltf';
|
|
364
366
|
// const path = 'data/models/samples/just_a_girl/scene.gltf';
|
|
365
367
|
// const path = 'data/models/samples/slum_house/scene.gltf';
|
|
366
368
|
// const path = 'data/models/samples/jack_trigger/scene.gltf';
|
|
367
369
|
// const path = 'data/models/samples/cornell_box/scene.gltf';
|
|
368
|
-
// const path = 'data/models/samples/cyberpunk_bike/scene.gltf';
|
|
369
|
-
// const path = 'data/models/samples/sd_macross_city_standoff_diorama/scene.gltf';
|
|
370
370
|
// const path = 'data/models/Slaughter Mech/Slaugter Mech.gltf';
|
|
371
371
|
// const path = 'data/models/samples/gi_box_01/model-thick-1.glb';
|
|
372
372
|
// const path = 'data/models/sibenik/3-window-less/model.gltf';
|
|
373
373
|
// const path = 'data/models/samples/ancient_bath_house_-_modular_set/scene.gltf';
|
|
374
374
|
// const path = 'data/models/samples/environment_-_library/scene.gltf';
|
|
375
375
|
// const path = 'data/models/samples/the_attic_environment/scene1.gltf';
|
|
376
|
+
// const path = 'data/models/samples/cyberpunk_bike/scene.gltf';
|
|
376
377
|
const path = 'data/models/sponza-pbr/gltf/sponza.glb';
|
|
377
378
|
// const path = 'data/models/samples/gi_box_01/model.glb';
|
|
379
|
+
// const path = 'data/models/Scans/green_car_wreck/scene.gltf';
|
|
380
|
+
// const path = 'data/models/pica_pica/pica_pica.gltf';
|
|
378
381
|
|
|
379
382
|
const mesh_asset = await engine.assetManager.promise(path, 'model/gltf+json');
|
|
380
383
|
const gltf = mesh_asset.gltf;
|
|
@@ -438,6 +441,7 @@ async function main(engine) {
|
|
|
438
441
|
camera.component.clip_far = max2(100, model_footprint);
|
|
439
442
|
const camera_controller = ecd.getComponent(camera.entity, TopDownCameraController);
|
|
440
443
|
camera_controller.distanceMax = model_footprint * 1.1;
|
|
444
|
+
camera_controller.distanceMin = min2(camera_controller.distanceMin, model_footprint * 0.01);
|
|
441
445
|
mesh_bounds.getCenter(camera_controller.target)
|
|
442
446
|
|
|
443
447
|
const random = seededRandom();
|
|
@@ -486,6 +490,12 @@ async function main(engine) {
|
|
|
486
490
|
const probe_viz = volume.visualize_probes({ size: model_footprint * 0.002 });
|
|
487
491
|
probe_viz.build(ecd);
|
|
488
492
|
|
|
493
|
+
const mesh_viz = visualize_tetrahedral_mesh({
|
|
494
|
+
mesh: volume.mesh,
|
|
495
|
+
positions: volume.points,
|
|
496
|
+
opacity: 0.5
|
|
497
|
+
});
|
|
498
|
+
|
|
489
499
|
// volume.visualize_mesh({ ecd, opacity: 0.5 });
|
|
490
500
|
|
|
491
501
|
const gui = new GUI();
|
|
@@ -503,14 +513,26 @@ async function main(engine) {
|
|
|
503
513
|
get probe_vis() {
|
|
504
514
|
return probe_viz.isBuilt
|
|
505
515
|
},
|
|
506
|
-
set probe_vis(v){
|
|
507
|
-
if(v){
|
|
516
|
+
set probe_vis(v) {
|
|
517
|
+
if (v) {
|
|
508
518
|
probe_viz.build(ecd);
|
|
509
|
-
}else{
|
|
519
|
+
} else {
|
|
510
520
|
probe_viz.destroy();
|
|
511
521
|
}
|
|
512
522
|
}
|
|
513
523
|
}, "probe_vis").name("Visualise Probes");
|
|
524
|
+
gui.add({
|
|
525
|
+
get mesh_vis() {
|
|
526
|
+
return mesh_viz.isBuilt
|
|
527
|
+
},
|
|
528
|
+
set mesh_vis(v) {
|
|
529
|
+
if (v) {
|
|
530
|
+
mesh_viz.build(ecd);
|
|
531
|
+
} else {
|
|
532
|
+
mesh_viz.destroy();
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}, "mesh_vis").name("Visualise Mesh");
|
|
514
536
|
|
|
515
537
|
|
|
516
538
|
// mesh_entity.addEventListener(SGMeshEvents.AssetLoaded, build);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatToChannelCount.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/texture/formatToChannelCount.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatToChannelCount.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/texture/formatToChannelCount.js"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,6CAHW,MAAM,GACJ,MAAM,CAoBlB"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
RedFormat,
|
|
3
|
+
RedIntegerFormat,
|
|
4
|
+
RGB_S3TC_DXT1_Format,
|
|
5
|
+
RGBA_S3TC_DXT1_Format,
|
|
6
|
+
RGBA_S3TC_DXT3_Format,
|
|
7
|
+
RGBA_S3TC_DXT5_Format,
|
|
8
|
+
RGBAFormat,
|
|
9
|
+
RGFormat
|
|
10
|
+
} from "three";
|
|
2
11
|
|
|
3
12
|
|
|
4
13
|
/**
|
|
@@ -20,8 +29,12 @@ export function formatToChannelCount(format) {
|
|
|
20
29
|
case RGFormat:
|
|
21
30
|
return 2;
|
|
22
31
|
case RGBFormat:
|
|
32
|
+
case RGB_S3TC_DXT1_Format:
|
|
23
33
|
return 3;
|
|
24
34
|
case RGBAFormat:
|
|
35
|
+
case RGBA_S3TC_DXT1_Format:
|
|
36
|
+
case RGBA_S3TC_DXT3_Format:
|
|
37
|
+
case RGBA_S3TC_DXT5_Format:
|
|
25
38
|
return 4;
|
|
26
39
|
default:
|
|
27
40
|
throw new Error(`Unsupported format '${format}'`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"three_object_replace_materials.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/three/three_object_replace_materials.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qDAHW,MAAM,QAAQ,eACd,MAAM,QAAQ,QASxB"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {number[]|Uint32Array} data
|
|
3
|
-
* @param {number[]|Uint32Array} lookup
|
|
4
|
-
* @param {number} start
|
|
5
|
-
* @param {number} end
|
|
6
|
-
*/
|
|
7
|
-
export function array_quick_sort_by_lookup(data: number[] | Uint32Array, lookup: number[] | Uint32Array, start: number, end: number): void;
|
|
8
|
-
//# sourceMappingURL=array_quick_sort_by_lookup.d.ts.map
|