LightNode.js 645 B

12345678910111213141516171819202122232425262728
  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. } else {
  13. console.warn( "THREE.LightNode is only compatible in \"light\" channel." );
  14. return builder.format( 'vec3( 0.0 )', this.getType( builder ), output );
  15. }
  16. };