source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/docs/api/textures/Texture.html@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 6.7 KB
Line 
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <script src="../../list.js"></script>
6 <script src="../../page.js"></script>
7 <link type="text/css" rel="stylesheet" href="../../page.css" />
8 </head>
9 <body>
10 <h1>[name]</h1>
11
12 <div class="desc">Create a texture to apply to a surface or as a reflection or refraction map.</div>
13
14
15 <h2>Constructor</h2>
16
17 <h3>[name]( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy )</h3>
18
19 <h2>Example</h2>
20
21 <code>
22 // load a texture, set wrap mode to repeat
23 var texture = THREE.ImageUtils.loadTexture( "textures/water.jpg" );
24 texture.wrapS = THREE.RepeatWrapping;
25 texture.wrapT = THREE.RepeatWrapping;
26 texture.repeat.set( 4, 4 );
27 </code>
28
29 <h2>Properties</h2>
30
31 <h3>.[page:Image image]</h3>
32 <div>
33 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.
34 </div>
35
36 <h3>.[page:object mapping]</h3>
37 <div>
38 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; THREE.SphericalReflectionMapping, a spherical reflection map projection; and THREE.SphericalRefractionMapping.
39 </div>
40
41 <h3>.[page:number wrapS]</h3>
42 <div>
43 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.
44 </div>
45
46 <h3>.[page:number wrapT]</h3>
47 <div>
48 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.
49 </div>
50
51 <h3>.[page:number magFilter]</h3>
52 <div>
53 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.
54 </div>
55
56 <h3>.[page:number minFilter]</h3>
57 <div>
58 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.
59 </div>
60
61 <h3>.[page:number format]</h3>
62 <div>
63 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.
64 </div>
65
66 <h3>.[page:number type]</h3>
67 <div>
68 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.
69 </div>
70
71 <h3>.[page:number anisotropy]</h3>
72 <div>
73 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.
74 </div>
75
76 <h3>.[page:boolean needsUpdate]</h3>
77 <div>
78 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.
79 </div>
80
81 <h3>.[page:Vector2 repeat]</h3>
82 <div>
83 How many times the texture is repeated across the surface, in each direction U and V.
84 </div>
85
86 <h3>.[page:Vector2 offset]</h3>
87 <div>
88 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.
89 </div>
90
91 <h3>.[page:string name]</h3>
92 <div>
93 Given name of the texture, empty string by default.
94 </div>
95
96 <h3>.[page:boolean generateMipmaps]</h3>
97 <div>
98 Whether to generate mipmaps (if possible) for a texture. True by default.
99 </div>
100
101 <h3>.[page:boolean flipY]</h3>
102 <div>
103 False by default, set this to true if the texture needs to be flipped vertically.
104 </div>
105
106 <h3>.[page:array mipmaps]</h3>
107 <div>
108 Array of mipmaps generated.
109 </div>
110
111 <h3>.[page:number unpackAlignment]</h3>
112 <div>
113 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 <a href="http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml">glPixelStorei</a> for more information.
114 </div>
115
116 <h3>.[page:boolean premultiplyAlpha]</h3>
117 <div>
118 False by default, which is the norm for PNG images. Set to true if the RGB values have been stored premultiplied by alpha.
119 </div>
120
121 <h3>.[page:object onUpdate]</h3>
122 <div>
123 A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true and then the texture is used).
124 </div>
125
126 <h3>.[page:number id]</h3>
127 <div>
128 An internal ID number, starting from 0; should not be modified. THREE.TextureIdCount is the number of textures created so far.
129 </div>
130
131 <h2>Methods</h2>
132
133 <h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
134
135 <h3>.clone([page:todo texture]) [page:todo]</h3>
136 <div>
137 Make copy of texture. Note this is not a "deep copy", the image is shared.
138 </div>
139 <div>
140 todo
141 </div>
142
143 <h3>.dispose() [page:todo]</h3>
144 <div>
145 Call [page:EventDispatcher EventDispatcher].dispatchEvent with a 'dispose' event type.
146 </div>
147
148 <h2>Source</h2>
149
150 [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
151 </body>
152</html>
Note: See TracBrowser for help on using the repository browser.