UVNode.js 512 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import AttributeNode from '../core/AttributeNode.js';
  2. class UVNode extends AttributeNode {
  3. constructor( index = 0 ) {
  4. super( null, 'vec2' );
  5. this.isUVNode = true;
  6. this.index = index;
  7. }
  8. getAttributeName( /*builder*/ ) {
  9. const index = this.index;
  10. return 'uv' + ( index > 0 ? index + 1 : '' );
  11. }
  12. serialize( data ) {
  13. super.serialize( data );
  14. data.index = this.index;
  15. }
  16. deserialize( data ) {
  17. super.deserialize( data );
  18. this.index = data.index;
  19. }
  20. }
  21. export default UVNode;