-
new Texture(params)
-
纹理
Name Type Description params
object optional 初始化参数,所有params都会复制到实例上
Example
var loader = new Hilo3d.BasicLoader(); loader.load({ src: '//img.alicdn.com/tfs/TB1aNxtQpXXXXX1XVXXXXXXXXXX-1024-1024.jpg', crossOrigin: true }).then(img => { return new Hilo3d.Texture({ image: img }); });
Members Show Inherited
-
static,readonlyTexture.cacheObject
-
缓存
Methods Show Inherited
-
staticTexture.reset(gl)
-
重置
Name Type Description gl
WebGLRenderingContext -
isImgPowerOfTwo(img){Boolean}
-
是否是 2 的 n 次方
Name Type Description img
HTMLImageElement Returns:
Type Description Boolean -
getSupportSize(img, needPowerOfTwo){Object}
-
获取支持的尺寸
Name Type Default Description img
HTMLImageElement needPowerOfTwo
Boolean false optional Returns:
Type Description Object { width, height } -
resizeImgToPowerOfTwo(img){HTMLCanvasElement|HTMLImageElement}
-
更新图片大小成为 2 的 n 次方
Name Type Description img
HTMLImageElement Returns:
Type Description HTMLCanvasElement | HTMLImageElement -
resizeImg(img, width, height){HTMLCanvasElement|HTMLImageElement}
-
更新图片大小
Name Type Description img
HTMLImageElement width
Number height
Number Returns:
Type Description HTMLCanvasElement | HTMLImageElement -
_fixInternalFormat(state){number}
-
修复 WebGL & WebGL2 internalFormat
Name Type Description state
WebGLState Returns:
Type Description number internalFormat -
updateTexture(state, glTexture){Texture}
-
更新 Texture
Name Type Description state
WebGLState glTexture
WebGLTexture Returns:
Type Description Texture this -
updateSubTexture(xOffset, yOffset, image)
-
跟新局部贴图
Name Type Description xOffset
Number yOffset
Number image
HTMLImageElement | HTMLCanvasElement | ImageData -
getGLTexture(state){WebGLTexture}
-
获取 GLTexture
Name Type Description state
WebGLState Returns:
Type Description WebGLTexture