Texture.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 ) {
  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.offset = new THREE.Vector2( 0, 0 );
  15. this.repeat = new THREE.Vector2( 1, 1 );
  16. this.needsUpdate = false;
  17. };
  18. THREE.Texture.prototype = {
  19. constructor: THREE.Texture,
  20. clone: function () {
  21. var clonedTexture = new THREE.Texture( this.image, this.mapping, this.wrapS, this.wrapT, this.magFilter, this.minFilter );
  22. clonedTexture.offset.copy( this.offset );
  23. clonedTexture.repeat.copy( this.repeat );
  24. return clonedTexture;
  25. }
  26. };
  27. THREE.TextureCount = 0;
  28. THREE.MultiplyOperation = 0;
  29. THREE.MixOperation = 1;
  30. // Wrapping modes
  31. THREE.RepeatWrapping = 0;
  32. THREE.ClampToEdgeWrapping = 1;
  33. THREE.MirroredRepeatWrapping = 2;
  34. // Filters
  35. THREE.NearestFilter = 3;
  36. THREE.NearestMipMapNearestFilter = 4;
  37. THREE.NearestMipMapLinearFilter = 5;
  38. THREE.LinearFilter = 6;
  39. THREE.LinearMipMapNearestFilter = 7;
  40. THREE.LinearMipMapLinearFilter = 8;
  41. // Types
  42. THREE.ByteType = 9;
  43. THREE.UnsignedByteType = 10;
  44. THREE.ShortType = 11;
  45. THREE.UnsignedShortType = 12;
  46. THREE.IntType = 13;
  47. THREE.UnsignedIntType = 14;
  48. THREE.FloatType = 15;
  49. // Formats
  50. THREE.AlphaFormat = 16;
  51. THREE.RGBFormat = 17;
  52. THREE.RGBAFormat = 18;
  53. THREE.LuminanceFormat = 19;
  54. THREE.LuminanceAlphaFormat = 20;