-
new CubeTexture(params)
-
立方体纹理
Name Type Description params
object optional 初始化参数,所有params都会复制到实例上
Name Type Description image
Array.<HTMLImageElement> optional 图片列表,共6张
Example
var loadQueue = new Hilo3d.LoadQueue([{ crossOrigin: 'anonymous', src: '//gw.alicdn.com/tfs/TB15OJpQFXXXXXgXVXXXXXXXXXX-512-512.png' }, { crossOrigin: 'anonymous', src: '//gw.alicdn.com/tfs/TB1gwNqQFXXXXcIXFXXXXXXXXXX-512-512.png' }, { crossOrigin: 'anonymous', src: '//gw.alicdn.com/tfs/TB1pyNcQFXXXXb7XVXXXXXXXXXX-512-512.png' }, { crossOrigin: 'anonymous', src: '//gw.alicdn.com/tfs/TB1FilNQFXXXXcKXXXXXXXXXXXX-512-512.png' }, { crossOrigin: 'anonymous', src: '//gw.alicdn.com/tfs/TB1gIpqQFXXXXcZXFXXXXXXXXXX-512-512.png' }, { crossOrigin: 'anonymous', src: '//gw.alicdn.com/tfs/TB1RFXLQFXXXXXEXpXXXXXXXXXX-512-512.png' }]).on('complete', function () { var result = loadQueue.getAllContent(); var skyboxMap = new Hilo3d.CubeTexture({ image: result }); var skybox = new Hilo3d.Mesh({ geometry: new Hilo3d.BoxGeometry(), material: new Hilo3d.BasicMaterial({ lightType: 'NONE', diffuse: skyboxMap }) }); stage.addChild(skybox); });
Extends
Members Show Inherited
Name | Type | Default | Description |
---|---|---|---|
isCubeTexture
|
boolean | true | |
className
|
string | CubeTexture | |
target
|
number | TEXTURE_CUBE_MAP | |
internalFormat
|
number | RGB | |
format
|
number | RGB | |
magFilter
|
number | LINEAR | |
minFilter
|
number | LINEAR | |
wrapS
|
number | CLAMP_TO_EDGE | |
wrapT
|
number | CLAMP_TO_EDGE | |
right
|
HTMLImageElement |
右侧的图片 |
|
left
|
HTMLImageElement |
左侧的图片 |
|
top
|
HTMLImageElement |
顶部的图片 |
|
bottom
|
HTMLImageElement |
底部的图片 |
|
front
|
HTMLImageElement |
朝前的图片 |
|
back
|
HTMLImageElement |
朝后的图片 |
|
isTexture
|
boolean | true | inherited |
isImageCanRelease
|
boolean | false |
inherited
图片资源是否可以释放,可以的话,上传到GPU后将释放图片引用 |
image
|
HTMLImageElement | null |
inherited
图片对象 |
mipmaps
|
Array.<HTMLImageElement> | Array.<TypedArray> | null |
inherited
mipmaps |
type
|
GLenum | gl.UNSIGNED_BYTE |
inherited
类型 |
width
|
number | 0 | inherited |
height
|
number | 0 | inherited |
border
|
Number | 0 | inherited |
name
|
string | inherited | |
premultiplyAlpha
|
boolean | false | inherited |
flipY
|
boolean | false |
inherited
是否翻转Texture的Y轴 |
colorSpaceConversion
|
boolean | true |
inherited
是否转换到图片默认的颜色空间 |
compressed
|
Boolean | false |
inherited
是否压缩 |
needUpdate
|
boolean | true |
inherited
是否需要更新Texture |
needDestroy
|
boolean | false |
inherited
是否需要销毁之前的Texture,Texture参数变更之后需要销毁 |
autoUpdate
|
boolean | false |
inherited
是否每次都更新Texture |
uv
|
Number | 0 |
inherited
uv |
anisotropic
|
Number | 1 |
inherited
anisotropic |
origWidth
|
Number | 0 |
inherited
获取原始图像宽度。 |
origHeight
|
Number | 0 |
inherited
获取原始图像高度。 |
useMipmap
|
Boolean |
inherited
是否使用 mipmap |
|
useRepeat
|
Boolean |
inherited
是否使用 repeat |
|
mipmapCount
|
Number |
inherited
mipmapCount |
Methods Show Inherited
-
inherited isImgPowerOfTwo(img){Boolean}
-
是否是 2 的 n 次方
Name Type Description img
HTMLImageElement Returns:
Type Description Boolean -
inherited getSupportSize(img, needPowerOfTwo){Object}
-
获取支持的尺寸
Name Type Default Description img
HTMLImageElement needPowerOfTwo
Boolean false optional Returns:
Type Description Object { width, height } -
inherited resizeImgToPowerOfTwo(img){HTMLCanvasElement|HTMLImageElement}
-
更新图片大小成为 2 的 n 次方
Name Type Description img
HTMLImageElement Returns:
Type Description HTMLCanvasElement | HTMLImageElement -
inherited resizeImg(img, width, height){HTMLCanvasElement|HTMLImageElement}
-
更新图片大小
Name Type Description img
HTMLImageElement width
Number height
Number Returns:
Type Description HTMLCanvasElement | HTMLImageElement -
inherited _fixInternalFormat(state){number}
-
修复 WebGL & WebGL2 internalFormat
Name Type Description state
WebGLState Returns:
Type Description number internalFormat -
更新 Texture
Name Type Description state
WebGLState glTexture
WebGLTexture Returns:
Type Description Texture this -
inherited updateSubTexture(xOffset, yOffset, image)
-
跟新局部贴图
Name Type Description xOffset
Number yOffset
Number image
HTMLImageElement | HTMLCanvasElement | ImageData -
inherited getGLTexture(state){WebGLTexture}
-
获取 GLTexture
Name Type Description state
WebGLState Returns:
Type Description WebGLTexture -
设置 GLTexture
Name Type Default Description texture
WebGLTexture needDestroy
Boolean false optional 是否销毁之前的 GLTexture
Returns:
Type Description Texture this