@woosh/meep-engine 2.33.20 → 2.33.24
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/__detailed_box_volume_intersection.js +11 -8
- package/core/collection/ArrayUtils.js +1 -1
- package/core/collection/HashMap.js +66 -22
- package/core/collection/array/arrayQuickSort.js +9 -6
- package/core/collection/array/array_swap.js +22 -0
- package/core/collection/array/computeHashArray.js +22 -0
- package/core/collection/array/computeHashIntegerArray.js +15 -0
- 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/CircleMath.js +4 -4
- package/core/geom/3d/aabb/aabb3_computeDistanceAbovePlane.js +9 -33
- package/core/geom/3d/cone/computeConeBoundingBox.js +4 -4
- package/core/geom/3d/{compute_bounding_cone_of_2_cones.js → cone/compute_bounding_cone_of_2_cones.js} +3 -3
- package/core/geom/3d/{compute_bounding_cone_of_2_cones.spec.js → cone/compute_bounding_cone_of_2_cones.spec.js} +1 -1
- package/core/geom/3d/frustum/array_setFromProjectionMatrix.js +1 -1
- package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +11 -3
- 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/{encode_unit3_hemioct.js → normal/hemioct/encode_unit3_hemioct.js} +0 -0
- package/core/geom/3d/{unit_hemioct.spec.js → normal/hemioct/unit_hemioct.spec.js} +1 -1
- package/core/geom/3d/normal/lamber_azimuth/transform.js +61 -0
- package/core/geom/3d/normal/spherical/sphere_map_transform.js +77 -0
- package/core/geom/3d/{lerp_planes_to_array.js → plane/lerp_planes_to_array.js} +1 -3
- package/core/geom/3d/plane/plane3_lerp.js +3 -1
- package/core/geom/3d/plane/plane3_slerp.js +4 -1
- package/core/geom/3d/{plane_computeConvex3PlaneIntersection.js → plane/plane_computeConvex3PlaneIntersection.js} +14 -16
- package/core/geom/3d/ray/ray_computeNearestPointToPoint.js +37 -0
- package/core/geom/3d/shape/AbstractShape3D.js +29 -0
- package/core/geom/3d/shape/CompositeShape.js +60 -0
- package/core/geom/3d/shape/TransformedShape3D.js +70 -0
- package/core/geom/3d/shape/UnitCubeShape3D.js +13 -0
- package/core/geom/3d/shape/UnitSphereShape3D.js +16 -0
- package/core/geom/3d/topology/TopoTriangle.js +1 -1
- package/core/geom/3d/topology/TopoVertex.js +1 -1
- package/core/geom/3d/topology/bounds/computeTraingleClusterNormalBoundingCone.js +2 -2
- package/core/geom/3d/topology/simplify/compute_face_normal_change_dot_product.js +1 -1
- package/core/geom/3d/topology/simplify/quadratic/Quadratic3.js +1 -1
- package/core/geom/3d/triangle/computeTrianglePlaneSide.js +1 -1
- package/core/geom/3d/triangle/computeTriangleRayIntersection.js +1 -1
- 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 +1 -77
- package/core/geom/Matrix4.js +8 -8
- package/core/geom/Plane.js +15 -10
- package/core/geom/Quaternion.js +2 -1
- package/core/geom/Rectangle.js +2 -1
- package/core/geom/Vector1.js +1 -1
- package/core/geom/Vector3.d.ts +2 -0
- package/core/geom/Vector3.js +35 -159
- package/core/geom/Vector3.spec.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 +6 -3
- package/core/geom/random/randomPointOnBox.js +7 -3
- package/core/geom/random/randomPointOnSphere.js +6 -3
- package/core/geom/v3_angle_between.js +31 -0
- package/core/geom/v3_distance.js +16 -0
- package/core/geom/v3_distance_sqr.js +17 -0
- package/core/geom/v3_dot.js +13 -0
- package/core/geom/v3_length.js +10 -0
- package/core/geom/v3_length_sqr.js +10 -0
- package/core/geom/v3_lerp.js +21 -0
- package/core/geom/v3_slerp.js +48 -0
- package/core/graph/graph_k_means_cluster.js +1 -1
- 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 +6 -1
- 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 +4 -3
- package/engine/asset/loaders/material/computeTextureEquality.js +13 -5
- package/engine/asset/loaders/material/computeTextureHash.js +2 -1
- package/engine/ecs/animation/Animation.js +2 -1
- package/engine/ecs/animation/InverseKinematics.js +2 -1
- package/engine/ecs/animation/OneBoneSurfaceAlignmentSolver.js +3 -1
- package/engine/ecs/animation/TwoBoneInverseKinematicsSolver.js +3 -1
- 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 +2 -3
- 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 +1 -1
- package/engine/ecs/gui/position/ViewportPosition.js +2 -1
- package/engine/ecs/systems/RangedAttackSystem.js +1 -1
- package/engine/ecs/systems/SteeringSystem.js +3 -2
- package/engine/ecs/terrain/ecs/Terrain.js +6 -0
- package/engine/ecs/terrain/ecs/layers/TerrainLayers.js +5 -0
- package/engine/ecs/terrain/ecs/splat/SplatMapping.js +5 -0
- package/engine/ecs/terrain/tiles/TerrainTileManager.js +1 -1
- package/engine/ecs/tooltip/TooltipComponent.js +15 -0
- package/engine/ecs/util/hideEntityGracefully.js +18 -0
- package/engine/graphics/GraphicsEngine.js +1 -0
- package/engine/graphics/camera/testClippingPlaneComputation.js +2 -2
- 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 +2 -2
- package/engine/graphics/ecs/highlight/HighlightDefinition.js +2 -1
- package/engine/graphics/ecs/highlight/renderer/OutlineRenderer.js +0 -53
- package/engine/graphics/ecs/light/Light.d.ts +1 -1
- package/engine/graphics/ecs/light/Light.js +3 -0
- package/engine/graphics/ecs/mesh/Mesh.js +2 -1
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +13 -0
- 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/geometry/bvh/buffered/BVHGeometryRaycaster.js +2 -1
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +7 -7
- package/engine/graphics/micron/build/clustering/computeFaceCurvatureScore.js +1 -1
- package/engine/graphics/micron/build/clustering/compute_face_connection_weight.js +1 -1
- package/engine/graphics/micron/build/fill_patch_geometry_data.js +1 -1
- package/engine/graphics/micron/build/hierarchy/computePatchMergeScore.js +1 -1
- package/engine/graphics/micron/build/hierarchy/patch_combine.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/refinement/is_patch_facing_back.js +2 -2
- package/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
- package/engine/graphics/particles/particular/engine/ParticularEngine.js +4 -2
- package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +84 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +92 -144
- package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +14 -3
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +51 -12
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +3 -2
- 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 +21 -0
- package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +0 -20
- package/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +9 -9
- package/engine/graphics/particles/particular/engine/shader/ShaderManager.js +7 -25
- 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/ParticleVolume.js +384 -0
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +558 -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 +1 -1
- 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 +15 -33
- package/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
- package/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +12 -2
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +6 -6
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +231 -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 +8 -5
- package/engine/graphics/render/visibility/IncrementalDeltaSet.js +11 -0
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +2 -2
- package/engine/graphics/texture/atlas/AtlasPatch.js +7 -2
- package/engine/graphics/texture/atlas/TextureAtlas.js +18 -14
- 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/projectSphere.js +1 -1
- package/engine/grid/components/GridObstacle.js +3 -10
- package/engine/intelligence/behavior/selector/WeightedElement.js +2 -1
- package/engine/intelligence/optimization/RandomOptimizer.js +1 -1
- package/engine/navigation/ecs/components/Path.js +3 -2
- 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/CellFilterAngleToNormal.js +3 -2
- package/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +1 -1
- package/generation/grid/generation/GridTaskExecuteRuleTimes.js +2 -1
- package/generation/markers/GridCellActionPlaceMarker.js +13 -1
- package/generation/markers/MarkerNode.js +6 -0
- 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 +5 -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 +19 -101
- 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,12 @@ 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
|
+
|
|
45
|
+
const on_render = new Signal();
|
|
41
46
|
|
|
42
47
|
const lm = new LightManager();
|
|
43
48
|
|
|
@@ -45,7 +50,7 @@ const camera = new PerspectiveCamera(30);
|
|
|
45
50
|
camera.position.z = 1;
|
|
46
51
|
|
|
47
52
|
camera.layers.enable(3);
|
|
48
|
-
camera.layers.enable(1);
|
|
53
|
+
// camera.layers.enable(1);
|
|
49
54
|
|
|
50
55
|
camera.near = 1;
|
|
51
56
|
camera.far = 15;
|
|
@@ -56,14 +61,17 @@ camera.updateMatrixWorld(true);
|
|
|
56
61
|
|
|
57
62
|
// lm.setTileMapResolution(32,32,32);
|
|
58
63
|
lm.setTileMapResolution(24, 14, 8);
|
|
64
|
+
// lm.setTileMapResolution(16, 8, 10);
|
|
59
65
|
|
|
60
66
|
console.log(lm);
|
|
67
|
+
window.lights = lm;
|
|
61
68
|
|
|
62
69
|
const random = seededRandom(0);
|
|
63
70
|
|
|
64
71
|
const scene = new Scene();
|
|
65
72
|
|
|
66
|
-
const sphere_geometry =
|
|
73
|
+
const sphere_geometry = new OctahedronBufferGeometry(1, 2);
|
|
74
|
+
const sphere_geometry_shell = makeHelperSphereGeometry(1);
|
|
67
75
|
// const sphere_geometry = new SphereBufferGeometry(1, 8, 8);
|
|
68
76
|
|
|
69
77
|
// const directionalLight = new DirectionalLight(0xffffff, 0.7);
|
|
@@ -77,6 +85,7 @@ scene.add(new HemisphereLight("rgb(107,187,255)", "rgb(105,97,83)", 0.2));
|
|
|
77
85
|
|
|
78
86
|
|
|
79
87
|
const fp_materials = [];
|
|
88
|
+
const scratch_v2 = new Vector2();
|
|
80
89
|
|
|
81
90
|
function getFPStandard() {
|
|
82
91
|
const r = new FPlusStandardMaterial();
|
|
@@ -85,12 +94,6 @@ function getFPStandard() {
|
|
|
85
94
|
r.attach_lights(lm);
|
|
86
95
|
}
|
|
87
96
|
|
|
88
|
-
if (renderer !== undefined) {
|
|
89
|
-
|
|
90
|
-
renderer.getSize(
|
|
91
|
-
r.uniforms.resolution.value
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
97
|
|
|
95
98
|
fp_materials.push(r);
|
|
96
99
|
|
|
@@ -98,10 +101,10 @@ function getFPStandard() {
|
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
const material_fp_standard = new FPlusStandardMaterial({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
color: 0xFFFF00,
|
|
105
|
+
polygonOffset: true,
|
|
106
|
+
depthWrite: false
|
|
107
|
+
});
|
|
105
108
|
|
|
106
109
|
fp_materials.push(material_fp_standard);
|
|
107
110
|
|
|
@@ -165,18 +168,27 @@ function addSpotLight(position, direction, color, distance = 1, angle = 1, penum
|
|
|
165
168
|
lm.addLight(light);
|
|
166
169
|
}
|
|
167
170
|
|
|
171
|
+
const noise = new SimplexNoise(random);
|
|
172
|
+
|
|
168
173
|
/**
|
|
169
174
|
*
|
|
170
175
|
* @param {number[]} position
|
|
171
176
|
* @param {number} radius
|
|
172
177
|
* @param {string|number} color
|
|
173
178
|
* @param {number} intensity
|
|
179
|
+
* @param {boolean} wander
|
|
180
|
+
* @param {number} [wander_radius]
|
|
174
181
|
*/
|
|
175
|
-
function addPointLight(
|
|
182
|
+
function addPointLight({
|
|
183
|
+
position, radius, color, intensity = 1,
|
|
184
|
+
wander = false,
|
|
185
|
+
wander_radius = 5
|
|
186
|
+
}) {
|
|
176
187
|
|
|
177
188
|
const light = new PointLight();
|
|
178
189
|
|
|
179
|
-
light.position
|
|
190
|
+
const p = light.position;
|
|
191
|
+
p.set(
|
|
180
192
|
position[0],
|
|
181
193
|
position[1],
|
|
182
194
|
position[2],
|
|
@@ -199,23 +211,74 @@ function addPointLight(position, radius, color, intensity = 1) {
|
|
|
199
211
|
|
|
200
212
|
lm.addLight(light);
|
|
201
213
|
|
|
214
|
+
// outer shell
|
|
215
|
+
const visual_group = new Group();
|
|
216
|
+
|
|
217
|
+
const color_uint = light.color.toUint();
|
|
202
218
|
const sphere_material = new LineBasicMaterial({
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
219
|
+
depthTest: true,
|
|
220
|
+
depthWrite: false,
|
|
221
|
+
transparent: true,
|
|
222
|
+
linewidth: 1,
|
|
223
|
+
fog: false,
|
|
224
|
+
color: color_uint,
|
|
225
|
+
opacity: min2(intensity, 1)
|
|
226
|
+
});
|
|
211
227
|
|
|
212
|
-
const mesh = new Line(
|
|
228
|
+
const mesh = new Line(sphere_geometry_shell, sphere_material);
|
|
213
229
|
|
|
214
230
|
mesh.layers.set(1);
|
|
215
|
-
mesh.position.set(light.position.x, light.position.y, light.position.z);
|
|
216
231
|
mesh.scale.setScalar(light.radius.getValue());
|
|
217
232
|
|
|
218
|
-
|
|
233
|
+
// center
|
|
234
|
+
const mesh_center_0 = new Mesh(sphere_geometry, new MeshBasicMaterial({
|
|
235
|
+
color: color_uint
|
|
236
|
+
}));
|
|
237
|
+
mesh_center_0.scale.setScalar(0.02);
|
|
238
|
+
|
|
239
|
+
visual_group.add(mesh_center_0);
|
|
240
|
+
|
|
241
|
+
const mesh_center_1 = new Mesh(sphere_geometry, new MeshBasicMaterial({
|
|
242
|
+
color: color_uint,
|
|
243
|
+
transparent: true,
|
|
244
|
+
opacity: 0.033
|
|
245
|
+
}));
|
|
246
|
+
mesh_center_1.scale.setScalar(0.1);
|
|
247
|
+
|
|
248
|
+
visual_group.add(mesh_center_1);
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
visual_group.add(mesh);
|
|
252
|
+
visual_group.position.set(p.x, p.y, p.z);
|
|
253
|
+
|
|
254
|
+
scene.add(visual_group);
|
|
255
|
+
|
|
256
|
+
if (wander) {
|
|
257
|
+
const source_p_x = position[0];
|
|
258
|
+
const source_p_y = position[1];
|
|
259
|
+
const source_p_z = position[2];
|
|
260
|
+
|
|
261
|
+
on_render.add((renderer, camera, scene, time_delta, time) => {
|
|
262
|
+
|
|
263
|
+
const t = time * 0.0001;
|
|
264
|
+
|
|
265
|
+
const noise_x = noise.noise4D(source_p_x, source_p_y, source_p_z, t) * wander_radius;
|
|
266
|
+
const noise_y = noise.noise4D(source_p_x + 31.341, source_p_y - 43.23, source_p_z + 12.34, t) * wander_radius;
|
|
267
|
+
const noise_z = noise.noise4D(source_p_x - 231.141, source_p_y + 124.123, source_p_z - 54.4341, t) * wander_radius;
|
|
268
|
+
|
|
269
|
+
p.set(
|
|
270
|
+
source_p_x + noise_x,
|
|
271
|
+
source_p_y + noise_y,
|
|
272
|
+
source_p_z + noise_z,
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
visual_group.position.set(
|
|
276
|
+
p.x,
|
|
277
|
+
p.y,
|
|
278
|
+
p.z,
|
|
279
|
+
);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
219
282
|
}
|
|
220
283
|
|
|
221
284
|
const box_geometry = new TorusKnotBufferGeometry(1, 0.3, 128, 128);
|
|
@@ -233,39 +296,43 @@ function prepare_scene_0() {
|
|
|
233
296
|
|
|
234
297
|
controls.minDistance = 2;
|
|
235
298
|
|
|
236
|
-
|
|
237
|
-
|
|
299
|
+
const bounds_size = 15;
|
|
300
|
+
|
|
301
|
+
const light_radius = 5;
|
|
302
|
+
|
|
303
|
+
for (let i = 0; i < 5000; i++) {
|
|
304
|
+
const radius = randomFloatBetween(random, light_radius, light_radius);
|
|
238
305
|
const intensity = randomFloatBetween(random, 2, 2);
|
|
239
|
-
addPointLight(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
intensity
|
|
306
|
+
addPointLight({
|
|
307
|
+
position: [
|
|
308
|
+
randomFloatBetween(random, -bounds_size, bounds_size),
|
|
309
|
+
randomFloatBetween(random, -bounds_size, bounds_size),
|
|
310
|
+
randomFloatBetween(random, -bounds_size, bounds_size),
|
|
311
|
+
], radius: radius, color: `hsv(${random().toFixed(4)}, 0.8, 1)`, intensity: intensity
|
|
312
|
+
}
|
|
247
313
|
);
|
|
248
314
|
}
|
|
249
315
|
|
|
250
316
|
for (let i = 0; i < 500; i++) {
|
|
251
317
|
|
|
252
318
|
addKnot([
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
319
|
+
randomFloatBetween(random, -bounds_size, bounds_size),
|
|
320
|
+
randomFloatBetween(random, -bounds_size, bounds_size),
|
|
321
|
+
randomFloatBetween(random, -bounds_size, bounds_size)
|
|
322
|
+
], 0.5, [
|
|
323
|
+
randomFloatBetween(random, 0, Math.PI),
|
|
324
|
+
randomFloatBetween(random, 0, Math.PI),
|
|
325
|
+
randomFloatBetween(random, 0, Math.PI)
|
|
326
|
+
]);
|
|
261
327
|
}
|
|
262
328
|
}
|
|
263
329
|
|
|
264
330
|
function prepare_scene_1() {
|
|
265
|
-
addPointLight(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
331
|
+
addPointLight({
|
|
332
|
+
position: [
|
|
333
|
+
0, 0, -3
|
|
334
|
+
], radius: 1, color: 0xFF0000
|
|
335
|
+
}
|
|
269
336
|
);
|
|
270
337
|
|
|
271
338
|
// tight planes around the light
|
|
@@ -277,10 +344,11 @@ function prepare_scene_1() {
|
|
|
277
344
|
}
|
|
278
345
|
|
|
279
346
|
function prepare_scene_3() {
|
|
280
|
-
addPointLight(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
347
|
+
addPointLight({
|
|
348
|
+
position: [
|
|
349
|
+
0, 0, -4
|
|
350
|
+
], radius: 1, color: 0xFF0000
|
|
351
|
+
}
|
|
284
352
|
);
|
|
285
353
|
|
|
286
354
|
// tight planes around the light
|
|
@@ -288,25 +356,25 @@ function prepare_scene_3() {
|
|
|
288
356
|
camera.far = 7;
|
|
289
357
|
|
|
290
358
|
addKnot([
|
|
291
|
-
|
|
292
|
-
|
|
359
|
+
0, 0, -4
|
|
360
|
+
], 1, [0, 0, 0]);
|
|
293
361
|
|
|
294
362
|
// camera.position.set(0, 0, 0);
|
|
295
363
|
camera.lookAt(0, 0, -5);
|
|
296
364
|
}
|
|
297
365
|
|
|
298
366
|
function prepare_scene_2() {
|
|
299
|
-
addPointLight(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
367
|
+
addPointLight({
|
|
368
|
+
position: [
|
|
369
|
+
1.5, 0, -4
|
|
370
|
+
], radius: 1.5, color: 0xFF0000, intensity: 1
|
|
371
|
+
}
|
|
304
372
|
);
|
|
305
|
-
addPointLight(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
373
|
+
addPointLight({
|
|
374
|
+
position: [
|
|
375
|
+
-1.5, 0, -4
|
|
376
|
+
], radius: 1.5, color: 0x00FF00, intensity: 1
|
|
377
|
+
}
|
|
310
378
|
);
|
|
311
379
|
|
|
312
380
|
addKnot([0, 0, -5], 1, [0, 0, 0]);
|
|
@@ -323,17 +391,17 @@ function prepare_scene_5() {
|
|
|
323
391
|
const offset = new Vector3(100, 100, 100);
|
|
324
392
|
|
|
325
393
|
|
|
326
|
-
addPointLight(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
394
|
+
addPointLight({
|
|
395
|
+
position: [
|
|
396
|
+
1.5 + offset.x, 0 + offset.y, -4 + offset.z
|
|
397
|
+
], radius: 1.5, color: 0xFF0000, intensity: 10
|
|
398
|
+
}
|
|
331
399
|
);
|
|
332
|
-
addPointLight(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
400
|
+
addPointLight({
|
|
401
|
+
position: [
|
|
402
|
+
-1.5 + offset.x, 0 + offset.y, -4 + offset.z
|
|
403
|
+
], radius: 1.5, color: 0x00FF00, intensity: 10
|
|
404
|
+
}
|
|
337
405
|
);
|
|
338
406
|
|
|
339
407
|
addKnot(
|
|
@@ -355,11 +423,10 @@ function prepare_scene_5() {
|
|
|
355
423
|
}
|
|
356
424
|
|
|
357
425
|
|
|
358
|
-
|
|
359
426
|
function addSponza() {
|
|
360
427
|
const loader = new GLTFLoader();
|
|
361
428
|
|
|
362
|
-
loader.load("data/models/sponza-pbr/sponza.glb", (gltf) => {
|
|
429
|
+
loader.load("data/models/sponza-pbr/gltf/sponza.glb", (gltf) => {
|
|
363
430
|
|
|
364
431
|
gltf.scene.traverse(m => {
|
|
365
432
|
if (m.isLight) {
|
|
@@ -406,8 +473,8 @@ function addSponza() {
|
|
|
406
473
|
|
|
407
474
|
function prepare_scene_4() {
|
|
408
475
|
|
|
409
|
-
controls.target.set(2.1731179577352857,
|
|
410
|
-
camera.position.set(-
|
|
476
|
+
controls.target.set(2.1731179577352857, 2.4, -0.26);
|
|
477
|
+
camera.position.set(-8, 3.3, -0.26);
|
|
411
478
|
|
|
412
479
|
camera.near = 1;
|
|
413
480
|
camera.far = 50;
|
|
@@ -417,16 +484,19 @@ function prepare_scene_4() {
|
|
|
417
484
|
controls.update();
|
|
418
485
|
|
|
419
486
|
|
|
420
|
-
for (let i = 0; i <
|
|
487
|
+
for (let i = 0; i < 500; i++) {
|
|
421
488
|
const radius = randomFloatBetween(random, 2, 2);
|
|
422
|
-
addPointLight(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
489
|
+
addPointLight({
|
|
490
|
+
position: [
|
|
491
|
+
randomFloatBetween(random, -17, 17),
|
|
492
|
+
randomFloatBetween(random, -2, 13),
|
|
493
|
+
randomFloatBetween(random, -10, 10),
|
|
494
|
+
],
|
|
495
|
+
radius: radius,
|
|
496
|
+
color: `hsv(${random().toFixed(4)}, 0.8, 1)`,
|
|
497
|
+
intensity: randomFloatBetween(random, 6, 6),
|
|
498
|
+
wander: true
|
|
499
|
+
}
|
|
430
500
|
);
|
|
431
501
|
}
|
|
432
502
|
|
|
@@ -459,14 +529,13 @@ function prepare_scene_6() {
|
|
|
459
529
|
controls.update();
|
|
460
530
|
|
|
461
531
|
|
|
462
|
-
addPointLight(
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
3
|
|
532
|
+
addPointLight({
|
|
533
|
+
position: [
|
|
534
|
+
11,
|
|
535
|
+
1,
|
|
536
|
+
0,
|
|
537
|
+
], radius: 2, color: `hsv(0.5, 0.8, 1)`, intensity: 3
|
|
538
|
+
}
|
|
470
539
|
);
|
|
471
540
|
|
|
472
541
|
//
|
|
@@ -488,9 +557,9 @@ function prepare_scene_6() {
|
|
|
488
557
|
|
|
489
558
|
function prepare_scene_7() {
|
|
490
559
|
addSpotLight([
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
560
|
+
0, 0, -3
|
|
561
|
+
], [0, 0, 1],
|
|
562
|
+
0xFF0000
|
|
494
563
|
);
|
|
495
564
|
|
|
496
565
|
// tight planes around the light
|
|
@@ -513,8 +582,8 @@ console.log("done");
|
|
|
513
582
|
|
|
514
583
|
|
|
515
584
|
const renderer = new WebGLRenderer({
|
|
516
|
-
|
|
517
|
-
|
|
585
|
+
antialias: true
|
|
586
|
+
});
|
|
518
587
|
// renderer.shadowMap.type = VSMShadowMap;
|
|
519
588
|
// renderer.shadowMap.enabled = true;
|
|
520
589
|
renderer.sortObjects = false;
|
|
@@ -540,8 +609,12 @@ camera.aspect = window.innerWidth / window.innerHeight;
|
|
|
540
609
|
camera.updateProjectionMatrix();
|
|
541
610
|
|
|
542
611
|
|
|
543
|
-
scene.add(new GridHelper());
|
|
544
|
-
scene.background = new Color(0x666666);
|
|
612
|
+
// scene.add(new GridHelper());
|
|
613
|
+
// scene.background = new Color(0x666666);
|
|
614
|
+
|
|
615
|
+
const stats = new Stats();
|
|
616
|
+
stats.dom.style.cssText = 'position:fixed;top:0;right:0;cursor:pointer;opacity:0.9;z-index:10000';
|
|
617
|
+
document.body.appendChild(stats.dom);
|
|
545
618
|
|
|
546
619
|
const controls = new OrbitControls(camera, renderer.domElement);
|
|
547
620
|
|
|
@@ -585,10 +658,17 @@ function animate() {
|
|
|
585
658
|
material_fp_standard.uniforms.fp_f_camera_near.value = camera.near;
|
|
586
659
|
material_fp_standard.uniforms.fp_f_camera_far.value = camera.far;
|
|
587
660
|
|
|
661
|
+
|
|
662
|
+
renderer.getSize(scratch_v2);
|
|
663
|
+
scratch_v2.multiplyScalar(renderer.getPixelRatio());
|
|
664
|
+
|
|
588
665
|
fp_materials.forEach(m => {
|
|
589
666
|
|
|
590
667
|
m.uniforms.fp_f_camera_near.value = camera.near;
|
|
591
668
|
m.uniforms.fp_f_camera_far.value = camera.far;
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
m.uniforms.resolution.value.set(scratch_v2.x, scratch_v2.y);
|
|
592
672
|
});
|
|
593
673
|
|
|
594
674
|
lightClusterWidget.update();
|
|
@@ -596,7 +676,9 @@ function animate() {
|
|
|
596
676
|
|
|
597
677
|
renderer.render(scene, camera);
|
|
598
678
|
|
|
679
|
+
on_render.send6(renderer, camera, scene, time_delta, t);
|
|
599
680
|
|
|
681
|
+
stats.update();
|
|
600
682
|
}
|
|
601
683
|
|
|
602
684
|
const metrics = new MetricCollection();
|
|
@@ -627,20 +709,20 @@ function print_perf_stats() {
|
|
|
627
709
|
setInterval(print_perf_stats, 2000);
|
|
628
710
|
|
|
629
711
|
function do_sample() {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
712
|
+
query_bvh_frustum_from_objects.iteration_count = 0;
|
|
713
|
+
query_bvh_frustum_from_objects.rejection_count = 0;
|
|
714
|
+
query_bvh_frustum_from_objects.rejection_sphere_count = 0;
|
|
715
|
+
query_bvh_frustum_from_objects.plane_tests = 0;
|
|
716
|
+
query_bvh_frustum_from_objects.plane_tests_early_exits = 0;
|
|
635
717
|
|
|
636
718
|
const t0 = performance.now();
|
|
637
719
|
lm.buildTiles(camera);
|
|
638
720
|
const t1 = performance.now();
|
|
639
721
|
|
|
640
722
|
metrics.get("time").record(t1 - t0);
|
|
641
|
-
metrics.get("iterations").record(
|
|
642
|
-
metrics.get("rejections").record(
|
|
643
|
-
metrics.get("sphere_rejections").record(
|
|
723
|
+
metrics.get("iterations").record(query_bvh_frustum_from_objects.iteration_count);
|
|
724
|
+
metrics.get("rejections").record(query_bvh_frustum_from_objects.rejection_count);
|
|
725
|
+
metrics.get("sphere_rejections").record(query_bvh_frustum_from_objects.rejection_sphere_count);
|
|
644
726
|
}
|
|
645
727
|
|
|
646
728
|
function draw_camera_view_planes() {
|
|
@@ -653,7 +735,7 @@ function draw_camera_view_planes() {
|
|
|
653
735
|
});
|
|
654
736
|
}
|
|
655
737
|
|
|
656
|
-
|
|
738
|
+
prepare_scene_4();
|
|
657
739
|
animate();
|
|
658
740
|
|
|
659
741
|
// draw_camera_view_planes();
|
|
@@ -679,32 +761,32 @@ renderer.domElement.addEventListener(MouseEvents.DoubleClick, () => {
|
|
|
679
761
|
});
|
|
680
762
|
|
|
681
763
|
domify(lightClusterWidget.domElement).css({
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
764
|
+
position: "absolute",
|
|
765
|
+
zIndex: 2,
|
|
766
|
+
bottom: 0,
|
|
767
|
+
right: 0
|
|
768
|
+
});
|
|
687
769
|
|
|
688
770
|
document.body.appendChild(lightClusterWidget.domElement);
|
|
689
771
|
|
|
690
772
|
const debugger_button = new ButtonView({
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
773
|
+
action() {
|
|
774
|
+
if (screenGrid.domElement.parentNode !== null) {
|
|
775
|
+
document.body.removeChild(screenGrid.domElement);
|
|
776
|
+
} else {
|
|
777
|
+
document.body.appendChild(screenGrid.domElement);
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
name: "debugger",
|
|
781
|
+
css: {
|
|
782
|
+
position: "absolute",
|
|
783
|
+
color: "white",
|
|
784
|
+
background: "rgba(0,0,0,0.5)",
|
|
785
|
+
zIndex: 2,
|
|
786
|
+
top: 0,
|
|
787
|
+
left: 0
|
|
788
|
+
}
|
|
789
|
+
});
|
|
708
790
|
|
|
709
791
|
debugger_button.link();
|
|
710
792
|
|
|
@@ -713,3 +795,16 @@ document.body.appendChild(debugger_button.el);
|
|
|
713
795
|
const layerSwitcher = createLayerSwitcher(camera);
|
|
714
796
|
|
|
715
797
|
document.body.appendChild(layerSwitcher.domElement);
|
|
798
|
+
|
|
799
|
+
function onWindowResize() {
|
|
800
|
+
|
|
801
|
+
const w = window.innerWidth;
|
|
802
|
+
const h = window.innerHeight;
|
|
803
|
+
|
|
804
|
+
camera.aspect = w / h;
|
|
805
|
+
camera.updateProjectionMatrix();
|
|
806
|
+
|
|
807
|
+
renderer.setSize(w, h);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
window.addEventListener("resize", onWindowResize);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const _lut_array_buffer = new ArrayBuffer(84);
|
|
2
|
+
/**
|
|
3
|
+
* Mapping from 3 plane bitfield, corresponding to intersection point of the planes
|
|
4
|
+
* @type {number[]}
|
|
5
|
+
*/
|
|
6
|
+
export const triplanar_corner_mapping = new Uint8Array(_lut_array_buffer, 0, 43);
|
|
7
|
+
|
|
8
|
+
triplanar_corner_mapping[0b010101] = 0;
|
|
9
|
+
triplanar_corner_mapping[0b100101] = 1;
|
|
10
|
+
triplanar_corner_mapping[0b011001] = 2;
|
|
11
|
+
triplanar_corner_mapping[0b101001] = 3;
|
|
12
|
+
triplanar_corner_mapping[0b010110] = 4;
|
|
13
|
+
triplanar_corner_mapping[0b100110] = 5;
|
|
14
|
+
triplanar_corner_mapping[0b011010] = 6;
|
|
15
|
+
triplanar_corner_mapping[0b101010] = 7;
|
|
16
|
+
/**
|
|
17
|
+
* Mapping from 2 plane bitfield to 2 corner bitfield, corresponding to corner indices of intersecting planes
|
|
18
|
+
* @type {number[]}
|
|
19
|
+
*/
|
|
20
|
+
export const biplanar_edge_mapping = new Uint8Array(_lut_array_buffer, 43, 41);
|
|
21
|
+
|
|
22
|
+
biplanar_edge_mapping[0b000101] = 0 | (1 << 3);
|
|
23
|
+
biplanar_edge_mapping[0b000110] = 4 | (5 << 3);
|
|
24
|
+
|
|
25
|
+
biplanar_edge_mapping[0b001001] = 2 | (3 << 3);
|
|
26
|
+
biplanar_edge_mapping[0b001010] = 6 | (7 << 3);
|
|
27
|
+
|
|
28
|
+
biplanar_edge_mapping[0b010100] = 0 | (4 << 3);
|
|
29
|
+
biplanar_edge_mapping[0b011000] = 2 | (6 << 3);
|
|
30
|
+
|
|
31
|
+
biplanar_edge_mapping[0b100100] = 1 | (5 << 3);
|
|
32
|
+
biplanar_edge_mapping[0b101000] = 3 | (7 << 3);
|
|
33
|
+
|
|
34
|
+
biplanar_edge_mapping[0b010001] = 0 | (2 << 3);
|
|
35
|
+
biplanar_edge_mapping[0b010010] = 4 | (6 << 3);
|
|
36
|
+
|
|
37
|
+
biplanar_edge_mapping[0b100001] = 1 | (3 << 3);
|
|
38
|
+
biplanar_edge_mapping[0b100010] = 5 | (7 << 3);
|