LightNode.js 646 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @author sunag / http://www.sunag.com.br/
  3. */
  4. THREE.LightNode = function() {
  5. THREE.TempNode.call( this, 'v3', { shared: false } );
  6. };
  7. THREE.LightNode.prototype = Object.create( THREE.TempNode.prototype );
  8. THREE.LightNode.prototype.constructor = THREE.LightNode;
  9. THREE.LightNode.prototype.generate = function( builder, output ) {
  10. if ( builder.isCache( 'light' ) ) {
  11. return builder.format( 'reflectedLight.directDiffuse', this.getType( builder ), output )
  12. }
  13. else {
  14. console.warn( "THREE.LightNode is only compatible in \"light\" channel." );
  15. return builder.format( 'vec3( 0.0 )', this.getType( builder ), output );
  16. }
  17. };