@woosh/meep-engine 2.33.21 → 2.33.25
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/core/assert.js +3 -1
- package/core/bvh2/BinaryNode.js +1 -1
- package/core/bvh2/aabb3/AABB3.js +18 -0
- package/core/bvh2/aabb3/AABB3Math.js +1 -1
- package/core/bvh2/binary/2/BinaryUint32BVH.js +498 -0
- package/core/bvh2/binary/2/BinaryUint32BVH.spec.js +54 -0
- package/core/bvh2/binary/IndexedBinaryBVH.js +22 -26
- package/core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js +5 -1
- package/core/bvh2/traversal/__detailed_box_volume_intersection.js +31 -11
- package/core/collection/ArrayUtils.js +1 -1
- package/core/collection/array/arrayQuickSort.js +9 -6
- package/core/collection/array/array_swap.js +22 -0
- package/core/collection/array/binarySearchHighIndex.js +1 -1
- package/core/collection/array/computeHashArray.js +22 -0
- package/core/collection/array/computeHashIntegerArray.js +15 -0
- package/core/collection/array/copyArray.js +2 -2
- package/core/collection/table/DataType2TypedArrayConstructorMapping.js +15 -0
- package/core/color/Color.js +2 -1
- package/core/function/FunctionCompiler.js +2 -1
- package/core/geom/3d/aabb/aabb3_computeDistanceAbovePlane.js +9 -33
- package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +10 -2
- package/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js +41 -0
- package/core/geom/3d/morton/mortonEncode_magicbits.js +2 -1
- package/core/geom/3d/morton/reinterpret_float32_as_int32.js +13 -0
- package/core/geom/3d/morton/v3_morton_encode_transformed.js +33 -0
- package/core/geom/3d/normal/hemioct/unit_hemioct.spec.js +1 -1
- package/core/geom/3d/plane/plane_computeConvex3PlaneIntersection.js +13 -14
- package/core/geom/3d/ray/ray_computeNearestPointToPoint.js +37 -0
- package/core/geom/3d/shape/AbstractShape3D.js +38 -0
- package/core/geom/3d/shape/CompositeShape.js +240 -0
- package/core/geom/3d/shape/TransformedShape3D.js +126 -0
- package/core/geom/3d/shape/UnitCubeShape3D.js +24 -0
- package/core/geom/3d/shape/UnitSphereShape3D.js +24 -0
- package/core/geom/3d/shape/util/shape_to_visual_entity.js +159 -0
- package/core/geom/3d/voxel/DenseBitVolume3D.js +87 -0
- package/core/geom/3d/voxel/buildVolumeFromProjectedGeometry.js +23 -0
- package/core/geom/AABB2.js +1 -1
- package/core/geom/ConicRay.js +3 -1
- package/core/geom/LineSegment.js +0 -78
- package/core/geom/Matrix4.js +7 -8
- package/core/geom/Plane.js +14 -9
- package/core/geom/Rectangle.js +2 -1
- package/core/geom/Vector1.js +1 -1
- package/core/geom/Vector3.js +2 -1
- package/core/geom/Vector4.js +2 -1
- package/core/geom/random/randomPointInBox.js +7 -3
- package/core/geom/random/randomPointInPoint.js +6 -3
- package/core/geom/random/randomPointInSphere.js +9 -5
- package/core/geom/random/randomPointOnBox.js +7 -3
- package/core/geom/random/randomPointOnSphere.js +6 -3
- package/core/geom/v3_length.js +8 -3
- package/core/graph/graph_k_means_cluster.js +1 -1
- package/core/json/resolvePathByArray.js +2 -2
- package/core/math/MathUtils.js +0 -354
- package/core/math/MathUtils.spec.js +7 -1
- package/core/math/gaussian.js +9 -0
- package/core/math/hash/computeHashFloat.js +17 -0
- package/core/math/hash/computeHashFloatArray.js +34 -0
- package/core/math/hash/computeObjectHash.js +54 -0
- package/core/math/intersects1D.js +19 -0
- package/core/math/interval/NumericInterval.js +2 -2
- package/core/math/isValueBetween.js +10 -0
- package/core/math/isValueBetweenInclusive.js +10 -0
- package/core/math/noise/curl_noise_3dt.js +1 -1
- package/core/math/noise/sdnoise.js +10 -10
- package/core/math/overlap1D.js +19 -0
- package/core/math/pingpong.js +17 -0
- package/core/math/random/makeRangedRandom.js +19 -0
- package/core/math/random/randomFloatBetween.js +14 -0
- package/core/math/random/randomFromArray.js +19 -0
- package/core/math/random/randomGaussian.js +15 -0
- package/core/math/random/randomIntegerBetween.js +14 -0
- package/core/math/random/roundFair.js +15 -0
- package/core/math/separation1D.js +21 -0
- package/core/math/solveQuadratic.js +25 -0
- package/core/model/BoundedValue.js +1 -1
- package/core/model/node-graph/node/NodeInstancePortReference.js +1 -1
- package/core/model/node-graph/node/Port.js +1 -1
- package/core/model/reactive/evaluation/MultiPredicateEvaluator.spec.js +3 -1
- package/core/model/reactive/model/ReactiveBinaryExpression.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveReference.js +1 -1
- package/core/model/reactive/model/util/createRandomReactiveExpression.js +1 -1
- package/core/model/stat/LinearModifier.js +1 -1
- package/core/primitives/array/computeIntegerArrayHash.js +1 -1
- package/{engine/graphics/render/forward_plus/materials → core/primitives/strings}/insert_after.js +3 -0
- package/core/primitives/strings/insert_after_or_replace.js +27 -0
- package/editor/process/symbolic/makeHelperBoxGeometry.js +44 -0
- package/editor/view/ecs/EntityEditor.js +2 -2
- package/editor/view/ecs/components/particles/ParticleEmitterController.js +2 -2
- package/engine/EngineHarness.js +1 -0
- package/engine/animation/AnimationUtils.js +5 -5
- package/engine/animation/curve/AnimationCurve.js +72 -0
- package/engine/animation/curve/Keyframe.js +27 -0
- package/engine/animation/keyed2/AnimationTrack.js +27 -3
- package/engine/asset/Asset.js +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.d.ts +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.js +10 -0
- package/engine/asset/loaders/image/ImageRGBADataAsset.js +8 -1
- package/engine/asset/loaders/material/computeImageBitmapEquality.js +11 -0
- package/engine/asset/loaders/material/computeImageBitmapHash.js +22 -28
- package/engine/asset/loaders/material/computeMaterialHash.js +3 -1
- package/engine/asset/loaders/material/computeTextureHash.js +2 -1
- package/engine/ecs/EntityBuilder.js +25 -5
- package/engine/ecs/animation/Animation.js +2 -1
- package/engine/ecs/animation/InverseKinematics.js +2 -1
- package/engine/ecs/attachment/AttachmentBinding.js +8 -0
- package/engine/ecs/attachment/AttachmentSystem.js +4 -0
- package/engine/ecs/attachment/TransformAttachmentBinding.js +14 -44
- package/engine/ecs/components/Tag.js +27 -6
- package/engine/ecs/dynamic_actions/DynamicActorSystem.js +2 -1
- package/engine/ecs/dynamic_actions/DynamicRuleDescriptionTable.spec.js +3 -5
- package/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +1 -1
- package/engine/ecs/evaluation/complex/PointFitnessGaussianBlur.js +1 -1
- package/engine/ecs/foliage/ecs/Foliage2.js +1 -1
- package/engine/ecs/fow/FogOfWar.js +4 -0
- package/engine/ecs/fow/FogOfWarSystem.js +2 -0
- package/engine/ecs/fow/shader/FogOfWarRenderer.js +1 -1
- package/engine/ecs/gui/GUIElement.js +1 -1
- package/engine/ecs/gui/hud/HeadsUpDisplay.js +1 -1
- package/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +2 -0
- package/engine/ecs/gui/position/ViewportPosition.js +2 -1
- package/engine/ecs/system/AbstractContextSystem.js +1 -1
- package/engine/ecs/systems/RangedAttackSystem.js +1 -1
- package/engine/ecs/systems/SteeringSystem.js +1 -1
- package/engine/ecs/systems/TagSystem.js +17 -0
- package/engine/ecs/terrain/tiles/TerrainTileManager.js +1 -1
- package/engine/ecs/tooltip/TooltipComponent.js +15 -0
- package/engine/ecs/transform/Transform.js +19 -6
- package/engine/ecs/util/hideEntityGracefully.js +18 -0
- package/engine/graphics/GraphicsEngine.js +11 -23
- package/engine/graphics/camera/testClippingPlaneComputation.js +2 -2
- package/engine/graphics/composit/CompositLayer.js +17 -4
- package/engine/graphics/composit/CompositingStages.js +8 -0
- package/engine/graphics/composit/LayerCompositer.js +35 -6
- package/engine/graphics/ecs/animation/animator/AnimationClip.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +1 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +2 -1
- package/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
- package/engine/graphics/ecs/highlight/HighlightDefinition.js +2 -1
- package/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +11 -7
- package/engine/graphics/ecs/light/Light.d.ts +1 -1
- package/engine/graphics/ecs/light/Light.js +5 -0
- package/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +5 -1
- package/engine/graphics/ecs/mesh/Mesh.js +2 -1
- package/engine/graphics/ecs/mesh-v2/DrawMode.js +5 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +13 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +32 -18
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +6 -0
- package/engine/graphics/ecs/path/testPathDisplaySystem.js +98 -98
- package/engine/graphics/ecs/trail2d/Trail2D.js +17 -4
- package/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +2 -3
- package/engine/graphics/ecs/trail2d/Trail2DSystem.js +34 -118
- package/engine/graphics/geometry/AttributeSpec.js +105 -0
- package/engine/graphics/{micron/format/MicronVertexDataSpec.js → geometry/VertexDataSpec.js} +56 -25
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +7 -7
- package/engine/graphics/micron/build/fill_patch_geometry_data.js +1 -1
- package/engine/graphics/micron/buildPatchwork.js +1 -1
- package/engine/graphics/micron/format/MicronGeometry.js +3 -3
- package/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +2 -2
- package/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
- package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +5 -5
- package/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
- package/engine/graphics/particles/ParticleEmitterLibrary.js +3 -0
- package/engine/graphics/particles/ecs/{ParticleEmitterSystem2.js → ParticleEmitterSystem.js} +17 -9
- package/engine/graphics/particles/particular/engine/ParticularEngine.js +12 -4
- package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +84 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +106 -169
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js +5 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +14 -3
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +141 -14
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +8 -7
- package/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +37 -0
- package/engine/graphics/particles/particular/engine/emitter/distance_to_camera.js +25 -0
- package/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +8 -2
- package/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +2 -1
- package/engine/graphics/particles/particular/engine/parameter/ParameterTrack.js +1 -1
- package/engine/graphics/particles/particular/engine/parameter/ParticleParameter.js +1 -1
- package/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +24 -0
- package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +262 -71
- package/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +9 -9
- package/engine/graphics/particles/particular/engine/shader/ShaderManager.js +80 -46
- package/engine/graphics/particles/particular/engine/shader/debugAtlas.js +14 -0
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.js +2 -6
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.js +2 -7
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/update_parameters.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +141 -0
- package/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +478 -0
- package/engine/graphics/particles/particular/engine/utils/volume/lut_to_sampler.js +27 -0
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +935 -0
- package/engine/graphics/particles/particular/group/Operation.js +18 -0
- package/engine/graphics/particles/particular/group/OperationType.js +9 -0
- package/engine/graphics/particles/particular/group/ParticleAttribute.js +2 -1
- package/engine/graphics/particles/particular/group/ParticleAttributeType.js +11 -0
- package/engine/graphics/particles/particular/group/ParticleDataType.js +10 -0
- package/engine/graphics/particles/particular/group/ParticleGroup.js +7 -245
- package/engine/graphics/particles/particular/group/ParticleGroup.spec.js +3 -1
- package/engine/graphics/particles/particular/group/ParticleSpecification.js +21 -14
- package/engine/graphics/particles/particular/group/itemSizeFromAttributeType.js +20 -0
- package/engine/graphics/particles/particular/group/optimizeCommandQueue.js +162 -0
- package/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.js +19 -0
- package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
- package/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +13 -7
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +2 -1
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterSet.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.js +126 -95
- package/engine/graphics/render/forward_plus/PointLight.js +9 -0
- package/engine/graphics/render/forward_plus/PointLightData.js +1 -1
- package/engine/graphics/render/forward_plus/SpotLight.js +9 -0
- package/engine/graphics/render/forward_plus/cluster/compute_light_data_hash_0.js +2 -2
- package/engine/graphics/render/forward_plus/computeFrustumCorners.js +14 -32
- package/engine/graphics/render/forward_plus/materials/FP_INJECTION_POINT_ACCUMULATION.js +1 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +32 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_DECODE_PARS.js +51 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_PREAMBLE.js +25 -0
- package/engine/graphics/render/forward_plus/materials/fp_build_fragment_shader.js +31 -120
- package/engine/graphics/render/forward_plus/materials/fp_build_vertex_lighting_shared.js +35 -0
- package/engine/graphics/render/forward_plus/materials/fp_build_vertex_shader.js +4 -5
- package/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
- package/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +10 -3
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +595 -60
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +256 -136
- package/engine/graphics/render/forward_plus/query/analytical_triplanar_corner_mapping.js +8 -0
- package/engine/graphics/render/forward_plus/query/cube_mapping.js +38 -0
- package/engine/graphics/render/forward_plus/query/detailed_sphere_frustum_intersection_test.js +86 -0
- package/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +73 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_objects.js +131 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +129 -0
- package/engine/graphics/render/forward_plus/query/spot_light_inside_volume.js +33 -0
- package/engine/graphics/render/forward_plus/read_frustum_corner.js +14 -0
- package/engine/graphics/render/forward_plus/testClusterEquality.js +22 -0
- package/engine/graphics/render/layers/RenderLayerUtils.js +7 -4
- package/engine/graphics/render/visibility/IncrementalDeltaSet.js +11 -0
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +2 -2
- package/engine/graphics/shaders/TerrainShader.js +4 -5
- package/engine/graphics/texture/atlas/AtlasPatch.js +7 -2
- package/engine/graphics/texture/atlas/TextureAtlas.js +2 -2
- package/engine/graphics/texture/sampler/HarmonicDiffusionGrid.spec.js +1 -1
- package/engine/graphics/texture/sampler/SampleTraverser.js +1 -1
- package/engine/graphics/texture/sampler/Sampler2D.js +8 -7
- package/engine/graphics/texture/sampler/distanceField.spec.js +1 -1
- package/engine/graphics/texture/sampler/scaleSampler2D.js +7 -10
- package/engine/graphics/trail/x/RibbonMaterialX.js +3 -3
- package/engine/graphics/trail/x/RibbonX.js +17 -2
- package/engine/graphics/trail/x/RibbonXPlugin.js +51 -1
- package/engine/graphics/util/composeMatrix4.js +33 -23
- package/engine/graphics/util/decompose_matrix_4_array.js +61 -0
- package/engine/grid/components/GridObstacle.js +3 -10
- package/engine/intelligence/behavior/ecs/BehaviorComponent.js +30 -14
- package/engine/intelligence/behavior/selector/WeightedElement.js +2 -1
- package/engine/intelligence/optimization/RandomOptimizer.js +1 -1
- package/engine/knowledge/database/StaticKnowledgeDataTable.js +6 -1
- package/engine/navigation/ecs/components/Path.js +1 -6
- package/engine/navigation/grid/FastBinaryHeap.spec.js +1 -1
- package/engine/reference/v2/Reference.js +6 -0
- package/engine/sound/ecs/emitter/SoundEmitter.js +2 -1
- package/engine/sound/ecs/emitter/SoundTrack.js +2 -1
- package/engine/sound/material/concrete/RandomSoundMaterial.js +1 -1
- package/engine/ui/notification/notificationGenerator.js +1 -1
- package/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +1 -1
- package/generation/grid/generation/GridTaskExecuteRuleTimes.js +2 -1
- package/generation/markers/actions/MarkerNodeActionSelectRandom.js +1 -1
- package/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +1 -1
- package/generation/placement/action/random/CellActionSelectRandom.js +1 -1
- package/generation/theme/ThemeEngine.js +2 -2
- package/misc/makeMaterialIconCached.js +2 -2
- package/package.json +3 -3
- package/view/View.js +4 -2
- package/view/elements/image/HTMLElementCacheKey.js +2 -1
- package/view/elements/radial/RadialText.js +2 -1
- package/view/minimap/gl/MinimapMarkersGL.js +6 -100
- package/view/minimap/gl/buildMaterial.js +94 -0
- package/engine/graphics/micron/format/MicronGeometryBufferAttributeSpec.js +0 -71
- package/engine/graphics/render/forward_plus/queryBVH_Frustum.js +0 -345
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Color,
|
|
3
|
-
GridHelper,
|
|
4
2
|
Group,
|
|
5
3
|
HemisphereLight,
|
|
6
4
|
Line,
|
|
7
5
|
LineBasicMaterial,
|
|
8
6
|
Mesh,
|
|
7
|
+
MeshBasicMaterial,
|
|
8
|
+
OctahedronBufferGeometry,
|
|
9
9
|
PerspectiveCamera,
|
|
10
10
|
PlaneHelper,
|
|
11
11
|
Scene,
|
|
@@ -16,12 +16,11 @@ import {
|
|
|
16
16
|
import { min2 } from "../../../../core/math/min2.js";
|
|
17
17
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
18
18
|
import { PointLight } from "./PointLight.js";
|
|
19
|
-
import { randomFloatBetween } from "../../../../core/math/MathUtils.js";
|
|
20
19
|
import { makeHelperSphereGeometry } from "../../../../editor/process/symbolic/makeHelperSphereGeometry.js";
|
|
21
20
|
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
22
21
|
import { MouseEvents } from "../../../input/devices/events/MouseEvents.js";
|
|
23
22
|
import { RingBuffer } from "../../../../core/collection/RingBuffer.js";
|
|
24
|
-
import {
|
|
23
|
+
import { query_bvh_frustum_from_objects } from "./query/query_bvh_frustum_from_objects.js";
|
|
25
24
|
import { prettyPrint } from "../../../../core/NumberFormat.js";
|
|
26
25
|
import { FPlusDebugMaterial } from "./materials/FPlusDebugMaterial.js";
|
|
27
26
|
import { parseColor } from "../../../../core/color/ColorUtils.js";
|
|
@@ -38,6 +37,13 @@ import Vector3 from "../../../../core/geom/Vector3.js";
|
|
|
38
37
|
import { MetricCollection } from "../../../development/performance/MetricCollection.js";
|
|
39
38
|
import { MetricStatistics } from "../../../development/performance/MetricStatistics.js";
|
|
40
39
|
import { SpotLight } from "./SpotLight.js";
|
|
40
|
+
import { randomFloatBetween } from "../../../../core/math/random/randomFloatBetween.js";
|
|
41
|
+
import Signal from "../../../../core/events/signal/Signal.js";
|
|
42
|
+
import SimplexNoise from "simplex-noise";
|
|
43
|
+
import Stats from "three/examples/jsm/libs/stats.module.js";
|
|
44
|
+
import { threeUpdateTransform } from "../../util/threeUpdateTransform.js";
|
|
45
|
+
|
|
46
|
+
const on_render = new Signal();
|
|
41
47
|
|
|
42
48
|
const lm = new LightManager();
|
|
43
49
|
|
|
@@ -45,7 +51,8 @@ const camera = new PerspectiveCamera(30);
|
|
|
45
51
|
camera.position.z = 1;
|
|
46
52
|
|
|
47
53
|
camera.layers.enable(3);
|
|
48
|
-
camera.layers.enable(
|
|
54
|
+
camera.layers.enable(4);
|
|
55
|
+
// camera.layers.enable(1);
|
|
49
56
|
|
|
50
57
|
camera.near = 1;
|
|
51
58
|
camera.far = 15;
|
|
@@ -56,14 +63,19 @@ camera.updateMatrixWorld(true);
|
|
|
56
63
|
|
|
57
64
|
// lm.setTileMapResolution(32,32,32);
|
|
58
65
|
lm.setTileMapResolution(24, 14, 8);
|
|
66
|
+
// lm.setTileMapResolution(16, 8, 10);
|
|
59
67
|
|
|
60
68
|
console.log(lm);
|
|
69
|
+
window.lights = lm;
|
|
61
70
|
|
|
62
71
|
const random = seededRandom(0);
|
|
63
72
|
|
|
64
73
|
const scene = new Scene();
|
|
74
|
+
scene.matrixAutoUpdate = false;
|
|
75
|
+
scene.autoUpdate = false;
|
|
65
76
|
|
|
66
|
-
const sphere_geometry =
|
|
77
|
+
const sphere_geometry = new OctahedronBufferGeometry(1, 2);
|
|
78
|
+
const sphere_geometry_shell = makeHelperSphereGeometry(1);
|
|
67
79
|
// const sphere_geometry = new SphereBufferGeometry(1, 8, 8);
|
|
68
80
|
|
|
69
81
|
// const directionalLight = new DirectionalLight(0xffffff, 0.7);
|
|
@@ -77,6 +89,7 @@ scene.add(new HemisphereLight("rgb(107,187,255)", "rgb(105,97,83)", 0.2));
|
|
|
77
89
|
|
|
78
90
|
|
|
79
91
|
const fp_materials = [];
|
|
92
|
+
const scratch_v2 = new Vector2();
|
|
80
93
|
|
|
81
94
|
function getFPStandard() {
|
|
82
95
|
const r = new FPlusStandardMaterial();
|
|
@@ -85,12 +98,6 @@ function getFPStandard() {
|
|
|
85
98
|
r.attach_lights(lm);
|
|
86
99
|
}
|
|
87
100
|
|
|
88
|
-
if (renderer !== undefined) {
|
|
89
|
-
|
|
90
|
-
renderer.getSize(
|
|
91
|
-
r.uniforms.resolution.value
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
101
|
|
|
95
102
|
fp_materials.push(r);
|
|
96
103
|
|
|
@@ -98,10 +105,10 @@ function getFPStandard() {
|
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
const material_fp_standard = new FPlusStandardMaterial({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
color: 0xFFFF00,
|
|
109
|
+
polygonOffset: true,
|
|
110
|
+
depthWrite: false
|
|
111
|
+
});
|
|
105
112
|
|
|
106
113
|
fp_materials.push(material_fp_standard);
|
|
107
114
|
|
|
@@ -136,6 +143,10 @@ function addKnot(position, scale, rotation) {
|
|
|
136
143
|
group.add(mesh);
|
|
137
144
|
group.add(outline);
|
|
138
145
|
|
|
146
|
+
group.matrixAutoUpdate = false;
|
|
147
|
+
|
|
148
|
+
threeUpdateTransform(group);
|
|
149
|
+
|
|
139
150
|
scene.add(group);
|
|
140
151
|
}
|
|
141
152
|
|
|
@@ -165,18 +176,27 @@ function addSpotLight(position, direction, color, distance = 1, angle = 1, penum
|
|
|
165
176
|
lm.addLight(light);
|
|
166
177
|
}
|
|
167
178
|
|
|
179
|
+
const noise = new SimplexNoise(random);
|
|
180
|
+
|
|
168
181
|
/**
|
|
169
182
|
*
|
|
170
183
|
* @param {number[]} position
|
|
171
184
|
* @param {number} radius
|
|
172
185
|
* @param {string|number} color
|
|
173
186
|
* @param {number} intensity
|
|
187
|
+
* @param {boolean} wander
|
|
188
|
+
* @param {number} [wander_radius]
|
|
174
189
|
*/
|
|
175
|
-
function addPointLight(
|
|
190
|
+
function addPointLight({
|
|
191
|
+
position, radius, color, intensity = 1,
|
|
192
|
+
wander = false,
|
|
193
|
+
wander_radius = 5
|
|
194
|
+
}) {
|
|
176
195
|
|
|
177
196
|
const light = new PointLight();
|
|
178
197
|
|
|
179
|
-
light.position
|
|
198
|
+
const p = light.position;
|
|
199
|
+
p.set(
|
|
180
200
|
position[0],
|
|
181
201
|
position[1],
|
|
182
202
|
position[2],
|
|
@@ -199,23 +219,85 @@ function addPointLight(position, radius, color, intensity = 1) {
|
|
|
199
219
|
|
|
200
220
|
lm.addLight(light);
|
|
201
221
|
|
|
222
|
+
// outer shell
|
|
223
|
+
const visual_group = new Group();
|
|
224
|
+
|
|
225
|
+
const color_uint = light.color.toUint();
|
|
202
226
|
const sphere_material = new LineBasicMaterial({
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
227
|
+
depthTest: true,
|
|
228
|
+
depthWrite: false,
|
|
229
|
+
transparent: true,
|
|
230
|
+
linewidth: 1,
|
|
231
|
+
fog: false,
|
|
232
|
+
color: color_uint,
|
|
233
|
+
opacity: min2(intensity, 1)
|
|
234
|
+
});
|
|
211
235
|
|
|
212
|
-
const mesh = new Line(
|
|
236
|
+
const mesh = new Line(sphere_geometry_shell, sphere_material);
|
|
213
237
|
|
|
214
238
|
mesh.layers.set(1);
|
|
215
|
-
mesh.position.set(light.position.x, light.position.y, light.position.z);
|
|
216
239
|
mesh.scale.setScalar(light.radius.getValue());
|
|
217
240
|
|
|
218
|
-
|
|
241
|
+
// center
|
|
242
|
+
const mesh_center_0 = new Mesh(sphere_geometry, new MeshBasicMaterial({
|
|
243
|
+
color: color_uint
|
|
244
|
+
}));
|
|
245
|
+
mesh_center_0.layers.disableAll();
|
|
246
|
+
mesh_center_0.layers.set(4);
|
|
247
|
+
mesh_center_0.scale.setScalar(0.02);
|
|
248
|
+
mesh_center_0.matrixAutoUpdate = false;
|
|
249
|
+
|
|
250
|
+
visual_group.add(mesh_center_0);
|
|
251
|
+
|
|
252
|
+
const mesh_center_1 = new Mesh(sphere_geometry, new MeshBasicMaterial({
|
|
253
|
+
color: color_uint,
|
|
254
|
+
transparent: true,
|
|
255
|
+
opacity: 0.033
|
|
256
|
+
}));
|
|
257
|
+
mesh_center_1.scale.setScalar(0.1);
|
|
258
|
+
mesh_center_1.layers.disableAll();
|
|
259
|
+
mesh_center_1.layers.set(4);
|
|
260
|
+
mesh_center_1.matrixAutoUpdate = false;
|
|
261
|
+
|
|
262
|
+
visual_group.add(mesh_center_1);
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
visual_group.add(mesh);
|
|
266
|
+
visual_group.position.set(p.x, p.y, p.z);
|
|
267
|
+
|
|
268
|
+
threeUpdateTransform(visual_group);
|
|
269
|
+
visual_group.matrixAutoUpdate = false;
|
|
270
|
+
|
|
271
|
+
scene.add(visual_group);
|
|
272
|
+
|
|
273
|
+
if (wander) {
|
|
274
|
+
const source_p_x = position[0];
|
|
275
|
+
const source_p_y = position[1];
|
|
276
|
+
const source_p_z = position[2];
|
|
277
|
+
|
|
278
|
+
on_render.add((renderer, camera, scene, time_delta, time) => {
|
|
279
|
+
|
|
280
|
+
const t = time * 0.0001;
|
|
281
|
+
|
|
282
|
+
const noise_x = noise.noise4D(source_p_x, source_p_y, source_p_z, t) * wander_radius;
|
|
283
|
+
const noise_y = noise.noise4D(source_p_x + 31.341, source_p_y - 43.23, source_p_z + 12.34, t) * wander_radius;
|
|
284
|
+
const noise_z = noise.noise4D(source_p_x - 231.141, source_p_y + 124.123, source_p_z - 54.4341, t) * wander_radius;
|
|
285
|
+
|
|
286
|
+
p.set(
|
|
287
|
+
source_p_x + noise_x,
|
|
288
|
+
source_p_y + noise_y,
|
|
289
|
+
source_p_z + noise_z,
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
visual_group.position.set(
|
|
293
|
+
p.x,
|
|
294
|
+
p.y,
|
|
295
|
+
p.z,
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
threeUpdateTransform(visual_group);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
219
301
|
}
|
|
220
302
|
|
|
221
303
|
const box_geometry = new TorusKnotBufferGeometry(1, 0.3, 128, 128);
|
|
@@ -233,39 +315,45 @@ function prepare_scene_0() {
|
|
|
233
315
|
|
|
234
316
|
controls.minDistance = 2;
|
|
235
317
|
|
|
236
|
-
|
|
237
|
-
|
|
318
|
+
const bounds_size = 15;
|
|
319
|
+
|
|
320
|
+
const light_radius = 2;
|
|
321
|
+
|
|
322
|
+
for (let i = 0; i < 5000; i++) {
|
|
323
|
+
const radius = randomFloatBetween(random, light_radius, light_radius);
|
|
238
324
|
const intensity = randomFloatBetween(random, 2, 2);
|
|
239
|
-
addPointLight(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
intensity
|
|
325
|
+
addPointLight({
|
|
326
|
+
position: [
|
|
327
|
+
randomFloatBetween(random, -bounds_size, bounds_size),
|
|
328
|
+
randomFloatBetween(random, -bounds_size, bounds_size),
|
|
329
|
+
randomFloatBetween(random, -bounds_size, bounds_size),
|
|
330
|
+
], radius: radius, color: `hsv(${random().toFixed(4)}, 0.8, 1)`, intensity: intensity
|
|
331
|
+
}
|
|
247
332
|
);
|
|
248
333
|
}
|
|
249
334
|
|
|
335
|
+
const bounds_size_2 = 15;
|
|
336
|
+
|
|
250
337
|
for (let i = 0; i < 500; i++) {
|
|
251
338
|
|
|
252
339
|
addKnot([
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
340
|
+
randomFloatBetween(random, -bounds_size_2, bounds_size_2),
|
|
341
|
+
randomFloatBetween(random, -bounds_size_2, bounds_size_2),
|
|
342
|
+
randomFloatBetween(random, -bounds_size_2, bounds_size_2)
|
|
343
|
+
], 0.5, [
|
|
344
|
+
randomFloatBetween(random, 0, Math.PI),
|
|
345
|
+
randomFloatBetween(random, 0, Math.PI),
|
|
346
|
+
randomFloatBetween(random, 0, Math.PI)
|
|
347
|
+
]);
|
|
261
348
|
}
|
|
262
349
|
}
|
|
263
350
|
|
|
264
351
|
function prepare_scene_1() {
|
|
265
|
-
addPointLight(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
352
|
+
addPointLight({
|
|
353
|
+
position: [
|
|
354
|
+
0, 0, -3
|
|
355
|
+
], radius: 1, color: 0xFF0000
|
|
356
|
+
}
|
|
269
357
|
);
|
|
270
358
|
|
|
271
359
|
// tight planes around the light
|
|
@@ -277,10 +365,11 @@ function prepare_scene_1() {
|
|
|
277
365
|
}
|
|
278
366
|
|
|
279
367
|
function prepare_scene_3() {
|
|
280
|
-
addPointLight(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
368
|
+
addPointLight({
|
|
369
|
+
position: [
|
|
370
|
+
0, 0, -4
|
|
371
|
+
], radius: 1, color: 0xFF0000
|
|
372
|
+
}
|
|
284
373
|
);
|
|
285
374
|
|
|
286
375
|
// tight planes around the light
|
|
@@ -288,25 +377,25 @@ function prepare_scene_3() {
|
|
|
288
377
|
camera.far = 7;
|
|
289
378
|
|
|
290
379
|
addKnot([
|
|
291
|
-
|
|
292
|
-
|
|
380
|
+
0, 0, -4
|
|
381
|
+
], 1, [0, 0, 0]);
|
|
293
382
|
|
|
294
383
|
// camera.position.set(0, 0, 0);
|
|
295
384
|
camera.lookAt(0, 0, -5);
|
|
296
385
|
}
|
|
297
386
|
|
|
298
387
|
function prepare_scene_2() {
|
|
299
|
-
addPointLight(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
388
|
+
addPointLight({
|
|
389
|
+
position: [
|
|
390
|
+
1.5, 0, -4
|
|
391
|
+
], radius: 1.5, color: 0xFF0000, intensity: 1
|
|
392
|
+
}
|
|
304
393
|
);
|
|
305
|
-
addPointLight(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
394
|
+
addPointLight({
|
|
395
|
+
position: [
|
|
396
|
+
-1.5, 0, -4
|
|
397
|
+
], radius: 1.5, color: 0x00FF00, intensity: 1
|
|
398
|
+
}
|
|
310
399
|
);
|
|
311
400
|
|
|
312
401
|
addKnot([0, 0, -5], 1, [0, 0, 0]);
|
|
@@ -323,17 +412,17 @@ function prepare_scene_5() {
|
|
|
323
412
|
const offset = new Vector3(100, 100, 100);
|
|
324
413
|
|
|
325
414
|
|
|
326
|
-
addPointLight(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
415
|
+
addPointLight({
|
|
416
|
+
position: [
|
|
417
|
+
1.5 + offset.x, 0 + offset.y, -4 + offset.z
|
|
418
|
+
], radius: 1.5, color: 0xFF0000, intensity: 10
|
|
419
|
+
}
|
|
331
420
|
);
|
|
332
|
-
addPointLight(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
421
|
+
addPointLight({
|
|
422
|
+
position: [
|
|
423
|
+
-1.5 + offset.x, 0 + offset.y, -4 + offset.z
|
|
424
|
+
], radius: 1.5, color: 0x00FF00, intensity: 10
|
|
425
|
+
}
|
|
337
426
|
);
|
|
338
427
|
|
|
339
428
|
addKnot(
|
|
@@ -355,11 +444,10 @@ function prepare_scene_5() {
|
|
|
355
444
|
}
|
|
356
445
|
|
|
357
446
|
|
|
358
|
-
|
|
359
447
|
function addSponza() {
|
|
360
448
|
const loader = new GLTFLoader();
|
|
361
449
|
|
|
362
|
-
loader.load("data/models/sponza-pbr/sponza.glb", (gltf) => {
|
|
450
|
+
loader.load("data/models/sponza-pbr/gltf/sponza.glb", (gltf) => {
|
|
363
451
|
|
|
364
452
|
gltf.scene.traverse(m => {
|
|
365
453
|
if (m.isLight) {
|
|
@@ -387,6 +475,8 @@ function addSponza() {
|
|
|
387
475
|
|
|
388
476
|
});
|
|
389
477
|
|
|
478
|
+
threeUpdateTransform(m_0);
|
|
479
|
+
|
|
390
480
|
scene.add(m_0);
|
|
391
481
|
|
|
392
482
|
const m_1 = gltf.scene.clone(true);
|
|
@@ -399,6 +489,8 @@ function addSponza() {
|
|
|
399
489
|
|
|
400
490
|
});
|
|
401
491
|
|
|
492
|
+
threeUpdateTransform(m_1);
|
|
493
|
+
|
|
402
494
|
scene.add(m_1);
|
|
403
495
|
|
|
404
496
|
});
|
|
@@ -406,8 +498,8 @@ function addSponza() {
|
|
|
406
498
|
|
|
407
499
|
function prepare_scene_4() {
|
|
408
500
|
|
|
409
|
-
controls.target.set(2.1731179577352857,
|
|
410
|
-
camera.position.set(-
|
|
501
|
+
controls.target.set(2.1731179577352857, 2.4, -0.26);
|
|
502
|
+
camera.position.set(-8, 3.3, -0.26);
|
|
411
503
|
|
|
412
504
|
camera.near = 1;
|
|
413
505
|
camera.far = 50;
|
|
@@ -417,16 +509,19 @@ function prepare_scene_4() {
|
|
|
417
509
|
controls.update();
|
|
418
510
|
|
|
419
511
|
|
|
420
|
-
for (let i = 0; i <
|
|
512
|
+
for (let i = 0; i < 500; i++) {
|
|
421
513
|
const radius = randomFloatBetween(random, 2, 2);
|
|
422
|
-
addPointLight(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
514
|
+
addPointLight({
|
|
515
|
+
position: [
|
|
516
|
+
randomFloatBetween(random, -17, 17),
|
|
517
|
+
randomFloatBetween(random, -2, 13),
|
|
518
|
+
randomFloatBetween(random, -10, 10),
|
|
519
|
+
],
|
|
520
|
+
radius: radius,
|
|
521
|
+
color: `hsv(${random().toFixed(4)}, 0.8, 1)`,
|
|
522
|
+
intensity: randomFloatBetween(random, 6, 6),
|
|
523
|
+
wander: true
|
|
524
|
+
}
|
|
430
525
|
);
|
|
431
526
|
}
|
|
432
527
|
|
|
@@ -459,14 +554,13 @@ function prepare_scene_6() {
|
|
|
459
554
|
controls.update();
|
|
460
555
|
|
|
461
556
|
|
|
462
|
-
addPointLight(
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
3
|
|
557
|
+
addPointLight({
|
|
558
|
+
position: [
|
|
559
|
+
11,
|
|
560
|
+
1,
|
|
561
|
+
0,
|
|
562
|
+
], radius: 2, color: `hsv(0.5, 0.8, 1)`, intensity: 3
|
|
563
|
+
}
|
|
470
564
|
);
|
|
471
565
|
|
|
472
566
|
//
|
|
@@ -488,9 +582,9 @@ function prepare_scene_6() {
|
|
|
488
582
|
|
|
489
583
|
function prepare_scene_7() {
|
|
490
584
|
addSpotLight([
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
585
|
+
0, 0, -3
|
|
586
|
+
], [0, 0, 1],
|
|
587
|
+
0xFF0000
|
|
494
588
|
);
|
|
495
589
|
|
|
496
590
|
// tight planes around the light
|
|
@@ -513,8 +607,8 @@ console.log("done");
|
|
|
513
607
|
|
|
514
608
|
|
|
515
609
|
const renderer = new WebGLRenderer({
|
|
516
|
-
|
|
517
|
-
|
|
610
|
+
antialias: true
|
|
611
|
+
});
|
|
518
612
|
// renderer.shadowMap.type = VSMShadowMap;
|
|
519
613
|
// renderer.shadowMap.enabled = true;
|
|
520
614
|
renderer.sortObjects = false;
|
|
@@ -540,8 +634,12 @@ camera.aspect = window.innerWidth / window.innerHeight;
|
|
|
540
634
|
camera.updateProjectionMatrix();
|
|
541
635
|
|
|
542
636
|
|
|
543
|
-
scene.add(new GridHelper());
|
|
544
|
-
scene.background = new Color(0x666666);
|
|
637
|
+
// scene.add(new GridHelper());
|
|
638
|
+
// scene.background = new Color(0x666666);
|
|
639
|
+
|
|
640
|
+
const stats = new Stats();
|
|
641
|
+
stats.dom.style.cssText = 'position:fixed;top:0;right:0;cursor:pointer;opacity:0.9;z-index:10000';
|
|
642
|
+
document.body.appendChild(stats.dom);
|
|
545
643
|
|
|
546
644
|
const controls = new OrbitControls(camera, renderer.domElement);
|
|
547
645
|
|
|
@@ -585,10 +683,17 @@ function animate() {
|
|
|
585
683
|
material_fp_standard.uniforms.fp_f_camera_near.value = camera.near;
|
|
586
684
|
material_fp_standard.uniforms.fp_f_camera_far.value = camera.far;
|
|
587
685
|
|
|
686
|
+
|
|
687
|
+
renderer.getSize(scratch_v2);
|
|
688
|
+
scratch_v2.multiplyScalar(renderer.getPixelRatio());
|
|
689
|
+
|
|
588
690
|
fp_materials.forEach(m => {
|
|
589
691
|
|
|
590
692
|
m.uniforms.fp_f_camera_near.value = camera.near;
|
|
591
693
|
m.uniforms.fp_f_camera_far.value = camera.far;
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
m.uniforms.resolution.value.set(scratch_v2.x, scratch_v2.y);
|
|
592
697
|
});
|
|
593
698
|
|
|
594
699
|
lightClusterWidget.update();
|
|
@@ -596,7 +701,9 @@ function animate() {
|
|
|
596
701
|
|
|
597
702
|
renderer.render(scene, camera);
|
|
598
703
|
|
|
704
|
+
on_render.send6(renderer, camera, scene, time_delta, t);
|
|
599
705
|
|
|
706
|
+
stats.update();
|
|
600
707
|
}
|
|
601
708
|
|
|
602
709
|
const metrics = new MetricCollection();
|
|
@@ -627,20 +734,20 @@ function print_perf_stats() {
|
|
|
627
734
|
setInterval(print_perf_stats, 2000);
|
|
628
735
|
|
|
629
736
|
function do_sample() {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
737
|
+
query_bvh_frustum_from_objects.iteration_count = 0;
|
|
738
|
+
query_bvh_frustum_from_objects.rejection_count = 0;
|
|
739
|
+
query_bvh_frustum_from_objects.rejection_sphere_count = 0;
|
|
740
|
+
query_bvh_frustum_from_objects.plane_tests = 0;
|
|
741
|
+
query_bvh_frustum_from_objects.plane_tests_early_exits = 0;
|
|
635
742
|
|
|
636
743
|
const t0 = performance.now();
|
|
637
744
|
lm.buildTiles(camera);
|
|
638
745
|
const t1 = performance.now();
|
|
639
746
|
|
|
640
747
|
metrics.get("time").record(t1 - t0);
|
|
641
|
-
metrics.get("iterations").record(
|
|
642
|
-
metrics.get("rejections").record(
|
|
643
|
-
metrics.get("sphere_rejections").record(
|
|
748
|
+
metrics.get("iterations").record(query_bvh_frustum_from_objects.iteration_count);
|
|
749
|
+
metrics.get("rejections").record(query_bvh_frustum_from_objects.rejection_count);
|
|
750
|
+
metrics.get("sphere_rejections").record(query_bvh_frustum_from_objects.rejection_sphere_count);
|
|
644
751
|
}
|
|
645
752
|
|
|
646
753
|
function draw_camera_view_planes() {
|
|
@@ -653,7 +760,7 @@ function draw_camera_view_planes() {
|
|
|
653
760
|
});
|
|
654
761
|
}
|
|
655
762
|
|
|
656
|
-
|
|
763
|
+
prepare_scene_4();
|
|
657
764
|
animate();
|
|
658
765
|
|
|
659
766
|
// draw_camera_view_planes();
|
|
@@ -679,32 +786,32 @@ renderer.domElement.addEventListener(MouseEvents.DoubleClick, () => {
|
|
|
679
786
|
});
|
|
680
787
|
|
|
681
788
|
domify(lightClusterWidget.domElement).css({
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
789
|
+
position: "absolute",
|
|
790
|
+
zIndex: 2,
|
|
791
|
+
bottom: 0,
|
|
792
|
+
right: 0
|
|
793
|
+
});
|
|
687
794
|
|
|
688
795
|
document.body.appendChild(lightClusterWidget.domElement);
|
|
689
796
|
|
|
690
797
|
const debugger_button = new ButtonView({
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
798
|
+
action() {
|
|
799
|
+
if (screenGrid.domElement.parentNode !== null) {
|
|
800
|
+
document.body.removeChild(screenGrid.domElement);
|
|
801
|
+
} else {
|
|
802
|
+
document.body.appendChild(screenGrid.domElement);
|
|
803
|
+
}
|
|
804
|
+
},
|
|
805
|
+
name: "debugger",
|
|
806
|
+
css: {
|
|
807
|
+
position: "absolute",
|
|
808
|
+
color: "white",
|
|
809
|
+
background: "rgba(0,0,0,0.5)",
|
|
810
|
+
zIndex: 2,
|
|
811
|
+
top: 0,
|
|
812
|
+
left: 0
|
|
813
|
+
}
|
|
814
|
+
});
|
|
708
815
|
|
|
709
816
|
debugger_button.link();
|
|
710
817
|
|
|
@@ -713,3 +820,16 @@ document.body.appendChild(debugger_button.el);
|
|
|
713
820
|
const layerSwitcher = createLayerSwitcher(camera);
|
|
714
821
|
|
|
715
822
|
document.body.appendChild(layerSwitcher.domElement);
|
|
823
|
+
|
|
824
|
+
function onWindowResize() {
|
|
825
|
+
|
|
826
|
+
const w = window.innerWidth;
|
|
827
|
+
const h = window.innerHeight;
|
|
828
|
+
|
|
829
|
+
camera.aspect = w / h;
|
|
830
|
+
camera.updateProjectionMatrix();
|
|
831
|
+
|
|
832
|
+
renderer.setSize(w, h);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
window.addEventListener("resize", onWindowResize);
|