@plastic-software/three 0.175.14 → 0.179.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 +4 -4
- package/build/three.cjs +8402 -6787
- package/build/three.core.js +8007 -6688
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +397 -102
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +84 -27
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +6831 -2838
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +6648 -2838
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +1 -3
- package/examples/jsm/animation/AnimationClipCreator.js +1 -0
- package/examples/jsm/animation/CCDIKSolver.js +6 -3
- package/examples/jsm/capabilities/WebGL.js +1 -27
- package/examples/jsm/capabilities/WebGPU.js +2 -1
- package/examples/jsm/controls/ArcballControls.js +15 -4
- package/examples/jsm/controls/DragControls.js +1 -0
- package/examples/jsm/controls/FirstPersonControls.js +1 -0
- package/examples/jsm/controls/FlyControls.js +1 -0
- package/examples/jsm/controls/MapControls.js +1 -0
- package/examples/jsm/controls/OrbitControls.js +1 -0
- package/examples/jsm/controls/PointerLockControls.js +5 -3
- package/examples/jsm/controls/TrackballControls.js +1 -0
- package/examples/jsm/controls/TransformControls.js +62 -14
- package/examples/jsm/csm/CSM.js +2 -0
- package/examples/jsm/csm/CSMFrustum.js +2 -0
- package/examples/jsm/csm/CSMHelper.js +1 -0
- package/examples/jsm/csm/CSMShader.js +4 -1
- package/examples/jsm/csm/CSMShadowNode.js +22 -8
- package/examples/jsm/curves/CurveExtras.js +14 -0
- package/examples/jsm/curves/NURBSCurve.js +1 -0
- package/examples/jsm/curves/NURBSSurface.js +2 -0
- package/examples/jsm/curves/NURBSUtils.js +4 -1
- package/examples/jsm/curves/NURBSVolume.js +2 -0
- package/examples/jsm/effects/AnaglyphEffect.js +2 -0
- package/examples/jsm/effects/AsciiEffect.js +2 -0
- package/examples/jsm/effects/OutlineEffect.js +2 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +2 -0
- package/examples/jsm/effects/StereoEffect.js +2 -0
- package/examples/jsm/environments/DebugEnvironment.js +1 -0
- package/examples/jsm/environments/RoomEnvironment.js +57 -38
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +2 -0
- package/examples/jsm/exporters/GLTFExporter.js +7 -4
- package/examples/jsm/exporters/KTX2Exporter.js +2 -0
- package/examples/jsm/exporters/OBJExporter.js +3 -1
- package/examples/jsm/exporters/PLYExporter.js +4 -2
- package/examples/jsm/exporters/STLExporter.js +2 -0
- package/examples/jsm/exporters/USDZExporter.js +679 -300
- package/examples/jsm/geometries/BoxLineGeometry.js +1 -0
- package/examples/jsm/geometries/ConvexGeometry.js +1 -0
- package/examples/jsm/geometries/DecalGeometry.js +1 -0
- package/examples/jsm/geometries/ParametricFunctions.js +4 -1
- package/examples/jsm/geometries/ParametricGeometry.js +1 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +48 -8
- package/examples/jsm/geometries/TeapotGeometry.js +1 -0
- package/examples/jsm/geometries/TextGeometry.js +1 -0
- package/examples/jsm/helpers/LightProbeHelper.js +1 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -0
- package/examples/jsm/helpers/OctreeHelper.js +1 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +1 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +1 -0
- package/examples/jsm/helpers/TextureHelper.js +1 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +5 -4
- package/examples/jsm/helpers/VertexNormalsHelper.js +1 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +1 -0
- package/examples/jsm/helpers/ViewHelper.js +1 -0
- package/examples/jsm/interactive/HTMLMesh.js +11 -2
- package/examples/jsm/interactive/InteractiveGroup.js +1 -0
- package/examples/jsm/interactive/SelectionBox.js +2 -0
- package/examples/jsm/interactive/SelectionHelper.js +2 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
- package/examples/jsm/lighting/TiledLighting.js +1 -0
- package/examples/jsm/lights/LightProbeGenerator.js +15 -3
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +1 -0
- package/examples/jsm/lines/Line2.js +1 -0
- package/examples/jsm/lines/LineGeometry.js +1 -0
- package/examples/jsm/lines/LineMaterial.js +4 -4
- package/examples/jsm/lines/LineSegments2.js +1 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +1 -0
- package/examples/jsm/lines/Wireframe.js +1 -0
- package/examples/jsm/lines/WireframeGeometry2.js +1 -0
- package/examples/jsm/lines/webgpu/Line2.js +1 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +3 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -0
- package/examples/jsm/loaders/3MFLoader.js +1 -0
- package/examples/jsm/loaders/AMFLoader.js +1 -0
- package/examples/jsm/loaders/BVHLoader.js +1 -0
- package/examples/jsm/loaders/ColladaLoader.js +6 -5
- package/examples/jsm/loaders/DDSLoader.js +1 -0
- package/examples/jsm/loaders/DRACOLoader.js +2 -1
- package/examples/jsm/loaders/EXRLoader.js +211 -22
- package/examples/jsm/loaders/FBXLoader.js +25 -23
- package/examples/jsm/loaders/FontLoader.js +1 -0
- package/examples/jsm/loaders/GCodeLoader.js +1 -0
- package/examples/jsm/loaders/GLTFLoader.js +10 -82
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -0
- package/examples/jsm/loaders/IESLoader.js +1 -0
- package/examples/jsm/loaders/KMZLoader.js +1 -0
- package/examples/jsm/loaders/KTX2Loader.js +67 -26
- package/examples/jsm/loaders/KTXLoader.js +1 -0
- package/examples/jsm/loaders/LDrawLoader.js +55 -3
- package/examples/jsm/loaders/LUT3dlLoader.js +1 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -0
- package/examples/jsm/loaders/LUTImageLoader.js +1 -0
- package/examples/jsm/loaders/LWOLoader.js +1 -13
- package/examples/jsm/loaders/LottieLoader.js +15 -0
- package/examples/jsm/loaders/MD2Loader.js +1 -0
- package/examples/jsm/loaders/MDDLoader.js +1 -0
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +213 -30
- package/examples/jsm/loaders/NRRDLoader.js +1 -0
- package/examples/jsm/loaders/OBJLoader.js +1 -0
- package/examples/jsm/loaders/PCDLoader.js +122 -19
- package/examples/jsm/loaders/PDBLoader.js +1 -0
- package/examples/jsm/loaders/PLYLoader.js +1 -0
- package/examples/jsm/loaders/PVRLoader.js +1 -0
- package/examples/jsm/loaders/RGBELoader.js +1 -0
- package/examples/jsm/loaders/RGBMLoader.js +1 -0
- package/examples/jsm/loaders/STLLoader.js +1 -0
- package/examples/jsm/loaders/SVGLoader.js +1 -0
- package/examples/jsm/loaders/TDSLoader.js +1 -0
- package/examples/jsm/loaders/TGALoader.js +1 -0
- package/examples/jsm/loaders/TIFFLoader.js +1 -0
- package/examples/jsm/loaders/TTFLoader.js +14 -1
- package/examples/jsm/loaders/USDLoader.js +219 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -891
- package/examples/jsm/loaders/UltraHDRLoader.js +1 -0
- package/examples/jsm/loaders/VOXLoader.js +1 -0
- package/examples/jsm/loaders/VRMLLoader.js +3 -2
- package/examples/jsm/loaders/VTKLoader.js +1 -0
- package/examples/jsm/loaders/XYZLoader.js +1 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +74 -74
- package/examples/jsm/loaders/usd/USDAParser.js +741 -0
- package/examples/jsm/loaders/usd/USDCParser.js +17 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +1 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -0
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +1 -0
- package/examples/jsm/math/Capsule.js +2 -0
- package/examples/jsm/math/ColorConverter.js +1 -0
- package/examples/jsm/math/ConvexHull.js +2 -0
- package/examples/jsm/math/ImprovedNoise.js +19 -14
- package/examples/jsm/math/Lut.js +2 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +2 -0
- package/examples/jsm/math/OBB.js +2 -0
- package/examples/jsm/math/Octree.js +20 -1
- package/examples/jsm/math/SimplexNoise.js +2 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +3 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +2 -0
- package/examples/jsm/misc/Gyroscope.js +1 -0
- package/examples/jsm/misc/MD2Character.js +2 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +5 -3
- package/examples/jsm/misc/MorphAnimMesh.js +1 -0
- package/examples/jsm/misc/MorphBlendMesh.js +1 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +2 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +2 -0
- package/examples/jsm/misc/RollerCoaster.js +5 -0
- package/examples/jsm/misc/TubePainter.js +1 -0
- package/examples/jsm/misc/Volume.js +2 -0
- package/examples/jsm/misc/VolumeSlice.js +1 -0
- package/examples/jsm/modifiers/CurveModifier.js +3 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +2 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +2 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -0
- package/examples/jsm/modifiers/TessellateModifier.js +2 -0
- package/examples/jsm/objects/GroundedSkybox.js +1 -0
- package/examples/jsm/objects/Lensflare.js +3 -0
- package/examples/jsm/objects/LensflareMesh.js +4 -3
- package/examples/jsm/objects/MarchingCubes.js +2 -0
- package/examples/jsm/objects/Reflector.js +1 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Refractor.js +1 -0
- package/examples/jsm/objects/ShadowMesh.js +1 -0
- package/examples/jsm/objects/Sky.js +2 -1
- package/examples/jsm/objects/SkyMesh.js +22 -19
- package/examples/jsm/objects/Water.js +1 -0
- package/examples/jsm/objects/Water2.js +1 -0
- package/examples/jsm/objects/Water2Mesh.js +3 -1
- package/examples/jsm/objects/WaterMesh.js +2 -1
- package/examples/jsm/physics/AmmoPhysics.js +1 -0
- package/examples/jsm/physics/JoltPhysics.js +1 -0
- package/examples/jsm/physics/RapierPhysics.js +149 -13
- package/examples/jsm/postprocessing/AfterimagePass.js +20 -2
- package/examples/jsm/postprocessing/BloomPass.js +2 -1
- package/examples/jsm/postprocessing/BokehPass.js +2 -1
- package/examples/jsm/postprocessing/ClearPass.js +1 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +1 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +1 -0
- package/examples/jsm/postprocessing/EffectComposer.js +4 -2
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +1 -0
- package/examples/jsm/postprocessing/GTAOPass.js +14 -12
- package/examples/jsm/postprocessing/GlitchPass.js +2 -1
- package/examples/jsm/postprocessing/HalftonePass.js +2 -1
- package/examples/jsm/postprocessing/LUTPass.js +1 -0
- package/examples/jsm/postprocessing/MaskPass.js +1 -0
- package/examples/jsm/postprocessing/OutlinePass.js +22 -19
- package/examples/jsm/postprocessing/OutputPass.js +1 -0
- package/examples/jsm/postprocessing/Pass.js +3 -1
- package/examples/jsm/postprocessing/RenderPass.js +1 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +2 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +4 -3
- package/examples/jsm/postprocessing/SAOPass.js +3 -2
- package/examples/jsm/postprocessing/SMAAPass.js +3 -2
- package/examples/jsm/postprocessing/SSAARenderPass.js +2 -1
- package/examples/jsm/postprocessing/SSAOPass.js +12 -10
- package/examples/jsm/postprocessing/SSRPass.js +4 -3
- package/examples/jsm/postprocessing/SavePass.js +2 -1
- package/examples/jsm/postprocessing/ShaderPass.js +1 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -0
- package/examples/jsm/postprocessing/TexturePass.js +1 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +2 -1
- package/examples/jsm/renderers/CSS2DRenderer.js +3 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +4 -0
- package/examples/jsm/renderers/Projector.js +2 -0
- package/examples/jsm/renderers/SVGRenderer.js +3 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +4 -1
- package/examples/jsm/shaders/AfterimageShader.js +4 -1
- package/examples/jsm/shaders/BasicShader.js +4 -1
- package/examples/jsm/shaders/BleachBypassShader.js +4 -1
- package/examples/jsm/shaders/BlendShader.js +4 -1
- package/examples/jsm/shaders/BokehShader.js +4 -1
- package/examples/jsm/shaders/BokehShader2.js +4 -1
- package/examples/jsm/shaders/BrightnessContrastShader.js +4 -1
- package/examples/jsm/shaders/ColorCorrectionShader.js +4 -1
- package/examples/jsm/shaders/ColorifyShader.js +4 -1
- package/examples/jsm/shaders/ConvolutionShader.js +4 -1
- package/examples/jsm/shaders/CopyShader.js +4 -1
- package/examples/jsm/shaders/DOFMipMapShader.js +4 -1
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +4 -1
- package/examples/jsm/shaders/DigitalGlitch.js +4 -1
- package/examples/jsm/shaders/DotScreenShader.js +4 -1
- package/examples/jsm/shaders/ExposureShader.js +4 -1
- package/examples/jsm/shaders/FXAAShader.js +4 -1
- package/examples/jsm/shaders/FilmShader.js +4 -1
- package/examples/jsm/shaders/FocusShader.js +4 -1
- package/examples/jsm/shaders/FreiChenShader.js +4 -1
- package/examples/jsm/shaders/GTAOShader.js +4 -1
- package/examples/jsm/shaders/GammaCorrectionShader.js +4 -1
- package/examples/jsm/shaders/GodRaysShader.js +4 -1
- package/examples/jsm/shaders/HalftoneShader.js +4 -1
- package/examples/jsm/shaders/HorizontalBlurShader.js +4 -1
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +4 -1
- package/examples/jsm/shaders/HueSaturationShader.js +4 -1
- package/examples/jsm/shaders/KaleidoShader.js +4 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +4 -1
- package/examples/jsm/shaders/LuminosityShader.js +4 -1
- package/examples/jsm/shaders/MirrorShader.js +4 -1
- package/examples/jsm/shaders/NormalMapShader.js +4 -1
- package/examples/jsm/shaders/OutputShader.js +4 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +4 -1
- package/examples/jsm/shaders/RGBShiftShader.js +4 -1
- package/examples/jsm/shaders/SAOShader.js +4 -1
- package/examples/jsm/shaders/SMAAShader.js +1 -0
- package/examples/jsm/shaders/SSAOShader.js +4 -1
- package/examples/jsm/shaders/SSRShader.js +1 -0
- package/examples/jsm/shaders/SepiaShader.js +4 -1
- package/examples/jsm/shaders/SobelOperatorShader.js +4 -1
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +4 -1
- package/examples/jsm/shaders/TechnicolorShader.js +4 -1
- package/examples/jsm/shaders/ToonShader.js +2 -1
- package/examples/jsm/shaders/TriangleBlurShader.js +4 -1
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +15 -3
- package/examples/jsm/shaders/VelocityShader.js +4 -1
- package/examples/jsm/shaders/VerticalBlurShader.js +4 -1
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +4 -1
- package/examples/jsm/shaders/VignetteShader.js +4 -1
- package/examples/jsm/shaders/VolumeShader.js +5 -2
- package/examples/jsm/shaders/WaterRefractionShader.js +4 -1
- package/examples/jsm/textures/FlakesTexture.js +2 -0
- package/examples/jsm/transpiler/AST.js +381 -30
- package/examples/jsm/transpiler/GLSLDecoder.js +227 -88
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/TSLEncoder.js +234 -85
- package/examples/jsm/transpiler/Transpiler.js +19 -1
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +788 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +2 -3
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +1 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +5 -4
- package/examples/jsm/tsl/display/BloomNode.js +9 -7
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +206 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +33 -33
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +1 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +1 -0
- package/examples/jsm/tsl/display/FXAANode.js +3 -2
- package/examples/jsm/tsl/display/FilmNode.js +1 -0
- package/examples/jsm/tsl/display/GTAONode.js +1 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +9 -36
- package/examples/jsm/tsl/display/LensflareNode.js +1 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +1 -0
- package/examples/jsm/tsl/display/OutlineNode.js +1 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +1 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +1 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +1 -0
- package/examples/jsm/tsl/display/SMAANode.js +9 -8
- package/examples/jsm/tsl/display/SSAAPassNode.js +5 -4
- package/examples/jsm/tsl/display/SSRNode.js +1 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +1 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +1 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +1 -0
- package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +184 -174
- package/examples/jsm/tsl/display/TransitionNode.js +1 -0
- package/examples/jsm/tsl/display/hashBlur.js +28 -6
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +5 -4
- package/examples/jsm/tsl/math/Bayer.js +4 -1
- package/examples/jsm/tsl/shadows/TileShadowNode.js +456 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/Raymarching.js +6 -3
- package/examples/jsm/utils/BufferGeometryUtils.js +4 -1
- package/examples/jsm/utils/CameraUtils.js +4 -1
- package/examples/jsm/utils/GeometryCompressionUtils.js +4 -1
- package/examples/jsm/utils/GeometryUtils.js +4 -1
- package/examples/jsm/utils/LDrawUtils.js +2 -0
- package/examples/jsm/utils/SceneOptimizer.js +2 -0
- package/examples/jsm/utils/SceneUtils.js +4 -1
- package/examples/jsm/utils/ShadowMapViewer.js +2 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +2 -0
- package/examples/jsm/utils/SkeletonUtils.js +4 -1
- package/examples/jsm/utils/SortUtils.js +4 -1
- package/examples/jsm/utils/UVsDebug.js +4 -1
- package/examples/jsm/utils/WebGLTextureUtils.js +4 -1
- package/examples/jsm/utils/WebGPUTextureUtils.js +4 -1
- package/examples/jsm/utils/WorkerPool.js +2 -0
- package/examples/jsm/webxr/ARButton.js +1 -0
- package/examples/jsm/webxr/OculusHandModel.js +1 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +1 -0
- package/examples/jsm/webxr/Text2D.js +4 -1
- package/examples/jsm/webxr/VRButton.js +1 -0
- package/examples/jsm/webxr/XRButton.js +1 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +2 -0
- package/examples/jsm/webxr/XREstimatedLight.js +1 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +2 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +2 -0
- package/examples/jsm/webxr/XRPlanes.js +1 -0
- package/package.json +6 -4
- package/src/Three.Core.js +2 -1
- package/src/Three.TSL.js +83 -26
- package/src/Three.WebGPU.Nodes.js +1 -0
- package/src/Three.WebGPU.js +3 -0
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/audio/AudioListener.js +13 -10
- package/src/cameras/ArrayCamera.js +9 -1
- package/src/cameras/Camera.js +14 -0
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/constants.js +47 -20
- package/src/core/BufferAttribute.js +3 -3
- package/src/core/BufferGeometry.js +2 -5
- package/src/core/Clock.js +2 -8
- package/src/core/GLBufferAttribute.js +13 -1
- package/src/core/Object3D.js +23 -22
- package/src/core/RenderTarget.js +65 -21
- package/src/core/RenderTarget3D.js +1 -0
- package/{examples/jsm/misc → src/core}/Timer.js +4 -40
- package/src/extras/PMREMGenerator.js +11 -0
- package/src/extras/TextureUtils.js +1 -5
- package/src/extras/core/Curve.js +1 -1
- package/src/extras/core/Path.js +22 -22
- package/src/geometries/CapsuleGeometry.js +167 -17
- package/src/geometries/ExtrudeGeometry.js +39 -29
- package/src/helpers/ArrowHelper.js +2 -2
- package/src/helpers/CameraHelper.js +41 -11
- package/src/helpers/SkeletonHelper.js +36 -7
- package/src/lights/LightShadow.js +34 -7
- package/src/lights/PointLightShadow.js +1 -1
- package/src/lights/SpotLightShadow.js +9 -1
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/BufferGeometryLoader.js +1 -10
- package/src/loaders/FileLoader.js +27 -4
- package/src/loaders/ImageBitmapLoader.js +48 -9
- package/src/loaders/ImageLoader.js +55 -8
- package/src/loaders/Loader.js +14 -0
- package/src/loaders/LoadingManager.js +23 -0
- package/src/loaders/ObjectLoader.js +44 -16
- package/src/loaders/nodes/NodeObjectLoader.js +2 -2
- package/src/materials/Material.js +1 -7
- package/src/materials/MeshBasicMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +0 -8
- 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 +2 -2
- package/src/materials/nodes/NodeMaterial.js +106 -20
- package/src/materials/nodes/PointsNodeMaterial.js +5 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +107 -4
- package/src/math/Box3.js +28 -0
- package/src/math/Color.js +7 -7
- package/src/math/ColorManagement.js +22 -3
- package/src/math/Frustum.js +25 -9
- package/src/math/FrustumArray.js +258 -0
- package/src/math/Line3.js +129 -2
- package/src/math/Matrix4.js +48 -27
- package/src/math/Quaternion.js +1 -1
- package/src/math/Ray.js +2 -0
- package/src/math/Sphere.js +28 -0
- package/src/math/Spherical.js +2 -2
- package/src/nodes/Nodes.js +3 -3
- package/src/nodes/TSL.js +6 -3
- package/src/nodes/accessors/AccessorsUtils.js +7 -8
- package/src/nodes/accessors/Bitangent.js +54 -26
- package/src/nodes/accessors/Camera.js +40 -13
- package/src/nodes/accessors/CubeTextureNode.js +50 -2
- package/src/nodes/accessors/InstanceNode.js +5 -4
- package/src/nodes/accessors/Lights.js +2 -2
- package/src/nodes/accessors/MaterialNode.js +4 -0
- package/src/nodes/accessors/ModelNode.js +1 -1
- package/src/nodes/accessors/Normal.js +110 -24
- package/src/nodes/accessors/Object3DNode.js +7 -8
- package/src/nodes/accessors/Position.js +14 -4
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +19 -4
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SceneNode.js +1 -1
- package/src/nodes/accessors/SkinningNode.js +3 -2
- package/src/nodes/accessors/StorageBufferNode.js +25 -0
- package/src/nodes/accessors/StorageTextureNode.js +15 -4
- package/src/nodes/accessors/Tangent.js +25 -17
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/TextureBicubic.js +21 -3
- package/src/nodes/accessors/TextureNode.js +71 -8
- package/src/nodes/accessors/UniformArrayNode.js +0 -16
- package/src/nodes/accessors/VelocityNode.js +1 -0
- package/src/nodes/accessors/VertexColorNode.js +4 -4
- package/src/nodes/code/CodeNode.js +8 -11
- package/src/nodes/core/ArrayNode.js +12 -0
- package/src/nodes/core/AssignNode.js +30 -5
- package/src/nodes/core/AttributeNode.js +2 -2
- package/src/nodes/core/ContextNode.js +27 -4
- package/src/nodes/core/Node.js +83 -22
- package/src/nodes/core/NodeBuilder.js +273 -49
- package/src/nodes/core/NodeUtils.js +46 -1
- package/src/nodes/core/NodeVarying.js +19 -1
- package/src/nodes/core/PropertyNode.js +8 -12
- package/src/nodes/core/StackNode.js +171 -26
- package/src/nodes/core/StructTypeNode.js +26 -4
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/UniformNode.js +63 -5
- package/src/nodes/core/VarNode.js +102 -4
- package/src/nodes/core/VaryingNode.js +45 -24
- package/src/nodes/display/BlendModes.js +42 -1
- package/src/nodes/display/ColorSpaceNode.js +4 -27
- package/src/nodes/display/FrontFacingNode.js +34 -2
- package/src/nodes/display/NormalMapNode.js +19 -50
- package/src/nodes/display/PassNode.js +165 -20
- package/src/nodes/display/ScreenNode.js +0 -26
- package/src/nodes/display/ViewportTextureNode.js +67 -7
- package/src/nodes/functions/BSDF/BRDF_GGX.js +2 -6
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +4 -4
- package/src/nodes/functions/PhongLightingModel.js +3 -3
- package/src/nodes/functions/PhysicalLightingModel.js +16 -16
- package/src/nodes/functions/ShadowMaskModel.js +5 -1
- package/src/nodes/functions/material/getGeometryRoughness.js +2 -2
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +1 -1
- package/src/nodes/gpgpu/AtomicFunctionNode.js +28 -10
- package/src/nodes/gpgpu/BarrierNode.js +3 -3
- package/src/nodes/gpgpu/ComputeNode.js +68 -24
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
- package/src/nodes/lighting/AnalyticLightNode.js +7 -13
- package/src/nodes/lighting/EnvironmentNode.js +5 -5
- package/src/nodes/lighting/HemisphereLightNode.js +2 -2
- package/src/nodes/lighting/IESSpotLightNode.js +2 -1
- package/src/nodes/lighting/LightsNode.js +29 -11
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/ShadowBaseNode.js +1 -12
- package/src/nodes/lighting/ShadowFilterNode.js +274 -0
- package/src/nodes/lighting/ShadowNode.js +174 -242
- package/src/nodes/lighting/SpotLightNode.js +44 -7
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +166 -2
- package/src/nodes/math/ConditionalNode.js +1 -20
- package/src/nodes/math/MathNode.js +146 -75
- package/src/nodes/math/OperatorNode.js +129 -119
- package/src/nodes/shapes/Shapes.js +5 -4
- package/src/nodes/tsl/TSLBase.js +1 -0
- package/src/nodes/tsl/TSLCore.js +222 -72
- package/src/nodes/utils/DebugNode.js +16 -4
- package/src/nodes/utils/Discard.js +2 -2
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +83 -0
- package/src/nodes/utils/LoopNode.js +64 -34
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/RTTNode.js +22 -5
- package/src/nodes/utils/ReflectorNode.js +77 -7
- package/src/nodes/utils/SampleNode.js +81 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/objects/BatchedMesh.js +20 -6
- package/src/objects/Mesh.js +9 -0
- package/src/objects/Skeleton.js +1 -1
- package/src/objects/Sprite.js +9 -0
- package/src/renderers/WebGL3DRenderTarget.js +1 -0
- package/src/renderers/WebGLArrayRenderTarget.js +1 -0
- package/src/renderers/WebGLCubeRenderTarget.js +2 -4
- package/src/renderers/WebGLRenderer.js +45 -32
- package/src/renderers/common/Animation.js +2 -2
- package/src/renderers/common/Background.js +13 -2
- package/src/renderers/common/Bindings.js +19 -18
- package/src/renderers/common/Color4.js +2 -2
- package/src/renderers/common/CubeRenderTarget.js +1 -1
- package/src/renderers/common/PostProcessing.js +60 -5
- package/src/renderers/common/RenderList.js +0 -4
- package/src/renderers/common/RenderObject.js +80 -4
- package/src/renderers/common/Renderer.js +133 -22
- package/src/renderers/common/SampledTexture.js +3 -71
- package/src/renderers/common/Sampler.js +79 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageTexture.js +19 -0
- package/src/renderers/common/Textures.js +34 -24
- package/src/renderers/common/TimestampQueryPool.js +1 -0
- package/src/renderers/common/Uniform.js +1 -1
- package/src/renderers/common/UniformsGroup.js +14 -18
- package/src/renderers/common/XRManager.js +183 -35
- package/src/renderers/common/XRRenderTarget.js +21 -4
- package/src/renderers/common/extras/PMREMGenerator.js +30 -23
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
- package/src/renderers/common/nodes/Nodes.js +13 -3
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +20 -2
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
- package/src/renderers/webgl/WebGLAttributes.js +4 -0
- package/src/renderers/webgl/WebGLCapabilities.js +2 -2
- package/src/renderers/webgl/WebGLMaterials.js +6 -6
- package/src/renderers/webgl/WebGLProgram.js +22 -16
- package/src/renderers/webgl/WebGLPrograms.js +8 -6
- package/src/renderers/webgl/WebGLShadowMap.js +14 -3
- package/src/renderers/webgl/WebGLState.js +4 -4
- package/src/renderers/webgl/WebGLTextures.js +163 -11
- package/src/renderers/webgl/WebGLUtils.js +1 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +261 -94
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +75 -9
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +4 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +1 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +4 -4
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +44 -29
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +22 -21
- package/src/renderers/webgpu/WebGPUBackend.js +505 -143
- package/src/renderers/webgpu/WebGPURenderer.js +7 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +4 -1
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +4 -1
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +129 -96
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +3 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +9 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +58 -31
- package/src/renderers/webgpu/utils/WebGPUConstants.js +8 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +39 -9
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +50 -108
- package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
- package/src/renderers/webxr/WebXRController.js +1 -1
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
- package/src/renderers/webxr/WebXRManager.js +70 -9
- package/src/textures/DepthTexture.js +6 -10
- package/src/textures/ExternalTexture.js +45 -0
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +32 -0
- package/src/textures/Texture.js +118 -1
- package/src/textures/VideoTexture.js +31 -3
- package/examples/jsm/effects/PeppersGhostEffect.js +0 -172
- package/src/core/RenderTargetArray.js +0 -40
- package/src/nodes/utils/EquirectUVNode.js +0 -65
- package/src/nodes/utils/MatcapUVNode.js +0 -49
- package/src/nodes/utils/TriplanarTexturesNode.js +0 -148
|
@@ -75,7 +75,17 @@ export default /* glsl */`
|
|
|
75
75
|
|
|
76
76
|
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
|
|
79
|
+
|
|
80
|
+
#ifdef USE_REVERSEDEPTHBUF
|
|
81
|
+
|
|
82
|
+
return step( depth, compare );
|
|
83
|
+
|
|
84
|
+
#else
|
|
85
|
+
|
|
86
|
+
return step( compare, depth );
|
|
87
|
+
|
|
88
|
+
#endif
|
|
79
89
|
|
|
80
90
|
}
|
|
81
91
|
|
|
@@ -91,7 +101,15 @@ export default /* glsl */`
|
|
|
91
101
|
|
|
92
102
|
vec2 distribution = texture2DDistribution( shadow, uv );
|
|
93
103
|
|
|
94
|
-
|
|
104
|
+
#ifdef USE_REVERSEDEPTHBUF
|
|
105
|
+
|
|
106
|
+
float hard_shadow = step( distribution.x, compare ); // Hard Shadow
|
|
107
|
+
|
|
108
|
+
#else
|
|
109
|
+
|
|
110
|
+
float hard_shadow = step( compare , distribution.x ); // Hard Shadow
|
|
111
|
+
|
|
112
|
+
#endif
|
|
95
113
|
|
|
96
114
|
if (hard_shadow != 1.0 ) {
|
|
97
115
|
|
|
@@ -23,7 +23,7 @@ void main() {
|
|
|
23
23
|
|
|
24
24
|
#ifdef DECODE_VIDEO_TEXTURE
|
|
25
25
|
|
|
26
|
-
// use inline sRGB decode until browsers properly support
|
|
26
|
+
// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures
|
|
27
27
|
|
|
28
28
|
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
|
|
29
29
|
|
|
@@ -81,8 +81,17 @@ void main() {
|
|
|
81
81
|
|
|
82
82
|
#include <logdepthbuf_fragment>
|
|
83
83
|
|
|
84
|
-
// Higher precision equivalent of gl_FragCoord.z
|
|
85
|
-
|
|
84
|
+
// Higher precision equivalent of gl_FragCoord.z
|
|
85
|
+
|
|
86
|
+
#ifdef USE_REVERSEDEPTHBUF
|
|
87
|
+
|
|
88
|
+
float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
|
|
89
|
+
|
|
90
|
+
#else
|
|
91
|
+
|
|
92
|
+
float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
|
|
93
|
+
|
|
94
|
+
#endif
|
|
86
95
|
|
|
87
96
|
#if DEPTH_PACKING == 3200
|
|
88
97
|
|
|
@@ -21,6 +21,10 @@ function WebGLAttributes( gl ) {
|
|
|
21
21
|
|
|
22
22
|
type = gl.FLOAT;
|
|
23
23
|
|
|
24
|
+
} else if ( typeof Float16Array !== 'undefined' && array instanceof Float16Array ) {
|
|
25
|
+
|
|
26
|
+
type = gl.HALF_FLOAT;
|
|
27
|
+
|
|
24
28
|
} else if ( array instanceof Uint16Array ) {
|
|
25
29
|
|
|
26
30
|
if ( attribute.isFloat16BufferAttribute ) {
|
|
@@ -92,7 +92,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
95
|
-
const
|
|
95
|
+
const reversedDepthBuffer = parameters.reversedDepthBuffer === true && extensions.has( 'EXT_clip_control' );
|
|
96
96
|
|
|
97
97
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
98
98
|
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
@@ -120,7 +120,7 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
120
120
|
|
|
121
121
|
precision: precision,
|
|
122
122
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
123
|
-
|
|
123
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
124
124
|
|
|
125
125
|
maxTextures: maxTextures,
|
|
126
126
|
maxVertexTextures: maxVertexTextures,
|
|
@@ -141,17 +141,17 @@ function WebGLMaterials( renderer, properties ) {
|
|
|
141
141
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
if ( material.texture3DMatrix ) {
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
uniforms.texture3DMatrix.value.copy( material.texture3DMatrix );
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
}
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
if ( material.triplanarHardness ) {
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
uniforms.triplanarHardness.value = material.triplanarHardness;
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
}
|
|
155
155
|
|
|
156
156
|
if ( material.alphaMap ) {
|
|
157
157
|
|
|
@@ -57,7 +57,9 @@ function getEncodingComponents( colorSpace ) {
|
|
|
57
57
|
function getShaderErrors( gl, shader, type ) {
|
|
58
58
|
|
|
59
59
|
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
|
|
60
|
-
|
|
60
|
+
|
|
61
|
+
const shaderInfoLog = gl.getShaderInfoLog( shader ) || '';
|
|
62
|
+
const errors = shaderInfoLog.trim();
|
|
61
63
|
|
|
62
64
|
if ( status && errors === '' ) return '';
|
|
63
65
|
|
|
@@ -561,8 +563,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
561
563
|
parameters.bumpMap ? '#define USE_BUMPMAP' : '',
|
|
562
564
|
parameters.normalMap ? '#define USE_NORMALMAP' : '',
|
|
563
565
|
parameters.normalMapMode === TriPlanarMapping ? '#define USE_NORMALMAP_TRIPLANAR' : parameters.normalMapMode === CylindricalMapping ? '#define USE_NORMALMAP_CYLINDRICAL' : parameters.normalMapMode === UVMapping ? '#define USE_NORMALMAP_UV' : '',
|
|
564
|
-
parameters.normalMapObjectSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
565
|
-
parameters.normalMapTangentSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
566
|
+
parameters.normalMapObjectSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
567
|
+
parameters.normalMapTangentSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
566
568
|
parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',
|
|
567
569
|
parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
|
|
568
570
|
|
|
@@ -572,9 +574,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
572
574
|
parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
|
|
573
575
|
parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
|
|
574
576
|
parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
|
|
575
|
-
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
576
|
-
|
|
577
|
-
|
|
577
|
+
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
578
|
+
: parameters.clearcoatNormalMapMode === CylindricalMapping ? '#define USE_CLEARCOAT_NORMALMAP_CYLINDRICAL'
|
|
579
|
+
: parameters.clearcoatNormalMapMode === UVMapping ? '#define USE_CLEARCOAT_NORMALMAP_UV' : '',
|
|
578
580
|
|
|
579
581
|
parameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',
|
|
580
582
|
parameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',
|
|
@@ -662,7 +664,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
662
664
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
663
665
|
|
|
664
666
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
665
|
-
parameters.
|
|
667
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
666
668
|
|
|
667
669
|
'uniform mat4 modelMatrix;',
|
|
668
670
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -768,8 +770,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
768
770
|
parameters.bumpMap ? '#define USE_BUMPMAP' : '',
|
|
769
771
|
parameters.normalMap ? '#define USE_NORMALMAP' : '',
|
|
770
772
|
parameters.normalMapMode === TriPlanarMapping ? '#define USE_NORMALMAP_TRIPLANAR' : parameters.normalMapMode === CylindricalMapping ? '#define USE_NORMALMAP_CYLINDRICAL' : parameters.normalMapMode === UVMapping ? '#define USE_NORMALMAP_UV' : '',
|
|
771
|
-
parameters.normalMapObjectSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
772
|
-
parameters.normalMapTangentSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
773
|
+
parameters.normalMapObjectSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
774
|
+
parameters.normalMapTangentSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
773
775
|
parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
|
|
774
776
|
|
|
775
777
|
parameters.anisotropy ? '#define USE_ANISOTROPY' : '',
|
|
@@ -779,9 +781,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
779
781
|
parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
|
|
780
782
|
parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
|
|
781
783
|
parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
|
|
782
|
-
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
783
|
-
|
|
784
|
-
|
|
784
|
+
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
785
|
+
: parameters.clearcoatNormalMapMode === CylindricalMapping ? '#define USE_CLEARCOAT_NORMALMAP_CYLINDRICAL'
|
|
786
|
+
: parameters.clearcoatNormalMapMode === UVMapping ? '#define USE_CLEARCOAT_NORMALMAP_UV' : '',
|
|
785
787
|
|
|
786
788
|
parameters.dispersion ? '#define USE_DISPERSION' : '',
|
|
787
789
|
|
|
@@ -838,7 +840,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
838
840
|
parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
|
|
839
841
|
|
|
840
842
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
841
|
-
parameters.
|
|
843
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
842
844
|
|
|
843
845
|
'uniform mat4 modelViewMatrix;',
|
|
844
846
|
'uniform mat4 viewMatrix;',
|
|
@@ -939,9 +941,13 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
939
941
|
// check for link errors
|
|
940
942
|
if ( renderer.debug.checkShaderErrors ) {
|
|
941
943
|
|
|
942
|
-
const
|
|
943
|
-
const
|
|
944
|
-
const
|
|
944
|
+
const programInfoLog = gl.getProgramInfoLog( program ) || '';
|
|
945
|
+
const vertexShaderInfoLog = gl.getShaderInfoLog( glVertexShader ) || '';
|
|
946
|
+
const fragmentShaderInfoLog = gl.getShaderInfoLog( glFragmentShader ) || '';
|
|
947
|
+
|
|
948
|
+
const programLog = programInfoLog.trim();
|
|
949
|
+
const vertexLog = vertexShaderInfoLog.trim();
|
|
950
|
+
const fragmentLog = fragmentShaderInfoLog.trim();
|
|
945
951
|
|
|
946
952
|
let runnable = true;
|
|
947
953
|
let haveDiagnostics = true;
|
|
@@ -108,7 +108,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
111
|
-
const
|
|
111
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
112
112
|
|
|
113
113
|
const IS_INSTANCEDMESH = object.isInstancedMesh === true;
|
|
114
114
|
const IS_BATCHEDMESH = object.isBatchedMesh === true;
|
|
@@ -310,11 +310,11 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
310
310
|
useFog: material.fog === true,
|
|
311
311
|
fogExp2: ( !! fog && fog.isFogExp2 ),
|
|
312
312
|
|
|
313
|
-
flatShading: material.flatShading === true,
|
|
313
|
+
flatShading: ( material.flatShading === true && material.wireframe === false ),
|
|
314
314
|
|
|
315
315
|
sizeAttenuation: material.sizeAttenuation === true,
|
|
316
316
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
317
|
-
|
|
317
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
318
318
|
|
|
319
319
|
skinning: object.isSkinnedMesh === true,
|
|
320
320
|
|
|
@@ -447,7 +447,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
447
447
|
array.push( parameters.anisotropyMapUv );
|
|
448
448
|
array.push( parameters.clearcoatMapUv );
|
|
449
449
|
array.push( parameters.clearcoatNormalMapUv );
|
|
450
|
-
array.push( parameters.clearcoatNormalMapMode);
|
|
450
|
+
array.push( parameters.clearcoatNormalMapMode );
|
|
451
451
|
array.push( parameters.clearcoatRoughnessMapUv );
|
|
452
452
|
array.push( parameters.iridescenceMapUv );
|
|
453
453
|
array.push( parameters.iridescenceThicknessMapUv );
|
|
@@ -530,8 +530,10 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
530
530
|
_programLayers.enable( 20 );
|
|
531
531
|
if ( parameters.batchingColor )
|
|
532
532
|
_programLayers.enable( 21 );
|
|
533
|
-
if ( parameters.
|
|
533
|
+
if ( parameters.gradientMap )
|
|
534
534
|
_programLayers.enable( 22 );
|
|
535
|
+
if ( parameters.batchingMatrix )
|
|
536
|
+
_programLayers.enable( 23 );
|
|
535
537
|
|
|
536
538
|
array.push( _programLayers.mask );
|
|
537
539
|
_programLayers.disableAll();
|
|
@@ -544,7 +546,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
544
546
|
_programLayers.enable( 2 );
|
|
545
547
|
if ( parameters.logarithmicDepthBuffer )
|
|
546
548
|
_programLayers.enable( 3 );
|
|
547
|
-
if ( parameters.
|
|
549
|
+
if ( parameters.reversedDepthBuffer )
|
|
548
550
|
_programLayers.enable( 4 );
|
|
549
551
|
if ( parameters.skinning )
|
|
550
552
|
_programLayers.enable( 5 );
|
|
@@ -84,7 +84,17 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
84
84
|
|
|
85
85
|
// Set GL state for depth map.
|
|
86
86
|
_state.setBlending( NoBlending );
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
if ( _state.buffers.depth.getReversed() ) {
|
|
89
|
+
|
|
90
|
+
_state.buffers.color.setClear( 0, 0, 0, 0 );
|
|
91
|
+
|
|
92
|
+
} else {
|
|
93
|
+
|
|
94
|
+
_state.buffers.color.setClear( 1, 1, 1, 1 );
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
88
98
|
_state.buffers.depth.setTest( true );
|
|
89
99
|
_state.setScissorTest( false );
|
|
90
100
|
|
|
@@ -257,7 +267,8 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
257
267
|
if ( ( renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
|
|
258
268
|
( material.displacementMap && material.displacementScale !== 0 ) ||
|
|
259
269
|
( material.alphaMap && material.alphaTest > 0 ) ||
|
|
260
|
-
( material.map && material.alphaTest > 0 )
|
|
270
|
+
( material.map && material.alphaTest > 0 ) ||
|
|
271
|
+
( material.alphaToCoverage === true ) ) {
|
|
261
272
|
|
|
262
273
|
// in this case we need a unique material instance reflecting the
|
|
263
274
|
// appropriate state
|
|
@@ -303,7 +314,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
303
314
|
}
|
|
304
315
|
|
|
305
316
|
result.alphaMap = material.alphaMap;
|
|
306
|
-
result.alphaTest = material.alphaTest;
|
|
317
|
+
result.alphaTest = ( material.alphaToCoverage === true ) ? 0.5 : material.alphaTest; // approximate alphaToCoverage by using a fixed alphaTest value
|
|
307
318
|
result.map = material.map;
|
|
308
319
|
|
|
309
320
|
result.clipShadows = material.clipShadows;
|
|
@@ -667,7 +667,7 @@ function WebGLState( gl, extensions ) {
|
|
|
667
667
|
break;
|
|
668
668
|
|
|
669
669
|
case MultiplyBlending:
|
|
670
|
-
gl.blendFuncSeparate( gl.
|
|
670
|
+
gl.blendFuncSeparate( gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ZERO, gl.ONE );
|
|
671
671
|
break;
|
|
672
672
|
|
|
673
673
|
default:
|
|
@@ -685,15 +685,15 @@ function WebGLState( gl, extensions ) {
|
|
|
685
685
|
break;
|
|
686
686
|
|
|
687
687
|
case AdditiveBlending:
|
|
688
|
-
gl.
|
|
688
|
+
gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE );
|
|
689
689
|
break;
|
|
690
690
|
|
|
691
691
|
case SubtractiveBlending:
|
|
692
|
-
|
|
692
|
+
console.error( 'THREE.WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true' );
|
|
693
693
|
break;
|
|
694
694
|
|
|
695
695
|
case MultiplyBlending:
|
|
696
|
-
|
|
696
|
+
console.error( 'THREE.WebGLState: MultiplyBlending requires material.premultipliedAlpha = true' );
|
|
697
697
|
break;
|
|
698
698
|
|
|
699
699
|
default:
|
|
@@ -515,7 +515,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
515
515
|
|
|
516
516
|
if ( texture.isVideoTexture ) updateVideoTexture( texture );
|
|
517
517
|
|
|
518
|
-
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
518
|
+
if ( texture.isRenderTargetTexture === false && texture.isExternalTexture !== true && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
519
519
|
|
|
520
520
|
const image = texture.image;
|
|
521
521
|
|
|
@@ -534,6 +534,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
534
534
|
|
|
535
535
|
}
|
|
536
536
|
|
|
537
|
+
} else if ( texture.isExternalTexture ) {
|
|
538
|
+
|
|
539
|
+
textureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;
|
|
540
|
+
|
|
537
541
|
}
|
|
538
542
|
|
|
539
543
|
state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
@@ -544,7 +548,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
544
548
|
|
|
545
549
|
const textureProperties = properties.get( texture );
|
|
546
550
|
|
|
547
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
551
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
548
552
|
|
|
549
553
|
uploadTexture( textureProperties, texture, slot );
|
|
550
554
|
return;
|
|
@@ -559,7 +563,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
559
563
|
|
|
560
564
|
const textureProperties = properties.get( texture );
|
|
561
565
|
|
|
562
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
566
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
563
567
|
|
|
564
568
|
uploadTexture( textureProperties, texture, slot );
|
|
565
569
|
return;
|
|
@@ -739,6 +743,115 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
739
743
|
|
|
740
744
|
}
|
|
741
745
|
|
|
746
|
+
function getRow( index, rowLength, componentStride ) {
|
|
747
|
+
|
|
748
|
+
return Math.floor( Math.floor( index / componentStride ) / rowLength );
|
|
749
|
+
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
function updateTexture( texture, image, glFormat, glType ) {
|
|
753
|
+
|
|
754
|
+
const componentStride = 4; // only RGBA supported
|
|
755
|
+
|
|
756
|
+
const updateRanges = texture.updateRanges;
|
|
757
|
+
|
|
758
|
+
if ( updateRanges.length === 0 ) {
|
|
759
|
+
|
|
760
|
+
state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
|
|
761
|
+
|
|
762
|
+
} else {
|
|
763
|
+
|
|
764
|
+
// Before applying update ranges, we merge any adjacent / overlapping
|
|
765
|
+
// ranges to reduce load on `gl.texSubImage2D`. Empirically, this has led
|
|
766
|
+
// to performance improvements for applications which make heavy use of
|
|
767
|
+
// update ranges. Likely due to GPU command overhead.
|
|
768
|
+
//
|
|
769
|
+
// Note that to reduce garbage collection between frames, we merge the
|
|
770
|
+
// update ranges in-place. This is safe because this method will clear the
|
|
771
|
+
// update ranges once updated.
|
|
772
|
+
|
|
773
|
+
updateRanges.sort( ( a, b ) => a.start - b.start );
|
|
774
|
+
|
|
775
|
+
// To merge the update ranges in-place, we work from left to right in the
|
|
776
|
+
// existing updateRanges array, merging ranges. This may result in a final
|
|
777
|
+
// array which is smaller than the original. This index tracks the last
|
|
778
|
+
// index representing a merged range, any data after this index can be
|
|
779
|
+
// trimmed once the merge algorithm is completed.
|
|
780
|
+
let mergeIndex = 0;
|
|
781
|
+
|
|
782
|
+
for ( let i = 1; i < updateRanges.length; i ++ ) {
|
|
783
|
+
|
|
784
|
+
const previousRange = updateRanges[ mergeIndex ];
|
|
785
|
+
const range = updateRanges[ i ];
|
|
786
|
+
|
|
787
|
+
// Only merge if in the same row and overlapping/adjacent
|
|
788
|
+
const previousEnd = previousRange.start + previousRange.count;
|
|
789
|
+
const currentRow = getRow( range.start, image.width, componentStride );
|
|
790
|
+
const previousRow = getRow( previousRange.start, image.width, componentStride );
|
|
791
|
+
|
|
792
|
+
// We add one here to merge adjacent ranges. This is safe because ranges
|
|
793
|
+
// operate over positive integers.
|
|
794
|
+
if (
|
|
795
|
+
range.start <= previousEnd + 1 &&
|
|
796
|
+
currentRow === previousRow &&
|
|
797
|
+
getRow( range.start + range.count - 1, image.width, componentStride ) === currentRow // ensure range doesn't spill
|
|
798
|
+
) {
|
|
799
|
+
|
|
800
|
+
previousRange.count = Math.max(
|
|
801
|
+
previousRange.count,
|
|
802
|
+
range.start + range.count - previousRange.start
|
|
803
|
+
);
|
|
804
|
+
|
|
805
|
+
} else {
|
|
806
|
+
|
|
807
|
+
++ mergeIndex;
|
|
808
|
+
updateRanges[ mergeIndex ] = range;
|
|
809
|
+
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
// Trim the array to only contain the merged ranges.
|
|
816
|
+
updateRanges.length = mergeIndex + 1;
|
|
817
|
+
|
|
818
|
+
const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
819
|
+
const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
820
|
+
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
821
|
+
|
|
822
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
823
|
+
|
|
824
|
+
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
825
|
+
|
|
826
|
+
const range = updateRanges[ i ];
|
|
827
|
+
|
|
828
|
+
const pixelStart = Math.floor( range.start / componentStride );
|
|
829
|
+
const pixelCount = Math.ceil( range.count / componentStride );
|
|
830
|
+
|
|
831
|
+
const x = pixelStart % image.width;
|
|
832
|
+
const y = Math.floor( pixelStart / image.width );
|
|
833
|
+
|
|
834
|
+
// Assumes update ranges refer to contiguous memory
|
|
835
|
+
const width = pixelCount;
|
|
836
|
+
const height = 1;
|
|
837
|
+
|
|
838
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, x );
|
|
839
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, y );
|
|
840
|
+
|
|
841
|
+
state.texSubImage2D( _gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data );
|
|
842
|
+
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
texture.clearUpdateRanges();
|
|
846
|
+
|
|
847
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
848
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
849
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
850
|
+
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
}
|
|
854
|
+
|
|
742
855
|
function uploadTexture( textureProperties, texture, slot ) {
|
|
743
856
|
|
|
744
857
|
let textureType = _gl.TEXTURE_2D;
|
|
@@ -852,7 +965,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
852
965
|
|
|
853
966
|
if ( dataReady ) {
|
|
854
967
|
|
|
855
|
-
|
|
968
|
+
updateTexture( texture, image, glFormat, glType );
|
|
856
969
|
|
|
857
970
|
}
|
|
858
971
|
|
|
@@ -1629,7 +1742,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1629
1742
|
|
|
1630
1743
|
if ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );
|
|
1631
1744
|
|
|
1632
|
-
|
|
1745
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
1746
|
+
|
|
1747
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
1748
|
+
|
|
1749
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer[ 0 ], renderTarget );
|
|
1750
|
+
|
|
1751
|
+
} else {
|
|
1752
|
+
|
|
1753
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );
|
|
1754
|
+
|
|
1755
|
+
}
|
|
1633
1756
|
|
|
1634
1757
|
} else {
|
|
1635
1758
|
|
|
@@ -1660,7 +1783,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1660
1783
|
|
|
1661
1784
|
} else {
|
|
1662
1785
|
|
|
1663
|
-
|
|
1786
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
1787
|
+
|
|
1788
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
1789
|
+
|
|
1790
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] );
|
|
1791
|
+
|
|
1792
|
+
} else {
|
|
1793
|
+
|
|
1794
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
1795
|
+
|
|
1796
|
+
}
|
|
1664
1797
|
|
|
1665
1798
|
if ( renderTargetProperties.__webglDepthbuffer === undefined ) {
|
|
1666
1799
|
|
|
@@ -1873,13 +2006,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1873
2006
|
const attachment = textures[ i ];
|
|
1874
2007
|
const attachmentProperties = properties.get( attachment );
|
|
1875
2008
|
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
2009
|
+
let glTextureType = _gl.TEXTURE_2D;
|
|
2010
|
+
|
|
2011
|
+
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
2012
|
+
|
|
2013
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
2014
|
+
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
state.bindTexture( glTextureType, attachmentProperties.__webglTexture );
|
|
2018
|
+
setTextureParameters( glTextureType, attachment );
|
|
2019
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, glTextureType, 0 );
|
|
1879
2020
|
|
|
1880
2021
|
if ( textureNeedsGenerateMipmaps( attachment ) ) {
|
|
1881
2022
|
|
|
1882
|
-
generateMipmap(
|
|
2023
|
+
generateMipmap( glTextureType );
|
|
1883
2024
|
|
|
1884
2025
|
}
|
|
1885
2026
|
|
|
@@ -1990,7 +2131,18 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1990
2131
|
}
|
|
1991
2132
|
|
|
1992
2133
|
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
1993
|
-
|
|
2134
|
+
|
|
2135
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
2136
|
+
|
|
2137
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
2138
|
+
|
|
2139
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] );
|
|
2140
|
+
|
|
2141
|
+
} else {
|
|
2142
|
+
|
|
2143
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
2144
|
+
|
|
2145
|
+
}
|
|
1994
2146
|
|
|
1995
2147
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
1996
2148
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { 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, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat,
|
|
1
|
+
import { 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, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, 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, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat } from '../../constants.js';
|
|
2
2
|
import { ColorManagement } from '../../math/ColorManagement.js';
|
|
3
3
|
|
|
4
4
|
function WebGLUtils( gl, extensions ) {
|
|
@@ -25,8 +25,6 @@ function WebGLUtils( gl, extensions ) {
|
|
|
25
25
|
if ( p === AlphaFormat ) return gl.ALPHA;
|
|
26
26
|
if ( p === RGBFormat ) return gl.RGB;
|
|
27
27
|
if ( p === RGBAFormat ) return gl.RGBA;
|
|
28
|
-
if ( p === LuminanceFormat ) return gl.LUMINANCE;
|
|
29
|
-
if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
|
|
30
28
|
if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
|
|
31
29
|
if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
|
|
32
30
|
|