super-three 0.133.2 → 0.135.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/build/three.js +619 -538
- package/build/three.min.js +1 -1
- package/build/three.module.js +763 -616
- package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff +0 -0
- package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff2 +0 -0
- package/examples/fonts/open-sans/open-sans.css +9 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.eot +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.ttf +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.woff +0 -0
- package/examples/fonts/tabler-icons/fonts/tabler-icons.woff2 +0 -0
- package/examples/fonts/tabler-icons/tabler-icons.min.css +4 -0
- package/examples/js/controls/ArcballControls.js +68 -27
- package/examples/js/controls/DragControls.js +7 -0
- package/examples/js/controls/OrbitControls.js +5 -36
- package/examples/js/controls/TrackballControls.js +3 -2
- package/examples/js/csm/CSM.js +2 -2
- package/examples/js/csm/CSMFrustum.js +133 -0
- package/examples/js/exporters/GLTFExporter.js +147 -63
- package/examples/js/exporters/USDZExporter.js +45 -26
- package/examples/js/lines/LineMaterial.js +58 -20
- package/examples/js/lines/LineSegments2.js +29 -24
- package/examples/js/loaders/3DMLoader.js +24 -11
- package/examples/js/loaders/3MFLoader.js +2 -2
- package/examples/js/loaders/ColladaLoader.js +61 -3
- package/examples/js/loaders/FBXLoader.js +1 -1
- package/examples/js/loaders/GLTFLoader.js +94 -31
- package/examples/js/loaders/KTX2Loader.js +12 -0
- package/examples/js/loaders/LWOLoader.js +8 -6
- package/examples/js/loaders/LogLuvLoader.js +766 -0
- package/examples/js/loaders/PLYLoader.js +32 -7
- package/examples/js/loaders/RGBELoader.js +2 -1
- package/examples/js/loaders/SVGLoader.js +7 -3
- package/examples/js/loaders/TDSLoader.js +237 -271
- package/examples/js/loaders/lwo/LWO2Parser.js +1 -0
- package/examples/js/loaders/lwo/LWO3Parser.js +4 -2
- package/examples/js/objects/MarchingCubes.js +42 -128
- package/examples/js/renderers/CSS2DRenderer.js +4 -4
- package/examples/js/renderers/CSS3DRenderer.js +4 -4
- package/examples/js/utils/RoughnessMipmapper.js +1 -0
- package/examples/jsm/controls/ArcballControls.js +61 -29
- package/examples/jsm/controls/DragControls.js +7 -0
- package/examples/jsm/controls/OrbitControls.js +9 -51
- package/examples/jsm/controls/TrackballControls.js +1 -1
- package/examples/jsm/csm/CSM.js +3 -3
- package/examples/jsm/csm/{Frustum.js → CSMFrustum.js} +3 -3
- package/examples/jsm/exporters/GLTFExporter.js +160 -74
- package/examples/jsm/exporters/USDZExporter.js +47 -26
- package/examples/jsm/libs/flow.module.js +3218 -0
- package/examples/jsm/libs/lil-gui.module.min.js +8 -0
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/lines/LineMaterial.js +59 -23
- package/examples/jsm/lines/LineSegments2.js +22 -18
- package/examples/jsm/loaders/3DMLoader.js +18 -12
- package/examples/jsm/loaders/3MFLoader.js +2 -2
- package/examples/jsm/loaders/ColladaLoader.js +61 -3
- package/examples/jsm/loaders/FBXLoader.js +1 -1
- package/examples/jsm/loaders/GLTFLoader.js +99 -35
- package/examples/jsm/loaders/KTX2Loader.js +19 -0
- package/examples/jsm/loaders/LWOLoader.js +8 -6
- package/examples/jsm/loaders/LogLuvLoader.js +606 -0
- package/examples/jsm/loaders/PLYLoader.js +33 -7
- package/examples/jsm/loaders/SVGLoader.js +7 -4
- package/examples/jsm/loaders/TDSLoader.js +225 -285
- package/examples/jsm/loaders/lwo/LWO2Parser.js +1 -0
- package/examples/jsm/loaders/lwo/LWO3Parser.js +2 -2
- package/examples/jsm/node-editor/NodeEditor.js +455 -0
- package/examples/jsm/node-editor/accessors/NormalEditor.js +30 -0
- package/examples/jsm/node-editor/accessors/PositionEditor.js +30 -0
- package/examples/jsm/node-editor/accessors/UVEditor.js +26 -0
- package/examples/jsm/node-editor/display/BlendEditor.js +43 -0
- package/examples/jsm/node-editor/examples/animate-uv.json +1 -0
- package/examples/jsm/node-editor/examples/fake-top-light.json +1 -0
- package/examples/jsm/node-editor/examples/oscillator-color.json +1 -0
- package/examples/jsm/node-editor/examples/rim.json +1 -0
- package/examples/jsm/node-editor/inputs/ColorEditor.js +91 -0
- package/examples/jsm/node-editor/inputs/FloatEditor.js +24 -0
- package/examples/jsm/node-editor/inputs/SliderEditor.js +68 -0
- package/examples/jsm/node-editor/inputs/Vector2Editor.js +28 -0
- package/examples/jsm/node-editor/inputs/Vector3Editor.js +30 -0
- package/examples/jsm/node-editor/inputs/Vector4Editor.js +37 -0
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +69 -0
- package/examples/jsm/node-editor/math/DotEditor.js +36 -0
- package/examples/jsm/node-editor/math/InvertEditor.js +38 -0
- package/examples/jsm/node-editor/math/LimiterEditor.js +48 -0
- package/examples/jsm/node-editor/math/NormalizeEditor.js +26 -0
- package/examples/jsm/node-editor/math/OperatorEditor.js +50 -0
- package/examples/jsm/node-editor/math/PowerEditor.js +34 -0
- package/examples/jsm/node-editor/math/TrigonometryEditor.js +39 -0
- package/examples/jsm/node-editor/procedural/CheckerEditor.js +26 -0
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +42 -0
- package/examples/jsm/node-editor/utils/TimerEditor.js +57 -0
- package/examples/jsm/nodes/materials/StandardNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/nodes/StandardNode.js +6 -6
- package/examples/jsm/nodes/utils/ColorSpaceNode.js +1 -49
- package/examples/jsm/objects/MarchingCubes.js +46 -152
- package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +1 -1
- package/examples/jsm/postprocessing/AfterimagePass.js +1 -1
- package/examples/jsm/postprocessing/BloomPass.js +1 -1
- package/examples/jsm/postprocessing/BokehPass.js +1 -1
- package/examples/jsm/postprocessing/ClearPass.js +1 -1
- package/examples/jsm/postprocessing/CubeTexturePass.js +1 -1
- package/examples/jsm/postprocessing/DotScreenPass.js +1 -1
- package/examples/jsm/postprocessing/EffectComposer.js +3 -3
- package/examples/jsm/postprocessing/FilmPass.js +1 -1
- package/examples/jsm/postprocessing/GlitchPass.js +1 -1
- package/examples/jsm/postprocessing/HalftonePass.js +1 -1
- package/examples/jsm/postprocessing/MaskPass.js +1 -1
- package/examples/jsm/postprocessing/OutlinePass.js +1 -1
- package/examples/jsm/postprocessing/RenderPass.js +1 -1
- package/examples/jsm/postprocessing/SAOPass.js +1 -1
- package/examples/jsm/postprocessing/SMAAPass.js +1 -1
- package/examples/jsm/postprocessing/SSAARenderPass.js +1 -1
- package/examples/jsm/postprocessing/SSAOPass.js +1 -1
- package/examples/jsm/postprocessing/SSRPass.js +1 -1
- package/examples/jsm/postprocessing/SSRrPass.js +1 -1
- package/examples/jsm/postprocessing/SavePass.js +1 -1
- package/examples/jsm/postprocessing/ShaderPass.js +1 -1
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -1
- package/examples/jsm/postprocessing/TexturePass.js +1 -1
- package/examples/jsm/postprocessing/UnrealBloomPass.js +1 -1
- package/examples/jsm/renderers/CSS2DRenderer.js +5 -4
- package/examples/jsm/renderers/CSS3DRenderer.js +5 -4
- package/examples/jsm/renderers/nodes/Nodes.js +14 -13
- package/examples/jsm/renderers/nodes/ShaderNode.js +193 -41
- package/examples/jsm/renderers/nodes/accessors/MaterialNode.js +6 -6
- package/examples/jsm/renderers/nodes/accessors/ModelViewProjectionNode.js +5 -5
- package/examples/jsm/renderers/nodes/accessors/NormalNode.js +14 -3
- package/examples/jsm/renderers/nodes/accessors/PointUVNode.js +3 -3
- package/examples/jsm/renderers/nodes/accessors/PositionNode.js +15 -5
- package/examples/jsm/renderers/nodes/accessors/SkinningNode.js +107 -0
- package/examples/jsm/renderers/nodes/accessors/UVNode.js +7 -5
- package/examples/jsm/renderers/nodes/core/ArrayInputNode.js +3 -3
- package/examples/jsm/renderers/nodes/core/AttributeNode.js +6 -0
- package/examples/jsm/renderers/nodes/core/BypassNode.js +38 -0
- package/examples/jsm/renderers/nodes/core/CodeNode.js +3 -3
- package/examples/jsm/renderers/nodes/core/ContextNode.js +4 -19
- package/examples/jsm/renderers/nodes/core/ExpressionNode.js +13 -2
- package/examples/jsm/renderers/nodes/core/FunctionNode.js +19 -132
- package/examples/jsm/renderers/nodes/core/InputNode.js +13 -3
- package/examples/jsm/renderers/nodes/core/Node.js +32 -10
- package/examples/jsm/renderers/nodes/core/NodeBuilder.js +146 -128
- package/examples/jsm/renderers/nodes/core/NodeFunction.js +22 -0
- package/examples/jsm/renderers/nodes/core/NodeFunctionInput.js +4 -4
- package/examples/jsm/renderers/nodes/core/NodeKeywords.js +18 -179
- package/examples/jsm/renderers/nodes/core/NodeParser.js +11 -0
- package/examples/jsm/renderers/nodes/core/NodeVar.js +2 -2
- package/examples/jsm/renderers/nodes/core/PropertyNode.js +14 -2
- package/examples/jsm/renderers/nodes/core/TempNode.js +10 -13
- package/examples/jsm/renderers/nodes/core/VarNode.js +12 -7
- package/examples/jsm/renderers/nodes/core/VaryNode.js +23 -8
- package/examples/jsm/renderers/nodes/core/constants.js +2 -0
- package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +47 -25
- package/examples/jsm/renderers/nodes/display/NormalMapNode.js +21 -22
- package/examples/jsm/renderers/nodes/functions/BSDFs.js +64 -101
- package/examples/jsm/renderers/nodes/inputs/BufferNode.js +25 -0
- package/examples/jsm/renderers/nodes/inputs/IntNode.js +17 -0
- package/examples/jsm/renderers/nodes/inputs/TextureNode.js +10 -2
- package/examples/jsm/renderers/nodes/lights/LightContextNode.js +20 -14
- package/examples/jsm/renderers/nodes/lights/LightNode.js +32 -36
- package/examples/jsm/renderers/nodes/math/CondNode.js +60 -0
- package/examples/jsm/renderers/nodes/math/MathNode.js +87 -36
- package/examples/jsm/renderers/nodes/math/OperatorNode.js +124 -31
- package/examples/jsm/renderers/nodes/parsers/GLSLNodeFunction.js +137 -0
- package/examples/jsm/renderers/nodes/parsers/GLSLNodeParser.js +14 -0
- package/examples/jsm/renderers/nodes/parsers/WGSLNodeFunction.js +89 -0
- package/examples/jsm/renderers/nodes/parsers/WGSLNodeParser.js +14 -0
- package/examples/jsm/renderers/nodes/procedural/CheckerNode.js +7 -9
- package/examples/jsm/renderers/nodes/utils/ArrayElementNode.js +31 -0
- package/examples/jsm/renderers/nodes/utils/ConvertNode.js +33 -0
- package/examples/jsm/renderers/nodes/utils/JoinNode.js +7 -7
- package/examples/jsm/renderers/nodes/utils/OscNode.js +58 -0
- package/examples/jsm/renderers/nodes/utils/SplitNode.js +18 -8
- package/examples/jsm/renderers/nodes/utils/SpriteSheetUVNode.js +7 -7
- package/examples/jsm/renderers/webgl/nodes/SlotNode.js +22 -0
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +191 -94
- package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +2 -2
- package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUBackground.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPUBindings.js +3 -3
- package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +2 -4
- package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +2 -4
- package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +15 -23
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +3 -5
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +11 -27
- package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +62 -28
- package/examples/jsm/renderers/webgpu/WebGPUTextures.js +34 -27
- package/examples/jsm/renderers/webgpu/constants.js +2 -2
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +430 -98
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +1 -1
- package/examples/jsm/utils/RoughnessMipmapper.js +1 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +6 -6
- package/package.json +10 -10
- package/src/Three.Legacy.js +6 -0
- package/src/Three.js +0 -1
- package/src/cameras/StereoCamera.js +8 -7
- package/src/constants.js +1 -2
- package/src/core/Layers.js +7 -1
- package/src/core/Object3D.js +2 -0
- package/src/extras/PMREMGenerator.js +11 -6
- package/src/loaders/FileLoader.js +89 -152
- package/src/loaders/ImageLoader.js +9 -4
- package/src/loaders/LoaderUtils.js +26 -0
- package/src/loaders/MaterialLoader.js +7 -4
- package/src/loaders/ObjectLoader.js +2 -0
- package/src/materials/Material.js +4 -4
- package/src/materials/MeshPhysicalMaterial.js +20 -14
- package/src/math/MathUtils.js +5 -16
- package/src/renderers/WebGLMultisampleRenderTarget.js +7 -1
- package/src/renderers/WebGLRenderer.js +83 -117
- package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -27
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +19 -6
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +13 -5
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib.js +6 -4
- package/src/renderers/shaders/UniformsLib.js +1 -2
- package/src/renderers/webgl/WebGLExtensions.js +1 -0
- package/src/renderers/webgl/WebGLMaterials.js +27 -15
- package/src/renderers/webgl/WebGLProgram.js +10 -6
- package/src/renderers/webgl/WebGLPrograms.js +17 -12
- package/src/renderers/webgl/WebGLShadowMap.js +14 -5
- package/src/renderers/webgl/WebGLState.js +31 -17
- package/src/renderers/webgl/WebGLTextures.js +188 -51
- package/src/renderers/webgl/WebGLUniforms.js +45 -1
- package/src/renderers/webxr/WebXRManager.js +71 -110
- package/src/textures/Texture.js +6 -0
- package/src/utils.js +37 -1
- package/examples/js/controls/DeviceOrientationControls.js +0 -147
- package/examples/js/libs/dat.gui.min.js +0 -14
- package/examples/jsm/controls/DeviceOrientationControls.js +0 -153
- package/examples/jsm/libs/dat.gui.module.js +0 -3575
- package/examples/jsm/libs/glslang.js +0 -78
- package/examples/jsm/libs/glslang.wasm +0 -0
- package/examples/jsm/renderers/nodes/consts/MathConsts.js +0 -7
- package/examples/jsm/renderers/nodes/core/ConstNode.js +0 -39
- package/examples/jsm/renderers/nodes/core/NodeSlot.js +0 -13
- package/examples/jsm/renderers/nodes/core/StructNode.js +0 -80
- package/examples/jsm/renderers/nodes/core/StructVarNode.js +0 -75
- package/examples/jsm/renderers/nodes/functions/EncodingFunctions.js +0 -99
- package/examples/jsm/renderers/nodes/functions/MathFunctions.js +0 -47
- package/examples/jsm/renderers/webgpu/nodes/ShaderLib.js +0 -152
- package/src/extras/objects/ImmediateRenderObject.js +0 -31
|
@@ -75,19 +75,19 @@ class MaterialLoader extends Loader {
|
|
|
75
75
|
if ( json.roughness !== undefined ) material.roughness = json.roughness;
|
|
76
76
|
if ( json.metalness !== undefined ) material.metalness = json.metalness;
|
|
77
77
|
if ( json.sheen !== undefined ) material.sheen = json.sheen;
|
|
78
|
-
if ( json.
|
|
78
|
+
if ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );
|
|
79
79
|
if ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;
|
|
80
80
|
if ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );
|
|
81
81
|
if ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );
|
|
82
82
|
if ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;
|
|
83
|
-
if ( json.
|
|
83
|
+
if ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );
|
|
84
84
|
if ( json.shininess !== undefined ) material.shininess = json.shininess;
|
|
85
85
|
if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;
|
|
86
86
|
if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;
|
|
87
87
|
if ( json.transmission !== undefined ) material.transmission = json.transmission;
|
|
88
88
|
if ( json.thickness !== undefined ) material.thickness = json.thickness;
|
|
89
89
|
if ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;
|
|
90
|
-
if ( json.
|
|
90
|
+
if ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );
|
|
91
91
|
if ( json.fog !== undefined ) material.fog = json.fog;
|
|
92
92
|
if ( json.flatShading !== undefined ) material.flatShading = json.flatShading;
|
|
93
93
|
if ( json.blending !== undefined ) material.blending = json.blending;
|
|
@@ -264,7 +264,7 @@ class MaterialLoader extends Loader {
|
|
|
264
264
|
|
|
265
265
|
if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );
|
|
266
266
|
if ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );
|
|
267
|
-
if ( json.
|
|
267
|
+
if ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );
|
|
268
268
|
|
|
269
269
|
if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
|
|
270
270
|
if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
|
|
@@ -288,6 +288,9 @@ class MaterialLoader extends Loader {
|
|
|
288
288
|
if ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );
|
|
289
289
|
if ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );
|
|
290
290
|
|
|
291
|
+
if ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );
|
|
292
|
+
if ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );
|
|
293
|
+
|
|
291
294
|
return material;
|
|
292
295
|
|
|
293
296
|
}
|
|
@@ -706,6 +706,8 @@ class ObjectLoader extends Loader {
|
|
|
706
706
|
if ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;
|
|
707
707
|
if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;
|
|
708
708
|
|
|
709
|
+
if ( data.userData !== undefined ) texture.userData = data.userData;
|
|
710
|
+
|
|
709
711
|
textures[ data.uuid ] = texture;
|
|
710
712
|
|
|
711
713
|
}
|
|
@@ -192,14 +192,14 @@ class Material extends EventDispatcher {
|
|
|
192
192
|
if ( this.metalness !== undefined ) data.metalness = this.metalness;
|
|
193
193
|
|
|
194
194
|
if ( this.sheen !== undefined ) data.sheen = this.sheen;
|
|
195
|
-
if ( this.
|
|
195
|
+
if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
|
|
196
196
|
if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
|
|
197
197
|
if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
|
|
198
198
|
if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
|
|
199
199
|
|
|
200
200
|
if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
|
|
201
201
|
if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
|
|
202
|
-
if ( this.
|
|
202
|
+
if ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();
|
|
203
203
|
if ( this.shininess !== undefined ) data.shininess = this.shininess;
|
|
204
204
|
if ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;
|
|
205
205
|
if ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;
|
|
@@ -270,7 +270,7 @@ class Material extends EventDispatcher {
|
|
|
270
270
|
if ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;
|
|
271
271
|
if ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;
|
|
272
272
|
if ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;
|
|
273
|
-
if ( this.
|
|
273
|
+
if ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;
|
|
274
274
|
|
|
275
275
|
if ( this.envMap && this.envMap.isTexture ) {
|
|
276
276
|
|
|
@@ -295,7 +295,7 @@ class Material extends EventDispatcher {
|
|
|
295
295
|
if ( this.thickness !== undefined ) data.thickness = this.thickness;
|
|
296
296
|
if ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;
|
|
297
297
|
if ( this.attenuationDistance !== undefined ) data.attenuationDistance = this.attenuationDistance;
|
|
298
|
-
if ( this.
|
|
298
|
+
if ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();
|
|
299
299
|
|
|
300
300
|
if ( this.size !== undefined ) data.size = this.size;
|
|
301
301
|
if ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;
|
|
@@ -16,8 +16,10 @@ import * as MathUtils from '../math/MathUtils.js';
|
|
|
16
16
|
* reflectivity: <float>,
|
|
17
17
|
*
|
|
18
18
|
* sheen: <float>,
|
|
19
|
-
*
|
|
19
|
+
* sheenColor: <Color>,
|
|
20
|
+
* sheenColorMap: new THREE.Texture( <Image> ),
|
|
20
21
|
* sheenRoughness: <float>,
|
|
22
|
+
* sheenRoughnessMap: new THREE.Texture( <Image> ),
|
|
21
23
|
*
|
|
22
24
|
* transmission: <float>,
|
|
23
25
|
* transmissionMap: new THREE.Texture( <Image> ),
|
|
@@ -25,12 +27,12 @@ import * as MathUtils from '../math/MathUtils.js';
|
|
|
25
27
|
* thickness: <float>,
|
|
26
28
|
* thicknessMap: new THREE.Texture( <Image> ),
|
|
27
29
|
* attenuationDistance: <float>,
|
|
28
|
-
*
|
|
30
|
+
* attenuationColor: <Color>,
|
|
29
31
|
*
|
|
30
32
|
* specularIntensity: <float>,
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
33
|
+
* specularIntensityMap: new THREE.Texture( <Image> ),
|
|
34
|
+
* specularColor: <Color>,
|
|
35
|
+
* specularColorMap: new THREE.Texture( <Image> )
|
|
34
36
|
* }
|
|
35
37
|
*/
|
|
36
38
|
|
|
@@ -70,20 +72,22 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
70
72
|
}
|
|
71
73
|
} );
|
|
72
74
|
|
|
73
|
-
this.
|
|
75
|
+
this.sheenColor = new Color( 0x000000 );
|
|
76
|
+
this.sheenColorMap = null;
|
|
74
77
|
this.sheenRoughness = 1.0;
|
|
78
|
+
this.sheenRoughnessMap = null;
|
|
75
79
|
|
|
76
80
|
this.transmissionMap = null;
|
|
77
81
|
|
|
78
|
-
this.thickness = 0
|
|
82
|
+
this.thickness = 0;
|
|
79
83
|
this.thicknessMap = null;
|
|
80
84
|
this.attenuationDistance = 0.0;
|
|
81
|
-
this.
|
|
85
|
+
this.attenuationColor = new Color( 1, 1, 1 );
|
|
82
86
|
|
|
83
87
|
this.specularIntensity = 1.0;
|
|
84
88
|
this.specularIntensityMap = null;
|
|
85
|
-
this.
|
|
86
|
-
this.
|
|
89
|
+
this.specularColor = new Color( 1, 1, 1 );
|
|
90
|
+
this.specularColorMap = null;
|
|
87
91
|
|
|
88
92
|
this._sheen = 0.0;
|
|
89
93
|
this._clearcoat = 0;
|
|
@@ -168,8 +172,10 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
168
172
|
this.ior = source.ior;
|
|
169
173
|
|
|
170
174
|
this.sheen = source.sheen;
|
|
171
|
-
this.
|
|
175
|
+
this.sheenColor.copy( source.sheenColor );
|
|
176
|
+
this.sheenColorMap = source.sheenColorMap;
|
|
172
177
|
this.sheenRoughness = source.sheenRoughness;
|
|
178
|
+
this.sheenRoughnessMap = source.sheenRoughnessMap;
|
|
173
179
|
|
|
174
180
|
this.transmission = source.transmission;
|
|
175
181
|
this.transmissionMap = source.transmissionMap;
|
|
@@ -177,12 +183,12 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
|
|
|
177
183
|
this.thickness = source.thickness;
|
|
178
184
|
this.thicknessMap = source.thicknessMap;
|
|
179
185
|
this.attenuationDistance = source.attenuationDistance;
|
|
180
|
-
this.
|
|
186
|
+
this.attenuationColor.copy( source.attenuationColor );
|
|
181
187
|
|
|
182
188
|
this.specularIntensity = source.specularIntensity;
|
|
183
189
|
this.specularIntensityMap = source.specularIntensityMap;
|
|
184
|
-
this.
|
|
185
|
-
this.
|
|
190
|
+
this.specularColor.copy( source.specularColor );
|
|
191
|
+
this.specularColorMap = source.specularColorMap;
|
|
186
192
|
|
|
187
193
|
return this;
|
|
188
194
|
|
package/src/math/MathUtils.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
let _seed = 1234567;
|
|
2
|
-
|
|
3
|
-
const DEG2RAD = Math.PI / 180;
|
|
4
|
-
const RAD2DEG = 180 / Math.PI;
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
|
|
8
1
|
const _lut = [];
|
|
9
2
|
|
|
10
3
|
for ( let i = 0; i < 256; i ++ ) {
|
|
@@ -13,18 +6,14 @@ for ( let i = 0; i < 256; i ++ ) {
|
|
|
13
6
|
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function generateUUID() {
|
|
19
|
-
|
|
20
|
-
if ( hasRandomUUID ) {
|
|
9
|
+
let _seed = 1234567;
|
|
21
10
|
|
|
22
|
-
return crypto.randomUUID().toUpperCase();
|
|
23
11
|
|
|
24
|
-
|
|
12
|
+
const DEG2RAD = Math.PI / 180;
|
|
13
|
+
const RAD2DEG = 180 / Math.PI;
|
|
25
14
|
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
|
|
16
|
+
function generateUUID() {
|
|
28
17
|
|
|
29
18
|
const d0 = Math.random() * 0xffffffff | 0;
|
|
30
19
|
const d1 = Math.random() * 0xffffffff | 0;
|
|
@@ -2,12 +2,16 @@ import { WebGLRenderTarget } from './WebGLRenderTarget.js';
|
|
|
2
2
|
|
|
3
3
|
class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
|
|
4
4
|
|
|
5
|
-
constructor( width, height, options ) {
|
|
5
|
+
constructor( width, height, options = {} ) {
|
|
6
6
|
|
|
7
7
|
super( width, height, options );
|
|
8
8
|
|
|
9
9
|
this.samples = 4;
|
|
10
10
|
|
|
11
|
+
this.ignoreDepthForMultisampleCopy = options.ignoreDepth !== undefined ? options.ignoreDepth : true;
|
|
12
|
+
this.useRenderToTexture = ( options.useRenderToTexture !== undefined ) ? options.useRenderToTexture : false;
|
|
13
|
+
this.useRenderbuffer = this.useRenderToTexture === false;
|
|
14
|
+
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
copy( source ) {
|
|
@@ -15,6 +19,8 @@ class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
|
|
|
15
19
|
super.copy.call( this, source );
|
|
16
20
|
|
|
17
21
|
this.samples = source.samples;
|
|
22
|
+
this.useRenderToTexture = source.useRenderToTexture;
|
|
23
|
+
this.useRenderbuffer = source.useRenderbuffer;
|
|
18
24
|
|
|
19
25
|
return this;
|
|
20
26
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
REVISION,
|
|
2
3
|
BackSide,
|
|
3
4
|
DoubleSide,
|
|
4
5
|
FrontSide,
|
|
@@ -216,8 +217,10 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
216
217
|
failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat
|
|
217
218
|
};
|
|
218
219
|
|
|
219
|
-
//
|
|
220
|
+
// OffscreenCanvas does not have setAttribute, see #22811
|
|
221
|
+
if ( 'setAttribute' in _canvas ) _canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );
|
|
220
222
|
|
|
223
|
+
// event listeners must be registered before WebGL context is created, see #12753
|
|
221
224
|
_canvas.addEventListener( 'webglcontextlost', onContextLost, false );
|
|
222
225
|
_canvas.addEventListener( 'webglcontextrestored', onContextRestore, false );
|
|
223
226
|
|
|
@@ -659,77 +662,6 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
659
662
|
|
|
660
663
|
// Buffer rendering
|
|
661
664
|
|
|
662
|
-
function renderObjectImmediate( object, program ) {
|
|
663
|
-
|
|
664
|
-
object.render( function ( object ) {
|
|
665
|
-
|
|
666
|
-
_this.renderBufferImmediate( object, program );
|
|
667
|
-
|
|
668
|
-
} );
|
|
669
|
-
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
this.renderBufferImmediate = function ( object, program ) {
|
|
673
|
-
|
|
674
|
-
bindingStates.initAttributes();
|
|
675
|
-
|
|
676
|
-
const buffers = properties.get( object );
|
|
677
|
-
|
|
678
|
-
if ( object.hasPositions && ! buffers.position ) buffers.position = _gl.createBuffer();
|
|
679
|
-
if ( object.hasNormals && ! buffers.normal ) buffers.normal = _gl.createBuffer();
|
|
680
|
-
if ( object.hasUvs && ! buffers.uv ) buffers.uv = _gl.createBuffer();
|
|
681
|
-
if ( object.hasColors && ! buffers.color ) buffers.color = _gl.createBuffer();
|
|
682
|
-
|
|
683
|
-
const programAttributes = program.getAttributes();
|
|
684
|
-
|
|
685
|
-
if ( object.hasPositions ) {
|
|
686
|
-
|
|
687
|
-
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.position );
|
|
688
|
-
_gl.bufferData( _gl.ARRAY_BUFFER, object.positionArray, _gl.DYNAMIC_DRAW );
|
|
689
|
-
|
|
690
|
-
bindingStates.enableAttribute( programAttributes.position.location );
|
|
691
|
-
_gl.vertexAttribPointer( programAttributes.position.location, 3, _gl.FLOAT, false, 0, 0 );
|
|
692
|
-
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
if ( object.hasNormals ) {
|
|
696
|
-
|
|
697
|
-
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.normal );
|
|
698
|
-
_gl.bufferData( _gl.ARRAY_BUFFER, object.normalArray, _gl.DYNAMIC_DRAW );
|
|
699
|
-
|
|
700
|
-
bindingStates.enableAttribute( programAttributes.normal.location );
|
|
701
|
-
_gl.vertexAttribPointer( programAttributes.normal.location, 3, _gl.FLOAT, false, 0, 0 );
|
|
702
|
-
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
if ( object.hasUvs ) {
|
|
706
|
-
|
|
707
|
-
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.uv );
|
|
708
|
-
_gl.bufferData( _gl.ARRAY_BUFFER, object.uvArray, _gl.DYNAMIC_DRAW );
|
|
709
|
-
|
|
710
|
-
bindingStates.enableAttribute( programAttributes.uv.location );
|
|
711
|
-
_gl.vertexAttribPointer( programAttributes.uv.location, 2, _gl.FLOAT, false, 0, 0 );
|
|
712
|
-
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
if ( object.hasColors ) {
|
|
716
|
-
|
|
717
|
-
_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.color );
|
|
718
|
-
_gl.bufferData( _gl.ARRAY_BUFFER, object.colorArray, _gl.DYNAMIC_DRAW );
|
|
719
|
-
|
|
720
|
-
bindingStates.enableAttribute( programAttributes.color.location );
|
|
721
|
-
_gl.vertexAttribPointer( programAttributes.color.location, 3, _gl.FLOAT, false, 0, 0 );
|
|
722
|
-
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
bindingStates.disableUnusedAttributes();
|
|
726
|
-
|
|
727
|
-
_gl.drawArrays( _gl.TRIANGLES, 0, object.count );
|
|
728
|
-
|
|
729
|
-
object.count = 0;
|
|
730
|
-
|
|
731
|
-
};
|
|
732
|
-
|
|
733
665
|
this.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {
|
|
734
666
|
|
|
735
667
|
if ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)
|
|
@@ -1171,17 +1103,6 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
1171
1103
|
|
|
1172
1104
|
}
|
|
1173
1105
|
|
|
1174
|
-
} else if ( object.isImmediateRenderObject ) {
|
|
1175
|
-
|
|
1176
|
-
if ( sortObjects ) {
|
|
1177
|
-
|
|
1178
|
-
_vector3.setFromMatrixPosition( object.matrixWorld )
|
|
1179
|
-
.applyMatrix4( _projScreenMatrix );
|
|
1180
|
-
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
currentRenderList.push( object, null, object.material, groupOrder, _vector3.z, null );
|
|
1184
|
-
|
|
1185
1106
|
} else if ( object.isMesh || object.isLine || object.isPoints ) {
|
|
1186
1107
|
|
|
1187
1108
|
if ( object.isSkinnedMesh ) {
|
|
@@ -1279,7 +1200,8 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
1279
1200
|
minFilter: LinearMipmapLinearFilter,
|
|
1280
1201
|
magFilter: NearestFilter,
|
|
1281
1202
|
wrapS: ClampToEdgeWrapping,
|
|
1282
|
-
wrapT: ClampToEdgeWrapping
|
|
1203
|
+
wrapT: ClampToEdgeWrapping,
|
|
1204
|
+
useRenderToTexture: extensions.has( 'WEBGL_multisampled_render_to_texture' )
|
|
1283
1205
|
} );
|
|
1284
1206
|
|
|
1285
1207
|
}
|
|
@@ -1336,35 +1258,21 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
1336
1258
|
|
|
1337
1259
|
material.onBeforeRender( _this, scene, camera, geometry, object, group );
|
|
1338
1260
|
|
|
1339
|
-
if (
|
|
1261
|
+
if ( material.transparent === true && material.side === DoubleSide ) {
|
|
1340
1262
|
|
|
1341
|
-
|
|
1263
|
+
material.side = BackSide;
|
|
1264
|
+
material.needsUpdate = true;
|
|
1265
|
+
_this.renderBufferDirect( camera, scene, geometry, material, object, group );
|
|
1342
1266
|
|
|
1343
|
-
|
|
1267
|
+
material.side = FrontSide;
|
|
1268
|
+
material.needsUpdate = true;
|
|
1269
|
+
_this.renderBufferDirect( camera, scene, geometry, material, object, group );
|
|
1344
1270
|
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
renderObjectImmediate( object, program );
|
|
1271
|
+
material.side = DoubleSide;
|
|
1348
1272
|
|
|
1349
1273
|
} else {
|
|
1350
1274
|
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
material.side = BackSide;
|
|
1354
|
-
material.needsUpdate = true;
|
|
1355
|
-
_this.renderBufferDirect( camera, scene, geometry, material, object, group );
|
|
1356
|
-
|
|
1357
|
-
material.side = FrontSide;
|
|
1358
|
-
material.needsUpdate = true;
|
|
1359
|
-
_this.renderBufferDirect( camera, scene, geometry, material, object, group );
|
|
1360
|
-
|
|
1361
|
-
material.side = DoubleSide;
|
|
1362
|
-
|
|
1363
|
-
} else {
|
|
1364
|
-
|
|
1365
|
-
_this.renderBufferDirect( camera, scene, geometry, material, object, group );
|
|
1366
|
-
|
|
1367
|
-
}
|
|
1275
|
+
_this.renderBufferDirect( camera, scene, geometry, material, object, group );
|
|
1368
1276
|
|
|
1369
1277
|
}
|
|
1370
1278
|
|
|
@@ -1423,7 +1331,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
1423
1331
|
|
|
1424
1332
|
parameters.uniforms = programCache.getUniforms( material );
|
|
1425
1333
|
|
|
1426
|
-
material.onBuild( parameters, _this );
|
|
1334
|
+
material.onBuild( object, parameters, _this );
|
|
1427
1335
|
|
|
1428
1336
|
material.onBeforeCompile( parameters, _this );
|
|
1429
1337
|
|
|
@@ -1513,11 +1421,11 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
1513
1421
|
const environment = material.isMeshStandardMaterial ? scene.environment : null;
|
|
1514
1422
|
const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
|
|
1515
1423
|
const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
|
|
1516
|
-
const vertexAlphas = material.vertexColors === true && !! geometry
|
|
1517
|
-
const vertexTangents = !! material.normalMap && !! geometry
|
|
1518
|
-
const morphTargets = !! geometry
|
|
1519
|
-
const morphNormals = !! geometry
|
|
1520
|
-
const morphTargetsCount =
|
|
1424
|
+
const vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
|
|
1425
|
+
const vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;
|
|
1426
|
+
const morphTargets = !! geometry.morphAttributes.position;
|
|
1427
|
+
const morphNormals = !! geometry.morphAttributes.normal;
|
|
1428
|
+
const morphTargetsCount = !! geometry.morphAttributes.position ? geometry.morphAttributes.position.length : 0;
|
|
1521
1429
|
|
|
1522
1430
|
const materialProperties = properties.get( material );
|
|
1523
1431
|
const lights = currentRenderState.state.lights;
|
|
@@ -1885,15 +1793,71 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
1885
1793
|
|
|
1886
1794
|
};
|
|
1887
1795
|
|
|
1796
|
+
this.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {
|
|
1797
|
+
|
|
1798
|
+
properties.get( renderTarget.texture ).__webglTexture = colorTexture;
|
|
1799
|
+
properties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;
|
|
1800
|
+
|
|
1801
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
1802
|
+
renderTargetProperties.__hasExternalTextures = true;
|
|
1803
|
+
|
|
1804
|
+
if ( renderTargetProperties.__hasExternalTextures ) {
|
|
1805
|
+
|
|
1806
|
+
renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
|
|
1807
|
+
|
|
1808
|
+
if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
|
|
1809
|
+
|
|
1810
|
+
// The multisample_render_to_texture extension doesn't work properly if there
|
|
1811
|
+
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
1812
|
+
if ( renderTarget.useRenderToTexture ) {
|
|
1813
|
+
|
|
1814
|
+
console.warn( 'render-to-texture extension was disabled because an external texture was provided' );
|
|
1815
|
+
renderTarget.useRenderToTexture = false;
|
|
1816
|
+
renderTarget.useRenderbuffer = true;
|
|
1817
|
+
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
};
|
|
1825
|
+
|
|
1826
|
+
this.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {
|
|
1827
|
+
|
|
1828
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
1829
|
+
renderTargetProperties.__webglFramebuffer = defaultFramebuffer;
|
|
1830
|
+
renderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;
|
|
1831
|
+
|
|
1832
|
+
};
|
|
1833
|
+
|
|
1888
1834
|
this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {
|
|
1889
1835
|
|
|
1890
1836
|
_currentRenderTarget = renderTarget;
|
|
1891
1837
|
_currentActiveCubeFace = activeCubeFace;
|
|
1892
1838
|
_currentActiveMipmapLevel = activeMipmapLevel;
|
|
1839
|
+
let useDefaultFramebuffer = true;
|
|
1893
1840
|
|
|
1894
|
-
if ( renderTarget
|
|
1841
|
+
if ( renderTarget ) {
|
|
1842
|
+
|
|
1843
|
+
const renderTargetProperties = properties.get( renderTarget );
|
|
1844
|
+
|
|
1845
|
+
if ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {
|
|
1846
|
+
|
|
1847
|
+
// We need to make sure to rebind the framebuffer.
|
|
1848
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, null );
|
|
1849
|
+
useDefaultFramebuffer = false;
|
|
1850
|
+
|
|
1851
|
+
} else if ( renderTargetProperties.__webglFramebuffer === undefined ) {
|
|
1895
1852
|
|
|
1896
|
-
|
|
1853
|
+
textures.setupRenderTarget( renderTarget );
|
|
1854
|
+
|
|
1855
|
+
} else if ( renderTargetProperties.__hasExternalTextures ) {
|
|
1856
|
+
|
|
1857
|
+
// Color and depth texture must be rebound in order for the swapchain to update.
|
|
1858
|
+
textures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );
|
|
1859
|
+
|
|
1860
|
+
}
|
|
1897
1861
|
|
|
1898
1862
|
}
|
|
1899
1863
|
|
|
@@ -1918,7 +1882,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
1918
1882
|
framebuffer = __webglFramebuffer[ activeCubeFace ];
|
|
1919
1883
|
isCube = true;
|
|
1920
1884
|
|
|
1921
|
-
} else if ( renderTarget.
|
|
1885
|
+
} else if ( renderTarget.useRenderbuffer ) {
|
|
1922
1886
|
|
|
1923
1887
|
framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
|
|
1924
1888
|
|
|
@@ -1942,7 +1906,7 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
1942
1906
|
|
|
1943
1907
|
const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
1944
1908
|
|
|
1945
|
-
if ( framebufferBound && capabilities.drawBuffers ) {
|
|
1909
|
+
if ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {
|
|
1946
1910
|
|
|
1947
1911
|
let needsUpdate = false;
|
|
1948
1912
|
|
|
@@ -2279,4 +2243,6 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
2279
2243
|
|
|
2280
2244
|
}
|
|
2281
2245
|
|
|
2246
|
+
WebGLRenderer.prototype.isWebGLRenderer = true;
|
|
2247
|
+
|
|
2282
2248
|
export { WebGLRenderer };
|
|
@@ -239,7 +239,7 @@ float V_Neubelt( float dotNV, float dotNL ) {
|
|
|
239
239
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3
|
|
242
|
+
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
|
243
243
|
|
|
244
244
|
vec3 halfDir = normalize( lightDir + viewDir );
|
|
245
245
|
|
|
@@ -250,7 +250,7 @@ vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 no
|
|
|
250
250
|
float D = D_Charlie( sheenRoughness, dotNH );
|
|
251
251
|
float V = V_Neubelt( dotNV, dotNL );
|
|
252
252
|
|
|
253
|
-
return
|
|
253
|
+
return sheenColor * ( D * V );
|
|
254
254
|
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -59,31 +59,4 @@ vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
|
|
|
59
59
|
D = clamp( floor( D ) / 255.0, 0.0, 1.0 );
|
|
60
60
|
return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
// LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html
|
|
64
|
-
|
|
65
|
-
// M matrix, for encoding
|
|
66
|
-
const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
|
|
67
|
-
vec4 LinearToLogLuv( in vec4 value ) {
|
|
68
|
-
vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
|
|
69
|
-
Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
|
|
70
|
-
vec4 vResult;
|
|
71
|
-
vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
|
|
72
|
-
float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
|
|
73
|
-
vResult.w = fract( Le );
|
|
74
|
-
vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
|
|
75
|
-
return vResult;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Inverse M matrix, for decoding
|
|
79
|
-
const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
|
|
80
|
-
vec4 LogLuvToLinear( in vec4 value ) {
|
|
81
|
-
float Le = value.z * 255.0 + value.w;
|
|
82
|
-
vec3 Xp_Y_XYZp;
|
|
83
|
-
Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
|
|
84
|
-
Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
|
|
85
|
-
Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
|
|
86
|
-
vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
|
|
87
|
-
return vec4( max( vRGB, 0.0 ), 1.0 );
|
|
88
|
-
}
|
|
89
62
|
`;
|
|
@@ -14,7 +14,7 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
14
14
|
#ifdef SPECULAR
|
|
15
15
|
|
|
16
16
|
float specularIntensityFactor = specularIntensity;
|
|
17
|
-
vec3
|
|
17
|
+
vec3 specularColorFactor = specularColor;
|
|
18
18
|
|
|
19
19
|
#ifdef USE_SPECULARINTENSITYMAP
|
|
20
20
|
|
|
@@ -22,9 +22,9 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
22
22
|
|
|
23
23
|
#endif
|
|
24
24
|
|
|
25
|
-
#ifdef
|
|
25
|
+
#ifdef USE_SPECULARCOLORMAP
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
specularColorFactor *= specularColorMapTexelToLinear( texture2D( specularColorMap, vUv ) ).rgb;
|
|
28
28
|
|
|
29
29
|
#endif
|
|
30
30
|
|
|
@@ -33,12 +33,12 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
33
33
|
#else
|
|
34
34
|
|
|
35
35
|
float specularIntensityFactor = 1.0;
|
|
36
|
-
vec3
|
|
36
|
+
vec3 specularColorFactor = vec3( 1.0 );
|
|
37
37
|
material.specularF90 = 1.0;
|
|
38
38
|
|
|
39
39
|
#endif
|
|
40
40
|
|
|
41
|
-
material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) *
|
|
41
|
+
material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
|
|
42
42
|
|
|
43
43
|
#else
|
|
44
44
|
|
|
@@ -75,8 +75,21 @@ material.roughness = min( material.roughness, 1.0 );
|
|
|
75
75
|
|
|
76
76
|
#ifdef USE_SHEEN
|
|
77
77
|
|
|
78
|
-
material.
|
|
78
|
+
material.sheenColor = sheenColor;
|
|
79
|
+
|
|
80
|
+
#ifdef USE_SHEENCOLORMAP
|
|
81
|
+
|
|
82
|
+
material.sheenColor *= sheenColorMapTexelToLinear( texture2D( sheenColorMap, vUv ) ).rgb;
|
|
83
|
+
|
|
84
|
+
#endif
|
|
85
|
+
|
|
79
86
|
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
|
|
80
87
|
|
|
88
|
+
#ifdef USE_SHEENROUGHNESSMAP
|
|
89
|
+
|
|
90
|
+
material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
|
|
91
|
+
|
|
92
|
+
#endif
|
|
93
|
+
|
|
81
94
|
#endif
|
|
82
95
|
`;
|
|
@@ -14,7 +14,7 @@ struct PhysicalMaterial {
|
|
|
14
14
|
#endif
|
|
15
15
|
|
|
16
16
|
#ifdef USE_SHEEN
|
|
17
|
-
vec3
|
|
17
|
+
vec3 sheenColor;
|
|
18
18
|
float sheenRoughness;
|
|
19
19
|
#endif
|
|
20
20
|
|
|
@@ -133,7 +133,7 @@ void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricC
|
|
|
133
133
|
|
|
134
134
|
#ifdef USE_SHEEN
|
|
135
135
|
|
|
136
|
-
reflectedLight.directSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.
|
|
136
|
+
reflectedLight.directSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
|
|
137
137
|
|
|
138
138
|
#endif
|
|
139
139
|
|
|
@@ -24,7 +24,7 @@ export default /* glsl */`
|
|
|
24
24
|
vec4 transmission = getIBLVolumeRefraction(
|
|
25
25
|
n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,
|
|
26
26
|
pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,
|
|
27
|
-
|
|
27
|
+
attenuationColor, attenuationDistance );
|
|
28
28
|
|
|
29
29
|
totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );
|
|
30
30
|
transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );
|