Capítulo 232 de 859
Base class for all textures.
Note: After the initial use of a texture, its dimensions, format, and type cannot be changed. Instead, call Texture#dispose on the texture and instantiate a new one.
1. A highe…(0.5, 0.5) corresponds to the center of the texture. Default is (0, 0), the lower le…0 for uv, 1 for uv1, 2 for uv2 and 3 for uv3.SRGBColorSpace or LinearSRGBColorSpace.true, the texture is flipped along the vertical axis when uploaded to the GPU.Constructor
| Signature |
|---|
new Texture( image : Object, mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, format : number, type : number, anisotropy : number, colorSpace : string ) |
Properties
| Property | Description |
|---|---|
.anisotropy : number | The number of samples taken along the axis through the pixel that has the highest density of texels. By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at t… |
.center : Vector2 | The point around which rotation occurs. A value of (0.5, 0.5) corresponds to the center of the texture. Default is (0, 0), the lower left. |
.channel : number | Lets you select the uv attribute to map the texture to. 0 for uv, 1 for uv1, 2 for uv2 and 3 for uv3. |
.colorSpace : string | Textures containing color data should be annotated with SRGBColorSpace or LinearSRGBColorSpace. |
.depth | The depth of the texture in pixels. |
.flipY : boolean | If set to true, the texture is flipped along the vertical axis when uploaded to the GPU. |
.format : number | The format of the texture. |
.generateMipmaps : boolean | Whether to generate mipmaps (if possible) for a texture. |
.height | The height of the texture in pixels. |
.id : number (readonly) | The ID of the texture. |
.image : Object | The image object holding the texture data. |
.internalFormat : string | The default internal format is derived from Texture#format and Texture#type and defines how the texture data is going to be stored on the GPU. |
.isArrayTexture : boolean (readonly) | Indicates if a texture should be handled like a texture array. |
.isRenderTargetTexture : boolean (readonly) | Indicates whether a texture belongs to a render target or not. |
.isTexture : boolean (readonly) | This flag can be used for type testing. |
| `.magFilter : NearestFilter | NearestMipmapNearestFilter |
| `.mapping : UVMapping | CubeReflectionMapping |
.matrix : Matrix3 | The uv-transformation matrix of the texture. |
.matrixAutoUpdate : boolean | Whether to update the texture's uv-transformation Texture#matrix from the properties Texture#offset, Texture#repeat, [Texture#rota… |
| `.minFilter : NearestFilter | NearestMipmapNearestFilter |
.mipmaps : Array.<Object> | An array holding user-defined mipmaps. |
.name : string | The name of the texture. |
.needsPMREMUpdate : boolean | Setting this property to true indicates the engine the PMREM must be regenerated. |
.needsUpdate : boolean | Setting this property to true indicates the engine the texture must be updated in the next render. This triggers a texture upload to the GPU and ensures correct texture parameter configuration. |
.normalized : boolean | Whether the texture should use one of the 16 bit integer formats which are normalized to [0, 1] or [-1, 1] (depending on signed/unsigned) when sampled. |
.offset : Vector2 | How much a single repetition of the texture is offset from the beginning, in each direction U and V. Typical range is 0.0 to 1.0. |
.onUpdate : function | A callback function, called when the texture is updated (e.g., when Texture#needsUpdate has been set to true and then the texture is used). |
.pmremVersion : number (readonly) | Indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures). |
.premultiplyAlpha : boolean | If set to true, the alpha channel, if present, is multiplied into the color channels when the texture is uploaded to the GPU. |
| `.renderTarget : RenderTarget | WebGLRenderTarget` |
.repeat : Vector2 | How many times the texture is repeated across the surface, in each direction U and V. If repeat is set greater than 1 in either direction, the corresponding wrap parameter should also be set to `Re… |
.rotation : number | How much the texture is rotated around the center point, in radians. Positive values are counter-clockwise. |
.source : Source | The data definition of a texture. A reference to the data source can be shared across textures. This is often useful in context of spritesheets where multiple textures render the same data but with d… |
.type : number | The data type of the texture. |
.unpackAlignment : number | Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word-alignment), and 8… |
.updateRanges : Array.<Object> | This can be used to only update a subregion or specific rows of the texture (for example, just the first 3 rows). Use the addUpdateRange() function to add ranges to this array. |
.userData : Object | An object that can be used to store custom data about the texture. It should not hold references to functions as these will not be cloned. |
.uuid : string (readonly) | The UUID of the texture. |
.version : number (readonly) | This starts at 0 and counts how many times Texture#needsUpdate is set to true. |
.width | The width of the texture in pixels. |
| `.wrapS : RepeatWrapping | ClampToEdgeWrapping |
| `.wrapT : RepeatWrapping | ClampToEdgeWrapping |
.DEFAULT_ANISOTROPY : number | The default anisotropy value for all textures. |
.DEFAULT_IMAGE : Image | The default image for all textures. |
.DEFAULT_MAPPING : number | The default mapping for all textures. |
Methods
| Method | Description |
|---|---|
.addUpdateRange( start : number, count : number ) | Adds a range of data in the data texture to be updated on the GPU. |
.clearUpdateRanges() | Clears the update ranges. |
.clone() : Texture | Returns a new texture with copied values from this instance. |
.copy( source : Texture ) : Texture | Copies the values of the given texture to this instance. |
.dispose() | Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app. |
.setValues( values : Object ) | Sets this texture's properties based on values. |
| `.toJSON( meta : Object | string ) : Object` |
.transformUv( uv : Vector2 ) : Vector2 | Transforms the given uv vector with the textures uv transformation matrix. |
.updateMatrix() | Updates the texture transformation matrix from the properties Texture#offset, Texture#repeat, Texture#rotation, and [Texture#cen… |