super-three 0.177.0 → 0.181.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 +1994 -749
- package/build/three.core.js +1358 -506
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +631 -247
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +113 -33
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +9571 -3424
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +9397 -3426
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
- package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
- package/examples/jsm/Addons.js +2 -3
- package/examples/jsm/animation/CCDIKSolver.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +0 -27
- package/examples/jsm/capabilities/WebGPU.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +9 -9
- package/examples/jsm/controls/DragControls.js +7 -57
- package/examples/jsm/controls/FirstPersonControls.js +3 -3
- package/examples/jsm/controls/FlyControls.js +1 -1
- package/examples/jsm/controls/OrbitControls.js +2 -2
- package/examples/jsm/controls/PointerLockControls.js +2 -10
- package/examples/jsm/controls/TrackballControls.js +1 -1
- package/examples/jsm/controls/TransformControls.js +62 -15
- package/examples/jsm/csm/CSMShadowNode.js +4 -4
- package/examples/jsm/effects/AsciiEffect.js +8 -8
- package/examples/jsm/environments/RoomEnvironment.js +8 -3
- package/examples/jsm/exporters/DRACOExporter.js +2 -2
- package/examples/jsm/exporters/EXRExporter.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +33 -25
- package/examples/jsm/exporters/KTX2Exporter.js +4 -2
- package/examples/jsm/exporters/PLYExporter.js +1 -1
- package/examples/jsm/exporters/USDZExporter.js +683 -299
- package/examples/jsm/geometries/DecalGeometry.js +2 -2
- package/examples/jsm/geometries/ParametricGeometry.js +1 -1
- package/examples/jsm/geometries/RoundedBoxGeometry.js +47 -8
- package/examples/jsm/geometries/TeapotGeometry.js +2 -2
- package/examples/jsm/geometries/TextGeometry.js +3 -2
- package/examples/jsm/gpgpu/BitonicSort.js +715 -0
- package/examples/jsm/helpers/ViewHelper.js +43 -5
- package/examples/jsm/inspector/Inspector.js +427 -0
- package/examples/jsm/inspector/RendererInspector.js +415 -0
- package/examples/jsm/inspector/tabs/Console.js +204 -0
- package/examples/jsm/inspector/tabs/Parameters.js +332 -0
- package/examples/jsm/inspector/tabs/Performance.js +268 -0
- package/examples/jsm/inspector/tabs/Viewer.js +166 -0
- package/examples/jsm/inspector/ui/Graph.js +95 -0
- package/examples/jsm/inspector/ui/Item.js +170 -0
- package/examples/jsm/inspector/ui/List.js +75 -0
- package/examples/jsm/inspector/ui/Profiler.js +170 -0
- package/examples/jsm/inspector/ui/Style.js +654 -0
- package/examples/jsm/inspector/ui/Tab.js +46 -0
- package/examples/jsm/inspector/ui/Values.js +423 -0
- package/examples/jsm/inspector/ui/utils.js +56 -0
- package/examples/jsm/interactive/HTMLMesh.js +11 -13
- package/examples/jsm/interactive/InteractiveGroup.js +1 -1
- package/examples/jsm/interactive/SelectionBox.js +30 -0
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
- package/examples/jsm/lights/LightProbeGenerator.js +14 -3
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
- package/examples/jsm/lines/Line2.js +3 -3
- package/examples/jsm/lines/LineGeometry.js +1 -1
- package/examples/jsm/lines/LineSegments2.js +2 -2
- package/examples/jsm/lines/Wireframe.js +2 -2
- package/examples/jsm/lines/WireframeGeometry2.js +1 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +1 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -1
- package/examples/jsm/loaders/3MFLoader.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +4 -4
- package/examples/jsm/loaders/DDSLoader.js +1 -1
- package/examples/jsm/loaders/DRACOLoader.js +73 -22
- package/examples/jsm/loaders/EXRLoader.js +210 -22
- package/examples/jsm/loaders/FBXLoader.js +4 -4
- package/examples/jsm/loaders/FontLoader.js +23 -5
- package/examples/jsm/loaders/GLTFLoader.js +14 -8
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
- package/examples/jsm/loaders/HDRLoader.js +486 -0
- package/examples/jsm/loaders/KTX2Loader.js +136 -49
- package/examples/jsm/loaders/KTXLoader.js +2 -2
- package/examples/jsm/loaders/LDrawLoader.js +1 -1
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -1
- package/examples/jsm/loaders/LWOLoader.js +2 -2
- package/examples/jsm/loaders/MaterialXLoader.js +233 -34
- package/examples/jsm/loaders/OBJLoader.js +1 -1
- package/examples/jsm/loaders/PDBLoader.js +1 -1
- package/examples/jsm/loaders/RGBELoader.js +7 -473
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TTFLoader.js +13 -1
- package/examples/jsm/loaders/USDLoader.js +219 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -892
- package/examples/jsm/loaders/UltraHDRLoader.js +2 -2
- package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
- package/examples/jsm/loaders/usd/USDAParser.js +741 -0
- package/examples/jsm/loaders/usd/USDCParser.js +17 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/ColorSpaces.js +19 -1
- package/examples/jsm/math/ConvexHull.js +3 -3
- package/examples/jsm/math/ImprovedNoise.js +1 -1
- package/examples/jsm/math/Lut.js +2 -2
- package/examples/jsm/math/SimplexNoise.js +1 -1
- package/examples/jsm/misc/MD2CharacterComplex.js +1 -1
- package/examples/jsm/misc/ProgressiveLightMap.js +9 -3
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +7 -1
- package/examples/jsm/misc/TubePainter.js +383 -40
- package/examples/jsm/misc/Volume.js +1 -1
- package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
- package/examples/jsm/objects/LensflareMesh.js +3 -3
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/SkyMesh.js +3 -3
- package/examples/jsm/objects/Water.js +3 -3
- package/examples/jsm/objects/WaterMesh.js +6 -6
- package/examples/jsm/physics/RapierPhysics.js +95 -16
- package/examples/jsm/postprocessing/GTAOPass.js +10 -9
- package/examples/jsm/postprocessing/GlitchPass.js +2 -2
- package/examples/jsm/postprocessing/OutlinePass.js +17 -17
- package/examples/jsm/postprocessing/SSAOPass.js +10 -9
- package/examples/jsm/postprocessing/SSRPass.js +37 -8
- package/examples/jsm/postprocessing/UnrealBloomPass.js +8 -6
- package/examples/jsm/renderers/CSS2DRenderer.js +16 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +7 -6
- package/examples/jsm/renderers/SVGRenderer.js +1 -1
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +1 -1
- package/examples/jsm/shaders/AfterimageShader.js +1 -1
- package/examples/jsm/shaders/BleachBypassShader.js +1 -1
- package/examples/jsm/shaders/BokehShader.js +1 -1
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/DotScreenShader.js +1 -1
- package/examples/jsm/shaders/FocusShader.js +1 -1
- package/examples/jsm/shaders/GTAOShader.js +2 -2
- package/examples/jsm/shaders/GodRaysShader.js +1 -1
- package/examples/jsm/shaders/KaleidoShader.js +1 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +2 -2
- package/examples/jsm/shaders/SSRShader.js +1 -1
- package/examples/jsm/shaders/SepiaShader.js +1 -1
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +1 -1
- package/examples/jsm/shaders/TriangleBlurShader.js +1 -1
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +11 -2
- package/examples/jsm/shaders/VignetteShader.js +1 -1
- package/examples/jsm/transpiler/AST.js +381 -30
- package/examples/jsm/transpiler/GLSLDecoder.js +247 -104
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/TSLEncoder.js +196 -92
- package/examples/jsm/transpiler/Transpiler.js +17 -1
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +812 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +26 -24
- package/examples/jsm/tsl/display/AnamorphicNode.js +28 -4
- package/examples/jsm/tsl/display/BloomNode.js +11 -6
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +207 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +2 -0
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +446 -90
- package/examples/jsm/tsl/display/GTAONode.js +53 -5
- package/examples/jsm/tsl/display/GaussianBlurNode.js +55 -43
- package/examples/jsm/tsl/display/OutlineNode.js +13 -2
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/SSGINode.js +654 -0
- package/examples/jsm/tsl/display/SSRNode.js +182 -65
- package/examples/jsm/tsl/display/SSSNode.js +488 -0
- package/examples/jsm/tsl/display/TRAANode.js +578 -0
- package/examples/jsm/tsl/display/boxBlur.js +65 -0
- package/examples/jsm/tsl/display/hashBlur.js +18 -20
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +22 -2
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/ShadowMapViewerGPU.js +12 -5
- package/examples/jsm/webxr/OculusHandModel.js +1 -1
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -6
- package/package.json +5 -10
- package/src/Three.Core.js +5 -2
- package/src/Three.TSL.js +112 -32
- package/src/Three.WebGPU.Nodes.js +2 -0
- package/src/Three.WebGPU.js +4 -0
- package/src/animation/AnimationClip.js +20 -4
- package/src/animation/AnimationMixer.js +3 -3
- package/src/animation/AnimationObjectGroup.js +2 -1
- package/src/animation/KeyframeTrack.js +8 -7
- package/src/animation/PropertyBinding.js +12 -11
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/audio/Audio.js +10 -9
- package/src/audio/PositionalAudio.js +1 -1
- package/src/cameras/Camera.js +14 -0
- package/src/cameras/OrthographicCamera.js +2 -2
- package/src/cameras/PerspectiveCamera.js +2 -2
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +13 -5
- package/src/core/BufferAttribute.js +3 -3
- package/src/core/BufferGeometry.js +10 -10
- package/src/core/Clock.js +2 -8
- package/src/core/EventDispatcher.js +1 -1
- package/src/core/GLBufferAttribute.js +13 -1
- package/src/core/InterleavedBuffer.js +1 -1
- package/src/core/InterleavedBufferAttribute.js +3 -2
- package/src/core/Object3D.js +4 -3
- package/src/core/Raycaster.js +2 -1
- package/src/core/RenderTarget.js +10 -1
- package/{examples/jsm/misc → src/core}/Timer.js +4 -42
- package/src/extras/Controls.js +5 -4
- package/src/extras/DataUtils.js +2 -1
- package/src/extras/Earcut.js +6 -0
- package/src/extras/ImageUtils.js +2 -2
- package/src/extras/PMREMGenerator.js +279 -55
- package/src/extras/TextureUtils.js +2 -1
- package/src/extras/core/Curve.js +2 -1
- package/src/extras/core/Interpolations.js +7 -1
- package/src/extras/core/Path.js +22 -22
- package/src/extras/core/ShapePath.js +4 -4
- package/src/extras/lib/earcut.js +8 -8
- package/src/geometries/BoxGeometry.js +1 -0
- package/src/geometries/CapsuleGeometry.js +1 -0
- package/src/geometries/CircleGeometry.js +1 -0
- package/src/geometries/ConeGeometry.js +1 -0
- package/src/geometries/CylinderGeometry.js +1 -0
- package/src/geometries/DodecahedronGeometry.js +1 -0
- package/src/geometries/ExtrudeGeometry.js +8 -6
- package/src/geometries/IcosahedronGeometry.js +1 -0
- package/src/geometries/LatheGeometry.js +1 -0
- package/src/geometries/OctahedronGeometry.js +1 -0
- package/src/geometries/PlaneGeometry.js +1 -0
- package/src/geometries/RingGeometry.js +1 -0
- package/src/geometries/ShapeGeometry.js +1 -0
- package/src/geometries/SphereGeometry.js +1 -0
- package/src/geometries/TetrahedronGeometry.js +1 -0
- package/src/geometries/TorusGeometry.js +1 -0
- package/src/geometries/TorusKnotGeometry.js +1 -0
- package/src/geometries/TubeGeometry.js +1 -0
- package/src/helpers/CameraHelper.js +42 -12
- package/src/helpers/SkeletonHelper.js +35 -6
- package/src/lights/LightShadow.js +21 -8
- package/src/lights/PointLightShadow.js +1 -1
- package/src/lights/webgpu/ProjectorLight.js +1 -1
- package/src/loaders/AnimationLoader.js +2 -1
- package/src/loaders/AudioLoader.js +2 -1
- package/src/loaders/BufferGeometryLoader.js +2 -2
- package/src/loaders/Cache.js +2 -2
- package/src/loaders/DataTextureLoader.js +1 -1
- package/src/loaders/FileLoader.js +29 -5
- package/src/loaders/ImageBitmapLoader.js +32 -8
- package/src/loaders/ImageLoader.js +56 -9
- package/src/loaders/Loader.js +17 -3
- package/src/loaders/LoadingManager.js +45 -0
- package/src/loaders/MaterialLoader.js +3 -2
- package/src/loaders/ObjectLoader.js +13 -13
- package/src/loaders/TextureLoader.js +1 -1
- package/src/loaders/nodes/NodeLoader.js +3 -2
- package/src/materials/Material.js +16 -3
- package/src/materials/MeshBasicMaterial.js +2 -1
- package/src/materials/MeshDepthMaterial.js +1 -0
- package/src/materials/MeshDistanceMaterial.js +1 -1
- package/src/materials/MeshLambertMaterial.js +2 -1
- package/src/materials/MeshMatcapMaterial.js +22 -0
- package/src/materials/MeshNormalMaterial.js +1 -0
- package/src/materials/MeshPhongMaterial.js +2 -1
- package/src/materials/MeshPhysicalMaterial.js +2 -1
- package/src/materials/MeshStandardMaterial.js +8 -7
- package/src/materials/MeshToonMaterial.js +1 -0
- package/src/materials/PointsMaterial.js +1 -1
- package/src/materials/ShaderMaterial.js +2 -2
- package/src/materials/nodes/Line2NodeMaterial.js +2 -10
- package/src/materials/nodes/MeshBasicNodeMaterial.js +4 -3
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -1
- package/src/materials/nodes/MeshSSSNodeMaterial.js +3 -3
- package/src/materials/nodes/NodeMaterial.js +90 -27
- package/src/materials/nodes/PointsNodeMaterial.js +86 -28
- package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
- package/src/materials/nodes/manager/NodeMaterialObserver.js +89 -3
- package/src/math/Color.js +6 -5
- package/src/math/ColorManagement.js +9 -3
- package/src/math/Cylindrical.js +1 -1
- package/src/math/Euler.js +2 -1
- package/src/math/Frustum.js +25 -9
- package/src/math/FrustumArray.js +10 -5
- package/src/math/Line3.js +129 -2
- package/src/math/MathUtils.js +13 -11
- package/src/math/Matrix2.js +1 -1
- package/src/math/Matrix3.js +2 -2
- package/src/math/Matrix4.js +55 -34
- package/src/math/Plane.js +1 -1
- package/src/math/Quaternion.js +69 -67
- package/src/math/Spherical.js +3 -3
- package/src/nodes/Nodes.js +6 -4
- package/src/nodes/TSL.js +9 -4
- package/src/nodes/accessors/AccessorsUtils.js +7 -8
- package/src/nodes/accessors/Bitangent.js +31 -25
- package/src/nodes/accessors/BufferNode.js +1 -1
- package/src/nodes/accessors/Camera.js +142 -16
- package/src/nodes/accessors/ClippingNode.js +6 -5
- package/src/nodes/accessors/CubeTextureNode.js +5 -4
- package/src/nodes/accessors/InstanceNode.js +25 -5
- package/src/nodes/accessors/Lights.js +10 -0
- package/src/nodes/accessors/Normal.js +97 -30
- package/src/nodes/accessors/Object3DNode.js +2 -2
- package/src/nodes/accessors/Position.js +25 -9
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +20 -4
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SceneNode.js +3 -2
- package/src/nodes/accessors/StorageBufferNode.js +2 -1
- package/src/nodes/accessors/StorageTextureNode.js +23 -1
- package/src/nodes/accessors/Tangent.js +25 -17
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/Texture3DNode.js +14 -1
- package/src/nodes/accessors/TextureBicubic.js +21 -3
- package/src/nodes/accessors/TextureNode.js +142 -44
- package/src/nodes/accessors/UniformArrayNode.js +0 -16
- package/src/nodes/code/FunctionCallNode.js +24 -4
- package/src/nodes/code/FunctionNode.js +23 -0
- package/src/nodes/core/ArrayNode.js +13 -0
- package/src/nodes/core/AssignNode.js +6 -2
- package/src/nodes/core/AttributeNode.js +2 -1
- package/src/nodes/core/ContextNode.js +48 -10
- package/src/nodes/core/IndexNode.js +2 -2
- package/src/nodes/core/InputNode.js +2 -1
- package/src/nodes/core/InspectorNode.js +128 -0
- package/src/nodes/core/{CacheNode.js → IsolateNode.js} +36 -17
- package/src/nodes/core/Node.js +167 -34
- package/src/nodes/core/NodeBuilder.js +404 -120
- package/src/nodes/core/NodeFrame.js +21 -21
- package/src/nodes/core/NodeFunction.js +2 -1
- package/src/nodes/core/NodeParser.js +2 -1
- package/src/nodes/core/NodeUniform.js +1 -1
- package/src/nodes/core/NodeUtils.js +17 -88
- package/src/nodes/core/ParameterNode.js +31 -0
- package/src/nodes/core/PropertyNode.js +7 -0
- package/src/nodes/core/StackNode.js +77 -30
- package/src/nodes/core/StructNode.js +5 -5
- package/src/nodes/core/StructTypeNode.js +1 -0
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/UniformNode.js +80 -14
- package/src/nodes/core/VarNode.js +142 -16
- package/src/nodes/core/VaryingNode.js +9 -6
- package/src/nodes/display/BlendModes.js +7 -6
- package/src/nodes/display/BumpMapNode.js +1 -1
- package/src/nodes/display/ColorAdjustment.js +1 -1
- package/src/nodes/display/FrontFacingNode.js +35 -7
- package/src/nodes/display/NormalMapNode.js +20 -50
- package/src/nodes/display/PassNode.js +206 -17
- package/src/nodes/display/RenderOutputNode.js +28 -2
- package/src/nodes/display/ScreenNode.js +44 -40
- package/src/nodes/display/ToneMappingNode.js +31 -4
- package/src/nodes/display/ToonOutlinePassNode.js +8 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +16 -4
- package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
- package/src/nodes/display/ViewportTextureNode.js +94 -4
- package/src/nodes/fog/Fog.js +3 -2
- package/src/nodes/functions/BSDF/BRDF_GGX.js +2 -6
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +4 -4
- package/src/nodes/functions/BSDF/DFGApprox.js +60 -19
- package/src/nodes/functions/BasicLightingModel.js +2 -1
- package/src/nodes/functions/PhongLightingModel.js +3 -3
- package/src/nodes/functions/PhysicalLightingModel.js +19 -18
- package/src/nodes/functions/VolumetricLightingModel.js +5 -5
- package/src/nodes/functions/material/getGeometryRoughness.js +2 -2
- package/src/nodes/geometry/RangeNode.js +40 -4
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +2 -1
- package/src/nodes/gpgpu/ComputeNode.js +81 -25
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +29 -3
- package/src/nodes/lighting/EnvironmentNode.js +11 -11
- package/src/nodes/lighting/LightsNode.js +7 -8
- package/src/nodes/lighting/PointShadowNode.js +6 -0
- package/src/nodes/lighting/ProjectorLightNode.js +19 -6
- package/src/nodes/lighting/ShadowFilterNode.js +3 -1
- package/src/nodes/lighting/ShadowNode.js +77 -10
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +165 -1
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/ConditionalNode.js +25 -27
- package/src/nodes/math/MathNode.js +106 -65
- package/src/nodes/math/OperatorNode.js +28 -43
- package/src/nodes/pmrem/PMREMUtils.js +117 -2
- package/src/nodes/shapes/Shapes.js +1 -1
- package/src/nodes/tsl/TSLBase.js +6 -2
- package/src/nodes/tsl/TSLCore.js +546 -186
- package/src/nodes/utils/DebugNode.js +3 -2
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +119 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +37 -19
- package/src/nodes/utils/JoinNode.js +6 -3
- package/src/nodes/utils/LoopNode.js +20 -41
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/MemberNode.js +59 -7
- package/src/nodes/utils/PostProcessingUtils.js +28 -1
- package/src/nodes/utils/RTTNode.js +33 -6
- package/src/nodes/utils/ReflectorNode.js +68 -10
- package/src/nodes/utils/SampleNode.js +91 -0
- package/src/nodes/utils/SplitNode.js +11 -0
- package/src/nodes/utils/Timer.js +0 -47
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/objects/BatchedMesh.js +6 -4
- package/src/objects/LOD.js +1 -1
- package/src/objects/Line.js +2 -1
- package/src/objects/LineSegments.js +2 -1
- package/src/objects/Skeleton.js +3 -2
- package/src/objects/SkinnedMesh.js +3 -1
- package/src/objects/Sprite.js +4 -3
- package/src/renderers/WebGLRenderer.js +77 -66
- package/src/renderers/common/Animation.js +13 -1
- package/src/renderers/common/Attributes.js +1 -1
- package/src/renderers/common/Backend.js +108 -27
- package/src/renderers/common/Background.js +4 -3
- package/src/renderers/common/Bindings.js +76 -19
- package/src/renderers/common/CanvasTarget.js +341 -0
- package/src/renderers/common/ChainMap.js +1 -1
- package/src/renderers/common/Color4.js +2 -2
- package/src/renderers/common/CubeRenderTarget.js +1 -1
- package/src/renderers/common/DataMap.js +1 -1
- package/src/renderers/common/Geometries.js +26 -0
- package/src/renderers/common/Info.js +4 -2
- package/src/renderers/common/InspectorBase.js +146 -0
- package/src/renderers/common/Pipelines.js +1 -1
- package/src/renderers/common/PostProcessing.js +61 -25
- package/src/renderers/common/QuadMesh.js +7 -1
- package/src/renderers/common/RenderContext.js +2 -2
- package/src/renderers/common/RenderList.js +7 -3
- package/src/renderers/common/RenderObject.js +84 -5
- package/src/renderers/common/RenderObjects.js +1 -1
- package/src/renderers/common/Renderer.js +486 -255
- package/src/renderers/common/RendererUtils.js +9 -0
- package/src/renderers/common/SampledTexture.js +8 -68
- package/src/renderers/common/Sampler.js +117 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageTexture.js +27 -0
- package/src/renderers/common/Textures.js +138 -46
- package/src/renderers/common/TimestampQueryPool.js +65 -3
- package/src/renderers/common/UniformsGroup.js +2 -1
- package/src/renderers/common/XRManager.js +63 -24
- package/src/renderers/common/XRRenderTarget.js +21 -4
- package/src/renderers/common/extras/PMREMGenerator.js +161 -66
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +9 -7
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
- package/src/renderers/common/nodes/NodeSampler.js +13 -1
- package/src/renderers/common/nodes/Nodes.js +38 -16
- package/src/renderers/shaders/DFGLUTData.js +64 -0
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +52 -18
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +21 -11
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
- package/src/renderers/shaders/UniformsLib.js +1 -0
- package/src/renderers/shaders/UniformsUtils.js +25 -4
- package/src/renderers/webgl/WebGLAttributes.js +4 -0
- package/src/renderers/webgl/WebGLCapabilities.js +4 -3
- package/src/renderers/webgl/WebGLExtensions.js +2 -25
- package/src/renderers/webgl/WebGLInfo.js +3 -1
- package/src/renderers/webgl/WebGLProgram.js +25 -18
- package/src/renderers/webgl/WebGLPrograms.js +9 -6
- package/src/renderers/webgl/WebGLShadowMap.js +13 -2
- package/src/renderers/webgl/WebGLState.js +17 -16
- package/src/renderers/webgl/WebGLTextures.js +38 -21
- package/src/renderers/webgl/WebGLUniformsGroups.js +5 -3
- package/src/renderers/webgl/WebGLUtils.js +3 -2
- package/src/renderers/webgl-fallback/WebGLBackend.js +245 -182
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +184 -30
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +4 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +2 -3
- package/src/renderers/webgl-fallback/utils/WebGLState.js +9 -8
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +171 -19
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +51 -22
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +3 -2
- package/src/renderers/webgpu/WebGPUBackend.js +205 -128
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +2 -1
- package/src/renderers/webgpu/WebGPURenderer.js +3 -2
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +198 -121
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +8 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +49 -33
- package/src/renderers/webgpu/utils/WebGPUConstants.js +14 -3
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +56 -37
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +6 -8
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +266 -158
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +32 -9
- package/src/renderers/webgpu/utils/WebGPUUtils.js +24 -19
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
- package/src/renderers/webxr/WebXRManager.js +89 -13
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +14 -3
- package/src/textures/Texture.js +3 -2
- package/src/textures/VideoTexture.js +29 -2
- package/src/utils.js +67 -3
- package/examples/jsm/loaders/RGBMLoader.js +0 -1148
- package/examples/jsm/tsl/display/TRAAPassNode.js +0 -452
- package/src/nodes/utils/EquirectUVNode.js +0 -65
- package/src/nodes/utils/MatcapUVNode.js +0 -49
- package/src/nodes/utils/TriplanarTexturesNode.js +0 -148
package/build/three.module.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2010-2025 Three.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
import { Color, Matrix3, Vector2, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, cloneUniforms, BackSide, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, Euler, Matrix4, IntType, RGBAFormat, HalfFloatType, UnsignedByteType, FloatType, Plane, EquirectangularReflectionMapping, EquirectangularRefractionMapping, WebGLCubeRenderTarget, CubeReflectionMapping, CubeRefractionMapping, PerspectiveCamera, NoToneMapping, MeshBasicMaterial,
|
|
7
|
-
export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeCamera, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical,
|
|
6
|
+
import { Color, Matrix3, Vector2, mergeUniforms, Vector3, CubeUVReflectionMapping, Mesh, BoxGeometry, ShaderMaterial, cloneUniforms, BackSide, ColorManagement, SRGBTransfer, PlaneGeometry, FrontSide, getUnlitUniformColorSpace, Euler, Matrix4, IntType, warn, RGBAFormat, HalfFloatType, UnsignedByteType, FloatType, Plane, EquirectangularReflectionMapping, EquirectangularRefractionMapping, WebGLCubeRenderTarget, CubeReflectionMapping, CubeRefractionMapping, BufferGeometry, PerspectiveCamera, NoToneMapping, MeshBasicMaterial, error, BufferAttribute, WebGLRenderTarget, NoBlending, OrthographicCamera, LinearFilter, LinearSRGBColorSpace, warnOnce, arrayNeedsUint32, Uint32BufferAttribute, Uint16BufferAttribute, Vector4, DataArrayTexture, LessEqualCompare, Texture, DepthTexture, Data3DTexture, CubeTexture, GLSL3, CustomToneMapping, NeutralToneMapping, AgXToneMapping, ACESFilmicToneMapping, CineonToneMapping, ReinhardToneMapping, LinearToneMapping, PCFShadowMap, PCFSoftShadowMap, VSMShadowMap, LinearTransfer, AddOperation, MixOperation, MultiplyOperation, ObjectSpaceNormalMap, TangentSpaceNormalMap, NormalBlending, DoubleSide, UniformsUtils, Layers, Frustum, MeshDepthMaterial, RGBADepthPacking, MeshDistanceMaterial, NearestFilter, LessEqualDepth, AddEquation, SubtractEquation, ReverseSubtractEquation, ZeroFactor, OneFactor, SrcColorFactor, SrcAlphaFactor, SrcAlphaSaturateFactor, DstColorFactor, DstAlphaFactor, OneMinusSrcColorFactor, OneMinusSrcAlphaFactor, OneMinusDstColorFactor, OneMinusDstAlphaFactor, ConstantColorFactor, OneMinusConstantColorFactor, ConstantAlphaFactor, OneMinusConstantAlphaFactor, CustomBlending, MultiplyBlending, SubtractiveBlending, AdditiveBlending, CullFaceNone, CullFaceBack, CullFaceFront, NotEqualDepth, GreaterDepth, GreaterEqualDepth, EqualDepth, LessDepth, AlwaysDepth, NeverDepth, MinEquation, MaxEquation, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapNearestFilter, LinearMipmapLinearFilter, NeverCompare, AlwaysCompare, LessCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, NoColorSpace, DepthStencilFormat, getByteLength, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedShortType, createElementNS, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedInt5999Type, UnsignedInt101111Type, ByteType, ShortType, AlphaFormat, RGBFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, ExternalTexture, EventDispatcher, ArrayCamera, WebXRController, RAD2DEG, DataTexture, createCanvasElement, SRGBColorSpace, REVISION, log, WebGLCoordinateSystem, probeAsync } from './three.core.js';
|
|
7
|
+
export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeCamera, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NormalAnimationBlendMode, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, TOUCH, TetrahedronGeometry, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp, getConsoleFunction, setConsoleFunction } from './three.core.js';
|
|
8
8
|
|
|
9
9
|
function WebGLAnimation() {
|
|
10
10
|
|
|
@@ -81,6 +81,10 @@ function WebGLAttributes( gl ) {
|
|
|
81
81
|
|
|
82
82
|
type = gl.FLOAT;
|
|
83
83
|
|
|
84
|
+
} else if ( typeof Float16Array !== 'undefined' && array instanceof Float16Array ) {
|
|
85
|
+
|
|
86
|
+
type = gl.HALF_FLOAT;
|
|
87
|
+
|
|
84
88
|
} else if ( array instanceof Uint16Array ) {
|
|
85
89
|
|
|
86
90
|
if ( attribute.isFloat16BufferAttribute ) {
|
|
@@ -335,7 +339,7 @@ var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\
|
|
|
335
339
|
|
|
336
340
|
var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif";
|
|
337
341
|
|
|
338
|
-
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\
|
|
342
|
+
var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
|
|
339
343
|
|
|
340
344
|
var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
|
|
341
345
|
|
|
@@ -355,7 +359,7 @@ var colorspace_pars_fragment = "vec4 LinearTransferOETF( in vec4 value ) {\n\tre
|
|
|
355
359
|
|
|
356
360
|
var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
|
|
357
361
|
|
|
358
|
-
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n
|
|
362
|
+
var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif";
|
|
359
363
|
|
|
360
364
|
var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
|
|
361
365
|
|
|
@@ -381,7 +385,7 @@ var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertM
|
|
|
381
385
|
|
|
382
386
|
var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
|
|
383
387
|
|
|
384
|
-
var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness
|
|
388
|
+
var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";
|
|
385
389
|
|
|
386
390
|
var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
|
|
387
391
|
|
|
@@ -393,7 +397,7 @@ var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhong
|
|
|
393
397
|
|
|
394
398
|
var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
|
|
395
399
|
|
|
396
|
-
var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
400
|
+
var lights_physical_pars_fragment = "uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 uv = vec2( roughness, dotNV );\n\treturn texture2D( dfgLUT, uv ).rg;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNV * dotNV), 0.0, dotNV), material.roughness );\n\tvec2 dfgL = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNL * dotNL), 0.0, dotNL), material.roughness );\n\tvec3 FssEss_V = material.specularColor * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColor * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColor + ( 1.0 - material.specularColor ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
|
|
397
401
|
|
|
398
402
|
var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
|
|
399
403
|
|
|
@@ -401,13 +405,13 @@ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGH
|
|
|
401
405
|
|
|
402
406
|
var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
|
|
403
407
|
|
|
404
|
-
var logdepthbuf_fragment = "#if defined(
|
|
408
|
+
var logdepthbuf_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
|
|
405
409
|
|
|
406
|
-
var logdepthbuf_pars_fragment = "#if defined(
|
|
410
|
+
var logdepthbuf_pars_fragment = "#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
407
411
|
|
|
408
|
-
var logdepthbuf_pars_vertex = "#ifdef
|
|
412
|
+
var logdepthbuf_pars_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
|
|
409
413
|
|
|
410
|
-
var logdepthbuf_vertex = "#ifdef
|
|
414
|
+
var logdepthbuf_vertex = "#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";
|
|
411
415
|
|
|
412
416
|
var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
|
|
413
417
|
|
|
@@ -467,7 +471,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
|
|
|
467
471
|
|
|
468
472
|
var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
|
|
469
473
|
|
|
470
|
-
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\
|
|
474
|
+
var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\tfloat depth = unpackRGBAToDepth( texture2D( depths, uv ) );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\treturn step( depth, compare );\n\t\t#else\n\t\t\treturn step( compare, depth );\n\t\t#endif\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow( sampler2D shadow, vec2 uv, float compare ) {\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\tfloat hard_shadow = step( distribution.x, compare );\n\t\t#else\n\t\t\tfloat hard_shadow = step( compare, distribution.x );\n\t\t#endif\n\t\tif ( hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif";
|
|
471
475
|
|
|
472
476
|
var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
|
|
473
477
|
|
|
@@ -517,7 +521,7 @@ const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform fl
|
|
|
517
521
|
|
|
518
522
|
const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
|
|
519
523
|
|
|
520
|
-
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";
|
|
524
|
+
const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}";
|
|
521
525
|
|
|
522
526
|
const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
|
|
523
527
|
|
|
@@ -749,6 +753,7 @@ const UniformsLib = {
|
|
|
749
753
|
reflectivity: { value: 1.0 }, // basic, lambert, phong
|
|
750
754
|
ior: { value: 1.5 }, // physical
|
|
751
755
|
refractionRatio: { value: 0.98 }, // basic, lambert, phong
|
|
756
|
+
dfgLUT: { value: null } // DFG LUT for physically-based rendering
|
|
752
757
|
|
|
753
758
|
},
|
|
754
759
|
|
|
@@ -2345,13 +2350,13 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
2345
2350
|
|
|
2346
2351
|
if ( maxPrecision !== precision ) {
|
|
2347
2352
|
|
|
2348
|
-
|
|
2353
|
+
warn( 'WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.' );
|
|
2349
2354
|
precision = maxPrecision;
|
|
2350
2355
|
|
|
2351
2356
|
}
|
|
2352
2357
|
|
|
2353
2358
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
2354
|
-
const
|
|
2359
|
+
const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has( 'EXT_clip_control' );
|
|
2355
2360
|
|
|
2356
2361
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
2357
2362
|
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
@@ -2379,7 +2384,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
2379
2384
|
|
|
2380
2385
|
precision: precision,
|
|
2381
2386
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
2382
|
-
|
|
2387
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
2383
2388
|
|
|
2384
2389
|
maxTextures: maxTextures,
|
|
2385
2390
|
maxVertexTextures: maxVertexTextures,
|
|
@@ -2662,16 +2667,18 @@ function WebGLCubeMaps( renderer ) {
|
|
|
2662
2667
|
|
|
2663
2668
|
const LOD_MIN = 4;
|
|
2664
2669
|
|
|
2665
|
-
// The standard deviations (radians) associated with the extra mips.
|
|
2666
|
-
//
|
|
2667
|
-
// geometric shadowing function. These sigma values squared must match the
|
|
2668
|
-
// variance #defines in cube_uv_reflection_fragment.glsl.js.
|
|
2670
|
+
// The standard deviations (radians) associated with the extra mips.
|
|
2671
|
+
// Used for scene blur in fromScene() method.
|
|
2669
2672
|
const EXTRA_LOD_SIGMA = [ 0.125, 0.215, 0.35, 0.446, 0.526, 0.582 ];
|
|
2670
2673
|
|
|
2671
2674
|
// The maximum length of the blur for loop. Smaller sigmas will use fewer
|
|
2672
2675
|
// samples and exit early, but not recompile the shader.
|
|
2676
|
+
// Used for scene blur in fromScene() method.
|
|
2673
2677
|
const MAX_SAMPLES = 20;
|
|
2674
2678
|
|
|
2679
|
+
// GGX VNDF importance sampling configuration
|
|
2680
|
+
const GGX_SAMPLES = 256;
|
|
2681
|
+
|
|
2675
2682
|
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
|
|
2676
2683
|
const _clearColor = /*@__PURE__*/ new Color();
|
|
2677
2684
|
let _oldTarget = null;
|
|
@@ -2679,24 +2686,6 @@ let _oldActiveCubeFace = 0;
|
|
|
2679
2686
|
let _oldActiveMipmapLevel = 0;
|
|
2680
2687
|
let _oldXrEnabled = false;
|
|
2681
2688
|
|
|
2682
|
-
// Golden Ratio
|
|
2683
|
-
const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
|
|
2684
|
-
const INV_PHI = 1 / PHI;
|
|
2685
|
-
|
|
2686
|
-
// Vertices of a dodecahedron (except the opposites, which represent the
|
|
2687
|
-
// same axis), used as axis directions evenly spread on a sphere.
|
|
2688
|
-
const _axisDirections = [
|
|
2689
|
-
/*@__PURE__*/ new Vector3( - PHI, INV_PHI, 0 ),
|
|
2690
|
-
/*@__PURE__*/ new Vector3( PHI, INV_PHI, 0 ),
|
|
2691
|
-
/*@__PURE__*/ new Vector3( - INV_PHI, 0, PHI ),
|
|
2692
|
-
/*@__PURE__*/ new Vector3( INV_PHI, 0, PHI ),
|
|
2693
|
-
/*@__PURE__*/ new Vector3( 0, PHI, - INV_PHI ),
|
|
2694
|
-
/*@__PURE__*/ new Vector3( 0, PHI, INV_PHI ),
|
|
2695
|
-
/*@__PURE__*/ new Vector3( -1, 1, -1 ),
|
|
2696
|
-
/*@__PURE__*/ new Vector3( 1, 1, -1 ),
|
|
2697
|
-
/*@__PURE__*/ new Vector3( -1, 1, 1 ),
|
|
2698
|
-
/*@__PURE__*/ new Vector3( 1, 1, 1 ) ];
|
|
2699
|
-
|
|
2700
2689
|
const _origin = /*@__PURE__*/ new Vector3();
|
|
2701
2690
|
|
|
2702
2691
|
/**
|
|
@@ -2710,9 +2699,11 @@ const _origin = /*@__PURE__*/ new Vector3();
|
|
|
2710
2699
|
* higher roughness levels. In this way we maintain resolution to smoothly
|
|
2711
2700
|
* interpolate diffuse lighting while limiting sampling computation.
|
|
2712
2701
|
*
|
|
2713
|
-
*
|
|
2714
|
-
*
|
|
2715
|
-
|
|
2702
|
+
* The prefiltering uses GGX VNDF (Visible Normal Distribution Function)
|
|
2703
|
+
* importance sampling based on "Sampling the GGX Distribution of Visible Normals"
|
|
2704
|
+
* (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF
|
|
2705
|
+
* used in material rendering for physically-based image-based lighting.
|
|
2706
|
+
*/
|
|
2716
2707
|
class PMREMGenerator {
|
|
2717
2708
|
|
|
2718
2709
|
/**
|
|
@@ -2727,15 +2718,17 @@ class PMREMGenerator {
|
|
|
2727
2718
|
|
|
2728
2719
|
this._lodMax = 0;
|
|
2729
2720
|
this._cubeSize = 0;
|
|
2730
|
-
this._lodPlanes = [];
|
|
2731
2721
|
this._sizeLods = [];
|
|
2732
2722
|
this._sigmas = [];
|
|
2723
|
+
this._lodMeshes = [];
|
|
2724
|
+
|
|
2725
|
+
this._backgroundBox = null;
|
|
2733
2726
|
|
|
2734
|
-
this._blurMaterial = null;
|
|
2735
2727
|
this._cubemapMaterial = null;
|
|
2736
2728
|
this._equirectMaterial = null;
|
|
2737
2729
|
|
|
2738
|
-
this.
|
|
2730
|
+
this._blurMaterial = null;
|
|
2731
|
+
this._ggxMaterial = null;
|
|
2739
2732
|
|
|
2740
2733
|
}
|
|
2741
2734
|
|
|
@@ -2860,6 +2853,13 @@ class PMREMGenerator {
|
|
|
2860
2853
|
if ( this._cubemapMaterial !== null ) this._cubemapMaterial.dispose();
|
|
2861
2854
|
if ( this._equirectMaterial !== null ) this._equirectMaterial.dispose();
|
|
2862
2855
|
|
|
2856
|
+
if ( this._backgroundBox !== null ) {
|
|
2857
|
+
|
|
2858
|
+
this._backgroundBox.geometry.dispose();
|
|
2859
|
+
this._backgroundBox.material.dispose();
|
|
2860
|
+
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
2863
|
}
|
|
2864
2864
|
|
|
2865
2865
|
// private interface
|
|
@@ -2874,12 +2874,13 @@ class PMREMGenerator {
|
|
|
2874
2874
|
_dispose() {
|
|
2875
2875
|
|
|
2876
2876
|
if ( this._blurMaterial !== null ) this._blurMaterial.dispose();
|
|
2877
|
+
if ( this._ggxMaterial !== null ) this._ggxMaterial.dispose();
|
|
2877
2878
|
|
|
2878
2879
|
if ( this._pingPongRenderTarget !== null ) this._pingPongRenderTarget.dispose();
|
|
2879
2880
|
|
|
2880
|
-
for ( let i = 0; i < this.
|
|
2881
|
+
for ( let i = 0; i < this._lodMeshes.length; i ++ ) {
|
|
2881
2882
|
|
|
2882
|
-
this.
|
|
2883
|
+
this._lodMeshes[ i ].geometry.dispose();
|
|
2883
2884
|
|
|
2884
2885
|
}
|
|
2885
2886
|
|
|
@@ -2951,7 +2952,7 @@ class PMREMGenerator {
|
|
|
2951
2952
|
this._pingPongRenderTarget = _createRenderTarget( width, height, params );
|
|
2952
2953
|
|
|
2953
2954
|
const { _lodMax } = this;
|
|
2954
|
-
( {
|
|
2955
|
+
( { lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
|
|
2955
2956
|
|
|
2956
2957
|
this._blurMaterial = _getBlurShader( _lodMax, width, height );
|
|
2957
2958
|
|
|
@@ -2963,8 +2964,8 @@ class PMREMGenerator {
|
|
|
2963
2964
|
|
|
2964
2965
|
_compileMaterial( material ) {
|
|
2965
2966
|
|
|
2966
|
-
const
|
|
2967
|
-
this._renderer.compile(
|
|
2967
|
+
const mesh = new Mesh( new BufferGeometry(), material );
|
|
2968
|
+
this._renderer.compile( mesh, _flatCamera );
|
|
2968
2969
|
|
|
2969
2970
|
}
|
|
2970
2971
|
|
|
@@ -2984,16 +2985,36 @@ class PMREMGenerator {
|
|
|
2984
2985
|
renderer.toneMapping = NoToneMapping;
|
|
2985
2986
|
renderer.autoClear = false;
|
|
2986
2987
|
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
side: BackSide,
|
|
2990
|
-
depthWrite: false,
|
|
2991
|
-
depthTest: false,
|
|
2992
|
-
} );
|
|
2988
|
+
// https://github.com/mrdoob/three.js/issues/31413#issuecomment-3095966812
|
|
2989
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
2993
2990
|
|
|
2994
|
-
|
|
2991
|
+
if ( reversedDepthBuffer ) {
|
|
2992
|
+
|
|
2993
|
+
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
2994
|
+
renderer.clearDepth();
|
|
2995
|
+
renderer.setRenderTarget( null );
|
|
2996
|
+
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
if ( this._backgroundBox === null ) {
|
|
3000
|
+
|
|
3001
|
+
this._backgroundBox = new Mesh(
|
|
3002
|
+
new BoxGeometry(),
|
|
3003
|
+
new MeshBasicMaterial( {
|
|
3004
|
+
name: 'PMREM.Background',
|
|
3005
|
+
side: BackSide,
|
|
3006
|
+
depthWrite: false,
|
|
3007
|
+
depthTest: false,
|
|
3008
|
+
} )
|
|
3009
|
+
);
|
|
3010
|
+
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
const backgroundBox = this._backgroundBox;
|
|
3014
|
+
const backgroundMaterial = backgroundBox.material;
|
|
2995
3015
|
|
|
2996
3016
|
let useSolidColor = false;
|
|
3017
|
+
|
|
2997
3018
|
const background = scene.background;
|
|
2998
3019
|
|
|
2999
3020
|
if ( background ) {
|
|
@@ -3054,9 +3075,6 @@ class PMREMGenerator {
|
|
|
3054
3075
|
|
|
3055
3076
|
}
|
|
3056
3077
|
|
|
3057
|
-
backgroundBox.geometry.dispose();
|
|
3058
|
-
backgroundBox.material.dispose();
|
|
3059
|
-
|
|
3060
3078
|
renderer.toneMapping = toneMapping;
|
|
3061
3079
|
renderer.autoClear = originalAutoClear;
|
|
3062
3080
|
scene.background = background;
|
|
@@ -3090,7 +3108,9 @@ class PMREMGenerator {
|
|
|
3090
3108
|
}
|
|
3091
3109
|
|
|
3092
3110
|
const material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;
|
|
3093
|
-
|
|
3111
|
+
|
|
3112
|
+
const mesh = this._lodMeshes[ 0 ];
|
|
3113
|
+
mesh.material = material;
|
|
3094
3114
|
|
|
3095
3115
|
const uniforms = material.uniforms;
|
|
3096
3116
|
|
|
@@ -3110,19 +3130,82 @@ class PMREMGenerator {
|
|
|
3110
3130
|
const renderer = this._renderer;
|
|
3111
3131
|
const autoClear = renderer.autoClear;
|
|
3112
3132
|
renderer.autoClear = false;
|
|
3113
|
-
const n = this._lodPlanes.length;
|
|
3114
3133
|
|
|
3134
|
+
const n = this._lodMeshes.length;
|
|
3135
|
+
|
|
3136
|
+
// Use GGX VNDF importance sampling
|
|
3115
3137
|
for ( let i = 1; i < n; i ++ ) {
|
|
3116
3138
|
|
|
3117
|
-
|
|
3139
|
+
this._applyGGXFilter( cubeUVRenderTarget, i - 1, i );
|
|
3140
|
+
|
|
3141
|
+
}
|
|
3142
|
+
|
|
3143
|
+
renderer.autoClear = autoClear;
|
|
3144
|
+
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
/**
|
|
3148
|
+
* Applies GGX VNDF importance sampling filter to generate a prefiltered environment map.
|
|
3149
|
+
* Uses Monte Carlo integration with VNDF importance sampling to accurately represent the
|
|
3150
|
+
* GGX BRDF for physically-based rendering. Reads from the previous LOD level and
|
|
3151
|
+
* applies incremental roughness filtering to avoid over-blurring.
|
|
3152
|
+
*
|
|
3153
|
+
* @private
|
|
3154
|
+
* @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
3155
|
+
* @param {number} lodIn - Source LOD level to read from
|
|
3156
|
+
* @param {number} lodOut - Target LOD level to write to
|
|
3157
|
+
*/
|
|
3158
|
+
_applyGGXFilter( cubeUVRenderTarget, lodIn, lodOut ) {
|
|
3159
|
+
|
|
3160
|
+
const renderer = this._renderer;
|
|
3161
|
+
const pingPongRenderTarget = this._pingPongRenderTarget;
|
|
3118
3162
|
|
|
3119
|
-
|
|
3163
|
+
if ( this._ggxMaterial === null ) {
|
|
3120
3164
|
|
|
3121
|
-
|
|
3165
|
+
const width = 3 * Math.max( this._cubeSize, 16 );
|
|
3166
|
+
const height = 4 * this._cubeSize;
|
|
3167
|
+
this._ggxMaterial = _getGGXShader( this._lodMax, width, height );
|
|
3122
3168
|
|
|
3123
3169
|
}
|
|
3124
3170
|
|
|
3125
|
-
|
|
3171
|
+
const ggxMaterial = this._ggxMaterial;
|
|
3172
|
+
const ggxMesh = this._lodMeshes[ lodOut ];
|
|
3173
|
+
ggxMesh.material = ggxMaterial;
|
|
3174
|
+
|
|
3175
|
+
const ggxUniforms = ggxMaterial.uniforms;
|
|
3176
|
+
|
|
3177
|
+
// Calculate incremental roughness between LOD levels
|
|
3178
|
+
const targetRoughness = lodOut / ( this._lodMeshes.length - 1 );
|
|
3179
|
+
const sourceRoughness = lodIn / ( this._lodMeshes.length - 1 );
|
|
3180
|
+
const incrementalRoughness = Math.sqrt( targetRoughness * targetRoughness - sourceRoughness * sourceRoughness );
|
|
3181
|
+
|
|
3182
|
+
// Apply blur strength mapping for better quality across the roughness range
|
|
3183
|
+
const blurStrength = 0.05 + targetRoughness * 0.95;
|
|
3184
|
+
const adjustedRoughness = incrementalRoughness * blurStrength;
|
|
3185
|
+
|
|
3186
|
+
// Calculate viewport position based on output LOD level
|
|
3187
|
+
const { _lodMax } = this;
|
|
3188
|
+
const outputSize = this._sizeLods[ lodOut ];
|
|
3189
|
+
const x = 3 * outputSize * ( lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0 );
|
|
3190
|
+
const y = 4 * ( this._cubeSize - outputSize );
|
|
3191
|
+
|
|
3192
|
+
// Read from previous LOD with incremental roughness
|
|
3193
|
+
ggxUniforms[ 'envMap' ].value = cubeUVRenderTarget.texture;
|
|
3194
|
+
ggxUniforms[ 'roughness' ].value = adjustedRoughness;
|
|
3195
|
+
ggxUniforms[ 'mipInt' ].value = _lodMax - lodIn; // Sample from input LOD
|
|
3196
|
+
|
|
3197
|
+
_setViewport( pingPongRenderTarget, x, y, 3 * outputSize, 2 * outputSize );
|
|
3198
|
+
renderer.setRenderTarget( pingPongRenderTarget );
|
|
3199
|
+
renderer.render( ggxMesh, _flatCamera );
|
|
3200
|
+
|
|
3201
|
+
// Copy from pingPong back to cubeUV (simple direct copy)
|
|
3202
|
+
ggxUniforms[ 'envMap' ].value = pingPongRenderTarget.texture;
|
|
3203
|
+
ggxUniforms[ 'roughness' ].value = 0.0; // Direct copy
|
|
3204
|
+
ggxUniforms[ 'mipInt' ].value = _lodMax - lodOut; // Read from the level we just wrote
|
|
3205
|
+
|
|
3206
|
+
_setViewport( cubeUVRenderTarget, x, y, 3 * outputSize, 2 * outputSize );
|
|
3207
|
+
renderer.setRenderTarget( cubeUVRenderTarget );
|
|
3208
|
+
renderer.render( ggxMesh, _flatCamera );
|
|
3126
3209
|
|
|
3127
3210
|
}
|
|
3128
3211
|
|
|
@@ -3133,6 +3216,8 @@ class PMREMGenerator {
|
|
|
3133
3216
|
* the poles) to approximate the orthogonally-separable blur. It is least
|
|
3134
3217
|
* accurate at the poles, but still does a decent job.
|
|
3135
3218
|
*
|
|
3219
|
+
* Used for initial scene blur in fromScene() method when sigma > 0.
|
|
3220
|
+
*
|
|
3136
3221
|
* @private
|
|
3137
3222
|
* @param {WebGLRenderTarget} cubeUVRenderTarget
|
|
3138
3223
|
* @param {number} lodIn
|
|
@@ -3171,7 +3256,7 @@ class PMREMGenerator {
|
|
|
3171
3256
|
|
|
3172
3257
|
if ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {
|
|
3173
3258
|
|
|
3174
|
-
|
|
3259
|
+
error(
|
|
3175
3260
|
'blur direction must be either latitudinal or longitudinal!' );
|
|
3176
3261
|
|
|
3177
3262
|
}
|
|
@@ -3179,7 +3264,9 @@ class PMREMGenerator {
|
|
|
3179
3264
|
// Number of standard deviations at which to cut off the discrete approximation.
|
|
3180
3265
|
const STANDARD_DEVIATIONS = 3;
|
|
3181
3266
|
|
|
3182
|
-
const blurMesh =
|
|
3267
|
+
const blurMesh = this._lodMeshes[ lodOut ];
|
|
3268
|
+
blurMesh.material = blurMaterial;
|
|
3269
|
+
|
|
3183
3270
|
const blurUniforms = blurMaterial.uniforms;
|
|
3184
3271
|
|
|
3185
3272
|
const pixels = this._sizeLods[ lodIn ] - 1;
|
|
@@ -3189,7 +3276,7 @@ class PMREMGenerator {
|
|
|
3189
3276
|
|
|
3190
3277
|
if ( samples > MAX_SAMPLES ) {
|
|
3191
3278
|
|
|
3192
|
-
|
|
3279
|
+
warn( `sigmaRadians, ${
|
|
3193
3280
|
sigmaRadians}, is too large and will clip, as it requested ${
|
|
3194
3281
|
samples} samples when the maximum is set to ${MAX_SAMPLES}` );
|
|
3195
3282
|
|
|
@@ -3253,9 +3340,9 @@ class PMREMGenerator {
|
|
|
3253
3340
|
|
|
3254
3341
|
function _createPlanes( lodMax ) {
|
|
3255
3342
|
|
|
3256
|
-
const lodPlanes = [];
|
|
3257
3343
|
const sizeLods = [];
|
|
3258
3344
|
const sigmas = [];
|
|
3345
|
+
const lodMeshes = [];
|
|
3259
3346
|
|
|
3260
3347
|
let lod = lodMax;
|
|
3261
3348
|
|
|
@@ -3317,7 +3404,7 @@ function _createPlanes( lodMax ) {
|
|
|
3317
3404
|
planes.setAttribute( 'position', new BufferAttribute( position, positionSize ) );
|
|
3318
3405
|
planes.setAttribute( 'uv', new BufferAttribute( uv, uvSize ) );
|
|
3319
3406
|
planes.setAttribute( 'faceIndex', new BufferAttribute( faceIndex, faceIndexSize ) );
|
|
3320
|
-
|
|
3407
|
+
lodMeshes.push( new Mesh( planes, null ) );
|
|
3321
3408
|
|
|
3322
3409
|
if ( lod > LOD_MIN ) {
|
|
3323
3410
|
|
|
@@ -3327,7 +3414,7 @@ function _createPlanes( lodMax ) {
|
|
|
3327
3414
|
|
|
3328
3415
|
}
|
|
3329
3416
|
|
|
3330
|
-
return {
|
|
3417
|
+
return { lodMeshes, sizeLods, sigmas };
|
|
3331
3418
|
|
|
3332
3419
|
}
|
|
3333
3420
|
|
|
@@ -3348,6 +3435,147 @@ function _setViewport( target, x, y, width, height ) {
|
|
|
3348
3435
|
|
|
3349
3436
|
}
|
|
3350
3437
|
|
|
3438
|
+
function _getGGXShader( lodMax, width, height ) {
|
|
3439
|
+
|
|
3440
|
+
const shaderMaterial = new ShaderMaterial( {
|
|
3441
|
+
|
|
3442
|
+
name: 'PMREMGGXConvolution',
|
|
3443
|
+
|
|
3444
|
+
defines: {
|
|
3445
|
+
'GGX_SAMPLES': GGX_SAMPLES,
|
|
3446
|
+
'CUBEUV_TEXEL_WIDTH': 1.0 / width,
|
|
3447
|
+
'CUBEUV_TEXEL_HEIGHT': 1.0 / height,
|
|
3448
|
+
'CUBEUV_MAX_MIP': `${lodMax}.0`,
|
|
3449
|
+
},
|
|
3450
|
+
|
|
3451
|
+
uniforms: {
|
|
3452
|
+
'envMap': { value: null },
|
|
3453
|
+
'roughness': { value: 0.0 },
|
|
3454
|
+
'mipInt': { value: 0 }
|
|
3455
|
+
},
|
|
3456
|
+
|
|
3457
|
+
vertexShader: _getCommonVertexShader(),
|
|
3458
|
+
|
|
3459
|
+
fragmentShader: /* glsl */`
|
|
3460
|
+
|
|
3461
|
+
precision highp float;
|
|
3462
|
+
precision highp int;
|
|
3463
|
+
|
|
3464
|
+
varying vec3 vOutputDirection;
|
|
3465
|
+
|
|
3466
|
+
uniform sampler2D envMap;
|
|
3467
|
+
uniform float roughness;
|
|
3468
|
+
uniform float mipInt;
|
|
3469
|
+
|
|
3470
|
+
#define ENVMAP_TYPE_CUBE_UV
|
|
3471
|
+
#include <cube_uv_reflection_fragment>
|
|
3472
|
+
|
|
3473
|
+
#define PI 3.14159265359
|
|
3474
|
+
|
|
3475
|
+
// Van der Corput radical inverse
|
|
3476
|
+
float radicalInverse_VdC(uint bits) {
|
|
3477
|
+
bits = (bits << 16u) | (bits >> 16u);
|
|
3478
|
+
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
|
3479
|
+
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
|
3480
|
+
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
|
3481
|
+
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
|
3482
|
+
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
// Hammersley sequence
|
|
3486
|
+
vec2 hammersley(uint i, uint N) {
|
|
3487
|
+
return vec2(float(i) / float(N), radicalInverse_VdC(i));
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3490
|
+
// GGX VNDF importance sampling (Eric Heitz 2018)
|
|
3491
|
+
// "Sampling the GGX Distribution of Visible Normals"
|
|
3492
|
+
// https://jcgt.org/published/0007/04/01/
|
|
3493
|
+
vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
|
|
3494
|
+
float alpha = roughness * roughness;
|
|
3495
|
+
|
|
3496
|
+
// Section 3.2: Transform view direction to hemisphere configuration
|
|
3497
|
+
vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
|
|
3498
|
+
|
|
3499
|
+
// Section 4.1: Orthonormal basis
|
|
3500
|
+
float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
|
|
3501
|
+
vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
|
|
3502
|
+
vec3 T2 = cross(Vh, T1);
|
|
3503
|
+
|
|
3504
|
+
// Section 4.2: Parameterization of projected area
|
|
3505
|
+
float r = sqrt(Xi.x);
|
|
3506
|
+
float phi = 2.0 * PI * Xi.y;
|
|
3507
|
+
float t1 = r * cos(phi);
|
|
3508
|
+
float t2 = r * sin(phi);
|
|
3509
|
+
float s = 0.5 * (1.0 + Vh.z);
|
|
3510
|
+
t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
|
|
3511
|
+
|
|
3512
|
+
// Section 4.3: Reprojection onto hemisphere
|
|
3513
|
+
vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
|
|
3514
|
+
|
|
3515
|
+
// Section 3.4: Transform back to ellipsoid configuration
|
|
3516
|
+
return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3519
|
+
void main() {
|
|
3520
|
+
vec3 N = normalize(vOutputDirection);
|
|
3521
|
+
vec3 V = N; // Assume view direction equals normal for pre-filtering
|
|
3522
|
+
|
|
3523
|
+
vec3 prefilteredColor = vec3(0.0);
|
|
3524
|
+
float totalWeight = 0.0;
|
|
3525
|
+
|
|
3526
|
+
// For very low roughness, just sample the environment directly
|
|
3527
|
+
if (roughness < 0.001) {
|
|
3528
|
+
gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
|
|
3529
|
+
return;
|
|
3530
|
+
}
|
|
3531
|
+
|
|
3532
|
+
// Tangent space basis for VNDF sampling
|
|
3533
|
+
vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
|
3534
|
+
vec3 tangent = normalize(cross(up, N));
|
|
3535
|
+
vec3 bitangent = cross(N, tangent);
|
|
3536
|
+
|
|
3537
|
+
for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
|
|
3538
|
+
vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
|
|
3539
|
+
|
|
3540
|
+
// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
|
|
3541
|
+
vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
|
|
3542
|
+
|
|
3543
|
+
// Transform H back to world space
|
|
3544
|
+
vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
|
|
3545
|
+
vec3 L = normalize(2.0 * dot(V, H) * H - V);
|
|
3546
|
+
|
|
3547
|
+
float NdotL = max(dot(N, L), 0.0);
|
|
3548
|
+
|
|
3549
|
+
if(NdotL > 0.0) {
|
|
3550
|
+
// Sample environment at fixed mip level
|
|
3551
|
+
// VNDF importance sampling handles the distribution filtering
|
|
3552
|
+
vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
|
|
3553
|
+
|
|
3554
|
+
// Weight by NdotL for the split-sum approximation
|
|
3555
|
+
// VNDF PDF naturally accounts for the visible microfacet distribution
|
|
3556
|
+
prefilteredColor += sampleColor * NdotL;
|
|
3557
|
+
totalWeight += NdotL;
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
|
|
3561
|
+
if (totalWeight > 0.0) {
|
|
3562
|
+
prefilteredColor = prefilteredColor / totalWeight;
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3565
|
+
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
3566
|
+
}
|
|
3567
|
+
`,
|
|
3568
|
+
|
|
3569
|
+
blending: NoBlending,
|
|
3570
|
+
depthTest: false,
|
|
3571
|
+
depthWrite: false
|
|
3572
|
+
|
|
3573
|
+
} );
|
|
3574
|
+
|
|
3575
|
+
return shaderMaterial;
|
|
3576
|
+
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3351
3579
|
function _getBlurShader( lodMax, width, height ) {
|
|
3352
3580
|
|
|
3353
3581
|
const weights = new Float32Array( MAX_SAMPLES );
|
|
@@ -3730,30 +3958,7 @@ function WebGLExtensions( gl ) {
|
|
|
3730
3958
|
|
|
3731
3959
|
}
|
|
3732
3960
|
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
switch ( name ) {
|
|
3736
|
-
|
|
3737
|
-
case 'WEBGL_depth_texture':
|
|
3738
|
-
extension = gl.getExtension( 'WEBGL_depth_texture' ) || gl.getExtension( 'MOZ_WEBGL_depth_texture' ) || gl.getExtension( 'WEBKIT_WEBGL_depth_texture' );
|
|
3739
|
-
break;
|
|
3740
|
-
|
|
3741
|
-
case 'EXT_texture_filter_anisotropic':
|
|
3742
|
-
extension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );
|
|
3743
|
-
break;
|
|
3744
|
-
|
|
3745
|
-
case 'WEBGL_compressed_texture_s3tc':
|
|
3746
|
-
extension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );
|
|
3747
|
-
break;
|
|
3748
|
-
|
|
3749
|
-
case 'WEBGL_compressed_texture_pvrtc':
|
|
3750
|
-
extension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );
|
|
3751
|
-
break;
|
|
3752
|
-
|
|
3753
|
-
default:
|
|
3754
|
-
extension = gl.getExtension( name );
|
|
3755
|
-
|
|
3756
|
-
}
|
|
3961
|
+
const extension = gl.getExtension( name );
|
|
3757
3962
|
|
|
3758
3963
|
extensions[ name ] = extension;
|
|
3759
3964
|
|
|
@@ -3786,7 +3991,7 @@ function WebGLExtensions( gl ) {
|
|
|
3786
3991
|
|
|
3787
3992
|
if ( extension === null ) {
|
|
3788
3993
|
|
|
3789
|
-
warnOnce( '
|
|
3994
|
+
warnOnce( 'WebGLRenderer: ' + name + ' extension not supported.' );
|
|
3790
3995
|
|
|
3791
3996
|
}
|
|
3792
3997
|
|
|
@@ -4116,7 +4321,7 @@ function WebGLInfo( gl ) {
|
|
|
4116
4321
|
break;
|
|
4117
4322
|
|
|
4118
4323
|
default:
|
|
4119
|
-
|
|
4324
|
+
error( 'WebGLInfo: Unknown draw mode:', mode );
|
|
4120
4325
|
break;
|
|
4121
4326
|
|
|
4122
4327
|
}
|
|
@@ -5702,7 +5907,7 @@ function getEncodingComponents( colorSpace ) {
|
|
|
5702
5907
|
return [ encodingMatrix, 'sRGBTransferOETF' ];
|
|
5703
5908
|
|
|
5704
5909
|
default:
|
|
5705
|
-
|
|
5910
|
+
warn( 'WebGLProgram: Unsupported color space: ', colorSpace );
|
|
5706
5911
|
return [ encodingMatrix, 'LinearTransferOETF' ];
|
|
5707
5912
|
|
|
5708
5913
|
}
|
|
@@ -5712,7 +5917,9 @@ function getEncodingComponents( colorSpace ) {
|
|
|
5712
5917
|
function getShaderErrors( gl, shader, type ) {
|
|
5713
5918
|
|
|
5714
5919
|
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
|
|
5715
|
-
|
|
5920
|
+
|
|
5921
|
+
const shaderInfoLog = gl.getShaderInfoLog( shader ) || '';
|
|
5922
|
+
const errors = shaderInfoLog.trim();
|
|
5716
5923
|
|
|
5717
5924
|
if ( status && errors === '' ) return '';
|
|
5718
5925
|
|
|
@@ -5720,7 +5927,7 @@ function getShaderErrors( gl, shader, type ) {
|
|
|
5720
5927
|
if ( errorMatches ) {
|
|
5721
5928
|
|
|
5722
5929
|
// --enable-privileged-webgl-extension
|
|
5723
|
-
//
|
|
5930
|
+
// log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );
|
|
5724
5931
|
|
|
5725
5932
|
const errorLine = parseInt( errorMatches[ 1 ] );
|
|
5726
5933
|
return type.toUpperCase() + '\n\n' + errors + '\n\n' + handleSource( gl.getShaderSource( shader ), errorLine );
|
|
@@ -5784,7 +5991,7 @@ function getToneMappingFunction( functionName, toneMapping ) {
|
|
|
5784
5991
|
break;
|
|
5785
5992
|
|
|
5786
5993
|
default:
|
|
5787
|
-
|
|
5994
|
+
warn( 'WebGLProgram: Unsupported toneMapping:', toneMapping );
|
|
5788
5995
|
toneMappingName = 'Linear';
|
|
5789
5996
|
|
|
5790
5997
|
}
|
|
@@ -5862,7 +6069,7 @@ function fetchAttributeLocations( gl, program ) {
|
|
|
5862
6069
|
if ( info.type === gl.FLOAT_MAT3 ) locationSize = 3;
|
|
5863
6070
|
if ( info.type === gl.FLOAT_MAT4 ) locationSize = 4;
|
|
5864
6071
|
|
|
5865
|
-
//
|
|
6072
|
+
// log( 'WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );
|
|
5866
6073
|
|
|
5867
6074
|
attributes[ name ] = {
|
|
5868
6075
|
type: info.type,
|
|
@@ -5932,7 +6139,7 @@ function includeReplacer( match, include ) {
|
|
|
5932
6139
|
if ( newInclude !== undefined ) {
|
|
5933
6140
|
|
|
5934
6141
|
string = ShaderChunk[ newInclude ];
|
|
5935
|
-
|
|
6142
|
+
warn( 'WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', include, newInclude );
|
|
5936
6143
|
|
|
5937
6144
|
} else {
|
|
5938
6145
|
|
|
@@ -6128,7 +6335,7 @@ function generateCubeUVSize( parameters ) {
|
|
|
6128
6335
|
function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
6129
6336
|
|
|
6130
6337
|
// TODO Send this event to Three.js DevTools
|
|
6131
|
-
//
|
|
6338
|
+
// log( 'WebGLProgram', cacheKey );
|
|
6132
6339
|
|
|
6133
6340
|
const gl = renderer.getContext();
|
|
6134
6341
|
|
|
@@ -6308,8 +6515,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6308
6515
|
|
|
6309
6516
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
6310
6517
|
|
|
6311
|
-
parameters.logarithmicDepthBuffer ? '#define
|
|
6312
|
-
parameters.
|
|
6518
|
+
parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
|
|
6519
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
|
|
6313
6520
|
|
|
6314
6521
|
'uniform mat4 modelMatrix;',
|
|
6315
6522
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -6475,8 +6682,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6475
6682
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
6476
6683
|
parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
|
|
6477
6684
|
|
|
6478
|
-
parameters.logarithmicDepthBuffer ? '#define
|
|
6479
|
-
parameters.
|
|
6685
|
+
parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
|
|
6686
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
|
|
6480
6687
|
|
|
6481
6688
|
'uniform mat4 viewMatrix;',
|
|
6482
6689
|
'uniform vec3 cameraPosition;',
|
|
@@ -6593,8 +6800,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6593
6800
|
const vertexGlsl = versionString + prefixVertex + vertexShader;
|
|
6594
6801
|
const fragmentGlsl = versionString + prefixFragment + fragmentShader;
|
|
6595
6802
|
|
|
6596
|
-
//
|
|
6597
|
-
//
|
|
6803
|
+
// log( '*VERTEX*', vertexGlsl );
|
|
6804
|
+
// log( '*FRAGMENT*', fragmentGlsl );
|
|
6598
6805
|
|
|
6599
6806
|
const glVertexShader = WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );
|
|
6600
6807
|
const glFragmentShader = WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );
|
|
@@ -6622,9 +6829,13 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6622
6829
|
// check for link errors
|
|
6623
6830
|
if ( renderer.debug.checkShaderErrors ) {
|
|
6624
6831
|
|
|
6625
|
-
const
|
|
6626
|
-
const
|
|
6627
|
-
const
|
|
6832
|
+
const programInfoLog = gl.getProgramInfoLog( program ) || '';
|
|
6833
|
+
const vertexShaderInfoLog = gl.getShaderInfoLog( glVertexShader ) || '';
|
|
6834
|
+
const fragmentShaderInfoLog = gl.getShaderInfoLog( glFragmentShader ) || '';
|
|
6835
|
+
|
|
6836
|
+
const programLog = programInfoLog.trim();
|
|
6837
|
+
const vertexLog = vertexShaderInfoLog.trim();
|
|
6838
|
+
const fragmentLog = fragmentShaderInfoLog.trim();
|
|
6628
6839
|
|
|
6629
6840
|
let runnable = true;
|
|
6630
6841
|
let haveDiagnostics = true;
|
|
@@ -6644,7 +6855,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6644
6855
|
const vertexErrors = getShaderErrors( gl, glVertexShader, 'vertex' );
|
|
6645
6856
|
const fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );
|
|
6646
6857
|
|
|
6647
|
-
|
|
6858
|
+
error(
|
|
6648
6859
|
'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +
|
|
6649
6860
|
'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\n\n' +
|
|
6650
6861
|
'Material Name: ' + self.name + '\n' +
|
|
@@ -6658,7 +6869,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
6658
6869
|
|
|
6659
6870
|
} else if ( programLog !== '' ) {
|
|
6660
6871
|
|
|
6661
|
-
|
|
6872
|
+
warn( 'WebGLProgram: Program Info Log:', programLog );
|
|
6662
6873
|
|
|
6663
6874
|
} else if ( vertexLog === '' || fragmentLog === '' ) {
|
|
6664
6875
|
|
|
@@ -6969,7 +7180,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
6969
7180
|
|
|
6970
7181
|
if ( precision !== material.precision ) {
|
|
6971
7182
|
|
|
6972
|
-
|
|
7183
|
+
warn( 'WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.' );
|
|
6973
7184
|
|
|
6974
7185
|
}
|
|
6975
7186
|
|
|
@@ -7011,7 +7222,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7011
7222
|
}
|
|
7012
7223
|
|
|
7013
7224
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
7014
|
-
const
|
|
7225
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
7015
7226
|
|
|
7016
7227
|
const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
|
|
7017
7228
|
|
|
@@ -7208,11 +7419,11 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7208
7419
|
useFog: material.fog === true,
|
|
7209
7420
|
fogExp2: ( !! fog && fog.isFogExp2 ),
|
|
7210
7421
|
|
|
7211
|
-
flatShading: material.flatShading === true,
|
|
7422
|
+
flatShading: ( material.flatShading === true && material.wireframe === false ),
|
|
7212
7423
|
|
|
7213
7424
|
sizeAttenuation: material.sizeAttenuation === true,
|
|
7214
7425
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
7215
|
-
|
|
7426
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
7216
7427
|
|
|
7217
7428
|
skinning: object.isSkinnedMesh === true,
|
|
7218
7429
|
|
|
@@ -7421,6 +7632,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7421
7632
|
_programLayers.enable( 20 );
|
|
7422
7633
|
if ( parameters.batchingColor )
|
|
7423
7634
|
_programLayers.enable( 21 );
|
|
7635
|
+
if ( parameters.gradientMap )
|
|
7636
|
+
_programLayers.enable( 22 );
|
|
7424
7637
|
|
|
7425
7638
|
array.push( _programLayers.mask );
|
|
7426
7639
|
_programLayers.disableAll();
|
|
@@ -7433,7 +7646,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7433
7646
|
_programLayers.enable( 2 );
|
|
7434
7647
|
if ( parameters.logarithmicDepthBuffer )
|
|
7435
7648
|
_programLayers.enable( 3 );
|
|
7436
|
-
if ( parameters.
|
|
7649
|
+
if ( parameters.reversedDepthBuffer )
|
|
7437
7650
|
_programLayers.enable( 4 );
|
|
7438
7651
|
if ( parameters.skinning )
|
|
7439
7652
|
_programLayers.enable( 5 );
|
|
@@ -7470,7 +7683,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
7470
7683
|
if ( parameters.alphaToCoverage )
|
|
7471
7684
|
_programLayers.enable( 21 );
|
|
7472
7685
|
if ( parameters.numMultiviewViews )
|
|
7473
|
-
_programLayers.enable(
|
|
7686
|
+
_programLayers.enable( 22 );
|
|
7474
7687
|
|
|
7475
7688
|
array.push( _programLayers.mask );
|
|
7476
7689
|
|
|
@@ -8602,7 +8815,17 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
8602
8815
|
|
|
8603
8816
|
// Set GL state for depth map.
|
|
8604
8817
|
_state.setBlending( NoBlending );
|
|
8605
|
-
|
|
8818
|
+
|
|
8819
|
+
if ( _state.buffers.depth.getReversed() === true ) {
|
|
8820
|
+
|
|
8821
|
+
_state.buffers.color.setClear( 0, 0, 0, 0 );
|
|
8822
|
+
|
|
8823
|
+
} else {
|
|
8824
|
+
|
|
8825
|
+
_state.buffers.color.setClear( 1, 1, 1, 1 );
|
|
8826
|
+
|
|
8827
|
+
}
|
|
8828
|
+
|
|
8606
8829
|
_state.buffers.depth.setTest( true );
|
|
8607
8830
|
_state.setScissorTest( false );
|
|
8608
8831
|
|
|
@@ -8620,7 +8843,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
8620
8843
|
|
|
8621
8844
|
if ( shadow === undefined ) {
|
|
8622
8845
|
|
|
8623
|
-
|
|
8846
|
+
warn( 'WebGLShadowMap:', light, 'has no shadow.' );
|
|
8624
8847
|
continue;
|
|
8625
8848
|
|
|
8626
8849
|
}
|
|
@@ -9604,11 +9827,11 @@ function WebGLState( gl, extensions ) {
|
|
|
9604
9827
|
break;
|
|
9605
9828
|
|
|
9606
9829
|
case MultiplyBlending:
|
|
9607
|
-
gl.blendFuncSeparate( gl.
|
|
9830
|
+
gl.blendFuncSeparate( gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ZERO, gl.ONE );
|
|
9608
9831
|
break;
|
|
9609
9832
|
|
|
9610
9833
|
default:
|
|
9611
|
-
|
|
9834
|
+
error( 'WebGLState: Invalid blending: ', blending );
|
|
9612
9835
|
break;
|
|
9613
9836
|
|
|
9614
9837
|
}
|
|
@@ -9622,19 +9845,19 @@ function WebGLState( gl, extensions ) {
|
|
|
9622
9845
|
break;
|
|
9623
9846
|
|
|
9624
9847
|
case AdditiveBlending:
|
|
9625
|
-
gl.
|
|
9848
|
+
gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE );
|
|
9626
9849
|
break;
|
|
9627
9850
|
|
|
9628
9851
|
case SubtractiveBlending:
|
|
9629
|
-
|
|
9852
|
+
error( 'WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true' );
|
|
9630
9853
|
break;
|
|
9631
9854
|
|
|
9632
9855
|
case MultiplyBlending:
|
|
9633
|
-
|
|
9856
|
+
error( 'WebGLState: MultiplyBlending requires material.premultipliedAlpha = true' );
|
|
9634
9857
|
break;
|
|
9635
9858
|
|
|
9636
9859
|
default:
|
|
9637
|
-
|
|
9860
|
+
error( 'WebGLState: Invalid blending: ', blending );
|
|
9638
9861
|
break;
|
|
9639
9862
|
|
|
9640
9863
|
}
|
|
@@ -9921,7 +10144,7 @@ function WebGLState( gl, extensions ) {
|
|
|
9921
10144
|
|
|
9922
10145
|
} catch ( error ) {
|
|
9923
10146
|
|
|
9924
|
-
|
|
10147
|
+
error( 'WebGLState:', error );
|
|
9925
10148
|
|
|
9926
10149
|
}
|
|
9927
10150
|
|
|
@@ -9935,7 +10158,7 @@ function WebGLState( gl, extensions ) {
|
|
|
9935
10158
|
|
|
9936
10159
|
} catch ( error ) {
|
|
9937
10160
|
|
|
9938
|
-
|
|
10161
|
+
error( 'WebGLState:', error );
|
|
9939
10162
|
|
|
9940
10163
|
}
|
|
9941
10164
|
|
|
@@ -9949,7 +10172,7 @@ function WebGLState( gl, extensions ) {
|
|
|
9949
10172
|
|
|
9950
10173
|
} catch ( error ) {
|
|
9951
10174
|
|
|
9952
|
-
|
|
10175
|
+
error( 'WebGLState:', error );
|
|
9953
10176
|
|
|
9954
10177
|
}
|
|
9955
10178
|
|
|
@@ -9963,7 +10186,7 @@ function WebGLState( gl, extensions ) {
|
|
|
9963
10186
|
|
|
9964
10187
|
} catch ( error ) {
|
|
9965
10188
|
|
|
9966
|
-
|
|
10189
|
+
error( 'WebGLState:', error );
|
|
9967
10190
|
|
|
9968
10191
|
}
|
|
9969
10192
|
|
|
@@ -9977,7 +10200,7 @@ function WebGLState( gl, extensions ) {
|
|
|
9977
10200
|
|
|
9978
10201
|
} catch ( error ) {
|
|
9979
10202
|
|
|
9980
|
-
|
|
10203
|
+
error( 'WebGLState:', error );
|
|
9981
10204
|
|
|
9982
10205
|
}
|
|
9983
10206
|
|
|
@@ -9991,7 +10214,7 @@ function WebGLState( gl, extensions ) {
|
|
|
9991
10214
|
|
|
9992
10215
|
} catch ( error ) {
|
|
9993
10216
|
|
|
9994
|
-
|
|
10217
|
+
error( 'WebGLState:', error );
|
|
9995
10218
|
|
|
9996
10219
|
}
|
|
9997
10220
|
|
|
@@ -10005,7 +10228,7 @@ function WebGLState( gl, extensions ) {
|
|
|
10005
10228
|
|
|
10006
10229
|
} catch ( error ) {
|
|
10007
10230
|
|
|
10008
|
-
|
|
10231
|
+
error( 'WebGLState:', error );
|
|
10009
10232
|
|
|
10010
10233
|
}
|
|
10011
10234
|
|
|
@@ -10019,7 +10242,7 @@ function WebGLState( gl, extensions ) {
|
|
|
10019
10242
|
|
|
10020
10243
|
} catch ( error ) {
|
|
10021
10244
|
|
|
10022
|
-
|
|
10245
|
+
error( 'WebGLState:', error );
|
|
10023
10246
|
|
|
10024
10247
|
}
|
|
10025
10248
|
|
|
@@ -10033,7 +10256,7 @@ function WebGLState( gl, extensions ) {
|
|
|
10033
10256
|
|
|
10034
10257
|
} catch ( error ) {
|
|
10035
10258
|
|
|
10036
|
-
|
|
10259
|
+
error( 'WebGLState:', error );
|
|
10037
10260
|
|
|
10038
10261
|
}
|
|
10039
10262
|
|
|
@@ -10047,7 +10270,7 @@ function WebGLState( gl, extensions ) {
|
|
|
10047
10270
|
|
|
10048
10271
|
} catch ( error ) {
|
|
10049
10272
|
|
|
10050
|
-
|
|
10273
|
+
error( 'WebGLState:', error );
|
|
10051
10274
|
|
|
10052
10275
|
}
|
|
10053
10276
|
|
|
@@ -10348,7 +10571,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10348
10571
|
const context = canvas.getContext( '2d' );
|
|
10349
10572
|
context.drawImage( image, 0, 0, width, height );
|
|
10350
10573
|
|
|
10351
|
-
|
|
10574
|
+
warn( 'WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );
|
|
10352
10575
|
|
|
10353
10576
|
return canvas;
|
|
10354
10577
|
|
|
@@ -10356,7 +10579,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10356
10579
|
|
|
10357
10580
|
if ( 'data' in image ) {
|
|
10358
10581
|
|
|
10359
|
-
|
|
10582
|
+
warn( 'WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );
|
|
10360
10583
|
|
|
10361
10584
|
}
|
|
10362
10585
|
|
|
@@ -10397,7 +10620,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10397
10620
|
|
|
10398
10621
|
if ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];
|
|
10399
10622
|
|
|
10400
|
-
|
|
10623
|
+
warn( 'WebGLRenderer: Attempt to use non-existing WebGL internal format \'' + internalFormatName + '\'' );
|
|
10401
10624
|
|
|
10402
10625
|
}
|
|
10403
10626
|
|
|
@@ -10466,6 +10689,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10466
10689
|
if ( glFormat === _gl.RGB ) {
|
|
10467
10690
|
|
|
10468
10691
|
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
10692
|
+
if ( glType === _gl.UNSIGNED_INT_10F_11F_11F_REV ) internalFormat = _gl.R11F_G11F_B10F;
|
|
10469
10693
|
|
|
10470
10694
|
}
|
|
10471
10695
|
|
|
@@ -10509,7 +10733,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10509
10733
|
} else if ( depthType === UnsignedShortType ) {
|
|
10510
10734
|
|
|
10511
10735
|
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
10512
|
-
|
|
10736
|
+
warn( 'DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.' );
|
|
10513
10737
|
|
|
10514
10738
|
}
|
|
10515
10739
|
|
|
@@ -10739,7 +10963,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10739
10963
|
|
|
10740
10964
|
if ( textureUnit >= capabilities.maxTextures ) {
|
|
10741
10965
|
|
|
10742
|
-
|
|
10966
|
+
warn( 'WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );
|
|
10743
10967
|
|
|
10744
10968
|
}
|
|
10745
10969
|
|
|
@@ -10780,17 +11004,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10780
11004
|
|
|
10781
11005
|
if ( texture.isVideoTexture ) updateVideoTexture( texture );
|
|
10782
11006
|
|
|
10783
|
-
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
11007
|
+
if ( texture.isRenderTargetTexture === false && texture.isExternalTexture !== true && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10784
11008
|
|
|
10785
11009
|
const image = texture.image;
|
|
10786
11010
|
|
|
10787
11011
|
if ( image === null ) {
|
|
10788
11012
|
|
|
10789
|
-
|
|
11013
|
+
warn( 'WebGLRenderer: Texture marked for update but no image data found.' );
|
|
10790
11014
|
|
|
10791
11015
|
} else if ( image.complete === false ) {
|
|
10792
11016
|
|
|
10793
|
-
|
|
11017
|
+
warn( 'WebGLRenderer: Texture marked for update but image is incomplete' );
|
|
10794
11018
|
|
|
10795
11019
|
} else {
|
|
10796
11020
|
|
|
@@ -10802,6 +11026,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10802
11026
|
|
|
10803
11027
|
}
|
|
10804
11028
|
|
|
11029
|
+
} else if ( texture.isExternalTexture ) {
|
|
11030
|
+
|
|
11031
|
+
textureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;
|
|
11032
|
+
|
|
10805
11033
|
}
|
|
10806
11034
|
|
|
10807
11035
|
state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
@@ -10812,11 +11040,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10812
11040
|
|
|
10813
11041
|
const textureProperties = properties.get( texture );
|
|
10814
11042
|
|
|
10815
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
11043
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10816
11044
|
|
|
10817
11045
|
uploadTexture( textureProperties, texture, slot );
|
|
10818
11046
|
return;
|
|
10819
11047
|
|
|
11048
|
+
} else if ( texture.isExternalTexture ) {
|
|
11049
|
+
|
|
11050
|
+
textureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;
|
|
11051
|
+
|
|
10820
11052
|
}
|
|
10821
11053
|
|
|
10822
11054
|
state.bindTexture( _gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
@@ -10827,7 +11059,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10827
11059
|
|
|
10828
11060
|
const textureProperties = properties.get( texture );
|
|
10829
11061
|
|
|
10830
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
11062
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
10831
11063
|
|
|
10832
11064
|
uploadTexture( textureProperties, texture, slot );
|
|
10833
11065
|
return;
|
|
@@ -10886,7 +11118,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
10886
11118
|
( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
|
|
10887
11119
|
texture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {
|
|
10888
11120
|
|
|
10889
|
-
|
|
11121
|
+
warn( 'WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );
|
|
10890
11122
|
|
|
10891
11123
|
}
|
|
10892
11124
|
|
|
@@ -11331,7 +11563,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
11331
11563
|
|
|
11332
11564
|
} else {
|
|
11333
11565
|
|
|
11334
|
-
|
|
11566
|
+
warn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
11335
11567
|
|
|
11336
11568
|
}
|
|
11337
11569
|
|
|
@@ -11387,7 +11619,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
11387
11619
|
|
|
11388
11620
|
} else {
|
|
11389
11621
|
|
|
11390
|
-
|
|
11622
|
+
warn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()' );
|
|
11391
11623
|
|
|
11392
11624
|
}
|
|
11393
11625
|
|
|
@@ -11682,7 +11914,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
11682
11914
|
|
|
11683
11915
|
} else {
|
|
11684
11916
|
|
|
11685
|
-
|
|
11917
|
+
warn( 'WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()' );
|
|
11686
11918
|
|
|
11687
11919
|
}
|
|
11688
11920
|
|
|
@@ -12428,13 +12660,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
12428
12660
|
const attachment = textures[ i ];
|
|
12429
12661
|
const attachmentProperties = properties.get( attachment );
|
|
12430
12662
|
|
|
12431
|
-
|
|
12432
|
-
|
|
12433
|
-
|
|
12663
|
+
let glTextureType = _gl.TEXTURE_2D;
|
|
12664
|
+
|
|
12665
|
+
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
12666
|
+
|
|
12667
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
12668
|
+
|
|
12669
|
+
}
|
|
12670
|
+
|
|
12671
|
+
state.bindTexture( glTextureType, attachmentProperties.__webglTexture );
|
|
12672
|
+
setTextureParameters( glTextureType, attachment );
|
|
12673
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, glTextureType, 0 );
|
|
12434
12674
|
|
|
12435
12675
|
if ( textureNeedsGenerateMipmaps( attachment ) ) {
|
|
12436
12676
|
|
|
12437
|
-
generateMipmap(
|
|
12677
|
+
generateMipmap( glTextureType );
|
|
12438
12678
|
|
|
12439
12679
|
}
|
|
12440
12680
|
|
|
@@ -12694,13 +12934,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
12694
12934
|
|
|
12695
12935
|
if ( format !== RGBAFormat || type !== UnsignedByteType ) {
|
|
12696
12936
|
|
|
12697
|
-
|
|
12937
|
+
warn( 'WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
|
|
12698
12938
|
|
|
12699
12939
|
}
|
|
12700
12940
|
|
|
12701
12941
|
} else {
|
|
12702
12942
|
|
|
12703
|
-
|
|
12943
|
+
error( 'WebGLTextures: Unsupported texture color space:', colorSpace );
|
|
12704
12944
|
|
|
12705
12945
|
}
|
|
12706
12946
|
|
|
@@ -12770,6 +13010,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
12770
13010
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
12771
13011
|
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
12772
13012
|
if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
|
|
13013
|
+
if ( p === UnsignedInt101111Type ) return gl.UNSIGNED_INT_10F_11F_11F_REV;
|
|
12773
13014
|
|
|
12774
13015
|
if ( p === ByteType ) return gl.BYTE;
|
|
12775
13016
|
if ( p === ShortType ) return gl.SHORT;
|
|
@@ -12938,7 +13179,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
12938
13179
|
|
|
12939
13180
|
if ( extension !== null ) {
|
|
12940
13181
|
|
|
12941
|
-
if ( p ===
|
|
13182
|
+
if ( p === RED_RGTC1_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;
|
|
12942
13183
|
if ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;
|
|
12943
13184
|
if ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;
|
|
12944
13185
|
if ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
|
|
@@ -13037,9 +13278,9 @@ class WebXRDepthSensing {
|
|
|
13037
13278
|
constructor() {
|
|
13038
13279
|
|
|
13039
13280
|
/**
|
|
13040
|
-
*
|
|
13281
|
+
* An opaque texture representing the depth of the user's environment.
|
|
13041
13282
|
*
|
|
13042
|
-
* @type {?
|
|
13283
|
+
* @type {?ExternalTexture}
|
|
13043
13284
|
*/
|
|
13044
13285
|
this.texture = null;
|
|
13045
13286
|
|
|
@@ -13069,18 +13310,14 @@ class WebXRDepthSensing {
|
|
|
13069
13310
|
/**
|
|
13070
13311
|
* Inits the depth sensing module
|
|
13071
13312
|
*
|
|
13072
|
-
* @param {WebGLRenderer} renderer - The renderer.
|
|
13073
13313
|
* @param {XRWebGLDepthInformation} depthData - The XR depth data.
|
|
13074
13314
|
* @param {XRRenderState} renderState - The XR render state.
|
|
13075
13315
|
*/
|
|
13076
|
-
init(
|
|
13316
|
+
init( depthData, renderState ) {
|
|
13077
13317
|
|
|
13078
13318
|
if ( this.texture === null ) {
|
|
13079
13319
|
|
|
13080
|
-
const texture = new
|
|
13081
|
-
|
|
13082
|
-
const texProps = renderer.properties.get( texture );
|
|
13083
|
-
texProps.__webglTexture = depthData.texture;
|
|
13320
|
+
const texture = new ExternalTexture( depthData.texture );
|
|
13084
13321
|
|
|
13085
13322
|
if ( ( depthData.depthNear !== renderState.depthNear ) || ( depthData.depthFar !== renderState.depthFar ) ) {
|
|
13086
13323
|
|
|
@@ -13141,7 +13378,7 @@ class WebXRDepthSensing {
|
|
|
13141
13378
|
/**
|
|
13142
13379
|
* Returns a texture representing the depth of the user's environment.
|
|
13143
13380
|
*
|
|
13144
|
-
* @return {?
|
|
13381
|
+
* @return {?ExternalTexture} The depth texture.
|
|
13145
13382
|
*/
|
|
13146
13383
|
getDepthTexture() {
|
|
13147
13384
|
|
|
@@ -13193,7 +13430,10 @@ class WebXRManager extends EventDispatcher {
|
|
|
13193
13430
|
let glBaseLayer = null;
|
|
13194
13431
|
let xrFrame = null;
|
|
13195
13432
|
|
|
13433
|
+
const supportsGlBinding = typeof XRWebGLBinding !== 'undefined';
|
|
13434
|
+
|
|
13196
13435
|
const depthSensing = new WebXRDepthSensing();
|
|
13436
|
+
const cameraAccessTextures = {};
|
|
13197
13437
|
const attributes = gl.getContextAttributes();
|
|
13198
13438
|
|
|
13199
13439
|
let initialRenderTarget = null;
|
|
@@ -13381,6 +13621,11 @@ class WebXRManager extends EventDispatcher {
|
|
|
13381
13621
|
_currentDepthFar = null;
|
|
13382
13622
|
|
|
13383
13623
|
depthSensing.reset();
|
|
13624
|
+
for ( const key in cameraAccessTextures ) {
|
|
13625
|
+
|
|
13626
|
+
delete cameraAccessTextures[ key ];
|
|
13627
|
+
|
|
13628
|
+
}
|
|
13384
13629
|
|
|
13385
13630
|
// restore framebuffer/rendering state
|
|
13386
13631
|
|
|
@@ -13418,7 +13663,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
13418
13663
|
|
|
13419
13664
|
if ( scope.isPresenting === true ) {
|
|
13420
13665
|
|
|
13421
|
-
|
|
13666
|
+
warn( 'WebXRManager: Cannot change framebuffer scale while presenting.' );
|
|
13422
13667
|
|
|
13423
13668
|
}
|
|
13424
13669
|
|
|
@@ -13440,7 +13685,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
13440
13685
|
|
|
13441
13686
|
if ( scope.isPresenting === true ) {
|
|
13442
13687
|
|
|
13443
|
-
|
|
13688
|
+
warn( 'WebXRManager: Cannot change reference space type while presenting.' );
|
|
13444
13689
|
|
|
13445
13690
|
}
|
|
13446
13691
|
|
|
@@ -13471,6 +13716,9 @@ class WebXRManager extends EventDispatcher {
|
|
|
13471
13716
|
/**
|
|
13472
13717
|
* Returns the current base layer.
|
|
13473
13718
|
*
|
|
13719
|
+
* This is an `XRProjectionLayer` when the targeted XR device supports the
|
|
13720
|
+
* WebXR Layers API, or an `XRWebGLLayer` otherwise.
|
|
13721
|
+
*
|
|
13474
13722
|
* @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer.
|
|
13475
13723
|
*/
|
|
13476
13724
|
this.getBaseLayer = function () {
|
|
@@ -13482,10 +13730,19 @@ class WebXRManager extends EventDispatcher {
|
|
|
13482
13730
|
/**
|
|
13483
13731
|
* Returns the current XR binding.
|
|
13484
13732
|
*
|
|
13485
|
-
*
|
|
13733
|
+
* Creates a new binding if needed and the browser is
|
|
13734
|
+
* capable of doing so.
|
|
13735
|
+
*
|
|
13736
|
+
* @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created.
|
|
13486
13737
|
*/
|
|
13487
13738
|
this.getBinding = function () {
|
|
13488
13739
|
|
|
13740
|
+
if ( glBinding === null && supportsGlBinding ) {
|
|
13741
|
+
|
|
13742
|
+
glBinding = new XRWebGLBinding( session, gl );
|
|
13743
|
+
|
|
13744
|
+
}
|
|
13745
|
+
|
|
13489
13746
|
return glBinding;
|
|
13490
13747
|
|
|
13491
13748
|
};
|
|
@@ -13553,11 +13810,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
13553
13810
|
currentPixelRatio = renderer.getPixelRatio();
|
|
13554
13811
|
renderer.getSize( currentSize );
|
|
13555
13812
|
|
|
13813
|
+
|
|
13556
13814
|
// Check that the browser implements the necessary APIs to use an
|
|
13557
13815
|
// XRProjectionLayer rather than an XRWebGLLayer
|
|
13558
|
-
const
|
|
13816
|
+
const supportsLayers = supportsGlBinding && 'createProjectionLayer' in XRWebGLBinding.prototype;
|
|
13559
13817
|
|
|
13560
|
-
if ( !
|
|
13818
|
+
if ( ! supportsLayers ) {
|
|
13561
13819
|
|
|
13562
13820
|
const layerInit = {
|
|
13563
13821
|
antialias: attributes.antialias,
|
|
@@ -13616,7 +13874,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
13616
13874
|
|
|
13617
13875
|
}
|
|
13618
13876
|
|
|
13619
|
-
glBinding =
|
|
13877
|
+
glBinding = this.getBinding();
|
|
13620
13878
|
|
|
13621
13879
|
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
|
|
13622
13880
|
|
|
@@ -13712,6 +13970,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
13712
13970
|
/**
|
|
13713
13971
|
* Returns the current depth texture computed via depth sensing.
|
|
13714
13972
|
*
|
|
13973
|
+
* See {@link WebXRDepthSensing#getDepthTexture}.
|
|
13974
|
+
*
|
|
13715
13975
|
* @return {?Texture} The depth texture.
|
|
13716
13976
|
*/
|
|
13717
13977
|
this.getDepthTexture = function () {
|
|
@@ -13888,7 +14148,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
13888
14148
|
|
|
13889
14149
|
/**
|
|
13890
14150
|
* Updates the state of the XR camera. Use this method on app level if you
|
|
13891
|
-
* set cameraAutoUpdate` to `false`. The method requires the non-XR
|
|
14151
|
+
* set `cameraAutoUpdate` to `false`. The method requires the non-XR
|
|
13892
14152
|
* camera of the scene as a parameter. The passed in camera's transformation
|
|
13893
14153
|
* is automatically adjusted to the position of the XR camera when calling
|
|
13894
14154
|
* this method.
|
|
@@ -13926,9 +14186,10 @@ class WebXRManager extends EventDispatcher {
|
|
|
13926
14186
|
|
|
13927
14187
|
}
|
|
13928
14188
|
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
14189
|
+
// inherit camera layers and enable eye layers (1 = left, 2 = right)
|
|
14190
|
+
cameraXR.layers.mask = camera.layers.mask | 0b110;
|
|
14191
|
+
cameraL.layers.mask = cameraXR.layers.mask & 0b011;
|
|
14192
|
+
cameraR.layers.mask = cameraXR.layers.mask & 0b101;
|
|
13932
14193
|
|
|
13933
14194
|
const cameras = cameraXR.cameras;
|
|
13934
14195
|
var object = poseTarget || camera;
|
|
@@ -14010,7 +14271,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
14010
14271
|
/**
|
|
14011
14272
|
* Returns the amount of foveation used by the XR compositor for the projection layer.
|
|
14012
14273
|
*
|
|
14013
|
-
* @return {number} The amount of foveation.
|
|
14274
|
+
* @return {number|undefined} The amount of foveation.
|
|
14014
14275
|
*/
|
|
14015
14276
|
this.getFoveation = function () {
|
|
14016
14277
|
|
|
@@ -14065,6 +14326,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
14065
14326
|
/**
|
|
14066
14327
|
* Returns the depth sensing mesh.
|
|
14067
14328
|
*
|
|
14329
|
+
* See {@link WebXRDepthSensing#getMesh}.
|
|
14330
|
+
*
|
|
14068
14331
|
* @return {Mesh} The depth sensing mesh.
|
|
14069
14332
|
*/
|
|
14070
14333
|
this.getDepthSensingMesh = function () {
|
|
@@ -14073,6 +14336,19 @@ class WebXRManager extends EventDispatcher {
|
|
|
14073
14336
|
|
|
14074
14337
|
};
|
|
14075
14338
|
|
|
14339
|
+
/**
|
|
14340
|
+
* Retrieves an opaque texture from the view-aligned {@link XRCamera}.
|
|
14341
|
+
* Only available during the current animation loop.
|
|
14342
|
+
*
|
|
14343
|
+
* @param {XRCamera} xrCamera - The camera to query.
|
|
14344
|
+
* @return {?Texture} An opaque texture representing the current raw camera frame.
|
|
14345
|
+
*/
|
|
14346
|
+
this.getCameraTexture = function ( xrCamera ) {
|
|
14347
|
+
|
|
14348
|
+
return cameraAccessTextures[ xrCamera ];
|
|
14349
|
+
|
|
14350
|
+
};
|
|
14351
|
+
|
|
14076
14352
|
// Animation Loop
|
|
14077
14353
|
|
|
14078
14354
|
let onAnimationFrameCallback = null;
|
|
@@ -14172,13 +14448,48 @@ class WebXRManager extends EventDispatcher {
|
|
|
14172
14448
|
enabledFeatures.includes( 'depth-sensing' ) &&
|
|
14173
14449
|
session.depthUsage == 'gpu-optimized';
|
|
14174
14450
|
|
|
14175
|
-
if ( gpuDepthSensingEnabled &&
|
|
14451
|
+
if ( gpuDepthSensingEnabled && supportsGlBinding ) {
|
|
14452
|
+
|
|
14453
|
+
glBinding = scope.getBinding();
|
|
14176
14454
|
|
|
14177
14455
|
const depthData = glBinding.getDepthInformation( views[ 0 ] );
|
|
14178
14456
|
|
|
14179
14457
|
if ( depthData && depthData.isValid && depthData.texture ) {
|
|
14180
14458
|
|
|
14181
|
-
depthSensing.init(
|
|
14459
|
+
depthSensing.init( depthData, session.renderState );
|
|
14460
|
+
|
|
14461
|
+
}
|
|
14462
|
+
|
|
14463
|
+
}
|
|
14464
|
+
|
|
14465
|
+
const cameraAccessEnabled = enabledFeatures &&
|
|
14466
|
+
enabledFeatures.includes( 'camera-access' );
|
|
14467
|
+
|
|
14468
|
+
if ( cameraAccessEnabled && supportsGlBinding ) {
|
|
14469
|
+
|
|
14470
|
+
renderer.state.unbindTexture();
|
|
14471
|
+
|
|
14472
|
+
glBinding = scope.getBinding();
|
|
14473
|
+
|
|
14474
|
+
for ( let i = 0; i < views.length; i ++ ) {
|
|
14475
|
+
|
|
14476
|
+
const camera = views[ i ].camera;
|
|
14477
|
+
|
|
14478
|
+
if ( camera ) {
|
|
14479
|
+
|
|
14480
|
+
let cameraTex = cameraAccessTextures[ camera ];
|
|
14481
|
+
|
|
14482
|
+
if ( ! cameraTex ) {
|
|
14483
|
+
|
|
14484
|
+
cameraTex = new ExternalTexture();
|
|
14485
|
+
cameraAccessTextures[ camera ] = cameraTex;
|
|
14486
|
+
|
|
14487
|
+
}
|
|
14488
|
+
|
|
14489
|
+
const glTexture = glBinding.getCameraImage( camera );
|
|
14490
|
+
cameraTex.sourceTexture = glTexture;
|
|
14491
|
+
|
|
14492
|
+
}
|
|
14182
14493
|
|
|
14183
14494
|
}
|
|
14184
14495
|
|
|
@@ -14896,7 +15207,7 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
14896
15207
|
|
|
14897
15208
|
}
|
|
14898
15209
|
|
|
14899
|
-
|
|
15210
|
+
error( 'WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.' );
|
|
14900
15211
|
|
|
14901
15212
|
return 0;
|
|
14902
15213
|
|
|
@@ -15151,11 +15462,11 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
15151
15462
|
|
|
15152
15463
|
} else if ( value.isTexture ) {
|
|
15153
15464
|
|
|
15154
|
-
|
|
15465
|
+
warn( 'WebGLRenderer: Texture samplers can not be part of an uniforms group.' );
|
|
15155
15466
|
|
|
15156
15467
|
} else {
|
|
15157
15468
|
|
|
15158
|
-
|
|
15469
|
+
warn( 'WebGLRenderer: Unsupported uniform value type.', value );
|
|
15159
15470
|
|
|
15160
15471
|
}
|
|
15161
15472
|
|
|
@@ -15204,6 +15515,69 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
|
|
|
15204
15515
|
|
|
15205
15516
|
}
|
|
15206
15517
|
|
|
15518
|
+
/**
|
|
15519
|
+
* Precomputed DFG LUT for Image-Based Lighting
|
|
15520
|
+
* Resolution: 32x32
|
|
15521
|
+
* Samples: 4096 per texel
|
|
15522
|
+
* Format: RG16F (2 half floats per texel: scale, bias)
|
|
15523
|
+
*/
|
|
15524
|
+
|
|
15525
|
+
|
|
15526
|
+
const DATA = new Uint16Array( [
|
|
15527
|
+
0x2cd9, 0x3b64, 0x2d0e, 0x3b43, 0x2e20, 0x3aa7, 0x3061, 0x39fb, 0x325e, 0x397c, 0x3454, 0x3908, 0x357d, 0x3893, 0x3698, 0x381e, 0x379d, 0x375b, 0x3845, 0x3689, 0x38af, 0x35ca, 0x390d, 0x351e, 0x395f, 0x3484, 0x39a8, 0x33f9, 0x39e6, 0x330a, 0x3a1c, 0x3239, 0x3a4b, 0x3183, 0x3a73, 0x30e5, 0x3a95, 0x305b, 0x3ab1, 0x2fc6, 0x3ac9, 0x2ef7, 0x3ade, 0x2e43, 0x3aee, 0x2da7, 0x3afc, 0x2d1f, 0x3b07, 0x2ca9, 0x3b10, 0x2c42, 0x3b17, 0x2bd1, 0x3b1c, 0x2b34, 0x3b1f, 0x2aaa, 0x3b22, 0x2a31, 0x3b23, 0x29c7, 0x3b23, 0x2968,
|
|
15528
|
+
0x32d4, 0x3a4b, 0x32dc, 0x3a45, 0x3308, 0x3a26, 0x3378, 0x39d0, 0x3425, 0x394a, 0x34c9, 0x38be, 0x359c, 0x383e, 0x3688, 0x3796, 0x3778, 0x36c4, 0x382f, 0x3603, 0x3898, 0x3553, 0x38f7, 0x34b3, 0x394b, 0x3424, 0x3994, 0x334c, 0x39d3, 0x326c, 0x3a08, 0x31a9, 0x3a35, 0x30fe, 0x3a5a, 0x306a, 0x3a78, 0x2fd1, 0x3a90, 0x2ef1, 0x3aa2, 0x2e2e, 0x3ab0, 0x2d86, 0x3aba, 0x2cf3, 0x3ac1, 0x2c74, 0x3ac4, 0x2c05, 0x3ac4, 0x2b49, 0x3ac2, 0x2aa1, 0x3abd, 0x2a0c, 0x3ab7, 0x298b, 0x3aaf, 0x2918, 0x3aa6, 0x28b3, 0x3a9b, 0x285a,
|
|
15529
|
+
0x3559, 0x3954, 0x355a, 0x3951, 0x3566, 0x3944, 0x3582, 0x391e, 0x35b6, 0x38d3, 0x360a, 0x386a, 0x3684, 0x37ed, 0x3720, 0x370d, 0x37d3, 0x3641, 0x3847, 0x3588, 0x38a3, 0x34e2, 0x38fa, 0x344d, 0x3948, 0x3391, 0x398d, 0x32a6, 0x39c8, 0x31d6, 0x39fa, 0x3121, 0x3a22, 0x3082, 0x3a43, 0x2ff0, 0x3a5c, 0x2f01, 0x3a6f, 0x2e32, 0x3a7c, 0x2d7e, 0x3a84, 0x2ce2, 0x3a87, 0x2c5b, 0x3a87, 0x2bcc, 0x3a83, 0x2b00, 0x3a7b, 0x2a4e, 0x3a71, 0x29b3, 0x3a66, 0x292c, 0x3a58, 0x28b4, 0x3a4b, 0x284b, 0x3a3d, 0x27dc, 0x3a2e, 0x2739,
|
|
15530
|
+
0x3709, 0x387c, 0x370a, 0x387b, 0x3710, 0x3874, 0x3720, 0x385f, 0x373d, 0x3834, 0x376a, 0x37e1, 0x37ac, 0x3732, 0x3805, 0x3675, 0x383f, 0x35bc, 0x3883, 0x3511, 0x38cb, 0x3476, 0x3912, 0x33d8, 0x3955, 0x32e2, 0x3991, 0x3208, 0x39c6, 0x3149, 0x39f1, 0x30a1, 0x3a15, 0x300f, 0x3a30, 0x2f21, 0x3a44, 0x2e45, 0x3a51, 0x2d87, 0x3a59, 0x2ce2, 0x3a5b, 0x2c53, 0x3a58, 0x2bb0, 0x3a52, 0x2ada, 0x3a49, 0x2a1f, 0x3a40, 0x297d, 0x3a34, 0x28f0, 0x3a25, 0x2874, 0x3a13, 0x2807, 0x3a00, 0x274e, 0x39eb, 0x26a6, 0x39d5, 0x2611,
|
|
15531
|
+
0x3840, 0x3780, 0x3840, 0x377e, 0x3842, 0x3776, 0x3846, 0x375e, 0x384f, 0x372a, 0x385b, 0x36d3, 0x386c, 0x3659, 0x3885, 0x35c7, 0x38a8, 0x352d, 0x38d4, 0x3497, 0x3906, 0x340c, 0x393b, 0x331a, 0x3970, 0x323a, 0x39a0, 0x3172, 0x39cb, 0x30c3, 0x39ef, 0x302a, 0x3a0c, 0x2f4a, 0x3a21, 0x2e63, 0x3a2f, 0x2d9b, 0x3a37, 0x2ced, 0x3a39, 0x2c57, 0x3a37, 0x2baa, 0x3a34, 0x2ac9, 0x3a2c, 0x2a05, 0x3a20, 0x295d, 0x3a11, 0x28ca, 0x39ff, 0x2849, 0x39eb, 0x27b2, 0x39d5, 0x26ed, 0x39be, 0x2640, 0x39a5, 0x25aa, 0x398b, 0x2523,
|
|
15532
|
+
0x38e2, 0x363b, 0x38e2, 0x363b, 0x38e3, 0x3635, 0x38e6, 0x3626, 0x38ea, 0x3606, 0x38f0, 0x35cd, 0x38f8, 0x3579, 0x3903, 0x350e, 0x3915, 0x3495, 0x392d, 0x3418, 0x394c, 0x3340, 0x3970, 0x3261, 0x3995, 0x3197, 0x39b8, 0x30e4, 0x39d8, 0x3046, 0x39f3, 0x2f76, 0x3a08, 0x2e86, 0x3a16, 0x2db5, 0x3a1e, 0x2cff, 0x3a22, 0x2c61, 0x3a24, 0x2bb3, 0x3a20, 0x2ac7, 0x3a17, 0x29fc, 0x3a0a, 0x294c, 0x39fa, 0x28b2, 0x39e7, 0x282e, 0x39d1, 0x2773, 0x39b9, 0x26a9, 0x399f, 0x25fa, 0x3985, 0x255f, 0x3968, 0x24d6, 0x394a, 0x245d,
|
|
15533
|
+
0x396e, 0x3524, 0x396e, 0x3524, 0x396e, 0x3520, 0x396f, 0x3517, 0x3971, 0x3502, 0x3973, 0x34dd, 0x3975, 0x34a5, 0x3978, 0x3458, 0x397e, 0x33f9, 0x3987, 0x3332, 0x3997, 0x326b, 0x39aa, 0x31ac, 0x39c0, 0x30fb, 0x39d7, 0x305c, 0x39eb, 0x2f9e, 0x39fc, 0x2ea7, 0x3a07, 0x2dcf, 0x3a0f, 0x2d13, 0x3a16, 0x2c70, 0x3a17, 0x2bc4, 0x3a14, 0x2ad0, 0x3a0a, 0x29fc, 0x39fd, 0x2945, 0x39ed, 0x28a6, 0x39d9, 0x281d, 0x39c2, 0x274a, 0x39a9, 0x267c, 0x398e, 0x25c7, 0x3971, 0x2528, 0x3952, 0x249e, 0x3931, 0x2425, 0x3910, 0x2374,
|
|
15534
|
+
0x39e5, 0x3436, 0x39e5, 0x3435, 0x39e5, 0x3434, 0x39e5, 0x342e, 0x39e5, 0x3420, 0x39e5, 0x3408, 0x39e3, 0x33c4, 0x39e1, 0x3359, 0x39df, 0x32d3, 0x39de, 0x323a, 0x39e1, 0x319a, 0x39e7, 0x30fb, 0x39f0, 0x3065, 0x39f9, 0x2fb6, 0x3a02, 0x2ec0, 0x3a08, 0x2de6, 0x3a0d, 0x2d26, 0x3a12, 0x2c7e, 0x3a13, 0x2bda, 0x3a0e, 0x2adc, 0x3a05, 0x2a02, 0x39f8, 0x2945, 0x39e7, 0x28a1, 0x39d3, 0x2813, 0x39bc, 0x2730, 0x39a2, 0x265c, 0x3985, 0x25a3, 0x3966, 0x2501, 0x3945, 0x2475, 0x3923, 0x23f3, 0x3901, 0x231c, 0x38dd, 0x225e,
|
|
15535
|
+
0x3a4b, 0x32d6, 0x3a4a, 0x32d6, 0x3a4a, 0x32d4, 0x3a4a, 0x32cc, 0x3a48, 0x32bb, 0x3a47, 0x329d, 0x3a43, 0x326b, 0x3a3d, 0x3222, 0x3a36, 0x31c2, 0x3a2e, 0x314f, 0x3a28, 0x30d2, 0x3a23, 0x3052, 0x3a20, 0x2fab, 0x3a1e, 0x2ec2, 0x3a1b, 0x2def, 0x3a19, 0x2d31, 0x3a1a, 0x2c89, 0x3a18, 0x2beb, 0x3a11, 0x2aea, 0x3a07, 0x2a0a, 0x39fa, 0x2948, 0x39e9, 0x28a1, 0x39d4, 0x280f, 0x39bd, 0x2721, 0x39a2, 0x2647, 0x3985, 0x258b, 0x3964, 0x24e5, 0x3942, 0x2455, 0x391f, 0x23b3, 0x38fb, 0x22d8, 0x38d4, 0x2219, 0x38ad, 0x2172,
|
|
15536
|
+
0x3aa0, 0x3180, 0x3aa0, 0x3180, 0x3aa0, 0x317f, 0x3a9f, 0x317b, 0x3a9d, 0x3170, 0x3a99, 0x315d, 0x3a95, 0x313d, 0x3a8d, 0x310c, 0x3a82, 0x30ca, 0x3a76, 0x3077, 0x3a69, 0x3019, 0x3a5c, 0x2f68, 0x3a4f, 0x2e9e, 0x3a42, 0x2dde, 0x3a37, 0x2d2b, 0x3a30, 0x2c89, 0x3a29, 0x2bef, 0x3a1f, 0x2af0, 0x3a12, 0x2a0f, 0x3a03, 0x294a, 0x39f1, 0x28a0, 0x39dc, 0x280c, 0x39c5, 0x2717, 0x39a9, 0x2638, 0x398b, 0x2578, 0x396a, 0x24d0, 0x3947, 0x243f, 0x3923, 0x2380, 0x38fc, 0x22a4, 0x38d4, 0x21e4, 0x38ac, 0x213c, 0x3883, 0x20a8,
|
|
15537
|
+
0x3ae8, 0x3062, 0x3ae8, 0x3062, 0x3ae7, 0x3061, 0x3ae6, 0x305f, 0x3ae4, 0x305a, 0x3ae0, 0x304f, 0x3ada, 0x303b, 0x3ad1, 0x301b, 0x3ac5, 0x2fdd, 0x3ab6, 0x2f6a, 0x3aa4, 0x2ede, 0x3a91, 0x2e45, 0x3a7c, 0x2da5, 0x3a67, 0x2d0a, 0x3a57, 0x2c77, 0x3a48, 0x2bdc, 0x3a38, 0x2ae5, 0x3a27, 0x2a0a, 0x3a16, 0x2947, 0x3a02, 0x289d, 0x39eb, 0x2808, 0x39d3, 0x270d, 0x39b6, 0x262b, 0x3997, 0x256a, 0x3976, 0x24bf, 0x3952, 0x242b, 0x392d, 0x2358, 0x3904, 0x227a, 0x38db, 0x21b8, 0x38b2, 0x2110, 0x3887, 0x207d, 0x385b, 0x1ff6,
|
|
15538
|
+
0x3b23, 0x2ee8, 0x3b23, 0x2ee8, 0x3b22, 0x2ee8, 0x3b21, 0x2ee7, 0x3b1f, 0x2ee3, 0x3b1a, 0x2ed6, 0x3b14, 0x2ec1, 0x3b0b, 0x2e99, 0x3afe, 0x2e60, 0x3aee, 0x2e12, 0x3ad8, 0x2dad, 0x3ac1, 0x2d3d, 0x3aa5, 0x2cc3, 0x3a8b, 0x2c48, 0x3a76, 0x2ba2, 0x3a60, 0x2ac0, 0x3a49, 0x29f2, 0x3a32, 0x2938, 0x3a1b, 0x2893, 0x3a02, 0x27ff, 0x39e8, 0x26ff, 0x39ca, 0x261e, 0x39aa, 0x255b, 0x3988, 0x24b0, 0x3964, 0x241c, 0x393d, 0x2336, 0x3913, 0x2257, 0x38e9, 0x2195, 0x38be, 0x20eb, 0x3891, 0x2059, 0x3864, 0x1fae, 0x3837, 0x1ecd,
|
|
15539
|
+
0x3b54, 0x2d61, 0x3b54, 0x2d61, 0x3b53, 0x2d61, 0x3b52, 0x2d62, 0x3b4f, 0x2d61, 0x3b4b, 0x2d5c, 0x3b45, 0x2d51, 0x3b3b, 0x2d3d, 0x3b2e, 0x2d1a, 0x3b1d, 0x2ce7, 0x3b06, 0x2ca3, 0x3aeb, 0x2c52, 0x3acb, 0x2bee, 0x3ab0, 0x2b31, 0x3a94, 0x2a74, 0x3a77, 0x29bf, 0x3a5a, 0x2915, 0x3a3f, 0x287a, 0x3a22, 0x27de, 0x3a05, 0x26e4, 0x39e5, 0x2609, 0x39c3, 0x2547, 0x39a0, 0x249f, 0x397b, 0x240c, 0x3953, 0x2314, 0x3928, 0x2238, 0x38fd, 0x2175, 0x38d0, 0x20cb, 0x38a2, 0x2038, 0x3873, 0x1f71, 0x3844, 0x1e90, 0x3815, 0x1dce,
|
|
15540
|
+
0x3b7c, 0x2c22, 0x3b7c, 0x2c22, 0x3b7b, 0x2c23, 0x3b7a, 0x2c25, 0x3b77, 0x2c27, 0x3b73, 0x2c26, 0x3b6d, 0x2c23, 0x3b64, 0x2c1a, 0x3b57, 0x2c07, 0x3b46, 0x2bd1, 0x3b2e, 0x2b79, 0x3b0f, 0x2b07, 0x3aef, 0x2a86, 0x3ad1, 0x29f8, 0x3ab0, 0x2967, 0x3a8e, 0x28d7, 0x3a6d, 0x284e, 0x3a4c, 0x279f, 0x3a2b, 0x26b7, 0x3a08, 0x25e5, 0x39e4, 0x252c, 0x39be, 0x2488, 0x3998, 0x23f0, 0x396f, 0x22f2, 0x3943, 0x2215, 0x3917, 0x2155, 0x38e8, 0x20ae, 0x38b9, 0x201c, 0x3888, 0x1f38, 0x3857, 0x1e5a, 0x3826, 0x1d9a, 0x37eb, 0x1cf0,
|
|
15541
|
+
0x3b9c, 0x2a43, 0x3b9c, 0x2a43, 0x3b9b, 0x2a46, 0x3b9a, 0x2a4a, 0x3b98, 0x2a50, 0x3b93, 0x2a54, 0x3b8e, 0x2a59, 0x3b85, 0x2a56, 0x3b79, 0x2a45, 0x3b67, 0x2a24, 0x3b4f, 0x29ee, 0x3b2f, 0x29a4, 0x3b10, 0x294b, 0x3aef, 0x28e5, 0x3ac9, 0x2877, 0x3aa4, 0x2809, 0x3a7e, 0x2739, 0x3a59, 0x266d, 0x3a34, 0x25af, 0x3a0c, 0x2503, 0x39e4, 0x2468, 0x39bb, 0x23bb, 0x3990, 0x22c6, 0x3963, 0x21f0, 0x3936, 0x2133, 0x3906, 0x208f, 0x38d5, 0x1ffd, 0x38a3, 0x1f04, 0x3870, 0x1e28, 0x383d, 0x1d69, 0x380b, 0x1cc3, 0x37b0, 0x1c32,
|
|
15542
|
+
0x3bb5, 0x28aa, 0x3bb5, 0x28ab, 0x3bb5, 0x28ad, 0x3bb4, 0x28b2, 0x3bb2, 0x28b9, 0x3bae, 0x28c2, 0x3ba8, 0x28ca, 0x3ba0, 0x28d1, 0x3b94, 0x28cd, 0x3b83, 0x28c1, 0x3b6a, 0x28a3, 0x3b4b, 0x2876, 0x3b2d, 0x283d, 0x3b09, 0x27ea, 0x3ae1, 0x274b, 0x3ab9, 0x26a6, 0x3a8f, 0x25fe, 0x3a67, 0x255d, 0x3a3d, 0x24c5, 0x3a11, 0x2439, 0x39e6, 0x2371, 0x39b9, 0x228d, 0x398a, 0x21c1, 0x395a, 0x210b, 0x3929, 0x206c, 0x38f7, 0x1fc1, 0x38c3, 0x1ecb, 0x388f, 0x1df6, 0x385a, 0x1d3a, 0x3825, 0x1c99, 0x37e1, 0x1c08, 0x3779, 0x1b1b,
|
|
15543
|
+
0x3bc9, 0x26d3, 0x3bc9, 0x26d4, 0x3bc9, 0x26d9, 0x3bc8, 0x26e3, 0x3bc6, 0x26ef, 0x3bc2, 0x2705, 0x3bbd, 0x271a, 0x3bb6, 0x2731, 0x3baa, 0x273c, 0x3b9a, 0x273d, 0x3b81, 0x2726, 0x3b65, 0x26f7, 0x3b46, 0x26af, 0x3b20, 0x2650, 0x3af7, 0x25e1, 0x3acd, 0x256a, 0x3aa1, 0x24eb, 0x3a75, 0x246f, 0x3a46, 0x23ee, 0x3a17, 0x230d, 0x39e9, 0x223e, 0x39b7, 0x2183, 0x3985, 0x20d8, 0x3953, 0x2043, 0x391e, 0x1f7a, 0x38e9, 0x1e8d, 0x38b3, 0x1dbf, 0x387c, 0x1d0b, 0x3845, 0x1c6c, 0x380e, 0x1bc4, 0x37b0, 0x1ad2, 0x3745, 0x19fd,
|
|
15544
|
+
0x3bd9, 0x24e4, 0x3bd9, 0x24e5, 0x3bd9, 0x24e8, 0x3bd8, 0x24f2, 0x3bd5, 0x24fe, 0x3bd2, 0x2512, 0x3bce, 0x252b, 0x3bc6, 0x2544, 0x3bbc, 0x255a, 0x3bac, 0x256b, 0x3b93, 0x2569, 0x3b7a, 0x2557, 0x3b5b, 0x252f, 0x3b34, 0x24f7, 0x3b0c, 0x24ad, 0x3adf, 0x2458, 0x3ab1, 0x23f8, 0x3a82, 0x233f, 0x3a4f, 0x2286, 0x3a1e, 0x21d5, 0x39eb, 0x2130, 0x39b6, 0x2098, 0x3982, 0x200e, 0x394b, 0x1f25, 0x3914, 0x1e45, 0x38dc, 0x1d83, 0x38a3, 0x1cd6, 0x386b, 0x1c3d, 0x3831, 0x1b71, 0x37f2, 0x1a87, 0x3782, 0x19bc, 0x3714, 0x1909,
|
|
15545
|
+
0x3be5, 0x22d8, 0x3be5, 0x22d9, 0x3be4, 0x22df, 0x3be4, 0x22ef, 0x3be1, 0x2305, 0x3bde, 0x232a, 0x3bda, 0x2358, 0x3bd4, 0x2392, 0x3bcb, 0x23ca, 0x3bbb, 0x23f4, 0x3ba3, 0x2405, 0x3b8c, 0x2405, 0x3b6c, 0x23ec, 0x3b47, 0x23ae, 0x3b1d, 0x2353, 0x3af0, 0x22e2, 0x3ac0, 0x2261, 0x3a8e, 0x21d9, 0x3a5a, 0x214e, 0x3a26, 0x20c7, 0x39ee, 0x2045, 0x39b7, 0x1f97, 0x397f, 0x1eba, 0x3945, 0x1df0, 0x390b, 0x1d3a, 0x38d0, 0x1c9a, 0x3895, 0x1c0a, 0x385a, 0x1b18, 0x381f, 0x1a39, 0x37c9, 0x1975, 0x3756, 0x18cc, 0x36e6, 0x1836,
|
|
15546
|
+
0x3bed, 0x20a8, 0x3bed, 0x20a9, 0x3bed, 0x20ae, 0x3bed, 0x20bb, 0x3beb, 0x20cf, 0x3be8, 0x20ef, 0x3be4, 0x2119, 0x3bde, 0x214f, 0x3bd6, 0x2189, 0x3bc6, 0x21b8, 0x3bb1, 0x21de, 0x3b9a, 0x21f2, 0x3b7b, 0x21f2, 0x3b57, 0x21d8, 0x3b2d, 0x21a4, 0x3b00, 0x215f, 0x3acf, 0x2108, 0x3a99, 0x20a8, 0x3a64, 0x2043, 0x3a2c, 0x1fba, 0x39f2, 0x1ef3, 0x39b8, 0x1e36, 0x397c, 0x1d86, 0x3940, 0x1ce5, 0x3903, 0x1c52, 0x38c6, 0x1b9e, 0x3888, 0x1ab3, 0x384a, 0x19e4, 0x380e, 0x192b, 0x37a3, 0x188b, 0x372d, 0x17f7, 0x36ba, 0x1701,
|
|
15547
|
+
0x3bf4, 0x1e23, 0x3bf4, 0x1e25, 0x3bf4, 0x1e2d, 0x3bf3, 0x1e41, 0x3bf1, 0x1e64, 0x3bef, 0x1e9c, 0x3beb, 0x1ee1, 0x3be6, 0x1f40, 0x3bde, 0x1fa7, 0x3bce, 0x2001, 0x3bbd, 0x202f, 0x3ba6, 0x204e, 0x3b88, 0x205f, 0x3b64, 0x205b, 0x3b3b, 0x2044, 0x3b0e, 0x201f, 0x3adb, 0x1fcf, 0x3aa6, 0x1f4e, 0x3a6e, 0x1ec1, 0x3a33, 0x1e2b, 0x39f7, 0x1d95, 0x39ba, 0x1d06, 0x397b, 0x1c7d, 0x393c, 0x1bfc, 0x38fc, 0x1b13, 0x38bc, 0x1a40, 0x387c, 0x1983, 0x383c, 0x18da, 0x37fa, 0x1842, 0x377f, 0x177f, 0x3706, 0x1695, 0x3691, 0x15c8,
|
|
15548
|
+
0x3bf8, 0x1bca, 0x3bf8, 0x1bcc, 0x3bf8, 0x1bd8, 0x3bf8, 0x1bf7, 0x3bf6, 0x1c1b, 0x3bf4, 0x1c45, 0x3bf1, 0x1c83, 0x3bec, 0x1cce, 0x3be4, 0x1d21, 0x3bd5, 0x1d78, 0x3bc5, 0x1dd1, 0x3bb0, 0x1e17, 0x3b93, 0x1e4a, 0x3b70, 0x1e5f, 0x3b48, 0x1e57, 0x3b1b, 0x1e35, 0x3ae7, 0x1df6, 0x3ab2, 0x1da4, 0x3a77, 0x1d44, 0x3a3a, 0x1cdb, 0x39fc, 0x1c6e, 0x39bb, 0x1c03, 0x397a, 0x1b35, 0x3938, 0x1a72, 0x38f5, 0x19bb, 0x38b3, 0x1914, 0x3870, 0x187d, 0x382e, 0x17eb, 0x37db, 0x16f9, 0x375c, 0x1621, 0x36e1, 0x1565, 0x3669, 0x14be,
|
|
15549
|
+
0x3bfb, 0x18b9, 0x3bfb, 0x18ba, 0x3bfb, 0x18c3, 0x3bfb, 0x18da, 0x3bf9, 0x190a, 0x3bf7, 0x1948, 0x3bf5, 0x19ac, 0x3bf0, 0x1a20, 0x3be9, 0x1ab3, 0x3bdb, 0x1b49, 0x3bcd, 0x1be6, 0x3bb7, 0x1c34, 0x3b9c, 0x1c6d, 0x3b7a, 0x1c8e, 0x3b54, 0x1c9e, 0x3b26, 0x1c96, 0x3af2, 0x1c75, 0x3abc, 0x1c47, 0x3a80, 0x1c09, 0x3a42, 0x1b85, 0x3a01, 0x1aec, 0x39be, 0x1a50, 0x397a, 0x19b5, 0x3935, 0x1921, 0x38f0, 0x1895, 0x38aa, 0x1814, 0x3866, 0x173a, 0x3821, 0x1665, 0x37be, 0x15a4, 0x373c, 0x14f9, 0x36be, 0x1460, 0x3644, 0x13b3,
|
|
15550
|
+
0x3bfd, 0x156b, 0x3bfd, 0x156c, 0x3bfd, 0x1578, 0x3bfd, 0x1598, 0x3bfc, 0x15dd, 0x3bfa, 0x163c, 0x3bf7, 0x16cb, 0x3bf3, 0x177b, 0x3beb, 0x1833, 0x3be0, 0x18ad, 0x3bd2, 0x192e, 0x3bbd, 0x19a6, 0x3ba4, 0x1a0c, 0x3b83, 0x1a5a, 0x3b5d, 0x1a8c, 0x3b30, 0x1a9b, 0x3afd, 0x1a86, 0x3ac6, 0x1a5c, 0x3a89, 0x1a11, 0x3a49, 0x19b7, 0x3a06, 0x194f, 0x39c1, 0x18e3, 0x397a, 0x1873, 0x3933, 0x1805, 0x38eb, 0x173a, 0x38a3, 0x1676, 0x385c, 0x15bf, 0x3816, 0x1519, 0x37a2, 0x1482, 0x371d, 0x13f7, 0x369c, 0x1306, 0x3620, 0x1231,
|
|
15551
|
+
0x3bff, 0x11cb, 0x3bff, 0x11cd, 0x3bfe, 0x11dd, 0x3bfe, 0x1219, 0x3bfd, 0x126b, 0x3bfb, 0x12e9, 0x3bf9, 0x13c5, 0x3bf5, 0x1460, 0x3bee, 0x150f, 0x3be3, 0x15c9, 0x3bd6, 0x168a, 0x3bc3, 0x174f, 0x3baa, 0x1806, 0x3b8b, 0x184f, 0x3b66, 0x1888, 0x3b39, 0x18a6, 0x3b07, 0x18ad, 0x3acf, 0x189c, 0x3a92, 0x1876, 0x3a50, 0x1840, 0x3a0c, 0x17fd, 0x39c4, 0x176a, 0x397b, 0x16ce, 0x3931, 0x1634, 0x38e6, 0x1599, 0x389c, 0x1508, 0x3852, 0x147f, 0x380a, 0x1401, 0x3788, 0x131c, 0x36ff, 0x124a, 0x367c, 0x1190, 0x35fe, 0x10ea,
|
|
15552
|
+
0x3bff, 0x0daa, 0x3bff, 0x0dad, 0x3bff, 0x0dc0, 0x3bff, 0x0e0e, 0x3bfe, 0x0e87, 0x3bfc, 0x0f14, 0x3bfb, 0x1029, 0x3bf7, 0x10d1, 0x3bf0, 0x11d3, 0x3be6, 0x12c9, 0x3bd9, 0x13fc, 0x3bc7, 0x1499, 0x3bb0, 0x152a, 0x3b92, 0x15ab, 0x3b6e, 0x1615, 0x3b42, 0x165a, 0x3b10, 0x1681, 0x3ad8, 0x1683, 0x3a9a, 0x1665, 0x3a57, 0x1629, 0x3a11, 0x15dd, 0x39c8, 0x1580, 0x397c, 0x1518, 0x3930, 0x14ae, 0x38e3, 0x1441, 0x3896, 0x13b1, 0x384a, 0x12e9, 0x37ff, 0x122f, 0x376f, 0x1182, 0x36e3, 0x10e5, 0x365e, 0x1057, 0x35de, 0x0fac,
|
|
15553
|
+
0x3c00, 0x08ea, 0x3c00, 0x08ed, 0x3c00, 0x0902, 0x3c00, 0x0961, 0x3bff, 0x09f3, 0x3bfd, 0x0abc, 0x3bfb, 0x0c1f, 0x3bf8, 0x0d15, 0x3bf1, 0x0e5b, 0x3be8, 0x0fb4, 0x3bdc, 0x10b0, 0x3bcb, 0x1190, 0x3bb5, 0x126c, 0x3b97, 0x132c, 0x3b74, 0x13de, 0x3b4a, 0x1432, 0x3b18, 0x145e, 0x3ae0, 0x1472, 0x3aa2, 0x146f, 0x3a5f, 0x1456, 0x3a17, 0x142e, 0x39cc, 0x13ee, 0x397e, 0x136b, 0x392f, 0x12e1, 0x38df, 0x124f, 0x3890, 0x11bd, 0x3842, 0x1131, 0x37eb, 0x10ac, 0x3757, 0x102e, 0x36c9, 0x0f76, 0x3640, 0x0ea3, 0x35bf, 0x0de4,
|
|
15554
|
+
0x3c00, 0x039b, 0x3c00, 0x039d, 0x3c00, 0x03b2, 0x3c00, 0x041c, 0x3bff, 0x04be, 0x3bfd, 0x05d6, 0x3bfc, 0x0764, 0x3bf8, 0x08e2, 0x3bf2, 0x0a67, 0x3bea, 0x0c1b, 0x3bde, 0x0d41, 0x3bcd, 0x0e5f, 0x3bb8, 0x0f8c, 0x3b9c, 0x1057, 0x3b7a, 0x10e5, 0x3b51, 0x1155, 0x3b20, 0x11a5, 0x3ae8, 0x11da, 0x3aaa, 0x11ef, 0x3a66, 0x11e5, 0x3a1d, 0x11c1, 0x39d0, 0x1185, 0x3980, 0x113b, 0x392e, 0x10e5, 0x38dc, 0x1087, 0x388b, 0x1028, 0x383b, 0x0f94, 0x37d9, 0x0edb, 0x3741, 0x0e2c, 0x36af, 0x0d89, 0x3625, 0x0cf2, 0x35a1, 0x0c69,
|
|
15555
|
+
0x3c00, 0x0107, 0x3c00, 0x0108, 0x3c00, 0x0110, 0x3c00, 0x0145, 0x3bff, 0x0197, 0x3bfe, 0x0224, 0x3bfc, 0x030c, 0x3bf8, 0x0478, 0x3bf3, 0x062c, 0x3beb, 0x0833, 0x3be0, 0x0979, 0x3bd0, 0x0aeb, 0x3bbc, 0x0c3d, 0x3ba0, 0x0d01, 0x3b80, 0x0dbd, 0x3b57, 0x0e69, 0x3b27, 0x0eeb, 0x3af0, 0x0f53, 0x3ab1, 0x0f8a, 0x3a6c, 0x0f9f, 0x3a22, 0x0f8b, 0x39d4, 0x0f5b, 0x3982, 0x0f0f, 0x392f, 0x0eac, 0x38da, 0x0e3d, 0x3886, 0x0dc9, 0x3834, 0x0d51, 0x37c7, 0x0cd9, 0x372c, 0x0c65, 0x3697, 0x0bef, 0x360a, 0x0b20, 0x3585, 0x0a62,
|
|
15556
|
+
0x3c00, 0x0031, 0x3c00, 0x0031, 0x3c00, 0x0034, 0x3c00, 0x004b, 0x3bff, 0x006f, 0x3bfe, 0x00c9, 0x3bfc, 0x011b, 0x3bf9, 0x0207, 0x3bf4, 0x02d6, 0x3bec, 0x0415, 0x3be1, 0x0587, 0x3bd2, 0x0703, 0x3bbf, 0x087d, 0x3ba5, 0x096a, 0x3b85, 0x0a59, 0x3b5d, 0x0b32, 0x3b2e, 0x0bee, 0x3af7, 0x0c44, 0x3ab8, 0x0c7c, 0x3a73, 0x0c9c, 0x3a28, 0x0ca4, 0x39d8, 0x0c98, 0x3985, 0x0c77, 0x392f, 0x0c4a, 0x38d9, 0x0c10, 0x3882, 0x0ba0, 0x382e, 0x0b14, 0x37b6, 0x0a84, 0x3717, 0x09f5, 0x3680, 0x0969, 0x35f0, 0x08e6, 0x356a, 0x086a,
|
|
15557
|
+
0x3c00, 0x0004, 0x3c00, 0x0004, 0x3c00, 0x0004, 0x3c00, 0x000d, 0x3bff, 0x0021, 0x3bfe, 0x003b, 0x3bfd, 0x0070, 0x3bf9, 0x00c7, 0x3bf4, 0x012e, 0x3bed, 0x01c8, 0x3be3, 0x0274, 0x3bd4, 0x033b, 0x3bc1, 0x043a, 0x3ba8, 0x0534, 0x3b89, 0x0641, 0x3b62, 0x073b, 0x3b34, 0x0815, 0x3afd, 0x087c, 0x3abf, 0x08d0, 0x3a7a, 0x090a, 0x3a2e, 0x092c, 0x39dd, 0x0936, 0x3988, 0x0928, 0x3930, 0x0907, 0x38d7, 0x08d7, 0x387f, 0x089b, 0x3828, 0x0855, 0x37a7, 0x080b, 0x3704, 0x077b, 0x366a, 0x06e1, 0x35d8, 0x0649, 0x3550, 0x05b8,
|
|
15558
|
+
0x3c00, 0x0000, 0x3c00, 0x0000, 0x3c00, 0x0000, 0x3c00, 0x0003, 0x3bff, 0x0012, 0x3bfe, 0x001a, 0x3bfd, 0x0035, 0x3bfa, 0x0050, 0x3bf4, 0x0061, 0x3bed, 0x00a5, 0x3be4, 0x00ee, 0x3bd6, 0x0146, 0x3bc3, 0x01ab, 0x3bab, 0x0211, 0x3b8d, 0x028e, 0x3b67, 0x0303, 0x3b39, 0x0375, 0x3b04, 0x03e2, 0x3ac6, 0x0441, 0x3a80, 0x0492, 0x3a34, 0x04cd, 0x39e1, 0x04f2, 0x398b, 0x0504, 0x3931, 0x0502, 0x38d6, 0x04ec, 0x387c, 0x04c7, 0x3822, 0x0496, 0x3798, 0x045c, 0x36f2, 0x041a, 0x3655, 0x03d5, 0x35c1, 0x038e, 0x3537, 0x0347
|
|
15559
|
+
] );
|
|
15560
|
+
|
|
15561
|
+
let lut = null;
|
|
15562
|
+
|
|
15563
|
+
function getDFGLUT() {
|
|
15564
|
+
|
|
15565
|
+
if ( lut === null ) {
|
|
15566
|
+
|
|
15567
|
+
lut = new DataTexture( DATA, 32, 32, RGFormat, HalfFloatType );
|
|
15568
|
+
lut.minFilter = LinearFilter;
|
|
15569
|
+
lut.magFilter = LinearFilter;
|
|
15570
|
+
lut.wrapS = ClampToEdgeWrapping;
|
|
15571
|
+
lut.wrapT = ClampToEdgeWrapping;
|
|
15572
|
+
lut.generateMipmaps = false;
|
|
15573
|
+
lut.needsUpdate = true;
|
|
15574
|
+
|
|
15575
|
+
}
|
|
15576
|
+
|
|
15577
|
+
return lut;
|
|
15578
|
+
|
|
15579
|
+
}
|
|
15580
|
+
|
|
15207
15581
|
/**
|
|
15208
15582
|
* This renderer uses WebGL 2 to display scenes.
|
|
15209
15583
|
*
|
|
@@ -15229,7 +15603,7 @@ class WebGLRenderer {
|
|
|
15229
15603
|
preserveDrawingBuffer = false,
|
|
15230
15604
|
powerPreference = 'default',
|
|
15231
15605
|
failIfMajorPerformanceCaveat = false,
|
|
15232
|
-
|
|
15606
|
+
reversedDepthBuffer = false,
|
|
15233
15607
|
multiviewStereo = false,
|
|
15234
15608
|
} = parameters;
|
|
15235
15609
|
|
|
@@ -15260,6 +15634,21 @@ class WebGLRenderer {
|
|
|
15260
15634
|
|
|
15261
15635
|
}
|
|
15262
15636
|
|
|
15637
|
+
const INTEGER_FORMATS = new Set( [
|
|
15638
|
+
RGBAIntegerFormat,
|
|
15639
|
+
RGIntegerFormat,
|
|
15640
|
+
RedIntegerFormat
|
|
15641
|
+
] );
|
|
15642
|
+
|
|
15643
|
+
const UNSIGNED_TYPES = new Set( [
|
|
15644
|
+
UnsignedByteType,
|
|
15645
|
+
UnsignedIntType,
|
|
15646
|
+
UnsignedShortType,
|
|
15647
|
+
UnsignedInt248Type,
|
|
15648
|
+
UnsignedShort4444Type,
|
|
15649
|
+
UnsignedShort5551Type
|
|
15650
|
+
] );
|
|
15651
|
+
|
|
15263
15652
|
const uintClearColor = new Uint32Array( 4 );
|
|
15264
15653
|
const intClearColor = new Int32Array( 4 );
|
|
15265
15654
|
|
|
@@ -15281,7 +15670,7 @@ class WebGLRenderer {
|
|
|
15281
15670
|
* document.body.appendChild( renderer.domElement );
|
|
15282
15671
|
* ```
|
|
15283
15672
|
*
|
|
15284
|
-
* @type {
|
|
15673
|
+
* @type {HTMLCanvasElement|OffscreenCanvas}
|
|
15285
15674
|
*/
|
|
15286
15675
|
this.domElement = canvas;
|
|
15287
15676
|
|
|
@@ -15463,7 +15852,6 @@ class WebGLRenderer {
|
|
|
15463
15852
|
|
|
15464
15853
|
// camera matrices cache
|
|
15465
15854
|
|
|
15466
|
-
const _currentProjectionMatrix = new Matrix4();
|
|
15467
15855
|
const _projScreenMatrix = new Matrix4();
|
|
15468
15856
|
|
|
15469
15857
|
const _vector3 = new Vector3();
|
|
@@ -15535,7 +15923,7 @@ class WebGLRenderer {
|
|
|
15535
15923
|
|
|
15536
15924
|
} catch ( error ) {
|
|
15537
15925
|
|
|
15538
|
-
|
|
15926
|
+
error( 'WebGLRenderer: ' + error.message );
|
|
15539
15927
|
throw error;
|
|
15540
15928
|
|
|
15541
15929
|
}
|
|
@@ -15560,7 +15948,7 @@ class WebGLRenderer {
|
|
|
15560
15948
|
|
|
15561
15949
|
state = new WebGLState( _gl, extensions );
|
|
15562
15950
|
|
|
15563
|
-
if ( capabilities.
|
|
15951
|
+
if ( capabilities.reversedDepthBuffer && reversedDepthBuffer ) {
|
|
15564
15952
|
|
|
15565
15953
|
state.buffers.depth.setReversed( true );
|
|
15566
15954
|
|
|
@@ -15672,7 +16060,7 @@ class WebGLRenderer {
|
|
|
15672
16060
|
|
|
15673
16061
|
// xr
|
|
15674
16062
|
|
|
15675
|
-
const xr = new WebXRManager( _this, _gl );
|
|
16063
|
+
const xr = new WebXRManager( _this, _gl, extensions, multiviewStereo );
|
|
15676
16064
|
|
|
15677
16065
|
/**
|
|
15678
16066
|
* A reference to the XR manager.
|
|
@@ -15774,7 +16162,7 @@ class WebGLRenderer {
|
|
|
15774
16162
|
|
|
15775
16163
|
if ( xr.isPresenting ) {
|
|
15776
16164
|
|
|
15777
|
-
|
|
16165
|
+
warn( 'WebGLRenderer: Can\'t change size while VR device is presenting.' );
|
|
15778
16166
|
return;
|
|
15779
16167
|
|
|
15780
16168
|
}
|
|
@@ -16036,9 +16424,7 @@ class WebGLRenderer {
|
|
|
16036
16424
|
if ( _currentRenderTarget !== null ) {
|
|
16037
16425
|
|
|
16038
16426
|
const targetFormat = _currentRenderTarget.texture.format;
|
|
16039
|
-
isIntegerFormat = targetFormat
|
|
16040
|
-
targetFormat === RGIntegerFormat ||
|
|
16041
|
-
targetFormat === RedIntegerFormat;
|
|
16427
|
+
isIntegerFormat = INTEGER_FORMATS.has( targetFormat );
|
|
16042
16428
|
|
|
16043
16429
|
}
|
|
16044
16430
|
|
|
@@ -16047,12 +16433,7 @@ class WebGLRenderer {
|
|
|
16047
16433
|
if ( isIntegerFormat ) {
|
|
16048
16434
|
|
|
16049
16435
|
const targetType = _currentRenderTarget.texture.type;
|
|
16050
|
-
const isUnsignedType = targetType
|
|
16051
|
-
targetType === UnsignedIntType ||
|
|
16052
|
-
targetType === UnsignedShortType ||
|
|
16053
|
-
targetType === UnsignedInt248Type ||
|
|
16054
|
-
targetType === UnsignedShort4444Type ||
|
|
16055
|
-
targetType === UnsignedShort5551Type;
|
|
16436
|
+
const isUnsignedType = UNSIGNED_TYPES.has( targetType );
|
|
16056
16437
|
|
|
16057
16438
|
const clearColor = background.getClearColor();
|
|
16058
16439
|
const a = background.getClearAlpha();
|
|
@@ -16166,7 +16547,7 @@ class WebGLRenderer {
|
|
|
16166
16547
|
|
|
16167
16548
|
event.preventDefault();
|
|
16168
16549
|
|
|
16169
|
-
|
|
16550
|
+
log( 'WebGLRenderer: Context Lost.' );
|
|
16170
16551
|
|
|
16171
16552
|
_isContextLost = true;
|
|
16172
16553
|
|
|
@@ -16174,7 +16555,7 @@ class WebGLRenderer {
|
|
|
16174
16555
|
|
|
16175
16556
|
function onContextRestore( /* event */ ) {
|
|
16176
16557
|
|
|
16177
|
-
|
|
16558
|
+
log( 'WebGLRenderer: Context Restored.' );
|
|
16178
16559
|
|
|
16179
16560
|
_isContextLost = false;
|
|
16180
16561
|
|
|
@@ -16196,7 +16577,7 @@ class WebGLRenderer {
|
|
|
16196
16577
|
|
|
16197
16578
|
function onContextCreationError( event ) {
|
|
16198
16579
|
|
|
16199
|
-
|
|
16580
|
+
error( 'WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage );
|
|
16200
16581
|
|
|
16201
16582
|
}
|
|
16202
16583
|
|
|
@@ -16369,7 +16750,7 @@ class WebGLRenderer {
|
|
|
16369
16750
|
if ( object._multiDrawInstances !== null ) {
|
|
16370
16751
|
|
|
16371
16752
|
// @deprecated, r174
|
|
16372
|
-
warnOnce( '
|
|
16753
|
+
warnOnce( 'WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.' );
|
|
16373
16754
|
renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
|
|
16374
16755
|
|
|
16375
16756
|
} else {
|
|
@@ -16645,6 +17026,13 @@ class WebGLRenderer {
|
|
|
16645
17026
|
|
|
16646
17027
|
if ( typeof self !== 'undefined' ) animation.setContext( self );
|
|
16647
17028
|
|
|
17029
|
+
/**
|
|
17030
|
+
* Applications are advised to always define the animation loop
|
|
17031
|
+
* with this method and not manually with `requestAnimationFrame()`
|
|
17032
|
+
* for best compatibility.
|
|
17033
|
+
*
|
|
17034
|
+
* @param {?onAnimationCallback} callback - The application's animation loop.
|
|
17035
|
+
*/
|
|
16648
17036
|
this.setAnimationLoop = function ( callback ) {
|
|
16649
17037
|
|
|
16650
17038
|
onAnimationFrameCallback = callback;
|
|
@@ -16677,7 +17065,7 @@ class WebGLRenderer {
|
|
|
16677
17065
|
|
|
16678
17066
|
if ( camera !== undefined && camera.isCamera !== true ) {
|
|
16679
17067
|
|
|
16680
|
-
|
|
17068
|
+
error( 'WebGLRenderer.render: camera is not an instance of THREE.Camera.' );
|
|
16681
17069
|
return;
|
|
16682
17070
|
|
|
16683
17071
|
}
|
|
@@ -16709,7 +17097,7 @@ class WebGLRenderer {
|
|
|
16709
17097
|
renderStateStack.push( currentRenderState );
|
|
16710
17098
|
|
|
16711
17099
|
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
16712
|
-
_frustum.setFromProjectionMatrix( _projScreenMatrix );
|
|
17100
|
+
_frustum.setFromProjectionMatrix( _projScreenMatrix, WebGLCoordinateSystem, camera.reversedDepth );
|
|
16713
17101
|
|
|
16714
17102
|
_localClippingEnabled = this.localClippingEnabled;
|
|
16715
17103
|
_clippingEnabled = clipping.init( this.clippingPlanes, _localClippingEnabled );
|
|
@@ -16835,6 +17223,8 @@ class WebGLRenderer {
|
|
|
16835
17223
|
|
|
16836
17224
|
if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );
|
|
16837
17225
|
|
|
17226
|
+
textures.runDeferredUploads();
|
|
17227
|
+
|
|
16838
17228
|
// _gl.finish();
|
|
16839
17229
|
|
|
16840
17230
|
bindingStates.resetDefaultState();
|
|
@@ -16985,9 +17375,7 @@ class WebGLRenderer {
|
|
|
16985
17375
|
|
|
16986
17376
|
function renderScene( currentRenderList, scene, camera, viewport ) {
|
|
16987
17377
|
|
|
16988
|
-
const opaqueObjects = currentRenderList
|
|
16989
|
-
const transmissiveObjects = currentRenderList.transmissive;
|
|
16990
|
-
const transparentObjects = currentRenderList.transparent;
|
|
17378
|
+
const { opaque: opaqueObjects, transmissive: transmissiveObjects, transparent: transparentObjects } = currentRenderList;
|
|
16991
17379
|
|
|
16992
17380
|
currentRenderState.setupLightsView( camera );
|
|
16993
17381
|
|
|
@@ -17052,6 +17440,9 @@ class WebGLRenderer {
|
|
|
17052
17440
|
//
|
|
17053
17441
|
|
|
17054
17442
|
const currentRenderTarget = _this.getRenderTarget();
|
|
17443
|
+
const currentActiveCubeFace = _this.getActiveCubeFace();
|
|
17444
|
+
const currentActiveMipmapLevel = _this.getActiveMipmapLevel();
|
|
17445
|
+
|
|
17055
17446
|
_this.setRenderTarget( transmissionRenderTarget );
|
|
17056
17447
|
|
|
17057
17448
|
_this.getClearColor( _currentClearColor );
|
|
@@ -17089,10 +17480,7 @@ class WebGLRenderer {
|
|
|
17089
17480
|
|
|
17090
17481
|
const renderItem = transmissiveObjects[ i ];
|
|
17091
17482
|
|
|
17092
|
-
const object = renderItem
|
|
17093
|
-
const geometry = renderItem.geometry;
|
|
17094
|
-
const material = renderItem.material;
|
|
17095
|
-
const group = renderItem.group;
|
|
17483
|
+
const { object, geometry, material, group } = renderItem;
|
|
17096
17484
|
|
|
17097
17485
|
if ( material.side === DoubleSide && object.layers.test( camera.layers ) ) {
|
|
17098
17486
|
|
|
@@ -17121,7 +17509,7 @@ class WebGLRenderer {
|
|
|
17121
17509
|
|
|
17122
17510
|
}
|
|
17123
17511
|
|
|
17124
|
-
_this.setRenderTarget( currentRenderTarget );
|
|
17512
|
+
_this.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );
|
|
17125
17513
|
|
|
17126
17514
|
_this.setClearColor( _currentClearColor, _currentClearAlpha );
|
|
17127
17515
|
|
|
@@ -17139,9 +17527,7 @@ class WebGLRenderer {
|
|
|
17139
17527
|
|
|
17140
17528
|
const renderItem = renderList[ i ];
|
|
17141
17529
|
|
|
17142
|
-
const object = renderItem
|
|
17143
|
-
const geometry = renderItem.geometry;
|
|
17144
|
-
const group = renderItem.group;
|
|
17530
|
+
const { object, geometry, group } = renderItem;
|
|
17145
17531
|
let material = renderItem.material;
|
|
17146
17532
|
|
|
17147
17533
|
if ( material.allowOverride === true && overrideMaterial !== null ) {
|
|
@@ -17553,23 +17939,17 @@ class WebGLRenderer {
|
|
|
17553
17939
|
|
|
17554
17940
|
} else {
|
|
17555
17941
|
|
|
17556
|
-
const
|
|
17557
|
-
|
|
17558
|
-
if ( reverseDepthBuffer ) {
|
|
17942
|
+
const reversedDepthBuffer = state.buffers.depth.getReversed();
|
|
17559
17943
|
|
|
17560
|
-
|
|
17944
|
+
if ( reversedDepthBuffer && camera.reversedDepth !== true ) {
|
|
17561
17945
|
|
|
17562
|
-
|
|
17563
|
-
|
|
17564
|
-
|
|
17565
|
-
p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
|
|
17566
|
-
|
|
17567
|
-
} else {
|
|
17568
|
-
|
|
17569
|
-
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
17946
|
+
camera._reversedDepth = true;
|
|
17947
|
+
camera.updateProjectionMatrix();
|
|
17570
17948
|
|
|
17571
17949
|
}
|
|
17572
17950
|
|
|
17951
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
17952
|
+
|
|
17573
17953
|
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
17574
17954
|
|
|
17575
17955
|
}
|
|
@@ -17686,6 +18066,13 @@ class WebGLRenderer {
|
|
|
17686
18066
|
|
|
17687
18067
|
}
|
|
17688
18068
|
|
|
18069
|
+
// Set DFG LUT for physically-based materials
|
|
18070
|
+
if ( m_uniforms.dfgLUT !== undefined ) {
|
|
18071
|
+
|
|
18072
|
+
m_uniforms.dfgLUT.value = getDFGLUT();
|
|
18073
|
+
|
|
18074
|
+
}
|
|
18075
|
+
|
|
17689
18076
|
if ( refreshMaterial ) {
|
|
17690
18077
|
|
|
17691
18078
|
p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
|
|
@@ -17859,7 +18246,7 @@ class WebGLRenderer {
|
|
|
17859
18246
|
const renderTargetProperties = properties.get( renderTarget );
|
|
17860
18247
|
|
|
17861
18248
|
renderTargetProperties.__autoAllocateDepthBuffer = renderTarget.resolveDepthBuffer === false;
|
|
17862
|
-
if ( ! renderTargetProperties.__autoAllocateDepthBuffer
|
|
18249
|
+
if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
|
|
17863
18250
|
|
|
17864
18251
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
17865
18252
|
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
@@ -18035,9 +18422,15 @@ class WebGLRenderer {
|
|
|
18035
18422
|
|
|
18036
18423
|
} else if ( isRenderTarget3D ) {
|
|
18037
18424
|
|
|
18038
|
-
const textureProperties = properties.get( renderTarget.texture );
|
|
18039
18425
|
const layer = activeCubeFace;
|
|
18040
|
-
|
|
18426
|
+
|
|
18427
|
+
for ( let i = 0; i < renderTarget.textures.length; i ++ ) {
|
|
18428
|
+
|
|
18429
|
+
const textureProperties = properties.get( renderTarget.textures[ i ] );
|
|
18430
|
+
|
|
18431
|
+
_gl.framebufferTextureLayer( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0 + i, textureProperties.__webglTexture, activeMipmapLevel, layer );
|
|
18432
|
+
|
|
18433
|
+
}
|
|
18041
18434
|
|
|
18042
18435
|
} else if ( renderTarget !== null && activeMipmapLevel !== 0 ) {
|
|
18043
18436
|
|
|
@@ -18068,7 +18461,7 @@ class WebGLRenderer {
|
|
|
18068
18461
|
|
|
18069
18462
|
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
18070
18463
|
|
|
18071
|
-
|
|
18464
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );
|
|
18072
18465
|
return;
|
|
18073
18466
|
|
|
18074
18467
|
}
|
|
@@ -18093,14 +18486,14 @@ class WebGLRenderer {
|
|
|
18093
18486
|
|
|
18094
18487
|
if ( ! capabilities.textureFormatReadable( textureFormat ) ) {
|
|
18095
18488
|
|
|
18096
|
-
|
|
18489
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.' );
|
|
18097
18490
|
return;
|
|
18098
18491
|
|
|
18099
18492
|
}
|
|
18100
18493
|
|
|
18101
18494
|
if ( ! capabilities.textureTypeReadable( textureType ) ) {
|
|
18102
18495
|
|
|
18103
|
-
|
|
18496
|
+
error( 'WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
|
|
18104
18497
|
return;
|
|
18105
18498
|
|
|
18106
18499
|
}
|
|
@@ -18109,7 +18502,7 @@ class WebGLRenderer {
|
|
|
18109
18502
|
|
|
18110
18503
|
if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
|
|
18111
18504
|
|
|
18112
|
-
// when using MRT, select the
|
|
18505
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
18113
18506
|
|
|
18114
18507
|
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
18115
18508
|
|
|
@@ -18189,7 +18582,7 @@ class WebGLRenderer {
|
|
|
18189
18582
|
_gl.bindBuffer( _gl.PIXEL_PACK_BUFFER, glBuffer );
|
|
18190
18583
|
_gl.bufferData( _gl.PIXEL_PACK_BUFFER, buffer.byteLength, _gl.STREAM_READ );
|
|
18191
18584
|
|
|
18192
|
-
// when using MRT, select the
|
|
18585
|
+
// when using MRT, select the correct color buffer for the subsequent read command
|
|
18193
18586
|
|
|
18194
18587
|
if ( renderTarget.textures.length > 1 ) _gl.readBuffer( _gl.COLOR_ATTACHMENT0 + textureIndex );
|
|
18195
18588
|
|
|
@@ -18516,15 +18909,6 @@ class WebGLRenderer {
|
|
|
18516
18909
|
|
|
18517
18910
|
};
|
|
18518
18911
|
|
|
18519
|
-
this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
18520
|
-
|
|
18521
|
-
// @deprecated, r170
|
|
18522
|
-
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.' );
|
|
18523
|
-
|
|
18524
|
-
return this.copyTextureToTexture( srcTexture, dstTexture, srcRegion, dstPosition, level );
|
|
18525
|
-
|
|
18526
|
-
};
|
|
18527
|
-
|
|
18528
18912
|
/**
|
|
18529
18913
|
* Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data
|
|
18530
18914
|
* can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been
|
|
@@ -18635,4 +19019,4 @@ class WebGLRenderer {
|
|
|
18635
19019
|
|
|
18636
19020
|
}
|
|
18637
19021
|
|
|
18638
|
-
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, Data3DTexture, DataArrayTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, ShaderChunk, ShaderLib, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, Uint16BufferAttribute, Uint32BufferAttribute, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebXRController, ZeroFactor, createCanvasElement };
|
|
19022
|
+
export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, Data3DTexture, DataArrayTexture, DataTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, PerspectiveCamera, Plane, PlaneGeometry, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, ShaderChunk, ShaderLib, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, Uint16BufferAttribute, Uint32BufferAttribute, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebXRController, ZeroFactor, createCanvasElement, error, log, warn, warnOnce };
|