super-three 0.170.1 → 0.172.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/three.cjs +157 -49
- package/build/three.core.js +104 -42
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +53 -8
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +10 -5
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +21191 -1008
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +21189 -1008
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +0 -5
- package/examples/jsm/animation/CCDIKSolver.js +3 -2
- package/examples/jsm/controls/ArcballControls.js +28 -19
- package/examples/jsm/controls/OrbitControls.js +5 -4
- package/examples/jsm/csm/CSMShadowNode.js +16 -11
- package/examples/jsm/curves/NURBSCurve.js +1 -1
- package/examples/jsm/curves/NURBSUtils.js +3 -0
- package/examples/jsm/effects/OutlineEffect.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +11 -7
- package/examples/jsm/exporters/KTX2Exporter.js +1 -1
- package/examples/jsm/exporters/PLYExporter.js +2 -2
- package/examples/jsm/helpers/TextureHelperGPU.js +15 -5
- package/examples/jsm/helpers/VertexNormalsHelper.js +2 -0
- package/examples/jsm/lights/LightProbeGenerator.js +3 -3
- package/examples/jsm/lines/webgpu/LineSegments2.js +15 -6
- package/examples/jsm/loaders/3MFLoader.js +6 -3
- package/examples/jsm/loaders/BVHLoader.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +5 -5
- package/examples/jsm/loaders/DDSLoader.js +42 -0
- package/examples/jsm/loaders/GCodeLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +22 -2
- package/examples/jsm/loaders/KTX2Loader.js +6 -1
- package/examples/jsm/loaders/KTXLoader.js +4 -4
- package/examples/jsm/loaders/LDrawLoader.js +1 -1
- package/examples/jsm/loaders/LottieLoader.js +1 -1
- package/examples/jsm/loaders/MTLLoader.js +1 -0
- package/examples/jsm/loaders/NRRDLoader.js +1 -1
- package/examples/jsm/loaders/PLYLoader.js +7 -7
- package/examples/jsm/loaders/PVRLoader.js +1 -1
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TDSLoader.js +1 -1
- package/examples/jsm/loaders/VRMLLoader.js +7 -7
- package/examples/jsm/loaders/lwo/IFFParser.js +4 -4
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -1
- package/examples/jsm/math/ConvexHull.js +1 -1
- package/examples/jsm/math/OBB.js +17 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +10 -10
- package/examples/jsm/misc/Volume.js +20 -12
- package/examples/jsm/misc/VolumeSlice.js +2 -2
- package/examples/jsm/modifiers/CurveModifier.js +10 -8
- package/examples/jsm/modifiers/CurveModifierGPU.js +9 -7
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -2
- package/examples/jsm/objects/GroundedSkybox.js +4 -4
- package/examples/jsm/objects/Sky.js +2 -2
- package/examples/jsm/objects/SkyMesh.js +3 -3
- package/examples/jsm/objects/Water2.js +1 -1
- package/examples/jsm/objects/Water2Mesh.js +2 -2
- package/examples/jsm/objects/WaterMesh.js +4 -4
- package/examples/jsm/postprocessing/BloomPass.js +2 -2
- package/examples/jsm/postprocessing/EffectComposer.js +1 -2
- package/examples/jsm/postprocessing/OutlinePass.js +4 -4
- package/examples/jsm/postprocessing/SAOPass.js +1 -2
- package/examples/jsm/postprocessing/SMAAPass.js +1 -3
- package/examples/jsm/postprocessing/SSAOPass.js +2 -4
- package/examples/jsm/postprocessing/SSRPass.js +2 -4
- package/examples/jsm/postprocessing/UnrealBloomPass.js +2 -2
- package/examples/jsm/renderers/SVGRenderer.js +6 -4
- package/examples/jsm/shaders/BokehShader2.js +1 -1
- package/examples/jsm/shaders/GodRaysShader.js +3 -3
- package/examples/jsm/shaders/SobelOperatorShader.js +1 -1
- package/examples/jsm/tsl/display/AfterImageNode.js +93 -4
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +46 -2
- package/examples/jsm/tsl/display/AnamorphicNode.js +118 -5
- package/examples/jsm/tsl/display/BleachBypass.js +10 -0
- package/examples/jsm/tsl/display/BloomNode.js +233 -26
- package/examples/jsm/tsl/display/DenoiseNode.js +141 -25
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +80 -1
- package/examples/jsm/tsl/display/DotScreenNode.js +50 -5
- package/examples/jsm/tsl/display/FXAANode.js +52 -3
- package/examples/jsm/tsl/display/FilmNode.js +47 -1
- package/examples/jsm/tsl/display/GTAONode.js +210 -14
- package/examples/jsm/tsl/display/GaussianBlurNode.js +152 -8
- package/examples/jsm/tsl/display/LensflareNode.js +131 -13
- package/examples/jsm/tsl/display/Lut3DNode.js +55 -1
- package/examples/jsm/tsl/display/MotionBlur.js +12 -2
- package/examples/jsm/tsl/display/OutlineNode.js +343 -26
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +36 -2
- package/examples/jsm/tsl/display/PixelationPassNode.js +142 -9
- package/examples/jsm/tsl/display/RGBShiftNode.js +49 -2
- package/examples/jsm/tsl/display/SMAANode.js +187 -46
- package/examples/jsm/tsl/display/SSAAPassNode.js +110 -25
- package/examples/jsm/tsl/display/SSRNode.js +194 -21
- package/examples/jsm/tsl/display/Sepia.js +9 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +54 -4
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +79 -3
- package/examples/jsm/tsl/display/StereoPassNode.js +41 -3
- package/examples/jsm/tsl/display/TRAAPassNode.js +116 -21
- package/examples/jsm/tsl/display/TransitionNode.js +71 -6
- package/examples/jsm/tsl/display/hashBlur.js +14 -3
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +40 -34
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/CameraUtils.js +4 -1
- package/examples/jsm/utils/GeometryUtils.js +22 -19
- package/examples/jsm/utils/SceneUtils.js +2 -2
- package/examples/jsm/webxr/XRControllerModelFactory.js +6 -1
- package/examples/jsm/webxr/XREstimatedLight.js +1 -1
- package/package.json +8 -3
- package/src/Three.Core.js +2 -0
- package/src/Three.Legacy.js +0 -21
- package/src/Three.TSL.js +9 -4
- package/src/Three.WebGPU.Nodes.js +2 -2
- package/src/Three.WebGPU.js +2 -2
- package/src/animation/PropertyBinding.js +2 -2
- package/src/cameras/PerspectiveCamera.js +18 -2
- package/src/constants.js +1 -1
- package/src/core/RenderTarget.js +18 -0
- package/src/core/RenderTarget3D.js +22 -0
- package/src/core/RenderTargetArray.js +22 -0
- package/src/extras/Earcut.js +1 -1
- package/src/extras/PMREMGenerator.js +20 -0
- package/src/extras/TextureUtils.js +6 -0
- package/src/helpers/CameraHelper.js +16 -13
- package/src/loaders/nodes/NodeLoader.js +59 -0
- package/src/loaders/nodes/NodeMaterialLoader.js +45 -0
- package/src/loaders/nodes/NodeObjectLoader.js +61 -0
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +72 -19
- package/src/materials/nodes/Line2NodeMaterial.js +128 -34
- package/src/materials/nodes/LineBasicNodeMaterial.js +17 -2
- package/src/materials/nodes/LineDashedNodeMaterial.js +78 -5
- package/src/materials/nodes/MeshBasicNodeMaterial.js +56 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +35 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +22 -2
- package/src/materials/nodes/MeshNormalNodeMaterial.js +21 -2
- package/src/materials/nodes/MeshPhongNodeMaterial.js +64 -1
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +269 -0
- package/src/materials/nodes/MeshSSSNodeMaterial.js +97 -6
- package/src/materials/nodes/MeshStandardNodeMaterial.js +78 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +28 -0
- package/src/materials/nodes/NodeMaterial.js +474 -21
- package/src/materials/nodes/PointsNodeMaterial.js +22 -13
- package/src/materials/nodes/ShadowNodeMaterial.js +29 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +77 -19
- package/src/materials/nodes/VolumeNodeMaterial.js +80 -4
- package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -0
- package/src/nodes/Nodes.js +1 -6
- package/src/nodes/TSL.js +2 -3
- package/src/nodes/accessors/AccessorsUtils.js +27 -0
- package/src/nodes/accessors/Arrays.js +24 -5
- package/src/nodes/accessors/BatchNode.js +39 -3
- package/src/nodes/accessors/Bitangent.js +37 -0
- package/src/nodes/accessors/BufferAttributeNode.js +178 -5
- package/src/nodes/accessors/BufferNode.js +63 -0
- package/src/nodes/accessors/BuiltinNode.js +38 -0
- package/src/nodes/accessors/Camera.js +49 -0
- package/src/nodes/accessors/ClippingNode.js +71 -2
- package/src/nodes/accessors/CubeTextureNode.js +64 -0
- package/src/nodes/accessors/InstanceNode.js +85 -2
- package/src/nodes/accessors/InstancedMeshNode.js +28 -3
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +13 -0
- package/src/nodes/accessors/Lights.js +50 -1
- package/src/nodes/accessors/MaterialNode.js +302 -8
- package/src/nodes/accessors/MaterialProperties.js +7 -0
- package/src/nodes/accessors/MaterialReferenceNode.js +53 -13
- package/src/nodes/accessors/ModelNode.js +100 -5
- package/src/nodes/accessors/ModelViewProjectionNode.js +10 -38
- package/src/nodes/accessors/MorphNode.js +48 -4
- package/src/nodes/accessors/Normal.js +59 -3
- package/src/nodes/accessors/Object3DNode.js +102 -1
- package/src/nodes/accessors/PointUVNode.js +26 -0
- package/src/nodes/accessors/Position.js +53 -4
- package/src/nodes/accessors/ReferenceBaseNode.js +188 -0
- package/src/nodes/accessors/ReferenceNode.js +202 -2
- package/src/nodes/accessors/ReflectVector.js +24 -0
- package/src/nodes/accessors/RendererReferenceNode.js +46 -1
- package/src/nodes/accessors/SceneNode.js +54 -0
- package/src/nodes/accessors/SkinningNode.js +127 -1
- package/src/nodes/accessors/StorageBufferNode.js +168 -4
- package/src/nodes/accessors/StorageTextureNode.js +118 -0
- package/src/nodes/accessors/Tangent.js +36 -0
- package/src/nodes/accessors/Texture3DNode.js +89 -5
- package/src/nodes/accessors/TextureBicubic.js +12 -2
- package/src/nodes/accessors/TextureNode.js +309 -10
- package/src/nodes/accessors/TextureSizeNode.js +42 -0
- package/src/nodes/accessors/UV.js +10 -1
- package/src/nodes/accessors/UniformArrayNode.js +223 -23
- package/src/nodes/accessors/UserDataNode.js +46 -0
- package/src/nodes/accessors/VelocityNode.js +82 -0
- package/src/nodes/accessors/VertexColorNode.js +39 -2
- package/src/nodes/code/CodeNode.js +95 -1
- package/src/nodes/code/ExpressionNode.js +28 -0
- package/src/nodes/code/FunctionCallNode.js +37 -0
- package/src/nodes/code/FunctionNode.js +45 -0
- package/src/nodes/code/ScriptableNode.js +223 -1
- package/src/nodes/code/ScriptableValueNode.js +85 -1
- package/src/nodes/core/AssignNode.js +48 -2
- package/src/nodes/core/AttributeNode.js +43 -0
- package/src/nodes/core/BypassNode.js +47 -2
- package/src/nodes/core/CacheNode.js +53 -2
- package/src/nodes/core/ConstNode.js +24 -0
- package/src/nodes/core/ContextNode.js +65 -0
- package/src/nodes/core/IndexNode.js +68 -7
- package/src/nodes/core/InputNode.js +48 -0
- package/src/nodes/core/LightingModel.js +60 -0
- package/src/nodes/core/MRTNode.js +66 -0
- package/src/nodes/core/Node.js +337 -12
- package/src/nodes/core/NodeAttribute.js +38 -0
- package/src/nodes/core/NodeBuilder.js +945 -15
- package/src/nodes/core/NodeCache.js +41 -2
- package/src/nodes/core/NodeCode.js +31 -0
- package/src/nodes/core/NodeFrame.js +123 -2
- package/src/nodes/core/NodeFunction.js +46 -0
- package/src/nodes/core/NodeFunctionInput.js +44 -0
- package/src/nodes/core/NodeParser.js +11 -0
- package/src/nodes/core/NodeUniform.js +52 -0
- package/src/nodes/core/NodeUtils.js +141 -0
- package/src/nodes/core/NodeVar.js +30 -0
- package/src/nodes/core/NodeVarying.js +28 -0
- package/src/nodes/core/OutputStructNode.js +33 -2
- package/src/nodes/core/ParameterNode.js +28 -0
- package/src/nodes/core/PropertyNode.js +232 -0
- package/src/nodes/core/StackNode.js +78 -0
- package/src/nodes/core/StructTypeNode.js +39 -1
- package/src/nodes/core/TempNode.js +30 -4
- package/src/nodes/core/UniformGroupNode.js +82 -7
- package/src/nodes/core/UniformNode.js +66 -0
- package/src/nodes/core/VarNode.js +52 -0
- package/src/nodes/core/VaryingNode.js +83 -2
- package/src/nodes/core/constants.js +36 -0
- package/src/nodes/display/BumpMapNode.js +37 -0
- package/src/nodes/display/ColorAdjustment.js +53 -11
- package/src/nodes/display/ColorSpaceFunctions.js +16 -0
- package/src/nodes/display/ColorSpaceNode.js +82 -0
- package/src/nodes/display/FrontFacingNode.js +29 -0
- package/src/nodes/display/NormalMapNode.js +43 -0
- package/src/nodes/display/PassNode.js +298 -7
- package/src/nodes/display/PosterizeNode.js +33 -0
- package/src/nodes/display/RenderOutputNode.js +66 -1
- package/src/nodes/display/ScreenNode.js +87 -0
- package/src/nodes/display/ToneMappingFunctions.js +58 -10
- package/src/nodes/display/ToneMappingNode.js +55 -2
- package/src/nodes/display/ToonOutlinePassNode.js +73 -0
- package/src/nodes/display/ViewportDepthNode.js +122 -8
- package/src/nodes/display/ViewportDepthTextureNode.js +23 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +23 -0
- package/src/nodes/display/ViewportTextureNode.js +57 -0
- package/src/nodes/fog/Fog.js +93 -0
- package/src/nodes/functions/BasicLightingModel.js +24 -0
- package/src/nodes/functions/PhongLightingModel.js +34 -2
- package/src/nodes/functions/PhysicalLightingModel.js +167 -8
- package/src/nodes/functions/ShadowMaskModel.js +23 -0
- package/src/nodes/functions/ToonLightingModel.js +20 -0
- package/src/nodes/functions/material/getAlphaHashThreshold.js +1 -3
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +16 -1
- package/src/nodes/geometry/RangeNode.js +54 -2
- package/src/nodes/gpgpu/AtomicFunctionNode.js +157 -1
- package/src/nodes/gpgpu/BarrierNode.js +47 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +126 -0
- package/src/nodes/gpgpu/ComputeNode.js +106 -2
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +115 -6
- package/src/nodes/lighting/AONode.js +18 -0
- package/src/nodes/lighting/AmbientLightNode.js +10 -0
- package/src/nodes/lighting/AnalyticLightNode.js +97 -2
- package/src/nodes/lighting/BasicEnvironmentNode.js +19 -0
- package/src/nodes/lighting/BasicLightMapNode.js +17 -0
- package/src/nodes/lighting/DirectionalLightNode.js +10 -0
- package/src/nodes/lighting/EnvironmentNode.js +18 -0
- package/src/nodes/lighting/HemisphereLightNode.js +31 -0
- package/src/nodes/lighting/IESSpotLightNode.js +11 -0
- package/src/nodes/lighting/IrradianceNode.js +17 -0
- package/src/nodes/lighting/LightProbeNode.js +20 -0
- package/src/nodes/lighting/LightUtils.js +12 -0
- package/src/nodes/lighting/LightingContextNode.js +48 -0
- package/src/nodes/lighting/LightingNode.js +15 -6
- package/src/nodes/lighting/LightsNode.js +132 -1
- package/src/nodes/lighting/PointLightNode.js +32 -1
- package/src/nodes/lighting/PointShadowNode.js +54 -1
- package/src/nodes/lighting/RectAreaLightNode.js +44 -6
- package/src/nodes/lighting/ShadowBaseNode.js +93 -0
- package/src/nodes/lighting/ShadowNode.js +240 -34
- package/src/nodes/lighting/SpotLightNode.js +43 -0
- package/src/nodes/math/ConditionalNode.js +70 -3
- package/src/nodes/math/Hash.js +9 -0
- package/src/nodes/math/MathNode.js +614 -11
- package/src/nodes/math/MathUtils.js +45 -1
- package/src/nodes/math/OperatorNode.js +233 -0
- package/src/nodes/math/TriNoise3D.js +18 -7
- package/src/nodes/parsers/GLSLNodeFunction.js +16 -0
- package/src/nodes/parsers/GLSLNodeParser.js +11 -0
- package/src/nodes/pmrem/PMREMNode.js +133 -0
- package/src/nodes/pmrem/PMREMUtils.js +1 -1
- package/src/nodes/procedural/Checker.js +9 -0
- package/src/nodes/tsl/TSLBase.js +2 -2
- package/src/nodes/utils/ArrayElementNode.js +38 -2
- package/src/nodes/utils/ConvertNode.js +31 -0
- package/src/nodes/utils/CubeMapNode.js +78 -0
- package/src/nodes/utils/Discard.js +16 -0
- package/src/nodes/utils/EquirectUVNode.js +31 -1
- package/src/nodes/utils/FlipNode.js +38 -0
- package/src/nodes/utils/FunctionOverloadingNode.js +53 -1
- package/src/nodes/utils/JoinNode.js +25 -0
- package/src/nodes/utils/LoopNode.js +74 -1
- package/src/nodes/utils/MatcapUVNode.js +17 -0
- package/src/nodes/utils/MaxMipLevelNode.js +49 -0
- package/src/nodes/utils/Oscillators.js +33 -0
- package/src/nodes/utils/Packing.js +17 -0
- package/src/nodes/utils/PostProcessingUtils.js +28 -23
- package/src/nodes/utils/RTTNode.js +123 -2
- package/src/nodes/utils/ReflectorNode.js +174 -4
- package/src/nodes/utils/RemapNode.js +79 -0
- package/src/nodes/utils/RotateNode.js +41 -0
- package/src/nodes/utils/SetNode.js +44 -1
- package/src/nodes/utils/SplitNode.js +55 -3
- package/src/nodes/utils/SpriteSheetUVNode.js +46 -0
- package/src/nodes/utils/SpriteUtils.js +17 -0
- package/src/nodes/utils/StorageArrayElementNode.js +40 -0
- package/src/nodes/utils/Timer.js +19 -0
- package/src/nodes/utils/TriplanarTexturesNode.js +84 -0
- package/src/nodes/utils/UVUtils.js +20 -0
- package/src/nodes/utils/ViewportUtils.js +13 -0
- package/src/objects/BatchedMesh.js +1 -2
- package/src/objects/ClippingGroup.js +49 -0
- package/src/renderers/WebGLRenderer.js +23 -4
- package/src/renderers/common/Animation.js +63 -0
- package/src/renderers/common/Attributes.js +36 -0
- package/src/renderers/common/Backend.js +467 -52
- package/src/renderers/common/Background.js +34 -1
- package/src/renderers/common/BindGroup.js +43 -0
- package/src/renderers/common/Binding.js +35 -0
- package/src/renderers/common/Bindings.js +93 -1
- package/src/renderers/common/Buffer.js +49 -0
- package/src/renderers/common/BufferUtils.js +27 -0
- package/src/renderers/common/BundleGroup.js +57 -0
- package/src/renderers/common/ChainMap.js +38 -1
- package/src/renderers/common/ClippingContext.js +107 -14
- package/src/renderers/common/Color4.js +36 -0
- package/src/renderers/common/ComputePipeline.js +24 -0
- package/src/renderers/common/CubeRenderTarget.js +13 -0
- package/src/renderers/common/DataMap.js +37 -1
- package/src/renderers/common/Geometries.js +98 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +25 -2
- package/src/renderers/common/Info.js +87 -0
- package/src/renderers/common/Lighting.js +26 -0
- package/src/renderers/common/Pipeline.js +22 -0
- package/src/renderers/common/Pipelines.js +148 -5
- package/src/renderers/common/PostProcessing.js +75 -3
- package/src/renderers/common/ProgrammableStage.js +60 -2
- package/src/renderers/common/QuadMesh.js +54 -5
- package/src/renderers/common/RenderBundle.js +14 -8
- package/src/renderers/common/RenderBundles.js +33 -10
- package/src/renderers/common/RenderContext.js +169 -4
- package/src/renderers/common/RenderContexts.js +42 -2
- package/src/renderers/common/RenderList.js +178 -0
- package/src/renderers/common/RenderLists.js +31 -0
- package/src/renderers/common/RenderObject.js +328 -4
- package/src/renderers/common/RenderObjects.js +101 -7
- package/src/renderers/common/RenderPipeline.js +24 -0
- package/src/renderers/common/Renderer.js +1096 -31
- package/src/renderers/common/RendererUtils.js +193 -0
- package/src/renderers/common/SampledTexture.js +121 -0
- package/src/renderers/common/Sampler.js +30 -0
- package/src/renderers/common/StorageBuffer.js +24 -0
- package/src/renderers/common/StorageBufferAttribute.js +31 -2
- package/src/renderers/common/StorageInstancedBufferAttribute.js +31 -2
- package/src/renderers/common/StorageTexture.js +38 -0
- package/src/renderers/common/Textures.js +83 -0
- package/src/renderers/common/Uniform.js +188 -2
- package/src/renderers/common/UniformBuffer.js +19 -0
- package/src/renderers/common/UniformsGroup.js +139 -2
- package/src/renderers/common/extras/PMREMGenerator.js +24 -3
- package/src/renderers/common/nodes/NodeBuilderState.js +95 -1
- package/src/renderers/common/nodes/NodeLibrary.js +89 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +91 -2
- package/src/renderers/common/nodes/NodeSampler.js +28 -0
- package/src/renderers/common/nodes/NodeStorageBuffer.js +35 -0
- package/src/renderers/common/nodes/NodeUniform.js +189 -0
- package/src/renderers/common/nodes/NodeUniformBuffer.js +29 -0
- package/src/renderers/common/nodes/NodeUniformsGroup.js +31 -18
- package/src/renderers/common/nodes/Nodes.js +327 -60
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +7 -7
- package/src/renderers/webgl-fallback/WebGLBackend.js +547 -29
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +0 -1
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1 -1
- package/src/renderers/webgpu/WebGPUBackend.js +480 -49
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +34 -0
- package/src/renderers/webgpu/WebGPURenderer.js +35 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +20 -8
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +21 -8
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +59 -11
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +17 -0
- package/src/renderers/webgpu/nodes/WGSLNodeParser.js +11 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +10 -8
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +9 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +5 -9
- package/src/renderers/webgpu/utils/WebGPUUtils.js +30 -0
- package/src/renderers/webxr/WebXRDepthSensing.js +1 -1
- package/src/renderers/webxr/WebXRManager.js +7 -1
- package/src/textures/Data3DTexture.js +2 -2
- package/src/textures/Texture.js +4 -0
- package/examples/jsm/animation/MMDAnimationHelper.js +0 -1209
- package/examples/jsm/animation/MMDPhysics.js +0 -1408
- package/examples/jsm/exporters/MMDExporter.js +0 -223
- package/examples/jsm/libs/mmdparser.module.js +0 -11530
- package/examples/jsm/loaders/MMDLoader.js +0 -2298
- package/examples/jsm/shaders/MMDToonShader.js +0 -134
- package/src/nodes/core/UniformGroup.js +0 -13
- package/src/nodes/fog/FogExp2Node.js +0 -35
- package/src/nodes/fog/FogNode.js +0 -50
- package/src/nodes/fog/FogRangeNode.js +0 -36
- package/src/renderers/common/PostProcessingUtils.js +0 -86
|
@@ -14,18 +14,184 @@ import { WebGLBufferRenderer } from './WebGLBufferRenderer.js';
|
|
|
14
14
|
import { warnOnce } from '../../utils.js';
|
|
15
15
|
import { WebGLCoordinateSystem } from '../../constants.js';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A backend implementation targeting WebGL 2.
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
* @augments Backend
|
|
22
|
+
*/
|
|
19
23
|
class WebGLBackend extends Backend {
|
|
20
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Constructs a new WebGPU backend.
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} parameters - The configuration parameter.
|
|
29
|
+
* @param {Boolean} [parameters.logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not.
|
|
30
|
+
* @param {Boolean} [parameters.alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque.
|
|
31
|
+
* @param {Boolean} [parameters.depth=true] - Whether the default framebuffer should have a depth buffer or not.
|
|
32
|
+
* @param {Boolean} [parameters.stencil=false] - Whether the default framebuffer should have a stencil buffer or not.
|
|
33
|
+
* @param {Boolean} [parameters.antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not.
|
|
34
|
+
* @param {Number} [parameters.samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default.
|
|
35
|
+
* @param {Boolean} [parameters.forceWebGL=false] - If set to `true`, the renderer uses it WebGL 2 backend no matter if WebGPU is supported or not.
|
|
36
|
+
* @param {WebGL2RenderingContext} [parameters.context=undefined] - A WebGL 2 rendering context.
|
|
37
|
+
*/
|
|
21
38
|
constructor( parameters = {} ) {
|
|
22
39
|
|
|
23
40
|
super( parameters );
|
|
24
41
|
|
|
42
|
+
/**
|
|
43
|
+
* This flag can be used for type testing.
|
|
44
|
+
*
|
|
45
|
+
* @type {Boolean}
|
|
46
|
+
* @readonly
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
25
49
|
this.isWebGLBackend = true;
|
|
26
50
|
|
|
51
|
+
/**
|
|
52
|
+
* A reference to a backend module holding shader attribute-related
|
|
53
|
+
* utility functions.
|
|
54
|
+
*
|
|
55
|
+
* @type {WebGLAttributeUtils?}
|
|
56
|
+
* @default null
|
|
57
|
+
*/
|
|
58
|
+
this.attributeUtils = null;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A reference to a backend module holding extension-related
|
|
62
|
+
* utility functions.
|
|
63
|
+
*
|
|
64
|
+
* @type {WebGLExtensions?}
|
|
65
|
+
* @default null
|
|
66
|
+
*/
|
|
67
|
+
this.extensions = null;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A reference to a backend module holding capability-related
|
|
71
|
+
* utility functions.
|
|
72
|
+
*
|
|
73
|
+
* @type {WebGLCapabilities?}
|
|
74
|
+
* @default null
|
|
75
|
+
*/
|
|
76
|
+
this.capabilities = null;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A reference to a backend module holding texture-related
|
|
80
|
+
* utility functions.
|
|
81
|
+
*
|
|
82
|
+
* @type {WebGLTextureUtils?}
|
|
83
|
+
* @default null
|
|
84
|
+
*/
|
|
85
|
+
this.textureUtils = null;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* A reference to a backend module holding renderer-related
|
|
89
|
+
* utility functions.
|
|
90
|
+
*
|
|
91
|
+
* @type {WebGLBufferRenderer?}
|
|
92
|
+
* @default null
|
|
93
|
+
*/
|
|
94
|
+
this.bufferRenderer = null;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A reference to the rendering context.
|
|
98
|
+
*
|
|
99
|
+
* @type {WebGL2RenderingContext?}
|
|
100
|
+
* @default null
|
|
101
|
+
*/
|
|
102
|
+
this.gl = null;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* A reference to a backend module holding state-related
|
|
106
|
+
* utility functions.
|
|
107
|
+
*
|
|
108
|
+
* @type {WebGLState?}
|
|
109
|
+
* @default null
|
|
110
|
+
*/
|
|
111
|
+
this.state = null;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* A reference to a backend module holding common
|
|
115
|
+
* utility functions.
|
|
116
|
+
*
|
|
117
|
+
* @type {WebGLUtils?}
|
|
118
|
+
* @default null
|
|
119
|
+
*/
|
|
120
|
+
this.utils = null;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Dictionary for caching VAOs.
|
|
124
|
+
*
|
|
125
|
+
* @type {Object<String,WebGLVertexArrayObject>}
|
|
126
|
+
*/
|
|
127
|
+
this.vaoCache = {};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Dictionary for caching transform feedback objects.
|
|
131
|
+
*
|
|
132
|
+
* @type {Object<String,WebGLTransformFeedback>}
|
|
133
|
+
*/
|
|
134
|
+
this.transformFeedbackCache = {};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Controls if `gl.RASTERIZER_DISCARD` should be enabled or not.
|
|
138
|
+
* Only relevant when using compute shaders.
|
|
139
|
+
*
|
|
140
|
+
* @type {Boolean}
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
143
|
+
this.discard = false;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* A reference to the `EXT_disjoint_timer_query_webgl2` extension. `null` if the
|
|
147
|
+
* device does not support the extension.
|
|
148
|
+
*
|
|
149
|
+
* @type {EXTDisjointTimerQueryWebGL2?}
|
|
150
|
+
* @default null
|
|
151
|
+
*/
|
|
152
|
+
this.disjoint = null;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* A reference to the `KHR_parallel_shader_compile` extension. `null` if the
|
|
156
|
+
* device does not support the extension.
|
|
157
|
+
*
|
|
158
|
+
* @type {KHRParallelShaderCompile?}
|
|
159
|
+
* @default null
|
|
160
|
+
*/
|
|
161
|
+
this.parallel = null;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Whether to track timestamps with a Timestamp Query API or not.
|
|
165
|
+
*
|
|
166
|
+
* @type {Boolean}
|
|
167
|
+
* @default false
|
|
168
|
+
*/
|
|
169
|
+
this.trackTimestamp = ( parameters.trackTimestamp === true );
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* A reference to the current render context.
|
|
173
|
+
*
|
|
174
|
+
* @private
|
|
175
|
+
* @type {RenderContext}
|
|
176
|
+
* @default null
|
|
177
|
+
*/
|
|
178
|
+
this._currentContext = null;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* A unique collection of bindings.
|
|
182
|
+
*
|
|
183
|
+
* @private
|
|
184
|
+
* @type {WeakSet}
|
|
185
|
+
*/
|
|
186
|
+
this._knownBindings = new WeakSet();
|
|
187
|
+
|
|
27
188
|
}
|
|
28
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Initializes the backend so it is ready for usage.
|
|
192
|
+
*
|
|
193
|
+
* @param {Renderer} renderer - The renderer.
|
|
194
|
+
*/
|
|
29
195
|
init( renderer ) {
|
|
30
196
|
|
|
31
197
|
super.init( renderer );
|
|
@@ -66,11 +232,6 @@ class WebGLBackend extends Backend {
|
|
|
66
232
|
this.state = new WebGLState( this );
|
|
67
233
|
this.utils = new WebGLUtils( this );
|
|
68
234
|
|
|
69
|
-
this.vaoCache = {};
|
|
70
|
-
this.transformFeedbackCache = {};
|
|
71
|
-
this.discard = false;
|
|
72
|
-
this.trackTimestamp = ( parameters.trackTimestamp === true );
|
|
73
|
-
|
|
74
235
|
this.extensions.get( 'EXT_color_buffer_float' );
|
|
75
236
|
this.extensions.get( 'WEBGL_clip_cull_distance' );
|
|
76
237
|
this.extensions.get( 'OES_texture_float_linear' );
|
|
@@ -82,30 +243,52 @@ class WebGLBackend extends Backend {
|
|
|
82
243
|
this.disjoint = this.extensions.get( 'EXT_disjoint_timer_query_webgl2' );
|
|
83
244
|
this.parallel = this.extensions.get( 'KHR_parallel_shader_compile' );
|
|
84
245
|
|
|
85
|
-
this._knownBindings = new WeakSet();
|
|
86
|
-
|
|
87
|
-
this._currentContext = null;
|
|
88
|
-
|
|
89
246
|
}
|
|
90
247
|
|
|
248
|
+
/**
|
|
249
|
+
* The coordinate system of the backend.
|
|
250
|
+
*
|
|
251
|
+
* @type {Number}
|
|
252
|
+
* @readonly
|
|
253
|
+
*/
|
|
91
254
|
get coordinateSystem() {
|
|
92
255
|
|
|
93
256
|
return WebGLCoordinateSystem;
|
|
94
257
|
|
|
95
258
|
}
|
|
96
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Transfers buffer data from a storage buffer attribute
|
|
262
|
+
* from the GPU to the CPU in context of compute shaders.
|
|
263
|
+
*
|
|
264
|
+
* @async
|
|
265
|
+
* @param {StorageBufferAttribute} attribute - The storage buffer attribute.
|
|
266
|
+
* @return {Promise<ArrayBuffer>} A promise that resolves with the buffer data when the data are ready.
|
|
267
|
+
*/
|
|
97
268
|
async getArrayBufferAsync( attribute ) {
|
|
98
269
|
|
|
99
270
|
return await this.attributeUtils.getArrayBufferAsync( attribute );
|
|
100
271
|
|
|
101
272
|
}
|
|
102
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Can be used to synchronize CPU operations with GPU tasks. So when this method is called,
|
|
276
|
+
* the CPU waits for the GPU to complete its operation (e.g. a compute task).
|
|
277
|
+
*
|
|
278
|
+
* @async
|
|
279
|
+
* @return {Promise} A Promise that resolves when synchronization has been finished.
|
|
280
|
+
*/
|
|
103
281
|
async waitForGPU() {
|
|
104
282
|
|
|
105
283
|
await this.utils._clientWaitAsync();
|
|
106
284
|
|
|
107
285
|
}
|
|
108
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Inits a time stamp query for the given render context.
|
|
289
|
+
*
|
|
290
|
+
* @param {RenderContext} renderContext - The render context.
|
|
291
|
+
*/
|
|
109
292
|
initTimestampQuery( renderContext ) {
|
|
110
293
|
|
|
111
294
|
if ( ! this.disjoint || ! this.trackTimestamp ) return;
|
|
@@ -140,6 +323,11 @@ class WebGLBackend extends Backend {
|
|
|
140
323
|
|
|
141
324
|
// timestamp utils
|
|
142
325
|
|
|
326
|
+
/**
|
|
327
|
+
* Prepares the timestamp buffer.
|
|
328
|
+
*
|
|
329
|
+
* @param {RenderContext} renderContext - The render context.
|
|
330
|
+
*/
|
|
143
331
|
prepareTimestampBuffer( renderContext ) {
|
|
144
332
|
|
|
145
333
|
if ( ! this.disjoint || ! this.trackTimestamp ) return;
|
|
@@ -166,6 +354,14 @@ class WebGLBackend extends Backend {
|
|
|
166
354
|
|
|
167
355
|
}
|
|
168
356
|
|
|
357
|
+
/**
|
|
358
|
+
* Resolves the time stamp for the given render context and type.
|
|
359
|
+
*
|
|
360
|
+
* @async
|
|
361
|
+
* @param {RenderContext} renderContext - The render context.
|
|
362
|
+
* @param {String} type - The render context.
|
|
363
|
+
* @return {Promise} A Promise that resolves when the time stamp has been computed.
|
|
364
|
+
*/
|
|
169
365
|
async resolveTimestampAsync( renderContext, type = 'render' ) {
|
|
170
366
|
|
|
171
367
|
if ( ! this.disjoint || ! this.trackTimestamp ) return;
|
|
@@ -195,12 +391,23 @@ class WebGLBackend extends Backend {
|
|
|
195
391
|
|
|
196
392
|
}
|
|
197
393
|
|
|
394
|
+
/**
|
|
395
|
+
* Returns the backend's rendering context.
|
|
396
|
+
*
|
|
397
|
+
* @return {WebGL2RenderingContext} The rendering context.
|
|
398
|
+
*/
|
|
198
399
|
getContext() {
|
|
199
400
|
|
|
200
401
|
return this.gl;
|
|
201
402
|
|
|
202
403
|
}
|
|
203
404
|
|
|
405
|
+
/**
|
|
406
|
+
* This method is executed at the beginning of a render call and prepares
|
|
407
|
+
* the WebGL state for upcoming render calls
|
|
408
|
+
*
|
|
409
|
+
* @param {RenderContext} renderContext - The render context.
|
|
410
|
+
*/
|
|
204
411
|
beginRender( renderContext ) {
|
|
205
412
|
|
|
206
413
|
const { gl } = this;
|
|
@@ -256,6 +463,12 @@ class WebGLBackend extends Backend {
|
|
|
256
463
|
|
|
257
464
|
}
|
|
258
465
|
|
|
466
|
+
/**
|
|
467
|
+
* This method is executed at the end of a render call and finalizes work
|
|
468
|
+
* after draw calls.
|
|
469
|
+
*
|
|
470
|
+
* @param {RenderContext} renderContext - The render context.
|
|
471
|
+
*/
|
|
259
472
|
finishRender( renderContext ) {
|
|
260
473
|
|
|
261
474
|
const { gl, state } = this;
|
|
@@ -362,6 +575,13 @@ class WebGLBackend extends Backend {
|
|
|
362
575
|
|
|
363
576
|
}
|
|
364
577
|
|
|
578
|
+
/**
|
|
579
|
+
* This method processes the result of occlusion queries and writes it
|
|
580
|
+
* into render context data.
|
|
581
|
+
*
|
|
582
|
+
* @async
|
|
583
|
+
* @param {RenderContext} renderContext - The render context.
|
|
584
|
+
*/
|
|
365
585
|
resolveOccludedAsync( renderContext ) {
|
|
366
586
|
|
|
367
587
|
const renderContextData = this.get( renderContext );
|
|
@@ -420,6 +640,14 @@ class WebGLBackend extends Backend {
|
|
|
420
640
|
|
|
421
641
|
}
|
|
422
642
|
|
|
643
|
+
/**
|
|
644
|
+
* Returns `true` if the given 3D object is fully occluded by other
|
|
645
|
+
* 3D objects in the scene.
|
|
646
|
+
*
|
|
647
|
+
* @param {RenderContext} renderContext - The render context.
|
|
648
|
+
* @param {Object3D} object - The 3D object to test.
|
|
649
|
+
* @return {Boolean} Whether the 3D object is fully occluded or not.
|
|
650
|
+
*/
|
|
423
651
|
isOccluded( renderContext, object ) {
|
|
424
652
|
|
|
425
653
|
const renderContextData = this.get( renderContext );
|
|
@@ -428,6 +656,11 @@ class WebGLBackend extends Backend {
|
|
|
428
656
|
|
|
429
657
|
}
|
|
430
658
|
|
|
659
|
+
/**
|
|
660
|
+
* Updates the viewport with the values from the given render context.
|
|
661
|
+
*
|
|
662
|
+
* @param {RenderContext} renderContext - The render context.
|
|
663
|
+
*/
|
|
431
664
|
updateViewport( renderContext ) {
|
|
432
665
|
|
|
433
666
|
const gl = this.gl;
|
|
@@ -437,6 +670,11 @@ class WebGLBackend extends Backend {
|
|
|
437
670
|
|
|
438
671
|
}
|
|
439
672
|
|
|
673
|
+
/**
|
|
674
|
+
* Defines the scissor test.
|
|
675
|
+
*
|
|
676
|
+
* @param {Boolean} boolean - Whether the scissor test should be enabled or not.
|
|
677
|
+
*/
|
|
440
678
|
setScissorTest( boolean ) {
|
|
441
679
|
|
|
442
680
|
const gl = this.gl;
|
|
@@ -453,6 +691,15 @@ class WebGLBackend extends Backend {
|
|
|
453
691
|
|
|
454
692
|
}
|
|
455
693
|
|
|
694
|
+
/**
|
|
695
|
+
* Performs a clear operation.
|
|
696
|
+
*
|
|
697
|
+
* @param {Boolean} color - Whether the color buffer should be cleared or not.
|
|
698
|
+
* @param {Boolean} depth - Whether the depth buffer should be cleared or not.
|
|
699
|
+
* @param {Boolean} stencil - Whether the stencil buffer should be cleared or not.
|
|
700
|
+
* @param {Object?} [descriptor=null] - The render context of the current set render target.
|
|
701
|
+
* @param {Boolean} [setFrameBuffer=true] - TODO.
|
|
702
|
+
*/
|
|
456
703
|
clear( color, depth, stencil, descriptor = null, setFrameBuffer = true ) {
|
|
457
704
|
|
|
458
705
|
const { gl } = this;
|
|
@@ -543,6 +790,12 @@ class WebGLBackend extends Backend {
|
|
|
543
790
|
|
|
544
791
|
}
|
|
545
792
|
|
|
793
|
+
/**
|
|
794
|
+
* This method is executed at the beginning of a compute call and
|
|
795
|
+
* prepares the state for upcoming compute tasks.
|
|
796
|
+
*
|
|
797
|
+
* @param {Node|Array<Node>} computeGroup - The compute node(s).
|
|
798
|
+
*/
|
|
546
799
|
beginCompute( computeGroup ) {
|
|
547
800
|
|
|
548
801
|
const { state, gl } = this;
|
|
@@ -552,11 +805,19 @@ class WebGLBackend extends Backend {
|
|
|
552
805
|
|
|
553
806
|
}
|
|
554
807
|
|
|
808
|
+
/**
|
|
809
|
+
* Executes a compute command for the given compute node.
|
|
810
|
+
*
|
|
811
|
+
* @param {Node|Array<Node>} computeGroup - The group of compute nodes of a compute call. Can be a single compute node.
|
|
812
|
+
* @param {Node} computeNode - The compute node.
|
|
813
|
+
* @param {Array<BindGroup>} bindings - The bindings.
|
|
814
|
+
* @param {ComputePipeline} pipeline - The compute pipeline.
|
|
815
|
+
*/
|
|
555
816
|
compute( computeGroup, computeNode, bindings, pipeline ) {
|
|
556
817
|
|
|
557
818
|
const { state, gl } = this;
|
|
558
819
|
|
|
559
|
-
if (
|
|
820
|
+
if ( this.discard === false ) {
|
|
560
821
|
|
|
561
822
|
// required here to handle async behaviour of render.compute()
|
|
562
823
|
gl.enable( gl.RASTERIZER_DISCARD );
|
|
@@ -621,6 +882,12 @@ class WebGLBackend extends Backend {
|
|
|
621
882
|
|
|
622
883
|
}
|
|
623
884
|
|
|
885
|
+
/**
|
|
886
|
+
* This method is executed at the end of a compute call and
|
|
887
|
+
* finalizes work after compute tasks.
|
|
888
|
+
*
|
|
889
|
+
* @param {Node|Array<Node>} computeGroup - The compute node(s).
|
|
890
|
+
*/
|
|
624
891
|
finishCompute( computeGroup ) {
|
|
625
892
|
|
|
626
893
|
const gl = this.gl;
|
|
@@ -639,6 +906,12 @@ class WebGLBackend extends Backend {
|
|
|
639
906
|
|
|
640
907
|
}
|
|
641
908
|
|
|
909
|
+
/**
|
|
910
|
+
* Executes a draw command for the given render object.
|
|
911
|
+
*
|
|
912
|
+
* @param {RenderObject} renderObject - The render object to draw.
|
|
913
|
+
* @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process.
|
|
914
|
+
*/
|
|
642
915
|
draw( renderObject/*, info*/ ) {
|
|
643
916
|
|
|
644
917
|
const { object, pipeline, material, context, hardwareClippingPlanes } = renderObject;
|
|
@@ -801,12 +1074,24 @@ class WebGLBackend extends Backend {
|
|
|
801
1074
|
|
|
802
1075
|
}
|
|
803
1076
|
|
|
1077
|
+
/**
|
|
1078
|
+
* Explain why always null is returned.
|
|
1079
|
+
*
|
|
1080
|
+
* @param {RenderObject} renderObject - The render object.
|
|
1081
|
+
* @return {Boolean} Whether the render pipeline requires an update or not.
|
|
1082
|
+
*/
|
|
804
1083
|
needsRenderUpdate( /*renderObject*/ ) {
|
|
805
1084
|
|
|
806
1085
|
return false;
|
|
807
1086
|
|
|
808
1087
|
}
|
|
809
1088
|
|
|
1089
|
+
/**
|
|
1090
|
+
* Explain why no cache key is computed.
|
|
1091
|
+
*
|
|
1092
|
+
* @param {RenderObject} renderObject - The render object.
|
|
1093
|
+
* @return {String} The cache key.
|
|
1094
|
+
*/
|
|
810
1095
|
getRenderCacheKey( /*renderObject*/ ) {
|
|
811
1096
|
|
|
812
1097
|
return '';
|
|
@@ -815,53 +1100,108 @@ class WebGLBackend extends Backend {
|
|
|
815
1100
|
|
|
816
1101
|
// textures
|
|
817
1102
|
|
|
1103
|
+
/**
|
|
1104
|
+
* Creates a default texture for the given texture that can be used
|
|
1105
|
+
* as a placeholder until the actual texture is ready for usage.
|
|
1106
|
+
*
|
|
1107
|
+
* @param {Texture} texture - The texture to create a default texture for.
|
|
1108
|
+
*/
|
|
818
1109
|
createDefaultTexture( texture ) {
|
|
819
1110
|
|
|
820
1111
|
this.textureUtils.createDefaultTexture( texture );
|
|
821
1112
|
|
|
822
1113
|
}
|
|
823
1114
|
|
|
1115
|
+
/**
|
|
1116
|
+
* Defines a texture on the GPU for the given texture object.
|
|
1117
|
+
*
|
|
1118
|
+
* @param {Texture} texture - The texture.
|
|
1119
|
+
* @param {Object} [options={}] - Optional configuration parameter.
|
|
1120
|
+
*/
|
|
824
1121
|
createTexture( texture, options ) {
|
|
825
1122
|
|
|
826
1123
|
this.textureUtils.createTexture( texture, options );
|
|
827
1124
|
|
|
828
1125
|
}
|
|
829
1126
|
|
|
1127
|
+
/**
|
|
1128
|
+
* Uploads the updated texture data to the GPU.
|
|
1129
|
+
*
|
|
1130
|
+
* @param {Texture} texture - The texture.
|
|
1131
|
+
* @param {Object} [options={}] - Optional configuration parameter.
|
|
1132
|
+
*/
|
|
830
1133
|
updateTexture( texture, options ) {
|
|
831
1134
|
|
|
832
1135
|
this.textureUtils.updateTexture( texture, options );
|
|
833
1136
|
|
|
834
1137
|
}
|
|
835
1138
|
|
|
1139
|
+
/**
|
|
1140
|
+
* Generates mipmaps for the given texture
|
|
1141
|
+
*
|
|
1142
|
+
* @param {Texture} texture - The texture.
|
|
1143
|
+
*/
|
|
836
1144
|
generateMipmaps( texture ) {
|
|
837
1145
|
|
|
838
1146
|
this.textureUtils.generateMipmaps( texture );
|
|
839
1147
|
|
|
840
1148
|
}
|
|
841
1149
|
|
|
842
|
-
|
|
1150
|
+
/**
|
|
1151
|
+
* Destroys the GPU data for the given texture object.
|
|
1152
|
+
*
|
|
1153
|
+
* @param {Texture} texture - The texture.
|
|
1154
|
+
*/
|
|
843
1155
|
destroyTexture( texture ) {
|
|
844
1156
|
|
|
845
1157
|
this.textureUtils.destroyTexture( texture );
|
|
846
1158
|
|
|
847
1159
|
}
|
|
848
1160
|
|
|
1161
|
+
/**
|
|
1162
|
+
* Returns texture data as a typed array.
|
|
1163
|
+
*
|
|
1164
|
+
* @param {Texture} texture - The texture to copy.
|
|
1165
|
+
* @param {Number} x - The x coordinate of the copy origin.
|
|
1166
|
+
* @param {Number} y - The y coordinate of the copy origin.
|
|
1167
|
+
* @param {Number} width - The width of the copy.
|
|
1168
|
+
* @param {Number} height - The height of the copy.
|
|
1169
|
+
* @param {Number} faceIndex - The face index.
|
|
1170
|
+
* @return {TypedArray} The texture data as a typed array.
|
|
1171
|
+
*/
|
|
849
1172
|
copyTextureToBuffer( texture, x, y, width, height, faceIndex ) {
|
|
850
1173
|
|
|
851
1174
|
return this.textureUtils.copyTextureToBuffer( texture, x, y, width, height, faceIndex );
|
|
852
1175
|
|
|
853
1176
|
}
|
|
854
1177
|
|
|
1178
|
+
/**
|
|
1179
|
+
* This method does nothing since WebGL 2 has no concept of samplers.
|
|
1180
|
+
*
|
|
1181
|
+
* @param {Texture} texture - The texture to create the sampler for.
|
|
1182
|
+
*/
|
|
855
1183
|
createSampler( /*texture*/ ) {
|
|
856
1184
|
|
|
857
1185
|
//console.warn( 'Abstract class.' );
|
|
858
1186
|
|
|
859
1187
|
}
|
|
860
1188
|
|
|
861
|
-
|
|
1189
|
+
/**
|
|
1190
|
+
* This method does nothing since WebGL 2 has no concept of samplers.
|
|
1191
|
+
*
|
|
1192
|
+
* @param {Texture} texture - The texture to destroy the sampler for.
|
|
1193
|
+
*/
|
|
1194
|
+
destroySampler( /*texture*/ ) {}
|
|
862
1195
|
|
|
863
1196
|
// node builder
|
|
864
1197
|
|
|
1198
|
+
/**
|
|
1199
|
+
* Returns a node builder for the given render object.
|
|
1200
|
+
*
|
|
1201
|
+
* @param {RenderObject} object - The render object.
|
|
1202
|
+
* @param {Renderer} renderer - The renderer.
|
|
1203
|
+
* @return {GLSLNodeBuilder} The node builder.
|
|
1204
|
+
*/
|
|
865
1205
|
createNodeBuilder( object, renderer ) {
|
|
866
1206
|
|
|
867
1207
|
return new GLSLNodeBuilder( object, renderer );
|
|
@@ -870,6 +1210,11 @@ class WebGLBackend extends Backend {
|
|
|
870
1210
|
|
|
871
1211
|
// program
|
|
872
1212
|
|
|
1213
|
+
/**
|
|
1214
|
+
* Creates a shader program from the given programmable stage.
|
|
1215
|
+
*
|
|
1216
|
+
* @param {ProgrammableStage} program - The programmable stage.
|
|
1217
|
+
*/
|
|
873
1218
|
createProgram( program ) {
|
|
874
1219
|
|
|
875
1220
|
const gl = this.gl;
|
|
@@ -886,12 +1231,23 @@ class WebGLBackend extends Backend {
|
|
|
886
1231
|
|
|
887
1232
|
}
|
|
888
1233
|
|
|
889
|
-
|
|
1234
|
+
/**
|
|
1235
|
+
* Destroys the shader program of the given programmable stage.
|
|
1236
|
+
*
|
|
1237
|
+
* @param {ProgrammableStage} program - The programmable stage.
|
|
1238
|
+
*/
|
|
1239
|
+
destroyProgram( program ) {
|
|
890
1240
|
|
|
891
|
-
|
|
1241
|
+
this.delete( program );
|
|
892
1242
|
|
|
893
1243
|
}
|
|
894
1244
|
|
|
1245
|
+
/**
|
|
1246
|
+
* Creates a render pipeline for the given render object.
|
|
1247
|
+
*
|
|
1248
|
+
* @param {RenderObject} renderObject - The render object.
|
|
1249
|
+
* @param {Array<Promise>} promises - An array of compilation promises which are used in `compileAsync()`.
|
|
1250
|
+
*/
|
|
895
1251
|
createRenderPipeline( renderObject, promises ) {
|
|
896
1252
|
|
|
897
1253
|
const gl = this.gl;
|
|
@@ -950,6 +1306,14 @@ class WebGLBackend extends Backend {
|
|
|
950
1306
|
|
|
951
1307
|
}
|
|
952
1308
|
|
|
1309
|
+
/**
|
|
1310
|
+
* Formats the source code of error messages.
|
|
1311
|
+
*
|
|
1312
|
+
* @private
|
|
1313
|
+
* @param {String} string - The code.
|
|
1314
|
+
* @param {Number} errorLine - The error line.
|
|
1315
|
+
* @return {String} The formatted code.
|
|
1316
|
+
*/
|
|
953
1317
|
_handleSource( string, errorLine ) {
|
|
954
1318
|
|
|
955
1319
|
const lines = string.split( '\n' );
|
|
@@ -969,6 +1333,15 @@ class WebGLBackend extends Backend {
|
|
|
969
1333
|
|
|
970
1334
|
}
|
|
971
1335
|
|
|
1336
|
+
/**
|
|
1337
|
+
* Gets the shader compilation errors from the info log.
|
|
1338
|
+
*
|
|
1339
|
+
* @private
|
|
1340
|
+
* @param {WebGL2RenderingContext} gl - The rendering context.
|
|
1341
|
+
* @param {WebGLShader} shader - The WebGL shader object.
|
|
1342
|
+
* @param {String} type - The shader type.
|
|
1343
|
+
* @return {String} The shader errors.
|
|
1344
|
+
*/
|
|
972
1345
|
_getShaderErrors( gl, shader, type ) {
|
|
973
1346
|
|
|
974
1347
|
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
|
|
@@ -990,6 +1363,14 @@ class WebGLBackend extends Backend {
|
|
|
990
1363
|
|
|
991
1364
|
}
|
|
992
1365
|
|
|
1366
|
+
/**
|
|
1367
|
+
* Logs shader compilation errors.
|
|
1368
|
+
*
|
|
1369
|
+
* @private
|
|
1370
|
+
* @param {WebGLProgram} programGPU - The WebGL program.
|
|
1371
|
+
* @param {WebGLShader} glFragmentShader - The fragment shader as a native WebGL shader object.
|
|
1372
|
+
* @param {WebGLShader} glVertexShader - The vertex shader as a native WebGL shader object.
|
|
1373
|
+
*/
|
|
993
1374
|
_logProgramError( programGPU, glFragmentShader, glVertexShader ) {
|
|
994
1375
|
|
|
995
1376
|
if ( this.renderer.debug.checkShaderErrors ) {
|
|
@@ -1032,6 +1413,13 @@ class WebGLBackend extends Backend {
|
|
|
1032
1413
|
|
|
1033
1414
|
}
|
|
1034
1415
|
|
|
1416
|
+
/**
|
|
1417
|
+
* Completes the shader program setup for the given render object.
|
|
1418
|
+
*
|
|
1419
|
+
* @private
|
|
1420
|
+
* @param {RenderObject} renderObject - The render object.
|
|
1421
|
+
* @param {RenderPipeline} pipeline - The render pipeline.
|
|
1422
|
+
*/
|
|
1035
1423
|
_completeCompile( renderObject, pipeline ) {
|
|
1036
1424
|
|
|
1037
1425
|
const { state, gl } = this;
|
|
@@ -1060,6 +1448,12 @@ class WebGLBackend extends Backend {
|
|
|
1060
1448
|
|
|
1061
1449
|
}
|
|
1062
1450
|
|
|
1451
|
+
/**
|
|
1452
|
+
* Creates a compute pipeline for the given compute node.
|
|
1453
|
+
*
|
|
1454
|
+
* @param {ComputePipeline} computePipeline - The compute pipeline.
|
|
1455
|
+
* @param {Array<BindGroup>} bindings - The bindings.
|
|
1456
|
+
*/
|
|
1063
1457
|
createComputePipeline( computePipeline, bindings ) {
|
|
1064
1458
|
|
|
1065
1459
|
const { state, gl } = this;
|
|
@@ -1154,7 +1548,15 @@ class WebGLBackend extends Backend {
|
|
|
1154
1548
|
|
|
1155
1549
|
}
|
|
1156
1550
|
|
|
1157
|
-
|
|
1551
|
+
/**
|
|
1552
|
+
* Creates bindings from the given bind group definition.
|
|
1553
|
+
*
|
|
1554
|
+
* @param {BindGroup} bindGroup - The bind group.
|
|
1555
|
+
* @param {Array<BindGroup>} bindings - Array of bind groups.
|
|
1556
|
+
* @param {Number} cacheIndex - The cache index.
|
|
1557
|
+
* @param {Number} version - The version.
|
|
1558
|
+
*/
|
|
1559
|
+
createBindings( bindGroup, bindings /*, cacheIndex, version*/ ) {
|
|
1158
1560
|
|
|
1159
1561
|
if ( this._knownBindings.has( bindings ) === false ) {
|
|
1160
1562
|
|
|
@@ -1185,7 +1587,15 @@ class WebGLBackend extends Backend {
|
|
|
1185
1587
|
|
|
1186
1588
|
}
|
|
1187
1589
|
|
|
1188
|
-
|
|
1590
|
+
/**
|
|
1591
|
+
* Updates the given bind group definition.
|
|
1592
|
+
*
|
|
1593
|
+
* @param {BindGroup} bindGroup - The bind group.
|
|
1594
|
+
* @param {Array<BindGroup>} bindings - Array of bind groups.
|
|
1595
|
+
* @param {Number} cacheIndex - The cache index.
|
|
1596
|
+
* @param {Number} version - The version.
|
|
1597
|
+
*/
|
|
1598
|
+
updateBindings( bindGroup /*, bindings, cacheIndex, version*/ ) {
|
|
1189
1599
|
|
|
1190
1600
|
const { gl } = this;
|
|
1191
1601
|
|
|
@@ -1225,6 +1635,11 @@ class WebGLBackend extends Backend {
|
|
|
1225
1635
|
|
|
1226
1636
|
}
|
|
1227
1637
|
|
|
1638
|
+
/**
|
|
1639
|
+
* Updates a buffer binding.
|
|
1640
|
+
*
|
|
1641
|
+
* @param {Buffer} binding - The buffer binding to update.
|
|
1642
|
+
*/
|
|
1228
1643
|
updateBinding( binding ) {
|
|
1229
1644
|
|
|
1230
1645
|
const gl = this.gl;
|
|
@@ -1244,6 +1659,11 @@ class WebGLBackend extends Backend {
|
|
|
1244
1659
|
|
|
1245
1660
|
// attributes
|
|
1246
1661
|
|
|
1662
|
+
/**
|
|
1663
|
+
* Creates the buffer of an indexed shader attribute.
|
|
1664
|
+
*
|
|
1665
|
+
* @param {BufferAttribute} attribute - The indexed buffer attribute.
|
|
1666
|
+
*/
|
|
1247
1667
|
createIndexAttribute( attribute ) {
|
|
1248
1668
|
|
|
1249
1669
|
const gl = this.gl;
|
|
@@ -1252,6 +1672,11 @@ class WebGLBackend extends Backend {
|
|
|
1252
1672
|
|
|
1253
1673
|
}
|
|
1254
1674
|
|
|
1675
|
+
/**
|
|
1676
|
+
* Creates the buffer of a shader attribute.
|
|
1677
|
+
*
|
|
1678
|
+
* @param {BufferAttribute} attribute - The buffer attribute.
|
|
1679
|
+
*/
|
|
1255
1680
|
createAttribute( attribute ) {
|
|
1256
1681
|
|
|
1257
1682
|
if ( this.has( attribute ) ) return;
|
|
@@ -1262,6 +1687,11 @@ class WebGLBackend extends Backend {
|
|
|
1262
1687
|
|
|
1263
1688
|
}
|
|
1264
1689
|
|
|
1690
|
+
/**
|
|
1691
|
+
* Creates the buffer of a storage attribute.
|
|
1692
|
+
*
|
|
1693
|
+
* @param {BufferAttribute} attribute - The buffer attribute.
|
|
1694
|
+
*/
|
|
1265
1695
|
createStorageAttribute( attribute ) {
|
|
1266
1696
|
|
|
1267
1697
|
if ( this.has( attribute ) ) return;
|
|
@@ -1272,24 +1702,34 @@ class WebGLBackend extends Backend {
|
|
|
1272
1702
|
|
|
1273
1703
|
}
|
|
1274
1704
|
|
|
1705
|
+
/**
|
|
1706
|
+
* Updates the buffer of a shader attribute.
|
|
1707
|
+
*
|
|
1708
|
+
* @param {BufferAttribute} attribute - The buffer attribute to update.
|
|
1709
|
+
*/
|
|
1275
1710
|
updateAttribute( attribute ) {
|
|
1276
1711
|
|
|
1277
1712
|
this.attributeUtils.updateAttribute( attribute );
|
|
1278
1713
|
|
|
1279
1714
|
}
|
|
1280
1715
|
|
|
1716
|
+
/**
|
|
1717
|
+
* Destroys the buffer of a shader attribute.
|
|
1718
|
+
*
|
|
1719
|
+
* @param {BufferAttribute} attribute - The buffer attribute to destroy.
|
|
1720
|
+
*/
|
|
1281
1721
|
destroyAttribute( attribute ) {
|
|
1282
1722
|
|
|
1283
1723
|
this.attributeUtils.destroyAttribute( attribute );
|
|
1284
1724
|
|
|
1285
1725
|
}
|
|
1286
1726
|
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1727
|
+
/**
|
|
1728
|
+
* Checks if the given feature is supported by the backend.
|
|
1729
|
+
*
|
|
1730
|
+
* @param {String} name - The feature's name.
|
|
1731
|
+
* @return {Boolean} Whether the feature is supported or not.
|
|
1732
|
+
*/
|
|
1293
1733
|
hasFeature( name ) {
|
|
1294
1734
|
|
|
1295
1735
|
const keysMatching = Object.keys( GLFeatureName ).filter( key => GLFeatureName[ key ] === name );
|
|
@@ -1306,24 +1746,51 @@ class WebGLBackend extends Backend {
|
|
|
1306
1746
|
|
|
1307
1747
|
}
|
|
1308
1748
|
|
|
1749
|
+
/**
|
|
1750
|
+
* Returns the maximum anisotropy texture filtering value.
|
|
1751
|
+
*
|
|
1752
|
+
* @return {Number} The maximum anisotropy texture filtering value.
|
|
1753
|
+
*/
|
|
1309
1754
|
getMaxAnisotropy() {
|
|
1310
1755
|
|
|
1311
1756
|
return this.capabilities.getMaxAnisotropy();
|
|
1312
1757
|
|
|
1313
1758
|
}
|
|
1314
1759
|
|
|
1315
|
-
|
|
1760
|
+
/**
|
|
1761
|
+
* Copies data of the given source texture to the given destination texture.
|
|
1762
|
+
*
|
|
1763
|
+
* @param {Texture} srcTexture - The source texture.
|
|
1764
|
+
* @param {Texture} dstTexture - The destination texture.
|
|
1765
|
+
* @param {Vector4?} [srcRegion=null] - The region of the source texture to copy.
|
|
1766
|
+
* @param {(Vector2|Vector3)?} [dstPosition=null] - The destination position of the copy.
|
|
1767
|
+
* @param {Number} [level=0] - The mip level to copy.
|
|
1768
|
+
*/
|
|
1769
|
+
copyTextureToTexture( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {
|
|
1316
1770
|
|
|
1317
1771
|
this.textureUtils.copyTextureToTexture( srcTexture, dstTexture, srcRegion, dstPosition, level );
|
|
1318
1772
|
|
|
1319
1773
|
}
|
|
1320
1774
|
|
|
1775
|
+
/**
|
|
1776
|
+
* Copies the current bound framebuffer to the given texture.
|
|
1777
|
+
*
|
|
1778
|
+
* @param {Texture} texture - The destination texture.
|
|
1779
|
+
* @param {RenderContext} renderContext - The render context.
|
|
1780
|
+
* @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy.
|
|
1781
|
+
*/
|
|
1321
1782
|
copyFramebufferToTexture( texture, renderContext, rectangle ) {
|
|
1322
1783
|
|
|
1323
1784
|
this.textureUtils.copyFramebufferToTexture( texture, renderContext, rectangle );
|
|
1324
1785
|
|
|
1325
1786
|
}
|
|
1326
1787
|
|
|
1788
|
+
/**
|
|
1789
|
+
* Configures the active framebuffer from the given render context.
|
|
1790
|
+
*
|
|
1791
|
+
* @private
|
|
1792
|
+
* @param {RenderContext} descriptor - The render context.
|
|
1793
|
+
*/
|
|
1327
1794
|
_setFramebuffer( descriptor ) {
|
|
1328
1795
|
|
|
1329
1796
|
const { gl, state } = this;
|
|
@@ -1337,6 +1804,8 @@ class WebGLBackend extends Backend {
|
|
|
1337
1804
|
const { samples, depthBuffer, stencilBuffer } = renderTarget;
|
|
1338
1805
|
|
|
1339
1806
|
const isCube = renderTarget.isWebGLCubeRenderTarget === true;
|
|
1807
|
+
const isRenderTarget3D = renderTarget.isRenderTarget3D === true;
|
|
1808
|
+
const isRenderTargetArray = renderTarget.isRenderTargetArray === true;
|
|
1340
1809
|
|
|
1341
1810
|
let msaaFb = renderTargetContextData.msaaFrameBuffer;
|
|
1342
1811
|
let depthRenderbuffer = renderTargetContextData.depthRenderbuffer;
|
|
@@ -1390,7 +1859,19 @@ class WebGLBackend extends Backend {
|
|
|
1390
1859
|
|
|
1391
1860
|
const attachment = gl.COLOR_ATTACHMENT0 + i;
|
|
1392
1861
|
|
|
1393
|
-
|
|
1862
|
+
if ( isRenderTarget3D || isRenderTargetArray ) {
|
|
1863
|
+
|
|
1864
|
+
const layer = this.renderer._activeCubeFace;
|
|
1865
|
+
|
|
1866
|
+
gl.framebufferTextureLayer( gl.FRAMEBUFFER, attachment, textureData.textureGPU, 0, layer );
|
|
1867
|
+
|
|
1868
|
+
} else {
|
|
1869
|
+
|
|
1870
|
+
gl.framebufferTexture2D( gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, textureData.textureGPU, 0 );
|
|
1871
|
+
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
|
|
1394
1875
|
|
|
1395
1876
|
}
|
|
1396
1877
|
|
|
@@ -1482,10 +1963,17 @@ class WebGLBackend extends Backend {
|
|
|
1482
1963
|
|
|
1483
1964
|
}
|
|
1484
1965
|
|
|
1485
|
-
|
|
1966
|
+
/**
|
|
1967
|
+
* Computes the VAO key for the given index and attributes.
|
|
1968
|
+
*
|
|
1969
|
+
* @private
|
|
1970
|
+
* @param {BufferAttribute?} index - The index. `null` for non-indexed geometries.
|
|
1971
|
+
* @param {Array<BufferAttribute>} attributes - An array of buffer attributes.
|
|
1972
|
+
* @return {String} The VAO key.
|
|
1973
|
+
*/
|
|
1486
1974
|
_getVaoKey( index, attributes ) {
|
|
1487
1975
|
|
|
1488
|
-
let key =
|
|
1976
|
+
let key = '';
|
|
1489
1977
|
|
|
1490
1978
|
if ( index !== null ) {
|
|
1491
1979
|
|
|
@@ -1507,6 +1995,14 @@ class WebGLBackend extends Backend {
|
|
|
1507
1995
|
|
|
1508
1996
|
}
|
|
1509
1997
|
|
|
1998
|
+
/**
|
|
1999
|
+
* Creates a VAO from the index and attributes.
|
|
2000
|
+
*
|
|
2001
|
+
* @private
|
|
2002
|
+
* @param {BufferAttribute?} index - The index. `null` for non-indexed geometries.
|
|
2003
|
+
* @param {Array<BufferAttribute>} attributes - An array of buffer attributes.
|
|
2004
|
+
* @return {Object} The VAO data.
|
|
2005
|
+
*/
|
|
1510
2006
|
_createVao( index, attributes ) {
|
|
1511
2007
|
|
|
1512
2008
|
const { gl } = this;
|
|
@@ -1584,6 +2080,13 @@ class WebGLBackend extends Backend {
|
|
|
1584
2080
|
|
|
1585
2081
|
}
|
|
1586
2082
|
|
|
2083
|
+
/**
|
|
2084
|
+
* Creates a tranform feedback from the given transform buffers.
|
|
2085
|
+
*
|
|
2086
|
+
* @private
|
|
2087
|
+
* @param {Array<DualAttributeData>} transformBuffers - The tranform buffers.
|
|
2088
|
+
* @return {WebGLTransformFeedback} The tranform feedback.
|
|
2089
|
+
*/
|
|
1587
2090
|
_getTransformFeedback( transformBuffers ) {
|
|
1588
2091
|
|
|
1589
2092
|
let key = '';
|
|
@@ -1624,7 +2127,13 @@ class WebGLBackend extends Backend {
|
|
|
1624
2127
|
|
|
1625
2128
|
}
|
|
1626
2129
|
|
|
1627
|
-
|
|
2130
|
+
/**
|
|
2131
|
+
* Setups the given bindings.
|
|
2132
|
+
*
|
|
2133
|
+
* @private
|
|
2134
|
+
* @param {Array<BindGroup>} bindings - The bindings.
|
|
2135
|
+
* @param {WebGLProgram} programGPU - The WebGL program.
|
|
2136
|
+
*/
|
|
1628
2137
|
_setupBindings( bindings, programGPU ) {
|
|
1629
2138
|
|
|
1630
2139
|
const gl = this.gl;
|
|
@@ -1654,6 +2163,12 @@ class WebGLBackend extends Backend {
|
|
|
1654
2163
|
|
|
1655
2164
|
}
|
|
1656
2165
|
|
|
2166
|
+
/**
|
|
2167
|
+
* Binds the given uniforms.
|
|
2168
|
+
*
|
|
2169
|
+
* @private
|
|
2170
|
+
* @param {Array<BindGroup>} bindings - The bindings.
|
|
2171
|
+
*/
|
|
1657
2172
|
_bindUniforms( bindings ) {
|
|
1658
2173
|
|
|
1659
2174
|
const { gl, state } = this;
|
|
@@ -1682,6 +2197,9 @@ class WebGLBackend extends Backend {
|
|
|
1682
2197
|
|
|
1683
2198
|
}
|
|
1684
2199
|
|
|
2200
|
+
/**
|
|
2201
|
+
* Frees internal resources.
|
|
2202
|
+
*/
|
|
1685
2203
|
dispose() {
|
|
1686
2204
|
|
|
1687
2205
|
this.renderer.domElement.removeEventListener( 'webglcontextlost', this._onContextLost );
|