Texture.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * @author mr.doob / http://mrdoob.com/
  3. * @author alteredq / http://alteredqualia.com/
  4. * @author szimek / https://github.com/szimek/
  5. */
  6. THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type ) {
  7. this.id = THREE.TextureCount ++;
  8. this.image = image;
  9. this.mapping = mapping !== undefined ? mapping : new THREE.UVMapping();
  10. this.wrapS = wrapS !== undefined ? wrapS : THREE.ClampToEdgeWrapping;
  11. this.wrapT = wrapT !== undefined ? wrapT : THREE.ClampToEdgeWrapping;
  12. this.magFilter = magFilter !== undefined ? magFilter : THREE.LinearFilter;
  13. this.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter;
  14. this.format = format !== undefined ? format : THREE.RGBAFormat;
  15. this.type = type !== undefined ? type : THREE.UnsignedByteType;
  16. this.offset = new THREE.Vector2( 0, 0 );
  17. this.repeat = new THREE.Vector2( 1, 1 );
  18. this.generateMipmaps = true;
  19. this.premultiplyAlpha = false;
  20. this.flipY = true;
  21. this.needsUpdate = false;
  22. this.onUpdate = null;
  23. };
  24. THREE.Texture.prototype = {
  25. constructor: THREE.Texture,
  26. clone: function () {
  27. var clonedTexture = new THREE.Texture( this.image, this.mapping, this.wrapS, this.wrapT, this.magFilter, this.minFilter, this.format, this.type );
  28. clonedTexture.offset.copy( this.offset );
  29. clonedTexture.repeat.copy( this.repeat );
  30. return clonedTexture;
  31. }
  32. };
  33. THREE.TextureCount = 0;
粤ICP备19079148号