A Texture Object
Agent can be generated from the Surface Object Agent (using its getTexture()
method). This Object Agent provides an interface to a texture assigned
to a specific channel in a surface. Textures have their own settings,
including one or more layers that accumulate to represent the visual makeup
of the surface.
Constants
The following
texture constants have been defined in LScript for use with the Texture
Object Agent:
TXTRIMAGE
Image
Texture type
TXTRPROCEDURE
Procedural
Texture type
TXTRGRADIENT
Gradient
Texture type
Data Members
There are no
Data Members currently exported by Texture Object Agents.
Methods
setChannelGroup(Channel
Group Object Agent)
setChannelGroup(Channel Group Object Agent) sets the channel group for
the Texture using the provided Object Agent. Envelopes created for parameters
in the Texture's layers will belong to this group.
getChannelGroup(
)
getChannelGroup() returns the Channel Group Object Agent for the
Texture.
firstLayer(
)
firstLayer() returns the TextureLayer Object Agent for the first
layer defined in the Texture.
nextLayer(TextureLayer
Object Agent)
nextLayer(TextureLayer Object Agent) returns the TextureLayer Object
Agent that follows the specified TextureLayer for the Texture.
addLayer(layer
type)
addLayer(layer type) creates a new layer in the Texture of the specific
type—of TXTRIMAGE, TXTRPROCEDURE or TXTRGRADIENT—and returns the TextureLayer
Object Agent for it.
Example:
This example
demonstrates using the Texture Object Agent by adding a new Texture layer
to an existing channel. You must load the "objects/geography/genearth/earth.lwo"
object from the LightWave content into Layout for this example to work.
@version 2.5
@warnings
@script generic
objName = "Earth";
surfName
= "GlobeSurface";
generic
{
//
Create the Mesh Object Agent.
meshObj
= Mesh(objName);
if(meshObj)
{
//
Create the Surface Object Agent.
surfObj
= Surface(surfName);
if(surfObj)
{
//
Create the Texture Object Agent.
texObj
= surfObj.getTexture(SURFCOLR);
if(texObj)
{
//
Add a new Texture layer.
texObj.addLayer(TXTRIMAGE);
}
else
error("Not
a valid texture layer!");
}
else
error("This
is not the ", surfName, " surface!");
}
else
error("This
is not the ", objName, " object!");
}
|