UVNode.js 522 B

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