UVNode.js 584 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import AttributeNode from '../core/AttributeNode.js';
  2. class UVNode extends AttributeNode {
  3. constructor( index = 0 ) {
  4. super( 'vec2' );
  5. this.index = index;
  6. }
  7. getIndexProperty( prefix ) {
  8. return prefix + ( this.index > 0 ? this.index + 1 : '' );
  9. }
  10. getAttributeName( /*builder*/ ) {
  11. return this.getIndexProperty( 'uv' );
  12. }
  13. getAttributeProperty( builder ) {
  14. // customize 'uv' property
  15. const property = this.getIndexProperty( 'vUv' );
  16. this.setAttributeProperty( property );
  17. return super.getAttributeProperty( builder );
  18. }
  19. }
  20. export default UVNode;