1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- /**
- * @author sunag / http://www.sunag.com.br/
- */
- THREE.ColorAdjustmentNode = function ( rgb, adjustment, method ) {
- THREE.TempNode.call( this, 'v3' );
- this.rgb = rgb;
- this.adjustment = adjustment;
- this.method = method || THREE.ColorAdjustmentNode.SATURATION;
- };
- THREE.ColorAdjustmentNode.SATURATION = 'saturation';
- THREE.ColorAdjustmentNode.HUE = 'hue';
- THREE.ColorAdjustmentNode.VIBRANCE = 'vibrance';
- THREE.ColorAdjustmentNode.BRIGHTNESS = 'brightness';
- THREE.ColorAdjustmentNode.CONTRAST = 'contrast';
- THREE.ColorAdjustmentNode.prototype = Object.create( THREE.TempNode.prototype );
- THREE.ColorAdjustmentNode.prototype.constructor = THREE.ColorAdjustmentNode;
- THREE.ColorAdjustmentNode.prototype.nodeType = "ColorAdjustment";
- THREE.ColorAdjustmentNode.prototype.generate = function ( builder, output ) {
- var rgb = this.rgb.build( builder, 'v3' );
- var adjustment = this.adjustment.build( builder, 'fv1' );
- var name;
- switch ( this.method ) {
- case THREE.ColorAdjustmentNode.SATURATION:
- name = 'saturation_rgb';
- break;
- case THREE.ColorAdjustmentNode.HUE:
- name = 'hue_rgb';
- break;
- case THREE.ColorAdjustmentNode.VIBRANCE:
- name = 'vibrance_rgb';
- break;
- case THREE.ColorAdjustmentNode.BRIGHTNESS:
- return builder.format( '(' + rgb + '+' + adjustment + ')', this.getType( builder ), output );
- break;
- case THREE.ColorAdjustmentNode.CONTRAST:
- return builder.format( '(' + rgb + '*' + adjustment + ')', this.getType( builder ), output );
- break;
- }
- builder.include( name );
- return builder.format( name + '(' + rgb + ',' + adjustment + ')', this.getType( builder ), output );
- };
- THREE.ColorAdjustmentNode.prototype.toJSON = function ( meta ) {
- var data = this.getJSONNode( meta );
- if ( ! data ) {
- data = this.createJSONNode( meta );
- data.rgb = this.rgb.toJSON( meta ).uuid;
- data.adjustment = this.adjustment.toJSON( meta ).uuid;
- data.method = this.method;
- }
- return data;
- };
|