Texture.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Texture - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → </p>
  13. <h1 translate="no">Texture</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Base class for all textures.</p>
  17. <p>Note: After the initial use of a texture, its dimensions, format, and type
  18. cannot be changed. Instead, call <a href="Texture.html#dispose">Texture#dispose</a> on the texture and instantiate a new one.</p></div>
  19. </header>
  20. <article>
  21. <div class="container-overview">
  22. <h2>Constructor</h2>
  23. <h3 class="name name-method" id="Texture" translate="no">new <a href="#Texture">Texture</a><span class="signature">( image : <span class="param-type">Object</span>, mapping : <span class="param-type">number</span>, wrapS : <span class="param-type">number</span>, wrapT : <span class="param-type">number</span>, magFilter : <span class="param-type">number</span>, minFilter : <span class="param-type">number</span>, format : <span class="param-type">number</span>, type : <span class="param-type">number</span>, anisotropy : <span class="param-type">number</span>, colorSpace : <span class="param-type">string</span> )</span> </h3>
  24. <div class="method">
  25. <div class="description">
  26. <p>Constructs a new texture.</p>
  27. </div>
  28. <table class="params">
  29. <tbody>
  30. <tr>
  31. <td class="name">
  32. <strong>image</strong>
  33. </td>
  34. <td class="description last">
  35. <p>The image holding the texture data.</p>
  36. <p>Default is <code>Texture.DEFAULT_IMAGE</code>.</p>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class="name">
  41. <strong>mapping</strong>
  42. </td>
  43. <td class="description last">
  44. <p>The texture mapping.</p>
  45. <p>Default is <code>Texture.DEFAULT_MAPPING</code>.</p>
  46. </td>
  47. </tr>
  48. <tr>
  49. <td class="name">
  50. <strong>wrapS</strong>
  51. </td>
  52. <td class="description last">
  53. <p>The wrapS value.</p>
  54. <p>Default is <code>ClampToEdgeWrapping</code>.</p>
  55. </td>
  56. </tr>
  57. <tr>
  58. <td class="name">
  59. <strong>wrapT</strong>
  60. </td>
  61. <td class="description last">
  62. <p>The wrapT value.</p>
  63. <p>Default is <code>ClampToEdgeWrapping</code>.</p>
  64. </td>
  65. </tr>
  66. <tr>
  67. <td class="name">
  68. <strong>magFilter</strong>
  69. </td>
  70. <td class="description last">
  71. <p>The mag filter value.</p>
  72. <p>Default is <code>LinearFilter</code>.</p>
  73. </td>
  74. </tr>
  75. <tr>
  76. <td class="name">
  77. <strong>minFilter</strong>
  78. </td>
  79. <td class="description last">
  80. <p>The min filter value.</p>
  81. <p>Default is <code>LinearMipmapLinearFilter</code>.</p>
  82. </td>
  83. </tr>
  84. <tr>
  85. <td class="name">
  86. <strong>format</strong>
  87. </td>
  88. <td class="description last">
  89. <p>The texture format.</p>
  90. <p>Default is <code>RGBAFormat</code>.</p>
  91. </td>
  92. </tr>
  93. <tr>
  94. <td class="name">
  95. <strong>type</strong>
  96. </td>
  97. <td class="description last">
  98. <p>The texture type.</p>
  99. <p>Default is <code>UnsignedByteType</code>.</p>
  100. </td>
  101. </tr>
  102. <tr>
  103. <td class="name">
  104. <strong>anisotropy</strong>
  105. </td>
  106. <td class="description last">
  107. <p>The anisotropy value.</p>
  108. <p>Default is <code>Texture.DEFAULT_ANISOTROPY</code>.</p>
  109. </td>
  110. </tr>
  111. <tr>
  112. <td class="name">
  113. <strong>colorSpace</strong>
  114. </td>
  115. <td class="description last">
  116. <p>The color space.</p>
  117. <p>Default is <code>NoColorSpace</code>.</p>
  118. </td>
  119. </tr>
  120. </tbody>
  121. </table>
  122. </div>
  123. </div>
  124. <h2 class="subsection-title">Properties</h2>
  125. <div class="member">
  126. <h3 class="name" id="anisotropy" translate="no">.<a href="#anisotropy">anisotropy</a><span class="type-signature"> : number</span> </h3>
  127. <div class="description">
  128. <p>The number of samples taken along the axis through the pixel that has the
  129. highest density of texels. By default, this value is <code>1</code>. A higher value
  130. gives a less blurry result than a basic mipmap, at the cost of more
  131. texture samples being used.</p>
  132. <p>Default is <code>Texture.DEFAULT_ANISOTROPY</code>.</p>
  133. </div>
  134. </div>
  135. <div class="member">
  136. <h3 class="name" id="center" translate="no">.<a href="#center">center</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  137. <div class="description">
  138. <p>The point around which rotation occurs. A value of <code>(0.5, 0.5)</code> corresponds
  139. to the center of the texture. Default is <code>(0, 0)</code>, the lower left.</p>
  140. <p>Default is <code>(0,0)</code>.</p>
  141. </div>
  142. </div>
  143. <div class="member">
  144. <h3 class="name" id="channel" translate="no">.<a href="#channel">channel</a><span class="type-signature"> : number</span> </h3>
  145. <div class="description">
  146. <p>Lets you select the uv attribute to map the texture to. <code>0</code> for <code>uv</code>,
  147. <code>1</code> for <code>uv1</code>, <code>2</code> for <code>uv2</code> and <code>3</code> for <code>uv3</code>.</p>
  148. <p>Default is <code>0</code>.</p>
  149. </div>
  150. </div>
  151. <div class="member">
  152. <h3 class="name" id="colorSpace" translate="no">.<a href="#colorSpace">colorSpace</a><span class="type-signature"> : string</span> </h3>
  153. <div class="description">
  154. <p>Textures containing color data should be annotated with <code>SRGBColorSpace</code> or <code>LinearSRGBColorSpace</code>.</p>
  155. <p>Default is <code>NoColorSpace</code>.</p>
  156. </div>
  157. </div>
  158. <div class="member">
  159. <h3 class="name" id="depth" translate="no">.<a href="#depth">depth</a> </h3>
  160. <div class="description">
  161. <p>The depth of the texture in pixels.</p>
  162. </div>
  163. </div>
  164. <div class="member">
  165. <h3 class="name" id="flipY" translate="no">.<a href="#flipY">flipY</a><span class="type-signature"> : boolean</span> </h3>
  166. <div class="description">
  167. <p>If set to <code>true</code>, the texture is flipped along the vertical axis when
  168. uploaded to the GPU.</p>
  169. <p>Note that this property has no effect when using <code>ImageBitmap</code>. You need to
  170. configure the flip on bitmap creation instead.</p>
  171. <p>Default is <code>true</code>.</p>
  172. </div>
  173. </div>
  174. <div class="member">
  175. <h3 class="name" id="format" translate="no">.<a href="#format">format</a><span class="type-signature"> : number</span> </h3>
  176. <div class="description">
  177. <p>The format of the texture.</p>
  178. <p>Default is <code>RGBAFormat</code>.</p>
  179. </div>
  180. </div>
  181. <div class="member">
  182. <h3 class="name" id="generateMipmaps" translate="no">.<a href="#generateMipmaps">generateMipmaps</a><span class="type-signature"> : boolean</span> </h3>
  183. <div class="description">
  184. <p>Whether to generate mipmaps (if possible) for a texture.</p>
  185. <p>Set this to <code>false</code> if you are creating mipmaps manually.</p>
  186. <p>Default is <code>true</code>.</p>
  187. </div>
  188. </div>
  189. <div class="member">
  190. <h3 class="name" id="height" translate="no">.<a href="#height">height</a> </h3>
  191. <div class="description">
  192. <p>The height of the texture in pixels.</p>
  193. </div>
  194. </div>
  195. <div class="member">
  196. <h3 class="name" id="id" translate="no">.<a href="#id">id</a><span class="type-signature"> : number</span> <span class="type-signature">(readonly) </span></h3>
  197. <div class="description">
  198. <p>The ID of the texture.</p>
  199. </div>
  200. </div>
  201. <div class="member">
  202. <h3 class="name" id="image" translate="no">.<a href="#image">image</a><span class="type-signature"> : Object</span> </h3>
  203. <div class="description">
  204. <p>The image object holding the texture data.</p>
  205. </div>
  206. </div>
  207. <div class="member">
  208. <h3 class="name" id="internalFormat" translate="no">.<a href="#internalFormat">internalFormat</a><span class="type-signature"> : string</span> </h3>
  209. <div class="description">
  210. <p>The default internal format is derived from <a href="Texture.html#format">Texture#format</a> and <a href="Texture.html#type">Texture#type</a> and
  211. defines how the texture data is going to be stored on the GPU.</p>
  212. <p>This property allows to overwrite the default format.</p>
  213. <p>Default is <code>null</code>.</p>
  214. </div>
  215. </div>
  216. <div class="member">
  217. <h3 class="name" id="isArrayTexture" translate="no">.<a href="#isArrayTexture">isArrayTexture</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  218. <div class="description">
  219. <p>Indicates if a texture should be handled like a texture array.</p>
  220. <p>Default is <code>false</code>.</p>
  221. </div>
  222. </div>
  223. <div class="member">
  224. <h3 class="name" id="isRenderTargetTexture" translate="no">.<a href="#isRenderTargetTexture">isRenderTargetTexture</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  225. <div class="description">
  226. <p>Indicates whether a texture belongs to a render target or not.</p>
  227. <p>Default is <code>false</code>.</p>
  228. </div>
  229. </div>
  230. <div class="member">
  231. <h3 class="name" id="isTexture" translate="no">.<a href="#isTexture">isTexture</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  232. <div class="description">
  233. <p>This flag can be used for type testing.</p>
  234. <p>Default is <code>true</code>.</p>
  235. </div>
  236. </div>
  237. <div class="member">
  238. <h3 class="name" id="magFilter" translate="no">.<a href="#magFilter">magFilter</a><span class="type-signature"> : <a href="global.html#NearestFilter">NearestFilter</a> | <a href="global.html#NearestMipmapNearestFilter">NearestMipmapNearestFilter</a> | <a href="global.html#NearestMipmapLinearFilter">NearestMipmapLinearFilter</a> | <a href="global.html#LinearFilter">LinearFilter</a> | <a href="global.html#LinearMipmapNearestFilter">LinearMipmapNearestFilter</a> | <a href="global.html#LinearMipmapLinearFilter">LinearMipmapLinearFilter</a></span> </h3>
  239. <div class="description">
  240. <p>How the texture is sampled when a texel covers more than one pixel.</p>
  241. <p>Default is <code>LinearFilter</code>.</p>
  242. </div>
  243. </div>
  244. <div class="member">
  245. <h3 class="name" id="mapping" translate="no">.<a href="#mapping">mapping</a><span class="type-signature"> : <a href="global.html#UVMapping">UVMapping</a> | <a href="global.html#CubeReflectionMapping">CubeReflectionMapping</a> | <a href="global.html#CubeRefractionMapping">CubeRefractionMapping</a> | <a href="global.html#EquirectangularReflectionMapping">EquirectangularReflectionMapping</a> | <a href="global.html#EquirectangularRefractionMapping">EquirectangularRefractionMapping</a> | <a href="global.html#CubeUVReflectionMapping">CubeUVReflectionMapping</a></span> </h3>
  246. <div class="description">
  247. <p>How the texture is applied to the object. The value <code>UVMapping</code>
  248. is the default, where texture or uv coordinates are used to apply the map.</p>
  249. <p>Default is <code>UVMapping</code>.</p>
  250. </div>
  251. </div>
  252. <div class="member">
  253. <h3 class="name" id="matrix" translate="no">.<a href="#matrix">matrix</a><span class="type-signature"> : <a href="Matrix3.html">Matrix3</a></span> </h3>
  254. <div class="description">
  255. <p>The uv-transformation matrix of the texture.</p>
  256. </div>
  257. </div>
  258. <div class="member">
  259. <h3 class="name" id="matrixAutoUpdate" translate="no">.<a href="#matrixAutoUpdate">matrixAutoUpdate</a><span class="type-signature"> : boolean</span> </h3>
  260. <div class="description">
  261. <p>Whether to update the texture's uv-transformation <a href="Texture.html#matrix">Texture#matrix</a>
  262. from the properties <a href="Texture.html#offset">Texture#offset</a>, <a href="Texture.html#repeat">Texture#repeat</a>,
  263. <a href="Texture.html#rotation">Texture#rotation</a>, and <a href="Texture.html#center">Texture#center</a>.</p>
  264. <p>Set this to <code>false</code> if you are specifying the uv-transform matrix directly.</p>
  265. <p>Default is <code>true</code>.</p>
  266. </div>
  267. </div>
  268. <div class="member">
  269. <h3 class="name" id="minFilter" translate="no">.<a href="#minFilter">minFilter</a><span class="type-signature"> : <a href="global.html#NearestFilter">NearestFilter</a> | <a href="global.html#NearestMipmapNearestFilter">NearestMipmapNearestFilter</a> | <a href="global.html#NearestMipmapLinearFilter">NearestMipmapLinearFilter</a> | <a href="global.html#LinearFilter">LinearFilter</a> | <a href="global.html#LinearMipmapNearestFilter">LinearMipmapNearestFilter</a> | <a href="global.html#LinearMipmapLinearFilter">LinearMipmapLinearFilter</a></span> </h3>
  270. <div class="description">
  271. <p>How the texture is sampled when a texel covers less than one pixel.</p>
  272. <p>Default is <code>LinearMipmapLinearFilter</code>.</p>
  273. </div>
  274. </div>
  275. <div class="member">
  276. <h3 class="name" id="mipmaps" translate="no">.<a href="#mipmaps">mipmaps</a><span class="type-signature"> : Array.&lt;Object></span> </h3>
  277. <div class="description">
  278. <p>An array holding user-defined mipmaps.</p>
  279. </div>
  280. </div>
  281. <div class="member">
  282. <h3 class="name" id="name" translate="no">.<a href="#name">name</a><span class="type-signature"> : string</span> </h3>
  283. <div class="description">
  284. <p>The name of the material.</p>
  285. </div>
  286. </div>
  287. <div class="member">
  288. <h3 class="name" id="needsPMREMUpdate" translate="no">.<a href="#needsPMREMUpdate">needsPMREMUpdate</a><span class="type-signature"> : boolean</span> </h3>
  289. <div class="description">
  290. <p>Setting this property to <code>true</code> indicates the engine the PMREM
  291. must be regenerated.</p>
  292. <p>Default is <code>false</code>.</p>
  293. </div>
  294. </div>
  295. <div class="member">
  296. <h3 class="name" id="needsUpdate" translate="no">.<a href="#needsUpdate">needsUpdate</a><span class="type-signature"> : boolean</span> </h3>
  297. <div class="description">
  298. <p>Setting this property to <code>true</code> indicates the engine the texture
  299. must be updated in the next render. This triggers a texture upload
  300. to the GPU and ensures correct texture parameter configuration.</p>
  301. <p>Default is <code>false</code>.</p>
  302. </div>
  303. </div>
  304. <div class="member">
  305. <h3 class="name" id="offset" translate="no">.<a href="#offset">offset</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  306. <div class="description">
  307. <p>How much a single repetition of the texture is offset from the beginning,
  308. in each direction U and V. Typical range is <code>0.0</code> to <code>1.0</code>.</p>
  309. <p>Default is <code>(0,0)</code>.</p>
  310. </div>
  311. </div>
  312. <div class="member">
  313. <h3 class="name" id="onUpdate" translate="no">.<a href="#onUpdate">onUpdate</a><span class="type-signature"> : function</span> </h3>
  314. <div class="description">
  315. <p>A callback function, called when the texture is updated (e.g., when
  316. <a href="Texture.html#needsUpdate">Texture#needsUpdate</a> has been set to true and then the texture is used).</p>
  317. <p>Default is <code>null</code>.</p>
  318. </div>
  319. </div>
  320. <div class="member">
  321. <h3 class="name" id="pmremVersion" translate="no">.<a href="#pmremVersion">pmremVersion</a><span class="type-signature"> : number</span> <span class="type-signature">(readonly) </span></h3>
  322. <div class="description">
  323. <p>Indicates whether this texture should be processed by <code>PMREMGenerator</code> or not
  324. (only relevant for render target textures).</p>
  325. <p>Default is <code>0</code>.</p>
  326. </div>
  327. </div>
  328. <div class="member">
  329. <h3 class="name" id="premultiplyAlpha" translate="no">.<a href="#premultiplyAlpha">premultiplyAlpha</a><span class="type-signature"> : boolean</span> </h3>
  330. <div class="description">
  331. <p>If set to <code>true</code>, the alpha channel, if present, is multiplied into the
  332. color channels when the texture is uploaded to the GPU.</p>
  333. <p>Note that this property has no effect when using <code>ImageBitmap</code>. You need to
  334. configure premultiply alpha on bitmap creation instead.</p>
  335. <p>Default is <code>false</code>.</p>
  336. </div>
  337. </div>
  338. <div class="member">
  339. <h3 class="name" id="renderTarget" translate="no">.<a href="#renderTarget">renderTarget</a><span class="type-signature"> : <a href="RenderTarget.html">RenderTarget</a> | <a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> </h3>
  340. <div class="description">
  341. <p>An optional back reference to the textures render target.</p>
  342. <p>Default is <code>null</code>.</p>
  343. </div>
  344. </div>
  345. <div class="member">
  346. <h3 class="name" id="repeat" translate="no">.<a href="#repeat">repeat</a><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  347. <div class="description">
  348. <p>How many times the texture is repeated across the surface, in each
  349. direction U and V. If repeat is set greater than <code>1</code> in either direction,
  350. the corresponding wrap parameter should also be set to <code>RepeatWrapping</code>
  351. or <code>MirroredRepeatWrapping</code> to achieve the desired tiling effect.</p>
  352. <p>Default is <code>(1,1)</code>.</p>
  353. </div>
  354. </div>
  355. <div class="member">
  356. <h3 class="name" id="rotation" translate="no">.<a href="#rotation">rotation</a><span class="type-signature"> : number</span> </h3>
  357. <div class="description">
  358. <p>How much the texture is rotated around the center point, in radians.
  359. Positive values are counter-clockwise.</p>
  360. <p>Default is <code>0</code>.</p>
  361. </div>
  362. </div>
  363. <div class="member">
  364. <h3 class="name" id="source" translate="no">.<a href="#source">source</a><span class="type-signature"> : <a href="Source.html">Source</a></span> </h3>
  365. <div class="description">
  366. <p>The data definition of a texture. A reference to the data source can be
  367. shared across textures. This is often useful in context of spritesheets
  368. where multiple textures render the same data but with different texture
  369. transformations.</p>
  370. </div>
  371. </div>
  372. <div class="member">
  373. <h3 class="name" id="type" translate="no">.<a href="#type">type</a><span class="type-signature"> : number</span> </h3>
  374. <div class="description">
  375. <p>The data type of the texture.</p>
  376. <p>Default is <code>UnsignedByteType</code>.</p>
  377. </div>
  378. </div>
  379. <div class="member">
  380. <h3 class="name" id="unpackAlignment" translate="no">.<a href="#unpackAlignment">unpackAlignment</a><span class="type-signature"> : number</span> </h3>
  381. <div class="description">
  382. <p>Specifies the alignment requirements for the start of each pixel row in memory.
  383. The allowable values are <code>1</code> (byte-alignment), <code>2</code> (rows aligned to even-numbered bytes),
  384. <code>4</code> (word-alignment), and <code>8</code> (rows start on double-word boundaries).</p>
  385. <p>Default is <code>4</code>.</p>
  386. </div>
  387. </div>
  388. <div class="member">
  389. <h3 class="name" id="updateRanges" translate="no">.<a href="#updateRanges">updateRanges</a><span class="type-signature"> : Array.&lt;Object></span> </h3>
  390. <div class="description">
  391. <p>This can be used to only update a subregion or specific rows of the texture (for example, just the
  392. first 3 rows). Use the <code>addUpdateRange()</code> function to add ranges to this array.</p>
  393. </div>
  394. </div>
  395. <div class="member">
  396. <h3 class="name" id="userData" translate="no">.<a href="#userData">userData</a><span class="type-signature"> : Object</span> </h3>
  397. <div class="description">
  398. <p>An object that can be used to store custom data about the texture. It
  399. should not hold references to functions as these will not be cloned.</p>
  400. </div>
  401. </div>
  402. <div class="member">
  403. <h3 class="name" id="uuid" translate="no">.<a href="#uuid">uuid</a><span class="type-signature"> : string</span> <span class="type-signature">(readonly) </span></h3>
  404. <div class="description">
  405. <p>The UUID of the material.</p>
  406. </div>
  407. </div>
  408. <div class="member">
  409. <h3 class="name" id="version" translate="no">.<a href="#version">version</a><span class="type-signature"> : number</span> <span class="type-signature">(readonly) </span></h3>
  410. <div class="description">
  411. <p>This starts at <code>0</code> and counts how many times <a href="Texture.html#needsUpdate">Texture#needsUpdate</a> is set to <code>true</code>.</p>
  412. <p>Default is <code>0</code>.</p>
  413. </div>
  414. </div>
  415. <div class="member">
  416. <h3 class="name" id="width" translate="no">.<a href="#width">width</a> </h3>
  417. <div class="description">
  418. <p>The width of the texture in pixels.</p>
  419. </div>
  420. </div>
  421. <div class="member">
  422. <h3 class="name" id="wrapS" translate="no">.<a href="#wrapS">wrapS</a><span class="type-signature"> : <a href="global.html#RepeatWrapping">RepeatWrapping</a> | <a href="global.html#ClampToEdgeWrapping">ClampToEdgeWrapping</a> | <a href="global.html#MirroredRepeatWrapping">MirroredRepeatWrapping</a></span> </h3>
  423. <div class="description">
  424. <p>This defines how the texture is wrapped horizontally and corresponds to
  425. <em>U</em> in UV mapping.</p>
  426. <p>Default is <code>ClampToEdgeWrapping</code>.</p>
  427. </div>
  428. </div>
  429. <div class="member">
  430. <h3 class="name" id="wrapT" translate="no">.<a href="#wrapT">wrapT</a><span class="type-signature"> : <a href="global.html#RepeatWrapping">RepeatWrapping</a> | <a href="global.html#ClampToEdgeWrapping">ClampToEdgeWrapping</a> | <a href="global.html#MirroredRepeatWrapping">MirroredRepeatWrapping</a></span> </h3>
  431. <div class="description">
  432. <p>This defines how the texture is wrapped horizontally and corresponds to
  433. <em>V</em> in UV mapping.</p>
  434. <p>Default is <code>ClampToEdgeWrapping</code>.</p>
  435. </div>
  436. </div>
  437. <div class="member">
  438. <h3 class="name" id=".DEFAULT_ANISOTROPY" translate="no">.<a href="#.DEFAULT_ANISOTROPY">DEFAULT_ANISOTROPY</a><span class="type-signature"> : number</span> </h3>
  439. <div class="description">
  440. <p>The default anisotropy value for all textures.</p>
  441. <p>Default is <code>1</code>.</p>
  442. </div>
  443. </div>
  444. <div class="member">
  445. <h3 class="name" id=".DEFAULT_IMAGE" translate="no">.<a href="#.DEFAULT_IMAGE">DEFAULT_IMAGE</a><span class="type-signature"> : Image</span> </h3>
  446. <div class="description">
  447. <p>The default image for all textures.</p>
  448. <p>Default is <code>null</code>.</p>
  449. </div>
  450. </div>
  451. <div class="member">
  452. <h3 class="name" id=".DEFAULT_MAPPING" translate="no">.<a href="#.DEFAULT_MAPPING">DEFAULT_MAPPING</a><span class="type-signature"> : number</span> </h3>
  453. <div class="description">
  454. <p>The default mapping for all textures.</p>
  455. <p>Default is <code>UVMapping</code>.</p>
  456. </div>
  457. </div>
  458. <h2 class="subsection-title">Methods</h2>
  459. <h3 class="name name-method" id="addUpdateRange" translate="no">.<a href="#addUpdateRange">addUpdateRange</a><span class="signature">( start : <span class="param-type">number</span>, count : <span class="param-type">number</span> )</span> </h3>
  460. <div class="method">
  461. <div class="description">
  462. <p>Adds a range of data in the data texture to be updated on the GPU.</p>
  463. </div>
  464. <table class="params">
  465. <tbody>
  466. <tr>
  467. <td class="name">
  468. <strong>start</strong>
  469. </td>
  470. <td class="description last">
  471. <p>Position at which to start update.</p>
  472. </td>
  473. </tr>
  474. <tr>
  475. <td class="name">
  476. <strong>count</strong>
  477. </td>
  478. <td class="description last">
  479. <p>The number of components to update.</p>
  480. </td>
  481. </tr>
  482. </tbody>
  483. </table>
  484. </div>
  485. <h3 class="name name-method" id="clearUpdateRanges" translate="no">.<a href="#clearUpdateRanges">clearUpdateRanges</a><span class="signature">()</span> </h3>
  486. <div class="method">
  487. <div class="description">
  488. <p>Clears the update ranges.</p>
  489. </div>
  490. </div>
  491. <h3 class="name name-method" id="clone" translate="no">.<a href="#clone">clone</a><span class="signature">()</span><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  492. <div class="method">
  493. <div class="description">
  494. <p>Returns a new texture with copied values from this instance.</p>
  495. </div>
  496. <dl class="details">
  497. <dt class="tag-returns"><strong>Returns:</strong> A clone of this instance.</dt>
  498. </dl>
  499. </div>
  500. <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( source : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  501. <div class="method">
  502. <div class="description">
  503. <p>Copies the values of the given texture to this instance.</p>
  504. </div>
  505. <table class="params">
  506. <tbody>
  507. <tr>
  508. <td class="name">
  509. <strong>source</strong>
  510. </td>
  511. <td class="description last">
  512. <p>The texture to copy.</p>
  513. </td>
  514. </tr>
  515. </tbody>
  516. </table>
  517. <dl class="details">
  518. <dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
  519. </dl>
  520. </div>
  521. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  522. <div class="method">
  523. <div class="description">
  524. <p>Frees the GPU-related resources allocated by this instance. Call this
  525. method whenever this instance is no longer used in your app.</p>
  526. </div>
  527. <h5>Fires:</h5>
  528. <ul>
  529. <li><a href="Texture.html#event:dispose">Texture#event:dispose</a></li>
  530. </ul>
  531. </div>
  532. <h3 class="name name-method" id="setValues" translate="no">.<a href="#setValues">setValues</a><span class="signature">( values : <span class="param-type">Object</span> )</span> </h3>
  533. <div class="method">
  534. <div class="description">
  535. <p>Sets this texture's properties based on <code>values</code>.</p>
  536. </div>
  537. <table class="params">
  538. <tbody>
  539. <tr>
  540. <td class="name">
  541. <strong>values</strong>
  542. </td>
  543. <td class="description last">
  544. <p>A container with texture parameters.</p>
  545. </td>
  546. </tr>
  547. </tbody>
  548. </table>
  549. </div>
  550. <h3 class="name name-method" id="toJSON" translate="no">.<a href="#toJSON">toJSON</a><span class="signature">( meta : <span class="param-type">Object | string</span> )</span><span class="type-signature"> : Object</span> </h3>
  551. <div class="method">
  552. <div class="description">
  553. <p>Serializes the texture into JSON.</p>
  554. </div>
  555. <table class="params">
  556. <tbody>
  557. <tr>
  558. <td class="name">
  559. <strong>meta</strong>
  560. </td>
  561. <td class="description last">
  562. <p>An optional value holding meta information about the serialization.</p>
  563. </td>
  564. </tr>
  565. </tbody>
  566. </table>
  567. <dl class="details">
  568. <dt class="tag-see">See:</dt>
  569. <dd class="tag-see">
  570. <ul>
  571. <li><a href="ObjectLoader.html#parse">ObjectLoader#parse</a></li>
  572. </ul>
  573. </dd>
  574. </dl>
  575. <dl class="details">
  576. <dt class="tag-returns"><strong>Returns:</strong> A JSON object representing the serialized texture.</dt>
  577. </dl>
  578. </div>
  579. <h3 class="name name-method" id="transformUv" translate="no">.<a href="#transformUv">transformUv</a><span class="signature">( uv : <span class="param-type"><a href="Vector2.html">Vector2</a></span> )</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  580. <div class="method">
  581. <div class="description">
  582. <p>Transforms the given uv vector with the textures uv transformation matrix.</p>
  583. </div>
  584. <table class="params">
  585. <tbody>
  586. <tr>
  587. <td class="name">
  588. <strong>uv</strong>
  589. </td>
  590. <td class="description last">
  591. <p>The uv vector.</p>
  592. </td>
  593. </tr>
  594. </tbody>
  595. </table>
  596. <dl class="details">
  597. <dt class="tag-returns"><strong>Returns:</strong> The transformed uv vector.</dt>
  598. </dl>
  599. </div>
  600. <h3 class="name name-method" id="updateMatrix" translate="no">.<a href="#updateMatrix">updateMatrix</a><span class="signature">()</span> </h3>
  601. <div class="method">
  602. <div class="description">
  603. <p>Updates the texture transformation matrix from the from the properties <a href="Texture.html#offset">Texture#offset</a>,
  604. <a href="Texture.html#repeat">Texture#repeat</a>, <a href="Texture.html#rotation">Texture#rotation</a>, and <a href="Texture.html#center">Texture#center</a>.</p>
  605. </div>
  606. </div>
  607. <h2 class="subsection-title">Events</h2>
  608. <h3 class="name name-method" id="event:dispose" translate="no">.<a href="#event:dispose">dispose</a> </h3>
  609. <div class="method">
  610. <div class="description">
  611. <p>Fires when the texture has been disposed of.</p>
  612. </div>
  613. <h5>Type:</h5>
  614. <ul>
  615. <li>
  616. <span class="param-type">Object</span>
  617. </li>
  618. </ul>
  619. </div>
  620. <h2 class="subsection-title">Source</h2>
  621. <p>
  622. <a href="https://github.com/mrdoob/three.js/blob/master/src/textures/Texture.js" translate="no" target="_blank" rel="noopener">src/textures/Texture.js</a>
  623. </p>
  624. </article>
  625. </section>
  626. <script src="../scripts/linenumber.js"></script>
  627. <script src="../scripts/page.js"></script>
  628. </body>
  629. </html>
粤ICP备19079148号