@woosh/meep-engine 2.165.6 → 2.166.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle-worker-image-decoder.js +1 -1
- package/editor/tools/v2/GizmoNode.d.ts +21 -0
- package/editor/tools/v2/GizmoNode.d.ts.map +1 -0
- package/editor/tools/v2/TransformControls.d.ts +87 -20
- package/editor/tools/v2/TransformControls.d.ts.map +1 -0
- package/editor/tools/v2/TransformControlsGizmo.d.ts +22 -0
- package/editor/tools/v2/TransformControlsGizmo.d.ts.map +1 -0
- package/editor/tools/v2/TransformControlsPlane.d.ts +6 -0
- package/editor/tools/v2/TransformControlsPlane.d.ts.map +1 -0
- package/editor/tools/v2/TranslateHelperGeometry.d.ts +6 -0
- package/editor/tools/v2/TranslateHelperGeometry.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/CORRECTNESS_HUNT_2026_07_24.md +142 -0
- package/src/core/binary/BinaryBuffer.js +1 -1
- package/src/core/binary/EncodingBinaryBuffer.d.ts.map +1 -1
- package/src/core/binary/EncodingBinaryBuffer.js +3 -1
- package/src/core/binary/data_view/DataType2DataViewReaders.d.ts +8 -12
- package/src/core/binary/data_view/DataType2DataViewReaders.d.ts.map +1 -1
- package/src/core/binary/data_view/DataType2DataViewWriters.d.ts +8 -12
- package/src/core/binary/data_view/DataType2DataViewWriters.d.ts.map +1 -1
- package/src/core/binary/data_view/DataViewStructAccessor.d.ts +39 -18
- package/src/core/binary/type/BinaryDataType.d.ts +15 -15
- package/src/core/binary/type/DataType2TypedArrayConstructorMapping.d.ts +7 -11
- package/src/core/binary/type/DataType2TypedArrayConstructorMapping.d.ts.map +1 -1
- package/src/core/binary/type/DataTypeByteSizes.d.ts +7 -13
- package/src/core/binary/type/DataTypeByteSizes.d.ts.map +1 -1
- package/src/core/binary/type/DataTypeIndices.d.ts +8 -11
- package/src/core/binary/type/DataTypeIndices.d.ts.map +1 -1
- package/src/core/cache/Cache.d.ts +226 -56
- package/src/core/cache/Cache.d.ts.map +1 -1
- package/src/core/cache/Cache.js +0 -4
- package/src/core/cache/CacheElement.d.ts.map +1 -1
- package/src/core/cache/CacheElement.js +4 -0
- package/src/core/cache/FrequencySketch.d.ts +0 -21
- package/src/core/cache/FrequencySketch.d.ts.map +1 -1
- package/src/core/cache/FrequencySketch.js +66 -65
- package/src/core/cache/LoadingCache.d.ts +72 -23
- package/src/core/cache/wtinylfu/CacheElementWTinylfu.d.ts +17 -0
- package/src/core/cache/wtinylfu/CacheElementWTinylfu.d.ts.map +1 -0
- package/src/core/cache/wtinylfu/CacheElementWTinylfu.js +18 -0
- package/src/core/cache/wtinylfu/CacheRegionType.d.ts +10 -0
- package/src/core/cache/wtinylfu/CacheRegionType.d.ts.map +1 -0
- package/src/core/cache/wtinylfu/CacheRegionType.js +10 -0
- package/src/core/cache/wtinylfu/CacheRegionWTinylfu.d.ts +66 -0
- package/src/core/cache/wtinylfu/CacheRegionWTinylfu.d.ts.map +1 -0
- package/src/core/cache/wtinylfu/CacheRegionWTinylfu.js +183 -0
- package/src/core/cache/wtinylfu/CacheWTinylfu.d.ts +279 -0
- package/src/core/cache/wtinylfu/CacheWTinylfu.d.ts.map +1 -0
- package/src/core/cache/wtinylfu/CacheWTinylfu.js +807 -0
- package/src/core/cache/wtinylfu/benchmark/CacheWTinylfu.bench.md +243 -0
- package/src/core/cache/wtinylfu/wtinylfuDecisions.d.ts +80 -0
- package/src/core/cache/wtinylfu/wtinylfuDecisions.d.ts.map +1 -0
- package/src/core/cache/wtinylfu/wtinylfuDecisions.js +102 -0
- package/src/core/collection/RingBuffer.d.ts.map +1 -1
- package/src/core/collection/RingBuffer.js +15 -3
- package/src/core/collection/Stack.d.ts +2 -2
- package/src/core/collection/array/array_copy.d.ts +12 -7
- package/src/core/collection/array/computeHashArray.d.ts +9 -1
- package/src/core/collection/array/isArrayEqualStrict.d.ts +8 -1
- package/src/core/collection/array/isArraysEqualWithComparator.d.ts +10 -1
- package/src/core/collection/array/iterator/ArrayIteratorRandom.d.ts +3 -1
- package/src/core/collection/array/iterator/ArrayIteratorRandom.d.ts.map +1 -1
- package/src/core/collection/list/List.d.ts +334 -45
- package/src/core/collection/list/List.d.ts.map +1 -1
- package/src/core/collection/list/ListForwarder.d.ts +37 -18
- package/src/core/collection/map/HashMap.d.ts +199 -40
- package/src/core/collection/map/HashMap.d.ts.map +1 -1
- package/src/core/collection/map/HashMap.js +5 -17
- package/src/core/collection/queue/Deque.d.ts +113 -37
- package/src/core/collection/set/ArraySet.d.ts +87 -26
- package/src/core/collection/set/HashSet.d.ts +66 -33
- package/src/core/collection/set/HashSet.d.ts.map +1 -1
- package/src/core/collection/table/bind/TableRecord.d.ts +21 -20
- package/src/core/color/Color.d.ts +1 -2
- package/src/core/color/Color.d.ts.map +1 -1
- package/src/core/events/signal/Signal.d.ts +210 -57
- package/src/core/events/signal/signal_filter.d.ts +1 -1
- package/src/core/fsm/simple/SimpleStateMachine.d.ts +83 -27
- package/src/core/fsm/simple/SimpleStateMachineDescription.d.ts +90 -21
- package/src/core/geom/2d/aabb/AABB2.d.ts +335 -51
- package/src/core/geom/2d/line/line2_compute_segment_point_distance_sqr.d.ts.map +1 -1
- package/src/core/geom/2d/line/line2_compute_segment_point_distance_sqr.js +5 -0
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.d.ts +1 -6
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.d.ts.map +1 -1
- package/src/core/geom/2d/quad-tree/QuadTreeNode.d.ts +1 -2
- package/src/core/geom/2d/quad-tree/QuadTreeNode.d.ts.map +1 -1
- package/src/core/geom/3d/SurfacePoint3.d.ts +62 -17
- package/src/core/geom/3d/aabb/aabb3_build_corners.d.ts +13 -1
- package/src/core/geom/3d/frustum/read_three_planes_to_array.d.ts +7 -3
- package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.d.ts +7 -6
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.d.ts +16 -6
- package/src/core/geom/ConicRay.d.ts.map +1 -1
- package/src/core/geom/ConicRay.js +9 -2
- package/src/core/geom/Quaternion.d.ts +1 -2
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +7 -3
- package/src/core/geom/Vector1.d.ts +1 -2
- package/src/core/geom/Vector1.d.ts.map +1 -1
- package/src/core/geom/Vector2.d.ts +1 -2
- package/src/core/geom/Vector2.d.ts.map +1 -1
- package/src/core/geom/Vector3.d.ts +1 -2
- package/src/core/geom/Vector3.d.ts.map +1 -1
- package/src/core/geom/Vector4.d.ts +1 -1
- package/src/core/geom/Vector4.d.ts.map +1 -1
- package/src/core/graph/v2/Graph.d.ts +4 -4
- package/src/core/graph/v2/Graph.d.ts.map +1 -1
- package/src/core/json/resolvePathByArray.d.ts +10 -1
- package/src/core/math/build_gaussian_kernel_1d.d.ts +2 -2
- package/src/core/math/build_gaussian_kernel_1d.d.ts.map +1 -1
- package/src/core/math/build_gaussian_kernel_1d.js +4 -2
- package/src/core/math/build_gaussian_kernel_2d.d.ts +2 -2
- package/src/core/math/build_gaussian_kernel_2d.d.ts.map +1 -1
- package/src/core/math/build_gaussian_kernel_2d.js +4 -2
- package/src/core/math/clamp.d.ts +9 -1
- package/src/core/math/epsilonEquals.d.ts +9 -1
- package/src/core/math/gaussian.d.ts +2 -2
- package/src/core/math/gaussian.js +2 -2
- package/src/core/math/interval/NumericInterval.d.ts +1 -2
- package/src/core/math/interval/NumericInterval.d.ts.map +1 -1
- package/src/core/math/noise/create_simplex_noise_2d.d.ts +7 -1
- package/src/core/math/random/seededRandom.d.ts +3 -1
- package/src/core/math/remap.d.ts +12 -5
- package/src/core/math/sign.d.ts +10 -1
- package/src/core/math/spline/spline3_bezier_bounds.d.ts.map +1 -1
- package/src/core/math/spline/spline3_bezier_bounds.js +10 -3
- package/src/core/math/spline/spline3_bezier_to_hermite.d.ts +8 -7
- package/src/core/math/spline/spline3_bezier_to_hermite.d.ts.map +1 -1
- package/src/core/math/spline/spline3_bezier_to_hermite.js +13 -12
- package/src/core/math/spline/spline3_hermite_bounds.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_bounds.js +10 -3
- package/src/core/math/spline/spline3_hermite_bounds_t.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_bounds_t.js +115 -109
- package/src/core/math/spline/spline3_hermite_to_bezier.d.ts +2 -0
- package/src/core/math/spline/spline3_hermite_to_bezier.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_to_bezier.js +2 -0
- package/src/core/math/statistics/computeStatisticalMean.js +1 -1
- package/src/core/math/statistics/gaussian_amplitude.d.ts.map +1 -1
- package/src/core/math/statistics/gaussian_amplitude.js +3 -1
- package/src/core/model/BooleanVector3.d.ts +77 -28
- package/src/core/model/BooleanVector3.d.ts.map +1 -1
- package/src/core/model/BoundedValue.d.ts +5 -5
- package/src/core/model/BoundedValue.d.ts.map +1 -1
- package/src/core/model/ModuleRegistry.d.ts +45 -3
- package/src/core/model/ObservedBoolean.d.ts +1 -2
- package/src/core/model/ObservedBoolean.d.ts.map +1 -1
- package/src/core/model/ObservedEnum.d.ts +91 -7
- package/src/core/model/ObservedEnum.d.ts.map +1 -1
- package/src/core/model/ObservedString.d.ts +1 -2
- package/src/core/model/ObservedString.d.ts.map +1 -1
- package/src/core/model/ObservedValue.d.ts +1 -1
- package/src/core/model/ObservedValue.d.ts.map +1 -1
- package/src/core/model/node-graph/Connection.d.ts +57 -12
- package/src/core/model/node-graph/NodeGraph.d.ts +2 -2
- package/src/core/model/node-graph/node/NodeDescription.d.ts +166 -15
- package/src/core/model/node-graph/node/NodeDescription.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstance.d.ts +181 -22
- package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstancePortReference.d.ts +82 -3
- package/src/core/model/node-graph/node/Port.d.ts +72 -3
- package/src/core/model/node-graph/node/Port.d.ts.map +1 -1
- package/src/core/model/node-graph/node/PortDirection.d.ts +7 -5
- package/src/core/model/node-graph/type/DataType.d.ts +61 -4
- package/src/core/model/node-graph/type/ParametricDataType.d.ts +0 -1
- package/src/core/model/node-graph/type/ParametricDataType.d.ts.map +1 -1
- package/src/core/model/object/ImmutableObjectPool.d.ts +1 -2
- package/src/core/model/object/ImmutableObjectPool.d.ts.map +1 -1
- package/src/core/model/object/invokeObjectEquals.d.ts +9 -5
- package/src/core/model/object/invokeObjectHash.d.ts +7 -5
- package/src/core/model/object/objectDeepEquals.d.ts +10 -1
- package/src/core/model/object/objectKeyByValue.d.ts +10 -1
- package/src/core/model/object/read_property.d.ts +11 -1
- package/src/core/model/object/write_property.d.ts +10 -1
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.d.ts +6 -0
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.d.ts.map +1 -1
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +12 -12
- package/src/core/model/reactive/js/compileReactiveToJS.d.ts.map +1 -1
- package/src/core/model/reactive/js/compileReactiveToJS.js +35 -1
- package/src/core/model/reactive/model/ReactiveBinaryExpression.d.ts +1 -3
- package/src/core/model/reactive/model/ReactiveBinaryExpression.d.ts.map +1 -1
- package/src/core/model/reactive/model/ReactiveExpression.d.ts +63 -10
- package/src/core/model/reactive/model/ReactiveExpression.d.ts.map +1 -1
- package/src/core/model/reactive/model/ReactiveUnaryExpression.d.ts +0 -12
- package/src/core/model/reactive/model/ReactiveUnaryExpression.d.ts.map +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveAdd.d.ts +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveAdd.d.ts.map +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveDivide.d.ts +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveDivide.d.ts.map +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveMultiply.d.ts +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveMultiply.d.ts.map +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveNegate.d.ts +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveNegate.d.ts.map +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveSubtract.d.ts +1 -1
- package/src/core/model/reactive/model/arithmetic/ReactiveSubtract.d.ts.map +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveEquals.d.ts +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveEquals.d.ts.map +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveGreaterThan.d.ts +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveGreaterThan.d.ts.map +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveGreaterThanOrEqual.d.ts +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveGreaterThanOrEqual.d.ts.map +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveLessThan.d.ts +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveLessThan.d.ts.map +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveLessThanOrEqual.d.ts +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveLessThanOrEqual.d.ts.map +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveNotEquals.d.ts +1 -1
- package/src/core/model/reactive/model/comparative/ReactiveNotEquals.d.ts.map +1 -1
- package/src/core/model/reactive/model/logic/ReactiveAnd.d.ts +41 -5
- package/src/core/model/reactive/model/logic/ReactiveAnd.d.ts.map +1 -1
- package/src/core/model/reactive/model/logic/ReactiveNot.d.ts +1 -1
- package/src/core/model/reactive/model/logic/ReactiveNot.d.ts.map +1 -1
- package/src/core/model/reactive/model/logic/ReactiveOr.d.ts +2 -1
- package/src/core/model/reactive/model/logic/ReactiveOr.d.ts.map +1 -1
- package/src/core/model/reactive/model/terminal/ReactiveLiteralBoolean.d.ts +2 -1
- package/src/core/model/reactive/model/terminal/ReactiveLiteralBoolean.d.ts.map +1 -1
- package/src/core/model/reactive/model/terminal/ReactiveLiteralNumber.d.ts +2 -3
- package/src/core/model/reactive/model/terminal/ReactiveLiteralNumber.d.ts.map +1 -1
- package/src/core/model/reactive/model/terminal/ReactiveLiteralString.d.ts +2 -4
- package/src/core/model/reactive/model/terminal/ReactiveLiteralString.d.ts.map +1 -1
- package/src/core/model/reactive/model/terminal/ReactiveReference.d.ts +68 -11
- package/src/core/model/reactive/model/terminal/ReactiveReference.d.ts.map +1 -1
- package/src/core/model/stat/LinearModifier.d.ts +79 -24
- package/src/core/parser/simple/DataType.d.ts +13 -5
- package/src/core/parser/simple/Token.d.ts +52 -13
- package/src/core/parser/simple/readArrayLiteral.d.ts +1 -0
- package/src/core/parser/simple/readArrayLiteral.d.ts.map +1 -1
- package/src/core/parser/simple/readBooleanToken.d.ts +1 -0
- package/src/core/parser/simple/readBooleanToken.d.ts.map +1 -1
- package/src/core/parser/simple/readHexToken.d.ts +1 -0
- package/src/core/parser/simple/readHexToken.d.ts.map +1 -1
- package/src/core/parser/simple/readIdentifierToken.d.ts +1 -0
- package/src/core/parser/simple/readIdentifierToken.d.ts.map +1 -1
- package/src/core/parser/simple/readNumberToken.d.ts +1 -0
- package/src/core/parser/simple/readNumberToken.d.ts.map +1 -1
- package/src/core/parser/simple/readReferenceToken.d.ts +1 -0
- package/src/core/parser/simple/readReferenceToken.d.ts.map +1 -1
- package/src/core/parser/simple/readStringToken.d.ts +1 -0
- package/src/core/parser/simple/readStringToken.d.ts.map +1 -1
- package/src/core/parser/simple/readUnsignedIntegerToken.d.ts +1 -0
- package/src/core/parser/simple/readUnsignedIntegerToken.d.ts.map +1 -1
- package/src/core/process/BaseProcess.d.ts +17 -5
- package/src/core/process/BaseProcess.d.ts.map +1 -1
- package/src/core/process/CompositeProcess.d.ts +0 -1
- package/src/core/process/CompositeProcess.d.ts.map +1 -1
- package/src/core/process/action/AsynchronousAction.d.ts +3 -3
- package/src/core/process/executor/ConcurrentExecutor.d.ts +3 -3
- package/src/core/process/filter/MutableFilter.d.ts +1 -1
- package/src/core/process/filter/MutableFilter.d.ts.map +1 -1
- package/src/core/process/task/Task.d.ts +1 -1
- package/src/core/process/task/Task.d.ts.map +1 -1
- package/src/core/process/task/TaskGroup.d.ts +3 -3
- package/src/core/process/task/TaskSignal.d.ts +8 -6
- package/src/core/process/undo/Action.d.ts +31 -9
- package/src/core/process/undo/ActionGroup.d.ts +20 -5
- package/src/core/process/undo/ActionProcessor.d.ts +163 -27
- package/src/core/process/undo/ActionProcessor.d.ts.map +1 -1
- package/src/engine/Engine.d.ts +178 -42
- package/src/engine/Engine.d.ts.map +1 -1
- package/src/engine/EngineConfiguration.d.ts +74 -20
- package/src/engine/achievements/AchievementGateway.d.ts +17 -5
- package/src/engine/achievements/AchievementManager.d.ts +0 -1
- package/src/engine/achievements/AchievementManager.d.ts.map +1 -1
- package/src/engine/animation/Tween.d.ts +1 -1
- package/src/engine/animation/clip/AnimationClip.d.ts +24 -4
- package/src/engine/animation/clip/AnimationClipBinding.d.ts +35 -14
- package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -1
- package/src/engine/animation/clip/ecd_bind_animation_curve.js +10 -1
- package/src/engine/animation/clip/hemisphere_align_quaternion_values.d.ts +20 -0
- package/src/engine/animation/clip/hemisphere_align_quaternion_values.d.ts.map +1 -0
- package/src/engine/animation/clip/hemisphere_align_quaternion_values.js +37 -0
- package/src/engine/animation/curve/actionProcessorOperations/curveActions.d.ts +2 -2
- package/src/engine/animation/curve/actionProcessorOperations/curveActions.d.ts.map +1 -1
- package/src/engine/animation/curve/editor/createKeyframeMarker.d.ts +1 -1
- package/src/engine/animation/curve/editor/createKeyframeMarker.d.ts.map +1 -1
- package/src/engine/animation/keyed2/AnimationTrackPlayback.d.ts +1 -1
- package/src/engine/animation/keyed2/AnimationTrackPlayback.d.ts.map +1 -1
- package/src/engine/animation/keyed2/AnimationTrackPlayback.js +5 -1
- package/src/engine/animation/keyed2/behavior/AnimationBehavior.d.ts +0 -1
- package/src/engine/animation/keyed2/behavior/AnimationBehavior.d.ts.map +1 -1
- package/src/engine/asset/Asset.d.ts +47 -7
- package/src/engine/asset/AssetManager.d.ts +258 -60
- package/src/engine/asset/AssetRequestScope.d.ts +27 -3
- package/src/engine/asset/AssetTransformer.d.ts +16 -5
- package/src/engine/asset/CORS/CrossOriginConfig.d.ts +8 -5
- package/src/engine/asset/CORS/CrossOriginConfig.d.ts.map +1 -1
- package/src/engine/asset/CORS/CrossOriginKind.d.ts +5 -4
- package/src/engine/asset/loaders/AssetLoader.d.ts +50 -12
- package/src/engine/asset/loaders/GLTFAssetLoader.d.ts +71 -6
- package/src/engine/asset/loaders/image/ImageRGBADataAsset.d.ts +0 -1
- package/src/engine/asset/loaders/image/ImageRGBADataAsset.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/StaticMaterialCache.d.ts +30 -7
- package/src/engine/asset/loaders/material/computeMaterialEquality.d.ts +8 -3
- package/src/engine/asset/loaders/material/computeMaterialHash.d.ts +7 -3
- package/src/engine/asset/loaders/material/traverseMaterialTextures.d.ts +8 -3
- package/src/engine/asset/loaders/texture/TextureAssetLoader.d.ts +6 -6
- package/src/engine/asset/preloader/AssetPreloader.d.ts +6 -15
- package/src/engine/asset/preloader/AssetPreloader.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +13 -13
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +14 -4
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts +1 -1
- package/src/engine/ecs/Entity.d.ts +228 -41
- package/src/engine/ecs/EntityBlueprint.d.ts +43 -17
- package/src/engine/ecs/EntityComponentDataset.d.ts +580 -60
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +5 -21
- package/src/engine/ecs/EntityManager.d.ts +10 -9
- package/src/engine/ecs/EntityManager.d.ts.map +1 -1
- package/src/engine/ecs/EntityObserver.d.ts +80 -13
- package/src/engine/ecs/System.d.ts +162 -33
- package/src/engine/ecs/animation/AnimationSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/animation/AnimationSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/attachment/AttachmentSystem.d.ts +1 -1
- package/src/engine/ecs/attachment/AttachmentSystem.d.ts.map +1 -1
- package/src/engine/ecs/components/PropertySetSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/components/PropertySetSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/components/SerializationMetadataSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/components/SerializationMetadataSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/components/TagSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/components/TagSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.d.ts +1 -1
- package/src/engine/ecs/dynamic_actions/rules/DynamicRuleDescriptionTable.d.ts.map +1 -1
- package/src/engine/ecs/fow/FogOfWar.d.ts +10 -1
- package/src/engine/ecs/fow/FogOfWar.d.ts.map +1 -1
- package/src/engine/ecs/fow/FogOfWar.js +133 -54
- package/src/engine/ecs/fow/FogOfWarRevealerSystem.d.ts +1 -1
- package/src/engine/ecs/fow/FogOfWarSystem.d.ts +1 -6
- package/src/engine/ecs/fow/FogOfWarSystem.d.ts.map +1 -1
- package/src/engine/ecs/fow/serialization/FogOfWarRevealerSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/fow/serialization/FogOfWarRevealerSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/fow/serialization/FogOfWarSerializationAdapter.js +3 -0
- package/src/engine/ecs/gui/GUIElement.d.ts +115 -5
- package/src/engine/ecs/gui/GUIElementSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/gui/GUIElementSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/gui/GUIElementSystem.d.ts +59 -8
- package/src/engine/ecs/gui/GUIElementSystem.d.ts.map +1 -1
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.d.ts +42 -6
- package/src/engine/ecs/gui/menu/radial/RadialContextMenu.d.ts +23 -22
- package/src/engine/ecs/gui/parallax/GuiElementParallaxSystem.d.ts +1 -1
- package/src/engine/ecs/gui/position/ViewportPositionSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/gui/position/ViewportPositionSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/gui/position/ViewportPositionSystem.d.ts +1 -1
- package/src/engine/ecs/gui/view/ViewEntity.d.ts +1 -2
- package/src/engine/ecs/gui/view/ViewEntity.d.ts.map +1 -1
- package/src/engine/ecs/guid/UUIDSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/guid/UUIDSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/ik/InverseKinematicsSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/ik/InverseKinematicsSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/ik/InverseKinematicsSystem.d.ts +1 -1
- package/src/engine/ecs/ik/InverseKinematicsSystem.d.ts.map +1 -1
- package/src/engine/ecs/name/NameSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/name/NameSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/parent/ChildEntities.d.ts +23 -3
- package/src/engine/ecs/parent/EntityNode.d.ts +157 -25
- package/src/engine/ecs/parent/ParentEntity.d.ts +31 -11
- package/src/engine/ecs/parent/ParentEntitySystem.d.ts +44 -11
- package/src/engine/ecs/renderable/RenderSystem.d.ts +65 -7
- package/src/engine/ecs/renderable/Renderable.d.ts +95 -25
- package/src/engine/ecs/speaker/VoiceSystem.d.ts +3 -3
- package/src/engine/ecs/speaker/VoiceSystem.d.ts.map +1 -1
- package/src/engine/ecs/storage/binary/BinaryClassSerializationAdapter.d.ts +86 -21
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.d.ts.map +1 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +3 -1
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts +1 -1
- package/src/engine/ecs/storage/binary/object-v2/serializerTestHarness.d.ts.map +1 -1
- package/src/engine/ecs/system/AbstractContextSystem.d.ts +1 -1
- package/src/engine/ecs/system_validate_class.d.ts +1 -1
- package/src/engine/ecs/system_validate_class.d.ts.map +1 -1
- package/src/engine/ecs/systems/AnimationSystem.d.ts +41 -6
- package/src/engine/ecs/systems/AnimationSystem.d.ts.map +1 -1
- package/src/engine/ecs/systems/ScriptSystem.d.ts +9 -5
- package/src/engine/ecs/systems/ScriptSystem.d.ts.map +1 -1
- package/src/engine/ecs/systems/TimerSystem.d.ts +1 -1
- package/src/engine/ecs/systems/TimerSystem.d.ts.map +1 -1
- package/src/engine/ecs/team/TeamSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/team/TeamSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/OffsetScaleTransform2D.d.ts +7 -6
- package/src/engine/ecs/terrain/ecs/Terrain.d.ts +389 -17
- package/src/engine/ecs/terrain/ecs/TerrainSystem.d.ts +65 -8
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts +1 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts.map +1 -1
- package/src/engine/ecs/terrain/serialization/TerrainSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/terrain/serialization/TerrainSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTile.d.ts +2 -2
- package/src/engine/ecs/terrain/tiles/TerrainTile.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts +2 -2
- package/src/engine/ecs/tooltip/TooltipComponentSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/tooltip/TooltipComponentSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/tooltip/TooltipComponentSystem.d.ts +1 -1
- package/src/engine/ecs/transform/TransformSerializationAdapter.d.ts +0 -1
- package/src/engine/ecs/transform/TransformSerializationAdapter.d.ts.map +1 -1
- package/src/engine/ecs/transform-attachment/TransformAttachment.d.ts +116 -19
- package/src/engine/ecs/transform-attachment/TransformAttachmentSystem.d.ts +58 -6
- package/src/engine/graphics/GraphicsEngine.d.ts +224 -41
- package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics/GraphicsEngine.js +14 -3
- package/src/engine/graphics/camera/CameraShake.d.ts +6 -6
- package/src/engine/graphics/camera/CameraShake.d.ts.map +1 -1
- package/src/engine/graphics/camera/CameraShakeBehavior.d.ts +1 -2
- package/src/engine/graphics/camera/CameraShakeBehavior.d.ts.map +1 -1
- package/src/engine/graphics/camera/CameraShakeTraumaBehavior.d.ts +1 -2
- package/src/engine/graphics/camera/CameraShakeTraumaBehavior.d.ts.map +1 -1
- package/src/engine/graphics/camera/camera_compute_distance_to_fit_length.d.ts +8 -1
- package/src/engine/graphics/camera/makeScreenScissorFrustum.d.ts +8 -4
- package/src/engine/graphics/composit/CompositLayer.d.ts +1 -1
- package/src/engine/graphics/composit/CompositLayer.d.ts.map +1 -1
- package/src/engine/graphics/composit/CompositLayer.js +258 -255
- package/src/engine/graphics/composit/LayerCompositer.d.ts +12 -0
- package/src/engine/graphics/composit/LayerCompositer.d.ts.map +1 -1
- package/src/engine/graphics/composit/LayerCompositer.js +19 -10
- package/src/engine/graphics/ecs/animation/AnimationControllerSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/ecs/animation/AnimationControllerSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/AnimationControllerSystem.d.ts +1 -2
- package/src/engine/graphics/ecs/animation/AnimationControllerSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/AnimationGraphSystem.d.ts +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraphSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/ecs/animation/animator/graph/AnimationGraphSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/serialization/AnimationGraphDefinitionSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/Camera.d.ts +113 -18
- package/src/engine/graphics/ecs/camera/Camera.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/CameraSystem.d.ts +74 -10
- package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/ecs/camera/serialization/CameraSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.d.ts +90 -33
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts +34 -5
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLander.d.ts +0 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLander.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraLanderSystem.d.ts +1 -1
- package/src/engine/graphics/ecs/decal/v2/Decal.d.ts +52 -15
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.d.ts +70 -24
- package/src/engine/graphics/ecs/highlight/Highlight.d.ts +61 -16
- package/src/engine/graphics/ecs/highlight/HighlightDefinition.d.ts +57 -19
- package/src/engine/graphics/ecs/highlight/HighlightSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/ecs/highlight/HighlightSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.d.ts +1 -2
- package/src/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.d.ts.map +1 -1
- package/src/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +10 -4
- package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.d.ts +6 -0
- package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.d.ts.map +1 -1
- package/src/engine/graphics/ecs/highlight/renderer/OutlineRenderer.js +21 -0
- package/src/engine/graphics/ecs/highlight/system/MeshHighlightSystem.d.ts +57 -8
- package/src/engine/graphics/ecs/highlight/system/MeshHighlightSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/highlight/system/RenderableHighlightSystem.d.ts +62 -8
- package/src/engine/graphics/ecs/highlight/system/RenderableHighlightSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.d.ts +68 -8
- package/src/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/Light.d.ts +79 -19
- package/src/engine/graphics/ecs/light/Light.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/LightSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/ecs/light/LightSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/light/LightSystem.d.ts +123 -11
- package/src/engine/graphics/ecs/light/LightType.d.ts +8 -6
- package/src/engine/graphics/ecs/mesh/Mesh.d.ts +176 -30
- package/src/engine/graphics/ecs/mesh/MeshEvents.d.ts +6 -12
- package/src/engine/graphics/ecs/mesh/MeshSystem.d.ts +99 -7
- package/src/engine/graphics/ecs/mesh/serialization/MeshSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/ecs/mesh/serialization/MeshSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/mesh-v2/DrawMode.d.ts +8 -6
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +147 -32
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +37 -0
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGAnimationPlayback.d.ts +6 -5
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.d.ts +162 -25
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationController.d.ts +40 -12
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.d.ts +31 -11
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshEvents.d.ts +5 -12
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshHighlightSystem.d.ts +36 -7
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.d.ts +63 -8
- package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.d.ts +9 -4
- package/src/engine/graphics/ecs/path/PathDisplay.d.ts +21 -9
- package/src/engine/graphics/ecs/path/PathDisplayEvents.d.ts +6 -3
- package/src/engine/graphics/ecs/path/PathDisplaySpec.d.ts +28 -11
- package/src/engine/graphics/ecs/path/PathDisplaySystem.d.ts +55 -10
- package/src/engine/graphics/ecs/path/PathDisplaySystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/PathDisplayType.d.ts +8 -6
- package/src/engine/graphics/ecs/path/entity/EntityPathMarkerDefinition.d.ts +39 -8
- package/src/engine/graphics/ecs/path/entity/EntityPathStyle.d.ts +38 -12
- package/src/engine/graphics/ecs/path/highlight/PathDisplayHighlightSystem.d.ts +31 -7
- package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js +5 -23
- package/src/engine/graphics/ecs/path/ribbon/RibbonPathStyle.d.ts +24 -7
- package/src/engine/graphics/ecs/path/tube/BasicMaterialDefinition.d.ts +4 -3
- package/src/engine/graphics/ecs/path/tube/CapType.d.ts +7 -5
- package/src/engine/graphics/ecs/path/tube/MatcapMaterialDefinition.d.ts +11 -3
- package/src/engine/graphics/ecs/path/tube/PathNormalType.d.ts +6 -4
- package/src/engine/graphics/ecs/path/tube/StandardMaterialDefinition.d.ts +9 -4
- package/src/engine/graphics/ecs/path/tube/TubeMaterialType.d.ts +7 -6
- package/src/engine/graphics/ecs/path/tube/TubePathStyle.d.ts +114 -35
- package/src/engine/graphics/ecs/path/tube/TubePathStyle.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/estimatePathViaIterativeIntegral.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/estimatePathViaIterativeIntegral.js +6 -4
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +85 -6
- package/src/engine/graphics/ecs/trail3d/Trail3DSystem.d.ts +1 -1
- package/src/engine/graphics/ecs/water/WaterSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/ecs/water/WaterSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/WaterSystem.d.ts +1 -1
- package/src/engine/graphics/ecs/water/WaterSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/water/WaterSystem.js +9 -3
- package/src/engine/graphics/geometry/AttributeGroupSpec.d.ts +75 -25
- package/src/engine/graphics/geometry/AttributeSpec.d.ts +85 -12
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.d.ts +1 -2
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.d.ts +6 -4
- package/src/engine/graphics/material/manager/MaterialManager.d.ts +12 -0
- package/src/engine/graphics/material/manager/MaterialManager.d.ts.map +1 -1
- package/src/engine/graphics/material/manager/MaterialManager.js +78 -41
- package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.d.ts +67 -7
- package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.js +46 -9
- package/src/engine/graphics/particles/node-based/codegen/glsl/getTypeByteSize.d.ts +9 -9
- package/src/engine/graphics/particles/node-based/editor/ParticleSpecificationEditorView.d.ts +1 -2
- package/src/engine/graphics/particles/node-based/editor/ParticleSpecificationEditorView.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/FloatConstant.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/FloatConstant.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/ParticleDataTypes.d.ts +10 -9
- package/src/engine/graphics/particles/node-based/nodes/ParticleDataTypes.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/ReadFloatUniform.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/ReadFloatUniform.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/ReadVelocity.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/ReadVelocity.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/Vector3Constant.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/Vector3Constant.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/Vector3Merge.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/Vector3Merge.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/Vector3Split.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/Vector3Split.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/WriteVelocity.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/WriteVelocity.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/attribute/ReadVector3Attribute.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/attribute/ReadVector3Attribute.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/attribute/WriteVector3Attribute.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/attribute/WriteVector3Attribute.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/math/AddFloatNode.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/math/AddFloatNode.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/math/Vector3Add.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/math/Vector3Add.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/math/Vector3Divide.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/math/Vector3Divide.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/math/Vector3Multiply.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/math/Vector3Multiply.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/math/Vector3Subtract.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/math/Vector3Subtract.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/nodes/noise/CurlNoiseNode.d.ts +0 -1
- package/src/engine/graphics/particles/node-based/nodes/noise/CurlNoiseNode.d.ts.map +1 -1
- package/src/engine/graphics/particles/node-based/particle/ParticleAttributeSpecification.d.ts +18 -18
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.d.ts +5 -0
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.js +8 -0
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts +252 -2
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.d.ts +2 -15
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrack.d.ts +5 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrack.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrackSet.d.ts +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrackSet.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParticleParameter.d.ts +5 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParticleParameter.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/shader/MaterialRecord.d.ts +7 -0
- package/src/engine/graphics/particles/particular/engine/shader/MaterialRecord.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/shader/MaterialRecord.js +8 -0
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.d.ts +10 -2
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.d.ts.map +1 -1
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.js +42 -10
- package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.d.ts +76 -16
- package/src/engine/graphics/particles/particular/engine/utils/volume/SamplingFunctionKind.d.ts +6 -4
- package/src/engine/graphics/render/buffer/FrameBuffer.d.ts.map +1 -1
- package/src/engine/graphics/render/buffer/FrameBuffer.js +5 -2
- package/src/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.d.ts +104 -8
- package/src/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.d.ts.map +1 -1
- package/src/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +40 -7
- package/src/engine/graphics/render/buffer/simple-fx/ao/SAOUpscaleShader.js +78 -37
- package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.d.ts +0 -3
- package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.d.ts.map +1 -1
- package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +10 -4
- package/src/engine/graphics/render/forward_plus/LightManager.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/LightManager.js +1235 -1232
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts +1 -1
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.d.ts +32 -5
- package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +11 -10
- package/src/engine/graphics/render/forward_plus/plugin/MaterialTransformer.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +4 -9
- package/src/engine/graphics/render/forward_plus/plugin/forwardPlusMaterialMarker.d.ts +16 -0
- package/src/engine/graphics/render/forward_plus/plugin/forwardPlusMaterialMarker.d.ts.map +1 -0
- package/src/engine/graphics/render/forward_plus/plugin/forwardPlusMaterialMarker.js +18 -0
- package/src/engine/graphics/render/forward_plus/plugin/isForwardPlusLightingSkipped.d.ts +16 -0
- package/src/engine/graphics/render/forward_plus/plugin/isForwardPlusLightingSkipped.d.ts.map +1 -0
- package/src/engine/graphics/render/forward_plus/plugin/isForwardPlusLightingSkipped.js +31 -0
- package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts +1 -1
- package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.d.ts +1 -1
- package/src/engine/graphics/render/gizmo/Gizmo.d.ts +7 -3
- package/src/engine/graphics/render/gizmo/GizmoRenderingPlugin.d.ts +5 -5
- package/src/engine/graphics/render/gizmo/GizmoRenderingPlugin.d.ts.map +1 -1
- package/src/engine/graphics/render/gizmo/GizmoShapeRenderingInterface.d.ts +72 -13
- package/src/engine/graphics/render/layers/RenderLayer.d.ts +78 -22
- package/src/engine/graphics/render/layers/RenderLayerManager.d.ts +72 -17
- package/src/engine/graphics/render/layers/RenderLayerState.d.ts +18 -3
- package/src/engine/graphics/render/view/CameraView.d.ts +3 -3
- package/src/engine/graphics/render/view/CameraViewManager.d.ts +2 -2
- package/src/engine/graphics/render/visibility/IncrementalDeltaSet.d.ts +143 -24
- package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/sh3/lpg/serialization/LightProbeGridSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts +3 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts +1 -2
- package/src/engine/graphics/sh3/path_tracer/material/StandardTexture.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts +3 -3
- package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
- package/src/engine/graphics/texture/cubemap/load_environment_map.d.ts +13 -8
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts +1 -1
- package/src/engine/graphics/texture/sampler/serialization/Sampler2DSerializationAdapter.d.ts +0 -1
- package/src/engine/graphics/texture/sampler/serialization/Sampler2DSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/texture/virtual/VirtualTextureTileLoader.d.ts +1 -3
- package/src/engine/graphics/texture/virtual/VirtualTextureTileLoader.d.ts.map +1 -1
- package/src/engine/graphics/three/cloneObject3D.d.ts +7 -3
- package/src/engine/graphics/trail/tube/TubeX.d.ts.map +1 -1
- package/src/engine/graphics/trail/tube/TubeX.js +557 -555
- package/src/engine/graphics/trail/tube/TubeXPlugin.d.ts +0 -1
- package/src/engine/graphics/trail/tube/TubeXPlugin.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonXMaterialSpec.d.ts +13 -3
- package/src/engine/graphics/trail/x/RibbonXPlugin.d.ts +12 -4
- package/src/engine/graphics/trail/x/RibbonXPlugin.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonXPlugin.js +15 -8
- package/src/engine/graphics/util/promiseMaterialLoaded.d.ts +7 -3
- package/src/engine/grid/grid2transform/GridPosition2TransformSerializationAdapter.d.ts +0 -1
- package/src/engine/grid/grid2transform/GridPosition2TransformSerializationAdapter.d.ts.map +1 -1
- package/src/engine/grid/grid2transform/GridPosition2TransformSystem.d.ts +1 -1
- package/src/engine/grid/obstacle/GridObstacleSerializationAdapter.d.ts +0 -1
- package/src/engine/grid/obstacle/GridObstacleSerializationAdapter.d.ts.map +1 -1
- package/src/engine/grid/position/GridPositionSerializationAdapter.d.ts +0 -1
- package/src/engine/grid/position/GridPositionSerializationAdapter.d.ts.map +1 -1
- package/src/engine/grid/position/GridPositionSystem.d.ts +1 -1
- package/src/engine/grid/transform2grid/Transform2GridPositionSystem.d.ts +1 -1
- package/src/engine/input/GAMEPAD_API_PROPOSAL.md +717 -0
- package/src/engine/input/analog/apply_radial_dead_zone.d.ts +23 -0
- package/src/engine/input/analog/apply_radial_dead_zone.d.ts.map +1 -0
- package/src/engine/input/analog/apply_radial_dead_zone.js +38 -0
- package/src/engine/input/devices/GamepadDevice.d.ts +140 -23
- package/src/engine/input/devices/GamepadDevice.d.ts.map +1 -1
- package/src/engine/input/devices/GamepadDevice.js +202 -16
- package/src/engine/input/devices/InputDeviceSwitch.d.ts +44 -11
- package/src/engine/input/devices/InputDeviceSwitch.d.ts.map +1 -1
- package/src/engine/input/devices/KeyCodes.d.ts +112 -1
- package/src/engine/input/devices/KeyboardDevice.d.ts +2 -3
- package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
- package/src/engine/input/devices/PointerDevice.d.ts +96 -31
- package/src/engine/input/devices/PointerDevice.d.ts.map +1 -1
- package/src/engine/input/devices/events/KeyboardEvents.d.ts +5 -4
- package/src/engine/input/devices/events/MouseEvents.d.ts +18 -12
- package/src/engine/input/devices/events/TouchEvents.d.ts +12 -6
- package/src/engine/input/devices/gamepad/GamepadAxes.d.ts +5 -1
- package/src/engine/input/devices/gamepad/GamepadAxes.d.ts.map +1 -1
- package/src/engine/input/devices/gamepad/GamepadAxes.js +5 -1
- package/src/engine/input/devices/gamepad/GamepadHandle.d.ts +130 -26
- package/src/engine/input/devices/gamepad/GamepadHandle.d.ts.map +1 -1
- package/src/engine/input/devices/gamepad/GamepadHandle.js +60 -34
- package/src/engine/input/devices/gamepad/GamepadStandardMapping.d.ts +20 -0
- package/src/engine/input/devices/gamepad/GamepadStandardMapping.d.ts.map +1 -0
- package/src/engine/input/devices/gamepad/GamepadStandardMapping.js +20 -0
- package/src/engine/input/devices/gamepad/GamepadStick.d.ts +93 -0
- package/src/engine/input/devices/gamepad/GamepadStick.d.ts.map +1 -0
- package/src/engine/input/devices/gamepad/GamepadStick.js +165 -0
- package/src/engine/input/devices/gamepad/GamepadStickCalibration.d.ts +84 -0
- package/src/engine/input/devices/gamepad/GamepadStickCalibration.d.ts.map +1 -0
- package/src/engine/input/devices/gamepad/GamepadStickCalibration.js +119 -0
- package/src/engine/input/devices/gamepad/GamepadStickCalibrator.d.ts +92 -0
- package/src/engine/input/devices/gamepad/GamepadStickCalibrator.d.ts.map +1 -0
- package/src/engine/input/devices/gamepad/GamepadStickCalibrator.js +250 -0
- package/src/engine/input/devices/gamepad/gamepad_write_dpad_vector.d.ts +17 -0
- package/src/engine/input/devices/gamepad/gamepad_write_dpad_vector.d.ts.map +1 -0
- package/src/engine/input/devices/gamepad/gamepad_write_dpad_vector.js +30 -0
- package/src/engine/input/devices/touch/TouchDevice.d.ts +3 -3
- package/src/engine/input/ecs/components/Input.d.ts +49 -6
- package/src/engine/input/ecs/components/InputController.d.ts +33 -3
- package/src/engine/input/ecs/ism/InputBinding.d.ts +40 -4
- package/src/engine/input/ecs/systems/InputControllerSystem.d.ts +28 -6
- package/src/engine/input/ecs/systems/InputControllerSystem.d.ts.map +1 -1
- package/src/engine/input/ecs/systems/InputControllerSystem.js +9 -6
- package/src/engine/input/ecs/systems/InputSystem.d.ts +59 -6
- package/src/engine/intelligence/behavior/Behavior.d.ts +58 -16
- package/src/engine/intelligence/behavior/Behavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/BehaviorStatus.d.ts +10 -8
- package/src/engine/intelligence/behavior/SelectorBehavior.d.ts +0 -1
- package/src/engine/intelligence/behavior/SelectorBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.d.ts +0 -8
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/composite/ParallelBehaviorSerializationAdapter.d.ts +0 -1
- package/src/engine/intelligence/behavior/composite/ParallelBehaviorSerializationAdapter.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/composite/SequenceBehavior.d.ts +0 -1
- package/src/engine/intelligence/behavior/composite/SequenceBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/composite/SequenceBehaviorSerializationAdapter.d.ts +0 -1
- package/src/engine/intelligence/behavior/composite/SequenceBehaviorSerializationAdapter.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/AbstractDecoratorBehavior.d.ts +0 -1
- package/src/engine/intelligence/behavior/decorator/AbstractDecoratorBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/IgnoreFailureBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/decorator/IgnoreFailureBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/InvertStatusBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/decorator/InvertStatusBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/InvertStatusBehaviorSerializationAdapter.d.ts +0 -1
- package/src/engine/intelligence/behavior/decorator/InvertStatusBehaviorSerializationAdapter.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/decorator/OverrideContextBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/RepeatBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/decorator/RepeatBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/RepeatBehaviorSerializationAdapter.d.ts +0 -1
- package/src/engine/intelligence/behavior/decorator/RepeatBehaviorSerializationAdapter.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/decorator/RepeatUntilSuccessBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/decorator/RepeatUntilSuccessBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.d.ts +0 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorSystem.d.ts +1 -1
- package/src/engine/intelligence/behavior/ecs/DieBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/ecs/DieBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/EntityBehavior.d.ts +0 -1
- package/src/engine/intelligence/behavior/ecs/EntityBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/KillBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/ecs/KillBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/OrbitingBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/ecs/OrbitingBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/SendEventBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/ecs/SendEventBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/WaitForEventBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/ecs/WaitForEventBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/WaitForEventBehaviorSerializationAdapter.d.ts +0 -1
- package/src/engine/intelligence/behavior/ecs/WaitForEventBehaviorSerializationAdapter.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/primitive/FailingBehavior.d.ts +1 -3
- package/src/engine/intelligence/behavior/primitive/FailingBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/primitive/FailingBehaviorSerializationAdapter.d.ts +0 -1
- package/src/engine/intelligence/behavior/primitive/FailingBehaviorSerializationAdapter.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/primitive/PromiseBehavior.d.ts +2 -4
- package/src/engine/intelligence/behavior/primitive/PromiseBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.d.ts +1 -3
- package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/primitive/SucceedingBehaviorSerializationAdapter.d.ts +0 -1
- package/src/engine/intelligence/behavior/primitive/SucceedingBehaviorSerializationAdapter.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/util/BranchBehavior.d.ts +1 -3
- package/src/engine/intelligence/behavior/util/BranchBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/util/ConditionBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/util/ConditionBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/util/DelayBehavior.d.ts +1 -3
- package/src/engine/intelligence/behavior/util/DelayBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/util/LogMessageBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/util/LogMessageBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/util/RandomDelayBehavior.d.ts +4 -4
- package/src/engine/intelligence/behavior/util/RandomDelayBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/util/RotationBehavior.d.ts +1 -2
- package/src/engine/intelligence/behavior/util/RotationBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/blackboard/AbstractBlackboard.d.ts +58 -15
- package/src/engine/intelligence/blackboard/AbstractBlackboard.d.ts.map +1 -1
- package/src/engine/intelligence/blackboard/Blackboard.d.ts +79 -11
- package/src/engine/intelligence/blackboard/Blackboard.d.ts.map +1 -1
- package/src/engine/intelligence/blackboard/BlackboardSerializationAdapter.d.ts +0 -1
- package/src/engine/intelligence/blackboard/BlackboardSerializationAdapter.d.ts.map +1 -1
- package/src/engine/intelligence/blackboard/BlackboardValue.d.ts +1 -0
- package/src/engine/intelligence/blackboard/BlackboardValue.d.ts.map +1 -1
- package/src/engine/intelligence/controller/graph/StateGraphSystem.d.ts +1 -3
- package/src/engine/intelligence/controller/graph/StateGraphSystem.d.ts.map +1 -1
- package/src/engine/interpolation/InterpolationSystem.d.ts +1 -5
- package/src/engine/interpolation/InterpolationSystem.d.ts.map +1 -1
- package/src/engine/interpolation/TransformPoseSerializationAdapter.d.ts +0 -1
- package/src/engine/interpolation/TransformPoseSerializationAdapter.d.ts.map +1 -1
- package/src/engine/knowledge/database/StaticKnowledgeDataTable.d.ts +140 -9
- package/src/engine/knowledge/database/StaticKnowledgeDataTableDescriptor.d.ts +26 -7
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.d.ts +2 -3
- package/src/engine/knowledge/database/StaticKnowledgeDatabase.d.ts.map +1 -1
- package/src/engine/navigation/ecs/components/InterpolationType.d.ts +8 -4
- package/src/engine/navigation/ecs/components/Path.d.ts +170 -47
- package/src/engine/navigation/ecs/components/Path.d.ts.map +1 -1
- package/src/engine/navigation/ecs/components/Path.js +10 -4
- package/src/engine/navigation/ecs/components/PathEvents.d.ts +8 -6
- package/src/engine/navigation/ecs/components/PathSerializationAdapter.d.ts +0 -1
- package/src/engine/navigation/ecs/components/PathSerializationAdapter.d.ts.map +1 -1
- package/src/engine/navigation/ecs/path_following/PathFollower.d.ts +85 -45
- package/src/engine/navigation/ecs/path_following/PathFollowerEventType.d.ts +5 -3
- package/src/engine/navigation/ecs/path_following/PathFollowerFlags.d.ts +14 -20
- package/src/engine/navigation/ecs/path_following/PathFollowerSerializationAdapter.d.ts +0 -1
- package/src/engine/navigation/ecs/path_following/PathFollowerSerializationAdapter.d.ts.map +1 -1
- package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts +31 -6
- package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts.map +1 -1
- package/src/engine/navigation/ecs/path_following/PathFollowingSystem.js +1 -1
- package/src/engine/network/adapters/TransformReplicationAdapter.d.ts +0 -1
- package/src/engine/network/adapters/TransformReplicationAdapter.d.ts.map +1 -1
- package/src/engine/network/ecs/NetworkSystem.d.ts +1 -1
- package/src/engine/network/ecs/serialization/NetworkIdentitySerializationAdapter.d.ts +0 -1
- package/src/engine/network/ecs/serialization/NetworkIdentitySerializationAdapter.d.ts.map +1 -1
- package/src/engine/options/Option.d.ts +3 -3
- package/src/engine/options/OptionsView.d.ts +1 -2
- package/src/engine/options/OptionsView.d.ts.map +1 -1
- package/src/engine/physics/body/SolverBodyState.d.ts.map +1 -1
- package/src/engine/physics/body/SolverBodyState.js +10 -1
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
- package/src/engine/physics/constraint/solve_constraints.js +840 -830
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts +3 -3
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/ColliderSerializationAdapter.d.ts +0 -1
- package/src/engine/physics/ecs/ColliderSerializationAdapter.d.ts.map +1 -1
- package/src/engine/physics/ecs/JointSerializationAdapter.d.ts +0 -1
- package/src/engine/physics/ecs/JointSerializationAdapter.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +14 -2
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +2246 -2172
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts +0 -1
- package/src/engine/physics/ecs/RigidBodySerializationAdapter.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +12 -8
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +8 -4
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_velocity.js +25 -2
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_contacts.js +622 -617
- package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_convex_manifold.js +632 -568
- package/src/engine/physics/solver/solve_contacts.d.ts +6 -5
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +1506 -1482
- package/src/engine/platform/EnginePlatform.d.ts +24 -14
- package/src/engine/platform/WebEnginePlatform.d.ts +20 -5
- package/src/engine/platform/WebEnginePlatform.d.ts.map +1 -1
- package/src/engine/plugin/EnginePlugin.d.ts +36 -3
- package/src/engine/plugin/EnginePlugin.d.ts.map +1 -1
- package/src/engine/plugin/EnginePluginManager.d.ts +85 -16
- package/src/engine/plugin/EnginePluginManager.d.ts.map +1 -1
- package/src/engine/plugin/PluginReferenceContext.d.ts +1 -1
- package/src/engine/reference/v2/Reference.d.ts +55 -17
- package/src/engine/reference/v2/Reference.d.ts.map +1 -1
- package/src/engine/save/GameStateLoader.d.ts +0 -1
- package/src/engine/save/GameStateLoader.d.ts.map +1 -1
- package/src/engine/save/Storage.d.ts +75 -15
- package/src/engine/save/storage/InMemoryStorage.d.ts +0 -1
- package/src/engine/save/storage/InMemoryStorage.d.ts.map +1 -1
- package/src/engine/save/storage/IndexedDBStorage.d.ts +0 -2
- package/src/engine/save/storage/IndexedDBStorage.d.ts.map +1 -1
- package/src/engine/scene/Scene.d.ts +65 -7
- package/src/engine/scene/SceneManager.d.ts +125 -25
- package/src/engine/simulation/Ticker.d.ts +1 -2
- package/src/engine/simulation/Ticker.d.ts.map +1 -1
- package/src/engine/sound/SoundEngine.d.ts +46 -3
- package/src/engine/sound/ecs/SoundController.d.ts +0 -1
- package/src/engine/sound/ecs/SoundController.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundControllerSystem.d.ts +1 -2
- package/src/engine/sound/ecs/SoundControllerSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundListener.d.ts +0 -1
- package/src/engine/sound/ecs/SoundListener.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundListenerSystem.d.ts +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitter.d.ts +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitter.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts +1 -1
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts +1 -2
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts.map +1 -1
- package/src/engine/sound/simulation/core/AcousticMediumSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/simulation/core/AcousticMediumSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/simulation/definition/AcousticDirectivitySerializationAdapter.d.ts +0 -1
- package/src/engine/sound/simulation/definition/AcousticDirectivitySerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/simulation/definition/AcousticMaterialSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/simulation/definition/AcousticMaterialSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/simulation/ecs/AcousticBodySerializationAdapter.d.ts +0 -1
- package/src/engine/sound/simulation/ecs/AcousticBodySerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/simulation/ecs/AcousticProbeFieldSystem.d.ts +1 -1
- package/src/engine/sound/simulation/ecs/AcousticSimulationSystem.d.ts +1 -1
- package/src/engine/sound/simulation/ecs/AcousticVolumeSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/simulation/ecs/AcousticVolumeSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/simulation/ecs/AcousticVolumeSystem.d.ts +1 -1
- package/src/engine/sound/simulation/probe/AcousticProbeFieldSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/simulation/probe/AcousticProbeFieldSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.d.ts +0 -1
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +1 -2
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/ParameterStore.d.ts +1 -2
- package/src/engine/sound/sopra/runtime/ParameterStore.d.ts.map +1 -1
- package/src/engine/ui/bindings/DomElementProcessorManager.d.ts +0 -3
- package/src/engine/ui/bindings/DomElementProcessorManager.d.ts.map +1 -1
- package/src/engine/ui/modal/ModalStack.d.ts +3 -3
- package/src/engine/ui/notification/AnimatedObjectEmitter.d.ts +2 -2
- package/src/engine/ui/notification/ViewEmitter.d.ts +2 -2
- package/src/generation/filtering/CellFilter.d.ts +1 -1
- package/src/generation/filtering/CellFilter.d.ts.map +1 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorRandomRotation.d.ts +3 -1
- package/src/generation/markers/actions/placement/MarkerNodeEntityProcessorRandomRotation.d.ts.map +1 -1
- package/src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.d.ts +3 -1
- package/src/generation/markers/actions/probability/MarkerNodeActionSelectWeighted.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformRotateRandom.d.ts +3 -1
- package/src/generation/markers/transform/MarkerNodeTransformRotateRandom.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerRecordPropertyClosure.d.ts +3 -1
- package/src/generation/markers/transform/MarkerNodeTransformerRecordPropertyClosure.d.ts.map +1 -1
- package/src/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.d.ts +3 -1
- package/src/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.d.ts.map +1 -1
- package/src/generation/placement/action/util/CellMatcherWithinAABB.d.ts +1 -1
- package/src/generation/placement/action/util/CellMatcherWithinAABB.d.ts.map +1 -1
- package/src/misc/makeMatcapSelectionOption.d.ts +11 -13
- package/src/view/View.d.ts +313 -30
- package/src/view/asset/AssetLoaderStatusView.d.ts +1 -1
- package/src/view/asset/PreloaderView.d.ts +1 -1
- package/src/view/common/LabelView.d.ts +2 -1
- package/src/view/common/LabelView.d.ts.map +1 -1
- package/src/view/common/ListView.d.ts +2 -2
- package/src/view/common/ListView.d.ts.map +1 -1
- package/src/view/common/TabbedView.d.ts +1 -1
- package/src/view/common/VirtualListView.d.ts +3 -3
- package/src/view/common/VirtualListView.d.ts.map +1 -1
- package/src/view/common/dnd/Draggable.d.ts +2 -2
- package/src/view/common/dnd/DropTarget.d.ts +6 -6
- package/src/view/controller/GuiController.d.ts +1 -2
- package/src/view/controller/GuiController.d.ts.map +1 -1
- package/src/view/controller/controls/BooleanVector3Control.d.ts +1 -2
- package/src/view/controller/controls/BooleanVector3Control.d.ts.map +1 -1
- package/src/view/controller/controls/NativeListController.d.ts +1 -1
- package/src/view/controller/controls/Vector1Control.d.ts +1 -1
- package/src/view/currency/CompositeCurrencyLabelView.d.ts +1 -1
- package/src/view/currency/CurrencyDenominationLabelView.d.ts +1 -1
- package/src/view/elements/BottomLeftResizeHandleView.d.ts +1 -1
- package/src/view/elements/CanvasView.d.ts +1 -2
- package/src/view/elements/CanvasView.d.ts.map +1 -1
- package/src/view/elements/CheckboxView.d.ts +1 -1
- package/src/view/elements/CompassArrowView.d.ts +1 -2
- package/src/view/elements/CompassArrowView.d.ts.map +1 -1
- package/src/view/elements/ConfirmationDialogView.d.ts +1 -1
- package/src/view/elements/DropDownSelectionView.d.ts +1 -1
- package/src/view/elements/EmptyView.d.ts +1 -2
- package/src/view/elements/EmptyView.d.ts.map +1 -1
- package/src/view/elements/Group.d.ts +1 -2
- package/src/view/elements/Group.d.ts.map +1 -1
- package/src/view/elements/MeshPreview.d.ts +1 -1
- package/src/view/elements/SimpleWindow.d.ts +1 -1
- package/src/view/elements/button/ButtonView.d.ts +1 -1
- package/src/view/elements/image/ImageView.d.ts +1 -2
- package/src/view/elements/image/ImageView.d.ts.map +1 -1
- package/src/view/elements/image/SvgImageView.d.ts +1 -1
- package/src/view/elements/label/LabeledValueView.d.ts +1 -1
- package/src/view/elements/navigation/ViewStack.d.ts +1 -8
- package/src/view/elements/navigation/ViewStack.d.ts.map +1 -1
- package/src/view/elements/notify/ToastLogView.d.ts +1 -1
- package/src/view/elements/progress/RectangularPieProgressView.d.ts +1 -1
- package/src/view/elements/progress/SmoothProgressBar.d.ts +1 -1
- package/src/view/elements/progress/segmented/SegmentedResourceBarView.d.ts +1 -1
- package/src/view/elements/radial/RadialMenu.d.ts +1 -1
- package/src/view/elements/radial/RadialMenuElement.d.ts +1 -1
- package/src/view/elements/radial/RadialMenuElementDefinition.d.ts +125 -39
- package/src/view/elements/radial/RadialProgressView.d.ts +1 -1
- package/src/view/elements/radial/RadialText.d.ts +1 -1
- package/src/view/elements/tiles2d/Tile.d.ts +1 -1
- package/src/view/elements/tiles2d/TileGrid.d.ts +4 -5
- package/src/view/elements/tiles2d/TileGrid.d.ts.map +1 -1
- package/src/view/elements/video/VideoView.d.ts +2 -2
- package/src/view/elements/video/VideoView.d.ts.map +1 -1
- package/src/view/elements/windrose/WindRoseDiagram.d.ts +1 -1
- package/src/view/game/achievements/AchievementNotificationView.d.ts +1 -1
- package/src/view/math/FunctionGraphView.d.ts +1 -1
- package/src/view/minimap/Minimap.d.ts +1 -1
- package/src/view/minimap/dom/MinimapCameraView.d.ts +1 -1
- package/src/view/minimap/dom/MinimapMarkerView.d.ts +1 -1
- package/src/view/minimap/dom/MinimapTerrainView.d.ts +1 -1
- package/src/view/task/TaskProgressView.d.ts +1 -1
- package/src/view/tooltip/DomTooltipObserver.d.ts +2 -2
- package/src/view/tooltip/TooltipView.d.ts +1 -1
- package/src/view/tooltip/gml/parser/parseTooltipString.d.ts +1 -0
- package/src/view/tooltip/gml/parser/parseTooltipString.d.ts.map +1 -1
- package/src/view/tooltip/gml/parser/readReferenceToken.d.ts +1 -0
- package/src/view/tooltip/gml/parser/readReferenceToken.d.ts.map +1 -1
- package/src/view/tooltip/gml/parser/readReferenceValueToken.d.ts +2 -1
- package/src/view/tooltip/gml/parser/readReferenceValueToken.d.ts.map +1 -1
- package/src/view/tooltip/gml/parser/readStyleToken.d.ts +1 -0
- package/src/view/tooltip/gml/parser/readStyleToken.d.ts.map +1 -1
- package/editor/ecs/component/TypeSchema.d.ts +0 -38
- package/editor/tools/v2/BlenderCameraOrientationGizmo.d.ts +0 -50
|
@@ -1,1232 +1,1235 @@
|
|
|
1
|
-
import { m4_multiply } from "../../../../core/geom/3d/mat4/m4_multiply.js";
|
|
2
|
-
import {
|
|
3
|
-
ClampToEdgeWrapping,
|
|
4
|
-
DataTexture,
|
|
5
|
-
DataTexture3D,
|
|
6
|
-
Frustum,
|
|
7
|
-
LinearFilter,
|
|
8
|
-
LinearMipMapLinearFilter,
|
|
9
|
-
NearestFilter,
|
|
10
|
-
RGBAFormat,
|
|
11
|
-
RGBAIntegerFormat,
|
|
12
|
-
UnsignedByteType,
|
|
13
|
-
UnsignedShortType
|
|
14
|
-
} from "three";
|
|
15
|
-
import { assert } from "../../../../core/assert.js";
|
|
16
|
-
import { computeBinaryDataTypeByPrecision } from "../../../../core/binary/type/computeBinaryDataTypeByPrecision.js";
|
|
17
|
-
import {
|
|
18
|
-
DataType2TypedArrayConstructorMapping
|
|
19
|
-
} from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
20
|
-
import { BinaryUint32BVH } from "../../../../core/bvh2/binary/2/BinaryUint32BVH.js";
|
|
21
|
-
import { BVH } from "../../../../core/bvh2/bvh3/BVH.js";
|
|
22
|
-
import {
|
|
23
|
-
bvh_query_user_data_intersects_frustum
|
|
24
|
-
} from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_intersects_frustum.js";
|
|
25
|
-
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
26
|
-
import { array_sort_quick } from "../../../../core/collection/array/array_sort_quick.js";
|
|
27
|
-
import { array_swap_one } from "../../../../core/collection/array/array_swap_one.js";
|
|
28
|
-
import { frustum3_planes_to_flat_from_three } from "../../../../core/geom/3d/frustum/frustum3_planes_to_flat_from_three.js";
|
|
29
|
-
import { frustum3_slice_linear_to_points } from "../../../../core/geom/3d/frustum/frustum3_slice_linear_to_points.js";
|
|
30
|
-
import { v3_morton_encode_transformed } from "../../../../core/geom/3d/morton/v3_morton_encode_transformed.js";
|
|
31
|
-
import { v3_distance } from "../../../../core/geom/vec3/v3_distance.js";
|
|
32
|
-
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
33
|
-
import { NumericType } from "../../../../core/math/NumericType.js";
|
|
34
|
-
import { frustum_from_camera } from "../../ecs/camera/frustum_from_camera.js";
|
|
35
|
-
import { CachingTextureAtlas } from "../../texture/atlas/CachingTextureAtlas.js";
|
|
36
|
-
import { ReferencedTextureAtlas } from "../../texture/atlas/ReferencedTextureAtlas.js";
|
|
37
|
-
import { TextureAtlas } from "../../texture/atlas/TextureAtlas.js";
|
|
38
|
-
import {
|
|
39
|
-
computeThreeTextureInternalFormatFromDataType
|
|
40
|
-
} from "../../texture/computeThreeTextureInternalFormatFromDataType.js";
|
|
41
|
-
import { computeThreeTextureTypeFromDataType } from "../../texture/computeThreeTextureTypeFromDataType.js";
|
|
42
|
-
import { writeSample2DDataToDataTexture } from "../../texture/sampler/writeSampler2DDataToDataTexture.js";
|
|
43
|
-
import { TextureBackedMemoryRegion } from "../../texture/TextureBackedMemoryRegion.js";
|
|
44
|
-
import { IncrementalDeltaSet } from "../visibility/IncrementalDeltaSet.js";
|
|
45
|
-
import { assign_cluster, LOOKUP_CACHE, scratch_corners, scratch_frustum_planes } from "./assign_cluster.js";
|
|
46
|
-
import { compute_cluster_planes_from_points } from "./cluster/compute_cluster_planes_from_points.js";
|
|
47
|
-
import { read_plane_pair } from "./cluster/read_plane_pair.js";
|
|
48
|
-
import { computeFrustumCorners } from "./computeFrustumCorners.js";
|
|
49
|
-
import { LightRenderMetadata } from "./LightRenderMetadata.js";
|
|
50
|
-
import { Decal } from "./model/Decal.js";
|
|
51
|
-
import { point_light_inside_volume } from "./query/point_light_inside_volume.js";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* How many bits are used to encode light type
|
|
56
|
-
* @type {number}
|
|
57
|
-
*/
|
|
58
|
-
const LIGHT_ENCODING_TYPE_BIT_COUNT = 2;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
*
|
|
62
|
-
* @param {AbstractLight|PointLight|Decal} light
|
|
63
|
-
* @returns {number}
|
|
64
|
-
*/
|
|
65
|
-
function encode_light_type(light) {
|
|
66
|
-
if (light.isPointLight === true) {
|
|
67
|
-
return 0;
|
|
68
|
-
} else if (light.isDecal === true) {
|
|
69
|
-
return 3;
|
|
70
|
-
} else {
|
|
71
|
-
throw new Error('Unsupported light type');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @param {number} address
|
|
78
|
-
* @param {AbstractLight} light
|
|
79
|
-
* @returns {number}
|
|
80
|
-
*/
|
|
81
|
-
function encode_light_descriptor(address, light) {
|
|
82
|
-
const light_type = encode_light_type(light);
|
|
83
|
-
return light_type | (address << 2);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
88
|
-
* @param {IncrementalDeltaSet<LightRenderMetadata>} data_set
|
|
89
|
-
* @param {BinaryUint32BVH} bvh
|
|
90
|
-
*/
|
|
91
|
-
function build_light_data_bvh(data_set, bvh) {
|
|
92
|
-
const elements = data_set.elements;
|
|
93
|
-
const element_count = data_set.size;
|
|
94
|
-
|
|
95
|
-
bvh.setLeafCount(element_count);
|
|
96
|
-
bvh.initialize_structure();
|
|
97
|
-
|
|
98
|
-
for (let i = 0; i < element_count; i++) {
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
*
|
|
102
|
-
* @type {LightRenderMetadata}
|
|
103
|
-
*/
|
|
104
|
-
const datum = elements[i];
|
|
105
|
-
|
|
106
|
-
const bb = datum.bvh_leaf.bounds;
|
|
107
|
-
|
|
108
|
-
const payload = encode_light_descriptor(datum.address, datum.light);
|
|
109
|
-
|
|
110
|
-
bvh.setLeafData(
|
|
111
|
-
i, payload,
|
|
112
|
-
bb[0], bb[1], bb[2],
|
|
113
|
-
bb[3], bb[4], bb[5],
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// vbvh.sort_morton(this.__projection_matrix);
|
|
118
|
-
// vbvh.sort_bubble_sah();
|
|
119
|
-
|
|
120
|
-
bvh.build();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
125
|
-
* @param {LightRenderMetadata} a
|
|
126
|
-
* @param {LightRenderMetadata} b
|
|
127
|
-
* @returns {number}
|
|
128
|
-
*/
|
|
129
|
-
function compareLRMByLightId(a, b) {
|
|
130
|
-
return b.light.id - a.light.id;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export class LightManager {
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* @readonly
|
|
137
|
-
* @type {BVH}
|
|
138
|
-
*/
|
|
139
|
-
#light_data_bvh = new BVH();
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Mapping from a light/decal object ID internal metadata
|
|
143
|
-
* @type {Map<number,LightRenderMetadata>}
|
|
144
|
-
*/
|
|
145
|
-
#metadata_map = new Map();
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
constructor() {
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Number of cluster slices along each dimension
|
|
152
|
-
* @type {Vector3}
|
|
153
|
-
* @private
|
|
154
|
-
*/
|
|
155
|
-
this.__tiles_resolution = new Vector3(32, 16, 8);
|
|
156
|
-
|
|
157
|
-
this.__cluster_texture_precision = 8;
|
|
158
|
-
this.__cluster_texture_needs_rebuild = false;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Texel layout:
|
|
162
|
-
* - R: offset into lookup texture for lights
|
|
163
|
-
* - G: light count
|
|
164
|
-
* - B: offset into lookup texture for decals
|
|
165
|
-
* - A: decal count
|
|
166
|
-
* @type {DataTexture3D}
|
|
167
|
-
* @private
|
|
168
|
-
*/
|
|
169
|
-
this.__cluster_texture = new DataTexture3D(
|
|
170
|
-
new Uint16Array(4),
|
|
171
|
-
1,
|
|
172
|
-
1,
|
|
173
|
-
1,
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
this.__cluster_texture.flipY = false;
|
|
177
|
-
this.__cluster_texture.generateMipmaps = false;
|
|
178
|
-
this.__cluster_texture.unpackAlignment = 2;
|
|
179
|
-
|
|
180
|
-
this.__cluster_texture.magFilter = NearestFilter;
|
|
181
|
-
this.__cluster_texture.minFilter = NearestFilter;
|
|
182
|
-
|
|
183
|
-
this.__cluster_texture.type = UnsignedShortType;
|
|
184
|
-
this.__cluster_texture.format = RGBAIntegerFormat;
|
|
185
|
-
this.__cluster_texture.internalFormat = "RGBA16UI";
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
*
|
|
189
|
-
* @type {TextureBackedMemoryRegion}
|
|
190
|
-
* @readonly
|
|
191
|
-
* @private
|
|
192
|
-
*/
|
|
193
|
-
this.__lookup_data = new TextureBackedMemoryRegion();
|
|
194
|
-
this.__lookup_data.type = NumericType.Uint;
|
|
195
|
-
this.__lookup_data.channel_count = 1;
|
|
196
|
-
this.__lookup_data.precision = 8;
|
|
197
|
-
this.__lookup_data.resize(1);
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
*
|
|
201
|
-
* @type {TextureBackedMemoryRegion}
|
|
202
|
-
* @readonly
|
|
203
|
-
* @private
|
|
204
|
-
*/
|
|
205
|
-
this.__light_data = new TextureBackedMemoryRegion();
|
|
206
|
-
this.__light_data.type = NumericType.Float;
|
|
207
|
-
this.__light_data.precision = 32;
|
|
208
|
-
this.__light_data.channel_count = 4;
|
|
209
|
-
this.__light_data.resize(8);
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* @type {DataTexture}
|
|
213
|
-
* @readonly
|
|
214
|
-
* @private
|
|
215
|
-
*/
|
|
216
|
-
this.__decal_atlas_texture = new DataTexture(new Uint8Array(4), 1, 1, RGBAFormat);
|
|
217
|
-
this.__decal_atlas_texture.type = UnsignedByteType;
|
|
218
|
-
this.__decal_atlas_texture.flipY = false;
|
|
219
|
-
this.__decal_atlas_texture.wrapS = ClampToEdgeWrapping;
|
|
220
|
-
this.__decal_atlas_texture.wrapT = ClampToEdgeWrapping;
|
|
221
|
-
this.__decal_atlas_texture.minFilter = LinearMipMapLinearFilter;
|
|
222
|
-
this.__decal_atlas_texture.magFilter = LinearFilter;
|
|
223
|
-
this.__decal_atlas_texture.generateMipmaps = true;
|
|
224
|
-
this.__decal_atlas_texture.unpackAlignment = 4;
|
|
225
|
-
this.__decal_atlas_texture.anisotropy = 8;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
*
|
|
229
|
-
* @type {AbstractTextureAtlas}
|
|
230
|
-
* @readonly
|
|
231
|
-
* @private
|
|
232
|
-
*/
|
|
233
|
-
this.__decal_atlas = new CachingTextureAtlas({
|
|
234
|
-
atlas: new TextureAtlas(512)
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
*
|
|
239
|
-
* @type {ReferencedTextureAtlas}
|
|
240
|
-
* @private
|
|
241
|
-
*/
|
|
242
|
-
this.__decal_patch_references = new ReferencedTextureAtlas(this.__decal_atlas);
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
*
|
|
246
|
-
* @type {Map<Decal, Reference<AtlasPatch>>}
|
|
247
|
-
* @private
|
|
248
|
-
*/
|
|
249
|
-
this.__decal_references = new Map();
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
*
|
|
253
|
-
* @type {IncrementalDeltaSet<LightRenderMetadata>}
|
|
254
|
-
* @readonly
|
|
255
|
-
* @private
|
|
256
|
-
*/
|
|
257
|
-
this.__visible_lights = new IncrementalDeltaSet(compareLRMByLightId);
|
|
258
|
-
/**
|
|
259
|
-
*
|
|
260
|
-
* @type {IncrementalDeltaSet<LightRenderMetadata>}
|
|
261
|
-
* @readonly
|
|
262
|
-
* @private
|
|
263
|
-
*/
|
|
264
|
-
this.__visible_decals = new IncrementalDeltaSet(compareLRMByLightId);
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
*
|
|
268
|
-
* @type {LightRenderMetadata[]}
|
|
269
|
-
* @private
|
|
270
|
-
*/
|
|
271
|
-
this.__sorted_visible_lights = [];
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
*
|
|
275
|
-
* @type {BinaryUint32BVH}
|
|
276
|
-
* @private
|
|
277
|
-
*/
|
|
278
|
-
this.__visible_bvh_lights = new BinaryUint32BVH();
|
|
279
|
-
/**
|
|
280
|
-
*
|
|
281
|
-
* @type {BinaryUint32BVH}
|
|
282
|
-
* @private
|
|
283
|
-
*/
|
|
284
|
-
this.__visible_bvh_decals = new BinaryUint32BVH();
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
*
|
|
288
|
-
* @type {Frustum}
|
|
289
|
-
* @private
|
|
290
|
-
*/
|
|
291
|
-
this.__view_frustum = new Frustum();
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Corner points of the view frustum
|
|
295
|
-
* @type {Float32Array}
|
|
296
|
-
* @private
|
|
297
|
-
*/
|
|
298
|
-
this.__view_frustum_points = new Float32Array(24);
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
*
|
|
302
|
-
* @type {Float32Array|mat4|number[]}
|
|
303
|
-
* @private
|
|
304
|
-
*/
|
|
305
|
-
this.__projection_matrix = new Float32Array(16);
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Accelerated data structure with pre-computed plane normals for clusters in each dimensions. Order: X, Y, Z
|
|
310
|
-
* @type {Float32Array}
|
|
311
|
-
* @private
|
|
312
|
-
*/
|
|
313
|
-
this.__cluster_planes = new Float32Array(1);
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Accelerated data structure with pre-computed corner coordinates of each cluster's frustum
|
|
317
|
-
* @type {Float32Array}
|
|
318
|
-
* @private
|
|
319
|
-
*/
|
|
320
|
-
this.__cluster_frustum_points = new Float32Array(1);
|
|
321
|
-
|
|
322
|
-
this.setTileMapResolution(32, 16, 16);
|
|
323
|
-
|
|
324
|
-
this.__visible_lights.onAdded.add(this.__handle_visible_light_added, this);
|
|
325
|
-
this.__visible_lights.onRemoved.add(this.__handle_visible_light_removed, this);
|
|
326
|
-
|
|
327
|
-
this.__visible_decals.onAdded.add(this.__handle_visible_decal_added, this);
|
|
328
|
-
this.__visible_decals.onRemoved.add(this.__handle_visible_decal_removed, this);
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Data needs to be re-written into the data texture
|
|
332
|
-
* Usually set when source lights change
|
|
333
|
-
* @type {boolean}
|
|
334
|
-
* @private
|
|
335
|
-
*/
|
|
336
|
-
this.__light_data_needs_update = true;
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
*
|
|
340
|
-
* @type {boolean}
|
|
341
|
-
* @private
|
|
342
|
-
*/
|
|
343
|
-
this.__visible_bvh_needs_update = true;
|
|
344
|
-
|
|
345
|
-
// window.light_manager = this; // DEBUG
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
requestDataUpdate() {
|
|
349
|
-
this.__light_data_needs_update = true;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Please set this to false if you have a lot of overlapping decals in the scene
|
|
354
|
-
* Overlapping decals can provide filtering artifacts due to incorrect mipmap level detection by WebGL
|
|
355
|
-
* see article: https://0fps.net/2013/07/09/texture-atlases-wrapping-and-mip-mapping/
|
|
356
|
-
* NOTE: the technique mentioned in the article above is not implemented, as it would require significant increase in number of texture fetches
|
|
357
|
-
* @param {boolean} v
|
|
358
|
-
*/
|
|
359
|
-
set decal_filtering_enabled(v) {
|
|
360
|
-
const t = this.__decal_atlas_texture;
|
|
361
|
-
|
|
362
|
-
if (t.generateMipmaps === v) {
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
t.generateMipmaps = v;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
*
|
|
371
|
-
* @return {boolean}
|
|
372
|
-
*/
|
|
373
|
-
get decal_filtering_enabled() {
|
|
374
|
-
return this.__decal_atlas_texture.generateMipmaps;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
__update_decal_atlas_texture() {
|
|
378
|
-
const sampler = this.__decal_atlas.sampler;
|
|
379
|
-
|
|
380
|
-
if (sampler.version !== this.__decal_atlas_texture.version) {
|
|
381
|
-
writeSample2DDataToDataTexture(sampler, this.__decal_atlas_texture);
|
|
382
|
-
|
|
383
|
-
this.__decal_atlas_texture.version = sampler.version;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Sometimes light lookup table can get quite large, to make sure we can store these addresses in the cluster texture,
|
|
389
|
-
* we may need to switch to a larger data type, such as Uint8->Uint16 or Uint16->Uint32
|
|
390
|
-
* @param {number} bit_count How many bits should be addressable from the cluster content
|
|
391
|
-
* @returns {boolean} true if texture was rebuilt (underlying type change), false otherwise
|
|
392
|
-
* @private
|
|
393
|
-
*/
|
|
394
|
-
__set_cluster_addressable_bit_range(bit_count) {
|
|
395
|
-
const rounded_value = Math.ceil(bit_count);
|
|
396
|
-
|
|
397
|
-
this.__cluster_texture_precision = rounded_value;
|
|
398
|
-
const dataType = computeBinaryDataTypeByPrecision(NumericType.Uint, rounded_value);
|
|
399
|
-
|
|
400
|
-
const threeTextureType = computeThreeTextureTypeFromDataType(dataType);
|
|
401
|
-
|
|
402
|
-
const texture = this.__cluster_texture;
|
|
403
|
-
if (threeTextureType !== texture.type) {
|
|
404
|
-
this.__cluster_texture_needs_rebuild = true;
|
|
405
|
-
|
|
406
|
-
return true;
|
|
407
|
-
} else {
|
|
408
|
-
return false;
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
__update_cluster_texture() {
|
|
413
|
-
if (this.__cluster_texture_needs_rebuild) {
|
|
414
|
-
this.__build_cluster_texture();
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
__build_cluster_texture() {
|
|
419
|
-
const dataType = computeBinaryDataTypeByPrecision(NumericType.Uint, this.__cluster_texture_precision);
|
|
420
|
-
|
|
421
|
-
const threeTextureType = computeThreeTextureTypeFromDataType(dataType);
|
|
422
|
-
|
|
423
|
-
const texture = this.__cluster_texture;
|
|
424
|
-
|
|
425
|
-
const channelCount = 4;
|
|
426
|
-
|
|
427
|
-
texture.dispose();
|
|
428
|
-
|
|
429
|
-
const image = texture.image;
|
|
430
|
-
|
|
431
|
-
const resolution = this.__tiles_resolution;
|
|
432
|
-
|
|
433
|
-
image.width = resolution.x;
|
|
434
|
-
image.height = resolution.y;
|
|
435
|
-
image.depth = resolution.z;
|
|
436
|
-
|
|
437
|
-
texture.type = threeTextureType;
|
|
438
|
-
texture.internalFormat = computeThreeTextureInternalFormatFromDataType(dataType, channelCount);
|
|
439
|
-
|
|
440
|
-
const ArrayConstructor = DataType2TypedArrayConstructorMapping[dataType];
|
|
441
|
-
|
|
442
|
-
image.data = new ArrayConstructor(resolution.x * resolution.y * resolution.z * channelCount);
|
|
443
|
-
|
|
444
|
-
texture.needsUpdate = true;
|
|
445
|
-
|
|
446
|
-
this.__cluster_texture_needs_rebuild = false;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
*
|
|
451
|
-
* @param {number} size
|
|
452
|
-
* @returns {boolean}
|
|
453
|
-
* @private
|
|
454
|
-
*/
|
|
455
|
-
__ensure_lookup_size(size) {
|
|
456
|
-
return this.__lookup_data.resize(size);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
*
|
|
461
|
-
* @returns {DataTexture}
|
|
462
|
-
*/
|
|
463
|
-
getTextureLookup() {
|
|
464
|
-
return this.__lookup_data.getTexture();
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
*
|
|
469
|
-
* @returns {DataTexture}
|
|
470
|
-
*/
|
|
471
|
-
getTextureData() {
|
|
472
|
-
return this.__light_data.getTexture();
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* @returns {DataTexture3D}
|
|
477
|
-
*/
|
|
478
|
-
getTextureClusters() {
|
|
479
|
-
return this.__cluster_texture;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* @returns {DataTexture}
|
|
484
|
-
*/
|
|
485
|
-
getTextureDecalAtlas() {
|
|
486
|
-
return this.__decal_atlas_texture;
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* NOTE: do not modify the value
|
|
491
|
-
* @returns {Readonly<Vector3>}
|
|
492
|
-
*/
|
|
493
|
-
getResolution() {
|
|
494
|
-
return this.__tiles_resolution;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
*
|
|
499
|
-
* @private
|
|
500
|
-
*/
|
|
501
|
-
__handle_light_dimensions_change() {
|
|
502
|
-
// internal BVH needs to be rebuilt
|
|
503
|
-
this.__visible_bvh_needs_update = true;
|
|
504
|
-
// when dimensions change, typically data will need to be re-written to the GPU, things like light positions or projection matrix
|
|
505
|
-
this.__light_data_needs_update = true;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
*
|
|
510
|
-
* @private
|
|
511
|
-
*/
|
|
512
|
-
__handle_light_appearance_change() {
|
|
513
|
-
// appearance changes (such as color or intensity) don't affect bounds, only the encoded data
|
|
514
|
-
this.__light_data_needs_update = true;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
*
|
|
519
|
-
* @param {LightRenderMetadata} data
|
|
520
|
-
* @private
|
|
521
|
-
*/
|
|
522
|
-
__handle_visible_decal_added(data) {
|
|
523
|
-
this.__light_data_needs_update = true;
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
*
|
|
527
|
-
* @type {Decal}
|
|
528
|
-
*/
|
|
529
|
-
const light = data.light;
|
|
530
|
-
|
|
531
|
-
light.onDimensionChanged(this.__handle_light_dimensions_change, this);
|
|
532
|
-
|
|
533
|
-
const ref = this.__decal_patch_references.acquire(light.texture_diffuse);
|
|
534
|
-
|
|
535
|
-
const patch = ref.getValue();
|
|
536
|
-
const patch_uv = patch.uv;
|
|
537
|
-
|
|
538
|
-
patch_uv.position.onChanged.add(light.handleUvPositionChange, light);
|
|
539
|
-
patch_uv.size.onChanged.add(light.handleUvSizeChange, light);
|
|
540
|
-
|
|
541
|
-
light.uv[0] = patch_uv.position.x;
|
|
542
|
-
light.uv[1] = patch_uv.position.y;
|
|
543
|
-
light.uv[2] = patch_uv.size.x;
|
|
544
|
-
light.uv[3] = patch_uv.size.y;
|
|
545
|
-
|
|
546
|
-
this.__decal_references.set(light, ref);
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
*
|
|
551
|
-
* @param {LightRenderMetadata} data
|
|
552
|
-
* @private
|
|
553
|
-
*/
|
|
554
|
-
__handle_visible_decal_removed(data) {
|
|
555
|
-
this.__light_data_needs_update = true;
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
*
|
|
559
|
-
* @type {Decal}
|
|
560
|
-
*/
|
|
561
|
-
const light = data.light;
|
|
562
|
-
|
|
563
|
-
light.offDimensionChanged(this.__handle_light_dimensions_change, this);
|
|
564
|
-
|
|
565
|
-
const ref = this.__decal_references.get(light);
|
|
566
|
-
|
|
567
|
-
if (ref === undefined) {
|
|
568
|
-
// This can occur when decal changes while being in the visible list, messing with the IncrementalDeltaSet's compare order
|
|
569
|
-
console.warn(`Decal reference not found: ${light}`);
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
const patch = ref.getValue();
|
|
574
|
-
const patch_uv = patch.uv;
|
|
575
|
-
|
|
576
|
-
// unsubscribe
|
|
577
|
-
patch_uv.position.onChanged.remove(light.handleUvPositionChange, light);
|
|
578
|
-
patch_uv.size.onChanged.remove(light.handleUvSizeChange, light);
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
ref.release();
|
|
582
|
-
|
|
583
|
-
this.__decal_references.delete(light);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
*
|
|
588
|
-
* @param {LightRenderMetadata} data
|
|
589
|
-
* @private
|
|
590
|
-
*/
|
|
591
|
-
__handle_visible_light_added(data) {
|
|
592
|
-
this.__light_data_needs_update = true;
|
|
593
|
-
|
|
594
|
-
const light = data.light;
|
|
595
|
-
|
|
596
|
-
light.onDimensionChanged(this.__handle_light_dimensions_change, this);
|
|
597
|
-
light.onAppearanceChanged(this.__handle_light_appearance_change, this);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
/**
|
|
601
|
-
*
|
|
602
|
-
* @param {LightRenderMetadata} data
|
|
603
|
-
* @private
|
|
604
|
-
*/
|
|
605
|
-
__handle_visible_light_removed(data) {
|
|
606
|
-
this.__light_data_needs_update = true;
|
|
607
|
-
|
|
608
|
-
const light = data.light;
|
|
609
|
-
light.offDimensionChanged(this.__handle_light_dimensions_change, this);
|
|
610
|
-
light.offAppearanceChanged(this.__handle_light_appearance_change, this);
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
*
|
|
615
|
-
* @param {LightRenderMetadata} light
|
|
616
|
-
* @returns {number}
|
|
617
|
-
* @protected
|
|
618
|
-
*/
|
|
619
|
-
__sort_visible_light_score(light) {
|
|
620
|
-
const center = scratch_corners;
|
|
621
|
-
|
|
622
|
-
light.light.getCenter(center)
|
|
623
|
-
|
|
624
|
-
const x = center[0];
|
|
625
|
-
const y = center[1];
|
|
626
|
-
const z = center[2];
|
|
627
|
-
|
|
628
|
-
return v3_morton_encode_transformed(x, y, z, this.__projection_matrix);
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* DEBUG method
|
|
633
|
-
* @param {LightRenderMetadata} lights
|
|
634
|
-
* @param {number} count
|
|
635
|
-
* @returns {number} lower = better sorting score
|
|
636
|
-
* @private
|
|
637
|
-
*/
|
|
638
|
-
__assess_sorting_score(lights, count) {
|
|
639
|
-
|
|
640
|
-
let r = 0;
|
|
641
|
-
|
|
642
|
-
const center_a = [];
|
|
643
|
-
const center_b = [];
|
|
644
|
-
|
|
645
|
-
for (let i = 0; i < count; i++) {
|
|
646
|
-
const a = lights[i];
|
|
647
|
-
|
|
648
|
-
const score_a = this.__sort_visible_light_score(a);
|
|
649
|
-
a.light.getCenter(center_a);
|
|
650
|
-
|
|
651
|
-
for (let j = i + 1; j < count; j++) {
|
|
652
|
-
const b = lights[j];
|
|
653
|
-
|
|
654
|
-
const score_b = this.__sort_visible_light_score(b);
|
|
655
|
-
b.light.getCenter(center_b);
|
|
656
|
-
|
|
657
|
-
//
|
|
658
|
-
const score_distance = Math.abs(score_a - score_b);
|
|
659
|
-
const position_distance = v3_distance(
|
|
660
|
-
center_a[0], center_a[1], center_a[2],
|
|
661
|
-
center_b[0], center_b[1], center_b[2],
|
|
662
|
-
);
|
|
663
|
-
|
|
664
|
-
r += score_distance / position_distance;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
return r / (count * (count - 1) * 0.5);
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
/**
|
|
673
|
-
* Sort lights for better data locality
|
|
674
|
-
* @private
|
|
675
|
-
*/
|
|
676
|
-
__sort_visible_light() {
|
|
677
|
-
const sorted_lights = this.__sorted_visible_lights;
|
|
678
|
-
|
|
679
|
-
const visible_light_set = this.__visible_lights;
|
|
680
|
-
const visible_light_count = visible_light_set.size;
|
|
681
|
-
|
|
682
|
-
const visible_decal_set = this.__visible_decals;
|
|
683
|
-
const visible_decal_count = visible_decal_set.size;
|
|
684
|
-
|
|
685
|
-
const expected_sorted_size = visible_light_count + visible_decal_count;
|
|
686
|
-
|
|
687
|
-
if (
|
|
688
|
-
// crop array
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
const
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
//
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
const
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
light_data.
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
const
|
|
897
|
-
const
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
const
|
|
925
|
-
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
//
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
//
|
|
1027
|
-
this.
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
const
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
//
|
|
1089
|
-
camera.
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
//
|
|
1096
|
-
this.
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
// console.
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
this.
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
this.
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
*
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
assert.
|
|
1152
|
-
|
|
1153
|
-
assert.
|
|
1154
|
-
assert.
|
|
1155
|
-
|
|
1156
|
-
assert.
|
|
1157
|
-
|
|
1158
|
-
assert.
|
|
1159
|
-
assert.
|
|
1160
|
-
|
|
1161
|
-
assert.
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1
|
+
import { m4_multiply } from "../../../../core/geom/3d/mat4/m4_multiply.js";
|
|
2
|
+
import {
|
|
3
|
+
ClampToEdgeWrapping,
|
|
4
|
+
DataTexture,
|
|
5
|
+
DataTexture3D,
|
|
6
|
+
Frustum,
|
|
7
|
+
LinearFilter,
|
|
8
|
+
LinearMipMapLinearFilter,
|
|
9
|
+
NearestFilter,
|
|
10
|
+
RGBAFormat,
|
|
11
|
+
RGBAIntegerFormat,
|
|
12
|
+
UnsignedByteType,
|
|
13
|
+
UnsignedShortType
|
|
14
|
+
} from "three";
|
|
15
|
+
import { assert } from "../../../../core/assert.js";
|
|
16
|
+
import { computeBinaryDataTypeByPrecision } from "../../../../core/binary/type/computeBinaryDataTypeByPrecision.js";
|
|
17
|
+
import {
|
|
18
|
+
DataType2TypedArrayConstructorMapping
|
|
19
|
+
} from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
20
|
+
import { BinaryUint32BVH } from "../../../../core/bvh2/binary/2/BinaryUint32BVH.js";
|
|
21
|
+
import { BVH } from "../../../../core/bvh2/bvh3/BVH.js";
|
|
22
|
+
import {
|
|
23
|
+
bvh_query_user_data_intersects_frustum
|
|
24
|
+
} from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_intersects_frustum.js";
|
|
25
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
26
|
+
import { array_sort_quick } from "../../../../core/collection/array/array_sort_quick.js";
|
|
27
|
+
import { array_swap_one } from "../../../../core/collection/array/array_swap_one.js";
|
|
28
|
+
import { frustum3_planes_to_flat_from_three } from "../../../../core/geom/3d/frustum/frustum3_planes_to_flat_from_three.js";
|
|
29
|
+
import { frustum3_slice_linear_to_points } from "../../../../core/geom/3d/frustum/frustum3_slice_linear_to_points.js";
|
|
30
|
+
import { v3_morton_encode_transformed } from "../../../../core/geom/3d/morton/v3_morton_encode_transformed.js";
|
|
31
|
+
import { v3_distance } from "../../../../core/geom/vec3/v3_distance.js";
|
|
32
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
33
|
+
import { NumericType } from "../../../../core/math/NumericType.js";
|
|
34
|
+
import { frustum_from_camera } from "../../ecs/camera/frustum_from_camera.js";
|
|
35
|
+
import { CachingTextureAtlas } from "../../texture/atlas/CachingTextureAtlas.js";
|
|
36
|
+
import { ReferencedTextureAtlas } from "../../texture/atlas/ReferencedTextureAtlas.js";
|
|
37
|
+
import { TextureAtlas } from "../../texture/atlas/TextureAtlas.js";
|
|
38
|
+
import {
|
|
39
|
+
computeThreeTextureInternalFormatFromDataType
|
|
40
|
+
} from "../../texture/computeThreeTextureInternalFormatFromDataType.js";
|
|
41
|
+
import { computeThreeTextureTypeFromDataType } from "../../texture/computeThreeTextureTypeFromDataType.js";
|
|
42
|
+
import { writeSample2DDataToDataTexture } from "../../texture/sampler/writeSampler2DDataToDataTexture.js";
|
|
43
|
+
import { TextureBackedMemoryRegion } from "../../texture/TextureBackedMemoryRegion.js";
|
|
44
|
+
import { IncrementalDeltaSet } from "../visibility/IncrementalDeltaSet.js";
|
|
45
|
+
import { assign_cluster, LOOKUP_CACHE, scratch_corners, scratch_frustum_planes } from "./assign_cluster.js";
|
|
46
|
+
import { compute_cluster_planes_from_points } from "./cluster/compute_cluster_planes_from_points.js";
|
|
47
|
+
import { read_plane_pair } from "./cluster/read_plane_pair.js";
|
|
48
|
+
import { computeFrustumCorners } from "./computeFrustumCorners.js";
|
|
49
|
+
import { LightRenderMetadata } from "./LightRenderMetadata.js";
|
|
50
|
+
import { Decal } from "./model/Decal.js";
|
|
51
|
+
import { point_light_inside_volume } from "./query/point_light_inside_volume.js";
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* How many bits are used to encode light type
|
|
56
|
+
* @type {number}
|
|
57
|
+
*/
|
|
58
|
+
const LIGHT_ENCODING_TYPE_BIT_COUNT = 2;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param {AbstractLight|PointLight|Decal} light
|
|
63
|
+
* @returns {number}
|
|
64
|
+
*/
|
|
65
|
+
function encode_light_type(light) {
|
|
66
|
+
if (light.isPointLight === true) {
|
|
67
|
+
return 0;
|
|
68
|
+
} else if (light.isDecal === true) {
|
|
69
|
+
return 3;
|
|
70
|
+
} else {
|
|
71
|
+
throw new Error('Unsupported light type');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @param {number} address
|
|
78
|
+
* @param {AbstractLight} light
|
|
79
|
+
* @returns {number}
|
|
80
|
+
*/
|
|
81
|
+
function encode_light_descriptor(address, light) {
|
|
82
|
+
const light_type = encode_light_type(light);
|
|
83
|
+
return light_type | (address << 2);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
* @param {IncrementalDeltaSet<LightRenderMetadata>} data_set
|
|
89
|
+
* @param {BinaryUint32BVH} bvh
|
|
90
|
+
*/
|
|
91
|
+
function build_light_data_bvh(data_set, bvh) {
|
|
92
|
+
const elements = data_set.elements;
|
|
93
|
+
const element_count = data_set.size;
|
|
94
|
+
|
|
95
|
+
bvh.setLeafCount(element_count);
|
|
96
|
+
bvh.initialize_structure();
|
|
97
|
+
|
|
98
|
+
for (let i = 0; i < element_count; i++) {
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
*
|
|
102
|
+
* @type {LightRenderMetadata}
|
|
103
|
+
*/
|
|
104
|
+
const datum = elements[i];
|
|
105
|
+
|
|
106
|
+
const bb = datum.bvh_leaf.bounds;
|
|
107
|
+
|
|
108
|
+
const payload = encode_light_descriptor(datum.address, datum.light);
|
|
109
|
+
|
|
110
|
+
bvh.setLeafData(
|
|
111
|
+
i, payload,
|
|
112
|
+
bb[0], bb[1], bb[2],
|
|
113
|
+
bb[3], bb[4], bb[5],
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// vbvh.sort_morton(this.__projection_matrix);
|
|
118
|
+
// vbvh.sort_bubble_sah();
|
|
119
|
+
|
|
120
|
+
bvh.build();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
*
|
|
125
|
+
* @param {LightRenderMetadata} a
|
|
126
|
+
* @param {LightRenderMetadata} b
|
|
127
|
+
* @returns {number}
|
|
128
|
+
*/
|
|
129
|
+
function compareLRMByLightId(a, b) {
|
|
130
|
+
return b.light.id - a.light.id;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export class LightManager {
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @readonly
|
|
137
|
+
* @type {BVH}
|
|
138
|
+
*/
|
|
139
|
+
#light_data_bvh = new BVH();
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Mapping from a light/decal object ID internal metadata
|
|
143
|
+
* @type {Map<number,LightRenderMetadata>}
|
|
144
|
+
*/
|
|
145
|
+
#metadata_map = new Map();
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
constructor() {
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Number of cluster slices along each dimension
|
|
152
|
+
* @type {Vector3}
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
this.__tiles_resolution = new Vector3(32, 16, 8);
|
|
156
|
+
|
|
157
|
+
this.__cluster_texture_precision = 8;
|
|
158
|
+
this.__cluster_texture_needs_rebuild = false;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Texel layout:
|
|
162
|
+
* - R: offset into lookup texture for lights
|
|
163
|
+
* - G: light count
|
|
164
|
+
* - B: offset into lookup texture for decals
|
|
165
|
+
* - A: decal count
|
|
166
|
+
* @type {DataTexture3D}
|
|
167
|
+
* @private
|
|
168
|
+
*/
|
|
169
|
+
this.__cluster_texture = new DataTexture3D(
|
|
170
|
+
new Uint16Array(4),
|
|
171
|
+
1,
|
|
172
|
+
1,
|
|
173
|
+
1,
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
this.__cluster_texture.flipY = false;
|
|
177
|
+
this.__cluster_texture.generateMipmaps = false;
|
|
178
|
+
this.__cluster_texture.unpackAlignment = 2;
|
|
179
|
+
|
|
180
|
+
this.__cluster_texture.magFilter = NearestFilter;
|
|
181
|
+
this.__cluster_texture.minFilter = NearestFilter;
|
|
182
|
+
|
|
183
|
+
this.__cluster_texture.type = UnsignedShortType;
|
|
184
|
+
this.__cluster_texture.format = RGBAIntegerFormat;
|
|
185
|
+
this.__cluster_texture.internalFormat = "RGBA16UI";
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
*
|
|
189
|
+
* @type {TextureBackedMemoryRegion}
|
|
190
|
+
* @readonly
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
this.__lookup_data = new TextureBackedMemoryRegion();
|
|
194
|
+
this.__lookup_data.type = NumericType.Uint;
|
|
195
|
+
this.__lookup_data.channel_count = 1;
|
|
196
|
+
this.__lookup_data.precision = 8;
|
|
197
|
+
this.__lookup_data.resize(1);
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
*
|
|
201
|
+
* @type {TextureBackedMemoryRegion}
|
|
202
|
+
* @readonly
|
|
203
|
+
* @private
|
|
204
|
+
*/
|
|
205
|
+
this.__light_data = new TextureBackedMemoryRegion();
|
|
206
|
+
this.__light_data.type = NumericType.Float;
|
|
207
|
+
this.__light_data.precision = 32;
|
|
208
|
+
this.__light_data.channel_count = 4;
|
|
209
|
+
this.__light_data.resize(8);
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @type {DataTexture}
|
|
213
|
+
* @readonly
|
|
214
|
+
* @private
|
|
215
|
+
*/
|
|
216
|
+
this.__decal_atlas_texture = new DataTexture(new Uint8Array(4), 1, 1, RGBAFormat);
|
|
217
|
+
this.__decal_atlas_texture.type = UnsignedByteType;
|
|
218
|
+
this.__decal_atlas_texture.flipY = false;
|
|
219
|
+
this.__decal_atlas_texture.wrapS = ClampToEdgeWrapping;
|
|
220
|
+
this.__decal_atlas_texture.wrapT = ClampToEdgeWrapping;
|
|
221
|
+
this.__decal_atlas_texture.minFilter = LinearMipMapLinearFilter;
|
|
222
|
+
this.__decal_atlas_texture.magFilter = LinearFilter;
|
|
223
|
+
this.__decal_atlas_texture.generateMipmaps = true;
|
|
224
|
+
this.__decal_atlas_texture.unpackAlignment = 4;
|
|
225
|
+
this.__decal_atlas_texture.anisotropy = 8;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
*
|
|
229
|
+
* @type {AbstractTextureAtlas}
|
|
230
|
+
* @readonly
|
|
231
|
+
* @private
|
|
232
|
+
*/
|
|
233
|
+
this.__decal_atlas = new CachingTextureAtlas({
|
|
234
|
+
atlas: new TextureAtlas(512)
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
*
|
|
239
|
+
* @type {ReferencedTextureAtlas}
|
|
240
|
+
* @private
|
|
241
|
+
*/
|
|
242
|
+
this.__decal_patch_references = new ReferencedTextureAtlas(this.__decal_atlas);
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
*
|
|
246
|
+
* @type {Map<Decal, Reference<AtlasPatch>>}
|
|
247
|
+
* @private
|
|
248
|
+
*/
|
|
249
|
+
this.__decal_references = new Map();
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
*
|
|
253
|
+
* @type {IncrementalDeltaSet<LightRenderMetadata>}
|
|
254
|
+
* @readonly
|
|
255
|
+
* @private
|
|
256
|
+
*/
|
|
257
|
+
this.__visible_lights = new IncrementalDeltaSet(compareLRMByLightId);
|
|
258
|
+
/**
|
|
259
|
+
*
|
|
260
|
+
* @type {IncrementalDeltaSet<LightRenderMetadata>}
|
|
261
|
+
* @readonly
|
|
262
|
+
* @private
|
|
263
|
+
*/
|
|
264
|
+
this.__visible_decals = new IncrementalDeltaSet(compareLRMByLightId);
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
*
|
|
268
|
+
* @type {LightRenderMetadata[]}
|
|
269
|
+
* @private
|
|
270
|
+
*/
|
|
271
|
+
this.__sorted_visible_lights = [];
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
*
|
|
275
|
+
* @type {BinaryUint32BVH}
|
|
276
|
+
* @private
|
|
277
|
+
*/
|
|
278
|
+
this.__visible_bvh_lights = new BinaryUint32BVH();
|
|
279
|
+
/**
|
|
280
|
+
*
|
|
281
|
+
* @type {BinaryUint32BVH}
|
|
282
|
+
* @private
|
|
283
|
+
*/
|
|
284
|
+
this.__visible_bvh_decals = new BinaryUint32BVH();
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
*
|
|
288
|
+
* @type {Frustum}
|
|
289
|
+
* @private
|
|
290
|
+
*/
|
|
291
|
+
this.__view_frustum = new Frustum();
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Corner points of the view frustum
|
|
295
|
+
* @type {Float32Array}
|
|
296
|
+
* @private
|
|
297
|
+
*/
|
|
298
|
+
this.__view_frustum_points = new Float32Array(24);
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
*
|
|
302
|
+
* @type {Float32Array|mat4|number[]}
|
|
303
|
+
* @private
|
|
304
|
+
*/
|
|
305
|
+
this.__projection_matrix = new Float32Array(16);
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Accelerated data structure with pre-computed plane normals for clusters in each dimensions. Order: X, Y, Z
|
|
310
|
+
* @type {Float32Array}
|
|
311
|
+
* @private
|
|
312
|
+
*/
|
|
313
|
+
this.__cluster_planes = new Float32Array(1);
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Accelerated data structure with pre-computed corner coordinates of each cluster's frustum
|
|
317
|
+
* @type {Float32Array}
|
|
318
|
+
* @private
|
|
319
|
+
*/
|
|
320
|
+
this.__cluster_frustum_points = new Float32Array(1);
|
|
321
|
+
|
|
322
|
+
this.setTileMapResolution(32, 16, 16);
|
|
323
|
+
|
|
324
|
+
this.__visible_lights.onAdded.add(this.__handle_visible_light_added, this);
|
|
325
|
+
this.__visible_lights.onRemoved.add(this.__handle_visible_light_removed, this);
|
|
326
|
+
|
|
327
|
+
this.__visible_decals.onAdded.add(this.__handle_visible_decal_added, this);
|
|
328
|
+
this.__visible_decals.onRemoved.add(this.__handle_visible_decal_removed, this);
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Data needs to be re-written into the data texture
|
|
332
|
+
* Usually set when source lights change
|
|
333
|
+
* @type {boolean}
|
|
334
|
+
* @private
|
|
335
|
+
*/
|
|
336
|
+
this.__light_data_needs_update = true;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
*
|
|
340
|
+
* @type {boolean}
|
|
341
|
+
* @private
|
|
342
|
+
*/
|
|
343
|
+
this.__visible_bvh_needs_update = true;
|
|
344
|
+
|
|
345
|
+
// window.light_manager = this; // DEBUG
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
requestDataUpdate() {
|
|
349
|
+
this.__light_data_needs_update = true;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Please set this to false if you have a lot of overlapping decals in the scene
|
|
354
|
+
* Overlapping decals can provide filtering artifacts due to incorrect mipmap level detection by WebGL
|
|
355
|
+
* see article: https://0fps.net/2013/07/09/texture-atlases-wrapping-and-mip-mapping/
|
|
356
|
+
* NOTE: the technique mentioned in the article above is not implemented, as it would require significant increase in number of texture fetches
|
|
357
|
+
* @param {boolean} v
|
|
358
|
+
*/
|
|
359
|
+
set decal_filtering_enabled(v) {
|
|
360
|
+
const t = this.__decal_atlas_texture;
|
|
361
|
+
|
|
362
|
+
if (t.generateMipmaps === v) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
t.generateMipmaps = v;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
*
|
|
371
|
+
* @return {boolean}
|
|
372
|
+
*/
|
|
373
|
+
get decal_filtering_enabled() {
|
|
374
|
+
return this.__decal_atlas_texture.generateMipmaps;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
__update_decal_atlas_texture() {
|
|
378
|
+
const sampler = this.__decal_atlas.sampler;
|
|
379
|
+
|
|
380
|
+
if (sampler.version !== this.__decal_atlas_texture.version) {
|
|
381
|
+
writeSample2DDataToDataTexture(sampler, this.__decal_atlas_texture);
|
|
382
|
+
|
|
383
|
+
this.__decal_atlas_texture.version = sampler.version;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Sometimes light lookup table can get quite large, to make sure we can store these addresses in the cluster texture,
|
|
389
|
+
* we may need to switch to a larger data type, such as Uint8->Uint16 or Uint16->Uint32
|
|
390
|
+
* @param {number} bit_count How many bits should be addressable from the cluster content
|
|
391
|
+
* @returns {boolean} true if texture was rebuilt (underlying type change), false otherwise
|
|
392
|
+
* @private
|
|
393
|
+
*/
|
|
394
|
+
__set_cluster_addressable_bit_range(bit_count) {
|
|
395
|
+
const rounded_value = Math.ceil(bit_count);
|
|
396
|
+
|
|
397
|
+
this.__cluster_texture_precision = rounded_value;
|
|
398
|
+
const dataType = computeBinaryDataTypeByPrecision(NumericType.Uint, rounded_value);
|
|
399
|
+
|
|
400
|
+
const threeTextureType = computeThreeTextureTypeFromDataType(dataType);
|
|
401
|
+
|
|
402
|
+
const texture = this.__cluster_texture;
|
|
403
|
+
if (threeTextureType !== texture.type) {
|
|
404
|
+
this.__cluster_texture_needs_rebuild = true;
|
|
405
|
+
|
|
406
|
+
return true;
|
|
407
|
+
} else {
|
|
408
|
+
return false;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
__update_cluster_texture() {
|
|
413
|
+
if (this.__cluster_texture_needs_rebuild) {
|
|
414
|
+
this.__build_cluster_texture();
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
__build_cluster_texture() {
|
|
419
|
+
const dataType = computeBinaryDataTypeByPrecision(NumericType.Uint, this.__cluster_texture_precision);
|
|
420
|
+
|
|
421
|
+
const threeTextureType = computeThreeTextureTypeFromDataType(dataType);
|
|
422
|
+
|
|
423
|
+
const texture = this.__cluster_texture;
|
|
424
|
+
|
|
425
|
+
const channelCount = 4;
|
|
426
|
+
|
|
427
|
+
texture.dispose();
|
|
428
|
+
|
|
429
|
+
const image = texture.image;
|
|
430
|
+
|
|
431
|
+
const resolution = this.__tiles_resolution;
|
|
432
|
+
|
|
433
|
+
image.width = resolution.x;
|
|
434
|
+
image.height = resolution.y;
|
|
435
|
+
image.depth = resolution.z;
|
|
436
|
+
|
|
437
|
+
texture.type = threeTextureType;
|
|
438
|
+
texture.internalFormat = computeThreeTextureInternalFormatFromDataType(dataType, channelCount);
|
|
439
|
+
|
|
440
|
+
const ArrayConstructor = DataType2TypedArrayConstructorMapping[dataType];
|
|
441
|
+
|
|
442
|
+
image.data = new ArrayConstructor(resolution.x * resolution.y * resolution.z * channelCount);
|
|
443
|
+
|
|
444
|
+
texture.needsUpdate = true;
|
|
445
|
+
|
|
446
|
+
this.__cluster_texture_needs_rebuild = false;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
*
|
|
451
|
+
* @param {number} size
|
|
452
|
+
* @returns {boolean}
|
|
453
|
+
* @private
|
|
454
|
+
*/
|
|
455
|
+
__ensure_lookup_size(size) {
|
|
456
|
+
return this.__lookup_data.resize(size);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
*
|
|
461
|
+
* @returns {DataTexture}
|
|
462
|
+
*/
|
|
463
|
+
getTextureLookup() {
|
|
464
|
+
return this.__lookup_data.getTexture();
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
*
|
|
469
|
+
* @returns {DataTexture}
|
|
470
|
+
*/
|
|
471
|
+
getTextureData() {
|
|
472
|
+
return this.__light_data.getTexture();
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* @returns {DataTexture3D}
|
|
477
|
+
*/
|
|
478
|
+
getTextureClusters() {
|
|
479
|
+
return this.__cluster_texture;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* @returns {DataTexture}
|
|
484
|
+
*/
|
|
485
|
+
getTextureDecalAtlas() {
|
|
486
|
+
return this.__decal_atlas_texture;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* NOTE: do not modify the value
|
|
491
|
+
* @returns {Readonly<Vector3>}
|
|
492
|
+
*/
|
|
493
|
+
getResolution() {
|
|
494
|
+
return this.__tiles_resolution;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
*
|
|
499
|
+
* @private
|
|
500
|
+
*/
|
|
501
|
+
__handle_light_dimensions_change() {
|
|
502
|
+
// internal BVH needs to be rebuilt
|
|
503
|
+
this.__visible_bvh_needs_update = true;
|
|
504
|
+
// when dimensions change, typically data will need to be re-written to the GPU, things like light positions or projection matrix
|
|
505
|
+
this.__light_data_needs_update = true;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
*
|
|
510
|
+
* @private
|
|
511
|
+
*/
|
|
512
|
+
__handle_light_appearance_change() {
|
|
513
|
+
// appearance changes (such as color or intensity) don't affect bounds, only the encoded data
|
|
514
|
+
this.__light_data_needs_update = true;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
*
|
|
519
|
+
* @param {LightRenderMetadata} data
|
|
520
|
+
* @private
|
|
521
|
+
*/
|
|
522
|
+
__handle_visible_decal_added(data) {
|
|
523
|
+
this.__light_data_needs_update = true;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
*
|
|
527
|
+
* @type {Decal}
|
|
528
|
+
*/
|
|
529
|
+
const light = data.light;
|
|
530
|
+
|
|
531
|
+
light.onDimensionChanged(this.__handle_light_dimensions_change, this);
|
|
532
|
+
|
|
533
|
+
const ref = this.__decal_patch_references.acquire(light.texture_diffuse);
|
|
534
|
+
|
|
535
|
+
const patch = ref.getValue();
|
|
536
|
+
const patch_uv = patch.uv;
|
|
537
|
+
|
|
538
|
+
patch_uv.position.onChanged.add(light.handleUvPositionChange, light);
|
|
539
|
+
patch_uv.size.onChanged.add(light.handleUvSizeChange, light);
|
|
540
|
+
|
|
541
|
+
light.uv[0] = patch_uv.position.x;
|
|
542
|
+
light.uv[1] = patch_uv.position.y;
|
|
543
|
+
light.uv[2] = patch_uv.size.x;
|
|
544
|
+
light.uv[3] = patch_uv.size.y;
|
|
545
|
+
|
|
546
|
+
this.__decal_references.set(light, ref);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
*
|
|
551
|
+
* @param {LightRenderMetadata} data
|
|
552
|
+
* @private
|
|
553
|
+
*/
|
|
554
|
+
__handle_visible_decal_removed(data) {
|
|
555
|
+
this.__light_data_needs_update = true;
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
*
|
|
559
|
+
* @type {Decal}
|
|
560
|
+
*/
|
|
561
|
+
const light = data.light;
|
|
562
|
+
|
|
563
|
+
light.offDimensionChanged(this.__handle_light_dimensions_change, this);
|
|
564
|
+
|
|
565
|
+
const ref = this.__decal_references.get(light);
|
|
566
|
+
|
|
567
|
+
if (ref === undefined) {
|
|
568
|
+
// This can occur when decal changes while being in the visible list, messing with the IncrementalDeltaSet's compare order
|
|
569
|
+
console.warn(`Decal reference not found: ${light}`);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
const patch = ref.getValue();
|
|
574
|
+
const patch_uv = patch.uv;
|
|
575
|
+
|
|
576
|
+
// unsubscribe
|
|
577
|
+
patch_uv.position.onChanged.remove(light.handleUvPositionChange, light);
|
|
578
|
+
patch_uv.size.onChanged.remove(light.handleUvSizeChange, light);
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
ref.release();
|
|
582
|
+
|
|
583
|
+
this.__decal_references.delete(light);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
*
|
|
588
|
+
* @param {LightRenderMetadata} data
|
|
589
|
+
* @private
|
|
590
|
+
*/
|
|
591
|
+
__handle_visible_light_added(data) {
|
|
592
|
+
this.__light_data_needs_update = true;
|
|
593
|
+
|
|
594
|
+
const light = data.light;
|
|
595
|
+
|
|
596
|
+
light.onDimensionChanged(this.__handle_light_dimensions_change, this);
|
|
597
|
+
light.onAppearanceChanged(this.__handle_light_appearance_change, this);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
*
|
|
602
|
+
* @param {LightRenderMetadata} data
|
|
603
|
+
* @private
|
|
604
|
+
*/
|
|
605
|
+
__handle_visible_light_removed(data) {
|
|
606
|
+
this.__light_data_needs_update = true;
|
|
607
|
+
|
|
608
|
+
const light = data.light;
|
|
609
|
+
light.offDimensionChanged(this.__handle_light_dimensions_change, this);
|
|
610
|
+
light.offAppearanceChanged(this.__handle_light_appearance_change, this);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
*
|
|
615
|
+
* @param {LightRenderMetadata} light
|
|
616
|
+
* @returns {number}
|
|
617
|
+
* @protected
|
|
618
|
+
*/
|
|
619
|
+
__sort_visible_light_score(light) {
|
|
620
|
+
const center = scratch_corners;
|
|
621
|
+
|
|
622
|
+
light.light.getCenter(center)
|
|
623
|
+
|
|
624
|
+
const x = center[0];
|
|
625
|
+
const y = center[1];
|
|
626
|
+
const z = center[2];
|
|
627
|
+
|
|
628
|
+
return v3_morton_encode_transformed(x, y, z, this.__projection_matrix);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* DEBUG method
|
|
633
|
+
* @param {LightRenderMetadata} lights
|
|
634
|
+
* @param {number} count
|
|
635
|
+
* @returns {number} lower = better sorting score
|
|
636
|
+
* @private
|
|
637
|
+
*/
|
|
638
|
+
__assess_sorting_score(lights, count) {
|
|
639
|
+
|
|
640
|
+
let r = 0;
|
|
641
|
+
|
|
642
|
+
const center_a = [];
|
|
643
|
+
const center_b = [];
|
|
644
|
+
|
|
645
|
+
for (let i = 0; i < count; i++) {
|
|
646
|
+
const a = lights[i];
|
|
647
|
+
|
|
648
|
+
const score_a = this.__sort_visible_light_score(a);
|
|
649
|
+
a.light.getCenter(center_a);
|
|
650
|
+
|
|
651
|
+
for (let j = i + 1; j < count; j++) {
|
|
652
|
+
const b = lights[j];
|
|
653
|
+
|
|
654
|
+
const score_b = this.__sort_visible_light_score(b);
|
|
655
|
+
b.light.getCenter(center_b);
|
|
656
|
+
|
|
657
|
+
//
|
|
658
|
+
const score_distance = Math.abs(score_a - score_b);
|
|
659
|
+
const position_distance = v3_distance(
|
|
660
|
+
center_a[0], center_a[1], center_a[2],
|
|
661
|
+
center_b[0], center_b[1], center_b[2],
|
|
662
|
+
);
|
|
663
|
+
|
|
664
|
+
r += score_distance / position_distance;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
return r / (count * (count - 1) * 0.5);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Sort lights for better data locality
|
|
674
|
+
* @private
|
|
675
|
+
*/
|
|
676
|
+
__sort_visible_light() {
|
|
677
|
+
const sorted_lights = this.__sorted_visible_lights;
|
|
678
|
+
|
|
679
|
+
const visible_light_set = this.__visible_lights;
|
|
680
|
+
const visible_light_count = visible_light_set.size;
|
|
681
|
+
|
|
682
|
+
const visible_decal_set = this.__visible_decals;
|
|
683
|
+
const visible_decal_count = visible_decal_set.size;
|
|
684
|
+
|
|
685
|
+
const expected_sorted_size = visible_light_count + visible_decal_count;
|
|
686
|
+
|
|
687
|
+
if (sorted_lights.length > expected_sorted_size) {
|
|
688
|
+
// crop the reused array back down to the current frame's size, otherwise stale records from a
|
|
689
|
+
// larger earlier frame are re-encoded into the light-data texture every frame. Truncate via
|
|
690
|
+
// `length =` (in place, drops the tail references for GC) rather than splice, which would
|
|
691
|
+
// allocate a throwaway array of the removed elements.
|
|
692
|
+
sorted_lights.length = expected_sorted_size;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
array_copy(visible_light_set.elements, 0, sorted_lights, 0, visible_light_count);
|
|
696
|
+
array_copy(visible_decal_set.elements, 0, sorted_lights, visible_light_count, visible_decal_count);
|
|
697
|
+
|
|
698
|
+
array_sort_quick(sorted_lights, this.__sort_visible_light_score, this, 0, expected_sorted_size - 1);
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
__update_visible_bvh() {
|
|
702
|
+
this.__visible_bvh_needs_update = false;
|
|
703
|
+
|
|
704
|
+
build_light_data_bvh(
|
|
705
|
+
this.__visible_lights,
|
|
706
|
+
this.__visible_bvh_lights
|
|
707
|
+
);
|
|
708
|
+
|
|
709
|
+
build_light_data_bvh(
|
|
710
|
+
this.__visible_decals,
|
|
711
|
+
this.__visible_bvh_decals
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
*
|
|
718
|
+
* @param {Camera} camera
|
|
719
|
+
* @private
|
|
720
|
+
*/
|
|
721
|
+
__build_view_frustum(camera) {
|
|
722
|
+
frustum_from_camera(camera, this.__view_frustum, false);
|
|
723
|
+
|
|
724
|
+
array_swap_one(this.__view_frustum.planes, 4, 5);
|
|
725
|
+
|
|
726
|
+
this.__build_view_frustum_points();
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
__build_visible_light_list() {
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
*
|
|
733
|
+
* @type {IncrementalDeltaSet<LightRenderMetadata>}
|
|
734
|
+
*/
|
|
735
|
+
const visible_lights = this.__visible_lights;
|
|
736
|
+
|
|
737
|
+
visible_lights.initializeUpdate();
|
|
738
|
+
|
|
739
|
+
const visible_decals = this.__visible_decals;
|
|
740
|
+
|
|
741
|
+
visible_decals.initializeUpdate();
|
|
742
|
+
|
|
743
|
+
const nodes = [];
|
|
744
|
+
|
|
745
|
+
frustum3_planes_to_flat_from_three(this.__view_frustum.planes, scratch_frustum_planes)
|
|
746
|
+
|
|
747
|
+
/*
|
|
748
|
+
Search is done in 2 phases:
|
|
749
|
+
1) broad phase using bounding boxes
|
|
750
|
+
2) granular phase where we use object-specific shape to check against frustum
|
|
751
|
+
*/
|
|
752
|
+
|
|
753
|
+
const broad_match_count = bvh_query_user_data_intersects_frustum(nodes, 0, this.#light_data_bvh, scratch_frustum_planes);
|
|
754
|
+
|
|
755
|
+
for (let i = 0; i < broad_match_count; i++) {
|
|
756
|
+
|
|
757
|
+
const light_id = nodes[i];
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
*
|
|
761
|
+
* @type {LightRenderMetadata}
|
|
762
|
+
*/
|
|
763
|
+
const light_data = this.#metadata_map.get(light_id);
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
*
|
|
767
|
+
* @type {PointLight|Decal}
|
|
768
|
+
*/
|
|
769
|
+
const light = light_data.light;
|
|
770
|
+
|
|
771
|
+
if (light.isDecal === true) {
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
// decals go into a separate bucket
|
|
775
|
+
visible_decals.push(light_data);
|
|
776
|
+
|
|
777
|
+
} else if (light.isPointLight === true) {
|
|
778
|
+
// perform granular check
|
|
779
|
+
|
|
780
|
+
const light_position = light.position;
|
|
781
|
+
|
|
782
|
+
const light_x = light_position.x;
|
|
783
|
+
const light_y = light_position.y;
|
|
784
|
+
const light_z = light_position.z;
|
|
785
|
+
|
|
786
|
+
const radius = light.radius.getValue();
|
|
787
|
+
|
|
788
|
+
if (!point_light_inside_volume(light_x, light_y, light_z, radius, scratch_frustum_planes)) {
|
|
789
|
+
// outside of view frustum
|
|
790
|
+
continue;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
// register as visible
|
|
795
|
+
visible_lights.push(light_data);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
visible_lights.finalizeUpdate();
|
|
801
|
+
|
|
802
|
+
visible_decals.finalizeUpdate();
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
__write_light_data_texture() {
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
*
|
|
809
|
+
* @type {LightRenderMetadata[]}
|
|
810
|
+
*/
|
|
811
|
+
const visible_lights = this.__sorted_visible_lights;
|
|
812
|
+
|
|
813
|
+
// write light data into texture
|
|
814
|
+
const visible_light_count = visible_lights.length;
|
|
815
|
+
|
|
816
|
+
// compute amount of space required for the lights
|
|
817
|
+
let address = 0;
|
|
818
|
+
for (let i = 0; i < visible_light_count; i++) {
|
|
819
|
+
const datum = visible_lights[i];
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
*
|
|
823
|
+
* @type {PointLight}
|
|
824
|
+
*/
|
|
825
|
+
const light = datum.light;
|
|
826
|
+
|
|
827
|
+
address += light.ENCODED_SLOT_COUNT;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
const expected_light_data_size = address;
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
const light_data = this.__light_data;
|
|
834
|
+
light_data.resize(Math.ceil(address / 4));
|
|
835
|
+
|
|
836
|
+
light_data.update();
|
|
837
|
+
|
|
838
|
+
// update required lookup precision
|
|
839
|
+
this.__lookup_data.precision = Math.max(
|
|
840
|
+
0,
|
|
841
|
+
Math.ceil(Math.log2(light_data.size))
|
|
842
|
+
) + LIGHT_ENCODING_TYPE_BIT_COUNT;
|
|
843
|
+
|
|
844
|
+
const tx_light = light_data.getTexture();
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
*
|
|
848
|
+
* @type {Float32Array}
|
|
849
|
+
*/
|
|
850
|
+
const tx_light_data = tx_light.image.data;
|
|
851
|
+
|
|
852
|
+
address = 0;
|
|
853
|
+
|
|
854
|
+
for (let i = 0; i < visible_light_count; i++) {
|
|
855
|
+
const datum = visible_lights[i];
|
|
856
|
+
|
|
857
|
+
assert.lessThan(address, tx_light_data.length, "overflow");
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
*
|
|
861
|
+
* @type {PointLight}
|
|
862
|
+
*/
|
|
863
|
+
const light = datum.light;
|
|
864
|
+
|
|
865
|
+
datum.address = address >> 2;
|
|
866
|
+
|
|
867
|
+
const written_slots = light.toArray(tx_light_data, address);
|
|
868
|
+
|
|
869
|
+
address += written_slots;
|
|
870
|
+
|
|
871
|
+
// align address to 4 slot boundary
|
|
872
|
+
if ((address & 3) !== 0) {
|
|
873
|
+
// not on 4 slot boundary
|
|
874
|
+
address = ((address >> 2) + 1) << 2;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
if (address !== expected_light_data_size) {
|
|
879
|
+
throw new Error(`Expected light data size is ${expected_light_data_size}, actual written data is size is ${address}`);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
tx_light.needsUpdate = true;
|
|
883
|
+
|
|
884
|
+
this.__visible_bvh_needs_update = true;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Perform cluster assignment where each cluster is filled with overlapping lights
|
|
889
|
+
* @private
|
|
890
|
+
*/
|
|
891
|
+
__assign_lights_to_clusters() {
|
|
892
|
+
|
|
893
|
+
const tiles_resolution = this.__tiles_resolution;
|
|
894
|
+
|
|
895
|
+
const tr_z = tiles_resolution.z;
|
|
896
|
+
const tr_y = tiles_resolution.y;
|
|
897
|
+
const tr_x = tiles_resolution.x;
|
|
898
|
+
|
|
899
|
+
const tr_x_1 = tr_x + 1;
|
|
900
|
+
const tr_y_1 = tr_y + 1;
|
|
901
|
+
|
|
902
|
+
const tr_xy_1 = tr_x_1 * tr_y_1;
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
*
|
|
906
|
+
* @type {Float32Array}
|
|
907
|
+
*/
|
|
908
|
+
const cluster_planes = this.__cluster_planes;
|
|
909
|
+
|
|
910
|
+
const bvh_lights = this.__visible_bvh_lights;
|
|
911
|
+
const bvh_decals = this.__visible_bvh_decals;
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
const cluster_planes_x_offset = 0;
|
|
915
|
+
const cluster_planes_y_offset = tr_x_1 * 4;
|
|
916
|
+
const cluster_planes_z_offset = cluster_planes_y_offset + tr_y_1 * 4;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
*
|
|
920
|
+
* @type {number[]|Float32Array}
|
|
921
|
+
*/
|
|
922
|
+
const light_source_data = this.__light_data.getTexture().image.data;
|
|
923
|
+
|
|
924
|
+
const tile_slice_size = tr_x * tr_y;
|
|
925
|
+
|
|
926
|
+
const light_cluster_texture = this.__cluster_texture;
|
|
927
|
+
const tile_texture_data = light_cluster_texture.image.data;
|
|
928
|
+
|
|
929
|
+
const light_lookup = this.__lookup_data;
|
|
930
|
+
light_lookup.update();
|
|
931
|
+
const light_lookup_texture = light_lookup.getTexture();
|
|
932
|
+
const light_lookup_texture_data = light_lookup_texture.image.data;
|
|
933
|
+
|
|
934
|
+
let lookup_address_offset = 0;
|
|
935
|
+
let i_x_0, i_y_0, i_z_0;
|
|
936
|
+
|
|
937
|
+
// clear cache
|
|
938
|
+
LOOKUP_CACHE.fill(0xFFFFFFFF);
|
|
939
|
+
|
|
940
|
+
// console.log('Assignment Start');
|
|
941
|
+
|
|
942
|
+
for (i_z_0 = 0; i_z_0 < tr_z; i_z_0++) {
|
|
943
|
+
|
|
944
|
+
// construct z planes
|
|
945
|
+
|
|
946
|
+
const slice_offset = i_z_0 * tile_slice_size;
|
|
947
|
+
|
|
948
|
+
const z_plane_index_offset_0 = cluster_planes_z_offset + i_z_0 * 4;
|
|
949
|
+
|
|
950
|
+
read_plane_pair(cluster_planes, z_plane_index_offset_0, scratch_frustum_planes, 16);
|
|
951
|
+
|
|
952
|
+
for (i_y_0 = 0; i_y_0 < tr_y; i_y_0++) {
|
|
953
|
+
|
|
954
|
+
// construct y planes
|
|
955
|
+
|
|
956
|
+
const y_plane_index_offset_0 = cluster_planes_y_offset + i_y_0 * 4;
|
|
957
|
+
|
|
958
|
+
read_plane_pair(cluster_planes, y_plane_index_offset_0, scratch_frustum_planes, 8);
|
|
959
|
+
|
|
960
|
+
for (i_x_0 = 0; i_x_0 < tr_x; i_x_0++) {
|
|
961
|
+
|
|
962
|
+
// construct x planes
|
|
963
|
+
|
|
964
|
+
const x_plane_index_offset_0 = cluster_planes_x_offset + i_x_0 * 4;
|
|
965
|
+
|
|
966
|
+
read_plane_pair(cluster_planes, x_plane_index_offset_0, scratch_frustum_planes, 0);
|
|
967
|
+
|
|
968
|
+
const tile_index = slice_offset + (i_y_0 * tr_x) + i_x_0;
|
|
969
|
+
|
|
970
|
+
const tile_data_offset = tile_index * 4;
|
|
971
|
+
|
|
972
|
+
//assign lights
|
|
973
|
+
lookup_address_offset += assign_cluster(
|
|
974
|
+
tile_data_offset,
|
|
975
|
+
bvh_lights,
|
|
976
|
+
lookup_address_offset,
|
|
977
|
+
light_lookup_texture_data,
|
|
978
|
+
tile_texture_data,
|
|
979
|
+
light_source_data
|
|
980
|
+
);
|
|
981
|
+
|
|
982
|
+
// assign decals
|
|
983
|
+
const decal_count = assign_cluster(
|
|
984
|
+
tile_data_offset + 2,
|
|
985
|
+
bvh_decals,
|
|
986
|
+
lookup_address_offset,
|
|
987
|
+
light_lookup_texture_data,
|
|
988
|
+
tile_texture_data,
|
|
989
|
+
light_source_data
|
|
990
|
+
);
|
|
991
|
+
|
|
992
|
+
/*
|
|
993
|
+
TODO fix decal sorting artifacts
|
|
994
|
+
|
|
995
|
+
if (decal_count > 1) { // only sort when there are 2 or more, sorting 1 object is pointless
|
|
996
|
+
// decals need to be sorted for correct blending result
|
|
997
|
+
sort_decal_data(
|
|
998
|
+
light_lookup_texture_data,
|
|
999
|
+
light_source_data,
|
|
1000
|
+
lookup_address_offset,
|
|
1001
|
+
decal_count
|
|
1002
|
+
);
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
*/
|
|
1006
|
+
|
|
1007
|
+
lookup_address_offset += decal_count;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
light_cluster_texture.needsUpdate = true;
|
|
1013
|
+
light_lookup_texture.needsUpdate = true;
|
|
1014
|
+
|
|
1015
|
+
// Post-fact lookup texture resize, this frame will be wrong, but next one should be ok
|
|
1016
|
+
const current_lookup_size = this.__lookup_data.size;
|
|
1017
|
+
|
|
1018
|
+
const lookup_memory_resized = this.__ensure_lookup_size(lookup_address_offset);
|
|
1019
|
+
|
|
1020
|
+
const cluster_resized = this.__set_cluster_addressable_bit_range(Math.max(0, Math.log2(lookup_address_offset)));
|
|
1021
|
+
|
|
1022
|
+
if (
|
|
1023
|
+
(lookup_memory_resized && current_lookup_size < lookup_address_offset)
|
|
1024
|
+
|| cluster_resized
|
|
1025
|
+
) {
|
|
1026
|
+
// overflow, we ended up trying to write more lights into some clusters than what they could contain
|
|
1027
|
+
this.__update_cluster_texture();
|
|
1028
|
+
|
|
1029
|
+
// re-do assignment
|
|
1030
|
+
this.__assign_lights_to_clusters();
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// console.log('Unique assignment count: ', assignment_count, ', Hash reuse:', hash_reuse_count);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
*
|
|
1038
|
+
* @private
|
|
1039
|
+
*/
|
|
1040
|
+
__build_cluster_frustum_planes() {
|
|
1041
|
+
const tiles_resolution = this.__tiles_resolution;
|
|
1042
|
+
|
|
1043
|
+
const tr_z = tiles_resolution.z;
|
|
1044
|
+
const tr_y = tiles_resolution.y;
|
|
1045
|
+
const tr_x = tiles_resolution.x;
|
|
1046
|
+
|
|
1047
|
+
const destination = this.__cluster_planes;
|
|
1048
|
+
|
|
1049
|
+
compute_cluster_planes_from_points(destination, this.__cluster_frustum_points, tr_x, tr_y, tr_z);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
*
|
|
1054
|
+
* @private
|
|
1055
|
+
*/
|
|
1056
|
+
__build_view_frustum_points() {
|
|
1057
|
+
|
|
1058
|
+
const view_frustum = this.__view_frustum;
|
|
1059
|
+
|
|
1060
|
+
const points = this.__view_frustum_points;
|
|
1061
|
+
|
|
1062
|
+
computeFrustumCorners(points, view_frustum.planes);
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
*
|
|
1067
|
+
* @private
|
|
1068
|
+
*/
|
|
1069
|
+
__build_cluster_frustum_points() {
|
|
1070
|
+
const tiles_resolution = this.__tiles_resolution;
|
|
1071
|
+
|
|
1072
|
+
const tr_z = tiles_resolution.z;
|
|
1073
|
+
const tr_y = tiles_resolution.y;
|
|
1074
|
+
const tr_x = tiles_resolution.x;
|
|
1075
|
+
|
|
1076
|
+
const view_frustum_points = this.__view_frustum_points;
|
|
1077
|
+
const points_data = this.__cluster_frustum_points;
|
|
1078
|
+
|
|
1079
|
+
frustum3_slice_linear_to_points(view_frustum_points, tr_x, tr_y, tr_z, points_data);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Build light tile texture
|
|
1084
|
+
* @param {Camera|THREE.PerspectiveCamera} camera
|
|
1085
|
+
*/
|
|
1086
|
+
buildTiles(camera) {
|
|
1087
|
+
// camera.updateProjectionMatrix();
|
|
1088
|
+
// camera.updateMatrix();
|
|
1089
|
+
// camera.updateMatrixWorld(true);
|
|
1090
|
+
|
|
1091
|
+
//update world inverse matrix
|
|
1092
|
+
camera.matrixWorldInverse.copy(camera.matrixWorld);
|
|
1093
|
+
camera.matrixWorldInverse.invert();
|
|
1094
|
+
|
|
1095
|
+
// this.__projection_matrix.set(camera.matrixWorldInverse.elements);
|
|
1096
|
+
m4_multiply(this.__projection_matrix, camera.projectionMatrix.elements, camera.matrixWorldInverse.elements);
|
|
1097
|
+
|
|
1098
|
+
// console.time('__build_view_frustum');
|
|
1099
|
+
this.__build_view_frustum(camera);
|
|
1100
|
+
// console.timeEnd('__build_view_frustum');
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
// console.time('__build_visible_light_list');
|
|
1104
|
+
this.__build_visible_light_list();
|
|
1105
|
+
// console.timeEnd('__build_visible_light_list');
|
|
1106
|
+
|
|
1107
|
+
// update decal atlas
|
|
1108
|
+
this.__decal_atlas.update();
|
|
1109
|
+
this.__update_decal_atlas_texture();
|
|
1110
|
+
|
|
1111
|
+
// console.time('__write_light_data_texture');
|
|
1112
|
+
if (this.__light_data_needs_update) {
|
|
1113
|
+
// sort light for better search and query locality
|
|
1114
|
+
this.__sort_visible_light();
|
|
1115
|
+
|
|
1116
|
+
this.__write_light_data_texture();
|
|
1117
|
+
|
|
1118
|
+
// clear flag
|
|
1119
|
+
this.__light_data_needs_update = false;
|
|
1120
|
+
}
|
|
1121
|
+
// console.timeEnd('__write_light_data_texture');
|
|
1122
|
+
|
|
1123
|
+
if (this.__visible_bvh_needs_update) {
|
|
1124
|
+
this.__update_visible_bvh();
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
this.__build_cluster_frustum_points();
|
|
1128
|
+
// console.time('__build_cluster_frustum_planes');
|
|
1129
|
+
this.__build_cluster_frustum_planes();
|
|
1130
|
+
// console.timeEnd('__build_cluster_frustum_planes');
|
|
1131
|
+
|
|
1132
|
+
// console.time('__assign_lights_to_clusters');
|
|
1133
|
+
this.__assign_lights_to_clusters();
|
|
1134
|
+
// console.timeEnd('__assign_lights_to_clusters');
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
dispose() {
|
|
1138
|
+
this.__cluster_texture.dispose();
|
|
1139
|
+
this.__light_data.dispose();
|
|
1140
|
+
this.__lookup_data.dispose();
|
|
1141
|
+
this.__decal_atlas_texture.dispose();
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Set resolution of the cluster texture, higher resolution will result in less load on the GPU, but will take up more RAM to represent and more time to build the clusters each frame
|
|
1146
|
+
* @param {number} x
|
|
1147
|
+
* @param {number} y
|
|
1148
|
+
* @param {number} z
|
|
1149
|
+
*/
|
|
1150
|
+
setTileMapResolution(x, y, z) {
|
|
1151
|
+
assert.isNumber(x, 'x');
|
|
1152
|
+
assert.isNonNegativeInteger(x, 'x');
|
|
1153
|
+
assert.isFinite(x, 'x');
|
|
1154
|
+
assert.greaterThan(x, 0, 'x must be > 0');
|
|
1155
|
+
|
|
1156
|
+
assert.isNumber(y, 'y');
|
|
1157
|
+
assert.isNonNegativeInteger(y, 'y');
|
|
1158
|
+
assert.isFinite(y, 'y');
|
|
1159
|
+
assert.greaterThan(y, 0, 'y must be > 0');
|
|
1160
|
+
|
|
1161
|
+
assert.isNumber(z, 'z');
|
|
1162
|
+
assert.isNonNegativeInteger(z, 'z');
|
|
1163
|
+
assert.isFinite(z, 'z');
|
|
1164
|
+
assert.greaterThan(z, 0, 'z must be > 0');
|
|
1165
|
+
|
|
1166
|
+
const r = this.__tiles_resolution;
|
|
1167
|
+
|
|
1168
|
+
if (x === r.x && y === r.y && z === r.z) {
|
|
1169
|
+
// special case, no change
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
r.set(x, y, z);
|
|
1174
|
+
|
|
1175
|
+
this.__cluster_texture_needs_rebuild = true;
|
|
1176
|
+
this.__update_cluster_texture();
|
|
1177
|
+
|
|
1178
|
+
const cluster_planes_size = ((x + 1) + (y + 1) + (z + 1)) * 4;
|
|
1179
|
+
const cluster_frustum_points_size = (x + 1) * (y + 1) * (z + 1) * 3;
|
|
1180
|
+
|
|
1181
|
+
const buffer = new ArrayBuffer((cluster_planes_size + cluster_frustum_points_size) * 4);
|
|
1182
|
+
|
|
1183
|
+
this.__cluster_planes = new Float32Array(
|
|
1184
|
+
buffer, 0,
|
|
1185
|
+
cluster_planes_size
|
|
1186
|
+
);
|
|
1187
|
+
this.__cluster_frustum_points = new Float32Array(
|
|
1188
|
+
buffer, cluster_planes_size * 4,
|
|
1189
|
+
cluster_frustum_points_size
|
|
1190
|
+
);
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
*
|
|
1195
|
+
* @param {AbstractLight} light
|
|
1196
|
+
* @returns {boolean}
|
|
1197
|
+
*/
|
|
1198
|
+
hasLight(light) {
|
|
1199
|
+
return this.#metadata_map.has(light.id);
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
*
|
|
1204
|
+
* @param {AbstractLight} light
|
|
1205
|
+
*/
|
|
1206
|
+
addLight(light) {
|
|
1207
|
+
const lightData = new LightRenderMetadata(light);
|
|
1208
|
+
|
|
1209
|
+
lightData.link(this.#light_data_bvh);
|
|
1210
|
+
|
|
1211
|
+
this.#metadata_map.set(light.id, lightData);
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
/**
|
|
1215
|
+
*
|
|
1216
|
+
* @param {AbstractLight} light
|
|
1217
|
+
* @returns {boolean}
|
|
1218
|
+
*/
|
|
1219
|
+
removeLight(light) {
|
|
1220
|
+
|
|
1221
|
+
const light_id = light.id;
|
|
1222
|
+
|
|
1223
|
+
const data = this.#metadata_map.get(light_id);
|
|
1224
|
+
|
|
1225
|
+
if (data === undefined) {
|
|
1226
|
+
return false;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
data.unlink();
|
|
1230
|
+
|
|
1231
|
+
this.#metadata_map.delete(light_id);
|
|
1232
|
+
|
|
1233
|
+
return true;
|
|
1234
|
+
}
|
|
1235
|
+
}
|