codecamp

three.js CompressedTexture

基于被压缩的数据,创建一个纹理贴图,例如从一个DDS文件中。

它和CompressedTextureLoader一起使用。

构造函数

CompressedTexture( mipmaps : Array, width : Number, height : Number, format : Constant, type : Constant, mapping : Constant, wrapS : Constant, wrapT : Constant, magFilter : Constant, minFilter : Constant, anisotropy : Number )

mipmaps -- mipmaps数组中需要包含具有数据、宽、高的对象。mipmaps应当具有正确的格式与类型。
width -- 最大的mipmap的宽。
height -- 最大的mipmap的高。
format -- 在mipmaps中使用的格式。 
type -- 默认值是THREE.UnsignedByteType。
mapping -- 纹理贴图将被如何应用(映射)到物体上,它是THREE.UVMapping中的对象类型。 
wrapS -- 默认值是THREE.ClampToEdgeWrapping. 
wrapT -- 默认值是THREE.ClampToEdgeWrapping. 
magFilter -- 当一个纹素覆盖大于一个像素时,贴图将如何采样。 其默认值为THREE.LinearFilter。
minFilter -- 当一个纹素覆盖小于一个像素时,贴图将如何采样。 其默认值为THREE.LinearMipmapLinearFilter。
anisotropy -- 沿着轴,通过具有最高纹素密度的像素的样本数。 默认情况下,这个值为1。设置一个较高的值将会产生比基本的mipmap更清晰的效果,代价是需要使用更多纹理样本。 使用renderer.getMaxAnisotropy() 来查询GPU中各向异性的最大有效值;这个值通常是2的幂。

属性

共有属性请参见其基类Texture。

.flipY : Boolean

默认值为false。翻转纹理在压缩的纹理贴图中无法工作。

.generateMipmaps : Boolean

默认值为false。无法为压缩的纹理贴图生成Mipmap。

.isCompressedTexture : Boolean

只读标志,用于检查给定对象是否属于 CompressedTexture 类型。

方法

共有方法请参见其基类Texture。

源代码

src/textures/CompressedTexture.js


three.js CanvasTexture
three.js CompressedArrayTexture
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

参考

核心 / BufferAttributes

渲染器 / WebXR

开发者参考

WebGL渲染器

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }