Texture.js 2.4 KB

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