@needle-tools/three 0.162.12 → 0.169.2
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 +3 -3
- package/build/three.cjs +29789 -1941
- package/build/three.module.js +29095 -1933
- package/build/three.module.min.js +2 -2
- package/build/three.webgpu.js +80003 -0
- package/build/three.webgpu.min.js +6 -0
- package/build/three.webgpu.nodes.js +79951 -0
- package/build/three.webgpu.nodes.min.js +6 -0
- package/examples/jsm/Addons.js +2 -5
- package/examples/jsm/animation/AnimationClipCreator.js +1 -1
- package/examples/jsm/animation/CCDIKSolver.js +4 -2
- package/examples/jsm/capabilities/WebGL.js +27 -21
- package/examples/jsm/controls/ArcballControls.js +174 -158
- package/examples/jsm/controls/DragControls.js +260 -132
- package/examples/jsm/controls/FirstPersonControls.js +175 -163
- package/examples/jsm/controls/FlyControls.js +194 -188
- package/examples/jsm/controls/OrbitControls.js +790 -797
- package/examples/jsm/controls/PointerLockControls.js +24 -15
- package/examples/jsm/controls/TrackballControls.js +469 -448
- package/examples/jsm/controls/TransformControls.js +98 -63
- package/examples/jsm/csm/CSMShader.js +4 -4
- package/examples/jsm/effects/AnaglyphEffect.js +6 -13
- package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
- package/examples/jsm/effects/StereoEffect.js +6 -1
- package/examples/jsm/environments/RoomEnvironment.js +2 -6
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +19 -11
- package/examples/jsm/exporters/GLTFExporter.js +77 -8
- package/examples/jsm/exporters/KTX2Exporter.js +21 -13
- package/examples/jsm/exporters/OBJExporter.js +5 -1
- package/examples/jsm/exporters/PLYExporter.js +9 -7
- package/examples/jsm/exporters/USDZExporter.js +55 -11
- package/examples/jsm/geometries/DecalGeometry.js +4 -1
- package/examples/jsm/geometries/InstancedPointsGeometry.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +1 -1
- package/examples/jsm/geometries/TextGeometry.js +10 -2
- package/examples/jsm/helpers/LightProbeHelper.js +43 -44
- package/examples/jsm/helpers/LightProbeHelperGPU.js +65 -0
- package/examples/jsm/helpers/ViewHelper.js +75 -61
- package/examples/jsm/interactive/HTMLMesh.js +7 -9
- package/examples/jsm/libs/basis/basis_transcoder.js +8 -10
- package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
- package/examples/jsm/libs/draco/README.md +2 -2
- package/examples/jsm/libs/fflate.module.js +694 -496
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/lights/LightProbeGenerator.js +24 -10
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
- package/examples/jsm/lines/LineMaterial.js +1 -17
- package/examples/jsm/lines/LineSegments2.js +15 -0
- package/examples/jsm/lines/Wireframe.js +16 -1
- package/examples/jsm/lines/webgpu/Line2.js +20 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
- package/examples/jsm/loaders/3MFLoader.js +2 -0
- package/examples/jsm/loaders/ColladaLoader.js +9 -6
- package/examples/jsm/loaders/DRACOLoader.js +4 -2
- package/examples/jsm/loaders/EXRLoader.js +351 -97
- package/examples/jsm/loaders/FBXLoader.js +77 -78
- package/examples/jsm/loaders/GLTFLoader.js +76 -14
- package/examples/jsm/loaders/KTX2Loader.js +30 -22
- package/examples/jsm/loaders/LDrawLoader.js +3 -2
- package/examples/jsm/loaders/LUT3dlLoader.js +0 -15
- package/examples/jsm/loaders/LUTCubeLoader.js +0 -14
- package/examples/jsm/loaders/LUTImageLoader.js +0 -14
- package/examples/jsm/loaders/MMDLoader.js +31 -12
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +45 -21
- package/examples/jsm/loaders/OBJLoader.js +5 -3
- package/examples/jsm/loaders/PCDLoader.js +14 -13
- package/examples/jsm/loaders/PDBLoader.js +3 -2
- package/examples/jsm/loaders/PLYLoader.js +8 -5
- package/examples/jsm/loaders/RGBMLoader.js +16 -0
- package/examples/jsm/loaders/STLLoader.js +3 -2
- package/examples/jsm/loaders/USDZLoader.js +124 -76
- package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
- package/examples/jsm/loaders/VRMLLoader.js +11 -11
- package/examples/jsm/loaders/VTKLoader.js +80 -6
- package/examples/jsm/loaders/XYZLoader.js +3 -2
- package/examples/jsm/loaders/lwo/IFFParser.js +8 -5
- package/examples/jsm/materials/MeshGouraudMaterial.js +7 -1
- package/examples/jsm/math/Octree.js +26 -20
- package/examples/jsm/misc/GPUComputationRenderer.js +9 -25
- package/examples/jsm/misc/Timer.js +1 -1
- package/examples/jsm/modifiers/CurveModifier.js +11 -9
- package/examples/jsm/modifiers/CurveModifierGPU.js +233 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
- package/examples/jsm/objects/InstancedPoints.js +2 -2
- package/examples/jsm/objects/Lensflare.js +2 -2
- package/examples/jsm/objects/LensflareMesh.js +322 -0
- package/examples/jsm/objects/SkyMesh.js +187 -0
- package/examples/jsm/objects/Water2Mesh.js +158 -0
- package/examples/jsm/objects/WaterMesh.js +101 -0
- package/examples/jsm/physics/JoltPhysics.js +281 -0
- package/examples/jsm/physics/RapierPhysics.js +25 -5
- package/examples/jsm/postprocessing/GlitchPass.js +0 -3
- package/examples/jsm/postprocessing/LUTPass.js +5 -71
- package/examples/jsm/postprocessing/OutlinePass.js +31 -46
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +168 -0
- package/examples/jsm/postprocessing/SAOPass.js +0 -1
- package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
- package/examples/jsm/postprocessing/SSAOPass.js +6 -12
- package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -4
- package/examples/jsm/renderers/CSS2DRenderer.js +25 -5
- package/examples/jsm/renderers/CSS3DRenderer.js +24 -3
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +1 -3
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +7 -4
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +19 -5
- package/examples/jsm/shaders/BleachBypassShader.js +1 -2
- package/examples/jsm/shaders/ColorifyShader.js +1 -2
- package/examples/jsm/shaders/FXAAShader.js +0 -2
- package/examples/jsm/shaders/GTAOShader.js +1 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +1 -3
- package/examples/jsm/shaders/OutputShader.js +1 -1
- package/examples/jsm/transpiler/GLSLDecoder.js +47 -5
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -2
- package/examples/jsm/transpiler/TSLEncoder.js +24 -22
- package/examples/jsm/utils/BufferGeometryUtils.js +18 -16
- package/examples/jsm/utils/GeometryCompressionUtils.js +37 -122
- package/examples/jsm/utils/SceneUtils.js +60 -1
- package/examples/jsm/utils/ShadowMapViewer.js +3 -8
- package/examples/jsm/utils/ShadowMapViewerGPU.js +201 -0
- package/examples/jsm/utils/SkeletonUtils.js +84 -66
- package/examples/jsm/utils/SortUtils.js +8 -5
- package/examples/jsm/utils/TextureUtils.js +3 -2
- package/examples/jsm/utils/TextureUtilsGPU.js +63 -0
- package/examples/jsm/webxr/OculusHandModel.js +3 -2
- package/examples/jsm/webxr/XRControllerModelFactory.js +1 -1
- package/examples/jsm/webxr/XRHandModelFactory.js +4 -2
- package/package.json +11 -8
- package/src/Three.WebGPU.Nodes.js +200 -0
- package/src/Three.WebGPU.js +201 -0
- package/src/Three.js +23 -1
- package/src/animation/AnimationClip.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +10 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -2
- package/src/animation/tracks/StringKeyframeTrack.js +10 -1
- package/src/audio/Audio.js +2 -2
- package/src/constants.js +6 -7
- package/src/core/BufferAttribute.js +0 -9
- package/src/core/Clock.js +1 -1
- package/src/core/InterleavedBuffer.js +0 -9
- package/src/core/Object3D.js +34 -29
- package/src/core/Raycaster.js +6 -2
- package/src/core/RenderTarget.js +8 -0
- package/src/extras/Controls.js +32 -0
- package/src/extras/PMREMGenerator.js +12 -11
- package/src/extras/TextureUtils.js +210 -0
- package/src/geometries/CylinderGeometry.js +11 -4
- package/src/lights/Light.js +1 -0
- package/src/lights/LightShadow.js +5 -0
- package/{examples/jsm/lights → src/lights/webgpu}/IESSpotLight.js +1 -1
- package/src/loaders/FileLoader.js +5 -1
- package/src/loaders/LoaderUtils.js +3 -1
- package/src/loaders/MaterialLoader.js +8 -1
- package/src/loaders/ObjectLoader.js +36 -2
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeLoader.js +27 -5
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeMaterialLoader.js +22 -18
- package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeObjectLoader.js +21 -1
- package/src/materials/Material.js +4 -0
- package/src/materials/MeshPhysicalMaterial.js +20 -0
- package/src/materials/ShaderMaterial.js +0 -4
- package/src/materials/nodes/InstancedPointsNodeMaterial.js +156 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/Line2NodeMaterial.js +69 -68
- package/src/materials/nodes/LineBasicNodeMaterial.js +31 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/LineDashedNodeMaterial.js +15 -12
- package/src/materials/nodes/MeshBasicNodeMaterial.js +77 -0
- package/src/materials/nodes/MeshLambertNodeMaterial.js +47 -0
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +57 -0
- package/src/materials/nodes/MeshNormalNodeMaterial.js +44 -0
- package/src/materials/nodes/MeshPhongNodeMaterial.js +78 -0
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +248 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshSSSNodeMaterial.js +10 -7
- package/src/materials/nodes/MeshStandardNodeMaterial.js +108 -0
- package/src/materials/nodes/MeshToonNodeMaterial.js +38 -0
- package/{examples/jsm/nodes/materials → src/materials/nodes}/NodeMaterial.js +198 -157
- package/{examples/jsm/nodes/materials/Materials.js → src/materials/nodes/NodeMaterials.js} +7 -1
- package/{examples/jsm/nodes/materials → src/materials/nodes}/PointsNodeMaterial.js +10 -7
- package/src/materials/nodes/ShadowNodeMaterial.js +38 -0
- package/src/materials/nodes/SpriteNodeMaterial.js +123 -0
- package/src/materials/nodes/VolumeNodeMaterial.js +108 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +302 -0
- package/src/math/Box2.js +4 -4
- package/src/math/Box3.js +6 -6
- package/src/math/ColorManagement.js +10 -0
- package/src/math/Matrix2.js +54 -0
- package/src/math/Spherical.js +4 -5
- package/src/math/Triangle.js +24 -0
- package/src/math/Vector4.js +13 -0
- package/src/nodes/Nodes.js +164 -0
- package/src/nodes/TSL.js +179 -0
- package/src/nodes/accessors/AccessorsUtils.js +25 -0
- package/src/nodes/accessors/BatchNode.js +128 -0
- package/src/nodes/accessors/Bitangent.js +13 -0
- package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +44 -6
- package/{examples/jsm → src}/nodes/accessors/BufferNode.js +13 -4
- package/src/nodes/accessors/Camera.js +13 -0
- package/{examples/jsm → src}/nodes/accessors/ClippingNode.js +22 -15
- package/src/nodes/accessors/CubeTextureNode.js +79 -0
- package/src/nodes/accessors/InstanceNode.js +144 -0
- package/src/nodes/accessors/InstancedPointsMaterialNode.js +24 -0
- package/src/nodes/accessors/Lights.js +51 -0
- package/src/nodes/accessors/MaterialNode.js +441 -0
- package/src/nodes/accessors/MaterialProperties.js +3 -0
- package/{examples/jsm → src}/nodes/accessors/MaterialReferenceNode.js +10 -5
- package/src/nodes/accessors/ModelNode.js +72 -0
- package/src/nodes/accessors/ModelViewProjectionNode.js +42 -0
- package/{examples/jsm → src}/nodes/accessors/MorphNode.js +51 -33
- package/src/nodes/accessors/Normal.js +88 -0
- package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +18 -34
- package/src/nodes/accessors/PointUVNode.js +30 -0
- package/src/nodes/accessors/Position.js +10 -0
- package/src/nodes/accessors/ReferenceBaseNode.js +171 -0
- package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +58 -9
- package/src/nodes/accessors/ReflectVector.js +10 -0
- package/src/nodes/accessors/RendererReferenceNode.js +35 -0
- package/{examples/jsm → src}/nodes/accessors/SceneNode.js +9 -6
- package/src/nodes/accessors/SkinningNode.js +191 -0
- package/src/nodes/accessors/StorageBufferNode.js +147 -0
- package/{examples/jsm/nodes/accessors/TextureStoreNode.js → src/nodes/accessors/StorageTextureNode.js} +35 -10
- package/src/nodes/accessors/Tangent.js +22 -0
- package/src/nodes/accessors/Texture3DNode.js +103 -0
- package/{examples/jsm/nodes/accessors/TextureBicubicNode.js → src/nodes/accessors/TextureBicubic.js} +3 -32
- package/{examples/jsm → src}/nodes/accessors/TextureNode.js +123 -39
- package/src/nodes/accessors/TextureSizeNode.js +36 -0
- package/src/nodes/accessors/UV.js +3 -0
- package/{examples/jsm/nodes/accessors/UniformsNode.js → src/nodes/accessors/UniformArrayNode.js} +33 -15
- package/{examples/jsm → src}/nodes/accessors/UserDataNode.js +10 -7
- package/src/nodes/accessors/VelocityNode.js +134 -0
- package/{examples/jsm → src}/nodes/accessors/VertexColorNode.js +9 -5
- package/{examples/jsm → src}/nodes/code/CodeNode.js +9 -5
- package/{examples/jsm → src}/nodes/code/ExpressionNode.js +10 -6
- package/{examples/jsm → src}/nodes/code/FunctionCallNode.js +8 -5
- package/{examples/jsm → src}/nodes/code/FunctionNode.js +8 -31
- package/{examples/jsm → src}/nodes/code/ScriptableNode.js +24 -7
- package/{examples/jsm → src}/nodes/code/ScriptableValueNode.js +11 -8
- package/{examples/jsm → src}/nodes/core/AssignNode.js +12 -9
- package/{examples/jsm → src}/nodes/core/AttributeNode.js +29 -12
- package/{examples/jsm → src}/nodes/core/BypassNode.js +11 -7
- package/src/nodes/core/CacheNode.js +50 -0
- package/{examples/jsm → src}/nodes/core/ConstNode.js +6 -3
- package/{examples/jsm → src}/nodes/core/ContextNode.js +27 -11
- package/src/nodes/core/IndexNode.js +99 -0
- package/{examples/jsm → src}/nodes/core/InputNode.js +7 -3
- package/{examples/jsm → src}/nodes/core/LightingModel.js +2 -2
- package/src/nodes/core/MRTNode.js +85 -0
- package/{examples/jsm → src}/nodes/core/Node.js +114 -57
- package/{examples/jsm → src}/nodes/core/NodeBuilder.js +327 -90
- package/src/nodes/core/NodeCache.js +36 -0
- package/{examples/jsm → src}/nodes/core/NodeFrame.js +52 -10
- package/{examples/jsm → src}/nodes/core/NodeFunction.js +2 -2
- package/{examples/jsm → src}/nodes/core/NodeUniform.js +1 -2
- package/{examples/jsm → src}/nodes/core/NodeUtils.js +56 -8
- package/{examples/jsm → src}/nodes/core/OutputStructNode.js +13 -12
- package/{examples/jsm → src}/nodes/core/ParameterNode.js +7 -4
- package/src/nodes/core/PropertyNode.js +88 -0
- package/{examples/jsm → src}/nodes/core/StackNode.js +31 -11
- package/{examples/jsm → src}/nodes/core/StructTypeNode.js +7 -3
- package/{examples/jsm → src}/nodes/core/TempNode.js +10 -6
- package/src/nodes/core/UniformGroupNode.js +59 -0
- package/{examples/jsm → src}/nodes/core/UniformNode.js +37 -5
- package/{examples/jsm → src}/nodes/core/VarNode.js +14 -14
- package/src/nodes/core/VaryingNode.js +108 -0
- package/{examples/jsm → src}/nodes/display/AfterImageNode.js +38 -28
- package/src/nodes/display/AnaglyphPassNode.js +67 -0
- package/{examples/jsm → src}/nodes/display/AnamorphicNode.js +33 -30
- package/src/nodes/display/BleachBypass.js +26 -0
- package/src/nodes/display/BlendMode.js +54 -0
- package/src/nodes/display/BloomNode.js +341 -0
- package/{examples/jsm → src}/nodes/display/BumpMapNode.js +20 -38
- package/src/nodes/display/ColorAdjustment.js +46 -0
- package/src/nodes/display/ColorSpaceFunctions.js +38 -0
- package/src/nodes/display/ColorSpaceNode.js +114 -0
- package/src/nodes/display/DenoiseNode.js +204 -0
- package/src/nodes/display/DepthOfFieldNode.js +124 -0
- package/src/nodes/display/DotScreenNode.js +66 -0
- package/src/nodes/display/FXAANode.js +332 -0
- package/src/nodes/display/FilmNode.js +56 -0
- package/src/nodes/display/FrontFacingNode.js +45 -0
- package/src/nodes/display/GTAONode.js +331 -0
- package/{examples/jsm → src}/nodes/display/GaussianBlurNode.js +47 -24
- package/src/nodes/display/Lut3DNode.js +57 -0
- package/src/nodes/display/MotionBlur.js +25 -0
- package/{examples/jsm → src}/nodes/display/NormalMapNode.js +14 -14
- package/src/nodes/display/ParallaxBarrierPassNode.js +58 -0
- package/src/nodes/display/PassNode.js +378 -0
- package/src/nodes/display/PixelationPassNode.js +213 -0
- package/{examples/jsm → src}/nodes/display/PosterizeNode.js +8 -7
- package/src/nodes/display/RGBShiftNode.js +53 -0
- package/src/nodes/display/RenderOutputNode.js +60 -0
- package/src/nodes/display/SSAAPassNode.js +287 -0
- package/src/nodes/display/ScreenNode.js +181 -0
- package/src/nodes/display/Sepia.js +17 -0
- package/src/nodes/display/SobelOperatorNode.js +126 -0
- package/src/nodes/display/StereoCompositePassNode.js +110 -0
- package/src/nodes/display/StereoPassNode.js +83 -0
- package/src/nodes/display/ToneMappingFunctions.js +190 -0
- package/src/nodes/display/ToneMappingNode.js +67 -0
- package/src/nodes/display/ToonOutlinePassNode.js +111 -0
- package/src/nodes/display/TransitionNode.js +80 -0
- package/src/nodes/display/ViewportDepthNode.js +125 -0
- package/src/nodes/display/ViewportDepthTextureNode.js +33 -0
- package/src/nodes/display/ViewportSharedTextureNode.js +39 -0
- package/{examples/jsm → src}/nodes/display/ViewportTextureNode.js +20 -14
- package/src/nodes/fog/FogExp2Node.js +35 -0
- package/src/nodes/fog/FogNode.js +50 -0
- package/src/nodes/fog/FogRangeNode.js +36 -0
- package/src/nodes/functions/BSDF/BRDF_GGX.js +59 -0
- package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
- package/{examples/jsm → src}/nodes/functions/BSDF/DFGApprox.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX.js +2 -2
- package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
- package/{examples/jsm → src}/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/F_Schlick.js +2 -2
- package/src/nodes/functions/BSDF/LTC.js +131 -0
- package/{examples/jsm → src}/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
- package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -4
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
- package/src/nodes/functions/BasicLightingModel.js +78 -0
- package/{examples/jsm → src}/nodes/functions/PhongLightingModel.js +11 -9
- package/src/nodes/functions/PhysicalLightingModel.js +633 -0
- package/src/nodes/functions/ShadowMaskModel.js +31 -0
- package/src/nodes/functions/ToonLightingModel.js +51 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +13 -0
- package/{examples/jsm → src}/nodes/functions/material/getRoughness.js +2 -2
- package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
- package/{examples/jsm → src}/nodes/geometry/RangeNode.js +28 -11
- package/src/nodes/gpgpu/AtomicFunctionNode.js +99 -0
- package/src/nodes/gpgpu/BarrierNode.js +40 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +98 -0
- package/{examples/jsm → src}/nodes/gpgpu/ComputeNode.js +10 -6
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +100 -0
- package/src/nodes/lighting/AONode.js +27 -0
- package/{examples/jsm → src}/nodes/lighting/AmbientLightNode.js +6 -8
- package/src/nodes/lighting/AnalyticLightNode.js +522 -0
- package/src/nodes/lighting/BasicEnvironmentNode.js +30 -0
- package/src/nodes/lighting/BasicLightMapNode.js +32 -0
- package/{examples/jsm → src}/nodes/lighting/DirectionalLightNode.js +7 -9
- package/src/nodes/lighting/EnvironmentNode.js +138 -0
- package/{examples/jsm → src}/nodes/lighting/HemisphereLightNode.js +12 -11
- package/{examples/jsm → src}/nodes/lighting/IESSpotLightNode.js +7 -9
- package/src/nodes/lighting/IrradianceNode.js +27 -0
- package/src/nodes/lighting/LightProbeNode.js +53 -0
- package/{examples/jsm → src}/nodes/lighting/LightUtils.js +3 -3
- package/src/nodes/lighting/LightingContextNode.js +67 -0
- package/{examples/jsm → src}/nodes/lighting/LightingNode.js +9 -3
- package/src/nodes/lighting/LightsNode.js +250 -0
- package/{examples/jsm → src}/nodes/lighting/PointLightNode.js +12 -13
- package/src/nodes/lighting/RectAreaLightNode.js +97 -0
- package/{examples/jsm → src}/nodes/lighting/SpotLightNode.js +14 -16
- package/{examples/jsm → src}/nodes/materialx/MaterialXNodes.js +2 -2
- package/src/nodes/materialx/lib/mx_hsv.js +127 -0
- package/{examples/jsm → src}/nodes/materialx/lib/mx_noise.js +500 -603
- package/{examples/jsm → src}/nodes/materialx/lib/mx_transform_color.js +3 -9
- package/{examples/jsm/nodes/math/CondNode.js → src/nodes/math/ConditionalNode.js} +48 -13
- package/src/nodes/math/Hash.js +13 -0
- package/src/nodes/math/MathNode.js +407 -0
- package/{examples/jsm → src}/nodes/math/MathUtils.js +0 -7
- package/src/nodes/math/OperatorNode.js +319 -0
- package/{examples/jsm → src}/nodes/math/TriNoise3D.js +19 -29
- package/{examples/jsm → src}/nodes/parsers/GLSLNodeFunction.js +7 -7
- package/src/nodes/pmrem/PMREMNode.js +240 -0
- package/src/nodes/pmrem/PMREMUtils.js +288 -0
- package/src/nodes/procedural/Checker.js +14 -0
- package/src/nodes/tsl/TSLBase.js +30 -0
- package/{examples/jsm/nodes/shadernode/ShaderNode.js → src/nodes/tsl/TSLCore.js} +122 -96
- package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +9 -5
- package/{examples/jsm → src}/nodes/utils/ConvertNode.js +7 -3
- package/src/nodes/utils/CubeMapNode.js +160 -0
- package/src/nodes/utils/Discard.js +8 -0
- package/src/nodes/utils/EquirectUVNode.js +36 -0
- package/src/nodes/utils/FlipNode.js +68 -0
- package/{examples/jsm → src}/nodes/utils/FunctionOverloadingNode.js +11 -5
- package/{examples/jsm → src}/nodes/utils/JoinNode.js +6 -3
- package/{examples/jsm → src}/nodes/utils/LoopNode.js +23 -12
- package/src/nodes/utils/MatcapUVNode.js +33 -0
- package/{examples/jsm → src}/nodes/utils/MaxMipLevelNode.js +16 -7
- package/{examples/jsm → src}/nodes/utils/OscNode.js +12 -8
- package/src/nodes/utils/Packing.js +4 -0
- package/src/nodes/utils/RTTNode.js +133 -0
- package/{examples/jsm → src}/nodes/utils/ReflectorNode.js +21 -5
- package/{examples/jsm → src}/nodes/utils/RemapNode.js +12 -8
- package/{examples/jsm → src}/nodes/utils/RotateNode.js +8 -13
- package/{examples/jsm → src}/nodes/utils/SetNode.js +7 -4
- package/{examples/jsm → src}/nodes/utils/SplitNode.js +7 -3
- package/{examples/jsm → src}/nodes/utils/SpriteSheetUVNode.js +10 -6
- package/src/nodes/utils/SpriteUtils.js +47 -0
- package/{examples/jsm → src}/nodes/utils/StorageArrayElementNode.js +11 -12
- package/{examples/jsm → src}/nodes/utils/TimerNode.js +8 -5
- package/{examples/jsm → src}/nodes/utils/TriplanarTexturesNode.js +11 -9
- package/src/nodes/utils/UVUtils.js +19 -0
- package/src/nodes/utils/ViewportUtils.js +14 -0
- package/src/objects/BatchedMesh.js +302 -144
- package/src/objects/InstancedMesh.js +11 -1
- package/src/objects/LOD.js +21 -0
- package/src/objects/Line.js +67 -43
- package/src/objects/Mesh.js +7 -23
- package/src/objects/Points.js +2 -0
- package/src/renderers/WebGLRenderer.js +473 -224
- package/{examples/jsm → src}/renderers/common/Animation.js +3 -0
- package/{examples/jsm → src}/renderers/common/Attributes.js +4 -1
- package/{examples/jsm → src}/renderers/common/Backend.js +30 -27
- package/{examples/jsm → src}/renderers/common/Background.js +18 -10
- package/src/renderers/common/BindGroup.js +18 -0
- package/src/renderers/common/Bindings.js +203 -0
- package/src/renderers/common/BundleGroup.js +26 -0
- package/src/renderers/common/ChainMap.js +59 -0
- package/{examples/jsm → src}/renderers/common/ClippingContext.js +24 -12
- package/{examples/jsm → src}/renderers/common/Color4.js +1 -1
- package/{examples/jsm → src}/renderers/common/CubeRenderTarget.js +16 -4
- package/{examples/jsm → src}/renderers/common/Geometries.js +37 -5
- package/{examples/jsm → src}/renderers/common/Info.js +35 -15
- package/{examples/jsm → src}/renderers/common/Pipelines.js +2 -2
- package/src/renderers/common/PostProcessing.js +90 -0
- package/src/renderers/common/QuadMesh.js +55 -0
- package/src/renderers/common/RenderBundle.js +18 -0
- package/src/renderers/common/RenderBundles.js +38 -0
- package/{examples/jsm → src}/renderers/common/RenderContext.js +25 -2
- package/{examples/jsm → src}/renderers/common/RenderContexts.js +1 -1
- package/{examples/jsm → src}/renderers/common/RenderList.js +11 -2
- package/src/renderers/common/RenderObject.js +413 -0
- package/{examples/jsm → src}/renderers/common/RenderObjects.js +9 -2
- package/{examples/jsm → src}/renderers/common/Renderer.js +431 -83
- package/{examples/jsm → src}/renderers/common/SampledTexture.js +14 -5
- package/{examples/jsm → src}/renderers/common/StorageBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageInstancedBufferAttribute.js +1 -1
- package/{examples/jsm → src}/renderers/common/StorageTexture.js +2 -1
- package/{examples/jsm → src}/renderers/common/Textures.js +15 -15
- package/{examples/jsm → src}/renderers/common/Uniform.js +10 -5
- package/{examples/jsm → src}/renderers/common/UniformsGroup.js +69 -31
- package/src/renderers/common/extras/PMREMGenerator.js +771 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
- package/src/renderers/common/nodes/NodeLibrary.js +118 -0
- package/src/renderers/common/nodes/NodeSampledTexture.js +64 -0
- package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +8 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeStorageBuffer.js +5 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniform.js +3 -3
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformBuffer.js +2 -1
- package/{examples/jsm → src}/renderers/common/nodes/NodeUniformsGroup.js +2 -8
- package/{examples/jsm → src}/renderers/common/nodes/Nodes.js +106 -68
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +31 -1
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +9 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -10
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +8 -22
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -0
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +2 -10
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +2 -16
- package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +3 -14
- package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +10 -31
- package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +3 -23
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +45 -13
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +38 -25
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +3 -0
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +19 -11
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +47 -13
- package/src/renderers/shaders/ShaderChunk.js +0 -2
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +8 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
- package/src/renderers/shaders/ShaderLib/sprite.glsl.js +2 -4
- package/src/renderers/shaders/ShaderLib.js +2 -1
- package/src/renderers/shaders/UniformsLib.js +3 -0
- package/src/renderers/shaders/UniformsUtils.js +10 -1
- package/src/renderers/webgl/WebGLAttributes.js +42 -38
- package/src/renderers/webgl/WebGLBackground.js +24 -3
- package/src/renderers/webgl/WebGLBindingStates.js +14 -51
- package/src/renderers/webgl/WebGLBufferRenderer.js +23 -22
- package/src/renderers/webgl/WebGLCapabilities.js +44 -13
- package/src/renderers/webgl/WebGLCubeUVMaps.js +10 -6
- package/src/renderers/webgl/WebGLExtensions.js +7 -20
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +23 -21
- package/src/renderers/webgl/WebGLLights.js +21 -44
- package/src/renderers/webgl/WebGLMaterials.js +9 -8
- package/src/renderers/webgl/WebGLMorphtargets.js +78 -217
- package/src/renderers/webgl/WebGLProgram.js +46 -78
- package/src/renderers/webgl/WebGLPrograms.js +37 -40
- package/src/renderers/webgl/WebGLProperties.js +7 -0
- package/src/renderers/webgl/WebGLRenderStates.js +15 -9
- package/src/renderers/webgl/WebGLShadowMap.js +25 -25
- package/src/renderers/webgl/WebGLState.js +35 -58
- package/src/renderers/webgl/WebGLTextures.js +313 -358
- package/src/renderers/webgl/WebGLUniforms.js +12 -2
- package/src/renderers/webgl/WebGLUniformsGroups.js +8 -8
- package/src/renderers/webgl/WebGLUtils.js +9 -78
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBackend.js +389 -152
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +145 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/nodes/GLSLNodeBuilder.js +245 -44
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLAttributeUtils.js +7 -1
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLConstants.js +2 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLExtensions.js +2 -0
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLState.js +21 -3
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLTextureUtils.js +271 -43
- package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +6 -23
- package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +318 -141
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +42 -0
- package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +10 -7
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +59 -0
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +105 -0
- package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +424 -95
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUAttributeUtils.js +37 -18
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUBindingUtils.js +86 -32
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +10 -1
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +68 -27
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +235 -68
- package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +43 -5
- package/src/renderers/webxr/WebXRDepthSensing.js +11 -6
- package/src/renderers/webxr/WebXRManager.js +53 -38
- package/src/scenes/Scene.js +7 -1
- package/src/textures/CompressedArrayTexture.js +14 -0
- package/src/textures/DataArrayTexture.js +14 -0
- package/src/textures/DepthTexture.js +1 -3
- package/src/textures/Texture.js +12 -2
- package/src/utils.js +62 -1
- package/examples/jsm/geometries/SDFGeometryGenerator.js +0 -144
- package/examples/jsm/loaders/LogLuvLoader.js +0 -606
- package/examples/jsm/loaders/TiltLoader.js +0 -520
- package/examples/jsm/nodes/Nodes.js +0 -195
- package/examples/jsm/nodes/accessors/AccessorsUtils.js +0 -10
- package/examples/jsm/nodes/accessors/BitangentNode.js +0 -89
- package/examples/jsm/nodes/accessors/CameraNode.js +0 -119
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +0 -61
- package/examples/jsm/nodes/accessors/InstanceNode.js +0 -71
- package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +0 -21
- package/examples/jsm/nodes/accessors/MaterialNode.js +0 -314
- package/examples/jsm/nodes/accessors/ModelNode.js +0 -33
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +0 -39
- package/examples/jsm/nodes/accessors/NormalNode.js +0 -96
- package/examples/jsm/nodes/accessors/PointUVNode.js +0 -26
- package/examples/jsm/nodes/accessors/PositionNode.js +0 -104
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -35
- package/examples/jsm/nodes/accessors/SkinningNode.js +0 -124
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +0 -72
- package/examples/jsm/nodes/accessors/TangentNode.js +0 -109
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +0 -35
- package/examples/jsm/nodes/accessors/UVNode.js +0 -47
- package/examples/jsm/nodes/core/CacheNode.js +0 -49
- package/examples/jsm/nodes/core/IndexNode.js +0 -66
- package/examples/jsm/nodes/core/NodeCache.js +0 -26
- package/examples/jsm/nodes/core/NodeKeywords.js +0 -80
- package/examples/jsm/nodes/core/PropertyNode.js +0 -72
- package/examples/jsm/nodes/core/UniformGroupNode.js +0 -36
- package/examples/jsm/nodes/core/VaryingNode.js +0 -65
- package/examples/jsm/nodes/display/BlendModeNode.js +0 -128
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +0 -99
- package/examples/jsm/nodes/display/ColorSpaceNode.js +0 -108
- package/examples/jsm/nodes/display/FrontFacingNode.js +0 -27
- package/examples/jsm/nodes/display/PassNode.js +0 -183
- package/examples/jsm/nodes/display/ToneMappingNode.js +0 -184
- package/examples/jsm/nodes/display/ViewportDepthNode.js +0 -97
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +0 -31
- package/examples/jsm/nodes/display/ViewportNode.js +0 -134
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +0 -31
- package/examples/jsm/nodes/fog/FogExp2Node.js +0 -35
- package/examples/jsm/nodes/fog/FogNode.js +0 -38
- package/examples/jsm/nodes/fog/FogRangeNode.js +0 -34
- package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +0 -40
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +0 -393
- package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +0 -13
- package/examples/jsm/nodes/lighting/AONode.js +0 -27
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -241
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +0 -181
- package/examples/jsm/nodes/lighting/LightNode.js +0 -57
- package/examples/jsm/nodes/lighting/LightingContextNode.js +0 -66
- package/examples/jsm/nodes/lighting/LightsNode.js +0 -188
- package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +0 -162
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -28
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +0 -34
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -40
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -65
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +0 -155
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +0 -80
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -90
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +0 -130
- package/examples/jsm/nodes/math/HashNode.js +0 -34
- package/examples/jsm/nodes/math/MathNode.js +0 -391
- package/examples/jsm/nodes/math/OperatorNode.js +0 -274
- package/examples/jsm/nodes/procedural/CheckerNode.js +0 -42
- package/examples/jsm/nodes/utils/DiscardNode.js +0 -27
- package/examples/jsm/nodes/utils/EquirectUVNode.js +0 -33
- package/examples/jsm/nodes/utils/MatcapUVNode.js +0 -30
- package/examples/jsm/nodes/utils/PackingNode.js +0 -55
- package/examples/jsm/nodes/utils/RotateUVNode.js +0 -35
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -37
- package/examples/jsm/objects/QuadMesh.js +0 -66
- package/examples/jsm/renderers/common/Bindings.js +0 -173
- package/examples/jsm/renderers/common/ChainMap.js +0 -89
- package/examples/jsm/renderers/common/PostProcessing.js +0 -25
- package/examples/jsm/renderers/common/RenderObject.js +0 -221
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +0 -44
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +0 -49
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +0 -104
- package/examples/jsm/utils/GPUStatsPanel.js +0 -128
- package/examples/jsm/utils/PackedPhongMaterial.js +0 -178
- package/src/renderers/WebGL1Renderer.js +0 -7
- package/src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl.js +0 -10
- /package/{examples/jsm → src}/nodes/core/NodeAttribute.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeCode.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeFunctionInput.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeParser.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVar.js +0 -0
- /package/{examples/jsm → src}/nodes/core/NodeVarying.js +0 -0
- /package/{examples/jsm → src}/nodes/core/UniformGroup.js +0 -0
- /package/{examples/jsm → src}/nodes/core/constants.js +0 -0
- /package/{examples/jsm → src}/nodes/materialx/DISCLAIMER.md +0 -0
- /package/{examples/jsm → src}/nodes/parsers/GLSLNodeParser.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Binding.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Buffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/BufferUtils.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ComputePipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Constants.js +0 -0
- /package/{examples/jsm → src}/renderers/common/DataMap.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Pipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/ProgrammableStage.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderLists.js +0 -0
- /package/{examples/jsm → src}/renderers/common/RenderPipeline.js +0 -0
- /package/{examples/jsm → src}/renderers/common/Sampler.js +0 -0
- /package/{examples/jsm → src}/renderers/common/StorageBuffer.js +0 -0
- /package/{examples/jsm → src}/renderers/common/UniformBuffer.js +0 -0
- /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLCapabilities.js +0 -0
- /package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeParser.js +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { WebGLCoordinateSystem } from 'three';
|
|
2
|
-
|
|
3
1
|
import GLSLNodeBuilder from './nodes/GLSLNodeBuilder.js';
|
|
4
2
|
import Backend from '../common/Backend.js';
|
|
3
|
+
import { getCacheKey } from '../common/RenderContext.js';
|
|
5
4
|
|
|
6
5
|
import WebGLAttributeUtils from './utils/WebGLAttributeUtils.js';
|
|
7
6
|
import WebGLState from './utils/WebGLState.js';
|
|
@@ -10,6 +9,10 @@ import WebGLTextureUtils from './utils/WebGLTextureUtils.js';
|
|
|
10
9
|
import WebGLExtensions from './utils/WebGLExtensions.js';
|
|
11
10
|
import WebGLCapabilities from './utils/WebGLCapabilities.js';
|
|
12
11
|
import { GLFeatureName } from './utils/WebGLConstants.js';
|
|
12
|
+
import { WebGLBufferRenderer } from './WebGLBufferRenderer.js';
|
|
13
|
+
|
|
14
|
+
import { warnOnce } from '../../utils.js';
|
|
15
|
+
import { WebGLCoordinateSystem } from '../../constants.js';
|
|
13
16
|
|
|
14
17
|
//
|
|
15
18
|
|
|
@@ -39,15 +42,27 @@ class WebGLBackend extends Backend {
|
|
|
39
42
|
this.capabilities = new WebGLCapabilities( this );
|
|
40
43
|
this.attributeUtils = new WebGLAttributeUtils( this );
|
|
41
44
|
this.textureUtils = new WebGLTextureUtils( this );
|
|
45
|
+
this.bufferRenderer = new WebGLBufferRenderer( this );
|
|
46
|
+
|
|
42
47
|
this.state = new WebGLState( this );
|
|
43
48
|
this.utils = new WebGLUtils( this );
|
|
44
49
|
|
|
45
50
|
this.vaoCache = {};
|
|
46
51
|
this.transformFeedbackCache = {};
|
|
47
52
|
this.discard = false;
|
|
53
|
+
this.trackTimestamp = ( parameters.trackTimestamp === true );
|
|
48
54
|
|
|
49
55
|
this.extensions.get( 'EXT_color_buffer_float' );
|
|
56
|
+
this.extensions.get( 'WEBGL_clip_cull_distance' );
|
|
57
|
+
this.extensions.get( 'OES_texture_float_linear' );
|
|
58
|
+
this.extensions.get( 'EXT_color_buffer_half_float' );
|
|
59
|
+
this.extensions.get( 'WEBGL_multisampled_render_to_texture' );
|
|
60
|
+
this.extensions.get( 'WEBGL_render_shared_exponent' );
|
|
61
|
+
this.extensions.get( 'WEBGL_multi_draw' );
|
|
62
|
+
|
|
63
|
+
this.disjoint = this.extensions.get( 'EXT_disjoint_timer_query_webgl2' );
|
|
50
64
|
this.parallel = this.extensions.get( 'KHR_parallel_shader_compile' );
|
|
65
|
+
|
|
51
66
|
this._currentContext = null;
|
|
52
67
|
|
|
53
68
|
}
|
|
@@ -64,6 +79,96 @@ class WebGLBackend extends Backend {
|
|
|
64
79
|
|
|
65
80
|
}
|
|
66
81
|
|
|
82
|
+
|
|
83
|
+
initTimestampQuery( renderContext ) {
|
|
84
|
+
|
|
85
|
+
if ( ! this.disjoint || ! this.trackTimestamp ) return;
|
|
86
|
+
|
|
87
|
+
const renderContextData = this.get( renderContext );
|
|
88
|
+
|
|
89
|
+
if ( this.queryRunning ) {
|
|
90
|
+
|
|
91
|
+
if ( ! renderContextData.queryQueue ) renderContextData.queryQueue = [];
|
|
92
|
+
renderContextData.queryQueue.push( renderContext );
|
|
93
|
+
return;
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if ( renderContextData.activeQuery ) {
|
|
98
|
+
|
|
99
|
+
this.gl.endQuery( this.disjoint.TIME_ELAPSED_EXT );
|
|
100
|
+
renderContextData.activeQuery = null;
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
renderContextData.activeQuery = this.gl.createQuery();
|
|
105
|
+
|
|
106
|
+
if ( renderContextData.activeQuery !== null ) {
|
|
107
|
+
|
|
108
|
+
this.gl.beginQuery( this.disjoint.TIME_ELAPSED_EXT, renderContextData.activeQuery );
|
|
109
|
+
this.queryRunning = true;
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// timestamp utils
|
|
116
|
+
|
|
117
|
+
prepareTimestampBuffer( renderContext ) {
|
|
118
|
+
|
|
119
|
+
if ( ! this.disjoint || ! this.trackTimestamp ) return;
|
|
120
|
+
|
|
121
|
+
const renderContextData = this.get( renderContext );
|
|
122
|
+
|
|
123
|
+
if ( renderContextData.activeQuery ) {
|
|
124
|
+
|
|
125
|
+
this.gl.endQuery( this.disjoint.TIME_ELAPSED_EXT );
|
|
126
|
+
|
|
127
|
+
if ( ! renderContextData.gpuQueries ) renderContextData.gpuQueries = [];
|
|
128
|
+
renderContextData.gpuQueries.push( { query: renderContextData.activeQuery } );
|
|
129
|
+
renderContextData.activeQuery = null;
|
|
130
|
+
this.queryRunning = false;
|
|
131
|
+
|
|
132
|
+
if ( renderContextData.queryQueue && renderContextData.queryQueue.length > 0 ) {
|
|
133
|
+
|
|
134
|
+
const nextRenderContext = renderContextData.queryQueue.shift();
|
|
135
|
+
this.initTimestampQuery( nextRenderContext );
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async resolveTimestampAsync( renderContext, type = 'render' ) {
|
|
144
|
+
|
|
145
|
+
if ( ! this.disjoint || ! this.trackTimestamp ) return;
|
|
146
|
+
|
|
147
|
+
const renderContextData = this.get( renderContext );
|
|
148
|
+
|
|
149
|
+
if ( ! renderContextData.gpuQueries ) renderContextData.gpuQueries = [];
|
|
150
|
+
|
|
151
|
+
for ( let i = 0; i < renderContextData.gpuQueries.length; i ++ ) {
|
|
152
|
+
|
|
153
|
+
const queryInfo = renderContextData.gpuQueries[ i ];
|
|
154
|
+
const available = this.gl.getQueryParameter( queryInfo.query, this.gl.QUERY_RESULT_AVAILABLE );
|
|
155
|
+
const disjoint = this.gl.getParameter( this.disjoint.GPU_DISJOINT_EXT );
|
|
156
|
+
|
|
157
|
+
if ( available && ! disjoint ) {
|
|
158
|
+
|
|
159
|
+
const elapsed = this.gl.getQueryParameter( queryInfo.query, this.gl.QUERY_RESULT );
|
|
160
|
+
const duration = Number( elapsed ) / 1000000; // Convert nanoseconds to milliseconds
|
|
161
|
+
this.gl.deleteQuery( queryInfo.query );
|
|
162
|
+
renderContextData.gpuQueries.splice( i, 1 ); // Remove the processed query
|
|
163
|
+
i --;
|
|
164
|
+
this.renderer.info.updateTimestamp( type, duration );
|
|
165
|
+
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
|
|
67
172
|
getContext() {
|
|
68
173
|
|
|
69
174
|
return this.gl;
|
|
@@ -79,6 +184,8 @@ class WebGLBackend extends Backend {
|
|
|
79
184
|
|
|
80
185
|
//
|
|
81
186
|
|
|
187
|
+
this.initTimestampQuery( renderContext );
|
|
188
|
+
|
|
82
189
|
renderContextData.previousContext = this._currentContext;
|
|
83
190
|
this._currentContext = renderContext;
|
|
84
191
|
|
|
@@ -101,7 +208,7 @@ class WebGLBackend extends Backend {
|
|
|
101
208
|
|
|
102
209
|
const { x, y, width, height } = renderContext.scissorValue;
|
|
103
210
|
|
|
104
|
-
gl.scissor( x, y, width, height );
|
|
211
|
+
gl.scissor( x, renderContext.height - height - y, width, height );
|
|
105
212
|
|
|
106
213
|
}
|
|
107
214
|
|
|
@@ -129,6 +236,20 @@ class WebGLBackend extends Backend {
|
|
|
129
236
|
const renderContextData = this.get( renderContext );
|
|
130
237
|
const previousContext = renderContextData.previousContext;
|
|
131
238
|
|
|
239
|
+
const occlusionQueryCount = renderContext.occlusionQueryCount;
|
|
240
|
+
|
|
241
|
+
if ( occlusionQueryCount > 0 ) {
|
|
242
|
+
|
|
243
|
+
if ( occlusionQueryCount > renderContextData.occlusionQueryIndex ) {
|
|
244
|
+
|
|
245
|
+
gl.endQuery( gl.ANY_SAMPLES_PASSED );
|
|
246
|
+
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
this.resolveOccludedAsync( renderContext );
|
|
250
|
+
|
|
251
|
+
}
|
|
252
|
+
|
|
132
253
|
const textures = renderContext.textures;
|
|
133
254
|
|
|
134
255
|
if ( textures !== null ) {
|
|
@@ -149,18 +270,18 @@ class WebGLBackend extends Backend {
|
|
|
149
270
|
|
|
150
271
|
this._currentContext = previousContext;
|
|
151
272
|
|
|
152
|
-
|
|
153
273
|
if ( renderContext.textures !== null && renderContext.renderTarget ) {
|
|
154
274
|
|
|
155
275
|
const renderTargetContextData = this.get( renderContext.renderTarget );
|
|
156
276
|
|
|
157
277
|
const { samples } = renderContext.renderTarget;
|
|
158
|
-
const fb = renderTargetContextData.framebuffer;
|
|
159
|
-
|
|
160
|
-
const mask = gl.COLOR_BUFFER_BIT;
|
|
161
278
|
|
|
162
279
|
if ( samples > 0 ) {
|
|
163
280
|
|
|
281
|
+
const fb = renderTargetContextData.framebuffers[ renderContext.getCacheKey() ];
|
|
282
|
+
|
|
283
|
+
const mask = gl.COLOR_BUFFER_BIT;
|
|
284
|
+
|
|
164
285
|
const msaaFrameBuffer = renderTargetContextData.msaaFrameBuffer;
|
|
165
286
|
|
|
166
287
|
const textures = renderContext.textures;
|
|
@@ -172,9 +293,21 @@ class WebGLBackend extends Backend {
|
|
|
172
293
|
|
|
173
294
|
// TODO Add support for MRT
|
|
174
295
|
|
|
175
|
-
|
|
296
|
+
if ( renderContext.scissor ) {
|
|
297
|
+
|
|
298
|
+
const { x, y, width, height } = renderContext.scissorValue;
|
|
299
|
+
|
|
300
|
+
const viewY = renderContext.height - height - y;
|
|
301
|
+
|
|
302
|
+
gl.blitFramebuffer( x, viewY, x + width, viewY + height, x, viewY, x + width, viewY + height, mask, gl.NEAREST );
|
|
303
|
+
gl.invalidateSubFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray, x, viewY, width, height );
|
|
176
304
|
|
|
177
|
-
|
|
305
|
+
} else {
|
|
306
|
+
|
|
307
|
+
gl.blitFramebuffer( 0, 0, renderContext.width, renderContext.height, 0, 0, renderContext.width, renderContext.height, mask, gl.NEAREST );
|
|
308
|
+
gl.invalidateFramebuffer( gl.READ_FRAMEBUFFER, renderTargetContextData.invalidationArray );
|
|
309
|
+
|
|
310
|
+
}
|
|
178
311
|
|
|
179
312
|
}
|
|
180
313
|
|
|
@@ -193,32 +326,13 @@ class WebGLBackend extends Backend {
|
|
|
193
326
|
|
|
194
327
|
} else {
|
|
195
328
|
|
|
196
|
-
const gl = this.gl;
|
|
197
|
-
|
|
198
329
|
gl.viewport( 0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight );
|
|
199
330
|
|
|
200
331
|
}
|
|
201
332
|
|
|
202
333
|
}
|
|
203
334
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if ( occlusionQueryCount > 0 ) {
|
|
207
|
-
|
|
208
|
-
const renderContextData = this.get( renderContext );
|
|
209
|
-
|
|
210
|
-
if ( occlusionQueryCount > renderContextData.occlusionQueryIndex ) {
|
|
211
|
-
|
|
212
|
-
const { gl } = this;
|
|
213
|
-
|
|
214
|
-
gl.endQuery( gl.ANY_SAMPLES_PASSED );
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
this.resolveOccludedAsync( renderContext );
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
335
|
+
this.prepareTimestampBuffer( renderContext );
|
|
222
336
|
|
|
223
337
|
}
|
|
224
338
|
|
|
@@ -293,7 +407,7 @@ class WebGLBackend extends Backend {
|
|
|
293
407
|
const gl = this.gl;
|
|
294
408
|
const { x, y, width, height } = renderContext.viewportValue;
|
|
295
409
|
|
|
296
|
-
gl.viewport( x, y, width, height );
|
|
410
|
+
gl.viewport( x, renderContext.height - height - y, width, height );
|
|
297
411
|
|
|
298
412
|
}
|
|
299
413
|
|
|
@@ -338,6 +452,12 @@ class WebGLBackend extends Backend {
|
|
|
338
452
|
|
|
339
453
|
const clearColor = descriptor.clearColorValue || this.getClearColor();
|
|
340
454
|
|
|
455
|
+
// premultiply alpha
|
|
456
|
+
|
|
457
|
+
clearColor.r *= clearColor.a;
|
|
458
|
+
clearColor.g *= clearColor.a;
|
|
459
|
+
clearColor.b *= clearColor.a;
|
|
460
|
+
|
|
341
461
|
if ( depth ) this.state.setDepthMask( true );
|
|
342
462
|
|
|
343
463
|
if ( descriptor.textures === null ) {
|
|
@@ -379,17 +499,18 @@ class WebGLBackend extends Backend {
|
|
|
379
499
|
|
|
380
500
|
}
|
|
381
501
|
|
|
382
|
-
beginCompute(
|
|
502
|
+
beginCompute( computeGroup ) {
|
|
383
503
|
|
|
384
|
-
const gl = this
|
|
504
|
+
const { state, gl } = this;
|
|
385
505
|
|
|
386
|
-
|
|
506
|
+
state.bindFramebuffer( gl.FRAMEBUFFER, null );
|
|
507
|
+
this.initTimestampQuery( computeGroup );
|
|
387
508
|
|
|
388
509
|
}
|
|
389
510
|
|
|
390
511
|
compute( computeGroup, computeNode, bindings, pipeline ) {
|
|
391
512
|
|
|
392
|
-
const gl = this
|
|
513
|
+
const { state, gl } = this;
|
|
393
514
|
|
|
394
515
|
if ( ! this.discard ) {
|
|
395
516
|
|
|
@@ -415,7 +536,7 @@ class WebGLBackend extends Backend {
|
|
|
415
536
|
|
|
416
537
|
}
|
|
417
538
|
|
|
418
|
-
|
|
539
|
+
state.useProgram( programGPU );
|
|
419
540
|
|
|
420
541
|
this._bindUniforms( bindings );
|
|
421
542
|
|
|
@@ -456,7 +577,7 @@ class WebGLBackend extends Backend {
|
|
|
456
577
|
|
|
457
578
|
}
|
|
458
579
|
|
|
459
|
-
finishCompute(
|
|
580
|
+
finishCompute( computeGroup ) {
|
|
460
581
|
|
|
461
582
|
const gl = this.gl;
|
|
462
583
|
|
|
@@ -464,24 +585,32 @@ class WebGLBackend extends Backend {
|
|
|
464
585
|
|
|
465
586
|
gl.disable( gl.RASTERIZER_DISCARD );
|
|
466
587
|
|
|
588
|
+
this.prepareTimestampBuffer( computeGroup );
|
|
589
|
+
|
|
467
590
|
}
|
|
468
591
|
|
|
469
|
-
draw( renderObject
|
|
592
|
+
draw( renderObject/*, info*/ ) {
|
|
470
593
|
|
|
471
|
-
const { pipeline, material, context } = renderObject;
|
|
594
|
+
const { object, pipeline, material, context } = renderObject;
|
|
472
595
|
const { programGPU } = this.get( pipeline );
|
|
473
596
|
|
|
474
597
|
const { gl, state } = this;
|
|
475
598
|
|
|
476
599
|
const contextData = this.get( context );
|
|
477
600
|
|
|
601
|
+
const drawParms = renderObject.getDrawParameters();
|
|
602
|
+
|
|
603
|
+
if ( drawParms === null ) return;
|
|
604
|
+
|
|
478
605
|
//
|
|
479
606
|
|
|
480
607
|
this._bindUniforms( renderObject.getBindings() );
|
|
481
608
|
|
|
482
|
-
|
|
609
|
+
const frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );
|
|
483
610
|
|
|
484
|
-
|
|
611
|
+
state.setMaterial( material, frontFaceCW );
|
|
612
|
+
|
|
613
|
+
state.useProgram( programGPU );
|
|
485
614
|
|
|
486
615
|
//
|
|
487
616
|
|
|
@@ -511,11 +640,6 @@ class WebGLBackend extends Backend {
|
|
|
511
640
|
|
|
512
641
|
const index = renderObject.getIndex();
|
|
513
642
|
|
|
514
|
-
const object = renderObject.object;
|
|
515
|
-
const geometry = renderObject.geometry;
|
|
516
|
-
const drawRange = geometry.drawRange;
|
|
517
|
-
const firstVertex = drawRange.start;
|
|
518
|
-
|
|
519
643
|
//
|
|
520
644
|
|
|
521
645
|
const lastObject = contextData.lastOcclusionObject;
|
|
@@ -546,22 +670,22 @@ class WebGLBackend extends Backend {
|
|
|
546
670
|
}
|
|
547
671
|
|
|
548
672
|
//
|
|
673
|
+
const renderer = this.bufferRenderer;
|
|
549
674
|
|
|
550
|
-
|
|
551
|
-
if ( object.
|
|
552
|
-
else if ( object.
|
|
553
|
-
else if ( object.
|
|
554
|
-
else if ( object.isLineLoop ) mode = gl.LINE_LOOP;
|
|
675
|
+
if ( object.isPoints ) renderer.mode = gl.POINTS;
|
|
676
|
+
else if ( object.isLineSegments ) renderer.mode = gl.LINES;
|
|
677
|
+
else if ( object.isLine ) renderer.mode = gl.LINE_STRIP;
|
|
678
|
+
else if ( object.isLineLoop ) renderer.mode = gl.LINE_LOOP;
|
|
555
679
|
else {
|
|
556
680
|
|
|
557
681
|
if ( material.wireframe === true ) {
|
|
558
682
|
|
|
559
683
|
state.setLineWidth( material.wireframeLinewidth * this.renderer.getPixelRatio() );
|
|
560
|
-
mode = gl.LINES;
|
|
684
|
+
renderer.mode = gl.LINES;
|
|
561
685
|
|
|
562
686
|
} else {
|
|
563
687
|
|
|
564
|
-
mode = gl.TRIANGLES;
|
|
688
|
+
renderer.mode = gl.TRIANGLES;
|
|
565
689
|
|
|
566
690
|
}
|
|
567
691
|
|
|
@@ -569,46 +693,51 @@ class WebGLBackend extends Backend {
|
|
|
569
693
|
|
|
570
694
|
//
|
|
571
695
|
|
|
572
|
-
const instanceCount =
|
|
696
|
+
const { vertexCount, instanceCount } = drawParms;
|
|
697
|
+
let { firstVertex } = drawParms;
|
|
698
|
+
|
|
699
|
+
renderer.object = object;
|
|
573
700
|
|
|
574
701
|
if ( index !== null ) {
|
|
575
702
|
|
|
576
|
-
|
|
577
|
-
const indexCount = ( drawRange.count !== Infinity ) ? drawRange.count : index.count;
|
|
703
|
+
firstVertex *= index.array.BYTES_PER_ELEMENT;
|
|
578
704
|
|
|
579
|
-
|
|
705
|
+
const indexData = this.get( index );
|
|
580
706
|
|
|
581
|
-
|
|
707
|
+
renderer.index = index.count;
|
|
708
|
+
renderer.type = indexData.type;
|
|
582
709
|
|
|
583
|
-
|
|
710
|
+
} else {
|
|
584
711
|
|
|
585
|
-
|
|
712
|
+
renderer.index = 0;
|
|
586
713
|
|
|
587
|
-
|
|
714
|
+
}
|
|
588
715
|
|
|
589
|
-
|
|
716
|
+
if ( object.isBatchedMesh ) {
|
|
590
717
|
|
|
591
|
-
|
|
718
|
+
if ( object._multiDrawInstances !== null ) {
|
|
592
719
|
|
|
593
|
-
|
|
594
|
-
const vertexCount = ( drawRange.count !== Infinity ) ? drawRange.count : positionAttribute.count;
|
|
720
|
+
renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
|
|
595
721
|
|
|
596
|
-
if (
|
|
722
|
+
} else if ( ! this.hasFeature( 'WEBGL_multi_draw' ) ) {
|
|
597
723
|
|
|
598
|
-
|
|
724
|
+
warnOnce( 'THREE.WebGLRenderer: WEBGL_multi_draw not supported.' );
|
|
599
725
|
|
|
600
726
|
} else {
|
|
601
727
|
|
|
602
|
-
|
|
728
|
+
renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
|
|
603
729
|
|
|
604
730
|
}
|
|
605
731
|
|
|
606
|
-
|
|
732
|
+
} else if ( instanceCount > 1 ) {
|
|
607
733
|
|
|
608
|
-
|
|
734
|
+
renderer.renderInstances( firstVertex, vertexCount, instanceCount );
|
|
609
735
|
|
|
610
|
-
}
|
|
736
|
+
} else {
|
|
737
|
+
|
|
738
|
+
renderer.render( firstVertex, vertexCount );
|
|
611
739
|
|
|
740
|
+
}
|
|
612
741
|
//
|
|
613
742
|
|
|
614
743
|
gl.bindVertexArray( null );
|
|
@@ -621,9 +750,9 @@ class WebGLBackend extends Backend {
|
|
|
621
750
|
|
|
622
751
|
}
|
|
623
752
|
|
|
624
|
-
getRenderCacheKey( renderObject ) {
|
|
753
|
+
getRenderCacheKey( /*renderObject*/ ) {
|
|
625
754
|
|
|
626
|
-
return
|
|
755
|
+
return '';
|
|
627
756
|
|
|
628
757
|
}
|
|
629
758
|
|
|
@@ -660,9 +789,9 @@ class WebGLBackend extends Backend {
|
|
|
660
789
|
|
|
661
790
|
}
|
|
662
791
|
|
|
663
|
-
copyTextureToBuffer( texture, x, y, width, height ) {
|
|
792
|
+
copyTextureToBuffer( texture, x, y, width, height, faceIndex ) {
|
|
664
793
|
|
|
665
|
-
return this.textureUtils.copyTextureToBuffer( texture, x, y, width, height );
|
|
794
|
+
return this.textureUtils.copyTextureToBuffer( texture, x, y, width, height, faceIndex );
|
|
666
795
|
|
|
667
796
|
}
|
|
668
797
|
|
|
@@ -676,9 +805,9 @@ class WebGLBackend extends Backend {
|
|
|
676
805
|
|
|
677
806
|
// node builder
|
|
678
807
|
|
|
679
|
-
createNodeBuilder( object, renderer
|
|
808
|
+
createNodeBuilder( object, renderer ) {
|
|
680
809
|
|
|
681
|
-
return new GLSLNodeBuilder( object, renderer
|
|
810
|
+
return new GLSLNodeBuilder( object, renderer );
|
|
682
811
|
|
|
683
812
|
}
|
|
684
813
|
|
|
@@ -764,26 +893,107 @@ class WebGLBackend extends Backend {
|
|
|
764
893
|
|
|
765
894
|
}
|
|
766
895
|
|
|
896
|
+
_handleSource( string, errorLine ) {
|
|
897
|
+
|
|
898
|
+
const lines = string.split( '\n' );
|
|
899
|
+
const lines2 = [];
|
|
900
|
+
|
|
901
|
+
const from = Math.max( errorLine - 6, 0 );
|
|
902
|
+
const to = Math.min( errorLine + 6, lines.length );
|
|
903
|
+
|
|
904
|
+
for ( let i = from; i < to; i ++ ) {
|
|
905
|
+
|
|
906
|
+
const line = i + 1;
|
|
907
|
+
lines2.push( `${line === errorLine ? '>' : ' '} ${line}: ${lines[ i ]}` );
|
|
908
|
+
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
return lines2.join( '\n' );
|
|
912
|
+
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
_getShaderErrors( gl, shader, type ) {
|
|
916
|
+
|
|
917
|
+
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
|
|
918
|
+
const errors = gl.getShaderInfoLog( shader ).trim();
|
|
919
|
+
|
|
920
|
+
if ( status && errors === '' ) return '';
|
|
921
|
+
|
|
922
|
+
const errorMatches = /ERROR: 0:(\d+)/.exec( errors );
|
|
923
|
+
if ( errorMatches ) {
|
|
924
|
+
|
|
925
|
+
const errorLine = parseInt( errorMatches[ 1 ] );
|
|
926
|
+
return type.toUpperCase() + '\n\n' + errors + '\n\n' + this._handleSource( gl.getShaderSource( shader ), errorLine );
|
|
927
|
+
|
|
928
|
+
} else {
|
|
929
|
+
|
|
930
|
+
return errors;
|
|
931
|
+
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
_logProgramError( programGPU, glFragmentShader, glVertexShader ) {
|
|
937
|
+
|
|
938
|
+
if ( this.renderer.debug.checkShaderErrors ) {
|
|
939
|
+
|
|
940
|
+
const gl = this.gl;
|
|
941
|
+
|
|
942
|
+
const programLog = gl.getProgramInfoLog( programGPU ).trim();
|
|
943
|
+
|
|
944
|
+
if ( gl.getProgramParameter( programGPU, gl.LINK_STATUS ) === false ) {
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
if ( typeof this.renderer.debug.onShaderError === 'function' ) {
|
|
948
|
+
|
|
949
|
+
this.renderer.debug.onShaderError( gl, programGPU, glVertexShader, glFragmentShader );
|
|
950
|
+
|
|
951
|
+
} else {
|
|
952
|
+
|
|
953
|
+
// default error reporting
|
|
954
|
+
|
|
955
|
+
const vertexErrors = this._getShaderErrors( gl, glVertexShader, 'vertex' );
|
|
956
|
+
const fragmentErrors = this._getShaderErrors( gl, glFragmentShader, 'fragment' );
|
|
957
|
+
|
|
958
|
+
console.error(
|
|
959
|
+
'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +
|
|
960
|
+
'VALIDATE_STATUS ' + gl.getProgramParameter( programGPU, gl.VALIDATE_STATUS ) + '\n\n' +
|
|
961
|
+
'Program Info Log: ' + programLog + '\n' +
|
|
962
|
+
vertexErrors + '\n' +
|
|
963
|
+
fragmentErrors
|
|
964
|
+
);
|
|
965
|
+
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
} else if ( programLog !== '' ) {
|
|
969
|
+
|
|
970
|
+
console.warn( 'THREE.WebGLProgram: Program Info Log:', programLog );
|
|
971
|
+
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
}
|
|
977
|
+
|
|
767
978
|
_completeCompile( renderObject, pipeline ) {
|
|
768
979
|
|
|
769
|
-
const gl = this
|
|
980
|
+
const { state, gl } = this;
|
|
770
981
|
const pipelineData = this.get( pipeline );
|
|
771
982
|
const { programGPU, fragmentShader, vertexShader } = pipelineData;
|
|
772
983
|
|
|
773
984
|
if ( gl.getProgramParameter( programGPU, gl.LINK_STATUS ) === false ) {
|
|
774
985
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
console.error( 'THREE.WebGLBackend:', gl.getShaderInfoLog( fragmentShader ) );
|
|
778
|
-
console.error( 'THREE.WebGLBackend:', gl.getShaderInfoLog( vertexShader ) );
|
|
986
|
+
this._logProgramError( programGPU, fragmentShader, vertexShader );
|
|
779
987
|
|
|
780
988
|
}
|
|
781
989
|
|
|
782
|
-
|
|
990
|
+
state.useProgram( programGPU );
|
|
783
991
|
|
|
784
992
|
// Bindings
|
|
785
993
|
|
|
786
|
-
|
|
994
|
+
const bindings = renderObject.getBindings();
|
|
995
|
+
|
|
996
|
+
this._setupBindings( bindings, programGPU );
|
|
787
997
|
|
|
788
998
|
//
|
|
789
999
|
|
|
@@ -795,7 +1005,7 @@ class WebGLBackend extends Backend {
|
|
|
795
1005
|
|
|
796
1006
|
createComputePipeline( computePipeline, bindings ) {
|
|
797
1007
|
|
|
798
|
-
const gl = this
|
|
1008
|
+
const { state, gl } = this;
|
|
799
1009
|
|
|
800
1010
|
// Program
|
|
801
1011
|
|
|
@@ -833,25 +1043,23 @@ class WebGLBackend extends Backend {
|
|
|
833
1043
|
gl.transformFeedbackVaryings(
|
|
834
1044
|
programGPU,
|
|
835
1045
|
transformVaryingNames,
|
|
836
|
-
gl.SEPARATE_ATTRIBS
|
|
1046
|
+
gl.SEPARATE_ATTRIBS
|
|
837
1047
|
);
|
|
838
1048
|
|
|
839
1049
|
gl.linkProgram( programGPU );
|
|
840
1050
|
|
|
841
1051
|
if ( gl.getProgramParameter( programGPU, gl.LINK_STATUS ) === false ) {
|
|
842
1052
|
|
|
843
|
-
|
|
1053
|
+
this._logProgramError( programGPU, fragmentShader, vertexShader );
|
|
844
1054
|
|
|
845
|
-
console.error( 'THREE.WebGLBackend:', gl.getShaderInfoLog( fragmentShader ) );
|
|
846
|
-
console.error( 'THREE.WebGLBackend:', gl.getShaderInfoLog( vertexShader ) );
|
|
847
1055
|
|
|
848
1056
|
}
|
|
849
1057
|
|
|
850
|
-
|
|
1058
|
+
state.useProgram( programGPU );
|
|
851
1059
|
|
|
852
1060
|
// Bindings
|
|
853
1061
|
|
|
854
|
-
this.createBindings( bindings );
|
|
1062
|
+
this.createBindings( null, bindings );
|
|
855
1063
|
|
|
856
1064
|
this._setupBindings( bindings, programGPU );
|
|
857
1065
|
|
|
@@ -891,32 +1099,48 @@ class WebGLBackend extends Backend {
|
|
|
891
1099
|
|
|
892
1100
|
}
|
|
893
1101
|
|
|
894
|
-
createBindings( bindings ) {
|
|
1102
|
+
createBindings( bindGroup, bindings ) {
|
|
895
1103
|
|
|
896
|
-
this.updateBindings( bindings );
|
|
1104
|
+
this.updateBindings( bindGroup, bindings );
|
|
897
1105
|
|
|
898
1106
|
}
|
|
899
1107
|
|
|
900
|
-
updateBindings( bindings ) {
|
|
1108
|
+
updateBindings( bindGroup, bindings ) {
|
|
1109
|
+
|
|
1110
|
+
if ( ! bindGroup ) return;
|
|
901
1111
|
|
|
902
1112
|
const { gl } = this;
|
|
903
1113
|
|
|
904
|
-
|
|
905
|
-
|
|
1114
|
+
const bindingsData = this.get( bindings );
|
|
1115
|
+
const bindGroupData = this.get( bindGroup );
|
|
1116
|
+
|
|
1117
|
+
if ( bindingsData.textureIndex === undefined ) bindingsData.textureIndex = 0;
|
|
1118
|
+
|
|
1119
|
+
if ( bindGroupData.textureIndex === undefined ) {
|
|
1120
|
+
|
|
1121
|
+
bindGroupData.textureIndex = bindingsData.textureIndex;
|
|
1122
|
+
|
|
1123
|
+
} else {
|
|
1124
|
+
|
|
1125
|
+
// reset textureIndex to match previous mappimgs when rebuilt
|
|
1126
|
+
bindingsData.textureIndex = bindGroupData.textureIndex;
|
|
1127
|
+
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
let i = 0;
|
|
906
1131
|
|
|
907
|
-
for ( const binding of bindings ) {
|
|
1132
|
+
for ( const binding of bindGroup.bindings ) {
|
|
908
1133
|
|
|
909
1134
|
if ( binding.isUniformsGroup || binding.isUniformBuffer ) {
|
|
910
1135
|
|
|
911
|
-
const bufferGPU = gl.createBuffer();
|
|
912
1136
|
const data = binding.buffer;
|
|
1137
|
+
const bufferGPU = gl.createBuffer();
|
|
913
1138
|
|
|
914
1139
|
gl.bindBuffer( gl.UNIFORM_BUFFER, bufferGPU );
|
|
915
1140
|
gl.bufferData( gl.UNIFORM_BUFFER, data, gl.DYNAMIC_DRAW );
|
|
916
|
-
gl.bindBufferBase( gl.UNIFORM_BUFFER, groupIndex, bufferGPU );
|
|
917
1141
|
|
|
918
1142
|
this.set( binding, {
|
|
919
|
-
index:
|
|
1143
|
+
index: bindGroup.index * 2 + i ++,
|
|
920
1144
|
bufferGPU
|
|
921
1145
|
} );
|
|
922
1146
|
|
|
@@ -925,7 +1149,7 @@ class WebGLBackend extends Backend {
|
|
|
925
1149
|
const { textureGPU, glTextureType } = this.get( binding.texture );
|
|
926
1150
|
|
|
927
1151
|
this.set( binding, {
|
|
928
|
-
index: textureIndex ++,
|
|
1152
|
+
index: bindingsData.textureIndex ++,
|
|
929
1153
|
textureGPU,
|
|
930
1154
|
glTextureType
|
|
931
1155
|
} );
|
|
@@ -975,7 +1199,11 @@ class WebGLBackend extends Backend {
|
|
|
975
1199
|
|
|
976
1200
|
createStorageAttribute( attribute ) {
|
|
977
1201
|
|
|
978
|
-
|
|
1202
|
+
if ( this.has( attribute ) ) return;
|
|
1203
|
+
|
|
1204
|
+
const gl = this.gl;
|
|
1205
|
+
|
|
1206
|
+
this.attributeUtils.createAttribute( attribute, gl.ARRAY_BUFFER );
|
|
979
1207
|
|
|
980
1208
|
}
|
|
981
1209
|
|
|
@@ -997,12 +1225,6 @@ class WebGLBackend extends Backend {
|
|
|
997
1225
|
|
|
998
1226
|
}
|
|
999
1227
|
|
|
1000
|
-
async hasFeatureAsync( name ) {
|
|
1001
|
-
|
|
1002
|
-
return this.hasFeature( name );
|
|
1003
|
-
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
1228
|
hasFeature( name ) {
|
|
1007
1229
|
|
|
1008
1230
|
const keysMatching = Object.keys( GLFeatureName ).filter( key => GLFeatureName[ key ] === name );
|
|
@@ -1011,7 +1233,6 @@ class WebGLBackend extends Backend {
|
|
|
1011
1233
|
|
|
1012
1234
|
for ( let i = 0; i < keysMatching.length; i ++ ) {
|
|
1013
1235
|
|
|
1014
|
-
|
|
1015
1236
|
if ( extensions.has( keysMatching[ i ] ) ) return true;
|
|
1016
1237
|
|
|
1017
1238
|
}
|
|
@@ -1020,51 +1241,56 @@ class WebGLBackend extends Backend {
|
|
|
1020
1241
|
|
|
1021
1242
|
}
|
|
1022
1243
|
|
|
1023
|
-
|
|
1024
1244
|
getMaxAnisotropy() {
|
|
1025
1245
|
|
|
1026
1246
|
return this.capabilities.getMaxAnisotropy();
|
|
1027
1247
|
|
|
1028
1248
|
}
|
|
1029
1249
|
|
|
1030
|
-
|
|
1250
|
+
copyTextureToTexture( position, srcTexture, dstTexture, level ) {
|
|
1031
1251
|
|
|
1032
|
-
this.textureUtils.
|
|
1252
|
+
this.textureUtils.copyTextureToTexture( position, srcTexture, dstTexture, level );
|
|
1033
1253
|
|
|
1034
1254
|
}
|
|
1035
1255
|
|
|
1036
|
-
|
|
1256
|
+
copyFramebufferToTexture( texture, renderContext, rectangle ) {
|
|
1257
|
+
|
|
1258
|
+
this.textureUtils.copyFramebufferToTexture( texture, renderContext, rectangle );
|
|
1259
|
+
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
_setFramebuffer( descriptor ) {
|
|
1037
1263
|
|
|
1038
1264
|
const { gl, state } = this;
|
|
1039
1265
|
|
|
1040
1266
|
let currentFrameBuffer = null;
|
|
1041
1267
|
|
|
1042
|
-
if (
|
|
1268
|
+
if ( descriptor.textures !== null ) {
|
|
1043
1269
|
|
|
1044
|
-
const renderTarget =
|
|
1270
|
+
const renderTarget = descriptor.renderTarget;
|
|
1045
1271
|
const renderTargetContextData = this.get( renderTarget );
|
|
1046
1272
|
const { samples, depthBuffer, stencilBuffer } = renderTarget;
|
|
1047
|
-
|
|
1273
|
+
|
|
1048
1274
|
const isCube = renderTarget.isWebGLCubeRenderTarget === true;
|
|
1049
1275
|
|
|
1050
1276
|
let msaaFb = renderTargetContextData.msaaFrameBuffer;
|
|
1051
1277
|
let depthRenderbuffer = renderTargetContextData.depthRenderbuffer;
|
|
1052
1278
|
|
|
1279
|
+
const cacheKey = getCacheKey( descriptor );
|
|
1280
|
+
|
|
1053
1281
|
let fb;
|
|
1054
1282
|
|
|
1055
1283
|
if ( isCube ) {
|
|
1056
1284
|
|
|
1057
|
-
|
|
1285
|
+
renderTargetContextData.cubeFramebuffers || ( renderTargetContextData.cubeFramebuffers = {} );
|
|
1058
1286
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
fb = renderTargetContextData.cubeFramebuffers[ cubeFace ];
|
|
1287
|
+
fb = renderTargetContextData.cubeFramebuffers[ cacheKey ];
|
|
1064
1288
|
|
|
1065
1289
|
} else {
|
|
1066
1290
|
|
|
1067
|
-
|
|
1291
|
+
renderTargetContextData.framebuffers || ( renderTargetContextData.framebuffers = {} );
|
|
1292
|
+
|
|
1293
|
+
fb = renderTargetContextData.framebuffers[ cacheKey ];
|
|
1068
1294
|
|
|
1069
1295
|
}
|
|
1070
1296
|
|
|
@@ -1074,22 +1300,27 @@ class WebGLBackend extends Backend {
|
|
|
1074
1300
|
|
|
1075
1301
|
state.bindFramebuffer( gl.FRAMEBUFFER, fb );
|
|
1076
1302
|
|
|
1077
|
-
const textures =
|
|
1303
|
+
const textures = descriptor.textures;
|
|
1078
1304
|
|
|
1079
1305
|
if ( isCube ) {
|
|
1080
1306
|
|
|
1081
|
-
renderTargetContextData.cubeFramebuffers[
|
|
1307
|
+
renderTargetContextData.cubeFramebuffers[ cacheKey ] = fb;
|
|
1308
|
+
|
|
1082
1309
|
const { textureGPU } = this.get( textures[ 0 ] );
|
|
1083
1310
|
|
|
1311
|
+
const cubeFace = this.renderer._activeCubeFace;
|
|
1312
|
+
|
|
1084
1313
|
gl.framebufferTexture2D( gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + cubeFace, textureGPU, 0 );
|
|
1085
1314
|
|
|
1086
1315
|
} else {
|
|
1087
1316
|
|
|
1317
|
+
renderTargetContextData.framebuffers[ cacheKey ] = fb;
|
|
1318
|
+
|
|
1088
1319
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
1089
1320
|
|
|
1090
1321
|
const texture = textures[ i ];
|
|
1091
1322
|
const textureData = this.get( texture );
|
|
1092
|
-
textureData.renderTarget =
|
|
1323
|
+
textureData.renderTarget = descriptor.renderTarget;
|
|
1093
1324
|
|
|
1094
1325
|
const attachment = gl.COLOR_ATTACHMENT0 + i;
|
|
1095
1326
|
|
|
@@ -1097,15 +1328,13 @@ class WebGLBackend extends Backend {
|
|
|
1097
1328
|
|
|
1098
1329
|
}
|
|
1099
1330
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
state.drawBuffers( renderContext, fb );
|
|
1331
|
+
state.drawBuffers( descriptor, fb );
|
|
1103
1332
|
|
|
1104
1333
|
}
|
|
1105
1334
|
|
|
1106
|
-
if (
|
|
1335
|
+
if ( descriptor.depthTexture !== null ) {
|
|
1107
1336
|
|
|
1108
|
-
const textureData = this.get(
|
|
1337
|
+
const textureData = this.get( descriptor.depthTexture );
|
|
1109
1338
|
const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
|
|
1110
1339
|
|
|
1111
1340
|
gl.framebufferTexture2D( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0 );
|
|
@@ -1126,11 +1355,10 @@ class WebGLBackend extends Backend {
|
|
|
1126
1355
|
|
|
1127
1356
|
const msaaRenderbuffers = [];
|
|
1128
1357
|
|
|
1129
|
-
const textures =
|
|
1358
|
+
const textures = descriptor.textures;
|
|
1130
1359
|
|
|
1131
1360
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
1132
1361
|
|
|
1133
|
-
|
|
1134
1362
|
msaaRenderbuffers[ i ] = gl.createRenderbuffer();
|
|
1135
1363
|
|
|
1136
1364
|
gl.bindRenderbuffer( gl.RENDERBUFFER, msaaRenderbuffers[ i ] );
|
|
@@ -1144,10 +1372,10 @@ class WebGLBackend extends Backend {
|
|
|
1144
1372
|
|
|
1145
1373
|
}
|
|
1146
1374
|
|
|
1147
|
-
const texture =
|
|
1375
|
+
const texture = descriptor.textures[ i ];
|
|
1148
1376
|
const textureData = this.get( texture );
|
|
1149
1377
|
|
|
1150
|
-
gl.renderbufferStorageMultisample( gl.RENDERBUFFER, samples, textureData.glInternalFormat,
|
|
1378
|
+
gl.renderbufferStorageMultisample( gl.RENDERBUFFER, samples, textureData.glInternalFormat, descriptor.width, descriptor.height );
|
|
1151
1379
|
gl.framebufferRenderbuffer( gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, gl.RENDERBUFFER, msaaRenderbuffers[ i ] );
|
|
1152
1380
|
|
|
1153
1381
|
|
|
@@ -1159,7 +1387,7 @@ class WebGLBackend extends Backend {
|
|
|
1159
1387
|
if ( depthRenderbuffer === undefined ) {
|
|
1160
1388
|
|
|
1161
1389
|
depthRenderbuffer = gl.createRenderbuffer();
|
|
1162
|
-
this.textureUtils.setupRenderBufferStorage( depthRenderbuffer,
|
|
1390
|
+
this.textureUtils.setupRenderBufferStorage( depthRenderbuffer, descriptor );
|
|
1163
1391
|
|
|
1164
1392
|
renderTargetContextData.depthRenderbuffer = depthRenderbuffer;
|
|
1165
1393
|
|
|
@@ -1306,7 +1534,7 @@ class WebGLBackend extends Backend {
|
|
|
1306
1534
|
|
|
1307
1535
|
}
|
|
1308
1536
|
|
|
1309
|
-
const gl = this
|
|
1537
|
+
const { gl } = this;
|
|
1310
1538
|
|
|
1311
1539
|
transformFeedbackGPU = gl.createTransformFeedback();
|
|
1312
1540
|
|
|
@@ -1333,20 +1561,24 @@ class WebGLBackend extends Backend {
|
|
|
1333
1561
|
|
|
1334
1562
|
const gl = this.gl;
|
|
1335
1563
|
|
|
1336
|
-
for ( const
|
|
1564
|
+
for ( const bindGroup of bindings ) {
|
|
1337
1565
|
|
|
1338
|
-
const
|
|
1339
|
-
const index = bindingData.index;
|
|
1566
|
+
for ( const binding of bindGroup.bindings ) {
|
|
1340
1567
|
|
|
1341
|
-
|
|
1568
|
+
const bindingData = this.get( binding );
|
|
1569
|
+
const index = bindingData.index;
|
|
1342
1570
|
|
|
1343
|
-
|
|
1344
|
-
gl.uniformBlockBinding( programGPU, location, index );
|
|
1571
|
+
if ( binding.isUniformsGroup || binding.isUniformBuffer ) {
|
|
1345
1572
|
|
|
1346
|
-
|
|
1573
|
+
const location = gl.getUniformBlockIndex( programGPU, binding.name );
|
|
1574
|
+
gl.uniformBlockBinding( programGPU, location, index );
|
|
1347
1575
|
|
|
1348
|
-
|
|
1349
|
-
|
|
1576
|
+
} else if ( binding.isSampledTexture ) {
|
|
1577
|
+
|
|
1578
|
+
const location = gl.getUniformLocation( programGPU, binding.name );
|
|
1579
|
+
gl.uniform1i( location, index );
|
|
1580
|
+
|
|
1581
|
+
}
|
|
1350
1582
|
|
|
1351
1583
|
}
|
|
1352
1584
|
|
|
@@ -1358,18 +1590,23 @@ class WebGLBackend extends Backend {
|
|
|
1358
1590
|
|
|
1359
1591
|
const { gl, state } = this;
|
|
1360
1592
|
|
|
1361
|
-
for ( const
|
|
1593
|
+
for ( const bindGroup of bindings ) {
|
|
1362
1594
|
|
|
1363
|
-
const
|
|
1364
|
-
const index = bindingData.index;
|
|
1595
|
+
for ( const binding of bindGroup.bindings ) {
|
|
1365
1596
|
|
|
1366
|
-
|
|
1597
|
+
const bindingData = this.get( binding );
|
|
1598
|
+
const index = bindingData.index;
|
|
1367
1599
|
|
|
1368
|
-
|
|
1600
|
+
if ( binding.isUniformsGroup || binding.isUniformBuffer ) {
|
|
1369
1601
|
|
|
1370
|
-
|
|
1602
|
+
// TODO USE bindBufferRange to group multiple uniform buffers
|
|
1603
|
+
state.bindBufferBase( gl.UNIFORM_BUFFER, index, bindingData.bufferGPU );
|
|
1371
1604
|
|
|
1372
|
-
|
|
1605
|
+
} else if ( binding.isSampledTexture ) {
|
|
1606
|
+
|
|
1607
|
+
state.bindTexture( bindingData.glTextureType, bindingData.textureGPU, gl.TEXTURE0 + index );
|
|
1608
|
+
|
|
1609
|
+
}
|
|
1373
1610
|
|
|
1374
1611
|
}
|
|
1375
1612
|
|