super-three 0.167.0 → 0.169.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/three.cjs +532 -173
- package/build/three.module.js +532 -174
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +18173 -14266
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +79941 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/jsm/Addons.js +0 -4
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +777 -786
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +469 -448
- package/examples/jsm/controls/TransformControls.js +97 -62
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +1 -1
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +19 -11
- package/examples/jsm/exporters/GLTFExporter.js +6 -1
- package/examples/jsm/exporters/KTX2Exporter.js +21 -13
- package/examples/jsm/exporters/OBJExporter.js +5 -1
- package/examples/jsm/exporters/PLYExporter.js +9 -7
- package/examples/jsm/exporters/USDZExporter.js +29 -8
- package/examples/jsm/geometries/DecalGeometry.js +4 -1
- package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
- package/examples/jsm/helpers/LightProbeHelper.js +43 -44
- package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
- package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lights/LightProbeGenerator.js +24 -10
- package/examples/jsm/loaders/ColladaLoader.js +9 -6
- package/examples/jsm/loaders/DRACOLoader.js +3 -1
- package/examples/jsm/loaders/FBXLoader.js +30 -20
- package/examples/jsm/loaders/GLTFLoader.js +5 -10
- package/examples/jsm/loaders/KTX2Loader.js +27 -12
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +40 -14
- package/examples/jsm/loaders/OBJLoader.js +5 -3
- package/examples/jsm/loaders/PCDLoader.js +14 -13
- package/examples/jsm/loaders/PDBLoader.js +3 -2
- package/examples/jsm/loaders/PLYLoader.js +8 -5
- package/examples/jsm/loaders/STLLoader.js +3 -2
- package/examples/jsm/loaders/VRMLLoader.js +10 -10
- package/examples/jsm/loaders/VTKLoader.js +4 -3
- package/examples/jsm/loaders/XYZLoader.js +3 -2
- package/examples/jsm/misc/Timer.js +1 -1
- package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
- package/examples/jsm/objects/LensflareMesh.js +322 -0
- package/examples/jsm/objects/SkyMesh.js +187 -0
- package/examples/jsm/objects/Water2Mesh.js +158 -0
- package/examples/jsm/objects/WaterMesh.js +101 -0
- package/examples/jsm/physics/JoltPhysics.js +1 -1
- package/examples/jsm/physics/RapierPhysics.js +21 -1
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
- package/examples/jsm/transpiler/TSLEncoder.js +8 -8
- package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
- package/examples/jsm/utils/ShadowMapViewer.js +3 -8
- package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
- package/examples/jsm/utils/SkeletonUtils.js +84 -66
- package/examples/jsm/utils/TextureUtils.js +2 -1
- package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/package.json +3 -2
- package/src/Three.WebGPU.Nodes.js +200 -0
- package/src/Three.WebGPU.js +7 -0
- package/src/Three.js +1 -0
- package/src/audio/Audio.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +0 -9
- package/src/core/Clock.js +1 -1
- package/src/core/InterleavedBuffer.js +0 -9
- package/src/extras/Controls.js +32 -0
- package/src/geometries/CylinderGeometry.js +11 -4
- package/src/loaders/MaterialLoader.js +7 -1
- package/src/loaders/ObjectLoader.js +3 -3
- package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +25 -5
- package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +21 -18
- package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +19 -0
- package/src/materials/Material.js +4 -7
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +156 -0
- package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +56 -59
- package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +8 -5
- package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +12 -10
- package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +16 -12
- package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +10 -6
- package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +13 -9
- package/src/{nodes/materials → materials/nodes}/MeshNormalNodeMaterial.js +13 -9
- package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +14 -9
- package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +22 -18
- package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +10 -7
- package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +22 -12
- package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +9 -5
- package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +71 -115
- package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +3 -1
- package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +8 -5
- package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +9 -5
- package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +47 -14
- package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +24 -22
- package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
- package/src/math/Triangle.js +24 -0
- package/src/nodes/Nodes.js +103 -159
- package/src/nodes/TSL.js +179 -0
- package/src/nodes/accessors/AccessorsUtils.js +8 -8
- package/src/nodes/accessors/BatchNode.js +53 -21
- package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
- package/src/nodes/accessors/BufferAttributeNode.js +8 -5
- package/src/nodes/accessors/BufferNode.js +7 -4
- package/src/nodes/accessors/Camera.js +13 -0
- package/src/nodes/accessors/ClippingNode.js +19 -13
- package/src/nodes/accessors/CubeTextureNode.js +9 -8
- package/src/nodes/accessors/InstanceNode.js +19 -15
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +8 -5
- package/src/nodes/accessors/Lights.js +51 -0
- package/src/nodes/accessors/MaterialNode.js +56 -55
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +9 -4
- package/src/nodes/accessors/ModelNode.js +47 -12
- package/src/nodes/accessors/ModelViewProjectionNode.js +12 -9
- package/src/nodes/accessors/MorphNode.js +17 -13
- package/src/nodes/accessors/Normal.js +88 -0
- package/src/nodes/accessors/Object3DNode.js +17 -33
- package/src/nodes/accessors/PointUVNode.js +9 -5
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +171 -0
- package/src/nodes/accessors/ReferenceNode.js +50 -7
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +12 -6
- package/src/nodes/accessors/SceneNode.js +9 -6
- package/src/nodes/accessors/SkinningNode.js +88 -21
- package/src/nodes/accessors/StorageBufferNode.js +22 -5
- package/src/nodes/accessors/StorageTextureNode.js +9 -6
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +16 -13
- package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
- package/src/nodes/accessors/TextureNode.js +29 -23
- package/src/nodes/accessors/TextureSizeNode.js +10 -9
- package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +26 -14
- package/src/nodes/accessors/UserDataNode.js +10 -7
- package/src/nodes/accessors/VelocityNode.js +134 -0
- package/src/nodes/accessors/VertexColorNode.js +7 -4
- package/src/nodes/code/CodeNode.js +9 -5
- package/src/nodes/code/ExpressionNode.js +10 -6
- package/src/nodes/code/FunctionCallNode.js +8 -5
- package/src/nodes/code/FunctionNode.js +8 -23
- package/src/nodes/code/ScriptableNode.js +13 -10
- package/src/nodes/code/ScriptableValueNode.js +9 -7
- package/src/nodes/core/AssignNode.js +12 -9
- package/src/nodes/core/AttributeNode.js +12 -21
- package/src/nodes/core/BypassNode.js +11 -7
- package/src/nodes/core/CacheNode.js +10 -6
- package/src/nodes/core/ConstNode.js +6 -3
- package/src/nodes/core/ContextNode.js +21 -11
- package/src/nodes/core/IndexNode.js +35 -8
- package/src/nodes/core/InputNode.js +7 -3
- package/src/nodes/core/MRTNode.js +16 -7
- package/src/nodes/core/Node.js +19 -40
- package/src/nodes/core/NodeBuilder.js +117 -38
- package/src/nodes/core/NodeUtils.js +49 -6
- package/src/nodes/core/OutputStructNode.js +10 -6
- package/src/nodes/core/ParameterNode.js +7 -4
- package/src/nodes/core/PropertyNode.js +36 -32
- package/src/nodes/core/StackNode.js +31 -11
- package/src/nodes/core/StructTypeNode.js +7 -3
- package/src/nodes/core/TempNode.js +8 -4
- package/src/nodes/core/UniformGroupNode.js +14 -11
- package/src/nodes/core/UniformNode.js +7 -4
- package/src/nodes/core/VarNode.js +12 -8
- package/src/nodes/core/VaryingNode.js +10 -6
- package/src/nodes/display/AfterImageNode.js +15 -9
- package/src/nodes/display/AnaglyphPassNode.js +67 -0
- package/src/nodes/display/AnamorphicNode.js +17 -11
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +27 -19
- package/src/nodes/display/BumpMapNode.js +13 -12
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +67 -61
- package/src/nodes/display/DenoiseNode.js +23 -17
- package/src/nodes/display/DepthOfFieldNode.js +12 -7
- package/src/nodes/display/DotScreenNode.js +13 -22
- package/src/nodes/display/FXAANode.js +21 -16
- package/src/nodes/display/FilmNode.js +11 -7
- package/src/nodes/display/FrontFacingNode.js +10 -6
- package/src/nodes/display/GTAONode.js +22 -15
- package/src/nodes/display/GaussianBlurNode.js +14 -8
- package/src/nodes/display/Lut3DNode.js +10 -6
- package/src/nodes/display/MotionBlur.js +25 -0
- package/src/nodes/display/NormalMapNode.js +13 -13
- package/src/nodes/display/ParallaxBarrierPassNode.js +58 -0
- package/src/nodes/display/PassNode.js +95 -8
- package/src/nodes/display/PixelationPassNode.js +20 -8
- package/src/nodes/display/PosterizeNode.js +8 -7
- package/src/nodes/display/RGBShiftNode.js +11 -7
- package/src/nodes/display/RenderOutputNode.js +15 -11
- package/src/nodes/display/SSAAPassNode.js +287 -0
- package/src/nodes/display/ScreenNode.js +181 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +13 -8
- package/src/nodes/display/StereoCompositePassNode.js +110 -0
- package/src/nodes/display/StereoPassNode.js +83 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +15 -175
- package/src/nodes/display/ToonOutlinePassNode.js +111 -0
- package/src/nodes/display/TransitionNode.js +12 -8
- package/src/nodes/display/ViewportDepthNode.js +34 -29
- package/src/nodes/display/ViewportDepthTextureNode.js +10 -9
- package/src/nodes/display/ViewportSharedTextureNode.js +10 -9
- package/src/nodes/display/ViewportTextureNode.js +11 -11
- package/src/nodes/fog/FogExp2Node.js +8 -7
- package/src/nodes/fog/FogNode.js +10 -8
- package/src/nodes/fog/FogRangeNode.js +8 -7
- package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
- package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +6 -6
- package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/BasicLightingModel.js +1 -1
- package/src/nodes/functions/PhongLightingModel.js +5 -5
- package/src/nodes/functions/PhysicalLightingModel.js +34 -33
- package/src/nodes/functions/ShadowMaskModel.js +1 -1
- package/src/nodes/functions/ToonLightingModel.js +3 -3
- package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
- package/src/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/src/nodes/geometry/RangeNode.js +9 -5
- package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
- package/src/nodes/gpgpu/BarrierNode.js +40 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
- package/src/nodes/gpgpu/ComputeNode.js +10 -6
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
- package/src/nodes/lighting/AONode.js +6 -3
- package/src/nodes/lighting/AmbientLightNode.js +6 -8
- package/src/nodes/lighting/AnalyticLightNode.js +225 -36
- package/src/nodes/lighting/BasicEnvironmentNode.js +8 -4
- package/src/nodes/lighting/BasicLightMapNode.js +7 -4
- package/src/nodes/lighting/DirectionalLightNode.js +7 -9
- package/src/nodes/lighting/EnvironmentNode.js +23 -19
- package/src/nodes/lighting/HemisphereLightNode.js +11 -11
- package/src/nodes/lighting/IESSpotLightNode.js +7 -9
- package/src/nodes/lighting/IrradianceNode.js +6 -3
- package/src/nodes/lighting/LightProbeNode.js +53 -0
- package/src/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +19 -18
- package/src/nodes/lighting/LightingNode.js +7 -3
- package/src/nodes/lighting/LightsNode.js +112 -75
- package/src/nodes/lighting/PointLightNode.js +12 -13
- package/src/nodes/lighting/RectAreaLightNode.js +11 -11
- package/src/nodes/lighting/SpotLightNode.js +14 -16
- package/src/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +36 -31
- package/src/nodes/materialx/lib/mx_noise.js +96 -96
- package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
- package/src/nodes/math/{CondNode.js → ConditionalNode.js} +38 -10
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +127 -124
- package/src/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +97 -52
- package/src/nodes/math/TriNoise3D.js +19 -29
- package/src/nodes/pmrem/PMREMNode.js +61 -15
- package/src/nodes/pmrem/PMREMUtils.js +46 -46
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
- package/src/nodes/utils/ArrayElementNode.js +8 -4
- package/src/nodes/utils/ConvertNode.js +7 -3
- package/src/nodes/utils/CubeMapNode.js +160 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +9 -6
- package/src/nodes/utils/FlipNode.js +68 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +9 -5
- package/src/nodes/utils/JoinNode.js +6 -3
- package/src/nodes/utils/LoopNode.js +16 -6
- package/src/nodes/utils/MatcapUVNode.js +10 -7
- package/src/nodes/utils/MaxMipLevelNode.js +8 -5
- package/src/nodes/utils/OscNode.js +12 -8
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +11 -8
- package/src/nodes/utils/ReflectorNode.js +12 -4
- package/src/nodes/utils/RemapNode.js +12 -8
- package/src/nodes/utils/RotateNode.js +8 -13
- package/src/nodes/utils/SetNode.js +7 -4
- package/src/nodes/utils/SplitNode.js +7 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +10 -6
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/src/nodes/utils/StorageArrayElementNode.js +11 -12
- package/src/nodes/utils/TimerNode.js +8 -5
- package/src/nodes/utils/TriplanarTexturesNode.js +11 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +78 -13
- package/src/objects/LOD.js +21 -0
- package/src/objects/Line.js +1 -0
- package/src/objects/Mesh.js +7 -23
- package/src/objects/Points.js +2 -0
- package/src/renderers/WebGLRenderer.js +88 -41
- package/src/renderers/common/Backend.js +2 -2
- package/src/renderers/common/Background.js +3 -1
- package/src/renderers/common/BindGroup.js +3 -1
- package/src/renderers/common/Bindings.js +13 -15
- package/src/renderers/common/BundleGroup.js +26 -0
- package/src/renderers/common/ClippingContext.js +15 -5
- package/src/renderers/common/CubeRenderTarget.js +9 -3
- package/src/renderers/common/PostProcessing.js +4 -1
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderContext.js +23 -0
- package/src/renderers/common/RenderList.js +1 -1
- package/src/renderers/common/RenderObject.js +117 -6
- package/src/renderers/common/RenderObjects.js +8 -1
- package/src/renderers/common/Renderer.js +128 -94
- package/src/renderers/common/SampledTexture.js +12 -3
- package/src/renderers/common/Textures.js +8 -12
- package/src/renderers/common/extras/PMREMGenerator.js +19 -22
- package/src/renderers/common/nodes/NodeBuilderState.js +4 -4
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
- package/src/renderers/common/nodes/Nodes.js +65 -19
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
- package/src/renderers/webgl/WebGLAttributes.js +45 -14
- package/src/renderers/webgl/WebGLCapabilities.js +9 -0
- package/src/renderers/webgl/WebGLProgram.js +3 -1
- package/src/renderers/webgl/WebGLPrograms.js +21 -17
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLState.js +21 -0
- package/src/renderers/webgl/WebGLTextures.js +83 -4
- package/src/renderers/webgl-fallback/WebGLBackend.js +135 -110
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +60 -12
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +6 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +20 -2
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +89 -37
- package/src/renderers/webgpu/WebGPUBackend.js +112 -86
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
- package/src/renderers/webgpu/WebGPURenderer.js +9 -6
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +105 -0
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +189 -73
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +6 -16
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +7 -16
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +43 -26
- package/src/renderers/webgpu/utils/WebGPUUtils.js +19 -2
- package/src/renderers/webxr/WebXRManager.js +32 -25
- package/src/utils.js +33 -1
- package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/examples/jsm/loaders/TiltLoader.js +0 -520
- package/examples/jsm/utils/GPUStatsPanel.js +0 -95
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
- package/src/nodes/accessors/CameraNode.js +0 -19
- package/src/nodes/accessors/NormalNode.js +0 -14
- package/src/nodes/accessors/PositionNode.js +0 -10
- package/src/nodes/accessors/ReflectVectorNode.js +0 -10
- package/src/nodes/accessors/TangentNode.js +0 -23
- package/src/nodes/core/NodeKeywords.js +0 -80
- package/src/nodes/display/BlendModeNode.js +0 -128
- package/src/nodes/display/ColorAdjustmentNode.js +0 -104
- package/src/nodes/display/ViewportNode.js +0 -137
- package/src/nodes/lighting/LightNode.js +0 -57
- package/src/nodes/materials/InstancedPointsNodeMaterial.js +0 -162
- package/src/nodes/math/HashNode.js +0 -34
- package/src/nodes/procedural/CheckerNode.js +0 -42
- package/src/nodes/utils/DiscardNode.js +0 -28
- package/src/nodes/utils/PackingNode.js +0 -55
- package/src/nodes/utils/RotateUVNode.js +0 -35
- /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
package/build/three.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const REVISION = '
|
|
8
|
+
const REVISION = '169';
|
|
9
9
|
|
|
10
10
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
11
11
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -1594,6 +1594,38 @@ function probeAsync( gl, sync, interval ) {
|
|
|
1594
1594
|
|
|
1595
1595
|
}
|
|
1596
1596
|
|
|
1597
|
+
function toNormalizedProjectionMatrix( projectionMatrix ) {
|
|
1598
|
+
|
|
1599
|
+
const m = projectionMatrix.elements;
|
|
1600
|
+
|
|
1601
|
+
// Convert [-1, 1] to [0, 1] projection matrix
|
|
1602
|
+
m[ 2 ] = 0.5 * m[ 2 ] + 0.5 * m[ 3 ];
|
|
1603
|
+
m[ 6 ] = 0.5 * m[ 6 ] + 0.5 * m[ 7 ];
|
|
1604
|
+
m[ 10 ] = 0.5 * m[ 10 ] + 0.5 * m[ 11 ];
|
|
1605
|
+
m[ 14 ] = 0.5 * m[ 14 ] + 0.5 * m[ 15 ];
|
|
1606
|
+
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
function toReversedProjectionMatrix( projectionMatrix ) {
|
|
1610
|
+
|
|
1611
|
+
const m = projectionMatrix.elements;
|
|
1612
|
+
const isPerspectiveMatrix = m[ 11 ] === - 1;
|
|
1613
|
+
|
|
1614
|
+
// Reverse [0, 1] projection matrix
|
|
1615
|
+
if ( isPerspectiveMatrix ) {
|
|
1616
|
+
|
|
1617
|
+
m[ 10 ] = - m[ 10 ] - 1;
|
|
1618
|
+
m[ 14 ] = - m[ 14 ];
|
|
1619
|
+
|
|
1620
|
+
} else {
|
|
1621
|
+
|
|
1622
|
+
m[ 10 ] = - m[ 10 ];
|
|
1623
|
+
m[ 14 ] = - m[ 14 ] + 1;
|
|
1624
|
+
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1597
1629
|
/**
|
|
1598
1630
|
* Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
|
|
1599
1631
|
* or clipping. Based on W3C specifications for sRGB and Display P3,
|
|
@@ -8189,6 +8221,10 @@ const _vap = /*@__PURE__*/ new Vector3();
|
|
|
8189
8221
|
const _vbp = /*@__PURE__*/ new Vector3();
|
|
8190
8222
|
const _vcp = /*@__PURE__*/ new Vector3();
|
|
8191
8223
|
|
|
8224
|
+
const _v40 = /*@__PURE__*/ new Vector4();
|
|
8225
|
+
const _v41 = /*@__PURE__*/ new Vector4();
|
|
8226
|
+
const _v42 = /*@__PURE__*/ new Vector4();
|
|
8227
|
+
|
|
8192
8228
|
class Triangle {
|
|
8193
8229
|
|
|
8194
8230
|
constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
|
|
@@ -8283,6 +8319,25 @@ class Triangle {
|
|
|
8283
8319
|
|
|
8284
8320
|
}
|
|
8285
8321
|
|
|
8322
|
+
static getInterpolatedAttribute( attr, i1, i2, i3, barycoord, target ) {
|
|
8323
|
+
|
|
8324
|
+
_v40.setScalar( 0 );
|
|
8325
|
+
_v41.setScalar( 0 );
|
|
8326
|
+
_v42.setScalar( 0 );
|
|
8327
|
+
|
|
8328
|
+
_v40.fromBufferAttribute( attr, i1 );
|
|
8329
|
+
_v41.fromBufferAttribute( attr, i2 );
|
|
8330
|
+
_v42.fromBufferAttribute( attr, i3 );
|
|
8331
|
+
|
|
8332
|
+
target.setScalar( 0 );
|
|
8333
|
+
target.addScaledVector( _v40, barycoord.x );
|
|
8334
|
+
target.addScaledVector( _v41, barycoord.y );
|
|
8335
|
+
target.addScaledVector( _v42, barycoord.z );
|
|
8336
|
+
|
|
8337
|
+
return target;
|
|
8338
|
+
|
|
8339
|
+
}
|
|
8340
|
+
|
|
8286
8341
|
static isFrontFacing( a, b, c, direction ) {
|
|
8287
8342
|
|
|
8288
8343
|
_v0$2.subVectors( c, b );
|
|
@@ -9200,6 +9255,10 @@ class Material extends EventDispatcher {
|
|
|
9200
9255
|
|
|
9201
9256
|
}
|
|
9202
9257
|
|
|
9258
|
+
// onBeforeRender and onBeforeCompile only supported in WebGLRenderer
|
|
9259
|
+
|
|
9260
|
+
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}
|
|
9261
|
+
|
|
9203
9262
|
onBeforeCompile( /* shaderobject, renderer */ ) {}
|
|
9204
9263
|
|
|
9205
9264
|
customProgramCacheKey() {
|
|
@@ -9622,13 +9681,6 @@ class Material extends EventDispatcher {
|
|
|
9622
9681
|
|
|
9623
9682
|
}
|
|
9624
9683
|
|
|
9625
|
-
onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {
|
|
9626
|
-
|
|
9627
|
-
console.warn( 'Material: onBeforeRender() has been removed.' ); // @deprecated, r166
|
|
9628
|
-
|
|
9629
|
-
}
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
9684
|
}
|
|
9633
9685
|
|
|
9634
9686
|
class MeshBasicMaterial extends Material {
|
|
@@ -9901,7 +9953,6 @@ class BufferAttribute {
|
|
|
9901
9953
|
this.normalized = normalized;
|
|
9902
9954
|
|
|
9903
9955
|
this.usage = StaticDrawUsage;
|
|
9904
|
-
this._updateRange = { offset: 0, count: - 1 };
|
|
9905
9956
|
this.updateRanges = [];
|
|
9906
9957
|
this.gpuType = FloatType;
|
|
9907
9958
|
|
|
@@ -9917,13 +9968,6 @@ class BufferAttribute {
|
|
|
9917
9968
|
|
|
9918
9969
|
}
|
|
9919
9970
|
|
|
9920
|
-
get updateRange() {
|
|
9921
|
-
|
|
9922
|
-
warnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
9923
|
-
return this._updateRange;
|
|
9924
|
-
|
|
9925
|
-
}
|
|
9926
|
-
|
|
9927
9971
|
setUsage( value ) {
|
|
9928
9972
|
|
|
9929
9973
|
this.usage = value;
|
|
@@ -11568,14 +11612,6 @@ const _vC$1 = /*@__PURE__*/ new Vector3();
|
|
|
11568
11612
|
const _tempA = /*@__PURE__*/ new Vector3();
|
|
11569
11613
|
const _morphA = /*@__PURE__*/ new Vector3();
|
|
11570
11614
|
|
|
11571
|
-
const _uvA$1 = /*@__PURE__*/ new Vector2();
|
|
11572
|
-
const _uvB$1 = /*@__PURE__*/ new Vector2();
|
|
11573
|
-
const _uvC$1 = /*@__PURE__*/ new Vector2();
|
|
11574
|
-
|
|
11575
|
-
const _normalA = /*@__PURE__*/ new Vector3();
|
|
11576
|
-
const _normalB = /*@__PURE__*/ new Vector3();
|
|
11577
|
-
const _normalC = /*@__PURE__*/ new Vector3();
|
|
11578
|
-
|
|
11579
11615
|
const _intersectionPoint = /*@__PURE__*/ new Vector3();
|
|
11580
11616
|
const _intersectionPointWorld = /*@__PURE__*/ new Vector3();
|
|
11581
11617
|
|
|
@@ -11918,33 +11954,24 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
11918
11954
|
|
|
11919
11955
|
if ( intersection ) {
|
|
11920
11956
|
|
|
11921
|
-
|
|
11957
|
+
const barycoord = new Vector3();
|
|
11958
|
+
Triangle.getBarycoord( _intersectionPoint, _vA$1, _vB$1, _vC$1, barycoord );
|
|
11922
11959
|
|
|
11923
|
-
|
|
11924
|
-
_uvB$1.fromBufferAttribute( uv, b );
|
|
11925
|
-
_uvC$1.fromBufferAttribute( uv, c );
|
|
11960
|
+
if ( uv ) {
|
|
11926
11961
|
|
|
11927
|
-
intersection.uv = Triangle.
|
|
11962
|
+
intersection.uv = Triangle.getInterpolatedAttribute( uv, a, b, c, barycoord, new Vector2() );
|
|
11928
11963
|
|
|
11929
11964
|
}
|
|
11930
11965
|
|
|
11931
11966
|
if ( uv1 ) {
|
|
11932
11967
|
|
|
11933
|
-
|
|
11934
|
-
_uvB$1.fromBufferAttribute( uv1, b );
|
|
11935
|
-
_uvC$1.fromBufferAttribute( uv1, c );
|
|
11936
|
-
|
|
11937
|
-
intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
|
|
11968
|
+
intersection.uv1 = Triangle.getInterpolatedAttribute( uv1, a, b, c, barycoord, new Vector2() );
|
|
11938
11969
|
|
|
11939
11970
|
}
|
|
11940
11971
|
|
|
11941
11972
|
if ( normal ) {
|
|
11942
11973
|
|
|
11943
|
-
|
|
11944
|
-
_normalB.fromBufferAttribute( normal, b );
|
|
11945
|
-
_normalC.fromBufferAttribute( normal, c );
|
|
11946
|
-
|
|
11947
|
-
intersection.normal = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3() );
|
|
11974
|
+
intersection.normal = Triangle.getInterpolatedAttribute( normal, a, b, c, barycoord, new Vector3() );
|
|
11948
11975
|
|
|
11949
11976
|
if ( intersection.normal.dot( ray.direction ) > 0 ) {
|
|
11950
11977
|
|
|
@@ -11965,6 +11992,7 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
|
|
|
11965
11992
|
Triangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal );
|
|
11966
11993
|
|
|
11967
11994
|
intersection.face = face;
|
|
11995
|
+
intersection.barycoord = barycoord;
|
|
11968
11996
|
|
|
11969
11997
|
}
|
|
11970
11998
|
|
|
@@ -13608,40 +13636,71 @@ function WebGLAttributes( gl ) {
|
|
|
13608
13636
|
function updateBuffer( buffer, attribute, bufferType ) {
|
|
13609
13637
|
|
|
13610
13638
|
const array = attribute.array;
|
|
13611
|
-
const updateRange = attribute._updateRange; // @deprecated, r159
|
|
13612
13639
|
const updateRanges = attribute.updateRanges;
|
|
13613
13640
|
|
|
13614
13641
|
gl.bindBuffer( bufferType, buffer );
|
|
13615
13642
|
|
|
13616
|
-
if (
|
|
13643
|
+
if ( updateRanges.length === 0 ) {
|
|
13617
13644
|
|
|
13618
13645
|
// Not using update ranges
|
|
13619
13646
|
gl.bufferSubData( bufferType, 0, array );
|
|
13620
13647
|
|
|
13621
|
-
}
|
|
13648
|
+
} else {
|
|
13622
13649
|
|
|
13623
|
-
|
|
13650
|
+
// Before applying update ranges, we merge any adjacent / overlapping
|
|
13651
|
+
// ranges to reduce load on `gl.bufferSubData`. Empirically, this has led
|
|
13652
|
+
// to performance improvements for applications which make heavy use of
|
|
13653
|
+
// update ranges. Likely due to GPU command overhead.
|
|
13654
|
+
//
|
|
13655
|
+
// Note that to reduce garbage collection between frames, we merge the
|
|
13656
|
+
// update ranges in-place. This is safe because this method will clear the
|
|
13657
|
+
// update ranges once updated.
|
|
13624
13658
|
|
|
13625
|
-
|
|
13659
|
+
updateRanges.sort( ( a, b ) => a.start - b.start );
|
|
13660
|
+
|
|
13661
|
+
// To merge the update ranges in-place, we work from left to right in the
|
|
13662
|
+
// existing updateRanges array, merging ranges. This may result in a final
|
|
13663
|
+
// array which is smaller than the original. This index tracks the last
|
|
13664
|
+
// index representing a merged range, any data after this index can be
|
|
13665
|
+
// trimmed once the merge algorithm is completed.
|
|
13666
|
+
let mergeIndex = 0;
|
|
13626
13667
|
|
|
13668
|
+
for ( let i = 1; i < updateRanges.length; i ++ ) {
|
|
13669
|
+
|
|
13670
|
+
const previousRange = updateRanges[ mergeIndex ];
|
|
13627
13671
|
const range = updateRanges[ i ];
|
|
13628
13672
|
|
|
13629
|
-
|
|
13630
|
-
|
|
13673
|
+
// We add one here to merge adjacent ranges. This is safe because ranges
|
|
13674
|
+
// operate over positive integers.
|
|
13675
|
+
if ( range.start <= previousRange.start + previousRange.count + 1 ) {
|
|
13676
|
+
|
|
13677
|
+
previousRange.count = Math.max(
|
|
13678
|
+
previousRange.count,
|
|
13679
|
+
range.start + range.count - previousRange.start
|
|
13680
|
+
);
|
|
13681
|
+
|
|
13682
|
+
} else {
|
|
13683
|
+
|
|
13684
|
+
++ mergeIndex;
|
|
13685
|
+
updateRanges[ mergeIndex ] = range;
|
|
13686
|
+
|
|
13687
|
+
}
|
|
13631
13688
|
|
|
13632
13689
|
}
|
|
13633
13690
|
|
|
13634
|
-
|
|
13691
|
+
// Trim the array to only contain the merged ranges.
|
|
13692
|
+
updateRanges.length = mergeIndex + 1;
|
|
13635
13693
|
|
|
13636
|
-
|
|
13694
|
+
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
13637
13695
|
|
|
13638
|
-
|
|
13639
|
-
if ( updateRange.count !== - 1 ) {
|
|
13696
|
+
const range = updateRanges[ i ];
|
|
13640
13697
|
|
|
13641
|
-
|
|
13642
|
-
|
|
13698
|
+
gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
|
|
13699
|
+
array, range.start, range.count );
|
|
13643
13700
|
|
|
13644
|
-
|
|
13701
|
+
}
|
|
13702
|
+
|
|
13703
|
+
attribute.clearUpdateRanges();
|
|
13645
13704
|
|
|
13646
13705
|
}
|
|
13647
13706
|
|
|
@@ -14024,7 +14083,7 @@ var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D spe
|
|
|
14024
14083
|
|
|
14025
14084
|
var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
|
|
14026
14085
|
|
|
14027
|
-
var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3
|
|
14086
|
+
var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
|
|
14028
14087
|
|
|
14029
14088
|
var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
|
|
14030
14089
|
|
|
@@ -14102,7 +14161,7 @@ const vertex$2 = "#include <common>\n#include <batching_pars_vertex>\n#include <
|
|
|
14102
14161
|
|
|
14103
14162
|
const fragment$2 = "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
|
|
14104
14163
|
|
|
14105
|
-
const vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix
|
|
14164
|
+
const vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
|
|
14106
14165
|
|
|
14107
14166
|
const fragment$1 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
|
|
14108
14167
|
|
|
@@ -15868,6 +15927,14 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
15868
15927
|
}
|
|
15869
15928
|
|
|
15870
15929
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
15930
|
+
const reverseDepthBuffer = parameters.reverseDepthBuffer === true && extensions.has( 'EXT_clip_control' );
|
|
15931
|
+
|
|
15932
|
+
if ( reverseDepthBuffer === true ) {
|
|
15933
|
+
|
|
15934
|
+
const ext = extensions.get( 'EXT_clip_control' );
|
|
15935
|
+
ext.clipControlEXT( ext.LOWER_LEFT_EXT, ext.ZERO_TO_ONE_EXT );
|
|
15936
|
+
|
|
15937
|
+
}
|
|
15871
15938
|
|
|
15872
15939
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
15873
15940
|
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
@@ -15895,6 +15962,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
15895
15962
|
|
|
15896
15963
|
precision: precision,
|
|
15897
15964
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
15965
|
+
reverseDepthBuffer: reverseDepthBuffer,
|
|
15898
15966
|
|
|
15899
15967
|
maxTextures: maxTextures,
|
|
15900
15968
|
maxVertexTextures: maxVertexTextures,
|
|
@@ -19466,7 +19534,7 @@ function getToneMappingFunction( functionName, toneMapping ) {
|
|
|
19466
19534
|
break;
|
|
19467
19535
|
|
|
19468
19536
|
case CineonToneMapping:
|
|
19469
|
-
toneMappingName = '
|
|
19537
|
+
toneMappingName = 'Cineon';
|
|
19470
19538
|
break;
|
|
19471
19539
|
|
|
19472
19540
|
case ACESFilmicToneMapping:
|
|
@@ -20011,6 +20079,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20011
20079
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
20012
20080
|
|
|
20013
20081
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
20082
|
+
parameters.reverseDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
20014
20083
|
|
|
20015
20084
|
'uniform mat4 modelMatrix;',
|
|
20016
20085
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -20176,6 +20245,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
20176
20245
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
20177
20246
|
|
|
20178
20247
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
20248
|
+
parameters.reverseDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
20179
20249
|
|
|
20180
20250
|
'uniform mat4 viewMatrix;',
|
|
20181
20251
|
'uniform vec3 cameraPosition;',
|
|
@@ -20616,6 +20686,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20616
20686
|
const programs = [];
|
|
20617
20687
|
|
|
20618
20688
|
const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
|
|
20689
|
+
const reverseDepthBuffer = capabilities.reverseDepthBuffer;
|
|
20619
20690
|
const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
|
|
20620
20691
|
|
|
20621
20692
|
let precision = capabilities.precision;
|
|
@@ -20910,6 +20981,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
20910
20981
|
|
|
20911
20982
|
sizeAttenuation: material.sizeAttenuation === true,
|
|
20912
20983
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
20984
|
+
reverseDepthBuffer: reverseDepthBuffer,
|
|
20913
20985
|
|
|
20914
20986
|
skinning: object.isSkinnedMesh === true,
|
|
20915
20987
|
|
|
@@ -21129,40 +21201,42 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
21129
21201
|
_programLayers.enable( 2 );
|
|
21130
21202
|
if ( parameters.logarithmicDepthBuffer )
|
|
21131
21203
|
_programLayers.enable( 3 );
|
|
21132
|
-
if ( parameters.
|
|
21204
|
+
if ( parameters.reverseDepthBuffer )
|
|
21133
21205
|
_programLayers.enable( 4 );
|
|
21134
|
-
if ( parameters.
|
|
21206
|
+
if ( parameters.skinning )
|
|
21135
21207
|
_programLayers.enable( 5 );
|
|
21136
|
-
if ( parameters.
|
|
21208
|
+
if ( parameters.morphTargets )
|
|
21137
21209
|
_programLayers.enable( 6 );
|
|
21138
|
-
if ( parameters.
|
|
21210
|
+
if ( parameters.morphNormals )
|
|
21139
21211
|
_programLayers.enable( 7 );
|
|
21140
|
-
if ( parameters.
|
|
21212
|
+
if ( parameters.morphColors )
|
|
21141
21213
|
_programLayers.enable( 8 );
|
|
21142
|
-
if ( parameters.
|
|
21214
|
+
if ( parameters.premultipliedAlpha )
|
|
21143
21215
|
_programLayers.enable( 9 );
|
|
21144
|
-
if ( parameters.
|
|
21216
|
+
if ( parameters.shadowMapEnabled )
|
|
21145
21217
|
_programLayers.enable( 10 );
|
|
21146
|
-
if ( parameters.
|
|
21218
|
+
if ( parameters.doubleSided )
|
|
21147
21219
|
_programLayers.enable( 11 );
|
|
21148
|
-
if ( parameters.
|
|
21220
|
+
if ( parameters.flipSided )
|
|
21149
21221
|
_programLayers.enable( 12 );
|
|
21150
|
-
if ( parameters.
|
|
21222
|
+
if ( parameters.useDepthPacking )
|
|
21151
21223
|
_programLayers.enable( 13 );
|
|
21152
|
-
if ( parameters.
|
|
21224
|
+
if ( parameters.dithering )
|
|
21153
21225
|
_programLayers.enable( 14 );
|
|
21154
|
-
if ( parameters.
|
|
21226
|
+
if ( parameters.transmission )
|
|
21155
21227
|
_programLayers.enable( 15 );
|
|
21156
|
-
if ( parameters.
|
|
21228
|
+
if ( parameters.sheen )
|
|
21157
21229
|
_programLayers.enable( 16 );
|
|
21158
|
-
if ( parameters.
|
|
21230
|
+
if ( parameters.opaque )
|
|
21159
21231
|
_programLayers.enable( 17 );
|
|
21160
|
-
if ( parameters.
|
|
21232
|
+
if ( parameters.pointsUvs )
|
|
21161
21233
|
_programLayers.enable( 18 );
|
|
21162
|
-
if ( parameters.
|
|
21234
|
+
if ( parameters.decodeVideoTexture )
|
|
21163
21235
|
_programLayers.enable( 19 );
|
|
21164
|
-
if ( parameters.
|
|
21236
|
+
if ( parameters.alphaToCoverage )
|
|
21165
21237
|
_programLayers.enable( 20 );
|
|
21238
|
+
if ( parameters.numMultiviewViews )
|
|
21239
|
+
_programLayers.enable( 21 );
|
|
21166
21240
|
|
|
21167
21241
|
array.push( _programLayers.mask );
|
|
21168
21242
|
|
|
@@ -21265,6 +21339,12 @@ function WebGLProperties() {
|
|
|
21265
21339
|
|
|
21266
21340
|
let properties = new WeakMap();
|
|
21267
21341
|
|
|
21342
|
+
function has( object ) {
|
|
21343
|
+
|
|
21344
|
+
return properties.has( object );
|
|
21345
|
+
|
|
21346
|
+
}
|
|
21347
|
+
|
|
21268
21348
|
function get( object ) {
|
|
21269
21349
|
|
|
21270
21350
|
let map = properties.get( object );
|
|
@@ -21299,6 +21379,7 @@ function WebGLProperties() {
|
|
|
21299
21379
|
}
|
|
21300
21380
|
|
|
21301
21381
|
return {
|
|
21382
|
+
has: has,
|
|
21302
21383
|
get: get,
|
|
21303
21384
|
remove: remove,
|
|
21304
21385
|
update: update,
|
|
@@ -22713,6 +22794,18 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
22713
22794
|
|
|
22714
22795
|
}
|
|
22715
22796
|
|
|
22797
|
+
const reversedFuncs = {
|
|
22798
|
+
[ NeverDepth ]: AlwaysDepth,
|
|
22799
|
+
[ LessDepth ]: GreaterDepth,
|
|
22800
|
+
[ EqualDepth ]: NotEqualDepth,
|
|
22801
|
+
[ LessEqualDepth ]: GreaterEqualDepth,
|
|
22802
|
+
|
|
22803
|
+
[ AlwaysDepth ]: NeverDepth,
|
|
22804
|
+
[ GreaterDepth ]: LessDepth,
|
|
22805
|
+
[ NotEqualDepth ]: EqualDepth,
|
|
22806
|
+
[ GreaterEqualDepth ]: LessEqualDepth,
|
|
22807
|
+
};
|
|
22808
|
+
|
|
22716
22809
|
function WebGLState( gl ) {
|
|
22717
22810
|
|
|
22718
22811
|
function ColorBuffer() {
|
|
@@ -22777,6 +22870,7 @@ function WebGLState( gl ) {
|
|
|
22777
22870
|
function DepthBuffer() {
|
|
22778
22871
|
|
|
22779
22872
|
let locked = false;
|
|
22873
|
+
let reversed = false;
|
|
22780
22874
|
|
|
22781
22875
|
let currentDepthMask = null;
|
|
22782
22876
|
let currentDepthFunc = null;
|
|
@@ -22784,6 +22878,12 @@ function WebGLState( gl ) {
|
|
|
22784
22878
|
|
|
22785
22879
|
return {
|
|
22786
22880
|
|
|
22881
|
+
setReversed: function ( value ) {
|
|
22882
|
+
|
|
22883
|
+
reversed = value;
|
|
22884
|
+
|
|
22885
|
+
},
|
|
22886
|
+
|
|
22787
22887
|
setTest: function ( depthTest ) {
|
|
22788
22888
|
|
|
22789
22889
|
if ( depthTest ) {
|
|
@@ -22811,6 +22911,8 @@ function WebGLState( gl ) {
|
|
|
22811
22911
|
|
|
22812
22912
|
setFunc: function ( depthFunc ) {
|
|
22813
22913
|
|
|
22914
|
+
if ( reversed ) depthFunc = reversedFuncs[ depthFunc ];
|
|
22915
|
+
|
|
22814
22916
|
if ( currentDepthFunc !== depthFunc ) {
|
|
22815
22917
|
|
|
22816
22918
|
switch ( depthFunc ) {
|
|
@@ -24356,6 +24458,28 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
24356
24458
|
|
|
24357
24459
|
}
|
|
24358
24460
|
|
|
24461
|
+
if ( glFormat === _gl.RGB_INTEGER ) {
|
|
24462
|
+
|
|
24463
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGB8UI;
|
|
24464
|
+
if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RGB16UI;
|
|
24465
|
+
if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RGB32UI;
|
|
24466
|
+
if ( glType === _gl.BYTE ) internalFormat = _gl.RGB8I;
|
|
24467
|
+
if ( glType === _gl.SHORT ) internalFormat = _gl.RGB16I;
|
|
24468
|
+
if ( glType === _gl.INT ) internalFormat = _gl.RGB32I;
|
|
24469
|
+
|
|
24470
|
+
}
|
|
24471
|
+
|
|
24472
|
+
if ( glFormat === _gl.RGBA_INTEGER ) {
|
|
24473
|
+
|
|
24474
|
+
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RGBA8UI;
|
|
24475
|
+
if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RGBA16UI;
|
|
24476
|
+
if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RGBA32UI;
|
|
24477
|
+
if ( glType === _gl.BYTE ) internalFormat = _gl.RGBA8I;
|
|
24478
|
+
if ( glType === _gl.SHORT ) internalFormat = _gl.RGBA16I;
|
|
24479
|
+
if ( glType === _gl.INT ) internalFormat = _gl.RGBA32I;
|
|
24480
|
+
|
|
24481
|
+
}
|
|
24482
|
+
|
|
24359
24483
|
if ( glFormat === _gl.RGB ) {
|
|
24360
24484
|
|
|
24361
24485
|
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
@@ -25907,6 +26031,37 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25907
26031
|
const renderTargetProperties = properties.get( renderTarget );
|
|
25908
26032
|
const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
|
|
25909
26033
|
|
|
26034
|
+
// if the bound depth texture has changed
|
|
26035
|
+
if ( renderTargetProperties.__boundDepthTexture !== renderTarget.depthTexture ) {
|
|
26036
|
+
|
|
26037
|
+
// fire the dispose event to get rid of stored state associated with the previously bound depth buffer
|
|
26038
|
+
const depthTexture = renderTarget.depthTexture;
|
|
26039
|
+
if ( renderTargetProperties.__depthDisposeCallback ) {
|
|
26040
|
+
|
|
26041
|
+
renderTargetProperties.__depthDisposeCallback();
|
|
26042
|
+
|
|
26043
|
+
}
|
|
26044
|
+
|
|
26045
|
+
// set up dispose listeners to track when the currently attached buffer is implicitly unbound
|
|
26046
|
+
if ( depthTexture ) {
|
|
26047
|
+
|
|
26048
|
+
const disposeEvent = () => {
|
|
26049
|
+
|
|
26050
|
+
delete renderTargetProperties.__boundDepthTexture;
|
|
26051
|
+
delete renderTargetProperties.__depthDisposeCallback;
|
|
26052
|
+
depthTexture.removeEventListener( 'dispose', disposeEvent );
|
|
26053
|
+
|
|
26054
|
+
};
|
|
26055
|
+
|
|
26056
|
+
depthTexture.addEventListener( 'dispose', disposeEvent );
|
|
26057
|
+
renderTargetProperties.__depthDisposeCallback = disposeEvent;
|
|
26058
|
+
|
|
26059
|
+
}
|
|
26060
|
+
|
|
26061
|
+
renderTargetProperties.__boundDepthTexture = depthTexture;
|
|
26062
|
+
|
|
26063
|
+
}
|
|
26064
|
+
|
|
25910
26065
|
if ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {
|
|
25911
26066
|
|
|
25912
26067
|
if ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );
|
|
@@ -25922,16 +26077,42 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
25922
26077
|
for ( let i = 0; i < 6; i ++ ) {
|
|
25923
26078
|
|
|
25924
26079
|
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ i ] );
|
|
25925
|
-
|
|
25926
|
-
|
|
26080
|
+
|
|
26081
|
+
if ( renderTargetProperties.__webglDepthbuffer[ i ] === undefined ) {
|
|
26082
|
+
|
|
26083
|
+
renderTargetProperties.__webglDepthbuffer[ i ] = _gl.createRenderbuffer();
|
|
26084
|
+
setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer[ i ], renderTarget, false );
|
|
26085
|
+
|
|
26086
|
+
} else {
|
|
26087
|
+
|
|
26088
|
+
// attach buffer if it's been created already
|
|
26089
|
+
const glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
26090
|
+
const renderbuffer = renderTargetProperties.__webglDepthbuffer[ i ];
|
|
26091
|
+
_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );
|
|
26092
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );
|
|
26093
|
+
|
|
26094
|
+
}
|
|
25927
26095
|
|
|
25928
26096
|
}
|
|
25929
26097
|
|
|
25930
26098
|
} else {
|
|
25931
26099
|
|
|
25932
26100
|
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
25933
|
-
|
|
25934
|
-
|
|
26101
|
+
|
|
26102
|
+
if ( renderTargetProperties.__webglDepthbuffer === undefined ) {
|
|
26103
|
+
|
|
26104
|
+
renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();
|
|
26105
|
+
setupRenderBufferStorage( renderTargetProperties.__webglDepthbuffer, renderTarget, false );
|
|
26106
|
+
|
|
26107
|
+
} else {
|
|
26108
|
+
|
|
26109
|
+
// attach buffer if it's been created already
|
|
26110
|
+
const glAttachmentType = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
|
|
26111
|
+
const renderbuffer = renderTargetProperties.__webglDepthbuffer;
|
|
26112
|
+
_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );
|
|
26113
|
+
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, glAttachmentType, _gl.RENDERBUFFER, renderbuffer );
|
|
26114
|
+
|
|
26115
|
+
}
|
|
25935
26116
|
|
|
25936
26117
|
}
|
|
25937
26118
|
|
|
@@ -28245,18 +28426,31 @@ class WebXRManager extends EventDispatcher {
|
|
|
28245
28426
|
camera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );
|
|
28246
28427
|
camera.matrixWorldInverse.copy( camera.matrixWorld ).invert();
|
|
28247
28428
|
|
|
28248
|
-
//
|
|
28249
|
-
|
|
28250
|
-
|
|
28251
|
-
|
|
28252
|
-
|
|
28253
|
-
|
|
28254
|
-
|
|
28255
|
-
|
|
28256
|
-
|
|
28429
|
+
// Check if the projection uses an infinite far plane.
|
|
28430
|
+
if ( projL[ 10 ] === - 1.0 ) {
|
|
28431
|
+
|
|
28432
|
+
// Use the projection matrix from the left eye.
|
|
28433
|
+
// The camera offset is sufficient to include the view volumes
|
|
28434
|
+
// of both eyes (assuming symmetric projections).
|
|
28435
|
+
camera.projectionMatrix.copy( cameraL.projectionMatrix );
|
|
28436
|
+
camera.projectionMatrixInverse.copy( cameraL.projectionMatrixInverse );
|
|
28437
|
+
|
|
28438
|
+
} else {
|
|
28439
|
+
|
|
28440
|
+
// Find the union of the frustum values of the cameras and scale
|
|
28441
|
+
// the values so that the near plane's position does not change in world space,
|
|
28442
|
+
// although must now be relative to the new union camera.
|
|
28443
|
+
const near2 = near + zOffset;
|
|
28444
|
+
const far2 = far + zOffset;
|
|
28445
|
+
const left2 = left - xOffset;
|
|
28446
|
+
const right2 = right + ( ipd - xOffset );
|
|
28447
|
+
const top2 = topFov * far / far2 * near2;
|
|
28448
|
+
const bottom2 = bottomFov * far / far2 * near2;
|
|
28257
28449
|
|
|
28258
|
-
|
|
28259
|
-
|
|
28450
|
+
camera.projectionMatrix.makePerspective( left2, right2, top2, bottom2, near2, far2 );
|
|
28451
|
+
camera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert();
|
|
28452
|
+
|
|
28453
|
+
}
|
|
28260
28454
|
|
|
28261
28455
|
}
|
|
28262
28456
|
|
|
@@ -28286,15 +28480,18 @@ class WebXRManager extends EventDispatcher {
|
|
|
28286
28480
|
|
|
28287
28481
|
if ( session === null ) return;
|
|
28288
28482
|
|
|
28483
|
+
let depthNear = camera.near;
|
|
28484
|
+
let depthFar = camera.far;
|
|
28485
|
+
|
|
28289
28486
|
if ( depthSensing.texture !== null ) {
|
|
28290
28487
|
|
|
28291
|
-
|
|
28292
|
-
|
|
28488
|
+
if ( depthSensing.depthNear > 0 ) depthNear = depthSensing.depthNear;
|
|
28489
|
+
if ( depthSensing.depthFar > 0 ) depthFar = depthSensing.depthFar;
|
|
28293
28490
|
|
|
28294
28491
|
}
|
|
28295
28492
|
|
|
28296
|
-
cameraXR.near = cameraR.near = cameraL.near =
|
|
28297
|
-
cameraXR.far = cameraR.far = cameraL.far =
|
|
28493
|
+
cameraXR.near = cameraR.near = cameraL.near = depthNear;
|
|
28494
|
+
cameraXR.far = cameraR.far = cameraL.far = depthFar;
|
|
28298
28495
|
|
|
28299
28496
|
if ( _currentDepthNear !== cameraXR.near || _currentDepthFar !== cameraXR.far ) {
|
|
28300
28497
|
|
|
@@ -28308,15 +28505,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
28308
28505
|
_currentDepthNear = cameraXR.near;
|
|
28309
28506
|
_currentDepthFar = cameraXR.far;
|
|
28310
28507
|
|
|
28311
|
-
cameraL.near = _currentDepthNear;
|
|
28312
|
-
cameraL.far = _currentDepthFar;
|
|
28313
|
-
cameraR.near = _currentDepthNear;
|
|
28314
|
-
cameraR.far = _currentDepthFar;
|
|
28315
|
-
|
|
28316
|
-
cameraL.updateProjectionMatrix();
|
|
28317
|
-
cameraR.updateProjectionMatrix();
|
|
28318
|
-
camera.updateProjectionMatrix();
|
|
28319
|
-
|
|
28320
28508
|
}
|
|
28321
28509
|
|
|
28322
28510
|
const cameras = cameraXR.cameras;
|
|
@@ -29699,6 +29887,7 @@ class WebGLRenderer {
|
|
|
29699
29887
|
|
|
29700
29888
|
// camera matrices cache
|
|
29701
29889
|
|
|
29890
|
+
const _currentProjectionMatrix = new Matrix4();
|
|
29702
29891
|
const _projScreenMatrix = new Matrix4();
|
|
29703
29892
|
|
|
29704
29893
|
const _vector3 = new Vector3();
|
|
@@ -29795,6 +29984,8 @@ class WebGLRenderer {
|
|
|
29795
29984
|
|
|
29796
29985
|
state = new WebGLState( _gl );
|
|
29797
29986
|
|
|
29987
|
+
if ( capabilities.reverseDepthBuffer ) state.buffers.depth.setReversed( true );
|
|
29988
|
+
|
|
29798
29989
|
info = new WebGLInfo( _gl );
|
|
29799
29990
|
properties = new WebGLProperties();
|
|
29800
29991
|
textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
|
|
@@ -30095,7 +30286,13 @@ class WebGLRenderer {
|
|
|
30095
30286
|
|
|
30096
30287
|
}
|
|
30097
30288
|
|
|
30098
|
-
if ( depth )
|
|
30289
|
+
if ( depth ) {
|
|
30290
|
+
|
|
30291
|
+
bits |= _gl.DEPTH_BUFFER_BIT;
|
|
30292
|
+
_gl.clearDepth( this.capabilities.reverseDepthBuffer ? 0 : 1 );
|
|
30293
|
+
|
|
30294
|
+
}
|
|
30295
|
+
|
|
30099
30296
|
if ( stencil ) {
|
|
30100
30297
|
|
|
30101
30298
|
bits |= _gl.STENCIL_BUFFER_BIT;
|
|
@@ -30484,6 +30681,12 @@ class WebGLRenderer {
|
|
|
30484
30681
|
|
|
30485
30682
|
scene.traverse( function ( object ) {
|
|
30486
30683
|
|
|
30684
|
+
if ( ! ( object.isMesh || object.isPoints || object.isLine || object.isSprite ) ) {
|
|
30685
|
+
|
|
30686
|
+
return;
|
|
30687
|
+
|
|
30688
|
+
}
|
|
30689
|
+
|
|
30487
30690
|
const material = object.material;
|
|
30488
30691
|
|
|
30489
30692
|
if ( material ) {
|
|
@@ -31115,6 +31318,8 @@ class WebGLRenderer {
|
|
|
31115
31318
|
object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
|
|
31116
31319
|
object.normalMatrix.getNormalMatrix( object.modelViewMatrix );
|
|
31117
31320
|
|
|
31321
|
+
material.onBeforeRender( _this, scene, camera, geometry, object, group );
|
|
31322
|
+
|
|
31118
31323
|
if ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {
|
|
31119
31324
|
|
|
31120
31325
|
material.side = BackSide;
|
|
@@ -31499,7 +31704,21 @@ class WebGLRenderer {
|
|
|
31499
31704
|
|
|
31500
31705
|
} else {
|
|
31501
31706
|
|
|
31502
|
-
|
|
31707
|
+
if ( capabilities.reverseDepthBuffer ) {
|
|
31708
|
+
|
|
31709
|
+
_currentProjectionMatrix.copy( camera.projectionMatrix );
|
|
31710
|
+
|
|
31711
|
+
toNormalizedProjectionMatrix( _currentProjectionMatrix );
|
|
31712
|
+
toReversedProjectionMatrix( _currentProjectionMatrix );
|
|
31713
|
+
|
|
31714
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
|
|
31715
|
+
|
|
31716
|
+
} else {
|
|
31717
|
+
|
|
31718
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
31719
|
+
|
|
31720
|
+
}
|
|
31721
|
+
|
|
31503
31722
|
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
31504
31723
|
|
|
31505
31724
|
}
|
|
@@ -31831,6 +32050,28 @@ class WebGLRenderer {
|
|
|
31831
32050
|
// Color and depth texture must be rebound in order for the swapchain to update.
|
|
31832
32051
|
textures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );
|
|
31833
32052
|
|
|
32053
|
+
} else if ( renderTarget.depthBuffer ) {
|
|
32054
|
+
|
|
32055
|
+
// check if the depth texture is already bound to the frame buffer and that it's been initialized
|
|
32056
|
+
const depthTexture = renderTarget.depthTexture;
|
|
32057
|
+
if ( renderTargetProperties.__boundDepthTexture !== depthTexture ) {
|
|
32058
|
+
|
|
32059
|
+
// check if the depth texture is compatible
|
|
32060
|
+
if (
|
|
32061
|
+
depthTexture !== null &&
|
|
32062
|
+
properties.has( depthTexture ) &&
|
|
32063
|
+
( renderTarget.width !== depthTexture.image.width || renderTarget.height !== depthTexture.image.height )
|
|
32064
|
+
) {
|
|
32065
|
+
|
|
32066
|
+
throw new Error( 'WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.' );
|
|
32067
|
+
|
|
32068
|
+
}
|
|
32069
|
+
|
|
32070
|
+
// Swap the depth buffer to the currently attached one
|
|
32071
|
+
textures.setupDepthRenderbuffer( renderTarget );
|
|
32072
|
+
|
|
32073
|
+
}
|
|
32074
|
+
|
|
31834
32075
|
}
|
|
31835
32076
|
|
|
31836
32077
|
const texture = renderTarget.texture;
|
|
@@ -31995,61 +32236,55 @@ class WebGLRenderer {
|
|
|
31995
32236
|
|
|
31996
32237
|
if ( framebuffer ) {
|
|
31997
32238
|
|
|
31998
|
-
|
|
31999
|
-
|
|
32000
|
-
|
|
32001
|
-
|
|
32002
|
-
const texture = renderTarget.texture;
|
|
32003
|
-
const textureFormat = texture.format;
|
|
32004
|
-
const textureType = texture.type;
|
|
32005
|
-
|
|
32006
|
-
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
32239
|
+
const texture = renderTarget.texture;
|
|
32240
|
+
const textureFormat = texture.format;
|
|
32241
|
+
const textureType = texture.type;
|
|
32007
32242
|
|
|
32008
|
-
|
|
32243
|
+
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
32009
32244
|
|
|
32010
|
-
|
|
32011
|
-
|
|
32012
|
-
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
32245
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.' );
|
|
32013
32246
|
|
|
32014
|
-
|
|
32247
|
+
}
|
|
32015
32248
|
|
|
32016
|
-
|
|
32249
|
+
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
32017
32250
|
|
|
32018
|
-
|
|
32019
|
-
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
32251
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
32020
32252
|
|
|
32021
|
-
|
|
32022
|
-
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
32023
|
-
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
32024
|
-
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
32025
|
-
_gl.flush();
|
|
32253
|
+
}
|
|
32026
32254
|
|
|
32027
|
-
|
|
32028
|
-
|
|
32029
|
-
await probeAsync( _gl, sync, 4 );
|
|
32255
|
+
// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
|
|
32256
|
+
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
32030
32257
|
|
|
32031
|
-
|
|
32258
|
+
// set the active frame buffer to the one we want to read
|
|
32259
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
32032
32260
|
|
|
32033
|
-
|
|
32034
|
-
|
|
32261
|
+
const glBuffer = _gl.createBuffer();
|
|
32262
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
32263
|
+
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
32264
|
+
_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), 0 );
|
|
32035
32265
|
|
|
32036
|
-
|
|
32266
|
+
// reset the frame buffer to the currently set buffer before waiting
|
|
32267
|
+
const currFramebuffer = _currentRenderTarget !== null ? properties.get( _currentRenderTarget ).__webglFramebuffer : null;
|
|
32268
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, currFramebuffer );
|
|
32037
32269
|
|
|
32038
|
-
|
|
32039
|
-
|
|
32270
|
+
// check if the commands have finished every 8 ms
|
|
32271
|
+
const sync = _gl.fenceSync( _gl.SYNC_GPU_COMMANDS_COMPLETE, 0 );
|
|
32040
32272
|
|
|
32041
|
-
|
|
32273
|
+
_gl.flush();
|
|
32042
32274
|
|
|
32043
|
-
|
|
32275
|
+
await probeAsync( _gl, sync, 4 );
|
|
32044
32276
|
|
|
32045
|
-
|
|
32277
|
+
// read the data and delete the buffer
|
|
32278
|
+
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
32279
|
+
_gl.getBufferSubData( _gl.PIXEL_PACK_BUFFER, 0, buffer );
|
|
32280
|
+
_gl.deleteBuffer( glBuffer );
|
|
32281
|
+
_gl.deleteSync( sync );
|
|
32046
32282
|
|
|
32047
|
-
|
|
32283
|
+
return buffer;
|
|
32048
32284
|
|
|
32049
|
-
|
|
32285
|
+
} else {
|
|
32050
32286
|
|
|
32051
|
-
|
|
32052
|
-
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
32287
|
+
throw new Error( 'THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.' );
|
|
32053
32288
|
|
|
32054
32289
|
}
|
|
32055
32290
|
|
|
@@ -32535,7 +32770,6 @@ class InterleavedBuffer {
|
|
|
32535
32770
|
this.count = array !== undefined ? array.length / stride : 0;
|
|
32536
32771
|
|
|
32537
32772
|
this.usage = StaticDrawUsage;
|
|
32538
|
-
this._updateRange = { offset: 0, count: - 1 };
|
|
32539
32773
|
this.updateRanges = [];
|
|
32540
32774
|
|
|
32541
32775
|
this.version = 0;
|
|
@@ -32552,13 +32786,6 @@ class InterleavedBuffer {
|
|
|
32552
32786
|
|
|
32553
32787
|
}
|
|
32554
32788
|
|
|
32555
|
-
get updateRange() {
|
|
32556
|
-
|
|
32557
|
-
warnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
|
|
32558
|
-
return this._updateRange;
|
|
32559
|
-
|
|
32560
|
-
}
|
|
32561
|
-
|
|
32562
32789
|
setUsage( value ) {
|
|
32563
32790
|
|
|
32564
32791
|
this.usage = value;
|
|
@@ -33323,6 +33550,27 @@ class LOD extends Object3D {
|
|
|
33323
33550
|
|
|
33324
33551
|
}
|
|
33325
33552
|
|
|
33553
|
+
removeLevel( distance ) {
|
|
33554
|
+
|
|
33555
|
+
const levels = this.levels;
|
|
33556
|
+
|
|
33557
|
+
for ( let i = 0; i < levels.length; i ++ ) {
|
|
33558
|
+
|
|
33559
|
+
if ( levels[ i ].distance === distance ) {
|
|
33560
|
+
|
|
33561
|
+
const removedElements = levels.splice( i, 1 );
|
|
33562
|
+
this.remove( removedElements[ 0 ].object );
|
|
33563
|
+
|
|
33564
|
+
return true;
|
|
33565
|
+
|
|
33566
|
+
}
|
|
33567
|
+
|
|
33568
|
+
}
|
|
33569
|
+
|
|
33570
|
+
return false;
|
|
33571
|
+
|
|
33572
|
+
}
|
|
33573
|
+
|
|
33326
33574
|
getCurrentLevel() {
|
|
33327
33575
|
|
|
33328
33576
|
return this._currentLevel;
|
|
@@ -34442,6 +34690,9 @@ class BatchedMesh extends Mesh {
|
|
|
34442
34690
|
// stores visible, active, and geometry id per object
|
|
34443
34691
|
this._drawInfo = [];
|
|
34444
34692
|
|
|
34693
|
+
// instance ids that have been set as inactive, and are available to be overwritten
|
|
34694
|
+
this._availableInstanceIds = [];
|
|
34695
|
+
|
|
34445
34696
|
// geometry information
|
|
34446
34697
|
this._drawRanges = [];
|
|
34447
34698
|
this._reservedRanges = [];
|
|
@@ -34503,7 +34754,7 @@ class BatchedMesh extends Mesh {
|
|
|
34503
34754
|
|
|
34504
34755
|
_initColorsTexture() {
|
|
34505
34756
|
|
|
34506
|
-
let size = Math.sqrt( this.
|
|
34757
|
+
let size = Math.sqrt( this._maxInstanceCount );
|
|
34507
34758
|
size = Math.ceil( size );
|
|
34508
34759
|
|
|
34509
34760
|
// 4 floats per RGBA pixel initialized to white
|
|
@@ -34597,12 +34848,11 @@ class BatchedMesh extends Mesh {
|
|
|
34597
34848
|
|
|
34598
34849
|
}
|
|
34599
34850
|
|
|
34600
|
-
const geometryCount = this._geometryCount;
|
|
34601
34851
|
const boundingBox = this.boundingBox;
|
|
34602
34852
|
const drawInfo = this._drawInfo;
|
|
34603
34853
|
|
|
34604
34854
|
boundingBox.makeEmpty();
|
|
34605
|
-
for ( let i = 0; i <
|
|
34855
|
+
for ( let i = 0, l = drawInfo.length; i < l; i ++ ) {
|
|
34606
34856
|
|
|
34607
34857
|
if ( drawInfo[ i ].active === false ) continue;
|
|
34608
34858
|
|
|
@@ -34642,23 +34892,36 @@ class BatchedMesh extends Mesh {
|
|
|
34642
34892
|
|
|
34643
34893
|
addInstance( geometryId ) {
|
|
34644
34894
|
|
|
34895
|
+
const atCapacity = this._drawInfo.length >= this.maxInstanceCount;
|
|
34896
|
+
|
|
34645
34897
|
// ensure we're not over geometry
|
|
34646
|
-
if ( this.
|
|
34898
|
+
if ( atCapacity && this._availableInstanceIds.length === 0 ) {
|
|
34647
34899
|
|
|
34648
34900
|
throw new Error( 'BatchedMesh: Maximum item count reached.' );
|
|
34649
34901
|
|
|
34650
34902
|
}
|
|
34651
34903
|
|
|
34652
|
-
|
|
34653
|
-
|
|
34904
|
+
const instanceDrawInfo = {
|
|
34654
34905
|
visible: true,
|
|
34655
34906
|
active: true,
|
|
34656
34907
|
geometryIndex: geometryId,
|
|
34908
|
+
};
|
|
34657
34909
|
|
|
34658
|
-
|
|
34910
|
+
let drawId = null;
|
|
34911
|
+
|
|
34912
|
+
// Prioritize using previously freed instance ids
|
|
34913
|
+
if ( this._availableInstanceIds.length > 0 ) {
|
|
34914
|
+
|
|
34915
|
+
drawId = this._availableInstanceIds.pop();
|
|
34916
|
+
this._drawInfo[ drawId ] = instanceDrawInfo;
|
|
34917
|
+
|
|
34918
|
+
} else {
|
|
34919
|
+
|
|
34920
|
+
drawId = this._drawInfo.length;
|
|
34921
|
+
this._drawInfo.push( instanceDrawInfo );
|
|
34922
|
+
|
|
34923
|
+
}
|
|
34659
34924
|
|
|
34660
|
-
// initialize the matrix
|
|
34661
|
-
const drawId = this._drawInfo.length - 1;
|
|
34662
34925
|
const matricesTexture = this._matricesTexture;
|
|
34663
34926
|
const matricesArray = matricesTexture.image.data;
|
|
34664
34927
|
_identityMatrix.toArray( matricesArray, drawId * 16 );
|
|
@@ -34907,11 +35170,8 @@ class BatchedMesh extends Mesh {
|
|
|
34907
35170
|
}
|
|
34908
35171
|
*/
|
|
34909
35172
|
|
|
34910
|
-
/*
|
|
34911
35173
|
deleteInstance( instanceId ) {
|
|
34912
35174
|
|
|
34913
|
-
// Note: User needs to call optimize() afterward to pack the data.
|
|
34914
|
-
|
|
34915
35175
|
const drawInfo = this._drawInfo;
|
|
34916
35176
|
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
34917
35177
|
|
|
@@ -34920,12 +35180,12 @@ class BatchedMesh extends Mesh {
|
|
|
34920
35180
|
}
|
|
34921
35181
|
|
|
34922
35182
|
drawInfo[ instanceId ].active = false;
|
|
35183
|
+
this._availableInstanceIds.push( instanceId );
|
|
34923
35184
|
this._visibilityChanged = true;
|
|
34924
35185
|
|
|
34925
35186
|
return this;
|
|
34926
35187
|
|
|
34927
35188
|
}
|
|
34928
|
-
*/
|
|
34929
35189
|
|
|
34930
35190
|
// get bounding box and compute it if it doesn't exist
|
|
34931
35191
|
getBoundingBoxAt( geometryId, target ) {
|
|
@@ -35130,6 +35390,59 @@ class BatchedMesh extends Mesh {
|
|
|
35130
35390
|
|
|
35131
35391
|
}
|
|
35132
35392
|
|
|
35393
|
+
setGeometryIdAt( instanceId, geometryId ) {
|
|
35394
|
+
|
|
35395
|
+
// return early if the geometry is out of range or not active
|
|
35396
|
+
const drawInfo = this._drawInfo;
|
|
35397
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
35398
|
+
|
|
35399
|
+
return null;
|
|
35400
|
+
|
|
35401
|
+
}
|
|
35402
|
+
|
|
35403
|
+
// check if the provided geometryId is within the valid range
|
|
35404
|
+
if ( geometryId < 0 || geometryId >= this._geometryCount ) {
|
|
35405
|
+
|
|
35406
|
+
return null;
|
|
35407
|
+
|
|
35408
|
+
}
|
|
35409
|
+
|
|
35410
|
+
drawInfo[ instanceId ].geometryIndex = geometryId;
|
|
35411
|
+
|
|
35412
|
+
return this;
|
|
35413
|
+
|
|
35414
|
+
}
|
|
35415
|
+
|
|
35416
|
+
getGeometryIdAt( instanceId ) {
|
|
35417
|
+
|
|
35418
|
+
const drawInfo = this._drawInfo;
|
|
35419
|
+
if ( instanceId >= drawInfo.length || drawInfo[ instanceId ].active === false ) {
|
|
35420
|
+
|
|
35421
|
+
return - 1;
|
|
35422
|
+
|
|
35423
|
+
}
|
|
35424
|
+
|
|
35425
|
+
return drawInfo[ instanceId ].geometryIndex;
|
|
35426
|
+
|
|
35427
|
+
}
|
|
35428
|
+
|
|
35429
|
+
getGeometryRangeAt( geometryId, target = {} ) {
|
|
35430
|
+
|
|
35431
|
+
if ( geometryId < 0 || geometryId >= this._geometryCount ) {
|
|
35432
|
+
|
|
35433
|
+
return null;
|
|
35434
|
+
|
|
35435
|
+
}
|
|
35436
|
+
|
|
35437
|
+
const drawRange = this._drawRanges[ geometryId ];
|
|
35438
|
+
|
|
35439
|
+
target.start = drawRange.start;
|
|
35440
|
+
target.count = drawRange.count;
|
|
35441
|
+
|
|
35442
|
+
return target;
|
|
35443
|
+
|
|
35444
|
+
}
|
|
35445
|
+
|
|
35133
35446
|
raycast( raycaster, intersects ) {
|
|
35134
35447
|
|
|
35135
35448
|
const drawInfo = this._drawInfo;
|
|
@@ -35681,6 +35994,7 @@ function checkIntersection( object, raycaster, ray, thresholdSq, a, b ) {
|
|
|
35681
35994
|
index: a,
|
|
35682
35995
|
face: null,
|
|
35683
35996
|
faceIndex: null,
|
|
35997
|
+
barycoord: null,
|
|
35684
35998
|
object: object
|
|
35685
35999
|
|
|
35686
36000
|
};
|
|
@@ -35946,6 +36260,8 @@ function testPoint( point, index, localThresholdSq, matrixWorld, raycaster, inte
|
|
|
35946
36260
|
point: intersectPoint,
|
|
35947
36261
|
index: index,
|
|
35948
36262
|
face: null,
|
|
36263
|
+
faceIndex: null,
|
|
36264
|
+
barycoord: null,
|
|
35949
36265
|
object: object
|
|
35950
36266
|
|
|
35951
36267
|
} );
|
|
@@ -38448,12 +38764,19 @@ class CylinderGeometry extends BufferGeometry {
|
|
|
38448
38764
|
|
|
38449
38765
|
// faces
|
|
38450
38766
|
|
|
38451
|
-
|
|
38452
|
-
indices.push( b, c, d );
|
|
38767
|
+
if ( radiusTop > 0 ) {
|
|
38453
38768
|
|
|
38454
|
-
|
|
38769
|
+
indices.push( a, b, d );
|
|
38770
|
+
groupCount += 3;
|
|
38455
38771
|
|
|
38456
|
-
|
|
38772
|
+
}
|
|
38773
|
+
|
|
38774
|
+
if ( radiusBottom > 0 ) {
|
|
38775
|
+
|
|
38776
|
+
indices.push( b, c, d );
|
|
38777
|
+
groupCount += 3;
|
|
38778
|
+
|
|
38779
|
+
}
|
|
38457
38780
|
|
|
38458
38781
|
}
|
|
38459
38782
|
|
|
@@ -46763,7 +47086,7 @@ class MaterialLoader extends Loader {
|
|
|
46763
47086
|
|
|
46764
47087
|
}
|
|
46765
47088
|
|
|
46766
|
-
const material =
|
|
47089
|
+
const material = this.createMaterialFromType( json.type );
|
|
46767
47090
|
|
|
46768
47091
|
if ( json.uuid !== undefined ) material.uuid = json.uuid;
|
|
46769
47092
|
if ( json.name !== undefined ) material.name = json.name;
|
|
@@ -47019,6 +47342,12 @@ class MaterialLoader extends Loader {
|
|
|
47019
47342
|
|
|
47020
47343
|
}
|
|
47021
47344
|
|
|
47345
|
+
createMaterialFromType( type ) {
|
|
47346
|
+
|
|
47347
|
+
return MaterialLoader.createMaterialFromType( type );
|
|
47348
|
+
|
|
47349
|
+
}
|
|
47350
|
+
|
|
47022
47351
|
static createMaterialFromType( type ) {
|
|
47023
47352
|
|
|
47024
47353
|
const materialLib = {
|
|
@@ -48153,7 +48482,7 @@ class ObjectLoader extends Loader {
|
|
|
48153
48482
|
case 'DirectionalLight':
|
|
48154
48483
|
|
|
48155
48484
|
object = new DirectionalLight( data.color, data.intensity );
|
|
48156
|
-
object.target = data.target ||
|
|
48485
|
+
object.target = data.target || '';
|
|
48157
48486
|
|
|
48158
48487
|
break;
|
|
48159
48488
|
|
|
@@ -48172,7 +48501,7 @@ class ObjectLoader extends Loader {
|
|
|
48172
48501
|
case 'SpotLight':
|
|
48173
48502
|
|
|
48174
48503
|
object = new SpotLight( data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay );
|
|
48175
|
-
object.target = data.target ||
|
|
48504
|
+
object.target = data.target || '';
|
|
48176
48505
|
|
|
48177
48506
|
break;
|
|
48178
48507
|
|
|
@@ -48449,7 +48778,7 @@ class ObjectLoader extends Loader {
|
|
|
48449
48778
|
|
|
48450
48779
|
object.traverse( function ( child ) {
|
|
48451
48780
|
|
|
48452
|
-
if ( child.isDirectionalLight ||
|
|
48781
|
+
if ( child.isDirectionalLight || child.isSpotLight ) {
|
|
48453
48782
|
|
|
48454
48783
|
const uuid = child.target;
|
|
48455
48784
|
|
|
@@ -48864,7 +49193,7 @@ class Clock {
|
|
|
48864
49193
|
|
|
48865
49194
|
function now() {
|
|
48866
49195
|
|
|
48867
|
-
return
|
|
49196
|
+
return performance.now();
|
|
48868
49197
|
|
|
48869
49198
|
}
|
|
48870
49199
|
|
|
@@ -49156,7 +49485,7 @@ class Audio extends Object3D {
|
|
|
49156
49485
|
|
|
49157
49486
|
}
|
|
49158
49487
|
|
|
49159
|
-
stop() {
|
|
49488
|
+
stop( delay = 0 ) {
|
|
49160
49489
|
|
|
49161
49490
|
if ( this.hasPlaybackControl === false ) {
|
|
49162
49491
|
|
|
@@ -49169,7 +49498,7 @@ class Audio extends Object3D {
|
|
|
49169
49498
|
|
|
49170
49499
|
if ( this.source !== null ) {
|
|
49171
49500
|
|
|
49172
|
-
this.source.stop();
|
|
49501
|
+
this.source.stop( this.context.currentTime + delay );
|
|
49173
49502
|
this.source.onended = null;
|
|
49174
49503
|
|
|
49175
49504
|
}
|
|
@@ -54809,6 +55138,35 @@ class ShapePath {
|
|
|
54809
55138
|
|
|
54810
55139
|
}
|
|
54811
55140
|
|
|
55141
|
+
class Controls extends EventDispatcher {
|
|
55142
|
+
|
|
55143
|
+
constructor( object, domElement = null ) {
|
|
55144
|
+
|
|
55145
|
+
super();
|
|
55146
|
+
|
|
55147
|
+
this.object = object;
|
|
55148
|
+
this.domElement = domElement;
|
|
55149
|
+
|
|
55150
|
+
this.enabled = true;
|
|
55151
|
+
|
|
55152
|
+
this.state = - 1;
|
|
55153
|
+
|
|
55154
|
+
this.keys = {};
|
|
55155
|
+
this.mouseButtons = { LEFT: null, MIDDLE: null, RIGHT: null };
|
|
55156
|
+
this.touches = { ONE: null, TWO: null };
|
|
55157
|
+
|
|
55158
|
+
}
|
|
55159
|
+
|
|
55160
|
+
connect() {}
|
|
55161
|
+
|
|
55162
|
+
disconnect() {}
|
|
55163
|
+
|
|
55164
|
+
dispose() {}
|
|
55165
|
+
|
|
55166
|
+
update( /* delta */ ) {}
|
|
55167
|
+
|
|
55168
|
+
}
|
|
55169
|
+
|
|
54812
55170
|
class WebGLMultipleRenderTargets extends WebGLRenderTarget { // @deprecated, r162
|
|
54813
55171
|
|
|
54814
55172
|
constructor( width = 1, height = 1, count = 1, options = {} ) {
|
|
@@ -54913,6 +55271,7 @@ exports.CompressedTextureLoader = CompressedTextureLoader;
|
|
|
54913
55271
|
exports.ConeGeometry = ConeGeometry;
|
|
54914
55272
|
exports.ConstantAlphaFactor = ConstantAlphaFactor;
|
|
54915
55273
|
exports.ConstantColorFactor = ConstantColorFactor;
|
|
55274
|
+
exports.Controls = Controls;
|
|
54916
55275
|
exports.CubeCamera = CubeCamera;
|
|
54917
55276
|
exports.CubeReflectionMapping = CubeReflectionMapping;
|
|
54918
55277
|
exports.CubeRefractionMapping = CubeRefractionMapping;
|