From a1efe46add40afcf3214de94bad9b2812071b4d9 Mon Sep 17 00:00:00 2001 From: looeee Date: Fri, 4 Nov 2016 13:36:15 +0000 Subject: [PATCH 1/2] Improved documentation for docs / Texture --- docs/api/textures/Texture.html | 146 +++++++++++++++++++++++++-------- 1 file changed, 110 insertions(+), 36 deletions(-) diff --git a/docs/api/textures/Texture.html b/docs/api/textures/Texture.html index 7fbea329e19cfe..e1408730975a0a 100644 --- a/docs/api/textures/Texture.html +++ b/docs/api/textures/Texture.html @@ -31,61 +31,111 @@

Properties

[property:Integer id]

- Unique number for this texture instance. + Readonly - unique number for this texture instance. +
+ +

[property:String uuid]

+
+ [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance. + This gets automatically assigned, so this shouldn't be edited. +
+ +

[property:String name]

+
+ Optional name of the object (doesn't need to be unique). Default is an empty string.

[property:Image image]

- An Image object, typically created using the ImageUtils or [page:ImageLoader ImageLoader] classes. The Image object can include an image (e.g., PNG, JPG, GIF, DDS), video (e.g., MP4, OGG/OGV), or set of six images for a cube map. To use video as a texture you need to have a playing HTML5 video element as a source for your texture image and continuously update this texture as long as video is playing. + An image object, typically created using the [page:TextureLoader.load] method. + This can be any image (e.g., PNG, JPG, GIF, DDS) or video (e.g., MP4, OGG/OGV) type supported by Three.

+ + To use video as a texture you need to have a playing HTML5 + video element as a source for your texture image and continuously update this texture + as long as video is playing - the [page:VideoTexture VideoTexture] class handles this automatically. +
+ +

[property:string sourceFile]

+
+ This property is currently unused. +
+ +

[property:array mipmaps]

+
+ Array of user-specified mipmaps (optional).

[property:object mapping]

- How the image is applied to the object. An object type of THREE.UVMapping is the default, where the U,V coordinates are used to apply the map, and a single texture is expected. The other types are THREE.CubeReflectionMapping, for cube maps used as a reflection map; THREE.CubeRefractionMapping, refraction mapping; and THREE.SphericalReflectionMapping, a spherical reflection map projection. + How the image is applied to the object. An object type of [page:Textures THREE.UVMapping] is the default, + where the U,V coordinates are used to apply the map.
+ + See the [page:Textures texture constants] page for other mapping types.

[property:number wrapS]

- The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping. + This defines how the texture is wrapped horizontally and corresponds to *U* in UV mapping.
+ The default is [page:Textures THREE.ClampToEdgeWrapping], where the edge is clamped to the outer edge texels. + The other two choices are [page:Textures THREE.RepeatWrapping] and [page:Textures THREE.MirroredRepeatWrapping]. + See the [page:Textures texture constants] page for details.

[property:number wrapT]

- The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping. -
+ This defines how the texture is wrapped vertically and corresponds to *V* in UV mapping.
+ The same choices are available as for [property:number wrapS].

-
- NOTE: tiling of images in textures only functions if image dimensions are powers of two (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels. Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL, not Three.js. + NOTE: tiling of images in textures only functions if image dimensions are powers of two + (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels. + Individual dimensions need not be equal, but each must be a power of two. + This is a limitation of WebGL, not Three.js.

[property:number magFilter]

- How the texture is sampled when a texel covers more than one pixel. The default is THREE.LinearFilter, which takes the four closest texels and bilinearly interpolates among them. The other option is THREE.NearestFilter, which uses the value of the closest texel. + How the texture is sampled when a texel covers more than one pixel. The default is + [page:Textures THREE.LinearFilter], which takes the four closest texels and bilinearly interpolates among them. + The other option is [page:Textures THREE.NearestFilter], which uses the value of the closest texel.
+ See the [page:Textures texture constants] page for details.

[property:number minFilter]

- How the texture is sampled when a texel covers less than one pixel. The default is THREE.LinearMipMapLinearFilter, which uses mipmapping and a trilinear filter. Other choices are THREE.NearestFilter, THREE.NearestMipMapNearestFilter, THREE.NearestMipMapLinearFilter, THREE.LinearFilter, and THREE.LinearMipMapNearestFilter. These vary whether the nearest texel or nearest four texels are retrieved on the nearest mipmap or nearest two mipmaps. Interpolation occurs among the samples retrieved. + How the texture is sampled when a texel covers less than one pixel. The default is + [page:Textures THREE.LinearMipMapLinearFilter], which uses mipmapping and a trilinear filter.

+ + See the [page:Textures texture constants] page for all possible choices.
-

[property:number format]

+

[property:number anisotropy]

- The default is THREE.RGBAFormat for the texture. Other formats are: THREE.AlphaFormat, THREE.RGBFormat, THREE.LuminanceFormat, and THREE.LuminanceAlphaFormat. There are also compressed texture formats, if the S3TC extension is supported: THREE.RGB_S3TC_DXT1_Format, THREE.RGBA_S3TC_DXT1_Format, THREE.RGBA_S3TC_DXT3_Format, and THREE.RGBA_S3TC_DXT5_Format. + 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 the cost of more texture samples being used. Use [page:WebGLRenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() to + find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.
-

[property:number type]

+

[property:number format]

- The default is THREE.UnsignedByteType. Other valid types (as WebGL allows) are THREE.ByteType, THREE.ShortType, THREE.UnsignedShortType, THREE.IntType, THREE.UnsignedIntType, THREE.FloatType, THREE.UnsignedShort4444Type, THREE.UnsignedShort5551Type, and THREE.UnsignedShort565Type. + The default is [page:Textures THREE.RGBAFormat], although the [page:TextureLoader TextureLoader] will automatically + et this to [page:Textures THREE.RGBFormat] for JPG images.

+ + See the [page:Textures texture constants] page for details of other formats.
-

[property:number anisotropy]

+

[property:number type]

- 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 the cost of more texture samples being used. Use renderer.getMaxAnisotropy() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2. + This must correspond to the [page:Texture.format .format]. The default is [page:Textures THREE.UnsignedByteType], + which will be used for most texture formats.

+ + See the [page:Textures texture constants] page for details of other formats.
-

[property:boolean needsUpdate]

+

[property:Vector2 offset]

- If a texture is changed after creation, set this flag to true so that the texture is properly set up. Particularly important for setting the wrap mode. + 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*.

[property:Vector2 repeat]

@@ -93,19 +143,22 @@

[property:Vector2 repeat]

How many times the texture is repeated across the surface, in each direction U and V. -

[property:Vector2 offset]

+

[property:boolean needsUpdate]

- 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. + If a texture is changed after creation, set this flag to true so that the texture is properly set up. + Particularly important for setting the wrap mode.
-

[property:string name]

+

[property:boolean generateMipmaps]

- Given name of the texture, empty string by default. + Whether to generate mipmaps (if possible) for a texture. True by default. Set this to false if you are + creating mipmaps manually.
-

[property:boolean generateMipmaps]

+

[property:boolean premultiplyAlpha]

- Whether to generate mipmaps (if possible) for a texture. True by default. + False by default, which is the norm for PNG images. Set to true if the RGB values have + been stored premultiplied by alpha.

[property:boolean flipY]

@@ -113,29 +166,38 @@

[property:boolean flipY]

True by default. Flips the image's Y axis to match the WebGL texture coordinate space. -

[property:array mipmaps]

+

[property:number unpackAlignment]

- Array of user-specified mipmaps (optional). + 4 by default. 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 (rows start on double-word boundaries). + See glPixelStorei + for more information.
-

[property:number unpackAlignment]

+

[property:number encoding]

- 4 by default. 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 (rows start on double-word boundaries). See glPixelStorei for more information. + [page:Textures THREE.LinearEncoding] is the default. + See the [page:Textures texture constants] page for details of other formats.

+ + Note that ff this value is changed on a texture after the material has been used, + it is necessary to trigger a Material.needsUpdate for this value to be realized in the shader.
-

[property:boolean premultiplyAlpha]

+

[property:Integer version]

- False by default, which is the norm for PNG images. Set to true if the RGB values have been stored premultiplied by alpha. + This starts at *0* and counts how many times [property:Boolean needsUpdate] is set to *true*.
-

[property:number encoding]

+

[property:Function onUpdate]

- Set to THREE.LinearEncoding by default, but supports sRGB, RGBE, RGBM, RGBD, LogLuv and Gamma corrected encodings. IMPORTANT: If this value is changed on a texture after the material has been used, it is necessary to trigger a Material.needsUpdate for this value to be realized in the shader. + A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true + and then the texture is used).
-

[property:object onUpdate]

+

[property:Boolean needsUpdate]

- A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true and then the texture is used). + Set this to *true* to trigger an update next time the texture is used.
@@ -143,9 +205,15 @@

Methods

[page:EventDispatcher EventDispatcher] methods are available on this class.

-

[method:Material clone]( [page:Texture texture] )

+

[method:Texture clone]( [page:Texture texture] )

- Make copy of texture. Note this is not a "deep copy", the image is shared. + Make copy of the texture. Note this is not a "deep copy", the image is shared. +
+ +

[method:Texture toJSON]( meta )

+
+ meta -- optional object containing metadata.
+ Convert the material to Three JSON format.

[method:null dispose]()

@@ -153,6 +221,12 @@

[method:null dispose]()

Call [page:EventDispatcher EventDispatcher].dispatchEvent with a 'dispose' event type. +

[method:null transformUv]( uv )

+
+ Transform the uv based on the value of this texture's [page:Texture.repeat .repeat], [page:Texture.offset .offset], + [page:Texture.wrapS .wrapS], [page:Texture.wrapT .wrapT] and [page:Texture.flipY .flipY] properties. +
+

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] From 9210f7ba0305edcbe7156eb522444cb1bafaae41 Mon Sep 17 00:00:00 2001 From: looeee Date: Fri, 4 Nov 2016 13:41:02 +0000 Subject: [PATCH 2/2] Removed duplicate needsUpate --- docs/api/textures/Texture.html | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/docs/api/textures/Texture.html b/docs/api/textures/Texture.html index e1408730975a0a..fc3d5858d7ab5f 100644 --- a/docs/api/textures/Texture.html +++ b/docs/api/textures/Texture.html @@ -143,12 +143,6 @@

[property:Vector2 repeat]

How many times the texture is repeated across the surface, in each direction U and V. -

[property:boolean needsUpdate]

-
- If a texture is changed after creation, set this flag to true so that the texture is properly set up. - Particularly important for setting the wrap mode. -
-

[property:boolean generateMipmaps]

Whether to generate mipmaps (if possible) for a texture. True by default. Set this to false if you are @@ -197,7 +191,7 @@

[property:Function onUpdate]

[property:Boolean needsUpdate]

- Set this to *true* to trigger an update next time the texture is used. + Set this to *true* to trigger an update next time the texture is used. Particularly important for setting the wrap mode.