Public Member Functions
HardwareShaderContext Class Reference

## Detailed Description

This object is provided as the context object in the execution callback of a hardware shader.

See also:
  PluginRegistrar::RegisterShader

Since:
  9.0 (2011)

`#include <xsi_hardwareshadercontext.h>`

Inheritance diagram for HardwareShaderContext:
[legend]

List of all members.

## Public Member Functions
| HardwareShaderContext ()
| ~HardwareShaderContext ()
| HardwareShaderContext (const CRef &in_ref)
| HardwareShaderContext (const HardwareShaderContext &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
HardwareShaderContext & | operator= (const HardwareShaderContext &in_obj)
HardwareShaderContext & | operator= (const CRef &in_ref)
Shader | GetShader ()
Shader | GetShaderForAnimation ()
Camera | GetCamera ()
Material | GetMaterial ()
X3DObject | GetX3DObject ()
CRefArray | GetLights ()
ULONG | GetShaderUniqueID ()
CTime | GetTime () const
void * | GetTriangleIndices ()
UINT | GetIndexWidth ()
ULONG | GetNbIndices ()
ULONG | GetBaseOffset ()
ULONG | GetNbVertices ()
CHardwareAttributeArray | GetHardwareAttributeArray ()
bool | IsGeometryDirty () const
MATH::CTransformation | GetTransform () const
void | DrawPrimitive (siGraphicDriver in_eDriver) const
void | DrawScreenAlignedQuad (siGraphicDriver in_eDriver) const
HardwareSurface | CreateHardwareSurface (HardwareSurface::Options &in_options)
void | SetRenderTarget (UINT in_nDrawBufferIndex, HardwareSurface &in_surface)
void | SetRenderDepthStencilTarget (HardwareSurface &in_surface)
CRef | GetGraphicDriver () const
CRefArray | GetShadowSurfaces (XSI::CRefArray &out_lights) const
CParameterRefArray | GetDirtyParameters () const

## Constructor & Destructor Documentation

HardwareShaderContext | ( |  | ) |

Default constructor.

~HardwareShaderContext | ( |  | ) |

Default destructor.

HardwareShaderContext | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  in_ref | constant reference object.

HardwareShaderContext | ( | const HardwareShaderContext & | in_obj | ) |

Copy constructor.

Parameters:

  in_obj | constant class object.

## Member Function Documentation

bool IsA | ( | siClassID | in_ClassID | ) | const`[virtual]`

Returns true if a given class type is compatible with this API class.

Parameters:

  in_ClassID | class type.

Returns:
  true if the class is compatible, false otherwise.

Reimplemented from Context.

siClassID GetClassID | ( |  | ) | const`[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from Context.

HardwareShaderContext& operator= | ( | const HardwareShaderContext & | in_obj | ) |

Creates an object from another object.

Parameters:

  in_obj | constant class object.

Returns:
  The new HardwareShaderContext object.

HardwareShaderContext& operator= | ( | const CRef & | in_ref | ) |

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:

  in_ref | constant class object.

Returns:
  The new HardwareShaderContext object.

Reimplemented from Context.

Shader GetShader | ( |  | ) |

Returns the Shader object which is being drawn in the viewport.

Returns:
  The Shader object being drawn in the viewport.

Shader GetShaderForAnimation | ( |  | ) |

Returns the Shader object which is being drawn in the viewport. Use this method if you plan to access parameters with a time different than the current time (causing an evaluation)

Returns:
  The Shader object being drawn in the viewport.

Camera GetCamera | ( |  | ) |

Returns the Camera object which is associated with the viewport currently being refreshed.

Returns:
  The Camera object.

Since:
  9.0 (2011)

Material GetMaterial | ( |  | ) |

Returns the parent Material object.

Returns:
  The Material parent object of the hardware shader.

X3DObject GetX3DObject | ( |  | ) |

Returns the X3DObject associated with the shader.

Returns:
  The X3DObject object. Returns an invalid object if called outside the Execute phase.

CRefArray GetLights | ( |  | ) |

Returns an array of all XSI::Light objects contained in the scene.

Returns:
  CRefArray Array of XSI::Light objects.

ULONG GetShaderUniqueID | ( |  | ) |

Returns a unique identifier for the hardware shader.

Returns:
  Unique identifier.

CTime GetTime | ( |  | ) | const

Returns the time at which the viewport redraw is occurring. The shader should use this to set the evaluation time for the scene data being drawn.

Returns:
  The time at which the current frame is being drawn.

void* GetTriangleIndices | ( |  | ) |

Get the index list making up the triangles for this object. The type is defined by GetIndexWidth.

Returns:
  A list of triangle indices as defined by the XSI_RTS_Primitive::m_pIndices.

UINT GetIndexWidth | ( |  | ) |

The size of each index (4=UINT, 2=USHORT, 1=UBYTE) returned by GetTriangleIndices.

Returns:
  Array of triangle indices.

ULONG GetNbIndices | ( |  | ) |

The total number of indices returned by GetTriangleIndices. Divide the returned value by 3 if you want to get the number of triangles.

Returns:
  Array of indices.

ULONG GetBaseOffset | ( |  | ) |

Get the base offset.

ULONG GetNbVertices | ( |  | ) |

Get the number of unique vertices making up the geometry

Returns:
  Array of vertex indices.

CHardwareAttributeArray GetHardwareAttributeArray | ( |  | ) |

Return the hardware attribute array associated to a given context.

bool IsGeometryDirty | ( |  | ) | const

Returns true if the geometry has changed since the last time the frame was drawn.

Returns:
  Returns true if the geometry has changed, false otherwise.

MATH::CTransformation GetTransform | ( |  | ) | const

Returns the transformation of the object, or the current instance of the object being drawn.

Returns:
  The Transformation object.

void DrawPrimitive | ( | siGraphicDriver | in_eDriver | ) | const

Must be called by the hardware shader for drawing the primitive as triangle elements.

Parameters:

  in_eDriver | The graphic driver to use for drawing.

void DrawScreenAlignedQuad | ( | siGraphicDriver | in_eDriver | ) | const

Must be called by the hardware shader for drawing the primitive as 4 points polygon.

Parameters:

  in_eDriver | The graphic driver to use for drawing.

HardwareSurface CreateHardwareSurface | ( | HardwareSurface::Options & | in_options | ) |

Creates a new hardware surface object.

Parameters:

  in_options | Options for creating the hardware surface.

Returns:
  New hardware surface

void SetRenderTarget | ( | UINT | in_nDrawBufferIndex,
|  | HardwareSurface & | in_surface
| ) |  |

Sets the current render target for the specified draw buffer index.

Parameters:

  in_nDrawBufferIndex | Draw buffer index.
  in_surface | The hardware surface to use as target.

void SetRenderDepthStencilTarget | ( | HardwareSurface & | in_surface | ) |

Sets the current render depth/stencil target

CRef GetGraphicDriver | ( |  | ) | const

Return the current graphic driver .

Returns:
  The current graphic driver

CRefArray GetShadowSurfaces | ( | XSI::CRefArray & | out_lights | ) | const

Returns an array of XSI::HardwareSurface representing the Screen Space Shadow Maps. A Screen Space Shadow map can be used by a realtime shaders by doing a screen space lookup. A single shadow map can store the shadow intensity for up to 4 lights in individual color components. The out_lights parameter returns a list of lights that uses each shadow map color component. For example, if 5 lights cast shadows, the method will return 2 HardwareSurface with 5 lights in out_lights. The red, green, blue and alpha components in the first HardwareSurface map to the shadow intensity of the first 4 lights. The red component of the second HardwareSurface maps to fifth light. The shadow map is in screen space, so a simple texture lookup is enough to retreive the shadow intensity for 4 lights at a time.

Parameters:

  out_lights | Light list ordered by shadow map component.

Returns:
  CRefArray Array of XSI::HardwareSurface objects or an Empty array if no shadow surfaces were computed.

CParameterRefArray GetDirtyParameters | ( |  | ) | const

Returns the parameters from the render tree which values have changed since the last shader evaluation. These parameters are available for the next evaluation only. The shader renderer must be set with the XSI::siHWShaderPropertyUpdateAttribute option to enable this mechanism.

Returns:
  Parameter objects.

See also:
  XSI::siHWShaderPropertyUpdateAttribute

Since:
  10.5 (2012)

The documentation for this class was generated from the following file:

- xsi_hardwareshadercontext.h