TYPE: SOP
TITLE: Layer SOP

The Layer operation is designed to allow you to seamlessly work with
multiple layers of attributes.  This allows you to work with multiple
texture coordinate systems, or even multiple coloration layers.  If
the display option for Multi-pass Texturing is turned on (as it is by
default) all of the layers will be drawn on top of one another from
the bottom (layer 1) to the top.

Each of the default attributes (ie, "Cd", "uv", etc) gets renamed according 
to the current layer.  For layer 1 they have their base names.  For
every other layer, the current layer number is appended.  Thus, on
layer 5 the colour of the object is determined by "Cd5", not by "Cd"
as it usually is.  All operations will respect these new names when reading
or creating attributes.  The Point operation, for example, will use the
"Cd5" to determine what $CR is instead of "Cd".

In any operation with local variables, the current layer is $CURLAYER, the
number of layers is $MAXLAYER.

Parameters:
    Current Layer    - The current working layer.  All further operations in
                       this network will affect the specified layer.
                       If multipass texturing is off or the maximum layer
		       parameter is set to 1, the current layer is
                       displayed in the viewport.                     /layer
    Maximum Layers   - The maximum number of layers which will be
                       displayed for this operation for multipass 
                       texturing. Specifically, all layers from layer 1 to
		       $MAXLAYER will be drawn on top of one another unless
		       $MAXLAYER is 1 in which case only the current layer
		       is drawn. /maxlayer
    Override Merge Mode - If set, the default merge mode (on top) will
                       be replaced by a custom defined one for this layer.
    Source Blend     - The multiplier factor for the source pixels.
                       Check your OpenGL reference manual for details.
    Destination Blend - The same, but for destination pixels.
    Channel Mask     - Which channels should be written to by this
                       layer.
    Custom Mask      - Allows any of the 16 possible masks.  It's a
                       bitfield with 1 being red, 2 green, 4 blue, and
                       8 alpha.  Add up the numbers of channels you
                       want to write to to get the magic number. /custommask
    Pre-clear Window - If set, the window is cleared (using your mask)
                       before any drawing is done.  This is usually
                       used to set up an alpha plane for stenciling.
