1038
Chapter 14: Properties
Description
3D standard shader property; this property provides access to a transform which modifies the
texture coordinate mapping of a texture layer. Manipulate this transform to tile, rotate, or
translate a texture image before applying it to the surface of models. The texture itself remains
unaffected, the transform merely modifies how the shader applies the texture.
To tile the image twice along its horizontal axis, use
textureTransformList[whichTextureLayer].scale(0.5, 1.0, 1.0)
. Scales in Z will be
ignored since images are 2D in nature. Care must be taken to avoid 0.0 scales (even in Z), as that
will negate the effect of the entire texture.
To offset the image by point(xOffset,yOffset), use
textureTransformList[whichTextureLayer].translate(xOffset,yOffset,0.0)
.
Translating by integers when that texture layer’s textureRepeat property is
TRUE
will have no
effect, because the width and height of the texture will be valued between 0.0 and 1.0 in that case.
To apply a rotation to a texture layer, use
textureTransformList[whichTextureLayer].rotate(0,0,angle)
. Rotations around the Z
axis are rotated around the (0,0) 2D image point, which maps to the upper left corner of the
texture. Rotations about X and Y will be ignored since images are 2D by nature.
Just as with a model’s transform,
textureTransform
modifications are layerable. To rotate the
image about a point(xOffset,yOffset) instead of point(0,0), first translate to point(0 - xOffset,
0 - yOffset), then rotate, then translate to point(xOffset, yOffset).
The
textureTransformList
is similar to the shader
wrapTransformList
property with the
following exceptions.
It is applied in 2D image space rather than 3D world space. As a result, only rotations in Z, and
translations and scales in X and Y, are effective.
The transform is applied regardless of the
shaderReference.textureModeList[index]
setting.
The
wrapTransform
, by comparison, is only effective when the
textureMode
is
#wrapPlanar
,
#wrapCylindrical
, or
#wrapSpherical
.
Example
This statement shows the textureTransform of the third texture in the first shader used by the
model gbCyl3:
put member("scene").model("gbCyl3").shader.textureTransformList[3]
-- transform(1.0000, 0.0000, 0.0000, 0.0000, 0.0000, 1.0000, \
0.0000, 0.0000, 0.0000, 0.0000, 1.0000, 0.0000, 0.0000, 0.0000, \
0.0000, 1.0000)
The following statement halves the height and width of the fifth texture used by the shader
gbCyl3. If the
textureRepeatList[5]
value of gbCyl3 is set to
TRUE
, four copies of the texture
will be tiled across the shader.
member("scene").shader("gbCyl3").textureTransformList[5].scale = \
vector(0.5, 0.5, 1)
This statement rotates the fourth texture used by the shader gbCyl3 by 90° from vector(0, 0, 0):
member("scene").shader("gbCyl3").textureTransformList[4].rotation \
= vector(0, 0, 90)
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...