codecamp

three.js CubeTexture

创建一个由6张图片所组成的纹理对象。

代码示例

const loader = new THREE.CubeTextureLoader();
loader.setPath( 'textures/cube/pisa/' );

const textureCube = loader.load( [
	'px.png', 'nx.png',
	'py.png', 'ny.png',
	'pz.png', 'nz.png'
] );

const material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube } );

构造函数

CubeTexture( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy )

CubeTexture(立方贴图)的功能以及用法几乎和Texture是相同的。区别在于,CubeTexture中的图像是6个单独的图像所组成的数组, 纹理映射选项为THREE.CubeReflectionMapping(默认值)或THREE.CubeRefractionMapping。

属性

请参阅基本 Texture 类以了解通用属性。

.flipY : Boolean

如果设置为 true,纹理在上传到 GPU 时沿垂直轴翻转。默认为假。

.isCubeTexture : Boolean

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

方法

有关常用方法,请参见基 Texture 类。

源代码

src/textures/CubeTexture.js


three.js CompressedArrayTexture
three.js DataArrayTexture
温馨提示
下载编程狮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; }