RawNode.js 632 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * @author sunag / http://www.sunag.com.br/
  3. */
  4. THREE.RawNode = function( value ) {
  5. THREE.GLNode.call( this, 'v4' );
  6. this.value = value;
  7. };
  8. THREE.RawNode.prototype = Object.create( THREE.GLNode.prototype );
  9. THREE.RawNode.prototype.constructor = THREE.RawNode;
  10. THREE.GLNode.prototype.generate = function( builder ) {
  11. var material = builder.material;
  12. var data = this.value.verifyAndBuildCode( builder, this.type );
  13. var code = data.code + '\n';
  14. if ( builder.shader == 'vertex' ) {
  15. code += 'gl_Position = ' + data.result + ';';
  16. }
  17. else {
  18. code += 'gl_FragColor = ' + data.result + ';';
  19. }
  20. return code;
  21. };