[page:Texture] →

Canvas纹理([name])

从Canvas元素中创建纹理贴图。

它几乎与其基类[page:Texture Texture]相同,但它直接将[page:Texture.needsUpdate needsUpdate](需要更新)设置为了*true*。

构造函数

[name]( [param:HTMLElement canvas], [param:Constant mapping], [param:Constant wrapS], [param:Constant wrapT], [param:Constant magFilter], [param:Constant minFilter], [param:Constant format], [param:Constant type], [param:Number anisotropy] )

[page:HTMLElement canvas] -- 将会被用于加载纹理贴图的Canvas元素。
[page:Constant mapping] -- 纹理贴图将被如何应用(映射)到物体上,它是[page:Textures THREE.UVMapping]中的对象类型。 请参阅[page:Textures mapping constants](映射模式常量)来了解其他选项。
[page:Constant wrapS] -- 默认值是[page:Textures THREE.ClampToEdgeWrapping]. 请参阅[page:Textures wrap mode constants](包裹模式常量)来了解其他选项。
[page:Constant wrapT] -- 默认值是[page:Textures THREE.ClampToEdgeWrapping]. 请参阅[page:Textures wrap mode constants](包裹模式常量)来了解其他选项。
[page:Constant magFilter] -- 当一个纹素覆盖大于一个像素时,贴图将如何采样。 其默认值为[page:Textures THREE.LinearFilter]。请参阅[page:Textures magnification filter constants](放大滤镜常量)来了解其它选项。
[page:Constant minFilter] -- 当一个纹素覆盖小于一个像素时,贴图将如何采样。 其默认值为[page:Textures THREE.LinearMipmapLinearFilter]。请参阅[page:Textures minification filter constants](缩小滤镜常量)来了解其它选项。
[page:Constant format] -- 在纹理贴图中使用的格式。 请参阅[page:Textures format constants](格式常量)来了解各个选项。
[page:Constant type] -- 默认值是[page:Textures THREE.UnsignedByteType]. 请参阅[page:Textures type constants](类型常量)来了解其他选项。
[page:Number anisotropy] -- 沿着轴,通过具有最高纹素密度的像素的样本数。 默认情况下,这个值为1。设置一个较高的值将会产生比基本的mipmap更清晰的效果,代价是需要使用更多纹理样本。 使用[page:WebGLrenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() 来查询GPU中各向异性的最大有效值;这个值通常是2的幂。

属性

共有方法请参见其基类[page:Texture Texture]。

[property:Boolean isCanvasTexture]

Read-only flag to check if a given object is of type [name].

[property:Boolean needsUpdate]

默认值为true,这是必须的,以便使得Canvas中的数据能够载入。

方法

共有方法请参见其基类[page:Texture Texture]。

源代码

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]