BlinnExponentToRoughnessNode.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @author sunag / http://www.sunag.com.br/
  3. */
  4. import { TempNode } from '../core/TempNode.js';
  5. import { BlinnShininessExponentNode } from './BlinnShininessExponentNode.js';
  6. function BlinnExponentToRoughnessNode( blinnExponent ) {
  7. TempNode.call( this, 'f' );
  8. this.blinnExponent = blinnExponent || new BlinnShininessExponentNode();
  9. }
  10. BlinnExponentToRoughnessNode.prototype = Object.create( TempNode.prototype );
  11. BlinnExponentToRoughnessNode.prototype.constructor = BlinnExponentToRoughnessNode;
  12. BlinnExponentToRoughnessNode.prototype.nodeType = "BlinnExponentToRoughness";
  13. BlinnExponentToRoughnessNode.prototype.generate = function ( builder, output ) {
  14. return builder.format( 'BlinnExponentToGGXRoughness( ' + this.blinnExponent.build( builder, 'f' ) + ' )', this.type, output );
  15. };
  16. BlinnExponentToRoughnessNode.prototype.copy = function ( source ) {
  17. TempNode.prototype.copy.call( this, source );
  18. this.blinnExponent = source.blinnExponent;
  19. };
  20. BlinnExponentToRoughnessNode.prototype.toJSON = function ( meta ) {
  21. var data = this.getJSONNode( meta );
  22. if ( ! data ) {
  23. data = this.createJSONNode( meta );
  24. data.blinnExponent = this.blinnExponent;
  25. }
  26. return data;
  27. };
  28. export { BlinnExponentToRoughnessNode };