Texture.d.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. import { Vector2 } from './../math/Vector2';
  2. import { Matrix3 } from './../math/Matrix3';
  3. import { EventDispatcher } from './../core/EventDispatcher';
  4. import {
  5. Mapping,
  6. Wrapping,
  7. TextureFilter,
  8. PixelFormat,
  9. PixelFormatGPU,
  10. TextureDataType,
  11. TextureEncoding
  12. } from '../constants';
  13. // Textures /////////////////////////////////////////////////////////////////////
  14. export let TextureIdCount: number;
  15. export class Texture extends EventDispatcher {
  16. /**
  17. * @param [image]
  18. * @param [mapping=THREE.Texture.DEFAULT_MAPPING]
  19. * @param [wrapS=THREE.ClampToEdgeWrapping]
  20. * @param [wrapT=THREE.ClampToEdgeWrapping]
  21. * @param [magFilter=THREE.LinearFilter]
  22. * @param [minFilter=THREE.LinearMipmapLinearFilter]
  23. * @param [format=THREE.RGBAFormat]
  24. * @param [type=THREE.UnsignedByteType]
  25. * @param [anisotropy=1]
  26. * @param [encoding=THREE.LinearEncoding]
  27. */
  28. constructor(
  29. image?: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement,
  30. mapping?: Mapping,
  31. wrapS?: Wrapping,
  32. wrapT?: Wrapping,
  33. magFilter?: TextureFilter,
  34. minFilter?: TextureFilter,
  35. format?: PixelFormat,
  36. type?: TextureDataType,
  37. anisotropy?: number,
  38. encoding?: TextureEncoding
  39. );
  40. id: number;
  41. uuid: string;
  42. /**
  43. * @default ''
  44. */
  45. name: string;
  46. sourceFile: string;
  47. /**
  48. * @default THREE.Texture.DEFAULT_IMAGE
  49. */
  50. image: any; // HTMLImageElement or ImageData or { width: number, height: number } in some children;
  51. /**
  52. * @default []
  53. */
  54. mipmaps: any[]; // ImageData[] for 2D textures and CubeTexture[] for cube textures;
  55. /**
  56. * @default THREE.Texture.DEFAULT_MAPPING
  57. */
  58. mapping: Mapping;
  59. /**
  60. * @default THREE.ClampToEdgeWrapping
  61. */
  62. wrapS: Wrapping;
  63. /**
  64. * @default THREE.ClampToEdgeWrapping
  65. */
  66. wrapT: Wrapping;
  67. /**
  68. * @default THREE.LinearFilter
  69. */
  70. magFilter: TextureFilter;
  71. /**
  72. * @default THREE.LinearMipmapLinearFilter
  73. */
  74. minFilter: TextureFilter;
  75. /**
  76. * @default 1
  77. */
  78. anisotropy: number;
  79. /**
  80. * @default THREE.RGBAFormat
  81. */
  82. format: PixelFormat;
  83. internalFormat: PixelFormatGPU | null;
  84. /**
  85. * @default THREE.UnsignedByteType
  86. */
  87. type: TextureDataType;
  88. /**
  89. * @default new THREE.Matrix3()
  90. */
  91. matrix: Matrix3;
  92. /**
  93. * @default true
  94. */
  95. matrixAutoUpdate: boolean;
  96. /**
  97. * @default new THREE.Vector2( 0, 0 )
  98. */
  99. offset: Vector2;
  100. /**
  101. * @default new THREE.Vector2( 1, 1 )
  102. */
  103. repeat: Vector2;
  104. /**
  105. * @default new THREE.Vector2( 0, 0 )
  106. */
  107. center: Vector2;
  108. /**
  109. * @default 0
  110. */
  111. rotation: number;
  112. /**
  113. * @default true
  114. */
  115. generateMipmaps: boolean;
  116. /**
  117. * @default false
  118. */
  119. premultiplyAlpha: boolean;
  120. /**
  121. * @default true
  122. */
  123. flipY: boolean;
  124. /**
  125. * @default 4
  126. */
  127. unpackAlignment: number;
  128. /**
  129. * @default THREE.LinearEncoding
  130. */
  131. encoding: TextureEncoding;
  132. /**
  133. * @default 0
  134. */
  135. version: number;
  136. needsUpdate: boolean;
  137. readonly isTexture: true;
  138. onUpdate: () => void;
  139. static DEFAULT_IMAGE: any;
  140. static DEFAULT_MAPPING: any;
  141. clone(): this;
  142. copy( source: Texture ): this;
  143. toJSON( meta: any ): any;
  144. dispose(): void;
  145. transformUv( uv: Vector2 ): Vector2;
  146. updateMatrix(): void;
  147. }
粤ICP备19079148号