RawNode.js 630 B

123456789101112131415161718192021222324252627282930313233343536
  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.parseAndBuildCode( builder, this.type );
  13. var code = data.code + '\n';
  14. if ( builder.shader == 'vertex' ) {
  15. code += 'gl_Position = ' + data.result + ';';
  16. } else {
  17. code += 'gl_FragColor = ' + data.result + ';';
  18. }
  19. return code;
  20. };