@plastic-software/three 0.178.0 → 0.180.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 +950 -230
- package/build/three.core.js +754 -138
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +197 -96
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +99 -25
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +4586 -1499
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +4544 -1499
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +2 -3
- package/examples/jsm/capabilities/WebGPU.js +1 -1
- package/examples/jsm/controls/ArcballControls.js +7 -7
- package/examples/jsm/controls/DragControls.js +6 -56
- package/examples/jsm/controls/FirstPersonControls.js +2 -2
- package/examples/jsm/controls/PointerLockControls.js +0 -8
- package/examples/jsm/csm/CSMShadowNode.js +4 -4
- package/examples/jsm/environments/RoomEnvironment.js +8 -3
- package/examples/jsm/exporters/GLTFExporter.js +30 -22
- package/examples/jsm/exporters/KTX2Exporter.js +4 -2
- package/examples/jsm/exporters/PLYExporter.js +1 -1
- package/examples/jsm/exporters/USDZExporter.js +676 -299
- package/examples/jsm/geometries/RoundedBoxGeometry.js +47 -8
- package/examples/jsm/interactive/HTMLMesh.js +5 -3
- package/examples/jsm/libs/ktx-parse.module.js +1 -1
- package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
- package/examples/jsm/lights/LightProbeGenerator.js +14 -3
- package/examples/jsm/lines/Line2.js +3 -3
- package/examples/jsm/lines/LineGeometry.js +1 -1
- package/examples/jsm/lines/LineSegments2.js +2 -2
- package/examples/jsm/lines/Wireframe.js +2 -2
- package/examples/jsm/lines/WireframeGeometry2.js +1 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +1 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -1
- package/examples/jsm/loaders/ColladaLoader.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +210 -22
- package/examples/jsm/loaders/FBXLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +9 -5
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +5 -5
- package/examples/jsm/loaders/HDRLoader.js +486 -0
- package/examples/jsm/loaders/KTX2Loader.js +112 -32
- package/examples/jsm/loaders/MaterialXLoader.js +212 -30
- package/examples/jsm/loaders/RGBELoader.js +7 -473
- package/examples/jsm/loaders/TTFLoader.js +13 -1
- package/examples/jsm/loaders/USDLoader.js +219 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -892
- package/examples/jsm/loaders/UltraHDRLoader.js +1 -1
- package/examples/jsm/loaders/lwo/IFFParser.js +1 -1
- package/examples/jsm/loaders/usd/USDAParser.js +741 -0
- package/examples/jsm/loaders/usd/USDCParser.js +17 -0
- package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
- package/examples/jsm/math/ColorSpaces.js +19 -1
- package/examples/jsm/math/ConvexHull.js +2 -2
- package/examples/jsm/math/Lut.js +2 -2
- package/examples/jsm/misc/MD2CharacterComplex.js +1 -1
- package/examples/jsm/misc/ProgressiveLightMap.js +1 -1
- package/examples/jsm/misc/Volume.js +1 -1
- package/examples/jsm/objects/LensflareMesh.js +3 -3
- package/examples/jsm/objects/SkyMesh.js +2 -2
- package/examples/jsm/physics/RapierPhysics.js +14 -5
- package/examples/jsm/postprocessing/GTAOPass.js +10 -9
- package/examples/jsm/postprocessing/OutlinePass.js +17 -17
- package/examples/jsm/postprocessing/SSAOPass.js +10 -9
- package/examples/jsm/postprocessing/SSRPass.js +37 -8
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +11 -2
- package/examples/jsm/transpiler/GLSLDecoder.js +23 -20
- package/examples/jsm/transpiler/TSLEncoder.js +2 -10
- package/examples/jsm/transpiler/WGSLEncoder.js +24 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +27 -4
- package/examples/jsm/tsl/display/BloomNode.js +7 -6
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +2 -1
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +439 -90
- package/examples/jsm/tsl/display/GTAONode.js +8 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +51 -41
- package/examples/jsm/tsl/display/OutlineNode.js +2 -2
- package/examples/jsm/tsl/display/SSRNode.js +180 -65
- package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +181 -172
- package/examples/jsm/tsl/display/boxBlur.js +64 -0
- package/examples/jsm/tsl/display/hashBlur.js +15 -18
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +1 -1
- package/examples/jsm/utils/BufferGeometryUtils.js +1 -1
- package/examples/jsm/utils/ShadowMapViewerGPU.js +12 -5
- package/examples/jsm/webxr/OculusHandModel.js +1 -1
- package/package.json +1 -1
- package/src/Three.Core.js +2 -0
- package/src/Three.TSL.js +98 -24
- package/src/animation/AnimationClip.js +17 -2
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/cameras/Camera.js +14 -0
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/constants.js +11 -3
- package/src/core/BufferGeometry.js +2 -2
- package/{examples/jsm/misc → src/core}/Timer.js +4 -42
- package/src/extras/PMREMGenerator.js +11 -0
- package/src/extras/TextureUtils.js +2 -1
- package/src/extras/lib/earcut.js +1 -1
- package/src/helpers/CameraHelper.js +41 -11
- package/src/helpers/SkeletonHelper.js +35 -6
- package/src/lights/LightShadow.js +21 -8
- package/src/lights/PointLightShadow.js +1 -1
- package/src/lights/webgpu/ProjectorLight.js +1 -1
- package/src/loaders/FileLoader.js +25 -2
- package/src/loaders/ImageBitmapLoader.js +23 -0
- package/src/loaders/Loader.js +14 -0
- package/src/loaders/LoadingManager.js +23 -0
- package/src/materials/Material.js +12 -0
- package/src/materials/MeshBasicMaterial.js +1 -1
- package/src/materials/MeshDistanceMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +0 -8
- package/src/materials/nodes/NodeMaterial.js +1 -1
- package/src/materials/nodes/PointsNodeMaterial.js +86 -28
- package/src/materials/nodes/SpriteNodeMaterial.js +3 -15
- package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -2
- package/src/math/ColorManagement.js +7 -1
- package/src/math/Frustum.js +19 -8
- package/src/math/FrustumArray.js +10 -5
- package/src/math/Line3.js +129 -2
- package/src/math/Matrix4.js +48 -27
- package/src/math/Spherical.js +2 -2
- package/src/nodes/Nodes.js +4 -0
- package/src/nodes/TSL.js +4 -0
- package/src/nodes/accessors/BufferNode.js +1 -1
- package/src/nodes/accessors/Camera.js +142 -16
- package/src/nodes/accessors/ClippingNode.js +6 -5
- package/src/nodes/accessors/CubeTextureNode.js +2 -2
- package/src/nodes/accessors/InstanceNode.js +3 -1
- package/src/nodes/accessors/Normal.js +11 -11
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +19 -4
- package/src/nodes/accessors/SceneNode.js +1 -1
- package/src/nodes/accessors/StorageTextureNode.js +1 -1
- package/src/nodes/accessors/Texture3DNode.js +13 -0
- package/src/nodes/accessors/TextureNode.js +83 -19
- package/src/nodes/code/FunctionCallNode.js +19 -0
- package/src/nodes/code/FunctionNode.js +23 -0
- package/src/nodes/core/ArrayNode.js +12 -0
- package/src/nodes/core/AssignNode.js +6 -2
- package/src/nodes/core/ContextNode.js +44 -1
- package/src/nodes/core/Node.js +30 -22
- package/src/nodes/core/NodeBuilder.js +71 -32
- package/src/nodes/core/NodeFrame.js +1 -1
- package/src/nodes/core/NodeUniform.js +1 -1
- package/src/nodes/core/NodeUtils.js +5 -3
- package/src/nodes/core/StackNode.js +71 -4
- package/src/nodes/core/StructNode.js +5 -5
- package/src/nodes/core/StructTypeNode.js +1 -0
- package/src/nodes/core/SubBuildNode.js +2 -2
- package/src/nodes/core/UniformNode.js +79 -14
- package/src/nodes/core/VarNode.js +83 -15
- package/src/nodes/display/FrontFacingNode.js +4 -8
- package/src/nodes/display/PassNode.js +148 -2
- package/src/nodes/display/ScreenNode.js +42 -13
- package/src/nodes/display/ViewportDepthTextureNode.js +16 -4
- package/src/nodes/display/ViewportSharedTextureNode.js +12 -0
- package/src/nodes/display/ViewportTextureNode.js +94 -4
- package/src/nodes/functions/PhysicalLightingModel.js +2 -2
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +67 -23
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +430 -0
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
- package/src/nodes/lighting/LightsNode.js +1 -1
- package/src/nodes/lighting/ProjectorLightNode.js +19 -6
- package/src/nodes/lighting/ShadowFilterNode.js +1 -1
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +165 -1
- package/src/nodes/math/BitcastNode.js +156 -0
- package/src/nodes/math/ConditionalNode.js +19 -3
- package/src/nodes/math/MathNode.js +72 -60
- package/src/nodes/math/OperatorNode.js +26 -25
- package/src/nodes/tsl/TSLCore.js +477 -142
- package/src/nodes/utils/DebugNode.js +1 -1
- package/src/nodes/utils/EventNode.js +83 -0
- package/src/nodes/utils/JoinNode.js +3 -1
- package/src/nodes/utils/MemberNode.js +58 -7
- package/src/nodes/utils/RTTNode.js +10 -1
- package/src/nodes/utils/ReflectorNode.js +51 -7
- package/src/nodes/utils/SampleNode.js +12 -2
- package/src/nodes/utils/SplitNode.js +11 -0
- package/src/nodes/utils/Timer.js +0 -47
- package/src/objects/BatchedMesh.js +6 -4
- package/src/objects/LOD.js +1 -1
- package/src/objects/Sprite.js +2 -2
- package/src/renderers/WebGLRenderer.js +21 -31
- package/src/renderers/common/Attributes.js +1 -1
- package/src/renderers/common/Backend.js +19 -1
- package/src/renderers/common/Bindings.js +21 -18
- package/src/renderers/common/ChainMap.js +1 -1
- package/src/renderers/common/Color4.js +2 -2
- package/src/renderers/common/DataMap.js +1 -1
- package/src/renderers/common/Pipelines.js +1 -1
- package/src/renderers/common/PostProcessing.js +60 -5
- package/src/renderers/common/RenderContext.js +2 -2
- package/src/renderers/common/RenderObject.js +14 -2
- package/src/renderers/common/Renderer.js +55 -32
- package/src/renderers/common/SampledTexture.js +4 -72
- package/src/renderers/common/Sampler.js +91 -0
- package/src/renderers/common/Storage3DTexture.js +21 -0
- package/src/renderers/common/StorageArrayTexture.js +21 -0
- package/src/renderers/common/StorageTexture.js +19 -0
- package/src/renderers/common/Textures.js +52 -14
- package/src/renderers/common/TimestampQueryPool.js +3 -3
- package/src/renderers/common/XRManager.js +51 -17
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeLibrary.js +5 -5
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +21 -11
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
- package/src/renderers/webgl/WebGLCapabilities.js +2 -2
- package/src/renderers/webgl/WebGLMaterials.js +6 -6
- package/src/renderers/webgl/WebGLProgram.js +24 -18
- package/src/renderers/webgl/WebGLPrograms.js +4 -4
- package/src/renderers/webgl/WebGLShadowMap.js +11 -1
- package/src/renderers/webgl/WebGLTextures.js +20 -7
- package/src/renderers/webgl/WebGLUtils.js +3 -2
- package/src/renderers/webgl-fallback/WebGLBackend.js +207 -146
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +112 -19
- package/src/renderers/webgl-fallback/utils/WebGLState.js +1 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -3
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +9 -10
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +3 -2
- package/src/renderers/webgpu/WebGPUBackend.js +87 -44
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +169 -99
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +35 -31
- package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +10 -19
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +120 -84
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +3 -3
- package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
- package/src/renderers/webxr/WebXRManager.js +86 -11
- package/src/textures/ExternalTexture.js +56 -0
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +12 -2
- package/src/textures/VideoTexture.js +27 -2
- package/examples/jsm/loaders/RGBMLoader.js +0 -1148
|
@@ -141,17 +141,17 @@ function WebGLMaterials( renderer, properties ) {
|
|
|
141
141
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
if ( material.texture3DMatrix ) {
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
uniforms.texture3DMatrix.value.copy( material.texture3DMatrix );
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
}
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
if ( material.triplanarHardness ) {
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
uniforms.triplanarHardness.value = material.triplanarHardness;
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
}
|
|
155
155
|
|
|
156
156
|
if ( material.alphaMap ) {
|
|
157
157
|
|
|
@@ -57,7 +57,9 @@ function getEncodingComponents( colorSpace ) {
|
|
|
57
57
|
function getShaderErrors( gl, shader, type ) {
|
|
58
58
|
|
|
59
59
|
const status = gl.getShaderParameter( shader, gl.COMPILE_STATUS );
|
|
60
|
-
|
|
60
|
+
|
|
61
|
+
const shaderInfoLog = gl.getShaderInfoLog( shader ) || '';
|
|
62
|
+
const errors = shaderInfoLog.trim();
|
|
61
63
|
|
|
62
64
|
if ( status && errors === '' ) return '';
|
|
63
65
|
|
|
@@ -561,8 +563,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
561
563
|
parameters.bumpMap ? '#define USE_BUMPMAP' : '',
|
|
562
564
|
parameters.normalMap ? '#define USE_NORMALMAP' : '',
|
|
563
565
|
parameters.normalMapMode === TriPlanarMapping ? '#define USE_NORMALMAP_TRIPLANAR' : parameters.normalMapMode === CylindricalMapping ? '#define USE_NORMALMAP_CYLINDRICAL' : parameters.normalMapMode === UVMapping ? '#define USE_NORMALMAP_UV' : '',
|
|
564
|
-
parameters.normalMapObjectSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
565
|
-
parameters.normalMapTangentSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
566
|
+
parameters.normalMapObjectSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
567
|
+
parameters.normalMapTangentSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
566
568
|
parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',
|
|
567
569
|
parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
|
|
568
570
|
|
|
@@ -572,9 +574,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
572
574
|
parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
|
|
573
575
|
parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
|
|
574
576
|
parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
|
|
575
|
-
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
576
|
-
|
|
577
|
-
|
|
577
|
+
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
578
|
+
: parameters.clearcoatNormalMapMode === CylindricalMapping ? '#define USE_CLEARCOAT_NORMALMAP_CYLINDRICAL'
|
|
579
|
+
: parameters.clearcoatNormalMapMode === UVMapping ? '#define USE_CLEARCOAT_NORMALMAP_UV' : '',
|
|
578
580
|
|
|
579
581
|
parameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '',
|
|
580
582
|
parameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '',
|
|
@@ -661,8 +663,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
661
663
|
|
|
662
664
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
663
665
|
|
|
664
|
-
parameters.logarithmicDepthBuffer ? '#define
|
|
665
|
-
parameters.
|
|
666
|
+
parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
|
|
667
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
|
|
666
668
|
|
|
667
669
|
'uniform mat4 modelMatrix;',
|
|
668
670
|
'uniform mat4 modelViewMatrix;',
|
|
@@ -768,8 +770,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
768
770
|
parameters.bumpMap ? '#define USE_BUMPMAP' : '',
|
|
769
771
|
parameters.normalMap ? '#define USE_NORMALMAP' : '',
|
|
770
772
|
parameters.normalMapMode === TriPlanarMapping ? '#define USE_NORMALMAP_TRIPLANAR' : parameters.normalMapMode === CylindricalMapping ? '#define USE_NORMALMAP_CYLINDRICAL' : parameters.normalMapMode === UVMapping ? '#define USE_NORMALMAP_UV' : '',
|
|
771
|
-
parameters.normalMapObjectSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
772
|
-
parameters.normalMapTangentSpace && [UVMapping, CylindricalMapping].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
773
|
+
parameters.normalMapObjectSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_OBJECTSPACE' : '',
|
|
774
|
+
parameters.normalMapTangentSpace && [ UVMapping, CylindricalMapping ].includes( parameters.normalMapMode ) ? '#define USE_NORMALMAP_TANGENTSPACE' : '',
|
|
773
775
|
parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
|
|
774
776
|
|
|
775
777
|
parameters.anisotropy ? '#define USE_ANISOTROPY' : '',
|
|
@@ -779,9 +781,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
779
781
|
parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
|
|
780
782
|
parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '',
|
|
781
783
|
parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '',
|
|
782
|
-
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
783
|
-
|
|
784
|
-
|
|
784
|
+
parameters.clearcoatNormalMapMode === TriPlanarMapping ? '#define USE_CLEARCOAT_NORMALMAP_TRIPLANAR'
|
|
785
|
+
: parameters.clearcoatNormalMapMode === CylindricalMapping ? '#define USE_CLEARCOAT_NORMALMAP_CYLINDRICAL'
|
|
786
|
+
: parameters.clearcoatNormalMapMode === UVMapping ? '#define USE_CLEARCOAT_NORMALMAP_UV' : '',
|
|
785
787
|
|
|
786
788
|
parameters.dispersion ? '#define USE_DISPERSION' : '',
|
|
787
789
|
|
|
@@ -837,8 +839,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
837
839
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
838
840
|
parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
|
|
839
841
|
|
|
840
|
-
parameters.logarithmicDepthBuffer ? '#define
|
|
841
|
-
parameters.
|
|
842
|
+
parameters.logarithmicDepthBuffer ? '#define USE_LOGARITHMIC_DEPTH_BUFFER' : '',
|
|
843
|
+
parameters.reversedDepthBuffer ? '#define USE_REVERSED_DEPTH_BUFFER' : '',
|
|
842
844
|
|
|
843
845
|
'uniform mat4 modelViewMatrix;',
|
|
844
846
|
'uniform mat4 viewMatrix;',
|
|
@@ -939,9 +941,13 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
939
941
|
// check for link errors
|
|
940
942
|
if ( renderer.debug.checkShaderErrors ) {
|
|
941
943
|
|
|
942
|
-
const
|
|
943
|
-
const
|
|
944
|
-
const
|
|
944
|
+
const programInfoLog = gl.getProgramInfoLog( program ) || '';
|
|
945
|
+
const vertexShaderInfoLog = gl.getShaderInfoLog( glVertexShader ) || '';
|
|
946
|
+
const fragmentShaderInfoLog = gl.getShaderInfoLog( glFragmentShader ) || '';
|
|
947
|
+
|
|
948
|
+
const programLog = programInfoLog.trim();
|
|
949
|
+
const vertexLog = vertexShaderInfoLog.trim();
|
|
950
|
+
const fragmentLog = fragmentShaderInfoLog.trim();
|
|
945
951
|
|
|
946
952
|
let runnable = true;
|
|
947
953
|
let haveDiagnostics = true;
|
|
@@ -108,7 +108,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
111
|
-
const
|
|
111
|
+
const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
112
112
|
|
|
113
113
|
const IS_INSTANCEDMESH = object.isInstancedMesh === true;
|
|
114
114
|
const IS_BATCHEDMESH = object.isBatchedMesh === true;
|
|
@@ -314,7 +314,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
314
314
|
|
|
315
315
|
sizeAttenuation: material.sizeAttenuation === true,
|
|
316
316
|
logarithmicDepthBuffer: logarithmicDepthBuffer,
|
|
317
|
-
|
|
317
|
+
reversedDepthBuffer: reversedDepthBuffer,
|
|
318
318
|
|
|
319
319
|
skinning: object.isSkinnedMesh === true,
|
|
320
320
|
|
|
@@ -447,7 +447,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
447
447
|
array.push( parameters.anisotropyMapUv );
|
|
448
448
|
array.push( parameters.clearcoatMapUv );
|
|
449
449
|
array.push( parameters.clearcoatNormalMapUv );
|
|
450
|
-
array.push( parameters.clearcoatNormalMapMode);
|
|
450
|
+
array.push( parameters.clearcoatNormalMapMode );
|
|
451
451
|
array.push( parameters.clearcoatRoughnessMapUv );
|
|
452
452
|
array.push( parameters.iridescenceMapUv );
|
|
453
453
|
array.push( parameters.iridescenceThicknessMapUv );
|
|
@@ -546,7 +546,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
546
546
|
_programLayers.enable( 2 );
|
|
547
547
|
if ( parameters.logarithmicDepthBuffer )
|
|
548
548
|
_programLayers.enable( 3 );
|
|
549
|
-
if ( parameters.
|
|
549
|
+
if ( parameters.reversedDepthBuffer )
|
|
550
550
|
_programLayers.enable( 4 );
|
|
551
551
|
if ( parameters.skinning )
|
|
552
552
|
_programLayers.enable( 5 );
|
|
@@ -84,7 +84,17 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
|
|
|
84
84
|
|
|
85
85
|
// Set GL state for depth map.
|
|
86
86
|
_state.setBlending( NoBlending );
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
if ( _state.buffers.depth.getReversed() === true ) {
|
|
89
|
+
|
|
90
|
+
_state.buffers.color.setClear( 0, 0, 0, 0 );
|
|
91
|
+
|
|
92
|
+
} else {
|
|
93
|
+
|
|
94
|
+
_state.buffers.color.setClear( 1, 1, 1, 1 );
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
88
98
|
_state.buffers.depth.setTest( true );
|
|
89
99
|
_state.setScissorTest( false );
|
|
90
100
|
|
|
@@ -201,6 +201,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
201
201
|
if ( glFormat === _gl.RGB ) {
|
|
202
202
|
|
|
203
203
|
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
204
|
+
if ( glType === _gl.UNSIGNED_INT_10F_11F_11F_REV ) internalFormat = _gl.R11F_G11F_B10F;
|
|
204
205
|
|
|
205
206
|
}
|
|
206
207
|
|
|
@@ -515,7 +516,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
515
516
|
|
|
516
517
|
if ( texture.isVideoTexture ) updateVideoTexture( texture );
|
|
517
518
|
|
|
518
|
-
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
519
|
+
if ( texture.isRenderTargetTexture === false && texture.isExternalTexture !== true && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
519
520
|
|
|
520
521
|
const image = texture.image;
|
|
521
522
|
|
|
@@ -534,6 +535,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
534
535
|
|
|
535
536
|
}
|
|
536
537
|
|
|
538
|
+
} else if ( texture.isExternalTexture ) {
|
|
539
|
+
|
|
540
|
+
textureProperties.__webglTexture = texture.sourceTexture ? texture.sourceTexture : null;
|
|
541
|
+
|
|
537
542
|
}
|
|
538
543
|
|
|
539
544
|
state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot );
|
|
@@ -544,7 +549,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
544
549
|
|
|
545
550
|
const textureProperties = properties.get( texture );
|
|
546
551
|
|
|
547
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
552
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
548
553
|
|
|
549
554
|
uploadTexture( textureProperties, texture, slot );
|
|
550
555
|
return;
|
|
@@ -559,7 +564,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
559
564
|
|
|
560
565
|
const textureProperties = properties.get( texture );
|
|
561
566
|
|
|
562
|
-
if ( texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
567
|
+
if ( texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version ) {
|
|
563
568
|
|
|
564
569
|
uploadTexture( textureProperties, texture, slot );
|
|
565
570
|
return;
|
|
@@ -2002,13 +2007,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
2002
2007
|
const attachment = textures[ i ];
|
|
2003
2008
|
const attachmentProperties = properties.get( attachment );
|
|
2004
2009
|
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2010
|
+
let glTextureType = _gl.TEXTURE_2D;
|
|
2011
|
+
|
|
2012
|
+
if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
|
|
2013
|
+
|
|
2014
|
+
glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
|
|
2015
|
+
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
state.bindTexture( glTextureType, attachmentProperties.__webglTexture );
|
|
2019
|
+
setTextureParameters( glTextureType, attachment );
|
|
2020
|
+
setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, glTextureType, 0 );
|
|
2008
2021
|
|
|
2009
2022
|
if ( textureNeedsGenerateMipmaps( attachment ) ) {
|
|
2010
2023
|
|
|
2011
|
-
generateMipmap(
|
|
2024
|
+
generateMipmap( glTextureType );
|
|
2012
2025
|
|
|
2013
2026
|
}
|
|
2014
2027
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat } from '../../constants.js';
|
|
1
|
+
import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat, UnsignedInt101111Type } from '../../constants.js';
|
|
2
2
|
import { ColorManagement } from '../../math/ColorManagement.js';
|
|
3
3
|
|
|
4
4
|
function WebGLUtils( gl, extensions ) {
|
|
@@ -13,6 +13,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
13
13
|
if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
|
|
14
14
|
if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
|
|
15
15
|
if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
|
|
16
|
+
if ( p === UnsignedInt101111Type ) return gl.UNSIGNED_INT_10F_11F_11F_REV;
|
|
16
17
|
|
|
17
18
|
if ( p === ByteType ) return gl.BYTE;
|
|
18
19
|
if ( p === ShortType ) return gl.SHORT;
|
|
@@ -181,7 +182,7 @@ function WebGLUtils( gl, extensions ) {
|
|
|
181
182
|
|
|
182
183
|
if ( extension !== null ) {
|
|
183
184
|
|
|
184
|
-
if ( p ===
|
|
185
|
+
if ( p === RED_RGTC1_Format ) return extension.COMPRESSED_RED_RGTC1_EXT;
|
|
185
186
|
if ( p === SIGNED_RED_RGTC1_Format ) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;
|
|
186
187
|
if ( p === RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;
|
|
187
188
|
if ( p === SIGNED_RED_GREEN_RGTC2_Format ) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;
|