BlinnExponentToRoughnessNode.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. return this;
  20. };
  21. BlinnExponentToRoughnessNode.prototype.toJSON = function ( meta ) {
  22. var data = this.getJSONNode( meta );
  23. if ( ! data ) {
  24. data = this.createJSONNode( meta );
  25. data.blinnExponent = this.blinnExponent;
  26. }
  27. return data;
  28. };
  29. export { BlinnExponentToRoughnessNode };