|
@@ -7908,6 +7908,29 @@ function Color( r, g, b ) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function hue2rgb( p, q, t ) {
|
|
|
|
+
|
|
|
|
+ if ( t < 0 ) t += 1;
|
|
|
|
+ if ( t > 1 ) t -= 1;
|
|
|
|
+ if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;
|
|
|
|
+ if ( t < 1 / 2 ) return q;
|
|
|
|
+ if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );
|
|
|
|
+ return p;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function SRGBToLinear( c ) {
|
|
|
|
+
|
|
|
|
+ return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function LinearToSRGB( c ) {
|
|
|
|
+
|
|
|
|
+ return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
Object.assign( Color.prototype, {
|
|
Object.assign( Color.prototype, {
|
|
|
|
|
|
isColor: true,
|
|
isColor: true,
|
|
@@ -7966,46 +7989,31 @@ Object.assign( Color.prototype, {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- setHSL: function () {
|
|
|
|
-
|
|
|
|
- function hue2rgb( p, q, t ) {
|
|
|
|
-
|
|
|
|
- if ( t < 0 ) t += 1;
|
|
|
|
- if ( t > 1 ) t -= 1;
|
|
|
|
- if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;
|
|
|
|
- if ( t < 1 / 2 ) return q;
|
|
|
|
- if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );
|
|
|
|
- return p;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return function setHSL( h, s, l ) {
|
|
|
|
-
|
|
|
|
- // h,s,l ranges are in 0.0 - 1.0
|
|
|
|
- h = _Math.euclideanModulo( h, 1 );
|
|
|
|
- s = _Math.clamp( s, 0, 1 );
|
|
|
|
- l = _Math.clamp( l, 0, 1 );
|
|
|
|
|
|
+ setHSL: function ( h, s, l ) {
|
|
|
|
|
|
- if ( s === 0 ) {
|
|
|
|
|
|
+ // h,s,l ranges are in 0.0 - 1.0
|
|
|
|
+ h = _Math.euclideanModulo( h, 1 );
|
|
|
|
+ s = _Math.clamp( s, 0, 1 );
|
|
|
|
+ l = _Math.clamp( l, 0, 1 );
|
|
|
|
|
|
- this.r = this.g = this.b = l;
|
|
|
|
|
|
+ if ( s === 0 ) {
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ this.r = this.g = this.b = l;
|
|
|
|
|
|
- var p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );
|
|
|
|
- var q = ( 2 * l ) - p;
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- this.r = hue2rgb( q, p, h + 1 / 3 );
|
|
|
|
- this.g = hue2rgb( q, p, h );
|
|
|
|
- this.b = hue2rgb( q, p, h - 1 / 3 );
|
|
|
|
|
|
+ var p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );
|
|
|
|
+ var q = ( 2 * l ) - p;
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ this.r = hue2rgb( q, p, h + 1 / 3 );
|
|
|
|
+ this.g = hue2rgb( q, p, h );
|
|
|
|
+ this.b = hue2rgb( q, p, h - 1 / 3 );
|
|
|
|
|
|
- return this;
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- };
|
|
|
|
|
|
+ return this;
|
|
|
|
|
|
- }(),
|
|
|
|
|
|
+ },
|
|
|
|
|
|
setStyle: function ( style ) {
|
|
setStyle: function ( style ) {
|
|
|
|
|
|
@@ -8195,45 +8203,25 @@ Object.assign( Color.prototype, {
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
- copySRGBToLinear: function () {
|
|
|
|
|
|
+ copySRGBToLinear: function ( color ) {
|
|
|
|
|
|
- function SRGBToLinear( c ) {
|
|
|
|
-
|
|
|
|
- return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return function copySRGBToLinear( color ) {
|
|
|
|
-
|
|
|
|
- this.r = SRGBToLinear( color.r );
|
|
|
|
- this.g = SRGBToLinear( color.g );
|
|
|
|
- this.b = SRGBToLinear( color.b );
|
|
|
|
-
|
|
|
|
- return this;
|
|
|
|
-
|
|
|
|
- };
|
|
|
|
|
|
+ this.r = SRGBToLinear( color.r );
|
|
|
|
+ this.g = SRGBToLinear( color.g );
|
|
|
|
+ this.b = SRGBToLinear( color.b );
|
|
|
|
|
|
- }(),
|
|
|
|
-
|
|
|
|
- copyLinearToSRGB: function () {
|
|
|
|
-
|
|
|
|
- function LinearToSRGB( c ) {
|
|
|
|
-
|
|
|
|
- return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ return this;
|
|
|
|
|
|
- return function copyLinearToSRGB( color ) {
|
|
|
|
|
|
+ },
|
|
|
|
|
|
- this.r = LinearToSRGB( color.r );
|
|
|
|
- this.g = LinearToSRGB( color.g );
|
|
|
|
- this.b = LinearToSRGB( color.b );
|
|
|
|
|
|
+ copyLinearToSRGB: function ( color ) {
|
|
|
|
|
|
- return this;
|
|
|
|
|
|
+ this.r = LinearToSRGB( color.r );
|
|
|
|
+ this.g = LinearToSRGB( color.g );
|
|
|
|
+ this.b = LinearToSRGB( color.b );
|
|
|
|
|
|
- };
|
|
|
|
|
|
+ return this;
|
|
|
|
|
|
- }(),
|
|
|
|
|
|
+ },
|
|
|
|
|
|
convertSRGBToLinear: function () {
|
|
convertSRGBToLinear: function () {
|
|
|
|
|
|
@@ -27072,6 +27060,8 @@ function Points( geometry, material ) {
|
|
this.geometry = geometry !== undefined ? geometry : new BufferGeometry();
|
|
this.geometry = geometry !== undefined ? geometry : new BufferGeometry();
|
|
this.material = material !== undefined ? material : new PointsMaterial( { color: Math.random() * 0xffffff } );
|
|
this.material = material !== undefined ? material : new PointsMaterial( { color: Math.random() * 0xffffff } );
|
|
|
|
|
|
|
|
+ this.updateMorphTargets();
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
@@ -27189,6 +27179,38 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
|
|
|
}() ),
|
|
}() ),
|
|
|
|
|
|
|
|
+ updateMorphTargets: function () {
|
|
|
|
+
|
|
|
|
+ var geometry = this.geometry;
|
|
|
|
+ var m, ml, name;
|
|
|
|
+
|
|
|
|
+ var morphAttributes = geometry.morphAttributes;
|
|
|
|
+ var keys = Object.keys( morphAttributes );
|
|
|
|
+
|
|
|
|
+ if ( keys.length > 0 ) {
|
|
|
|
+
|
|
|
|
+ var morphAttribute = morphAttributes[ keys[ 0 ] ];
|
|
|
|
+
|
|
|
|
+ if ( morphAttribute !== undefined ) {
|
|
|
|
+
|
|
|
|
+ this.morphTargetInfluences = [];
|
|
|
|
+ this.morphTargetDictionary = {};
|
|
|
|
+
|
|
|
|
+ for ( m = 0, ml = morphAttribute.length; m < ml; m ++ ) {
|
|
|
|
+
|
|
|
|
+ name = morphAttribute[ m ].name || String( m );
|
|
|
|
+
|
|
|
|
+ this.morphTargetInfluences.push( 0 );
|
|
|
|
+ this.morphTargetDictionary[ name ] = m;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
clone: function () {
|
|
clone: function () {
|
|
|
|
|
|
return new this.constructor( this.geometry, this.material ).copy( this );
|
|
return new this.constructor( this.geometry, this.material ).copy( this );
|