Texture Layer Object Agents

 

A TextureLayer Object Agent is generated by the Texture Object Agent, and serves as proxy for the settings for the each layer defined in the Texture.

Constants

The following channel constants have been defined in LScript for use with the TextureLayer Object Agent:

TXLRPOSITION                   Position              (vector)

TXLRROTATION                  Rotation              (vector)

TXLRSIZE                           Size                   (vector)

TXLRFALLOFF                    Falloff                 (vector)

TXLRPROJECT                   Projection           (constant)

TXLRAXIS                           Texture      Axis  (integer)

TXLRWWRAP                     Width Wrap        (number)

TXLRHWRAP                      Height Wrap       (number)

TXLRCOORD                       Coordinate System (integer:
                                         1==object, 2==world)

TXLRIMAGE                        Image                 
                                         (Image Object Agent)

TXLRVMAP                         VMap                 
                                         (VMap Object Agent)

TXLREFOBJ                        Reference Object    
                                         (Layout Object Agent)

TXLROPACITY                    Opacity              (number)

TXLRANTIALIAS                  Antialias             (Boolean)

TXLRAAVALUE                   Antialias Threshold     (number)

TXLRPIXBLEND                   Pixel Blending     (Boolean)

TXLRWREPEAT                  Width Repeat      (constant)

TXLRHREPEAT                   Height Repeat     (constant)

The defined constants for a texture's TXLRPROJECT setting are:

TXPJPLANAR

TXPJCYLINDRICAL

TXPJSPHERICAL

TXPJCUBIC

TXPJFRONT

TXPJUVMAP

The defined constants for a texture's TXLRWREPEAT and TXLRHREPEAT settings are:

TXRPRESET

TXRPREPEAT

TXRPMIRROR

TXRPEDGE

Data Members

The following data members are exported by the TextureLayer Object Agent:

type
type is the type of the layer (TXTRIMAGE, TXTRPROCEDURE or TXTRGRADIENT).

Methods

The following methods are available:

getValue(channel)
getValue(channel) retrieves the value of the specified channel in the layer.

setValue(channel, value)
setValue(channel, value) sets the specified layer channel to the provided value.

Example:

This example demonstrates using the TextureLayer Object Agents by displaying the filename of an image used in a texture. You must load the "objects/geography/genearth/earth.lwo" object into Layout for this example to work properly.

@version 2.5
@warnings
@script generic

objName = "Earth";
urfName = "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)
              {
                    // Create the TextureLayer Object Agent.
                    texLayerObj = texObj.firstLayer();
                    if(texLayerObj.type == TXTRIMAGE)
                    {
                           imageObj = texLayerObj.getValue(TXLRIMAGE);
                           info(imageObj.filename(1));
                     }
                     else
                           error("Not a valid image layer!");
                 }
                 else
                        error("Not a valid texture layer!");
         }
         else
                error("This is not the ", surfName, " surface!");
    }
    else
          error("This is not the ", objName, " object!");
}