super-three 0.170.1 → 0.172.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/README.md +1 -1
- package/build/three.cjs +157 -49
- package/build/three.core.js +104 -42
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +53 -8
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +10 -5
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +21191 -1008
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +21189 -1008
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +0 -5
- package/examples/jsm/animation/CCDIKSolver.js +3 -2
- package/examples/jsm/controls/ArcballControls.js +28 -19
- package/examples/jsm/controls/OrbitControls.js +5 -4
- package/examples/jsm/csm/CSMShadowNode.js +16 -11
- package/examples/jsm/curves/NURBSCurve.js +1 -1
- package/examples/jsm/curves/NURBSUtils.js +3 -0
- package/examples/jsm/effects/OutlineEffect.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +11 -7
- package/examples/jsm/exporters/KTX2Exporter.js +1 -1
- package/examples/jsm/exporters/PLYExporter.js +2 -2
- package/examples/jsm/helpers/TextureHelperGPU.js +15 -5
- package/examples/jsm/helpers/VertexNormalsHelper.js +2 -0
- package/examples/jsm/lights/LightProbeGenerator.js +3 -3
- package/examples/jsm/lines/webgpu/LineSegments2.js +15 -6
- package/examples/jsm/loaders/3MFLoader.js +6 -3
- package/examples/jsm/loaders/BVHLoader.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +5 -5
- package/examples/jsm/loaders/DDSLoader.js +42 -0
- package/examples/jsm/loaders/GCodeLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +22 -2
- package/examples/jsm/loaders/KTX2Loader.js +6 -1
- package/examples/jsm/loaders/KTXLoader.js +4 -4
- package/examples/jsm/loaders/LDrawLoader.js +1 -1
- package/examples/jsm/loaders/LottieLoader.js +1 -1
- package/examples/jsm/loaders/MTLLoader.js +1 -0
- package/examples/jsm/loaders/NRRDLoader.js +1 -1
- package/examples/jsm/loaders/PLYLoader.js +7 -7
- package/examples/jsm/loaders/PVRLoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TDSLoader.js +1 -1
- package/examples/jsm/loaders/VRMLLoader.js +7 -7
- package/examples/jsm/loaders/lwo/IFFParser.js +4 -4
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -1
- package/examples/jsm/math/ConvexHull.js +1 -1
- package/examples/jsm/math/OBB.js +17 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +10 -10
- package/examples/jsm/misc/Volume.js +20 -12
- package/examples/jsm/misc/VolumeSlice.js +2 -2
- package/examples/jsm/modifiers/CurveModifier.js +10 -8
- package/examples/jsm/modifiers/CurveModifierGPU.js +9 -7
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -2
- package/examples/jsm/objects/GroundedSkybox.js +4 -4
- package/examples/jsm/objects/Sky.js +2 -2
- package/examples/jsm/objects/SkyMesh.js +3 -3
- package/examples/jsm/objects/Water2.js +1 -1
- package/examples/jsm/objects/Water2Mesh.js +2 -2
- package/examples/jsm/objects/WaterMesh.js +4 -4
- package/examples/jsm/postprocessing/BloomPass.js +2 -2
- package/examples/jsm/postprocessing/EffectComposer.js +1 -2
- package/examples/jsm/postprocessing/OutlinePass.js +4 -4
- package/examples/jsm/postprocessing/SAOPass.js +1 -2
- package/examples/jsm/postprocessing/SMAAPass.js +1 -3
- package/examples/jsm/postprocessing/SSAOPass.js +2 -4
- package/examples/jsm/postprocessing/SSRPass.js +2 -4
- package/examples/jsm/postprocessing/UnrealBloomPass.js +2 -2
- package/examples/jsm/renderers/SVGRenderer.js +6 -4
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/GodRaysShader.js +3 -3
- package/examples/jsm/shaders/SobelOperatorShader.js +1 -1
- package/examples/jsm/tsl/display/AfterImageNode.js +93 -4
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +46 -2
- package/examples/jsm/tsl/display/AnamorphicNode.js +118 -5
- package/examples/jsm/tsl/display/BleachBypass.js +10 -0
- package/examples/jsm/tsl/display/BloomNode.js +233 -26
- package/examples/jsm/tsl/display/DenoiseNode.js +141 -25
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +80 -1
- package/examples/jsm/tsl/display/DotScreenNode.js +50 -5
- package/examples/jsm/tsl/display/FXAANode.js +52 -3
- package/examples/jsm/tsl/display/FilmNode.js +47 -1
- package/examples/jsm/tsl/display/GTAONode.js +210 -14
- package/examples/jsm/tsl/display/GaussianBlurNode.js +152 -8
- package/examples/jsm/tsl/display/LensflareNode.js +131 -13
- package/examples/jsm/tsl/display/Lut3DNode.js +55 -1
- package/examples/jsm/tsl/display/MotionBlur.js +12 -2
- package/examples/jsm/tsl/display/OutlineNode.js +343 -26
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +36 -2
- package/examples/jsm/tsl/display/PixelationPassNode.js +142 -9
- package/examples/jsm/tsl/display/RGBShiftNode.js +49 -2
- package/examples/jsm/tsl/display/SMAANode.js +187 -46
- package/examples/jsm/tsl/display/SSAAPassNode.js +110 -25
- package/examples/jsm/tsl/display/SSRNode.js +194 -21
- package/examples/jsm/tsl/display/Sepia.js +9 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +54 -4
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +79 -3
- package/examples/jsm/tsl/display/StereoPassNode.js +41 -3
- package/examples/jsm/tsl/display/TRAAPassNode.js +116 -21
- package/examples/jsm/tsl/display/TransitionNode.js +71 -6
- package/examples/jsm/tsl/display/hashBlur.js +14 -3
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +40 -34
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/CameraUtils.js +4 -1
- package/examples/jsm/utils/GeometryUtils.js +22 -19
- package/examples/jsm/utils/SceneUtils.js +2 -2
- package/examples/jsm/webxr/XRControllerModelFactory.js +6 -1
- package/examples/jsm/webxr/XREstimatedLight.js +1 -1
- package/package.json +8 -3
- package/src/Three.Core.js +2 -0
- package/src/Three.Legacy.js +0 -21
- package/src/Three.TSL.js +9 -4
- package/src/Three.WebGPU.Nodes.js +2 -2
- package/src/Three.WebGPU.js +2 -2
- package/src/animation/PropertyBinding.js +2 -2
- package/src/cameras/PerspectiveCamera.js +18 -2
- package/src/constants.js +1 -1
- package/src/core/RenderTarget.js +18 -0
- package/src/core/RenderTarget3D.js +22 -0
- package/src/core/RenderTargetArray.js +22 -0
- package/src/extras/Earcut.js +1 -1
- package/src/extras/PMREMGenerator.js +20 -0
- package/src/extras/TextureUtils.js +6 -0
- package/src/helpers/CameraHelper.js +16 -13
- package/src/loaders/nodes/NodeLoader.js +59 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +45 -0
- package/src/loaders/nodes/NodeObjectLoader.js +61 -0
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +72 -19
- package/src/materials/nodes/Line2NodeMaterial.js +128 -34
- package/src/materials/nodes/LineBasicNodeMaterial.js +17 -2
- package/src/materials/nodes/LineDashedNodeMaterial.js +78 -5
- package/src/materials/nodes/MeshBasicNodeMaterial.js +56 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +35 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +22 -2
- package/src/materials/nodes/MeshNormalNodeMaterial.js +21 -2
- package/src/materials/nodes/MeshPhongNodeMaterial.js +64 -1
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +269 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +97 -6
- package/src/materials/nodes/MeshStandardNodeMaterial.js +78 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +28 -0
- package/src/materials/nodes/NodeMaterial.js +474 -21
- package/src/materials/nodes/PointsNodeMaterial.js +22 -13
- package/src/materials/nodes/ShadowNodeMaterial.js +29 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +77 -19
- package/src/materials/nodes/VolumeNodeMaterial.js +80 -4
- package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -0
- package/src/nodes/Nodes.js +1 -6
- package/src/nodes/TSL.js +2 -3
- package/src/nodes/accessors/AccessorsUtils.js +27 -0
- package/src/nodes/accessors/Arrays.js +24 -5
- package/src/nodes/accessors/BatchNode.js +39 -3
- package/src/nodes/accessors/Bitangent.js +37 -0
- package/src/nodes/accessors/BufferAttributeNode.js +178 -5
- package/src/nodes/accessors/BufferNode.js +63 -0
- package/src/nodes/accessors/BuiltinNode.js +38 -0
- package/src/nodes/accessors/Camera.js +49 -0
- package/src/nodes/accessors/ClippingNode.js +71 -2
- package/src/nodes/accessors/CubeTextureNode.js +64 -0
- package/src/nodes/accessors/InstanceNode.js +85 -2
- package/src/nodes/accessors/InstancedMeshNode.js +28 -3
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +13 -0
- package/src/nodes/accessors/Lights.js +50 -1
- package/src/nodes/accessors/MaterialNode.js +302 -8
- package/src/nodes/accessors/MaterialProperties.js +7 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +53 -13
- package/src/nodes/accessors/ModelNode.js +100 -5
- package/src/nodes/accessors/ModelViewProjectionNode.js +10 -38
- package/src/nodes/accessors/MorphNode.js +48 -4
- package/src/nodes/accessors/Normal.js +59 -3
- package/src/nodes/accessors/Object3DNode.js +102 -1
- package/src/nodes/accessors/PointUVNode.js +26 -0
- package/src/nodes/accessors/Position.js +53 -4
- package/src/nodes/accessors/ReferenceBaseNode.js +188 -0
- package/src/nodes/accessors/ReferenceNode.js +202 -2
- package/src/nodes/accessors/ReflectVector.js +24 -0
- package/src/nodes/accessors/RendererReferenceNode.js +46 -1
- package/src/nodes/accessors/SceneNode.js +54 -0
- package/src/nodes/accessors/SkinningNode.js +127 -1
- package/src/nodes/accessors/StorageBufferNode.js +168 -4
- package/src/nodes/accessors/StorageTextureNode.js +118 -0
- package/src/nodes/accessors/Tangent.js +36 -0
- package/src/nodes/accessors/Texture3DNode.js +89 -5
- package/src/nodes/accessors/TextureBicubic.js +12 -2
- package/src/nodes/accessors/TextureNode.js +309 -10
- package/src/nodes/accessors/TextureSizeNode.js +42 -0
- package/src/nodes/accessors/UV.js +10 -1
- package/src/nodes/accessors/UniformArrayNode.js +223 -23
- package/src/nodes/accessors/UserDataNode.js +46 -0
- package/src/nodes/accessors/VelocityNode.js +82 -0
- package/src/nodes/accessors/VertexColorNode.js +39 -2
- package/src/nodes/code/CodeNode.js +95 -1
- package/src/nodes/code/ExpressionNode.js +28 -0
- package/src/nodes/code/FunctionCallNode.js +37 -0
- package/src/nodes/code/FunctionNode.js +45 -0
- package/src/nodes/code/ScriptableNode.js +223 -1
- package/src/nodes/code/ScriptableValueNode.js +85 -1
- package/src/nodes/core/AssignNode.js +48 -2
- package/src/nodes/core/AttributeNode.js +43 -0
- package/src/nodes/core/BypassNode.js +47 -2
- package/src/nodes/core/CacheNode.js +53 -2
- package/src/nodes/core/ConstNode.js +24 -0
- package/src/nodes/core/ContextNode.js +65 -0
- package/src/nodes/core/IndexNode.js +68 -7
- package/src/nodes/core/InputNode.js +48 -0
- package/src/nodes/core/LightingModel.js +60 -0
- package/src/nodes/core/MRTNode.js +66 -0
- package/src/nodes/core/Node.js +337 -12
- package/src/nodes/core/NodeAttribute.js +38 -0
- package/src/nodes/core/NodeBuilder.js +945 -15
- package/src/nodes/core/NodeCache.js +41 -2
- package/src/nodes/core/NodeCode.js +31 -0
- package/src/nodes/core/NodeFrame.js +123 -2
- package/src/nodes/core/NodeFunction.js +46 -0
- package/src/nodes/core/NodeFunctionInput.js +44 -0
- package/src/nodes/core/NodeParser.js +11 -0
- package/src/nodes/core/NodeUniform.js +52 -0
- package/src/nodes/core/NodeUtils.js +141 -0
- package/src/nodes/core/NodeVar.js +30 -0
- package/src/nodes/core/NodeVarying.js +28 -0
- package/src/nodes/core/OutputStructNode.js +33 -2
- package/src/nodes/core/ParameterNode.js +28 -0
- package/src/nodes/core/PropertyNode.js +232 -0
- package/src/nodes/core/StackNode.js +78 -0
- package/src/nodes/core/StructTypeNode.js +39 -1
- package/src/nodes/core/TempNode.js +30 -4
- package/src/nodes/core/UniformGroupNode.js +82 -7
- package/src/nodes/core/UniformNode.js +66 -0
- package/src/nodes/core/VarNode.js +52 -0
- package/src/nodes/core/VaryingNode.js +83 -2
- package/src/nodes/core/constants.js +36 -0
- package/src/nodes/display/BumpMapNode.js +37 -0
- package/src/nodes/display/ColorAdjustment.js +53 -11
- package/src/nodes/display/ColorSpaceFunctions.js +16 -0
- package/src/nodes/display/ColorSpaceNode.js +82 -0
- package/src/nodes/display/FrontFacingNode.js +29 -0
- package/src/nodes/display/NormalMapNode.js +43 -0
- package/src/nodes/display/PassNode.js +298 -7
- package/src/nodes/display/PosterizeNode.js +33 -0
- package/src/nodes/display/RenderOutputNode.js +66 -1
- package/src/nodes/display/ScreenNode.js +87 -0
- package/src/nodes/display/ToneMappingFunctions.js +58 -10
- package/src/nodes/display/ToneMappingNode.js +55 -2
- package/src/nodes/display/ToonOutlinePassNode.js +73 -0
- package/src/nodes/display/ViewportDepthNode.js +122 -8
- package/src/nodes/display/ViewportDepthTextureNode.js +23 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +23 -0
- package/src/nodes/display/ViewportTextureNode.js +57 -0
- package/src/nodes/fog/Fog.js +93 -0
- package/src/nodes/functions/BasicLightingModel.js +24 -0
- package/src/nodes/functions/PhongLightingModel.js +34 -2
- package/src/nodes/functions/PhysicalLightingModel.js +167 -8
- package/src/nodes/functions/ShadowMaskModel.js +23 -0
- package/src/nodes/functions/ToonLightingModel.js +20 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +1 -3
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +16 -1
- package/src/nodes/geometry/RangeNode.js +54 -2
- package/src/nodes/gpgpu/AtomicFunctionNode.js +157 -1
- package/src/nodes/gpgpu/BarrierNode.js +47 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +126 -0
- package/src/nodes/gpgpu/ComputeNode.js +106 -2
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +115 -6
- package/src/nodes/lighting/AONode.js +18 -0
- package/src/nodes/lighting/AmbientLightNode.js +10 -0
- package/src/nodes/lighting/AnalyticLightNode.js +97 -2
- package/src/nodes/lighting/BasicEnvironmentNode.js +19 -0
- package/src/nodes/lighting/BasicLightMapNode.js +17 -0
- package/src/nodes/lighting/DirectionalLightNode.js +10 -0
- package/src/nodes/lighting/EnvironmentNode.js +18 -0
- package/src/nodes/lighting/HemisphereLightNode.js +31 -0
- package/src/nodes/lighting/IESSpotLightNode.js +11 -0
- package/src/nodes/lighting/IrradianceNode.js +17 -0
- package/src/nodes/lighting/LightProbeNode.js +20 -0
- package/src/nodes/lighting/LightUtils.js +12 -0
- package/src/nodes/lighting/LightingContextNode.js +48 -0
- package/src/nodes/lighting/LightingNode.js +15 -6
- package/src/nodes/lighting/LightsNode.js +132 -1
- package/src/nodes/lighting/PointLightNode.js +32 -1
- package/src/nodes/lighting/PointShadowNode.js +54 -1
- package/src/nodes/lighting/RectAreaLightNode.js +44 -6
- package/src/nodes/lighting/ShadowBaseNode.js +93 -0
- package/src/nodes/lighting/ShadowNode.js +240 -34
- package/src/nodes/lighting/SpotLightNode.js +43 -0
- package/src/nodes/math/ConditionalNode.js +70 -3
- package/src/nodes/math/Hash.js +9 -0
- package/src/nodes/math/MathNode.js +614 -11
- package/src/nodes/math/MathUtils.js +45 -1
- package/src/nodes/math/OperatorNode.js +233 -0
- package/src/nodes/math/TriNoise3D.js +18 -7
- package/src/nodes/parsers/GLSLNodeFunction.js +16 -0
- package/src/nodes/parsers/GLSLNodeParser.js +11 -0
- package/src/nodes/pmrem/PMREMNode.js +133 -0
- package/src/nodes/pmrem/PMREMUtils.js +1 -1
- package/src/nodes/procedural/Checker.js +9 -0
- package/src/nodes/tsl/TSLBase.js +2 -2
- package/src/nodes/utils/ArrayElementNode.js +38 -2
- package/src/nodes/utils/ConvertNode.js +31 -0
- package/src/nodes/utils/CubeMapNode.js +78 -0
- package/src/nodes/utils/Discard.js +16 -0
- package/src/nodes/utils/EquirectUVNode.js +31 -1
- package/src/nodes/utils/FlipNode.js +38 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +53 -1
- package/src/nodes/utils/JoinNode.js +25 -0
- package/src/nodes/utils/LoopNode.js +74 -1
- package/src/nodes/utils/MatcapUVNode.js +17 -0
- package/src/nodes/utils/MaxMipLevelNode.js +49 -0
- package/src/nodes/utils/Oscillators.js +33 -0
- package/src/nodes/utils/Packing.js +17 -0
- package/src/nodes/utils/PostProcessingUtils.js +28 -23
- package/src/nodes/utils/RTTNode.js +123 -2
- package/src/nodes/utils/ReflectorNode.js +174 -4
- package/src/nodes/utils/RemapNode.js +79 -0
- package/src/nodes/utils/RotateNode.js +41 -0
- package/src/nodes/utils/SetNode.js +44 -1
- package/src/nodes/utils/SplitNode.js +55 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +46 -0
- package/src/nodes/utils/SpriteUtils.js +17 -0
- package/src/nodes/utils/StorageArrayElementNode.js +40 -0
- package/src/nodes/utils/Timer.js +19 -0
- package/src/nodes/utils/TriplanarTexturesNode.js +84 -0
- package/src/nodes/utils/UVUtils.js +20 -0
- package/src/nodes/utils/ViewportUtils.js +13 -0
- package/src/objects/BatchedMesh.js +1 -2
- package/src/objects/ClippingGroup.js +49 -0
- package/src/renderers/WebGLRenderer.js +23 -4
- package/src/renderers/common/Animation.js +63 -0
- package/src/renderers/common/Attributes.js +36 -0
- package/src/renderers/common/Backend.js +467 -52
- package/src/renderers/common/Background.js +34 -1
- package/src/renderers/common/BindGroup.js +43 -0
- package/src/renderers/common/Binding.js +35 -0
- package/src/renderers/common/Bindings.js +93 -1
- package/src/renderers/common/Buffer.js +49 -0
- package/src/renderers/common/BufferUtils.js +27 -0
- package/src/renderers/common/BundleGroup.js +57 -0
- package/src/renderers/common/ChainMap.js +38 -1
- package/src/renderers/common/ClippingContext.js +107 -14
- package/src/renderers/common/Color4.js +36 -0
- package/src/renderers/common/ComputePipeline.js +24 -0
- package/src/renderers/common/CubeRenderTarget.js +13 -0
- package/src/renderers/common/DataMap.js +37 -1
- package/src/renderers/common/Geometries.js +98 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +25 -2
- package/src/renderers/common/Info.js +87 -0
- package/src/renderers/common/Lighting.js +26 -0
- package/src/renderers/common/Pipeline.js +22 -0
- package/src/renderers/common/Pipelines.js +148 -5
- package/src/renderers/common/PostProcessing.js +75 -3
- package/src/renderers/common/ProgrammableStage.js +60 -2
- package/src/renderers/common/QuadMesh.js +54 -5
- package/src/renderers/common/RenderBundle.js +14 -8
- package/src/renderers/common/RenderBundles.js +33 -10
- package/src/renderers/common/RenderContext.js +169 -4
- package/src/renderers/common/RenderContexts.js +42 -2
- package/src/renderers/common/RenderList.js +178 -0
- package/src/renderers/common/RenderLists.js +31 -0
- package/src/renderers/common/RenderObject.js +328 -4
- package/src/renderers/common/RenderObjects.js +101 -7
- package/src/renderers/common/RenderPipeline.js +24 -0
- package/src/renderers/common/Renderer.js +1096 -31
- package/src/renderers/common/RendererUtils.js +193 -0
- package/src/renderers/common/SampledTexture.js +121 -0
- package/src/renderers/common/Sampler.js +30 -0
- package/src/renderers/common/StorageBuffer.js +24 -0
- package/src/renderers/common/StorageBufferAttribute.js +31 -2
- package/src/renderers/common/StorageInstancedBufferAttribute.js +31 -2
- package/src/renderers/common/StorageTexture.js +38 -0
- package/src/renderers/common/Textures.js +83 -0
- package/src/renderers/common/Uniform.js +188 -2
- package/src/renderers/common/UniformBuffer.js +19 -0
- package/src/renderers/common/UniformsGroup.js +139 -2
- package/src/renderers/common/extras/PMREMGenerator.js +24 -3
- package/src/renderers/common/nodes/NodeBuilderState.js +95 -1
- package/src/renderers/common/nodes/NodeLibrary.js +89 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +91 -2
- package/src/renderers/common/nodes/NodeSampler.js +28 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +35 -0
- package/src/renderers/common/nodes/NodeUniform.js +189 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +29 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +31 -18
- package/src/renderers/common/nodes/Nodes.js +327 -60
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +7 -7
- package/src/renderers/webgl-fallback/WebGLBackend.js +547 -29
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +0 -1
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1 -1
- package/src/renderers/webgpu/WebGPUBackend.js +480 -49
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +34 -0
- package/src/renderers/webgpu/WebGPURenderer.js +35 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +20 -8
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +21 -8
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +59 -11
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +17 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +11 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +10 -8
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +9 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +5 -9
- package/src/renderers/webgpu/utils/WebGPUUtils.js +30 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +1 -1
- package/src/renderers/webxr/WebXRManager.js +7 -1
- package/src/textures/Data3DTexture.js +2 -2
- package/src/textures/Texture.js +4 -0
- package/examples/jsm/animation/MMDAnimationHelper.js +0 -1209
- package/examples/jsm/animation/MMDPhysics.js +0 -1408
- package/examples/jsm/exporters/MMDExporter.js +0 -223
- package/examples/jsm/libs/mmdparser.module.js +0 -11530
- package/examples/jsm/loaders/MMDLoader.js +0 -2298
- package/examples/jsm/shaders/MMDToonShader.js +0 -134
- package/src/nodes/core/UniformGroup.js +0 -13
- package/src/nodes/fog/FogExp2Node.js +0 -35
- package/src/nodes/fog/FogNode.js +0 -50
- package/src/nodes/fog/FogRangeNode.js +0 -36
- package/src/renderers/common/PostProcessingUtils.js +0 -86
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
#### JavaScript 3D library
|
|
10
10
|
|
|
11
|
-
The aim of the project is to create an easy-to-use, lightweight, cross-browser, general-purpose 3D library. The current builds only include
|
|
11
|
+
The aim of the project is to create an easy-to-use, lightweight, cross-browser, general-purpose 3D library. The current builds only include WebGL and WebGPU renderers but SVG and CSS3D renderers are also available as addons.
|
|
12
12
|
|
|
13
13
|
[Examples](https://threejs.org/examples/) —
|
|
14
14
|
[Docs](https://threejs.org/docs/) —
|
package/build/three.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
const REVISION = '
|
|
8
|
+
const REVISION = '172';
|
|
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 };
|
|
@@ -2112,6 +2112,7 @@ class Texture extends EventDispatcher {
|
|
|
2112
2112
|
this.version = 0;
|
|
2113
2113
|
this.onUpdate = null;
|
|
2114
2114
|
|
|
2115
|
+
this.renderTarget = null; // assign texture to a render target
|
|
2115
2116
|
this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not
|
|
2116
2117
|
this.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
|
|
2117
2118
|
|
|
@@ -2177,6 +2178,9 @@ class Texture extends EventDispatcher {
|
|
|
2177
2178
|
this.unpackAlignment = source.unpackAlignment;
|
|
2178
2179
|
this.colorSpace = source.colorSpace;
|
|
2179
2180
|
|
|
2181
|
+
this.renderTarget = source.renderTarget;
|
|
2182
|
+
this.isRenderTargetTexture = source.isRenderTargetTexture;
|
|
2183
|
+
|
|
2180
2184
|
this.userData = JSON.parse( JSON.stringify( source.userData ) );
|
|
2181
2185
|
|
|
2182
2186
|
this.needsUpdate = true;
|
|
@@ -3077,6 +3081,7 @@ class RenderTarget extends EventDispatcher {
|
|
|
3077
3081
|
|
|
3078
3082
|
this.textures[ i ] = texture.clone();
|
|
3079
3083
|
this.textures[ i ].isRenderTargetTexture = true;
|
|
3084
|
+
this.textures[ i ].renderTarget = this;
|
|
3080
3085
|
|
|
3081
3086
|
}
|
|
3082
3087
|
|
|
@@ -3086,6 +3091,7 @@ class RenderTarget extends EventDispatcher {
|
|
|
3086
3091
|
this.resolveDepthBuffer = options.resolveDepthBuffer;
|
|
3087
3092
|
this.resolveStencilBuffer = options.resolveStencilBuffer;
|
|
3088
3093
|
|
|
3094
|
+
this._depthTexture = null;
|
|
3089
3095
|
this.depthTexture = options.depthTexture;
|
|
3090
3096
|
|
|
3091
3097
|
this.samples = options.samples;
|
|
@@ -3104,6 +3110,21 @@ class RenderTarget extends EventDispatcher {
|
|
|
3104
3110
|
|
|
3105
3111
|
}
|
|
3106
3112
|
|
|
3113
|
+
set depthTexture( current ) {
|
|
3114
|
+
|
|
3115
|
+
if ( this._depthTexture !== null ) this._depthTexture.renderTarget = null;
|
|
3116
|
+
if ( current !== null ) current.renderTarget = this;
|
|
3117
|
+
|
|
3118
|
+
this._depthTexture = current;
|
|
3119
|
+
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3122
|
+
get depthTexture() {
|
|
3123
|
+
|
|
3124
|
+
return this._depthTexture;
|
|
3125
|
+
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3107
3128
|
setSize( width, height, depth = 1 ) {
|
|
3108
3129
|
|
|
3109
3130
|
if ( this.width !== width || this.height !== height || this.depth !== depth ) {
|
|
@@ -3152,6 +3173,7 @@ class RenderTarget extends EventDispatcher {
|
|
|
3152
3173
|
|
|
3153
3174
|
this.textures[ i ] = source.textures[ i ].clone();
|
|
3154
3175
|
this.textures[ i ].isRenderTargetTexture = true;
|
|
3176
|
+
this.textures[ i ].renderTarget = this;
|
|
3155
3177
|
|
|
3156
3178
|
}
|
|
3157
3179
|
|
|
@@ -3254,9 +3276,9 @@ class Data3DTexture extends Texture {
|
|
|
3254
3276
|
constructor( data = null, width = 1, height = 1, depth = 1 ) {
|
|
3255
3277
|
|
|
3256
3278
|
// We're going to add .setXXX() methods for setting properties later.
|
|
3257
|
-
// Users can still set in
|
|
3279
|
+
// Users can still set in Data3DTexture directly.
|
|
3258
3280
|
//
|
|
3259
|
-
// const texture = new THREE.
|
|
3281
|
+
// const texture = new THREE.Data3DTexture( data, width, height, depth );
|
|
3260
3282
|
// texture.anisotropy = 16;
|
|
3261
3283
|
//
|
|
3262
3284
|
// See #14839
|
|
@@ -12677,7 +12699,7 @@ class PerspectiveCamera extends Camera {
|
|
|
12677
12699
|
* The default film gauge is 35, so that the focal length can be specified for
|
|
12678
12700
|
* a 35mm (full frame) camera.
|
|
12679
12701
|
*
|
|
12680
|
-
* Values for focal length and film gauge must have the same unit.
|
|
12702
|
+
* @param {number} focalLength - Values for focal length and film gauge must have the same unit.
|
|
12681
12703
|
*/
|
|
12682
12704
|
setFocalLength( focalLength ) {
|
|
12683
12705
|
|
|
@@ -12691,6 +12713,8 @@ class PerspectiveCamera extends Camera {
|
|
|
12691
12713
|
|
|
12692
12714
|
/**
|
|
12693
12715
|
* Calculates the focal length from the current .fov and .filmGauge.
|
|
12716
|
+
*
|
|
12717
|
+
* @returns {number}
|
|
12694
12718
|
*/
|
|
12695
12719
|
getFocalLength() {
|
|
12696
12720
|
|
|
@@ -12724,6 +12748,10 @@ class PerspectiveCamera extends Camera {
|
|
|
12724
12748
|
/**
|
|
12725
12749
|
* Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.
|
|
12726
12750
|
* Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.
|
|
12751
|
+
*
|
|
12752
|
+
* @param {number} distance
|
|
12753
|
+
* @param {Vector2} minTarget
|
|
12754
|
+
* @param {Vector2} maxTarget
|
|
12727
12755
|
*/
|
|
12728
12756
|
getViewBounds( distance, minTarget, maxTarget ) {
|
|
12729
12757
|
|
|
@@ -12739,7 +12767,10 @@ class PerspectiveCamera extends Camera {
|
|
|
12739
12767
|
|
|
12740
12768
|
/**
|
|
12741
12769
|
* Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
|
|
12742
|
-
*
|
|
12770
|
+
*
|
|
12771
|
+
* @param {number} distance
|
|
12772
|
+
* @param {Vector2} target - Vector2 target used to store result where x is width and y is height.
|
|
12773
|
+
* @returns {Vector2}
|
|
12743
12774
|
*/
|
|
12744
12775
|
getViewSize( distance, target ) {
|
|
12745
12776
|
|
|
@@ -12783,6 +12814,13 @@ class PerspectiveCamera extends Camera {
|
|
|
12783
12814
|
* camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
|
|
12784
12815
|
*
|
|
12785
12816
|
* Note there is no reason monitors have to be the same size or in a grid.
|
|
12817
|
+
*
|
|
12818
|
+
* @param {number} fullWidth
|
|
12819
|
+
* @param {number} fullHeight
|
|
12820
|
+
* @param {number} x
|
|
12821
|
+
* @param {number} y
|
|
12822
|
+
* @param {number} width
|
|
12823
|
+
* @param {number} height
|
|
12786
12824
|
*/
|
|
12787
12825
|
setViewOffset( fullWidth, fullHeight, x, y, width, height ) {
|
|
12788
12826
|
|
|
@@ -21374,7 +21412,7 @@ function pointInTriangle( ax, ay, bx, by, cx, cy, px, py ) {
|
|
|
21374
21412
|
// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
|
|
21375
21413
|
function isValidDiagonal( a, b ) {
|
|
21376
21414
|
|
|
21377
|
-
return a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && //
|
|
21415
|
+
return a.next.i !== b.i && a.prev.i !== b.i && ! intersectsPolygon( a, b ) && // doesn't intersect other edges
|
|
21378
21416
|
( locallyInside( a, b ) && locallyInside( b, a ) && middleInside( a, b ) && // locally visible
|
|
21379
21417
|
( area( a.prev, a, b.prev ) || area( a, b.prev, b ) ) || // does not create opposite-facing sectors
|
|
21380
21418
|
equals( a, b ) && area( a.prev, a, a.next ) > 0 && area( b.prev, b, b.next ) > 0 ); // special zero-length case
|
|
@@ -32374,11 +32412,11 @@ class PropertyBinding {
|
|
|
32374
32412
|
|
|
32375
32413
|
this.targetObject = targetObject;
|
|
32376
32414
|
|
|
32377
|
-
if ( targetObject.
|
|
32415
|
+
if ( targetObject.isMaterial === true ) {
|
|
32378
32416
|
|
|
32379
32417
|
versioning = this.Versioning.NeedsUpdate;
|
|
32380
32418
|
|
|
32381
|
-
} else if ( targetObject.
|
|
32419
|
+
} else if ( targetObject.isObject3D === true ) {
|
|
32382
32420
|
|
|
32383
32421
|
versioning = this.Versioning.MatrixWorldNeedsUpdate;
|
|
32384
32422
|
|
|
@@ -34358,6 +34396,42 @@ class AnimationMixer extends EventDispatcher {
|
|
|
34358
34396
|
|
|
34359
34397
|
}
|
|
34360
34398
|
|
|
34399
|
+
class RenderTarget3D extends RenderTarget {
|
|
34400
|
+
|
|
34401
|
+
constructor( width = 1, height = 1, depth = 1, options = {} ) {
|
|
34402
|
+
|
|
34403
|
+
super( width, height, options );
|
|
34404
|
+
|
|
34405
|
+
this.isRenderTarget3D = true;
|
|
34406
|
+
|
|
34407
|
+
this.depth = depth;
|
|
34408
|
+
|
|
34409
|
+
this.texture = new Data3DTexture( null, width, height, depth );
|
|
34410
|
+
|
|
34411
|
+
this.texture.isRenderTargetTexture = true;
|
|
34412
|
+
|
|
34413
|
+
}
|
|
34414
|
+
|
|
34415
|
+
}
|
|
34416
|
+
|
|
34417
|
+
class RenderTargetArray extends RenderTarget {
|
|
34418
|
+
|
|
34419
|
+
constructor( width = 1, height = 1, depth = 1, options = {} ) {
|
|
34420
|
+
|
|
34421
|
+
super( width, height, options );
|
|
34422
|
+
|
|
34423
|
+
this.isRenderTargetArray = true;
|
|
34424
|
+
|
|
34425
|
+
this.depth = depth;
|
|
34426
|
+
|
|
34427
|
+
this.texture = new DataArrayTexture( null, width, height, depth );
|
|
34428
|
+
|
|
34429
|
+
this.texture.isRenderTargetTexture = true;
|
|
34430
|
+
|
|
34431
|
+
}
|
|
34432
|
+
|
|
34433
|
+
}
|
|
34434
|
+
|
|
34361
34435
|
class Uniform {
|
|
34362
34436
|
|
|
34363
34437
|
constructor( value ) {
|
|
@@ -35997,17 +36071,19 @@ class CameraHelper extends LineSegments {
|
|
|
35997
36071
|
|
|
35998
36072
|
_camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );
|
|
35999
36073
|
|
|
36000
|
-
//
|
|
36074
|
+
// Adjust z values based on coordinate system
|
|
36075
|
+
const nearZ = this.camera.coordinateSystem === WebGLCoordinateSystem ? - 1 : 0;
|
|
36001
36076
|
|
|
36002
|
-
|
|
36077
|
+
// center / target
|
|
36078
|
+
setPoint( 'c', pointMap, geometry, _camera, 0, 0, nearZ );
|
|
36003
36079
|
setPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );
|
|
36004
36080
|
|
|
36005
36081
|
// near
|
|
36006
36082
|
|
|
36007
|
-
setPoint( 'n1', pointMap, geometry, _camera, - w, - h,
|
|
36008
|
-
setPoint( 'n2', pointMap, geometry, _camera, w, - h,
|
|
36009
|
-
setPoint( 'n3', pointMap, geometry, _camera, - w, h,
|
|
36010
|
-
setPoint( 'n4', pointMap, geometry, _camera, w, h,
|
|
36083
|
+
setPoint( 'n1', pointMap, geometry, _camera, - w, - h, nearZ );
|
|
36084
|
+
setPoint( 'n2', pointMap, geometry, _camera, w, - h, nearZ );
|
|
36085
|
+
setPoint( 'n3', pointMap, geometry, _camera, - w, h, nearZ );
|
|
36086
|
+
setPoint( 'n4', pointMap, geometry, _camera, w, h, nearZ );
|
|
36011
36087
|
|
|
36012
36088
|
// far
|
|
36013
36089
|
|
|
@@ -36018,9 +36094,9 @@ class CameraHelper extends LineSegments {
|
|
|
36018
36094
|
|
|
36019
36095
|
// up
|
|
36020
36096
|
|
|
36021
|
-
setPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1,
|
|
36022
|
-
setPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1,
|
|
36023
|
-
setPoint( 'u3', pointMap, geometry, _camera, 0, h * 2,
|
|
36097
|
+
setPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, nearZ );
|
|
36098
|
+
setPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, nearZ );
|
|
36099
|
+
setPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, nearZ );
|
|
36024
36100
|
|
|
36025
36101
|
// cross
|
|
36026
36102
|
|
|
@@ -36029,10 +36105,10 @@ class CameraHelper extends LineSegments {
|
|
|
36029
36105
|
setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );
|
|
36030
36106
|
setPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );
|
|
36031
36107
|
|
|
36032
|
-
setPoint( 'cn1', pointMap, geometry, _camera, - w, 0,
|
|
36033
|
-
setPoint( 'cn2', pointMap, geometry, _camera, w, 0,
|
|
36034
|
-
setPoint( 'cn3', pointMap, geometry, _camera, 0, - h,
|
|
36035
|
-
setPoint( 'cn4', pointMap, geometry, _camera, 0, h,
|
|
36108
|
+
setPoint( 'cn1', pointMap, geometry, _camera, - w, 0, nearZ );
|
|
36109
|
+
setPoint( 'cn2', pointMap, geometry, _camera, w, 0, nearZ );
|
|
36110
|
+
setPoint( 'cn3', pointMap, geometry, _camera, 0, - h, nearZ );
|
|
36111
|
+
setPoint( 'cn4', pointMap, geometry, _camera, 0, h, nearZ );
|
|
36036
36112
|
|
|
36037
36113
|
geometry.getAttribute( 'position' ).needsUpdate = true;
|
|
36038
36114
|
|
|
@@ -36821,6 +36897,12 @@ function fill( texture ) {
|
|
|
36821
36897
|
/**
|
|
36822
36898
|
* Given the width, height, format, and type of a texture. Determines how many
|
|
36823
36899
|
* bytes must be used to represent the texture.
|
|
36900
|
+
*
|
|
36901
|
+
* @param {Number} width
|
|
36902
|
+
* @param {Number} height
|
|
36903
|
+
* @param {Number} format
|
|
36904
|
+
* @param {Number} type
|
|
36905
|
+
* @return {Number} The number of bytes required to represent the texture.
|
|
36824
36906
|
*/
|
|
36825
36907
|
function getByteLength( width, height, format, type ) {
|
|
36826
36908
|
|
|
@@ -36959,26 +37041,6 @@ const TextureUtils = {
|
|
|
36959
37041
|
getByteLength
|
|
36960
37042
|
};
|
|
36961
37043
|
|
|
36962
|
-
class WebGLMultipleRenderTargets extends WebGLRenderTarget { // @deprecated, r162
|
|
36963
|
-
|
|
36964
|
-
constructor( width = 1, height = 1, count = 1, options = {} ) {
|
|
36965
|
-
|
|
36966
|
-
console.warn( 'THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.' );
|
|
36967
|
-
|
|
36968
|
-
super( width, height, { ...options, count } );
|
|
36969
|
-
|
|
36970
|
-
this.isWebGLMultipleRenderTargets = true;
|
|
36971
|
-
|
|
36972
|
-
}
|
|
36973
|
-
|
|
36974
|
-
get texture() {
|
|
36975
|
-
|
|
36976
|
-
return this.textures;
|
|
36977
|
-
|
|
36978
|
-
}
|
|
36979
|
-
|
|
36980
|
-
}
|
|
36981
|
-
|
|
36982
37044
|
if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
|
|
36983
37045
|
|
|
36984
37046
|
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {
|
|
@@ -37488,7 +37550,7 @@ var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp(
|
|
|
37488
37550
|
|
|
37489
37551
|
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";
|
|
37490
37552
|
|
|
37491
|
-
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\
|
|
37553
|
+
var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif";
|
|
37492
37554
|
|
|
37493
37555
|
var uv_pars_fragment = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif";
|
|
37494
37556
|
|
|
@@ -39731,6 +39793,12 @@ class PMREMGenerator {
|
|
|
39731
39793
|
* in radians to be applied to the scene before PMREM generation. Optional near
|
|
39732
39794
|
* and far planes ensure the scene is rendered in its entirety (the cubeCamera
|
|
39733
39795
|
* is placed at the origin).
|
|
39796
|
+
*
|
|
39797
|
+
* @param {Scene} scene
|
|
39798
|
+
* @param {number} sigma
|
|
39799
|
+
* @param {number} near
|
|
39800
|
+
* @param {number} far
|
|
39801
|
+
* @return {WebGLRenderTarget}
|
|
39734
39802
|
*/
|
|
39735
39803
|
fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {
|
|
39736
39804
|
|
|
@@ -39766,6 +39834,10 @@ class PMREMGenerator {
|
|
|
39766
39834
|
* or HDR. The ideal input image size is 1k (1024 x 512),
|
|
39767
39835
|
* as this matches best with the 256 x 256 cubemap output.
|
|
39768
39836
|
* The smallest supported equirectangular image size is 64 x 32.
|
|
39837
|
+
*
|
|
39838
|
+
* @param {Texture} equirectangular
|
|
39839
|
+
* @param {WebGLRenderTarget} [renderTarget=null] - Optional render target.
|
|
39840
|
+
* @return {WebGLRenderTarget}
|
|
39769
39841
|
*/
|
|
39770
39842
|
fromEquirectangular( equirectangular, renderTarget = null ) {
|
|
39771
39843
|
|
|
@@ -39778,6 +39850,10 @@ class PMREMGenerator {
|
|
|
39778
39850
|
* or HDR. The ideal input cube size is 256 x 256,
|
|
39779
39851
|
* as this matches best with the 256 x 256 cubemap output.
|
|
39780
39852
|
* The smallest supported cube size is 16 x 16.
|
|
39853
|
+
*
|
|
39854
|
+
* @param {Texture} cubemap
|
|
39855
|
+
* @param {null} [renderTarget=null] - Optional render target.
|
|
39856
|
+
* @return {WebGLRenderTarget}
|
|
39781
39857
|
*/
|
|
39782
39858
|
fromCubemap( cubemap, renderTarget = null ) {
|
|
39783
39859
|
|
|
@@ -40095,6 +40171,12 @@ class PMREMGenerator {
|
|
|
40095
40171
|
* the blur latitudinally (around the poles), and then longitudinally (towards
|
|
40096
40172
|
* the poles) to approximate the orthogonally-separable blur. It is least
|
|
40097
40173
|
* accurate at the poles, but still does a decent job.
|
|
40174
|
+
*
|
|
40175
|
+
* @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
40176
|
+
* @param {number} lodIn
|
|
40177
|
+
* @param {number} lodOut
|
|
40178
|
+
* @param {number} sigma
|
|
40179
|
+
* @param {Vector3} [poleAxis]
|
|
40098
40180
|
*/
|
|
40099
40181
|
_blur( cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis ) {
|
|
40100
40182
|
|
|
@@ -50204,7 +50286,7 @@ class WebXRDepthSensing {
|
|
|
50204
50286
|
const texProps = renderer.properties.get( texture );
|
|
50205
50287
|
texProps.__webglTexture = depthData.texture;
|
|
50206
50288
|
|
|
50207
|
-
if ( ( depthData.depthNear
|
|
50289
|
+
if ( ( depthData.depthNear !== renderState.depthNear ) || ( depthData.depthFar !== renderState.depthFar ) ) {
|
|
50208
50290
|
|
|
50209
50291
|
this.depthNear = depthData.depthNear;
|
|
50210
50292
|
this.depthFar = depthData.depthFar;
|
|
@@ -50532,7 +50614,9 @@ class WebXRManager extends EventDispatcher {
|
|
|
50532
50614
|
currentPixelRatio = renderer.getPixelRatio();
|
|
50533
50615
|
renderer.getSize( currentSize );
|
|
50534
50616
|
|
|
50535
|
-
|
|
50617
|
+
const useLayers = session.enabledFeatures !== undefined && session.enabledFeatures.includes( 'layers' );
|
|
50618
|
+
|
|
50619
|
+
if ( ! useLayers ) {
|
|
50536
50620
|
|
|
50537
50621
|
const layerInit = {
|
|
50538
50622
|
antialias: attributes.antialias,
|
|
@@ -50757,6 +50841,10 @@ class WebXRManager extends EventDispatcher {
|
|
|
50757
50841
|
* the cameras' projection and world matrices have already been set.
|
|
50758
50842
|
* And that near and far planes are identical for both cameras.
|
|
50759
50843
|
* Visualization of this technique: https://computergraphics.stackexchange.com/a/4765
|
|
50844
|
+
*
|
|
50845
|
+
* @param {ArrayCamera} camera - The camera to update.
|
|
50846
|
+
* @param {PerspectiveCamera} cameraL - The left camera.
|
|
50847
|
+
* @param {PerspectiveCamera} cameraR - The right camera.
|
|
50760
50848
|
*/
|
|
50761
50849
|
function setProjectionFromUnion( camera, cameraL, cameraR ) {
|
|
50762
50850
|
|
|
@@ -52257,6 +52345,9 @@ class WebGLRenderer {
|
|
|
52257
52345
|
let _clippingEnabled = false;
|
|
52258
52346
|
let _localClippingEnabled = false;
|
|
52259
52347
|
|
|
52348
|
+
// transmission render target scale
|
|
52349
|
+
this.transmissionResolutionScale = 1.0;
|
|
52350
|
+
|
|
52260
52351
|
// camera matrices cache
|
|
52261
52352
|
|
|
52262
52353
|
const _currentProjectionMatrix = new Matrix4();
|
|
@@ -53345,7 +53436,7 @@ class WebGLRenderer {
|
|
|
53345
53436
|
|
|
53346
53437
|
//
|
|
53347
53438
|
|
|
53348
|
-
if ( _currentRenderTarget !== null ) {
|
|
53439
|
+
if ( _currentRenderTarget !== null && _currentActiveMipmapLevel === 0 ) {
|
|
53349
53440
|
|
|
53350
53441
|
// resolve multisample renderbuffers to a single-sample texture if necessary
|
|
53351
53442
|
|
|
@@ -53573,7 +53664,7 @@ class WebGLRenderer {
|
|
|
53573
53664
|
const transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget[ camera.id ];
|
|
53574
53665
|
|
|
53575
53666
|
const activeViewport = camera.viewport || _currentViewport;
|
|
53576
|
-
transmissionRenderTarget.setSize( activeViewport.z, activeViewport.w );
|
|
53667
|
+
transmissionRenderTarget.setSize( activeViewport.z * _this.transmissionResolutionScale, activeViewport.w * _this.transmissionResolutionScale );
|
|
53577
53668
|
|
|
53578
53669
|
//
|
|
53579
53670
|
|
|
@@ -54391,6 +54482,7 @@ class WebGLRenderer {
|
|
|
54391
54482
|
|
|
54392
54483
|
};
|
|
54393
54484
|
|
|
54485
|
+
const _scratchFrameBuffer = _gl.createFramebuffer();
|
|
54394
54486
|
this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {
|
|
54395
54487
|
|
|
54396
54488
|
_currentRenderTarget = renderTarget;
|
|
@@ -54499,6 +54591,14 @@ class WebGLRenderer {
|
|
|
54499
54591
|
|
|
54500
54592
|
}
|
|
54501
54593
|
|
|
54594
|
+
// Use a scratch frame buffer if rendering to a mip level to avoid depth buffers
|
|
54595
|
+
// being bound that are different sizes.
|
|
54596
|
+
if ( activeMipmapLevel !== 0 ) {
|
|
54597
|
+
|
|
54598
|
+
framebuffer = _scratchFrameBuffer;
|
|
54599
|
+
|
|
54600
|
+
}
|
|
54601
|
+
|
|
54502
54602
|
const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
54503
54603
|
|
|
54504
54604
|
if ( framebufferBound && useDefaultFramebuffer ) {
|
|
@@ -54519,8 +54619,15 @@ class WebGLRenderer {
|
|
|
54519
54619
|
} else if ( isRenderTarget3D ) {
|
|
54520
54620
|
|
|
54521
54621
|
const textureProperties = properties.get( renderTarget.texture );
|
|
54522
|
-
const layer = activeCubeFace
|
|
54523
|
-
_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel
|
|
54622
|
+
const layer = activeCubeFace;
|
|
54623
|
+
_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel, layer );
|
|
54624
|
+
|
|
54625
|
+
} else if ( renderTarget !== null && activeMipmapLevel !== 0 ) {
|
|
54626
|
+
|
|
54627
|
+
// Only bind the frame buffer if we are using a scratch frame buffer to render to a mipmap.
|
|
54628
|
+
// If we rebind the texture when using a multi sample buffer then an error about inconsistent samples will be thrown.
|
|
54629
|
+
const textureProperties = properties.get( renderTarget.texture );
|
|
54630
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D, textureProperties.__webglTexture, activeMipmapLevel );
|
|
54524
54631
|
|
|
54525
54632
|
}
|
|
54526
54633
|
|
|
@@ -55379,6 +55486,8 @@ exports.RedFormat = RedFormat;
|
|
|
55379
55486
|
exports.RedIntegerFormat = RedIntegerFormat;
|
|
55380
55487
|
exports.ReinhardToneMapping = ReinhardToneMapping;
|
|
55381
55488
|
exports.RenderTarget = RenderTarget;
|
|
55489
|
+
exports.RenderTarget3D = RenderTarget3D;
|
|
55490
|
+
exports.RenderTargetArray = RenderTargetArray;
|
|
55382
55491
|
exports.RepeatWrapping = RepeatWrapping;
|
|
55383
55492
|
exports.ReplaceStencilOp = ReplaceStencilOp;
|
|
55384
55493
|
exports.ReverseSubtractEquation = ReverseSubtractEquation;
|
|
@@ -55462,7 +55571,6 @@ exports.WebGL3DRenderTarget = WebGL3DRenderTarget;
|
|
|
55462
55571
|
exports.WebGLArrayRenderTarget = WebGLArrayRenderTarget;
|
|
55463
55572
|
exports.WebGLCoordinateSystem = WebGLCoordinateSystem;
|
|
55464
55573
|
exports.WebGLCubeRenderTarget = WebGLCubeRenderTarget;
|
|
55465
|
-
exports.WebGLMultipleRenderTargets = WebGLMultipleRenderTargets;
|
|
55466
55574
|
exports.WebGLRenderTarget = WebGLRenderTarget;
|
|
55467
55575
|
exports.WebGLRenderer = WebGLRenderer;
|
|
55468
55576
|
exports.WebGLUtils = WebGLUtils;
|