super-three 0.155.0 → 0.157.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.cjs +361 -324
- package/build/three.js +361 -324
- package/build/three.min.js +2 -2
- package/build/three.module.js +354 -323
- package/build/three.module.min.js +1 -1
- package/examples/jsm/capabilities/WebGL.js +17 -0
- package/examples/jsm/controls/DragControls.js +3 -2
- package/examples/jsm/controls/OrbitControls.js +13 -5
- package/examples/jsm/csm/CSMShader.js +59 -21
- package/examples/jsm/exporters/EXRExporter.js +102 -24
- package/examples/jsm/exporters/GLTFExporter.js +1 -1
- package/examples/jsm/libs/rhino3dm/rhino3dm.js +8726 -4
- package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +8737 -4
- package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
- package/examples/jsm/libs/tween.module.js +790 -735
- package/examples/jsm/libs/utif.module.js +1644 -1558
- package/examples/jsm/lights/LightProbeGenerator.js +37 -3
- package/examples/jsm/lines/LineMaterial.js +90 -156
- package/examples/jsm/loaders/3DMLoader.js +378 -104
- package/examples/jsm/loaders/DDSLoader.js +46 -3
- package/examples/jsm/loaders/EXRLoader.js +4 -4
- package/examples/jsm/loaders/FBXLoader.js +2 -0
- package/examples/jsm/loaders/GLTFLoader.js +18 -8
- package/examples/jsm/loaders/KTX2Loader.js +126 -77
- package/examples/jsm/loaders/LDrawLoader.js +22 -16
- package/examples/jsm/loaders/LogLuvLoader.js +2 -2
- package/examples/jsm/loaders/MMDLoader.js +10 -7
- package/examples/jsm/loaders/RGBELoader.js +48 -66
- package/examples/jsm/loaders/STLLoader.js +7 -0
- package/examples/jsm/loaders/USDZLoader.js +215 -12
- package/examples/jsm/materials/MeshGouraudMaterial.js +22 -18
- package/examples/jsm/nodes/Nodes.js +8 -1
- package/examples/jsm/nodes/accessors/BitangentNode.js +1 -1
- package/examples/jsm/nodes/accessors/BufferAttributeNode.js +30 -4
- package/examples/jsm/nodes/accessors/BufferNode.js +1 -1
- package/examples/jsm/nodes/accessors/CameraNode.js +1 -1
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +19 -4
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +4 -5
- package/examples/jsm/nodes/accessors/InstanceNode.js +2 -2
- package/examples/jsm/nodes/accessors/LineMaterialNode.js +29 -0
- package/examples/jsm/nodes/accessors/MaterialNode.js +23 -13
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +12 -9
- package/examples/jsm/nodes/accessors/ModelNode.js +1 -1
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +5 -4
- package/examples/jsm/nodes/accessors/MorphNode.js +4 -4
- package/examples/jsm/nodes/accessors/NormalNode.js +1 -1
- package/examples/jsm/nodes/accessors/Object3DNode.js +3 -3
- package/examples/jsm/nodes/accessors/PointUVNode.js +1 -1
- package/examples/jsm/nodes/accessors/PositionNode.js +1 -1
- package/examples/jsm/nodes/accessors/ReferenceNode.js +13 -7
- package/examples/jsm/nodes/accessors/ReflectVectorNode.js +2 -2
- package/examples/jsm/nodes/accessors/SceneNode.js +2 -2
- package/examples/jsm/nodes/accessors/SkinningNode.js +2 -2
- package/examples/jsm/nodes/accessors/StorageBufferNode.js +1 -1
- package/examples/jsm/nodes/accessors/TangentNode.js +1 -1
- package/examples/jsm/nodes/accessors/TextureBicubicNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureNode.js +18 -8
- package/examples/jsm/nodes/accessors/TextureSizeNode.js +2 -2
- package/examples/jsm/nodes/accessors/TextureStoreNode.js +29 -0
- package/examples/jsm/nodes/accessors/UVNode.js +1 -1
- package/examples/jsm/nodes/accessors/UserDataNode.js +2 -2
- package/examples/jsm/nodes/code/CodeNode.js +1 -1
- package/examples/jsm/nodes/code/ExpressionNode.js +1 -1
- package/examples/jsm/nodes/code/FunctionCallNode.js +1 -1
- package/examples/jsm/nodes/code/FunctionNode.js +18 -7
- package/examples/jsm/nodes/code/ScriptableNode.js +2 -2
- package/examples/jsm/nodes/code/ScriptableValueNode.js +2 -2
- package/examples/jsm/nodes/core/ArrayUniformNode.js +1 -1
- package/examples/jsm/nodes/core/AttributeNode.js +3 -3
- package/examples/jsm/nodes/core/BypassNode.js +1 -1
- package/examples/jsm/nodes/core/CacheNode.js +1 -1
- package/examples/jsm/nodes/core/ConstNode.js +1 -1
- package/examples/jsm/nodes/core/ContextNode.js +2 -2
- package/examples/jsm/nodes/core/IndexNode.js +1 -1
- package/examples/jsm/nodes/core/InputNode.js +1 -1
- package/examples/jsm/nodes/core/Node.js +45 -14
- package/examples/jsm/nodes/core/NodeBuilder.js +83 -15
- package/examples/jsm/nodes/core/NodeFrame.js +37 -14
- package/examples/jsm/nodes/core/NodeUniform.js +1 -1
- package/examples/jsm/nodes/core/OutputStructNode.js +62 -0
- package/examples/jsm/nodes/core/PropertyNode.js +3 -1
- package/examples/jsm/nodes/core/StackNode.js +5 -5
- package/examples/jsm/nodes/core/StructTypeNode.js +24 -0
- package/examples/jsm/nodes/core/TempNode.js +1 -1
- package/examples/jsm/nodes/core/UniformNode.js +3 -1
- package/examples/jsm/nodes/core/VarNode.js +1 -1
- package/examples/jsm/nodes/core/VaryingNode.js +1 -1
- package/examples/jsm/nodes/core/constants.js +1 -1
- package/examples/jsm/nodes/display/BlendModeNode.js +2 -2
- package/examples/jsm/nodes/display/BumpMapNode.js +2 -2
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +2 -2
- package/examples/jsm/nodes/display/ColorSpaceNode.js +2 -2
- package/examples/jsm/nodes/display/FrontFacingNode.js +1 -1
- package/examples/jsm/nodes/display/NormalMapNode.js +2 -2
- package/examples/jsm/nodes/display/PosterizeNode.js +2 -2
- package/examples/jsm/nodes/display/ToneMappingNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportDepthNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportNode.js +21 -7
- package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +1 -1
- package/examples/jsm/nodes/display/ViewportTextureNode.js +1 -1
- package/examples/jsm/nodes/fog/FogExp2Node.js +2 -2
- package/examples/jsm/nodes/fog/FogNode.js +2 -2
- package/examples/jsm/nodes/fog/FogRangeNode.js +2 -2
- package/examples/jsm/nodes/geometry/RangeNode.js +2 -2
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +1 -1
- package/examples/jsm/nodes/lighting/AONode.js +2 -2
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +4 -4
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +4 -4
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +2 -2
- package/examples/jsm/nodes/lighting/HemisphereLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/IESSpotLightNode.js +2 -2
- package/examples/jsm/nodes/lighting/LightNode.js +2 -2
- package/examples/jsm/nodes/lighting/LightingContextNode.js +3 -3
- package/examples/jsm/nodes/lighting/LightingNode.js +1 -1
- package/examples/jsm/nodes/lighting/LightsNode.js +4 -4
- package/examples/jsm/nodes/lighting/PointLightNode.js +3 -3
- package/examples/jsm/nodes/lighting/SpotLightNode.js +4 -4
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +449 -0
- package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +54 -0
- package/examples/jsm/nodes/materials/Materials.js +2 -0
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +2 -2
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +6 -6
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/NodeMaterial.js +39 -29
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +1 -1
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +2 -2
- package/examples/jsm/nodes/math/CondNode.js +1 -1
- package/examples/jsm/nodes/math/HashNode.js +34 -0
- package/examples/jsm/nodes/math/MathNode.js +2 -2
- package/examples/jsm/nodes/math/OperatorNode.js +1 -1
- package/examples/jsm/nodes/procedural/CheckerNode.js +3 -3
- package/examples/jsm/nodes/shadernode/ShaderNode.js +85 -28
- package/examples/jsm/nodes/utils/ArrayElementNode.js +1 -1
- package/examples/jsm/nodes/utils/ConvertNode.js +1 -1
- package/examples/jsm/nodes/utils/DiscardNode.js +1 -1
- package/examples/jsm/nodes/utils/EquirectUVNode.js +2 -2
- package/examples/jsm/nodes/utils/JoinNode.js +1 -1
- package/examples/jsm/nodes/utils/LoopNode.js +11 -11
- package/examples/jsm/nodes/utils/MatcapUVNode.js +2 -2
- package/examples/jsm/nodes/utils/MaxMipLevelNode.js +1 -1
- package/examples/jsm/nodes/utils/OscNode.js +2 -2
- package/examples/jsm/nodes/utils/PackingNode.js +2 -2
- package/examples/jsm/nodes/utils/RemapNode.js +2 -2
- package/examples/jsm/nodes/utils/RotateUVNode.js +2 -2
- package/examples/jsm/nodes/utils/SetNode.js +62 -0
- package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +2 -2
- package/examples/jsm/nodes/utils/SplitNode.js +2 -2
- package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +2 -2
- package/examples/jsm/nodes/utils/TimerNode.js +2 -2
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +2 -2
- package/examples/jsm/objects/Sky.js +1 -3
- package/examples/jsm/postprocessing/FilmPass.js +3 -5
- package/examples/jsm/postprocessing/OutputPass.js +3 -2
- package/examples/jsm/postprocessing/RenderPass.js +30 -12
- package/examples/jsm/postprocessing/SAOPass.js +23 -98
- package/examples/jsm/postprocessing/SSAOPass.js +10 -30
- package/examples/jsm/renderers/common/Backend.js +11 -8
- package/examples/jsm/renderers/common/Background.js +2 -2
- package/examples/jsm/renderers/common/Binding.js +6 -0
- package/examples/jsm/renderers/common/Bindings.js +4 -5
- package/examples/jsm/renderers/common/Pipelines.js +9 -9
- package/examples/jsm/renderers/common/RenderContext.js +3 -0
- package/examples/jsm/renderers/common/RenderContexts.js +26 -1
- package/examples/jsm/renderers/common/RenderList.js +12 -4
- package/examples/jsm/renderers/common/RenderObject.js +43 -15
- package/examples/jsm/renderers/common/RenderObjects.js +8 -14
- package/examples/jsm/renderers/common/Renderer.js +52 -16
- package/examples/jsm/renderers/common/SampledTexture.js +6 -3
- package/examples/jsm/renderers/common/Sampler.js +1 -1
- package/examples/jsm/renderers/common/StorageBuffer.js +1 -1
- package/examples/jsm/renderers/common/StorageTexture.js +19 -0
- package/examples/jsm/renderers/common/Textures.js +166 -21
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +35 -0
- package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +21 -11
- package/examples/jsm/renderers/common/nodes/NodeSampler.js +1 -7
- package/examples/jsm/renderers/common/nodes/Nodes.js +79 -18
- package/examples/jsm/renderers/webgl/WebGLBackend.js +702 -0
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +207 -20
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +84 -0
- package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +26 -0
- package/examples/jsm/renderers/webgl/utils/WebGLState.js +529 -0
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +212 -0
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +242 -0
- package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +340 -0
- package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodeBuilder.js +4 -4
- package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodes.js +14 -2
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +282 -43
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +18 -2
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +93 -60
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +2 -2
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +15 -2
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +39 -14
- package/examples/jsm/renderers/webgpu/utils/WebGPUTexturePassUtils.js +285 -0
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +205 -284
- package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +6 -5
- package/examples/jsm/shaders/FilmShader.js +11 -54
- package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
- package/examples/jsm/shaders/MMDToonShader.js +4 -4
- package/examples/jsm/shaders/OutputShader.js +2 -2
- package/examples/jsm/shaders/SAOShader.js +0 -13
- package/examples/jsm/shaders/SSAOShader.js +33 -26
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +6 -6
- package/examples/jsm/utils/BufferGeometryUtils.js +6 -4
- package/package.json +1 -1
- package/src/Three.js +1 -2
- package/src/animation/AnimationUtils.js +3 -20
- package/src/animation/KeyframeTrack.js +8 -8
- package/src/audio/Audio.js +6 -0
- package/src/cameras/Camera.js +1 -5
- package/src/cameras/CubeCamera.js +14 -8
- package/src/constants.js +10 -1
- package/src/core/Object3D.js +1 -14
- package/src/core/RenderTarget.js +16 -7
- package/src/core/UniformsGroup.js +2 -2
- package/src/extras/core/CurvePath.js +4 -1
- package/src/loaders/DataTextureLoader.js +0 -2
- package/src/loaders/MaterialLoader.js +1 -1
- package/src/loaders/ObjectLoader.js +6 -0
- package/src/materials/Material.js +10 -10
- package/src/math/Color.js +1 -5
- package/src/math/ColorManagement.js +82 -60
- package/src/math/Vector2.js +2 -2
- package/src/math/Vector3.js +3 -3
- package/src/math/Vector4.js +4 -4
- package/src/objects/Line.js +1 -1
- package/src/objects/Mesh.js +1 -1
- package/src/objects/Points.js +1 -1
- package/src/objects/Sprite.js +2 -2
- package/src/renderers/WebGLRenderer.js +42 -51
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +35 -2
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -9
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +19 -15
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +4 -4
- package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +11 -6
- package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +4 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +16 -16
- package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +3 -3
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +11 -1
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/background.glsl.js +8 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -1
- package/src/renderers/shaders/UniformsUtils.js +2 -2
- package/src/renderers/webgl/WebGLBackground.js +9 -17
- package/src/renderers/webgl/WebGLLights.js +14 -3
- package/src/renderers/webgl/WebGLProgram.js +36 -5
- package/src/renderers/webgl/WebGLPrograms.js +9 -1
- package/src/renderers/webgl/WebGLTextures.js +19 -8
- package/src/renderers/webgl/WebGLUtils.js +25 -20
- package/src/scenes/Fog.js +1 -0
- package/src/scenes/FogExp2.js +1 -0
- package/src/textures/Source.js +2 -2
- package/src/textures/Texture.js +2 -2
- package/src/utils.js +9 -1
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureMipmapUtils.js +0 -163
- package/src/lights/AmbientLightProbe.js +0 -21
- package/src/lights/HemisphereLightProbe.js +0 -30
- /package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/SlotNode.js +0 -0
package/src/core/RenderTarget.js
CHANGED
|
@@ -37,20 +37,29 @@ class RenderTarget extends EventDispatcher {
|
|
|
37
37
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
options = Object.assign( {
|
|
41
|
+
generateMipmaps: false,
|
|
42
|
+
internalFormat: null,
|
|
43
|
+
minFilter: LinearFilter,
|
|
44
|
+
depthBuffer: true,
|
|
45
|
+
stencilBuffer: false,
|
|
46
|
+
depthTexture: null,
|
|
47
|
+
samples: 0
|
|
48
|
+
}, options );
|
|
49
|
+
|
|
40
50
|
this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
|
|
41
51
|
this.texture.isRenderTargetTexture = true;
|
|
42
52
|
|
|
43
53
|
this.texture.flipY = false;
|
|
44
|
-
this.texture.generateMipmaps = options.generateMipmaps
|
|
45
|
-
this.texture.internalFormat = options.internalFormat
|
|
46
|
-
this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
|
|
54
|
+
this.texture.generateMipmaps = options.generateMipmaps;
|
|
55
|
+
this.texture.internalFormat = options.internalFormat;
|
|
47
56
|
|
|
48
|
-
this.depthBuffer = options.depthBuffer
|
|
49
|
-
this.stencilBuffer = options.stencilBuffer
|
|
57
|
+
this.depthBuffer = options.depthBuffer;
|
|
58
|
+
this.stencilBuffer = options.stencilBuffer;
|
|
50
59
|
|
|
51
|
-
this.depthTexture = options.depthTexture
|
|
60
|
+
this.depthTexture = options.depthTexture;
|
|
52
61
|
|
|
53
|
-
this.samples = options.samples
|
|
62
|
+
this.samples = options.samples;
|
|
54
63
|
|
|
55
64
|
}
|
|
56
65
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventDispatcher } from './EventDispatcher.js';
|
|
2
2
|
import { StaticDrawUsage } from '../constants.js';
|
|
3
3
|
|
|
4
|
-
let
|
|
4
|
+
let _id = 0;
|
|
5
5
|
|
|
6
6
|
class UniformsGroup extends EventDispatcher {
|
|
7
7
|
|
|
@@ -11,7 +11,7 @@ class UniformsGroup extends EventDispatcher {
|
|
|
11
11
|
|
|
12
12
|
this.isUniformsGroup = true;
|
|
13
13
|
|
|
14
|
-
Object.defineProperty( this, 'id', { value:
|
|
14
|
+
Object.defineProperty( this, 'id', { value: _id ++ } );
|
|
15
15
|
|
|
16
16
|
this.name = '';
|
|
17
17
|
|
|
@@ -33,10 +33,13 @@ class CurvePath extends Curve {
|
|
|
33
33
|
|
|
34
34
|
if ( ! startPoint.equals( endPoint ) ) {
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
const lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';
|
|
37
|
+
this.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );
|
|
37
38
|
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
return this;
|
|
42
|
+
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
// To get accurate point with reference to
|
|
@@ -142,7 +142,7 @@ class MaterialLoader extends Loader {
|
|
|
142
142
|
|
|
143
143
|
if ( json.rotation !== undefined ) material.rotation = json.rotation;
|
|
144
144
|
|
|
145
|
-
if ( json.linewidth !==
|
|
145
|
+
if ( json.linewidth !== undefined ) material.linewidth = json.linewidth;
|
|
146
146
|
if ( json.dashSize !== undefined ) material.dashSize = json.dashSize;
|
|
147
147
|
if ( json.gapSize !== undefined ) material.gapSize = json.gapSize;
|
|
148
148
|
if ( json.scale !== undefined ) material.scale = json.scale;
|
|
@@ -800,6 +800,12 @@ class ObjectLoader extends Loader {
|
|
|
800
800
|
|
|
801
801
|
}
|
|
802
802
|
|
|
803
|
+
if ( data.fog.name !== '' ) {
|
|
804
|
+
|
|
805
|
+
object.fog.name = data.fog.name;
|
|
806
|
+
|
|
807
|
+
}
|
|
808
|
+
|
|
803
809
|
}
|
|
804
810
|
|
|
805
811
|
if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;
|
|
@@ -2,7 +2,7 @@ import { EventDispatcher } from '../core/EventDispatcher.js';
|
|
|
2
2
|
import { FrontSide, NormalBlending, LessEqualDepth, AddEquation, OneMinusSrcAlphaFactor, SrcAlphaFactor, AlwaysStencilFunc, KeepStencilOp } from '../constants.js';
|
|
3
3
|
import * as MathUtils from '../math/MathUtils.js';
|
|
4
4
|
|
|
5
|
-
let
|
|
5
|
+
let _materialId = 0;
|
|
6
6
|
|
|
7
7
|
class Material extends EventDispatcher {
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ class Material extends EventDispatcher {
|
|
|
12
12
|
|
|
13
13
|
this.isMaterial = true;
|
|
14
14
|
|
|
15
|
-
Object.defineProperty( this, 'id', { value:
|
|
15
|
+
Object.defineProperty( this, 'id', { value: _materialId ++ } );
|
|
16
16
|
|
|
17
17
|
this.uuid = MathUtils.generateUUID();
|
|
18
18
|
|
|
@@ -320,10 +320,10 @@ class Material extends EventDispatcher {
|
|
|
320
320
|
|
|
321
321
|
if ( this.blending !== NormalBlending ) data.blending = this.blending;
|
|
322
322
|
if ( this.side !== FrontSide ) data.side = this.side;
|
|
323
|
-
if ( this.vertexColors ) data.vertexColors = true;
|
|
323
|
+
if ( this.vertexColors === true ) data.vertexColors = true;
|
|
324
324
|
|
|
325
325
|
if ( this.opacity < 1 ) data.opacity = this.opacity;
|
|
326
|
-
if ( this.transparent === true ) data.transparent =
|
|
326
|
+
if ( this.transparent === true ) data.transparent = true;
|
|
327
327
|
|
|
328
328
|
data.depthFunc = this.depthFunc;
|
|
329
329
|
data.depthTest = this.depthTest;
|
|
@@ -354,17 +354,17 @@ class Material extends EventDispatcher {
|
|
|
354
354
|
if ( this.dithering === true ) data.dithering = true;
|
|
355
355
|
|
|
356
356
|
if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
|
|
357
|
-
if ( this.alphaHash === true ) data.alphaHash =
|
|
358
|
-
if ( this.alphaToCoverage === true ) data.alphaToCoverage =
|
|
359
|
-
if ( this.premultipliedAlpha === true ) data.premultipliedAlpha =
|
|
360
|
-
if ( this.forceSinglePass === true ) data.forceSinglePass =
|
|
357
|
+
if ( this.alphaHash === true ) data.alphaHash = true;
|
|
358
|
+
if ( this.alphaToCoverage === true ) data.alphaToCoverage = true;
|
|
359
|
+
if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;
|
|
360
|
+
if ( this.forceSinglePass === true ) data.forceSinglePass = true;
|
|
361
361
|
|
|
362
|
-
if ( this.wireframe === true ) data.wireframe =
|
|
362
|
+
if ( this.wireframe === true ) data.wireframe = true;
|
|
363
363
|
if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
|
|
364
364
|
if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
|
|
365
365
|
if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
|
|
366
366
|
|
|
367
|
-
if ( this.flatShading === true ) data.flatShading =
|
|
367
|
+
if ( this.flatShading === true ) data.flatShading = true;
|
|
368
368
|
|
|
369
369
|
if ( this.visible === false ) data.visible = false;
|
|
370
370
|
|
package/src/math/Color.js
CHANGED
|
@@ -442,11 +442,7 @@ class Color {
|
|
|
442
442
|
|
|
443
443
|
this.getHSL( _hslA );
|
|
444
444
|
|
|
445
|
-
_hslA.h
|
|
446
|
-
|
|
447
|
-
this.setHSL( _hslA.h, _hslA.s, _hslA.l );
|
|
448
|
-
|
|
449
|
-
return this;
|
|
445
|
+
return this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );
|
|
450
446
|
|
|
451
447
|
}
|
|
452
448
|
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import { SRGBColorSpace, LinearSRGBColorSpace, DisplayP3ColorSpace, } from '../constants.js';
|
|
1
|
+
import { SRGBColorSpace, LinearSRGBColorSpace, DisplayP3ColorSpace, LinearDisplayP3ColorSpace, Rec709Primaries, P3Primaries, SRGBTransfer, LinearTransfer, NoColorSpace, } from '../constants.js';
|
|
2
2
|
import { Matrix3 } from './Matrix3.js';
|
|
3
3
|
|
|
4
|
-
export function SRGBToLinear( c ) {
|
|
5
|
-
|
|
6
|
-
return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function LinearToSRGB( c ) {
|
|
11
|
-
|
|
12
|
-
return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
4
|
/**
|
|
17
5
|
* Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
|
|
18
6
|
* or clipping. Based on W3C specifications for sRGB and Display P3,
|
|
@@ -25,50 +13,57 @@ export function LinearToSRGB( c ) {
|
|
|
25
13
|
* - http://www.russellcottrell.com/photo/matrixCalculator.htm
|
|
26
14
|
*/
|
|
27
15
|
|
|
28
|
-
const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().
|
|
29
|
-
0.8224621, 0.
|
|
30
|
-
0.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().fromArray( [
|
|
35
|
-
1.2249401, - 0.0420569, - 0.0196376,
|
|
36
|
-
- 0.2249404, 1.0420571, - 0.0786361,
|
|
37
|
-
0.0000001, 0.0000000, 1.0982735
|
|
38
|
-
] );
|
|
39
|
-
|
|
40
|
-
function DisplayP3ToLinearSRGB( color ) {
|
|
16
|
+
const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(
|
|
17
|
+
0.8224621, 0.177538, 0.0,
|
|
18
|
+
0.0331941, 0.9668058, 0.0,
|
|
19
|
+
0.0170827, 0.0723974, 0.9105199,
|
|
20
|
+
);
|
|
41
21
|
|
|
42
|
-
|
|
43
|
-
|
|
22
|
+
const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(
|
|
23
|
+
1.2249401, - 0.2249404, 0.0,
|
|
24
|
+
- 0.0420569, 1.0420571, 0.0,
|
|
25
|
+
- 0.0196376, - 0.0786361, 1.0982735
|
|
26
|
+
);
|
|
44
27
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
[
|
|
57
|
-
|
|
58
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Defines supported color spaces by transfer function and primaries,
|
|
30
|
+
* and provides conversions to/from the Linear-sRGB reference space.
|
|
31
|
+
*/
|
|
32
|
+
const COLOR_SPACES = {
|
|
33
|
+
[ LinearSRGBColorSpace ]: {
|
|
34
|
+
transfer: LinearTransfer,
|
|
35
|
+
primaries: Rec709Primaries,
|
|
36
|
+
toReference: ( color ) => color,
|
|
37
|
+
fromReference: ( color ) => color,
|
|
38
|
+
},
|
|
39
|
+
[ SRGBColorSpace ]: {
|
|
40
|
+
transfer: SRGBTransfer,
|
|
41
|
+
primaries: Rec709Primaries,
|
|
42
|
+
toReference: ( color ) => color.convertSRGBToLinear(),
|
|
43
|
+
fromReference: ( color ) => color.convertLinearToSRGB(),
|
|
44
|
+
},
|
|
45
|
+
[ LinearDisplayP3ColorSpace ]: {
|
|
46
|
+
transfer: LinearTransfer,
|
|
47
|
+
primaries: P3Primaries,
|
|
48
|
+
toReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
|
|
49
|
+
fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),
|
|
50
|
+
},
|
|
51
|
+
[ DisplayP3ColorSpace ]: {
|
|
52
|
+
transfer: SRGBTransfer,
|
|
53
|
+
primaries: P3Primaries,
|
|
54
|
+
toReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
|
|
55
|
+
fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),
|
|
56
|
+
},
|
|
59
57
|
};
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
const FROM_LINEAR = {
|
|
63
|
-
[ LinearSRGBColorSpace ]: ( color ) => color,
|
|
64
|
-
[ SRGBColorSpace ]: ( color ) => color.convertLinearToSRGB(),
|
|
65
|
-
[ DisplayP3ColorSpace ]: LinearSRGBToDisplayP3,
|
|
66
|
-
};
|
|
59
|
+
const SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );
|
|
67
60
|
|
|
68
61
|
export const ColorManagement = {
|
|
69
62
|
|
|
70
63
|
enabled: true,
|
|
71
64
|
|
|
65
|
+
_workingColorSpace: LinearSRGBColorSpace,
|
|
66
|
+
|
|
72
67
|
get legacyMode() {
|
|
73
68
|
|
|
74
69
|
console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
|
|
@@ -87,13 +82,19 @@ export const ColorManagement = {
|
|
|
87
82
|
|
|
88
83
|
get workingColorSpace() {
|
|
89
84
|
|
|
90
|
-
return
|
|
85
|
+
return this._workingColorSpace;
|
|
91
86
|
|
|
92
87
|
},
|
|
93
88
|
|
|
94
89
|
set workingColorSpace( colorSpace ) {
|
|
95
90
|
|
|
96
|
-
|
|
91
|
+
if ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {
|
|
92
|
+
|
|
93
|
+
throw new Error( `Unsupported working color space, "${ colorSpace }".` );
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this._workingColorSpace = colorSpace;
|
|
97
98
|
|
|
98
99
|
},
|
|
99
100
|
|
|
@@ -105,29 +106,50 @@ export const ColorManagement = {
|
|
|
105
106
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
const
|
|
109
|
-
const
|
|
109
|
+
const sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;
|
|
110
|
+
const targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
return targetFromReference( sourceToReference( color ) );
|
|
112
113
|
|
|
113
|
-
|
|
114
|
+
},
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
fromWorkingColorSpace: function ( color, targetColorSpace ) {
|
|
116
117
|
|
|
117
|
-
return
|
|
118
|
+
return this.convert( color, this._workingColorSpace, targetColorSpace );
|
|
118
119
|
|
|
119
120
|
},
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
toWorkingColorSpace: function ( color, sourceColorSpace ) {
|
|
122
123
|
|
|
123
|
-
return this.convert( color, this.
|
|
124
|
+
return this.convert( color, sourceColorSpace, this._workingColorSpace );
|
|
124
125
|
|
|
125
126
|
},
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
getPrimaries: function ( colorSpace ) {
|
|
129
|
+
|
|
130
|
+
return COLOR_SPACES[ colorSpace ].primaries;
|
|
131
|
+
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
getTransfer: function ( colorSpace ) {
|
|
128
135
|
|
|
129
|
-
|
|
136
|
+
if ( colorSpace === NoColorSpace ) return LinearTransfer;
|
|
137
|
+
|
|
138
|
+
return COLOR_SPACES[ colorSpace ].transfer;
|
|
130
139
|
|
|
131
140
|
},
|
|
132
141
|
|
|
133
142
|
};
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
export function SRGBToLinear( c ) {
|
|
146
|
+
|
|
147
|
+
return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function LinearToSRGB( c ) {
|
|
152
|
+
|
|
153
|
+
return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
|
|
154
|
+
|
|
155
|
+
}
|
package/src/math/Vector2.js
CHANGED
|
@@ -293,8 +293,8 @@ class Vector2 {
|
|
|
293
293
|
|
|
294
294
|
roundToZero() {
|
|
295
295
|
|
|
296
|
-
this.x =
|
|
297
|
-
this.y =
|
|
296
|
+
this.x = Math.trunc( this.x );
|
|
297
|
+
this.y = Math.trunc( this.y );
|
|
298
298
|
|
|
299
299
|
return this;
|
|
300
300
|
|
package/src/math/Vector3.js
CHANGED
|
@@ -397,9 +397,9 @@ class Vector3 {
|
|
|
397
397
|
|
|
398
398
|
roundToZero() {
|
|
399
399
|
|
|
400
|
-
this.x =
|
|
401
|
-
this.y =
|
|
402
|
-
this.z =
|
|
400
|
+
this.x = Math.trunc( this.x );
|
|
401
|
+
this.y = Math.trunc( this.y );
|
|
402
|
+
this.z = Math.trunc( this.z );
|
|
403
403
|
|
|
404
404
|
return this;
|
|
405
405
|
|
package/src/math/Vector4.js
CHANGED
|
@@ -502,10 +502,10 @@ class Vector4 {
|
|
|
502
502
|
|
|
503
503
|
roundToZero() {
|
|
504
504
|
|
|
505
|
-
this.x =
|
|
506
|
-
this.y =
|
|
507
|
-
this.z =
|
|
508
|
-
this.w =
|
|
505
|
+
this.x = Math.trunc( this.x );
|
|
506
|
+
this.y = Math.trunc( this.y );
|
|
507
|
+
this.z = Math.trunc( this.z );
|
|
508
|
+
this.w = Math.trunc( this.w );
|
|
509
509
|
|
|
510
510
|
return this;
|
|
511
511
|
|
package/src/objects/Line.js
CHANGED
package/src/objects/Mesh.js
CHANGED
package/src/objects/Points.js
CHANGED
|
@@ -32,7 +32,7 @@ class Points extends Object3D {
|
|
|
32
32
|
|
|
33
33
|
super.copy( source, recursive );
|
|
34
34
|
|
|
35
|
-
this.material = source.material;
|
|
35
|
+
this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
|
|
36
36
|
this.geometry = source.geometry;
|
|
37
37
|
|
|
38
38
|
return this;
|
package/src/objects/Sprite.js
CHANGED
|
@@ -28,7 +28,7 @@ const _uvC = /*@__PURE__*/ new Vector2();
|
|
|
28
28
|
|
|
29
29
|
class Sprite extends Object3D {
|
|
30
30
|
|
|
31
|
-
constructor( material ) {
|
|
31
|
+
constructor( material = new SpriteMaterial() ) {
|
|
32
32
|
|
|
33
33
|
super();
|
|
34
34
|
|
|
@@ -56,7 +56,7 @@ class Sprite extends Object3D {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
this.geometry = _geometry;
|
|
59
|
-
this.material =
|
|
59
|
+
this.material = material;
|
|
60
60
|
|
|
61
61
|
this.center = new Vector2( 0.5, 0.5 );
|
|
62
62
|
|
|
@@ -21,7 +21,9 @@ import {
|
|
|
21
21
|
UnsignedInt248Type,
|
|
22
22
|
UnsignedShort4444Type,
|
|
23
23
|
UnsignedShort5551Type,
|
|
24
|
-
WebGLCoordinateSystem
|
|
24
|
+
WebGLCoordinateSystem,
|
|
25
|
+
DisplayP3ColorSpace,
|
|
26
|
+
LinearDisplayP3ColorSpace
|
|
25
27
|
} from '../constants.js';
|
|
26
28
|
import { Color } from '../math/Color.js';
|
|
27
29
|
import { Frustum } from '../math/Frustum.js';
|
|
@@ -59,15 +61,8 @@ import { WebVRManager } from './webvr/WebVRManager.js';
|
|
|
59
61
|
import { WebXRManager } from './webxr/WebXRManager.js';
|
|
60
62
|
import { WebGLMaterials } from './webgl/WebGLMaterials.js';
|
|
61
63
|
import { WebGLUniformsGroups } from './webgl/WebGLUniformsGroups.js';
|
|
62
|
-
import {
|
|
63
|
-
|
|
64
|
-
function createCanvasElement() {
|
|
65
|
-
|
|
66
|
-
const canvas = createElementNS( 'canvas' );
|
|
67
|
-
canvas.style.display = 'block';
|
|
68
|
-
return canvas;
|
|
69
|
-
|
|
70
|
-
}
|
|
64
|
+
import { createCanvasElement } from '../utils.js';
|
|
65
|
+
import { ColorManagement } from '../math/ColorManagement.js';
|
|
71
66
|
|
|
72
67
|
class WebGLRenderer {
|
|
73
68
|
|
|
@@ -149,7 +144,7 @@ class WebGLRenderer {
|
|
|
149
144
|
|
|
150
145
|
// physically based shading
|
|
151
146
|
|
|
152
|
-
this.
|
|
147
|
+
this._outputColorSpace = SRGBColorSpace;
|
|
153
148
|
|
|
154
149
|
// physical lights
|
|
155
150
|
|
|
@@ -1799,48 +1794,28 @@ class WebGLRenderer {
|
|
|
1799
1794
|
|
|
1800
1795
|
if ( refreshProgram || _currentCamera !== camera ) {
|
|
1801
1796
|
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
if ( capabilities.logarithmicDepthBuffer ) {
|
|
1797
|
+
// common camera uniforms
|
|
1805
1798
|
|
|
1806
|
-
|
|
1807
|
-
|
|
1799
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
1800
|
+
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
1808
1801
|
|
|
1809
|
-
|
|
1802
|
+
const uCamPos = p_uniforms.map.cameraPosition;
|
|
1810
1803
|
|
|
1811
|
-
if (
|
|
1804
|
+
if ( uCamPos !== undefined ) {
|
|
1812
1805
|
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
// lighting uniforms depend on the camera so enforce an update
|
|
1816
|
-
// now, in case this material supports lights - or later, when
|
|
1817
|
-
// the next material that does gets activated:
|
|
1818
|
-
|
|
1819
|
-
refreshMaterial = true; // set to true on material change
|
|
1820
|
-
refreshLights = true; // remains set until update done
|
|
1806
|
+
uCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );
|
|
1821
1807
|
|
|
1822
1808
|
}
|
|
1823
1809
|
|
|
1824
|
-
|
|
1825
|
-
// (shader material also gets them for the sake of genericity)
|
|
1826
|
-
|
|
1827
|
-
if ( material.isShaderMaterial ||
|
|
1828
|
-
material.isMeshPhongMaterial ||
|
|
1829
|
-
material.isMeshToonMaterial ||
|
|
1830
|
-
material.isMeshStandardMaterial ||
|
|
1831
|
-
material.envMap ) {
|
|
1832
|
-
|
|
1833
|
-
const uCamPos = p_uniforms.map.cameraPosition;
|
|
1834
|
-
|
|
1835
|
-
if ( uCamPos !== undefined ) {
|
|
1836
|
-
|
|
1837
|
-
uCamPos.setValue( _gl,
|
|
1838
|
-
_vector3.setFromMatrixPosition( camera.matrixWorld ) );
|
|
1810
|
+
if ( capabilities.logarithmicDepthBuffer ) {
|
|
1839
1811
|
|
|
1840
|
-
|
|
1812
|
+
p_uniforms.setValue( _gl, 'logDepthBufFC',
|
|
1813
|
+
2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
|
|
1841
1814
|
|
|
1842
1815
|
}
|
|
1843
1816
|
|
|
1817
|
+
// consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067
|
|
1818
|
+
|
|
1844
1819
|
if ( material.isMeshPhongMaterial ||
|
|
1845
1820
|
material.isMeshToonMaterial ||
|
|
1846
1821
|
material.isMeshLambertMaterial ||
|
|
@@ -1852,16 +1827,16 @@ class WebGLRenderer {
|
|
|
1852
1827
|
|
|
1853
1828
|
}
|
|
1854
1829
|
|
|
1855
|
-
if (
|
|
1856
|
-
material.isMeshToonMaterial ||
|
|
1857
|
-
material.isMeshLambertMaterial ||
|
|
1858
|
-
material.isMeshBasicMaterial ||
|
|
1859
|
-
material.isMeshStandardMaterial ||
|
|
1860
|
-
material.isShaderMaterial ||
|
|
1861
|
-
material.isShadowMaterial ||
|
|
1862
|
-
object.isSkinnedMesh ) {
|
|
1830
|
+
if ( _currentCamera !== camera ) {
|
|
1863
1831
|
|
|
1864
|
-
|
|
1832
|
+
_currentCamera = camera;
|
|
1833
|
+
|
|
1834
|
+
// lighting uniforms depend on the camera so enforce an update
|
|
1835
|
+
// now, in case this material supports lights - or later, when
|
|
1836
|
+
// the next material that does gets activated:
|
|
1837
|
+
|
|
1838
|
+
refreshMaterial = true; // set to true on material change
|
|
1839
|
+
refreshLights = true; // remains set until update done
|
|
1865
1840
|
|
|
1866
1841
|
}
|
|
1867
1842
|
|
|
@@ -2477,6 +2452,22 @@ class WebGLRenderer {
|
|
|
2477
2452
|
|
|
2478
2453
|
}
|
|
2479
2454
|
|
|
2455
|
+
get outputColorSpace() {
|
|
2456
|
+
|
|
2457
|
+
return this._outputColorSpace;
|
|
2458
|
+
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
set outputColorSpace( colorSpace ) {
|
|
2462
|
+
|
|
2463
|
+
this._outputColorSpace = colorSpace;
|
|
2464
|
+
|
|
2465
|
+
const gl = this.getContext();
|
|
2466
|
+
gl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';
|
|
2467
|
+
gl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';
|
|
2468
|
+
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2480
2471
|
get physicallyCorrectLights() { // @deprecated, r150
|
|
2481
2472
|
|
|
2482
2473
|
console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
|
|
@@ -8,7 +8,7 @@ export default /* glsl */`
|
|
|
8
8
|
|
|
9
9
|
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|
10
10
|
|
|
11
|
-
float dotNV = saturate( dot(
|
|
11
|
+
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
12
12
|
|
|
13
13
|
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
14
14
|
|