UVNode.js 764 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * @author sunag / http://www.sunag.com.br/
  3. */
  4. THREE.UVNode = function( index ) {
  5. THREE.TempNode.call( this, 'v2', { shared: false } );
  6. this.index = index || 0;
  7. };
  8. THREE.UVNode.vertexDict = [ 'uv', 'uv2' ];
  9. THREE.UVNode.fragmentDict = [ 'vUv', 'vUv2' ];
  10. THREE.UVNode.prototype = Object.create( THREE.TempNode.prototype );
  11. THREE.UVNode.prototype.constructor = THREE.UVNode;
  12. THREE.UVNode.prototype.generate = function( builder, output ) {
  13. var material = builder.material;
  14. var result;
  15. material.requestAttribs.uv[ this.index ] = true;
  16. if ( builder.isShader( 'vertex' ) ) result = THREE.UVNode.vertexDict[ this.index ];
  17. else result = THREE.UVNode.fragmentDict[ this.index ];
  18. return builder.format( result, this.getType( builder ), output );
  19. };