2
0

Textures.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>纹理常量(Texture Constants)</h1>
  11. <h2>映射模式</h2>
  12. <code>
  13. THREE.UVMapping
  14. THREE.CubeReflectionMapping
  15. THREE.CubeRefractionMapping
  16. THREE.EquirectangularReflectionMapping
  17. THREE.EquirectangularRefractionMapping
  18. THREE.CubeUVReflectionMapping
  19. THREE.CubeUVRefractionMapping
  20. </code>
  21. <p>
  22. 这些常量定义了纹理贴图的映射模式。<br />
  23. [page:Constant UVMapping]是默认值,纹理使用网格的坐标来进行映射。<br /><br />
  24. 其它的值定义了环境映射的类型。<br /><br />
  25. [page:Constant CubeReflectionMapping] 和 [page:Constant CubeRefractionMapping] 用于 [page:CubeTexture CubeTexture] ——
  26. 由6个纹理组合而成,每个纹理都是立方体的一个面。
  27. 对于[page:CubeTexture CubeTexture]来说,[page:Constant CubeReflectionMapping]是其默认值。<br /><br />
  28. [page:Constant EquirectangularReflectionMapping] 和 [page:Constant EquirectangularRefractionMapping]
  29. 用于等距圆柱投影的环境贴图,也被叫做经纬线映射贴图。等距圆柱投影贴图表示沿着其水平中线360°的视角,以及沿着其垂直轴向180°的视角。贴图顶部和底部的边缘分别对应于它所映射的球体的北极和南极。
  30. <br /><br />
  31. 请查看示例:[example:webgl_materials_envmaps materials / envmaps] 。
  32. </p>
  33. <h2>包裹模式</h2>
  34. <code>
  35. THREE.RepeatWrapping
  36. THREE.ClampToEdgeWrapping
  37. THREE.MirroredRepeatWrapping
  38. </code>
  39. <p>
  40. 这些常量定义了纹理贴图的 [page:Texture.wrapS wrapS] 和 [page:Texture.wrapT wrapT] 属性,定义了水平和垂直方向上纹理的包裹方式。
  41. <br /><br />
  42. 使用[page:constant RepeatWrapping],纹理将简单地重复到无穷大。
  43. With [page:constant RepeatWrapping] the texture will simply repeat to infinity.<br /><br />
  44. [page:constant ClampToEdgeWrapping]是默认值,纹理中的最后一个像素将延伸到网格的边缘。<br /><br />
  45. 使用[page:constant MirroredRepeatWrapping], 纹理将重复到无穷大,在每次重复时将进行镜像。
  46. </p>
  47. <h2>放大滤镜(Magnification Filters)</h2>
  48. <code>
  49. THREE.NearestFilter
  50. THREE.LinearFilter
  51. </code>
  52. <p>
  53. 这些常量用于纹理的[page:Texture.magFilter magFilter]属性,它们定义了当被纹理化的像素映射到小于或者等于1纹理元素(texel)的区域时,将要使用的纹理放大函数。<br /><br />
  54. [page:constant NearestFilter]返回与指定纹理坐标(在曼哈顿距离之内)最接近的纹理元素的值。<br /><br />
  55. [page:constant LinearFilter]是默认值,返回距离指定的纹理坐标最近的四个纹理元素的加权平均值,
  56. 并且可以包含纹理的其他部分中,被包裹或者被重复的项目,具体取决于 [page:Texture.wrapS wrapS] 和 [page:Texture.wrapT wrapT] 的值,and on the exact mapping。
  57. </p>
  58. <h2>缩小滤镜(Minification Filters)</h2>
  59. <code>
  60. THREE.NearestFilter
  61. THREE.NearestMipmapNearestFilter
  62. THREE.NearestMipmapLinearFilter
  63. THREE.LinearFilter
  64. THREE.LinearMipmapNearestFilter
  65. THREE.LinearMipmapLinearFilter
  66. </code>
  67. <p>
  68. 这些常量用于纹理的[page:Texture.minFilter minFilter]属性,它们定义了当被纹理化的像素映射到大于1纹理元素(texel)的区域时,将要使用的纹理缩小函数。<br /><br />
  69. 除了[page:constant NearestFilter] 和 [page:constant LinearFilter],
  70. 下面的四个函数也可以用于缩小:<br /><br />
  71. [page:constant NearestMipmapNearestFilter]选择与被纹理化像素的尺寸最匹配的mipmap,
  72. 并以[page:constant NearestFilter](最靠近像素中心的纹理元素)为标准来生成纹理值。
  73. <br /><br />
  74. [page:constant NearestMipmapLinearFilter]选择与被纹理化像素的尺寸最接近的两个mipmap,
  75. 并以[page:constant NearestFilter]为标准来从每个mipmap中生成纹理值。最终的纹理值是这两个值的加权平均值。
  76. <br /><br />
  77. [page:constant LinearMipmapNearestFilter]选择与被纹理化像素的尺寸最匹配的mipmap,
  78. 并以[page:constant LinearFilter](最靠近像素中心的四个纹理元素的加权平均值)为标准来生成纹理值。
  79. <br /><br />
  80. [page:constant LinearMipmapLinearFilter]是默认值,它选择与被纹理化像素的尺寸最接近的两个mipmap,
  81. 并以[page:constant LinearFilter]为标准来从每个mipmap中生成纹理值。最终的纹理值是这两个值的加权平均值。<br /><br />
  82. 请查看示例:[example:webgl_materials_texture_filters materials / texture / filters]。
  83. </p>
  84. <h2>类型</h2>
  85. <code>
  86. THREE.UnsignedByteType
  87. THREE.ByteType
  88. THREE.ShortType
  89. THREE.UnsignedShortType
  90. THREE.IntType
  91. THREE.UnsignedIntType
  92. THREE.FloatType
  93. THREE.HalfFloatType
  94. THREE.UnsignedShort4444Type
  95. THREE.UnsignedShort5551Type
  96. THREE.UnsignedShort565Type
  97. THREE.UnsignedInt248Type
  98. </code>
  99. <p>
  100. 这些常量用于纹理的[page:Texture.type type]属性,这些属性必须与正确的格式相对应。详情请查看下方。<br /><br />
  101. [page:constant UnsignedByteType] 是默认值。
  102. </p>
  103. <h2>格式</h2>
  104. <code>
  105. THREE.AlphaFormat
  106. THREE.RedFormat
  107. THREE.RedIntegerFormat
  108. THREE.RGFormat
  109. THREE.RGIntegerFormat
  110. THREE.RGBFormat
  111. THREE.RGBIntegerFormat
  112. THREE.RGBAFormat
  113. THREE.RGBAIntegerFormat
  114. THREE.LuminanceFormat
  115. THREE.LuminanceAlphaFormat
  116. THREE.RGBEFormat
  117. THREE.DepthFormat
  118. THREE.DepthStencilFormat
  119. </code>
  120. <p>
  121. 这些常量用于纹理的[page:Texture.format format]属性,它们定义了shader(着色器)将如何读取的2D纹理或者*texels*(纹理元素)的元素。.<br /><br />
  122. [page:constant AlphaFormat] 丢弃红、绿、蓝分量,仅读取Alpha分量。<br /><br />
  123. [page:constant RedFormat] discards the green and blue components and reads just the red component.<br /><br />
  124. [page:constant RedIntegerFormat] discards the green and blue components and reads just the red component.
  125. The texels are read as integers instead of floating point.
  126. (can only be used with a WebGL 2 rendering context).
  127. <br /><br />
  128. [page:constant RGFormat] discards the alpha, and blue components and reads the red, and green components.
  129. (can only be used with a WebGL 2 rendering context).
  130. <br /><br />
  131. [page:constant RGIntegerFormat] discards the alpha, and blue components and reads the red, and green components.
  132. The texels are read as integers instead of floating point.
  133. (can only be used with a WebGL 2 rendering context).
  134. <br /><br />
  135. [page:constant RGBFormat] 丢弃Alpha分量,仅读取红、绿、蓝分量。<br /><br />
  136. [page:constant RGBIntegerFormat] discards the alpha components and reads the red, green and blue components.
  137. (can only be used with a WebGL 2 rendering context).
  138. <br /><br />
  139. [page:constant RGBAFormat] 是默认值,它将读取红、绿、蓝和Alpha分量。<br /><br />
  140. [page:constant RGBAIntegerFormat] is the default and reads the red, green, blue and alpha components.
  141. The texels are read as integers instead of floating point.
  142. (can only be used with a WebGL 2 rendering context).
  143. <br /><br />
  144. [page:constant LuminanceFormat] 将每个元素作为单独的亮度分量来读取。
  145. 将其转换为范围限制在[0,1]区间的浮点数,然后通过将亮度值放入红、绿、蓝通道,并将1.0赋给Alpha通道,来组装成一个RGBA元素。<br /><br />
  146. [page:constant LuminanceAlphaFormat] 将每个元素同时作为亮度分量和Alpha分量来读取。
  147. 和上面[page:constant LuminanceFormat]的处理过程是一致的,除了Alpha分量具有除了*1.0*以外的值。<br /><br />
  148. [page:constant RGBEFormat] 与 [page:constant RGBAFormat] 是相同的。<br /><br />
  149. [page:constant DepthFormat]将每个元素作为单独的深度值来读取,将其转换为范围限制在[0,1]区间的浮点数。
  150. 它是[page:DepthTexture DepthTexture]的默认值。<br /><br />
  151. [page:constant DepthStencilFormat]将每个元素同时作为一对深度值和模板值来读取。
  152. 其中的深度分量解释为[page:constant DepthFormat]。
  153. 模板分量基于深度+模板的内部格式来进行解释。
  154. <br /><br />
  155. 请注意,纹理必须具有正确的[page:Texture.type type]设置,正如上一节所描述的那样。
  156. 请参阅[link:https://developer.mozilla.org/en/docs/Web/API/WebGLRenderingContext/texImage2D WebGLRenderingContext.texImage2D]
  157. 来获得有关详细信息。
  158. </p>
  159. <h2>DDS / ST3C 压缩纹理格式</h2>
  160. <code>
  161. THREE.RGB_S3TC_DXT1_Format
  162. THREE.RGBA_S3TC_DXT1_Format
  163. THREE.RGBA_S3TC_DXT3_Format
  164. THREE.RGBA_S3TC_DXT5_Format
  165. </code>
  166. <p>
  167. 要使用[page:CompressedTexture CompressedTexture]中的[page:Texture.format format]属性,
  168. 需要获得[link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/ WEBGL_compressed_texture_s3tc]
  169. 扩展的支持。<br /><br />
  170. 通过这个扩展,这里的四种[link:https://en.wikipedia.org/wiki/S3_Texture_Compression S3TC]格式将可以使用:<br />
  171. [page:constant RGB_S3TC_DXT1_Format]:RGB图像格式的DXT1压缩图像。
  172. [page:constant RGBA_S3TC_DXT1_Format]:RGB图像格式的DXT1压缩图像,Alpha仅具有是/否透明两个值。<br />
  173. [page:constant RGBA_S3TC_DXT3_Format]:RGBA图像格式的DXT3压缩图像,和32位RGBA纹理贴图相比,它提供了4:1的压缩比。<br />
  174. [page:constant RGBA_S3TC_DXT5_Format]:RGBA图像格式的DXT5压缩图像,它也提供了4:1的压缩比,但与DX3格式的不同之处在于其Alpha是如何被压缩的。<br />
  175. </p>
  176. <h2>PVRTC 压缩纹理格式(PVRTC Compressed Texture Formats)</h2>
  177. <code>
  178. THREE.RGB_PVRTC_4BPPV1_Format
  179. THREE.RGB_PVRTC_2BPPV1_Format
  180. THREE.RGBA_PVRTC_4BPPV1_Format
  181. THREE.RGBA_PVRTC_2BPPV1_Format
  182. </code>
  183. <p>
  184. 要使用[page:CompressedTexture CompressedTexture]中的[page:Texture.format format]属性,需要获得
  185. [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_pvrtc/ WEBGL_compressed_texture_pvrtc]
  186. 扩展的支持。<br />
  187. PVRTC通常只在具有PowerVR芯片的移动设备上可用,这些设备主要是苹果设备。<br /><br />
  188. 通过这个扩展,这里的四种[link:https://en.wikipedia.org/wiki/PVRTC PVRTC]格式将可以使用:<br />
  189. [page:constant RGB_PVRTC_4BPPV1_Format]:4位模式下的RGB压缩,每4x4像素一个块。<br />
  190. [page:constant RGB_PVRTC_2BPPV1_Format]:2位模式下的RGB压缩,每8x4像素一个块。<br />
  191. [page:constant RGBA_PVRTC_4BPPV1_Format]: 4位模式下的RGBA压缩,每4x4像素一个块。<br />
  192. [page:constant RGBA_PVRTC_2BPPV1_Format]: 2位模式下的RGB压缩,每8x4像素一个块。<br />
  193. </p>
  194. <h2>ETC 压缩纹理格式</h2>
  195. <code>
  196. THREE.RGB_ETC1_Format
  197. THREE.RGB_ETC2_Format
  198. THREE.RGBA_ETC2_EAC_Format
  199. </code>
  200. <p>
  201. For use with a [page:CompressedTexture CompressedTexture]'s [page:Texture.format format] property,
  202. these require support for the [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc1/ WEBGL_compressed_texture_etc1]
  203. (ETC1) or [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc/ WEBGL_compressed_texture_etc]
  204. (ETC2) extensions. <br /><br />
  205. </p>
  206. <h2>ASTC Compressed Texture Format</h2>
  207. <code>
  208. THREE.RGBA_ASTC_4x4_Format
  209. THREE.RGBA_ASTC_5x4_Format
  210. THREE.RGBA_ASTC_5x5_Format
  211. THREE.RGBA_ASTC_6x5_Format
  212. THREE.RGBA_ASTC_6x6_Format
  213. THREE.RGBA_ASTC_8x5_Format
  214. THREE.RGBA_ASTC_8x6_Format
  215. THREE.RGBA_ASTC_8x8_Format
  216. THREE.RGBA_ASTC_10x5_Format
  217. THREE.RGBA_ASTC_10x6_Format
  218. THREE.RGBA_ASTC_10x8_Format
  219. THREE.RGBA_ASTC_10x10_Format
  220. THREE.RGBA_ASTC_12x10_Format
  221. THREE.RGBA_ASTC_12x12_Format
  222. THREE.SRGB8_ALPHA8_ASTC_4x4_Format
  223. THREE.SRGB8_ALPHA8_ASTC_5x4_Format
  224. THREE.SRGB8_ALPHA8_ASTC_5x5_Format
  225. THREE.SRGB8_ALPHA8_ASTC_6x5_Format
  226. THREE.SRGB8_ALPHA8_ASTC_6x6_Format
  227. THREE.SRGB8_ALPHA8_ASTC_8x5_Format
  228. THREE.SRGB8_ALPHA8_ASTC_8x6_Format
  229. THREE.SRGB8_ALPHA8_ASTC_8x8_Format
  230. THREE.SRGB8_ALPHA8_ASTC_10x5_Format
  231. THREE.SRGB8_ALPHA8_ASTC_10x6_Format
  232. THREE.SRGB8_ALPHA8_ASTC_10x8_Format
  233. THREE.SRGB8_ALPHA8_ASTC_10x10_Format
  234. THREE.SRGB8_ALPHA8_ASTC_12x10_Format
  235. THREE.SRGB8_ALPHA8_ASTC_12x12_Format
  236. </code>
  237. <p>
  238. For use with a [page:CompressedTexture CompressedTexture]'s [page:Texture.format format] property,
  239. these require support for the [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_astc/ WEBGL_compressed_texture_astc] extension. <br /><br />
  240. </p>
  241. <h2>Internal Formats</h2>
  242. <code>
  243. 'ALPHA'
  244. 'RGB'
  245. 'RGBA'
  246. 'LUMINANCE'
  247. 'LUMINANCE_ALPHA'
  248. 'RED_INTEGER'
  249. 'R8'
  250. 'R8_SNORM'
  251. 'R8I'
  252. 'R8UI'
  253. 'R16I'
  254. 'R16UI'
  255. 'R16F'
  256. 'R32I'
  257. 'R32UI'
  258. 'R32F'
  259. 'RG8'
  260. 'RG8_SNORM'
  261. 'RG8I'
  262. 'RG8UI'
  263. 'RG16I'
  264. 'RG16UI'
  265. 'RG16F'
  266. 'RG32I'
  267. 'RG32UI'
  268. 'RG32F'
  269. 'RGB565'
  270. 'RGB8'
  271. 'RGB8_SNORM'
  272. 'RGB8I'
  273. 'RGB8UI'
  274. 'RGB16I'
  275. 'RGB16UI'
  276. 'RGB16F'
  277. 'RGB32I'
  278. 'RGB32UI'
  279. 'RGB32F'
  280. 'RGB9_E5'
  281. 'SRGB8'
  282. 'R11F_G11F_B10F'
  283. 'RGBA4'
  284. 'RGBA8'
  285. 'RGBA8_SNORM'
  286. 'RGBA8I'
  287. 'RGBA8UI'
  288. 'RGBA16I'
  289. 'RGBA16UI'
  290. 'RGBA16F'
  291. 'RGBA32I'
  292. 'RGBA32UI'
  293. 'RGBA32F'
  294. 'RGB5_A1'
  295. 'RGB10_A2'
  296. 'RGB10_A2UI'
  297. 'SRGB8_ALPHA8'
  298. 'DEPTH_COMPONENT16'
  299. 'DEPTH_COMPONENT24'
  300. 'DEPTH_COMPONENT32F'
  301. 'DEPTH24_STENCIL8'
  302. 'DEPTH32F_STENCIL8'
  303. </code>
  304. <p>
  305. Heads up: changing the internal format of a texture will only affect the
  306. texture when using a WebGL 2 rendering context.<br /><br />
  307. For use with a texture's [page:Texture.internalFormat internalFormat] property,
  308. these define how elements of a texture, or *texels*, are stored on the GPU.<br /><br />
  309. [page:constant R8] stores the red component on 8 bits.<br /><br />
  310. [page:constant R8_SNORM] stores the red component on 8 bits. The component is stored as normalized. <br /><br />
  311. [page:constant R8I] stores the red component on 8 bits. The component is stored as an integer. <br /><br />
  312. [page:constant R8UI] stores the red component on 8 bits. The component is stored as an unsigned integer. <br /><br />
  313. [page:constant R16I] stores the red component on 16 bits. The component is stored as an integer. <br /><br />
  314. [page:constant R16UI] stores the red component on 16 bits. The component is stored as an unsigned integer. <br /><br />
  315. [page:constant R16F] stores the red component on 16 bits. The component is stored as floating point. <br /><br />
  316. [page:constant R32I] stores the red component on 32 bits. The component is stored as an integer. <br /><br />
  317. [page:constant R32UI] stores the red component on 32 bits. The component is stored as an unsigned integer. <br /><br />
  318. [page:constant R32F] stores the red component on 32 bits. The component is stored as floating point. <br /><br />
  319. [page:constant RG8] stores the red and green components on 8 bits each.<br /><br />
  320. [page:constant RG8_SNORM] stores the red and green components on 8 bits each.
  321. Every component is stored as normalized.
  322. <br /><br />
  323. [page:constant RG8I] stores the red and green components on 8 bits each.
  324. Every component is stored as an integer.
  325. <br /><br />
  326. [page:constant RG8UI] stores the red and green components on 8 bits each.
  327. Every component is stored as an unsigned integer.
  328. <br /><br />
  329. [page:constant RG16I] stores the red and green components on 16 bits each.
  330. Every component is stored as an integer.
  331. <br /><br />
  332. [page:constant RG16UI] stores the red and green components on 16 bits each.
  333. Every component is stored as an unsigned integer.
  334. <br /><br />
  335. [page:constant RG16F] stores the red and green components on 16 bits each.
  336. Every component is stored as floating point.
  337. <br /><br />
  338. [page:constant RG32I] stores the red and green components on 32 bits each.
  339. Every component is stored as an integer.
  340. <br /><br />
  341. [page:constant RG32UI] stores the red and green components on 32 bits.
  342. Every component is stored as an unsigned integer.
  343. <br /><br />
  344. [page:constant RG32F] stores the red and green components on 32 bits.
  345. Every component is stored as floating point.
  346. <br /><br />
  347. [page:constant RGB8] stores the red, green, and blue components on 8 bits each.
  348. [page:constant RGB8_SNORM] stores the red, green, and blue components on 8 bits each.
  349. Every component is stored as normalized.
  350. <br /><br />
  351. [page:constant RGB8I] stores the red, green, and blue components on 8 bits each.
  352. Every component is stored as an integer.
  353. <br /><br />
  354. [page:constant RGB8UI] stores the red, green, and blue components on 8 bits each.
  355. Every component is stored as an unsigned integer.
  356. <br /><br />
  357. [page:constant RGB16I] stores the red, green, and blue components on 16 bits each.
  358. Every component is stored as an integer.
  359. <br /><br />
  360. [page:constant RGB16UI] stores the red, green, and blue components on 16 bits each.
  361. Every component is stored as an unsigned integer.
  362. <br /><br />
  363. [page:constant RGB16F] stores the red, green, and blue components on 16 bits each.
  364. Every component is stored as floating point
  365. <br /><br />
  366. [page:constant RGB32I] stores the red, green, and blue components on 32 bits each.
  367. Every component is stored as an integer.
  368. <br /><br />
  369. [page:constant RGB32UI] stores the red, green, and blue components on 32 bits each.
  370. Every component is stored as an unsigned integer.
  371. <br /><br />
  372. [page:constant RGB32F] stores the red, green, and blue components on 32 bits each.
  373. Every component is stored as floating point
  374. <br /><br />
  375. [page:constant R11F_G11F_B10F] stores the red, green, and blue components respectively on 11 bits, 11 bits, and 10bits.
  376. Every component is stored as floating point.
  377. <br /><br />
  378. [page:constant RGB565] stores the red, green, and blue components respectively on 5 bits, 6 bits, and 5 bits.<br /><br />
  379. [page:constant RGB9_E5] stores the red, green, and blue components on 9 bits each.<br /><br />
  380. [page:constant RGBA8] stores the red, green, blue, and alpha components on 8 bits each.<br /><br />
  381. [page:constant RGBA8_SNORM] stores the red, green, blue, and alpha components on 8 bits.
  382. Every component is stored as normalized.
  383. <br /><br />
  384. [page:constant RGBA8I] stores the red, green, blue, and alpha components on 8 bits each.
  385. Every component is stored as an integer.
  386. <br /><br />
  387. [page:constant RGBA8UI] stores the red, green, blue, and alpha components on 8 bits.
  388. Every component is stored as an unsigned integer.
  389. <br /><br />
  390. [page:constant RGBA16I] stores the red, green, blue, and alpha components on 16 bits.
  391. Every component is stored as an integer.
  392. <br /><br />
  393. [page:constant RGBA16UI] stores the red, green, blue, and alpha components on 16 bits.
  394. Every component is stored as an unsigned integer.
  395. <br /><br />
  396. [page:constant RGBA16F] stores the red, green, blue, and alpha components on 16 bits.
  397. Every component is stored as floating point.
  398. <br /><br />
  399. [page:constant RGBA32I] stores the red, green, blue, and alpha components on 32 bits.
  400. Every component is stored as an integer.
  401. <br /><br />
  402. [page:constant RGBA32UI] stores the red, green, blue, and alpha components on 32 bits.
  403. Every component is stored as an unsigned integer.
  404. <br /><br />
  405. [page:constant RGBA32F] stores the red, green, blue, and alpha components on 32 bits.
  406. Every component is stored as floating point.
  407. <br /><br />
  408. [page:constant RGB5_A1] stores the red, green, blue, and alpha components respectively on 5 bits, 5 bits, 5 bits, and 1 bit.<br /><br />
  409. [page:constant RGB10_A2] stores the red, green, blue, and alpha components respectively on 10 bits, 10 bits, 10 bits and 2 bits.<br /><br />
  410. [page:constant RGB10_A2UI] stores the red, green, blue, and alpha components respectively on 10 bits, 10 bits, 10 bits and 2 bits.
  411. Every component is stored as an unsigned integer.
  412. <br /><br />
  413. [page:constant SRGB8] stores the red, green, and blue components on 8 bits each.<br /><br />
  414. [page:constant SRGB8_ALPHA8] stores the red, green, blue, and alpha components on 8 bits each.<br /><br />
  415. [page:constant DEPTH_COMPONENT16] stores the depth component on 16bits.<br /><br />
  416. [page:constant DEPTH_COMPONENT24] stores the depth component on 24bits.<br /><br />
  417. [page:constant DEPTH_COMPONENT32F] stores the depth component on 32bits. The component is stored as floating point.<br /><br />
  418. [page:constant DEPTH24_STENCIL8] stores the depth, and stencil components respectively on 24 bits and 8 bits.
  419. The stencil component is stored as an unsigned integer.
  420. <br /><br />
  421. [page:constant DEPTH32F_STENCIL8] stores the depth, and stencil components respectively on 32 bits and 8 bits.
  422. The depth component is stored as floating point, and the stencil component as an unsigned integer.
  423. <br /><br />
  424. Note that the texture must have the correct [page:Texture.type type] set,
  425. as well as the correct [page:Texture.format format].
  426. See [link:https://developer.mozilla.org/en/docs/Web/API/WebGLRenderingContext/texImage2D WebGLRenderingContext.texImage2D], and
  427. [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext/texImage3D WebGL2RenderingContext.texImage3D],
  428. for more details regarding the possible combination of [page:Texture.format format], [page:Texture.internalFormat internalFormat],
  429. and [page:Texture.type type].<br /><br />
  430. For more in-depth information regarding internal formats, you can also refer directly
  431. to the [link:https://www.khronos.org/registry/webgl/specs/latest/2.0/ WebGL2 Specification] and
  432. to the [link:https://www.khronos.org/registry/OpenGL/specs/es/3.0/es_spec_3.0.pdf OpenGL ES 3.0 Specification].
  433. </p>
  434. <h2>编码</h2>
  435. <code>
  436. THREE.LinearEncoding
  437. THREE.sRGBEncoding
  438. THREE.GammaEncoding
  439. THREE.RGBEEncoding
  440. THREE.LogLuvEncoding
  441. THREE.RGBM7Encoding
  442. THREE.RGBM16Encoding
  443. THREE.RGBDEncoding
  444. THREE.BasicDepthPacking
  445. THREE.RGBADepthPacking
  446. </code>
  447. <p>
  448. 这些常量用于纹理的[page:Texture.encoding encoding]属性。<br /><br />
  449. 如果编码类型在纹理已被一个材质使用之后发生了改变,
  450. 你需要来设置[page:Material.needsUpdate Material.needsUpdate]为*true*来使得材质重新编译。<br /><br />
  451. [page:constant LinearEncoding]是默认值。
  452. 除此之外的其他值仅在材质的贴图、envMap和emissiveMap中有效。
  453. </p>
  454. <h2>源代码</h2>
  455. <p>
  456. [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
  457. </p>
  458. </body>
  459. </html>