GetAttributeList Callback Reference

        RTSHADER_API XSI_RTS_Attribute* (*RTS_Shader3_GetAttributeList)
        {
            IRTSExecutionState  *in_pExecState,
            void                *in_pParams,
            void                **io_pShaderInstanceData
        }

Enables a shader to tell Softimage which attribute it needs in order to perform rendering. The attributes are returned as an array of _XSI_RTS_Attribute elements.

The _XSI_RTS_Attribute structure works together with a set of helper functions to enable shaders to request any type of data on the mesh or point cloud to be used in rendering. Each attribute is defined by an _XSI_RTS_Attribute structure which holds the name of the attribute and optionally an enum indicating which hardware register will hold the data (only needed when using the rendering functions exposed by the IRTSExecutionState). Each shader must export the GetAttributeList callback which notifies Softimage of which attributes the shader needs.

Parameters:

  in_pExecState | The execution state interface
  in_pParams | The shader property page parameters

Return values:

  io_pShaderInstanceData | Pointer to the shader's instance user data

Returns:
  Array of _XSI_RTS_Attribute structures.

Example:
  In this example, the Realtime Shader responds to the GetAttributeList call by first checking the value of a parameter on its property page. If the value of `useColor` is true, it tells Softimage that it needs the position, normal, 2 vertex colors and an attribute called `Foobar` to do its rendering. If it's false, it doesn't ask for vertex colors.

          XSI_RTS_Attribute __gAttributesWithColor [] =
          {
              XSI_RTS_ATTRIBUTE_POSITION, ePOSITION,
              XSI_RTS_ATTRIBUTE_NORMAL,   eNORMAL,
              XSI_RTS_ATTRIBUTE_COLOR,    eCOLOR0,
              XSI_RTS_ATTRIBUTE_COLOR,    eCOLOR1,
              "Foobar",                   eTEXCOORD0
          };

          XSI_RTS_Attribute __gAttributesWithoutColor [] =
          {
              XSI_RTS_ATTRIBUTE_POSITION, ePOSITION,
              XSI_RTS_ATTRIBUTE_NORMAL,   eNORMAL,
              "Foobar",                   eTEXCOORD0
          };

          struct ShaderPPG
          {
              bool useColor;
          };

          RTSHADER_API XSI_RTS_Attribute* MyShader_GetAttributeList
          (
              IRTSExecutionState  *in_pExecState,
              void                *in_pParams,
              void                **io_pInstanceData
          )
          {
              ShaderPPG* options = (ShaderPPG*)in_pParams;

              if (options->useColor)
              {
                  return __gAttributesWithColor;
              } else {
                  return __gAttributesWithoutColor;
              }
          }

See also:
  IRTSExecutionState, Realtime Shader Callbacks, cus_rtshad_GeometryData Geometry Data , cus_rtshad_ExecutionFlow Execution Flow

Since:
  7.0