Browse Source

add gammaFactor param for convertGammaToLinear & convertLinearToGamma

06wj 7 years ago
parent
commit
2364c9f39e
1 changed files with 4 additions and 10 deletions
  1. 4 10
      src/math/Color.js

+ 4 - 10
src/math/Color.js

@@ -313,23 +313,17 @@ Object.assign( Color.prototype, {
 
 	},
 
-	convertGammaToLinear: function () {
+	convertGammaToLinear: function ( gammaFactor ) {
 
-		var r = this.r, g = this.g, b = this.b;
-
-		this.r = r * r;
-		this.g = g * g;
-		this.b = b * b;
+		this.copyGammaToLinear( this, gammaFactor );
 
 		return this;
 
 	},
 
-	convertLinearToGamma: function () {
+	convertLinearToGamma: function ( gammaFactor ) {
 
-		this.r = Math.sqrt( this.r );
-		this.g = Math.sqrt( this.g );
-		this.b = Math.sqrt( this.b );
+		this.copyLinearToGamma( this, gammaFactor );
 
 		return this;