BlinnExponentToRoughnessNode.js 1.1 KB

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