NodeUV.js 754 B

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