@woosh/meep-engine 2.138.17 → 2.138.19
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 +2 -2
- package/build/bundle-worker-image-decoder.js +1 -1
- package/editor/actions/concrete/ActionUpdateTexture.d.ts +12 -0
- package/editor/actions/concrete/ActionUpdateTexture.d.ts.map +1 -0
- package/editor/actions/concrete/ArrayCopyAction.d.ts +20 -0
- package/editor/actions/concrete/ArrayCopyAction.d.ts.map +1 -0
- package/editor/actions/concrete/ComponentRemoveAction.d.ts +11 -0
- package/editor/actions/concrete/ComponentRemoveAction.d.ts.map +1 -0
- package/editor/actions/concrete/ModifyPatchSampler2DAction.d.ts +47 -0
- package/editor/actions/concrete/ModifyPatchSampler2DAction.d.ts.map +1 -0
- package/editor/actions/concrete/ModifyPatchTextureArray2DAction.d.ts +38 -0
- package/editor/actions/concrete/ModifyPatchTextureArray2DAction.d.ts.map +1 -0
- package/editor/actions/concrete/PaintTerrainOverlayAction.d.ts +23 -0
- package/editor/actions/concrete/PaintTerrainOverlayAction.d.ts.map +1 -0
- package/editor/actions/concrete/PatchTerrainHeightAction.d.ts +19 -0
- package/editor/actions/concrete/PatchTerrainHeightAction.d.ts.map +1 -0
- package/editor/actions/concrete/SelectionRemoveAction.d.ts +10 -0
- package/editor/actions/concrete/SelectionRemoveAction.d.ts.map +1 -0
- package/editor/actions/concrete/WriteGridValueAction.d.ts +15 -0
- package/editor/actions/concrete/WriteGridValueAction.d.ts.map +1 -0
- package/editor/ecs/component/FieldDescriptor.d.ts +27 -0
- package/editor/ecs/component/FieldDescriptor.d.ts.map +1 -0
- package/editor/ecs/component/FieldValueAdapter.d.ts +7 -0
- package/editor/ecs/component/FieldValueAdapter.d.ts.map +1 -0
- package/editor/ecs/component/createFieldEditor.d.ts +9 -0
- package/editor/ecs/component/createFieldEditor.d.ts.map +1 -0
- package/editor/ecs/component/createObjectEditor.d.ts +14 -0
- package/editor/ecs/component/createObjectEditor.d.ts.map +1 -0
- package/editor/ecs/component/editors/geom/QuaternionEditor.d.ts.map +1 -1
- package/editor/ecs/component/findNearestRegisteredType.d.ts +8 -0
- package/editor/ecs/component/findNearestRegisteredType.d.ts.map +1 -0
- package/editor/process/ObstacleGridDisplayProcess.d.ts.map +1 -1
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.d.ts.map +1 -1
- package/editor/tools/GridPaintTool.d.ts +17 -0
- package/editor/tools/GridPaintTool.d.ts.map +1 -0
- package/editor/tools/SelectionTool.d.ts +27 -0
- package/editor/tools/SelectionTool.d.ts.map +1 -0
- package/editor/tools/TopDownCameraControlTool.d.ts +13 -0
- package/editor/tools/TopDownCameraControlTool.d.ts.map +1 -0
- package/editor/view/ecs/ComponentControlFactory.d.ts.map +1 -0
- package/editor/view/ecs/ComponentControlView.d.ts.map +1 -1
- package/editor/view/ecs/EntityEditor.d.ts.map +1 -0
- package/editor/view/ecs/EntityList.d.ts.map +1 -0
- package/editor/view/ecs/HierarchicalEntityListView.d.ts.map +1 -0
- package/editor/view/node-graph/NodeGraphEditorView.d.ts.map +1 -1
- package/editor/view/node-graph/NodeGraphView.d.ts.map +1 -1
- package/editor/view/node-graph/NodeView.d.ts.map +1 -1
- package/editor/view/node-graph/PortView.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/binary/BinaryBuffer.d.ts +1 -1
- package/src/core/binary/BinaryBuffer.js +1 -1
- package/src/core/binary/BitSet.d.ts +1 -1
- package/src/core/binary/BitSet.js +1 -1
- package/src/core/cache/Cache.js +1 -1
- package/src/core/cache/LoadingCache.js +1 -1
- package/src/core/collection/list/List.js +1 -1
- package/src/core/collection/map/HashMap.js +1 -1
- package/src/core/collection/table/RowFirstTable.d.ts +1 -1
- package/src/core/collection/table/RowFirstTable.js +1 -1
- package/src/core/collection/table/RowFirstTableSpec.d.ts +1 -1
- package/src/core/collection/table/RowFirstTableSpec.js +1 -1
- package/src/core/color/oklab/compute_max_saturation.d.ts +1 -1
- package/src/core/color/oklab/compute_max_saturation.js +1 -1
- package/src/core/color/oklab/find_cusp.d.ts +1 -1
- package/src/core/color/oklab/find_cusp.js +1 -1
- package/src/core/color/oklab/find_gamut_intersection.d.ts +1 -1
- package/src/core/color/oklab/find_gamut_intersection.js +1 -1
- package/src/core/color/oklab/okhsv_to_linear_srgb.d.ts +1 -1
- package/src/core/color/oklab/okhsv_to_linear_srgb.js +1 -1
- package/src/core/color/oklab/oklab_to_linear_srgb.d.ts +1 -1
- package/src/core/color/oklab/oklab_to_linear_srgb.js +1 -1
- package/src/core/color/oklab/oklab_to_xyz.d.ts +1 -1
- package/src/core/color/oklab/oklab_to_xyz.js +1 -1
- package/src/core/color/oklab/xyz_to_oklab.d.ts +1 -1
- package/src/core/color/oklab/xyz_to_oklab.js +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.d.ts +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_nearest_point_on_surface.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_nearest_point_on_surface.js +57 -65
- package/src/core/geom/3d/octahedra/octahedral_uv_wrap.d.ts +1 -1
- package/src/core/geom/3d/octahedra/octahedral_uv_wrap.js +1 -1
- package/src/core/geom/3d/quaternion/quat_decode_from_uint32.d.ts +1 -1
- package/src/core/geom/3d/quaternion/quat_decode_from_uint32.js +1 -1
- package/src/core/geom/3d/quaternion/quat_encode_to_uint32.d.ts +1 -1
- package/src/core/geom/3d/quaternion/quat_encode_to_uint32.js +1 -1
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts +74 -3
- package/src/core/geom/3d/shape/CapsuleShape3D.d.ts +37 -0
- package/src/core/geom/3d/shape/CapsuleShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/CapsuleShape3D.js +210 -0
- package/src/core/geom/3d/shape/PointShape3D.d.ts +5 -0
- package/src/core/geom/3d/shape/PointShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/PointShape3D.js +52 -14
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts +75 -12
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +12 -3
- package/src/core/geom/3d/shape/UnionShape3D.d.ts +47 -5
- package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts +12 -5
- package/src/core/geom/3d/shape/UnitCubeShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts +17 -5
- package/src/core/geom/3d/shape/UnitSphereShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/json/shape_to_type.d.ts.map +1 -1
- package/src/core/geom/3d/shape/json/shape_to_type.js +4 -1
- package/src/core/geom/3d/shape/json/type_adapters.d.ts +17 -2
- package/src/core/geom/3d/shape/json/type_adapters.d.ts.map +1 -1
- package/src/core/geom/3d/shape/json/type_adapters.js +18 -2
- package/src/core/geom/3d/shape/util/compute_signed_distance_gradient_by_sampling.d.ts.map +1 -1
- package/src/core/geom/3d/shape/util/compute_signed_distance_gradient_by_sampling.js +51 -48
- package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.d.ts +1 -1
- package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.js +1 -1
- package/src/core/geom/ConicRay.d.ts +1 -1
- package/src/core/geom/ConicRay.js +1 -1
- package/src/core/geom/Quaternion.d.ts +2 -2
- package/src/core/geom/Quaternion.js +2 -2
- package/src/core/geom/Vector1.d.ts +1 -1
- package/src/core/geom/Vector1.js +1 -1
- package/src/core/geom/Vector2.d.ts +1 -1
- package/src/core/geom/Vector2.js +1 -1
- package/src/core/geom/Vector3.d.ts +1 -1
- package/src/core/geom/Vector3.js +1 -1
- package/src/core/geom/packing/miniball/Miniball.d.ts +1 -1
- package/src/core/geom/packing/miniball/Miniball.js +1 -1
- package/src/core/geom/vec3/serialization/v3_binary_equality_decode.d.ts +1 -1
- package/src/core/geom/vec3/serialization/v3_binary_equality_decode.js +1 -1
- package/src/core/geom/vec3/serialization/v3_binary_equality_encode.d.ts +1 -1
- package/src/core/geom/vec3/serialization/v3_binary_equality_encode.js +1 -1
- package/src/core/math/spline/spline3_hermite.d.ts +1 -1
- package/src/core/math/spline/spline3_hermite.js +1 -1
- package/src/core/math/spline/spline3_hermite_bounds.d.ts +1 -1
- package/src/core/math/spline/spline3_hermite_bounds.js +1 -1
- package/src/core/math/spline/spline3_hermite_bounds_t.d.ts +1 -1
- package/src/core/math/spline/spline3_hermite_bounds_t.js +1 -1
- package/src/core/math/spline/spline3_hermite_to_monomial.d.ts +1 -1
- package/src/core/math/spline/spline3_hermite_to_monomial.js +1 -1
- package/src/core/model/ObservedBoolean.d.ts +1 -1
- package/src/core/model/ObservedBoolean.js +1 -1
- package/src/core/model/ObservedString.d.ts +1 -1
- package/src/core/model/ObservedString.js +1 -1
- package/src/core/process/undo/Action.js +1 -1
- package/src/core/process/undo/ActionProcessor.js +1 -1
- package/src/engine/animation/curve/AnimationCurve.d.ts +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +1 -1
- package/src/engine/animation/curve/Keyframe.d.ts +1 -1
- package/src/engine/animation/curve/Keyframe.js +1 -1
- package/src/engine/animation/curve/animation_curve_compute_aabb.d.ts +1 -1
- package/src/engine/animation/curve/animation_curve_compute_aabb.js +1 -1
- package/src/engine/animation/curve/animation_curve_optimize.d.ts +1 -1
- package/src/engine/animation/curve/animation_curve_optimize.js +2 -2
- package/src/engine/asset/loaders/image/jpeg/JpegImage.js +1 -1
- package/src/engine/asset/loaders/image/png/PNGReader.d.ts.map +1 -1
- package/src/engine/asset/loaders/image/png/PNGReader.js +27 -7
- package/src/engine/asset/loaders/image/png/crc32.d.ts +1 -1
- package/src/engine/asset/loaders/image/png/crc32.js +1 -1
- package/src/engine/control/first-person/DESIGN.md +616 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +229 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.js +176 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +251 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +205 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +151 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +799 -0
- package/src/engine/control/first-person/math/computeJumpFromApex.d.ts +23 -0
- package/src/engine/control/first-person/math/computeJumpFromApex.d.ts.map +1 -0
- package/src/engine/control/first-person/math/computeJumpFromApex.js +23 -0
- package/src/engine/control/first-person/math/criticallyDampedSpring.d.ts +23 -0
- package/src/engine/control/first-person/math/criticallyDampedSpring.d.ts.map +1 -0
- package/src/engine/control/first-person/math/criticallyDampedSpring.js +34 -0
- package/src/engine/control/first-person/math/dampedSpringStep.d.ts +23 -0
- package/src/engine/control/first-person/math/dampedSpringStep.d.ts.map +1 -0
- package/src/engine/control/first-person/math/dampedSpringStep.js +72 -0
- package/src/engine/control/first-person/math/stepTowards.d.ts +12 -0
- package/src/engine/control/first-person/math/stepTowards.d.ts.map +1 -0
- package/src/engine/control/first-person/math/stepTowards.js +20 -0
- package/src/engine/control/first-person/pose/FirstPersonPose.d.ts +69 -0
- package/src/engine/control/first-person/pose/FirstPersonPose.d.ts.map +1 -0
- package/src/engine/control/first-person/pose/FirstPersonPose.js +91 -0
- package/src/engine/control/first-person/prototype_first_person_controller.d.ts +2 -0
- package/src/engine/control/first-person/prototype_first_person_controller.d.ts.map +1 -0
- package/src/engine/control/first-person/prototype_first_person_controller.js +314 -0
- package/src/engine/ecs/Entity.js +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +1 -1
- package/src/engine/ecs/EntityManager.d.ts +1 -1
- package/src/engine/ecs/EntityManager.js +1 -1
- package/src/engine/ecs/EntityObserver.js +1 -1
- package/src/engine/ecs/EntityReference.d.ts +1 -1
- package/src/engine/ecs/EntityReference.js +1 -1
- package/src/engine/ecs/System.js +1 -1
- package/src/engine/ecs/attachment/AttachmentSystem.d.ts +2 -2
- package/src/engine/ecs/attachment/AttachmentSystem.d.ts.map +1 -1
- package/src/engine/ecs/grid/HeightMap2AOMap.d.ts.map +1 -1
- package/src/engine/ecs/grid/HeightMap2AOMap.js +3 -2
- package/src/engine/ecs/guid/UUID.d.ts +1 -1
- package/src/engine/ecs/guid/UUID.js +1 -1
- package/src/engine/ecs/name/Name.d.ts +1 -1
- package/src/engine/ecs/name/Name.js +1 -1
- package/src/engine/ecs/parent/ParentEntity.js +1 -1
- package/src/engine/ecs/storage/BinaryBufferDeSerializer.d.ts +1 -1
- package/src/engine/ecs/storage/BinaryBufferDeSerializer.js +1 -1
- package/src/engine/ecs/storage/BinaryBufferSerializer.d.ts +1 -1
- package/src/engine/ecs/storage/BinaryBufferSerializer.js +1 -1
- package/src/engine/ecs/storage/binary/BinaryClassSerializationAdapter.js +1 -1
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.d.ts +1 -1
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +1 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.d.ts +1 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +1 -1
- package/src/engine/ecs/transform/Transform.d.ts +1 -1
- package/src/engine/ecs/transform/Transform.js +1 -1
- package/src/engine/graphics/ecs/path/PathDisplaySystem.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +10 -1
- package/src/engine/graphics/impostors/voxel/README.md +149 -0
- package/src/engine/graphics/impostors/voxel/VoxelImpostorBaker.d.ts +91 -0
- package/src/engine/graphics/impostors/voxel/VoxelImpostorBaker.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/VoxelImpostorBaker.js +376 -0
- package/src/engine/graphics/impostors/voxel/VoxelImpostorDescription.d.ts +128 -0
- package/src/engine/graphics/impostors/voxel/VoxelImpostorDescription.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/VoxelImpostorDescription.js +141 -0
- package/src/engine/graphics/impostors/voxel/bake/read_atlas_to_samples.d.ts +38 -0
- package/src/engine/graphics/impostors/voxel/bake/read_atlas_to_samples.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/bake/read_atlas_to_samples.js +338 -0
- package/src/engine/graphics/impostors/voxel/bake/voxelize_samples.d.ts +43 -0
- package/src/engine/graphics/impostors/voxel/bake/voxelize_samples.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/bake/voxelize_samples.js +192 -0
- package/src/engine/graphics/impostors/voxel/prototype_voxel_impostors.d.ts +2 -0
- package/src/engine/graphics/impostors/voxel/prototype_voxel_impostors.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/prototype_voxel_impostors.js +343 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderDepthV0.d.ts +13 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderDepthV0.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderDepthV0.js +99 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderLitV0.d.ts +19 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderLitV0.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderLitV0.js +231 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderNormalsV0.d.ts +5 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderNormalsV0.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderNormalsV0.js +70 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderV0.d.ts +13 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderV0.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderV0.js +127 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderViewportDepthV0.d.ts +5 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderViewportDepthV0.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/shader/VoxelImpostorShaderViewportDepthV0.js +68 -0
- package/src/engine/graphics/impostors/voxel/util/make_voxel_impostor_geometry.d.ts +27 -0
- package/src/engine/graphics/impostors/voxel/util/make_voxel_impostor_geometry.d.ts.map +1 -0
- package/src/engine/graphics/impostors/voxel/util/make_voxel_impostor_geometry.js +96 -0
- package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.d.ts +113 -29
- package/src/engine/graphics/render/forward_plus/SPECIFICATION.md +1 -1
- package/src/engine/graphics/shaders/AmbientOcclusionShader.d.ts.map +1 -1
- package/src/engine/graphics/shaders/AmbientOcclusionShader.js +20 -5
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +1 -1
- package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.d.ts +1 -1
- package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.js +1 -1
- package/src/engine/graphics/util/build_max_height_pyramid.d.ts +21 -14
- package/src/engine/graphics/util/build_max_height_pyramid.d.ts.map +1 -1
- package/src/engine/graphics/util/build_max_height_pyramid.js +107 -70
- package/src/engine/input/devices/InputDeviceSwitch.js +1 -1
- package/src/engine/input/devices/KeyboardDevice.js +1 -1
- package/src/engine/input/devices/PointerDevice.js +1 -1
- package/src/engine/intelligence/behavior/Behavior.js +1 -1
- package/src/engine/intelligence/behavior/SelectorBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/SelectorBehavior.js +1 -1
- package/src/engine/intelligence/behavior/behavior_to_dot.d.ts +1 -1
- package/src/engine/intelligence/behavior/behavior_to_dot.js +1 -1
- package/src/engine/intelligence/behavior/composite/CompositeBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/composite/CompositeBehavior.js +1 -1
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.js +1 -1
- package/src/engine/intelligence/behavior/composite/SequenceBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/composite/SequenceBehavior.js +1 -1
- package/src/engine/intelligence/behavior/decorator/AbstractDecoratorBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/decorator/AbstractDecoratorBehavior.js +1 -1
- package/src/engine/intelligence/behavior/decorator/IgnoreFailureBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/decorator/IgnoreFailureBehavior.js +1 -1
- package/src/engine/intelligence/behavior/decorator/InvertStatusBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/decorator/InvertStatusBehavior.js +1 -1
- package/src/engine/intelligence/behavior/decorator/RepeatBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/decorator/RepeatBehavior.js +1 -1
- package/src/engine/intelligence/behavior/decorator/RepeatUntilSuccessBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/decorator/RepeatUntilSuccessBehavior.js +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.js +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorSystem.d.ts +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorSystem.js +1 -1
- package/src/engine/intelligence/behavior/ecs/DieBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/ecs/DieBehavior.js +1 -1
- package/src/engine/intelligence/behavior/ecs/EntityBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/ecs/EntityBehavior.js +1 -1
- package/src/engine/intelligence/behavior/ecs/KillBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/ecs/KillBehavior.js +1 -1
- package/src/engine/intelligence/behavior/ecs/SendEventBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/ecs/SendEventBehavior.js +1 -1
- package/src/engine/intelligence/behavior/ecs/WaitForEventBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/ecs/WaitForEventBehavior.js +1 -1
- package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/primitive/ActionBehavior.js +1 -1
- package/src/engine/intelligence/behavior/primitive/FailingBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/primitive/FailingBehavior.js +1 -1
- package/src/engine/intelligence/behavior/primitive/PromiseBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/primitive/PromiseBehavior.js +1 -1
- package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.js +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedElement.d.ts +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedElement.js +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.js +1 -1
- package/src/engine/intelligence/behavior/util/BranchBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/util/BranchBehavior.js +1 -1
- package/src/engine/intelligence/behavior/util/DelayBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/util/DelayBehavior.js +1 -1
- package/src/engine/intelligence/behavior/util/LogMessageBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/util/LogMessageBehavior.js +1 -1
- package/src/engine/intelligence/behavior/util/RandomDelayBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/util/RandomDelayBehavior.js +1 -1
- package/src/engine/intelligence/blackboard/Blackboard.js +1 -1
- package/src/engine/intelligence/mcts/MonteCarlo.d.ts +1 -1
- package/src/engine/intelligence/mcts/MonteCarlo.js +1 -1
- package/src/engine/intelligence/mcts/MoveEdge.d.ts +1 -1
- package/src/engine/intelligence/mcts/MoveEdge.js +1 -1
- package/src/engine/intelligence/mcts/StateNode.d.ts +1 -1
- package/src/engine/intelligence/mcts/StateNode.js +1 -1
- package/src/engine/intelligence/resource/ActionSequence.d.ts +1 -1
- package/src/engine/intelligence/resource/ActionSequence.js +1 -1
- package/src/engine/intelligence/resource/Resource.d.ts +1 -1
- package/src/engine/intelligence/resource/Resource.js +1 -1
- package/src/engine/intelligence/resource/ResourceAllocation.d.ts +1 -1
- package/src/engine/intelligence/resource/ResourceAllocation.js +1 -1
- package/src/engine/intelligence/resource/ResourceAllocationBid.d.ts +1 -1
- package/src/engine/intelligence/resource/ResourceAllocationBid.js +1 -1
- package/src/engine/intelligence/resource/ResourceAllocationSolver.d.ts +1 -1
- package/src/engine/intelligence/resource/ResourceAllocationSolver.js +1 -1
- package/src/engine/intelligence/resource/StrategicResourceAllocator.d.ts +1 -1
- package/src/engine/intelligence/resource/StrategicResourceAllocator.js +1 -1
- package/src/engine/intelligence/resource/TacticalModule.d.ts +1 -1
- package/src/engine/intelligence/resource/TacticalModule.js +1 -1
- package/src/engine/network/NetworkSession.d.ts +1 -1
- package/src/engine/network/NetworkSession.js +1 -1
- package/src/engine/network/adapters/QuaternionInterpolationAdapter.d.ts +1 -1
- package/src/engine/network/adapters/QuaternionInterpolationAdapter.js +1 -1
- package/src/engine/network/adapters/TransformInterpolationAdapter.d.ts +1 -1
- package/src/engine/network/adapters/TransformInterpolationAdapter.js +1 -1
- package/src/engine/network/adapters/TransformReplicationAdapter.d.ts +1 -1
- package/src/engine/network/adapters/TransformReplicationAdapter.js +1 -1
- package/src/engine/network/adapters/Vector3InterpolationAdapter.d.ts +1 -1
- package/src/engine/network/adapters/Vector3InterpolationAdapter.js +1 -1
- package/src/engine/network/core/quantize/quantize_float.d.ts +1 -1
- package/src/engine/network/core/quantize/quantize_float.js +1 -1
- package/src/engine/network/core/quantize/quantize_position.d.ts +1 -1
- package/src/engine/network/core/quantize/quantize_position.js +1 -1
- package/src/engine/network/core/sequence/ack_bitfield.d.ts +1 -1
- package/src/engine/network/core/sequence/ack_bitfield.js +1 -1
- package/src/engine/network/core/sequence/seq16.d.ts +1 -1
- package/src/engine/network/core/sequence/seq16.js +1 -1
- package/src/engine/network/core/sequence/seq32.d.ts +1 -1
- package/src/engine/network/core/sequence/seq32.js +1 -1
- package/src/engine/network/diagnostics/BandwidthMeter.d.ts +1 -1
- package/src/engine/network/diagnostics/BandwidthMeter.js +1 -1
- package/src/engine/network/diagnostics/ReplayLog.d.ts +1 -1
- package/src/engine/network/diagnostics/ReplayLog.js +1 -1
- package/src/engine/network/diagnostics/SyncTest.d.ts +1 -1
- package/src/engine/network/diagnostics/SyncTest.js +1 -1
- package/src/engine/network/ecs/NetworkSystem.d.ts +1 -1
- package/src/engine/network/ecs/NetworkSystem.js +1 -1
- package/src/engine/network/ecs/components/NetworkIdentity.d.ts +1 -1
- package/src/engine/network/ecs/components/NetworkIdentity.js +1 -1
- package/src/engine/network/ecs/serialization/NetworkIdentitySerializationAdapter.d.ts +1 -1
- package/src/engine/network/ecs/serialization/NetworkIdentitySerializationAdapter.js +1 -1
- package/src/engine/network/orchestrator/NetworkPeer.d.ts +1 -1
- package/src/engine/network/orchestrator/NetworkPeer.js +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +1 -1
- package/src/engine/network/replication/Replicator.d.ts +1 -1
- package/src/engine/network/replication/Replicator.js +1 -1
- package/src/engine/network/replication/ScopeFilter.d.ts +2 -2
- package/src/engine/network/replication/ScopeFilter.js +2 -2
- package/src/engine/network/sim/ActionLog.d.ts +1 -1
- package/src/engine/network/sim/ActionLog.js +1 -1
- package/src/engine/network/sim/BinaryInterpolationAdapter.d.ts +1 -1
- package/src/engine/network/sim/BinaryInterpolationAdapter.js +1 -1
- package/src/engine/network/sim/InterpolationLog.d.ts +1 -1
- package/src/engine/network/sim/InterpolationLog.js +1 -1
- package/src/engine/network/sim/ReplicatedComponentRegistry.d.ts +1 -1
- package/src/engine/network/sim/ReplicatedComponentRegistry.js +1 -1
- package/src/engine/network/sim/RewindEngine.d.ts +1 -1
- package/src/engine/network/sim/RewindEngine.js +1 -1
- package/src/engine/network/sim/SimAction.d.ts +1 -1
- package/src/engine/network/sim/SimAction.js +1 -1
- package/src/engine/network/sim/SimActionExecutor.d.ts +1 -1
- package/src/engine/network/sim/SimActionExecutor.js +1 -1
- package/src/engine/network/sim/SimActionRegistry.d.ts +1 -1
- package/src/engine/network/sim/SimActionRegistry.js +1 -1
- package/src/engine/network/sim/SmoothingState.js +1 -1
- package/src/engine/network/sim/Snapshotter.d.ts +1 -1
- package/src/engine/network/sim/Snapshotter.js +1 -1
- package/src/engine/network/sim/SpeculationLog.d.ts +1 -1
- package/src/engine/network/sim/SpeculationLog.js +1 -1
- package/src/engine/network/state/Baseline.d.ts +1 -1
- package/src/engine/network/state/Baseline.js +1 -1
- package/src/engine/network/state/ChangedEntitySet.d.ts +1 -1
- package/src/engine/network/state/ChangedEntitySet.js +1 -1
- package/src/engine/network/state/InputRing.d.ts +1 -1
- package/src/engine/network/state/InputRing.js +1 -1
- package/src/engine/network/state/MutationLedger.d.ts +1 -1
- package/src/engine/network/state/MutationLedger.js +1 -1
- package/src/engine/network/state/PriorityAccumulator.d.ts +1 -1
- package/src/engine/network/state/PriorityAccumulator.js +1 -1
- package/src/engine/network/state/ReplicationSlotTable.d.ts +1 -1
- package/src/engine/network/state/ReplicationSlotTable.js +1 -1
- package/src/engine/network/time/AdaptiveRenderDelay.d.ts +1 -1
- package/src/engine/network/time/AdaptiveRenderDelay.js +1 -1
- package/src/engine/network/time/JitterBuffer.d.ts +1 -1
- package/src/engine/network/time/JitterBuffer.js +1 -1
- package/src/engine/network/time/TimeDilation.d.ts +1 -1
- package/src/engine/network/time/TimeDilation.js +1 -1
- package/src/engine/network/time/TimeSync.d.ts +1 -1
- package/src/engine/network/time/TimeSync.js +1 -1
- package/src/engine/network/transport/Channel.d.ts.map +1 -1
- package/src/engine/network/transport/Channel.js +3 -6
- package/src/engine/network/transport/LoopbackTransport.d.ts +1 -1
- package/src/engine/network/transport/LoopbackTransport.js +1 -1
- package/src/engine/network/transport/ReliableCommandPipeline.d.ts +1 -1
- package/src/engine/network/transport/ReliableCommandPipeline.js +1 -1
- package/src/engine/network/transport/Transport.d.ts +1 -1
- package/src/engine/network/transport/Transport.js +1 -1
- package/src/engine/network/transport/adapters/NodeUDPTransport.d.ts +1 -1
- package/src/engine/network/transport/adapters/NodeUDPTransport.js +2 -2
- package/src/engine/network/transport/adapters/SimulatedTransport.d.ts +1 -1
- package/src/engine/network/transport/adapters/SimulatedTransport.js +1 -1
- package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.d.ts +1 -1
- package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.js +1 -1
- package/src/engine/network/transport/adapters/WebSocketTransport.d.ts +1 -1
- package/src/engine/network/transport/adapters/WebSocketTransport.js +1 -1
- package/src/engine/network/transport/adapters/WebTransportTransport.d.ts +1 -1
- package/src/engine/network/transport/adapters/WebTransportTransport.js +1 -1
- package/src/engine/network/transport/fragments/FragmentAssembler.d.ts +1 -1
- package/src/engine/network/transport/fragments/FragmentAssembler.js +1 -1
- package/src/engine/network/transport/fragments/FragmentRetention.d.ts +1 -1
- package/src/engine/network/transport/fragments/FragmentRetention.js +1 -1
- package/src/engine/network/transport/fragments/packet_size.d.ts +1 -1
- package/src/engine/network/transport/fragments/packet_size.js +1 -1
- package/src/engine/simulation/Ticker.d.ts +1 -1
- package/src/engine/simulation/Ticker.js +1 -1
- package/src/engine/sound/SoundEngine.js +1 -1
- package/src/engine/ui/DraggableAspect.d.ts +1 -1
- package/src/engine/ui/DraggableAspect.js +1 -1
- package/src/view/View.js +1 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout of a single point in the {@link points} buffer. 12 floats per point,
|
|
3
|
+
* interleaved so an InstancedBufferAttribute can stride over the whole thing
|
|
4
|
+
* once and the geometry builder can split it into per-instance attributes
|
|
5
|
+
* with offsets.
|
|
6
|
+
*
|
|
7
|
+
* Order chosen so a single 16-byte fetch (vec4) covers the most-used pair
|
|
8
|
+
* (albedo.rgb + occlusion) and another covers normal.xyz + roughness.
|
|
9
|
+
*
|
|
10
|
+
* | offset | size | content |
|
|
11
|
+
* |--------|------|------------------------------------------|
|
|
12
|
+
* | 0 | 3 | position.xyz (object space) |
|
|
13
|
+
* | 3 | 3 | normal.xyz (object space, unit length) |
|
|
14
|
+
* | 6 | 3 | albedo.rgb (linear, no alpha) |
|
|
15
|
+
* | 9 | 3 | orm (occlusion, roughness, metalness) |
|
|
16
|
+
*
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
export const VOXEL_POINT_STRIDE: number;
|
|
20
|
+
export const VOXEL_POINT_OFFSET_POSITION: 0;
|
|
21
|
+
export const VOXEL_POINT_OFFSET_NORMAL: 3;
|
|
22
|
+
export const VOXEL_POINT_OFFSET_ALBEDO: 6;
|
|
23
|
+
export const VOXEL_POINT_OFFSET_ORM: 9;
|
|
24
|
+
/**
|
|
25
|
+
* Output of {@link VoxelImpostorBaker.bake} — describes a baked voxel
|
|
26
|
+
* impostor entirely on the CPU, in a form that's cheap to re-upload to a
|
|
27
|
+
* GPU instanced-quad geometry (see make_voxel_impostor_geometry).
|
|
28
|
+
*
|
|
29
|
+
* Conceptually: a sparse cloud of equally-sized points, each carrying the
|
|
30
|
+
* same G-buffer attributes the octahedral impostor packs into its texture
|
|
31
|
+
* atlas — position, normal, albedo, and ORM (occlusion / roughness /
|
|
32
|
+
* metalness). No alpha. Each point represents one occupied voxel cell of
|
|
33
|
+
* the source mesh's surface, captured at the bake-time resolution.
|
|
34
|
+
*
|
|
35
|
+
* Same impostor mental model as the octahedral system: pre-baked, no
|
|
36
|
+
* animation, only what's visible from outside the bounding sphere gets
|
|
37
|
+
* captured.
|
|
38
|
+
*/
|
|
39
|
+
export class VoxelImpostorDescription {
|
|
40
|
+
/**
|
|
41
|
+
* How the impostor was sampled. Drives which directions the baker
|
|
42
|
+
* placed cameras at during the GPU sampling pass.
|
|
43
|
+
* @type {number}
|
|
44
|
+
*/
|
|
45
|
+
capture_type: number;
|
|
46
|
+
/**
|
|
47
|
+
* Radius of the bounding sphere captured during the bake, in
|
|
48
|
+
* object-space units.
|
|
49
|
+
* @type {number}
|
|
50
|
+
*/
|
|
51
|
+
sphere_radius: number;
|
|
52
|
+
/**
|
|
53
|
+
* Centre of the bounding sphere in object space — points in
|
|
54
|
+
* {@link points} are stored in this same frame.
|
|
55
|
+
* @type {number[]}
|
|
56
|
+
*/
|
|
57
|
+
offset: number[];
|
|
58
|
+
/**
|
|
59
|
+
* Voxel grid cell size used during baking, in **bake (object)
|
|
60
|
+
* space**. Reference / diagnostic value — the renderer reads
|
|
61
|
+
* {@link point_diameter} instead of computing from this.
|
|
62
|
+
* @type {number}
|
|
63
|
+
*/
|
|
64
|
+
voxel_size: number;
|
|
65
|
+
/**
|
|
66
|
+
* Auto-tuned splat diameter in **bake (object) space** — what
|
|
67
|
+
* the renderer should set `uPointDiameter` to. Set by the baker
|
|
68
|
+
* to `voxel_size * sqrt(2)` so that camera-facing quads cover
|
|
69
|
+
* the worst-case oblique projection of a voxel cell (45° to the
|
|
70
|
+
* view direction, where the cell's projected width grows by
|
|
71
|
+
* sqrt(2)). At less oblique angles the splat overlaps with its
|
|
72
|
+
* neighbours, which the depth test resolves cleanly.
|
|
73
|
+
*
|
|
74
|
+
* The shaders apply the silhouette-tightening inward-shift at
|
|
75
|
+
* draw time, using this diameter: each splat's CENTRE sits at
|
|
76
|
+
* `iPosition - iNormal * (point_diameter * 0.5)`, so its outer
|
|
77
|
+
* edge falls on the source mesh surface — silhouette stays tight
|
|
78
|
+
* regardless of how much overlap was needed for fill.
|
|
79
|
+
*
|
|
80
|
+
* @type {number}
|
|
81
|
+
*/
|
|
82
|
+
point_diameter: number;
|
|
83
|
+
/**
|
|
84
|
+
* Number of valid points in {@link points}. Always {@link points}.length / {@link VOXEL_POINT_STRIDE}.
|
|
85
|
+
* @type {number}
|
|
86
|
+
*/
|
|
87
|
+
point_count: number;
|
|
88
|
+
/**
|
|
89
|
+
* Interleaved per-point attributes. See {@link VOXEL_POINT_STRIDE} for layout.
|
|
90
|
+
* @type {Float32Array|null}
|
|
91
|
+
*/
|
|
92
|
+
points: Float32Array | null;
|
|
93
|
+
/**
|
|
94
|
+
* Voxel grid resolution used during baking — the longest side of the
|
|
95
|
+
* grid covering the bounding box. Useful for diagnostics and for
|
|
96
|
+
* choosing a similar grid when re-baking the same model.
|
|
97
|
+
* @type {number}
|
|
98
|
+
*/
|
|
99
|
+
grid_resolution: number;
|
|
100
|
+
/**
|
|
101
|
+
* Atlas resolution and frame count used to sample the surface. Kept
|
|
102
|
+
* for diagnostics; the atlas itself is discarded once voxels are
|
|
103
|
+
* extracted.
|
|
104
|
+
* @type {number}
|
|
105
|
+
*/
|
|
106
|
+
source_atlas_resolution: number;
|
|
107
|
+
/**
|
|
108
|
+
* @type {number}
|
|
109
|
+
*/
|
|
110
|
+
source_atlas_frames: number;
|
|
111
|
+
/**
|
|
112
|
+
* @type {number}
|
|
113
|
+
*/
|
|
114
|
+
source_geometry_polygon_count: number;
|
|
115
|
+
/**
|
|
116
|
+
* @type {number}
|
|
117
|
+
*/
|
|
118
|
+
source_geometry_vertex_count: number;
|
|
119
|
+
/**
|
|
120
|
+
* @type {number}
|
|
121
|
+
*/
|
|
122
|
+
source_material_count: number;
|
|
123
|
+
/**
|
|
124
|
+
* @type {number}
|
|
125
|
+
*/
|
|
126
|
+
source_instance_count: number;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=VoxelImpostorDescription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VoxelImpostorDescription.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/impostors/voxel/VoxelImpostorDescription.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,iCAFU,MAAM,CAEqB;AAErC,4CAA6C;AAC7C,0CAA6C;AAC7C,0CAA6C;AAC7C,uCAA6C;AAE7C;;;;;;;;;;;;;;GAcG;AACH;IACI;;;;OAIG;IACH,cAFU,MAAM,CAE8B;IAE9C;;;;OAIG;IACH,eAFU,MAAM,CAEE;IAElB;;;;OAIG;IACH,QAFU,MAAM,EAAE,CAEC;IAEnB;;;;;OAKG;IACH,YAFU,MAAM,CAED;IAEf;;;;;;;;;;;;;;;;OAgBG;IACH,gBAFU,MAAM,CAEG;IAEnB;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,QAFU,YAAY,GAAC,IAAI,CAEb;IAEd;;;;;OAKG;IACH,iBAFU,MAAM,CAEI;IAEpB;;;;;OAKG;IACH,yBAFU,MAAM,CAEY;IAC5B;;OAEG;IACH,qBAFU,MAAM,CAEQ;IAGxB;;OAEG;IACH,+BAFU,MAAM,CAEkB;IAClC;;OAEG;IACH,8BAFU,MAAM,CAEiB;IACjC;;OAEG;IACH,uBAFU,MAAM,CAEU;IAC1B;;OAEG;IACH,uBAFU,MAAM,CAEU;CAC7B"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { ImpostorCaptureType } from "../octahedral/ImpostorCaptureType.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Layout of a single point in the {@link points} buffer. 12 floats per point,
|
|
5
|
+
* interleaved so an InstancedBufferAttribute can stride over the whole thing
|
|
6
|
+
* once and the geometry builder can split it into per-instance attributes
|
|
7
|
+
* with offsets.
|
|
8
|
+
*
|
|
9
|
+
* Order chosen so a single 16-byte fetch (vec4) covers the most-used pair
|
|
10
|
+
* (albedo.rgb + occlusion) and another covers normal.xyz + roughness.
|
|
11
|
+
*
|
|
12
|
+
* | offset | size | content |
|
|
13
|
+
* |--------|------|------------------------------------------|
|
|
14
|
+
* | 0 | 3 | position.xyz (object space) |
|
|
15
|
+
* | 3 | 3 | normal.xyz (object space, unit length) |
|
|
16
|
+
* | 6 | 3 | albedo.rgb (linear, no alpha) |
|
|
17
|
+
* | 9 | 3 | orm (occlusion, roughness, metalness) |
|
|
18
|
+
*
|
|
19
|
+
* @type {number}
|
|
20
|
+
*/
|
|
21
|
+
export const VOXEL_POINT_STRIDE = 12;
|
|
22
|
+
|
|
23
|
+
export const VOXEL_POINT_OFFSET_POSITION = 0;
|
|
24
|
+
export const VOXEL_POINT_OFFSET_NORMAL = 3;
|
|
25
|
+
export const VOXEL_POINT_OFFSET_ALBEDO = 6;
|
|
26
|
+
export const VOXEL_POINT_OFFSET_ORM = 9;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Output of {@link VoxelImpostorBaker.bake} — describes a baked voxel
|
|
30
|
+
* impostor entirely on the CPU, in a form that's cheap to re-upload to a
|
|
31
|
+
* GPU instanced-quad geometry (see make_voxel_impostor_geometry).
|
|
32
|
+
*
|
|
33
|
+
* Conceptually: a sparse cloud of equally-sized points, each carrying the
|
|
34
|
+
* same G-buffer attributes the octahedral impostor packs into its texture
|
|
35
|
+
* atlas — position, normal, albedo, and ORM (occlusion / roughness /
|
|
36
|
+
* metalness). No alpha. Each point represents one occupied voxel cell of
|
|
37
|
+
* the source mesh's surface, captured at the bake-time resolution.
|
|
38
|
+
*
|
|
39
|
+
* Same impostor mental model as the octahedral system: pre-baked, no
|
|
40
|
+
* animation, only what's visible from outside the bounding sphere gets
|
|
41
|
+
* captured.
|
|
42
|
+
*/
|
|
43
|
+
export class VoxelImpostorDescription {
|
|
44
|
+
/**
|
|
45
|
+
* How the impostor was sampled. Drives which directions the baker
|
|
46
|
+
* placed cameras at during the GPU sampling pass.
|
|
47
|
+
* @type {number}
|
|
48
|
+
*/
|
|
49
|
+
capture_type = ImpostorCaptureType.FullSphere;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Radius of the bounding sphere captured during the bake, in
|
|
53
|
+
* object-space units.
|
|
54
|
+
* @type {number}
|
|
55
|
+
*/
|
|
56
|
+
sphere_radius = 0;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Centre of the bounding sphere in object space — points in
|
|
60
|
+
* {@link points} are stored in this same frame.
|
|
61
|
+
* @type {number[]}
|
|
62
|
+
*/
|
|
63
|
+
offset = [0, 0, 0];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Voxel grid cell size used during baking, in **bake (object)
|
|
67
|
+
* space**. Reference / diagnostic value — the renderer reads
|
|
68
|
+
* {@link point_diameter} instead of computing from this.
|
|
69
|
+
* @type {number}
|
|
70
|
+
*/
|
|
71
|
+
voxel_size = 0;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Auto-tuned splat diameter in **bake (object) space** — what
|
|
75
|
+
* the renderer should set `uPointDiameter` to. Set by the baker
|
|
76
|
+
* to `voxel_size * sqrt(2)` so that camera-facing quads cover
|
|
77
|
+
* the worst-case oblique projection of a voxel cell (45° to the
|
|
78
|
+
* view direction, where the cell's projected width grows by
|
|
79
|
+
* sqrt(2)). At less oblique angles the splat overlaps with its
|
|
80
|
+
* neighbours, which the depth test resolves cleanly.
|
|
81
|
+
*
|
|
82
|
+
* The shaders apply the silhouette-tightening inward-shift at
|
|
83
|
+
* draw time, using this diameter: each splat's CENTRE sits at
|
|
84
|
+
* `iPosition - iNormal * (point_diameter * 0.5)`, so its outer
|
|
85
|
+
* edge falls on the source mesh surface — silhouette stays tight
|
|
86
|
+
* regardless of how much overlap was needed for fill.
|
|
87
|
+
*
|
|
88
|
+
* @type {number}
|
|
89
|
+
*/
|
|
90
|
+
point_diameter = 0;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Number of valid points in {@link points}. Always {@link points}.length / {@link VOXEL_POINT_STRIDE}.
|
|
94
|
+
* @type {number}
|
|
95
|
+
*/
|
|
96
|
+
point_count = 0;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Interleaved per-point attributes. See {@link VOXEL_POINT_STRIDE} for layout.
|
|
100
|
+
* @type {Float32Array|null}
|
|
101
|
+
*/
|
|
102
|
+
points = null;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Voxel grid resolution used during baking — the longest side of the
|
|
106
|
+
* grid covering the bounding box. Useful for diagnostics and for
|
|
107
|
+
* choosing a similar grid when re-baking the same model.
|
|
108
|
+
* @type {number}
|
|
109
|
+
*/
|
|
110
|
+
grid_resolution = 0;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Atlas resolution and frame count used to sample the surface. Kept
|
|
114
|
+
* for diagnostics; the atlas itself is discarded once voxels are
|
|
115
|
+
* extracted.
|
|
116
|
+
* @type {number}
|
|
117
|
+
*/
|
|
118
|
+
source_atlas_resolution = 0;
|
|
119
|
+
/**
|
|
120
|
+
* @type {number}
|
|
121
|
+
*/
|
|
122
|
+
source_atlas_frames = 0;
|
|
123
|
+
|
|
124
|
+
// --- input statistics, for the preview / diagnostics UI ---
|
|
125
|
+
/**
|
|
126
|
+
* @type {number}
|
|
127
|
+
*/
|
|
128
|
+
source_geometry_polygon_count = 0;
|
|
129
|
+
/**
|
|
130
|
+
* @type {number}
|
|
131
|
+
*/
|
|
132
|
+
source_geometry_vertex_count = 0;
|
|
133
|
+
/**
|
|
134
|
+
* @type {number}
|
|
135
|
+
*/
|
|
136
|
+
source_material_count = 0;
|
|
137
|
+
/**
|
|
138
|
+
* @type {number}
|
|
139
|
+
*/
|
|
140
|
+
source_instance_count = 0;
|
|
141
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read back the baked octahedral atlas (3 MRT textures: diffuse+alpha,
|
|
3
|
+
* normal+depth, orm) and convert every covered pixel into one CPU sample:
|
|
4
|
+
* world-space position, normal, albedo, ORM.
|
|
5
|
+
*
|
|
6
|
+
* This is the noisy point-cloud the voxelisation step bins into a sparse
|
|
7
|
+
* grid. The atlas captures the surface from many directions, so the same
|
|
8
|
+
* surface point shows up multiple times — that's a feature, not a bug:
|
|
9
|
+
* voxel averaging cancels per-pixel noise and per-frame quantisation
|
|
10
|
+
* error, and surfaces visible from many angles (the ones that matter for
|
|
11
|
+
* impostor quality) get the most votes.
|
|
12
|
+
*
|
|
13
|
+
* @param {object} params
|
|
14
|
+
* @param {ImpostorDescription} params.impostor bake output from ImpostorBaker
|
|
15
|
+
* @param {THREE.WebGLRenderer} params.renderer
|
|
16
|
+
* @returns {{samples: Float32Array, sample_count: number}}
|
|
17
|
+
*/
|
|
18
|
+
export function read_atlas_to_samples({ impostor, renderer }: {
|
|
19
|
+
impostor: ImpostorDescription;
|
|
20
|
+
renderer: THREE.WebGLRenderer;
|
|
21
|
+
}): {
|
|
22
|
+
samples: Float32Array;
|
|
23
|
+
sample_count: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Layout per output sample (Float32Array, see ATLAS_SAMPLE_STRIDE):
|
|
27
|
+
*
|
|
28
|
+
* | offset | size | content |
|
|
29
|
+
* |--------|------|--------------------------------------------|
|
|
30
|
+
* | 0 | 3 | position.xyz (object space, around offset) |
|
|
31
|
+
* | 3 | 3 | normal.xyz (object space, unit length) |
|
|
32
|
+
* | 6 | 3 | albedo.rgb (linear, no alpha) |
|
|
33
|
+
* | 9 | 3 | orm (occlusion, roughness, metalness) |
|
|
34
|
+
*
|
|
35
|
+
* @type {number}
|
|
36
|
+
*/
|
|
37
|
+
export const ATLAS_SAMPLE_STRIDE: number;
|
|
38
|
+
//# sourceMappingURL=read_atlas_to_samples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read_atlas_to_samples.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/impostors/voxel/bake/read_atlas_to_samples.js"],"names":[],"mappings":"AAuLA;;;;;;;;;;;;;;;;GAgBG;AACH;IAJuC,QAAQ;IACR,QAAQ,EAApC,MAAM,aAAa;;aACP,YAAY;kBAAgB,MAAM;EA2IxD;AA3UD;;;;;;;;;;;GAWG;AACH,kCAFU,MAAM,CAEsB"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { convert_channel_sRGB_to_linear } from "../../../../../core/color/sRGB/sRGB_to_linear.js";
|
|
2
|
+
import { renderSamplerFromTexture } from "../../../render/visibility/hiz/buildCanvasViewFromTexture.js";
|
|
3
|
+
import { HemiOctahedralUvEncoder } from "../../octahedral/grid/HemiOctahedralUvEncoder.js";
|
|
4
|
+
import { OctahedralUvEncoder } from "../../octahedral/grid/OctahedralUvEncoder.js";
|
|
5
|
+
import { ImpostorCaptureType } from "../../octahedral/ImpostorCaptureType.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Layout per output sample (Float32Array, see ATLAS_SAMPLE_STRIDE):
|
|
9
|
+
*
|
|
10
|
+
* | offset | size | content |
|
|
11
|
+
* |--------|------|--------------------------------------------|
|
|
12
|
+
* | 0 | 3 | position.xyz (object space, around offset) |
|
|
13
|
+
* | 3 | 3 | normal.xyz (object space, unit length) |
|
|
14
|
+
* | 6 | 3 | albedo.rgb (linear, no alpha) |
|
|
15
|
+
* | 9 | 3 | orm (occlusion, roughness, metalness) |
|
|
16
|
+
*
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
export const ATLAS_SAMPLE_STRIDE = 12;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Read back a single MRT attachment of the impostor atlas as flat RGBA8
|
|
24
|
+
* bytes. {@link renderSamplerFromTexture} renders the source texture into
|
|
25
|
+
* a side render target and reads back UNSIGNED_BYTE so this works on every
|
|
26
|
+
* WebGL2 platform, at the cost of 8-bit depth precision (256 steps across
|
|
27
|
+
* the 2*radius diameter).
|
|
28
|
+
*
|
|
29
|
+
* @param {THREE.WebGLRenderer} renderer
|
|
30
|
+
* @param {THREE.Texture} texture
|
|
31
|
+
* @returns {Uint8ClampedArray}
|
|
32
|
+
*/
|
|
33
|
+
function read_atlas_texture_rgba_u8(renderer, texture) {
|
|
34
|
+
const ctrl = renderSamplerFromTexture({
|
|
35
|
+
renderer,
|
|
36
|
+
texture,
|
|
37
|
+
// We need the bytes in their stored order (no flip) because the
|
|
38
|
+
// bake renderer wrote them in y-up viewport order, and the frame
|
|
39
|
+
// tile index math below assumes that order too.
|
|
40
|
+
flipY: false
|
|
41
|
+
});
|
|
42
|
+
ctrl.render();
|
|
43
|
+
return ctrl.destination.data;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Decode the bake-time view-space normal back into the impostor's local
|
|
49
|
+
* (object) space. Inverse of the encode side in BakeShaderStandard.
|
|
50
|
+
*
|
|
51
|
+
* The baker placed an OrthographicCamera at
|
|
52
|
+
*
|
|
53
|
+
* camera_pos = centre + radius * D_frame
|
|
54
|
+
*
|
|
55
|
+
* with three.js's lookAt(centre) using world-up = (0,1,0). That gives a
|
|
56
|
+
* camera basis (bake_right, bake_up, +D_frame) in object space. The
|
|
57
|
+
* baker wrote the surface normal as (normal.x = dot(n, right),
|
|
58
|
+
* normal.y = dot(n, up), normal.z = dot(n, D_frame)) and packed it into
|
|
59
|
+
* the atlas RGB channels as (* 0.5 + 0.5). So to reverse, decode the RGB
|
|
60
|
+
* back to ±1 and recombine through the same basis.
|
|
61
|
+
*
|
|
62
|
+
* @param {number[]} out length-3 output, object-space normal
|
|
63
|
+
* @param {number} nr encoded R in [0,1]
|
|
64
|
+
* @param {number} ng encoded G in [0,1]
|
|
65
|
+
* @param {number} nb encoded B in [0,1]
|
|
66
|
+
* @param {number[]} D_frame bake direction in object space (unit)
|
|
67
|
+
*/
|
|
68
|
+
function decode_normal_to_object_space(out, nr, ng, nb, D_frame) {
|
|
69
|
+
// 1. Decode bake-view-space normal from [0,1] to [-1,1]
|
|
70
|
+
const nx = nr * 2 - 1;
|
|
71
|
+
const ny = ng * 2 - 1;
|
|
72
|
+
const nz = nb * 2 - 1;
|
|
73
|
+
|
|
74
|
+
// 2. Mirror three.js Camera.lookAt's polar nudge — when D_frame is
|
|
75
|
+
// parallel to world-up, lookAt jiggles +Z slightly to avoid a
|
|
76
|
+
// degenerate cross product. We have to do the same so our basis
|
|
77
|
+
// matches the baker's.
|
|
78
|
+
let Dx = D_frame[0], Dy = D_frame[1], Dz = D_frame[2];
|
|
79
|
+
if (Math.abs(Dy) > 0.99999) {
|
|
80
|
+
// Normalise (D + (0, 0, 0.0001)) — same nudge the lit shader uses.
|
|
81
|
+
const dz_n = Dz + 0.0001;
|
|
82
|
+
const len = Math.sqrt(Dx * Dx + Dy * Dy + dz_n * dz_n);
|
|
83
|
+
Dx /= len;
|
|
84
|
+
Dy /= len;
|
|
85
|
+
Dz = dz_n / len;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 3. bake_right = normalize(cross((0,1,0), D))
|
|
89
|
+
// Cross product: (0,1,0) × (Dx,Dy,Dz) = (Dz, 0, -Dx)
|
|
90
|
+
let rx = Dz;
|
|
91
|
+
let ry = 0;
|
|
92
|
+
let rz = -Dx;
|
|
93
|
+
{
|
|
94
|
+
const len = Math.sqrt(rx * rx + ry * ry + rz * rz);
|
|
95
|
+
rx /= len; ry /= len; rz /= len;
|
|
96
|
+
}
|
|
97
|
+
// 4. bake_up = cross(D, right) — no normalise needed, D and right
|
|
98
|
+
// are already orthonormal.
|
|
99
|
+
const ux = Dy * rz - Dz * ry;
|
|
100
|
+
const uy = Dz * rx - Dx * rz;
|
|
101
|
+
const uz = Dx * ry - Dy * rx;
|
|
102
|
+
|
|
103
|
+
// 5. Recompose in object space.
|
|
104
|
+
out[0] = rx * nx + ux * ny + Dx * nz;
|
|
105
|
+
out[1] = ry * nx + uy * ny + Dy * nz;
|
|
106
|
+
out[2] = rz * nx + uz * ny + Dz * nz;
|
|
107
|
+
|
|
108
|
+
// Re-normalise — interpolation across pixels and 8-bit quantisation
|
|
109
|
+
// can drift the magnitude.
|
|
110
|
+
const out_len = Math.sqrt(out[0] * out[0] + out[1] * out[1] + out[2] * out[2]);
|
|
111
|
+
if (out_len > 1e-6) {
|
|
112
|
+
out[0] /= out_len;
|
|
113
|
+
out[1] /= out_len;
|
|
114
|
+
out[2] /= out_len;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Reconstruct world (= object-local) position of the surface pixel from
|
|
121
|
+
* the atlas-encoded depth + frame index + frame-local pixel coords.
|
|
122
|
+
*
|
|
123
|
+
* Convention from BakeShaderStandard:
|
|
124
|
+
* - camera at C = centre + radius * D_frame
|
|
125
|
+
* - looking back at centre (=> view forward = -D_frame)
|
|
126
|
+
* - ortho frustum: half-width = radius, half-height = radius, near = 0, far = 2*radius
|
|
127
|
+
* - depth_atlas = 1 + mvPosition.z / far
|
|
128
|
+
* - at near (z=0) => depth = 1
|
|
129
|
+
* - at centre (z=-r) => depth = 0.5
|
|
130
|
+
* - at far (z=-2r) => depth = 0
|
|
131
|
+
*
|
|
132
|
+
* So along the view ray (origin = C + u*right + v*up where u,v ∈ [-r, +r],
|
|
133
|
+
* direction = -D_frame), the surface point sits at parametric distance
|
|
134
|
+
* t = (1 - depth) * 2*radius from the ray origin.
|
|
135
|
+
*
|
|
136
|
+
* @param {number[]} out length-3 output (object space)
|
|
137
|
+
* @param {number} depth01 depth in [0,1] as stored in atlas alpha
|
|
138
|
+
* @param {number} frame_u_local frame-local X in [-1, +1]
|
|
139
|
+
* @param {number} frame_v_local frame-local Y in [-1, +1]
|
|
140
|
+
* @param {number[]} D_frame bake direction in object space (unit)
|
|
141
|
+
* @param {number} radius bounding sphere radius
|
|
142
|
+
* @param {number[]} centre bounding sphere centre (object space)
|
|
143
|
+
*/
|
|
144
|
+
function reconstruct_position(out, depth01, frame_u_local, frame_v_local, D_frame, radius, centre) {
|
|
145
|
+
// Same polar nudge as the normal decoder, so right/up agree.
|
|
146
|
+
let Dx = D_frame[0], Dy = D_frame[1], Dz = D_frame[2];
|
|
147
|
+
if (Math.abs(Dy) > 0.99999) {
|
|
148
|
+
const dz_n = Dz + 0.0001;
|
|
149
|
+
const len = Math.sqrt(Dx * Dx + Dy * Dy + dz_n * dz_n);
|
|
150
|
+
Dx /= len;
|
|
151
|
+
Dy /= len;
|
|
152
|
+
Dz = dz_n / len;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Same basis as decode_normal_to_object_space; see the cross-product
|
|
156
|
+
// derivation there.
|
|
157
|
+
let rx = Dz, ry = 0, rz = -Dx;
|
|
158
|
+
{
|
|
159
|
+
const len = Math.sqrt(rx * rx + ry * ry + rz * rz);
|
|
160
|
+
rx /= len; ry /= len; rz /= len;
|
|
161
|
+
}
|
|
162
|
+
const ux = Dy * rz - Dz * ry;
|
|
163
|
+
const uy = Dz * rx - Dx * rz;
|
|
164
|
+
const uz = Dx * ry - Dy * rx;
|
|
165
|
+
|
|
166
|
+
// C = centre + radius * D
|
|
167
|
+
const cx = centre[0] + radius * Dx;
|
|
168
|
+
const cy = centre[1] + radius * Dy;
|
|
169
|
+
const cz = centre[2] + radius * Dz;
|
|
170
|
+
|
|
171
|
+
// ray origin = C + frame_u_local*r*right + frame_v_local*r*up
|
|
172
|
+
const ox = cx + frame_u_local * radius * rx + frame_v_local * radius * ux;
|
|
173
|
+
const oy = cy + frame_u_local * radius * ry + frame_v_local * radius * uy;
|
|
174
|
+
const oz = cz + frame_u_local * radius * rz + frame_v_local * radius * uz;
|
|
175
|
+
|
|
176
|
+
// surface = origin + t * (-D)
|
|
177
|
+
const t = (1 - depth01) * 2 * radius;
|
|
178
|
+
out[0] = ox - t * Dx;
|
|
179
|
+
out[1] = oy - t * Dy;
|
|
180
|
+
out[2] = oz - t * Dz;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Read back the baked octahedral atlas (3 MRT textures: diffuse+alpha,
|
|
186
|
+
* normal+depth, orm) and convert every covered pixel into one CPU sample:
|
|
187
|
+
* world-space position, normal, albedo, ORM.
|
|
188
|
+
*
|
|
189
|
+
* This is the noisy point-cloud the voxelisation step bins into a sparse
|
|
190
|
+
* grid. The atlas captures the surface from many directions, so the same
|
|
191
|
+
* surface point shows up multiple times — that's a feature, not a bug:
|
|
192
|
+
* voxel averaging cancels per-pixel noise and per-frame quantisation
|
|
193
|
+
* error, and surfaces visible from many angles (the ones that matter for
|
|
194
|
+
* impostor quality) get the most votes.
|
|
195
|
+
*
|
|
196
|
+
* @param {object} params
|
|
197
|
+
* @param {ImpostorDescription} params.impostor bake output from ImpostorBaker
|
|
198
|
+
* @param {THREE.WebGLRenderer} params.renderer
|
|
199
|
+
* @returns {{samples: Float32Array, sample_count: number}}
|
|
200
|
+
*/
|
|
201
|
+
export function read_atlas_to_samples({ impostor, renderer }) {
|
|
202
|
+
const renderer_ = renderer;
|
|
203
|
+
const id = impostor;
|
|
204
|
+
|
|
205
|
+
const resolution = id.resolution;
|
|
206
|
+
const frame_count = id.frame_count;
|
|
207
|
+
const frame_size = resolution / frame_count;
|
|
208
|
+
|
|
209
|
+
// 1. Read all three MRT slices to CPU as RGBA8.
|
|
210
|
+
const base_bytes = read_atlas_texture_rgba_u8(renderer_, id.rt.texture[0]); // albedo + alpha
|
|
211
|
+
const geometry_bytes = read_atlas_texture_rgba_u8(renderer_, id.rt.texture[1]); // normal + depth
|
|
212
|
+
const orm_bytes = read_atlas_texture_rgba_u8(renderer_, id.rt.texture[2]); // ORM
|
|
213
|
+
|
|
214
|
+
// 2. Pick the UV encoder that matches the capture type. We only need
|
|
215
|
+
// uv_to_unit here — the frame index gives us the (u, v) directly.
|
|
216
|
+
let encoder;
|
|
217
|
+
if (id.capture_type === ImpostorCaptureType.FullSphere) {
|
|
218
|
+
encoder = new OctahedralUvEncoder();
|
|
219
|
+
} else if (id.capture_type === ImpostorCaptureType.Hemisphere) {
|
|
220
|
+
encoder = new HemiOctahedralUvEncoder();
|
|
221
|
+
} else {
|
|
222
|
+
throw new Error(`Unsupported capture type '${id.capture_type}'`);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// 3. Bound the per-sample output to atlas covered pixels. Worst case
|
|
226
|
+
// every pixel is opaque, but typical opaque coverage is ~20–40%
|
|
227
|
+
// for hollow geometry. Allocate for the worst case so we never
|
|
228
|
+
// realloc inside the hot loop.
|
|
229
|
+
const max_pixels = resolution * resolution;
|
|
230
|
+
const samples = new Float32Array(max_pixels * ATLAS_SAMPLE_STRIDE);
|
|
231
|
+
let sample_count = 0;
|
|
232
|
+
|
|
233
|
+
// Reused scratch buffers — kept outside the inner loop so the JIT
|
|
234
|
+
// doesn't allocate per pixel.
|
|
235
|
+
const D_frame = [0, 0, 0];
|
|
236
|
+
const pos_scratch = [0, 0, 0];
|
|
237
|
+
const nrm_scratch = [0, 0, 0];
|
|
238
|
+
|
|
239
|
+
const max_frame_index = frame_count - 1;
|
|
240
|
+
const inv_255 = 1 / 255;
|
|
241
|
+
const inv_frame_size = 1 / frame_size;
|
|
242
|
+
|
|
243
|
+
const centre = id.offset;
|
|
244
|
+
const radius = id.sphere_radius;
|
|
245
|
+
|
|
246
|
+
// 4. Walk frames row-major, matching the order the baker used. For
|
|
247
|
+
// each frame, scan its tile pixel-by-pixel. We rely on
|
|
248
|
+
// renderSamplerFromTexture having read the atlas back unflipped
|
|
249
|
+
// so atlas pixel (x, y) corresponds to the same world position
|
|
250
|
+
// the bake camera wrote there.
|
|
251
|
+
for (let frame_j = 0; frame_j < frame_count; frame_j++) {
|
|
252
|
+
// Re-derive the bake direction for this frame from the same
|
|
253
|
+
// (u, v) the baker used. Don't read it from atlas memory: it's
|
|
254
|
+
// lost in the rasteriser.
|
|
255
|
+
const frame_v = max_frame_index > 0 ? (frame_j / max_frame_index) : 0;
|
|
256
|
+
const frame_offset_y = Math.floor(frame_size * frame_j);
|
|
257
|
+
|
|
258
|
+
for (let frame_i = 0; frame_i < frame_count; frame_i++) {
|
|
259
|
+
const frame_u = max_frame_index > 0 ? (frame_i / max_frame_index) : 0;
|
|
260
|
+
const frame_offset_x = Math.floor(frame_size * frame_i);
|
|
261
|
+
|
|
262
|
+
encoder.uv_to_unit(D_frame, [frame_u, frame_v]);
|
|
263
|
+
|
|
264
|
+
// Per-pixel decode within this frame tile.
|
|
265
|
+
const px_end = Math.ceil(frame_size);
|
|
266
|
+
for (let py = 0; py < px_end; py++) {
|
|
267
|
+
const global_y = frame_offset_y + py;
|
|
268
|
+
if (global_y >= resolution) continue;
|
|
269
|
+
|
|
270
|
+
// frame_v_local in [-1, +1], +0.5 to land at pixel centre.
|
|
271
|
+
const frame_v_local = ((py + 0.5) * inv_frame_size) * 2 - 1;
|
|
272
|
+
|
|
273
|
+
for (let px = 0; px < px_end; px++) {
|
|
274
|
+
const global_x = frame_offset_x + px;
|
|
275
|
+
if (global_x >= resolution) continue;
|
|
276
|
+
|
|
277
|
+
const pixel = (global_y * resolution + global_x) * 4;
|
|
278
|
+
|
|
279
|
+
// Alpha gates the sample. Background pixels (alpha=0)
|
|
280
|
+
// were never written by the bake shader — discard them.
|
|
281
|
+
const a = base_bytes[pixel + 3];
|
|
282
|
+
if (a === 0) {
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const frame_u_local = ((px + 0.5) * inv_frame_size) * 2 - 1;
|
|
287
|
+
|
|
288
|
+
const depth01 = geometry_bytes[pixel + 3] * inv_255;
|
|
289
|
+
reconstruct_position(pos_scratch, depth01, frame_u_local, frame_v_local, D_frame, radius, centre);
|
|
290
|
+
|
|
291
|
+
decode_normal_to_object_space(
|
|
292
|
+
nrm_scratch,
|
|
293
|
+
geometry_bytes[pixel] * inv_255,
|
|
294
|
+
geometry_bytes[pixel + 1] * inv_255,
|
|
295
|
+
geometry_bytes[pixel + 2] * inv_255,
|
|
296
|
+
D_frame
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
const out_offset = sample_count * ATLAS_SAMPLE_STRIDE;
|
|
300
|
+
|
|
301
|
+
samples[out_offset] = pos_scratch[0];
|
|
302
|
+
samples[out_offset + 1] = pos_scratch[1];
|
|
303
|
+
samples[out_offset + 2] = pos_scratch[2];
|
|
304
|
+
|
|
305
|
+
samples[out_offset + 3] = nrm_scratch[0];
|
|
306
|
+
samples[out_offset + 4] = nrm_scratch[1];
|
|
307
|
+
samples[out_offset + 5] = nrm_scratch[2];
|
|
308
|
+
|
|
309
|
+
// albedo: decode sRGB -> linear before storing. The
|
|
310
|
+
// bake atlas holds raw sRGB-encoded bytes (the
|
|
311
|
+
// GLTF colour textures are sRGB but BakeShaderStandard
|
|
312
|
+
// is a RawShaderMaterial that samples them without
|
|
313
|
+
// conversion). Naïvely averaging those bytes in
|
|
314
|
+
// sRGB space — which is what the voxeliser would
|
|
315
|
+
// do if we stored them as-is — darkens the result,
|
|
316
|
+
// compounding the small darkening the bake's own
|
|
317
|
+
// 4x supersample already introduces. Decoding here
|
|
318
|
+
// means voxelize_samples averages in linear space
|
|
319
|
+
// (correct), and the voxeliser re-encodes back to
|
|
320
|
+
// sRGB at output so the rest of the pipeline still
|
|
321
|
+
// sees the "sRGB bytes labelled linear" format the
|
|
322
|
+
// shaders expect.
|
|
323
|
+
samples[out_offset + 6] = convert_channel_sRGB_to_linear(base_bytes[pixel] * inv_255);
|
|
324
|
+
samples[out_offset + 7] = convert_channel_sRGB_to_linear(base_bytes[pixel + 1] * inv_255);
|
|
325
|
+
samples[out_offset + 8] = convert_channel_sRGB_to_linear(base_bytes[pixel + 2] * inv_255);
|
|
326
|
+
|
|
327
|
+
samples[out_offset + 9] = orm_bytes[pixel] * inv_255; // occlusion
|
|
328
|
+
samples[out_offset + 10] = orm_bytes[pixel + 1] * inv_255; // roughness
|
|
329
|
+
samples[out_offset + 11] = orm_bytes[pixel + 2] * inv_255; // metalness
|
|
330
|
+
|
|
331
|
+
sample_count++;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return { samples, sample_count };
|
|
338
|
+
}
|