|
|
@@ -5,6 +5,7 @@ import {
|
|
|
BufferGeometry,
|
|
|
ClampToEdgeWrapping,
|
|
|
Color,
|
|
|
+ ColorManagement,
|
|
|
DirectionalLight,
|
|
|
EquirectangularReflectionMapping,
|
|
|
Euler,
|
|
|
@@ -538,12 +539,12 @@ class FBXTreeParser {
|
|
|
|
|
|
if ( materialNode.Diffuse ) {
|
|
|
|
|
|
- parameters.color = new Color().fromArray( materialNode.Diffuse.value ).convertSRGBToLinear();
|
|
|
+ parameters.color = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.Diffuse.value ), SRGBColorSpace );
|
|
|
|
|
|
} else if ( materialNode.DiffuseColor && ( materialNode.DiffuseColor.type === 'Color' || materialNode.DiffuseColor.type === 'ColorRGB' ) ) {
|
|
|
|
|
|
// The blender exporter exports diffuse here instead of in materialNode.Diffuse
|
|
|
- parameters.color = new Color().fromArray( materialNode.DiffuseColor.value ).convertSRGBToLinear();
|
|
|
+ parameters.color = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.DiffuseColor.value ), SRGBColorSpace );
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -555,12 +556,12 @@ class FBXTreeParser {
|
|
|
|
|
|
if ( materialNode.Emissive ) {
|
|
|
|
|
|
- parameters.emissive = new Color().fromArray( materialNode.Emissive.value ).convertSRGBToLinear();
|
|
|
+ parameters.emissive = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.Emissive.value ), SRGBColorSpace );
|
|
|
|
|
|
} else if ( materialNode.EmissiveColor && ( materialNode.EmissiveColor.type === 'Color' || materialNode.EmissiveColor.type === 'ColorRGB' ) ) {
|
|
|
|
|
|
// The blender exporter exports emissive color here instead of in materialNode.Emissive
|
|
|
- parameters.emissive = new Color().fromArray( materialNode.EmissiveColor.value ).convertSRGBToLinear();
|
|
|
+ parameters.emissive = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.EmissiveColor.value ), SRGBColorSpace );
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -596,12 +597,12 @@ class FBXTreeParser {
|
|
|
|
|
|
if ( materialNode.Specular ) {
|
|
|
|
|
|
- parameters.specular = new Color().fromArray( materialNode.Specular.value ).convertSRGBToLinear();
|
|
|
+ parameters.specular = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.Specular.value ), SRGBColorSpace );
|
|
|
|
|
|
} else if ( materialNode.SpecularColor && materialNode.SpecularColor.type === 'Color' ) {
|
|
|
|
|
|
// The blender exporter exports specular color here instead of in materialNode.Specular
|
|
|
- parameters.specular = new Color().fromArray( materialNode.SpecularColor.value ).convertSRGBToLinear();
|
|
|
+ parameters.specular = ColorManagement.toWorkingColorSpace( new Color().fromArray( materialNode.SpecularColor.value ), SRGBColorSpace );
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1152,7 +1153,7 @@ class FBXTreeParser {
|
|
|
|
|
|
if ( lightAttribute.Color !== undefined ) {
|
|
|
|
|
|
- color = new Color().fromArray( lightAttribute.Color.value ).convertSRGBToLinear();
|
|
|
+ color = ColorManagement.toWorkingColorSpace( new Color().fromArray( lightAttribute.Color.value ), SRGBColorSpace );
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1478,7 +1479,7 @@ class FBXTreeParser {
|
|
|
|
|
|
if ( r !== 0 || g !== 0 || b !== 0 ) {
|
|
|
|
|
|
- const color = new Color( r, g, b ).convertSRGBToLinear();
|
|
|
+ const color = new Color().setRGB( r, g, b, SRGBColorSpace );
|
|
|
sceneGraph.add( new AmbientLight( color, 1 ) );
|
|
|
|
|
|
}
|
|
|
@@ -2320,7 +2321,9 @@ class GeometryParser {
|
|
|
|
|
|
for ( let i = 0, c = new Color(); i < buffer.length; i += 4 ) {
|
|
|
|
|
|
- c.fromArray( buffer, i ).convertSRGBToLinear().toArray( buffer, i );
|
|
|
+ c.fromArray( buffer, i );
|
|
|
+ ColorManagement.toWorkingColorSpace( c, SRGBColorSpace );
|
|
|
+ c.toArray( buffer, i );
|
|
|
|
|
|
}
|
|
|
|