InputNode.js 964 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * @author sunag / http://www.sunag.com.br/
  3. */
  4. THREE.InputNode = function( type, params ) {
  5. THREE.TempNode.call( this, type, params );
  6. };
  7. THREE.InputNode.prototype = Object.create( THREE.TempNode.prototype );
  8. THREE.InputNode.prototype.constructor = THREE.InputNode;
  9. THREE.InputNode.prototype.generate = function( builder, output, uuid, type, ns, needsUpdate ) {
  10. var material = builder.material;
  11. uuid = builder.getUuid( uuid || this.getUuid() );
  12. type = type || this.getType( builder );
  13. var data = material.getDataNode( uuid );
  14. if ( builder.isShader( 'vertex' ) ) {
  15. if ( ! data.vertex ) {
  16. data.vertex = material.createVertexUniform( type, this.value, ns, needsUpdate );
  17. }
  18. return builder.format( data.vertex.name, type, output );
  19. }
  20. else {
  21. if ( ! data.fragment ) {
  22. data.fragment = material.createFragmentUniform( type, this.value, ns, needsUpdate );
  23. }
  24. return builder.format( data.fragment.name, type, output );
  25. }
  26. };