########################
Creating a RED::LayerSet
########################

.. code:: cpp

    // Building a sample 'layerset' with two layers:
    RED::LayerSet layerset;

    RC_TEST( layerset.AddLayer( RED::Object::GetIDFromString( "layer1" ) ) );
    RC_TEST( layerset.AddLayer( RED::Object::GetIDFromString( "layer2" ) ) );

In the sample code above, a ``RED::LayerSet`` is created on the program stack with two layers added to it 'layer1' and 'layer2'. This layerset object will intersect (``RED::LayerSet::Intersects``) with any other layerset that has received 'layer1' or 'layer2'. It'll also intersect with ``RED::LayerSet::ALL_LAYERS``.

A ``RED::LayerSet`` is used for different tasks:

    * Shape visibility control using ``RED::IShape::ApplyLayerSet``
    * Shader scope definition using ``RED::IMaterial::AddShaderToPass``
    * Lighting control using ``RED::ILightShape::SetLayerSetLit``, ``RED::ILightShape::SetLayerSetShadowCaster``, or ``RED::ILightShape::SetLayerSetShadowReceiver``

Layersets of shapes and materials are compared to the ``RED::LayerSet`` used by the rendered viewpoint and defined by ``RED::IViewpoint::ApplyLayerSet``. 