|
@@ -1522,7 +1522,7 @@ const _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua'
|
|
|
'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,
|
|
|
'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };
|
|
|
|
|
|
-const _rgb = { r: 0, g: 0, b: 0 };
|
|
|
+const _rgb$1 = { r: 0, g: 0, b: 0 };
|
|
|
const _hslA = { h: 0, s: 0, l: 0 };
|
|
|
const _hslB = { h: 0, s: 0, l: 0 };
|
|
|
|
|
@@ -1852,9 +1852,9 @@ class Color {
|
|
|
|
|
|
getHex( colorSpace = SRGBColorSpace ) {
|
|
|
|
|
|
- ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb ), colorSpace );
|
|
|
+ ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb$1 ), colorSpace );
|
|
|
|
|
|
- return clamp( _rgb.r * 255, 0, 255 ) << 16 ^ clamp( _rgb.g * 255, 0, 255 ) << 8 ^ clamp( _rgb.b * 255, 0, 255 ) << 0;
|
|
|
+ return clamp( _rgb$1.r * 255, 0, 255 ) << 16 ^ clamp( _rgb$1.g * 255, 0, 255 ) << 8 ^ clamp( _rgb$1.b * 255, 0, 255 ) << 0;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1868,9 +1868,9 @@ class Color {
|
|
|
|
|
|
// h,s,l ranges are in 0.0 - 1.0
|
|
|
|
|
|
- ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb ), colorSpace );
|
|
|
+ ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb$1 ), colorSpace );
|
|
|
|
|
|
- const r = _rgb.r, g = _rgb.g, b = _rgb.b;
|
|
|
+ const r = _rgb$1.r, g = _rgb$1.g, b = _rgb$1.b;
|
|
|
|
|
|
const max = Math.max( r, g, b );
|
|
|
const min = Math.min( r, g, b );
|
|
@@ -1911,11 +1911,11 @@ class Color {
|
|
|
|
|
|
getRGB( target, colorSpace = LinearSRGBColorSpace ) {
|
|
|
|
|
|
- ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb ), colorSpace );
|
|
|
+ ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb$1 ), colorSpace );
|
|
|
|
|
|
- target.r = _rgb.r;
|
|
|
- target.g = _rgb.g;
|
|
|
- target.b = _rgb.b;
|
|
|
+ target.r = _rgb$1.r;
|
|
|
+ target.g = _rgb$1.g;
|
|
|
+ target.b = _rgb$1.b;
|
|
|
|
|
|
return target;
|
|
|
|
|
@@ -1923,16 +1923,16 @@ class Color {
|
|
|
|
|
|
getStyle( colorSpace = SRGBColorSpace ) {
|
|
|
|
|
|
- ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb ), colorSpace );
|
|
|
+ ColorManagement.fromWorkingColorSpace( toComponents( this, _rgb$1 ), colorSpace );
|
|
|
|
|
|
if ( colorSpace !== SRGBColorSpace ) {
|
|
|
|
|
|
// Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).
|
|
|
- return `color(${ colorSpace } ${ _rgb.r } ${ _rgb.g } ${ _rgb.b })`;
|
|
|
+ return `color(${ colorSpace } ${ _rgb$1.r } ${ _rgb$1.g } ${ _rgb$1.b })`;
|
|
|
|
|
|
}
|
|
|
|
|
|
- return `rgb(${( _rgb.r * 255 ) | 0},${( _rgb.g * 255 ) | 0},${( _rgb.b * 255 ) | 0})`;
|
|
|
+ return `rgb(${( _rgb$1.r * 255 ) | 0},${( _rgb$1.g * 255 ) | 0},${( _rgb$1.b * 255 ) | 0})`;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -11395,6 +11395,19 @@ function cloneUniformsGroups( src ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+function getUnlitUniformColorSpace( renderer ) {
|
|
|
+
|
|
|
+ if ( renderer.getRenderTarget() === null ) {
|
|
|
+
|
|
|
+ // https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
|
|
|
+ return renderer.outputEncoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return LinearSRGBColorSpace;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
// Legacy
|
|
|
|
|
|
const UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms };
|
|
@@ -13796,6 +13809,8 @@ ShaderLib.physical = {
|
|
|
|
|
|
};
|
|
|
|
|
|
+const _rgb = { r: 0, b: 0, g: 0 };
|
|
|
+
|
|
|
function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {
|
|
|
|
|
|
const clearColor = new Color( 0x000000 );
|
|
@@ -13982,7 +13997,9 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
|
|
|
function setClear( color, alpha ) {
|
|
|
|
|
|
- state.buffers.color.setClear( color.r, color.g, color.b, alpha, premultipliedAlpha );
|
|
|
+ color.getRGB( _rgb, getUnlitUniformColorSpace( renderer ) );
|
|
|
+
|
|
|
+ state.buffers.color.setClear( _rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -25840,7 +25857,7 @@ function WebGLMaterials( renderer, properties ) {
|
|
|
|
|
|
function refreshFogUniforms( uniforms, fog ) {
|
|
|
|
|
|
- uniforms.fogColor.value.copy( fog.color );
|
|
|
+ fog.color.getRGB( uniforms.fogColor.value, getUnlitUniformColorSpace( renderer ) );
|
|
|
|
|
|
if ( fog.isFog ) {
|
|
|
|
|
@@ -41135,7 +41152,7 @@ class SpotLightShadow extends LightShadow {
|
|
|
|
|
|
class SpotLight extends Light {
|
|
|
|
|
|
- constructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 1 ) {
|
|
|
+ constructor( color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2 ) {
|
|
|
|
|
|
super( color, intensity );
|
|
|
|
|
@@ -41151,7 +41168,7 @@ class SpotLight extends Light {
|
|
|
this.distance = distance;
|
|
|
this.angle = angle;
|
|
|
this.penumbra = penumbra;
|
|
|
- this.decay = decay; // for physically correct lights, should be 2.
|
|
|
+ this.decay = decay;
|
|
|
|
|
|
this.map = null;
|
|
|
|
|
@@ -41289,7 +41306,7 @@ class PointLightShadow extends LightShadow {
|
|
|
|
|
|
class PointLight extends Light {
|
|
|
|
|
|
- constructor( color, intensity, distance = 0, decay = 1 ) {
|
|
|
+ constructor( color, intensity, distance = 0, decay = 2 ) {
|
|
|
|
|
|
super( color, intensity );
|
|
|
|
|
@@ -41298,7 +41315,7 @@ class PointLight extends Light {
|
|
|
this.type = 'PointLight';
|
|
|
|
|
|
this.distance = distance;
|
|
|
- this.decay = decay; // for physically correct lights, should be 2.
|
|
|
+ this.decay = decay;
|
|
|
|
|
|
this.shadow = new PointLightShadow();
|
|
|
|