This reference page is linked to from the following overview topics: Implementing Advanced Material and Texture Map Plug-ins with Nitrous, Nitrous Graphics SDK Extensions, Low-level Device API.
#include <HLSLMaterialHandle.h>
HLSLMaterialHandle is a material class to support HLSL custom material.
This class is used for viewport display and Quicksilver. It's used by RenderItemHandle::SetCustomMaterial() to describe HLSL custom material. It can also be used for realistic material display. see IHLSLMaterialTranslator for more details. How to use:
HLSLMaterialHandle hMaterial; hMaterial.Initialize(shaderFileName); hMaterial.SetFloatParameter(_M("myFloatShaderParam"), floatValue); pItem->SetCustomMaterial(hMaterial); // pItem is an instance of RenderItemHandle
Classes |
|
| struct | ParameterDesc |
| This is parameter description of
HLSLMaterialHandle parameter.
More... |
|
Public Types |
|
| enum |
ParameterType { ParameterTypeUnknown, ParameterTypeFloat, ParameterTypeInt, ParameterTypeBool, ParameterTypePoint3, ParameterTypePoint4, ParameterTypeMatrix, ParameterTypeTexture, ParameterTypeFloatArray, ParameterTypeIntArray, ParameterTypeBoolArray, ParameterTypePoint3Array, ParameterTypePoint4Array, ParameterTypeMatrixArray } |
| This is parameter type of
HLSLMaterialHandle parameter.
More... |
|
Public Member Functions |
|
| GraphicsDriverAPI | HLSLMaterialHandle () |
| GraphicsDriverAPI | HLSLMaterialHandle (const HLSLMaterialHandle &from) |
|
GraphicsDriverAPI HLSLMaterialHandle & |
operator= (const HLSLMaterialHandle &from) |
| virtual GraphicsDriverAPI | ~HLSLMaterialHandle () |
| GraphicsDriverAPI bool | InitializeWithFile (const MSTR &fileName) |
| Initialize an instance of
HLSLMaterialHandle. |
|
| GraphicsDriverAPI bool | InitializeWithString (const CStr &shaderContent) |
| Initialize an instance of
HLSLMaterialHandle with shader string. |
|
| virtual
GraphicsDriverAPI const MaterialRequiredStreams * |
GetRequiredStreams () const |
| Returns the material required streams to
tell how to setup mesh data. |
|
| GraphicsDriverAPI int | GetParameterCount () const |
| Returns the parameter count of material.
|
|
| GraphicsDriverAPI bool | GetParameterDescription (int index, ParameterDesc ¶meterDesc) const |
| Returns the description of parameter.
|
|
| GraphicsDriverAPI int | GetParameterIndex (const MSTR ¶meterName) const |
| Returns the index of parameter. |
|
| GraphicsDriverAPI void | SetIntParameter (const MSTR ¶meterName, int value) |
| Sets int parameter. |
|
| GraphicsDriverAPI void | SetIntParameter (int index, int value) |
| Sets int parameter. |
|
| GraphicsDriverAPI void | SetIntArrayParameter (const MSTR ¶meterName, const int *value, unsigned int count) |
| Sets int array parameter. |
|
| GraphicsDriverAPI void | SetIntArrayParameter (int index, const int *value, unsigned int count) |
| Sets int array parameter. |
|
| GraphicsDriverAPI void | SetFloatParameter (const MSTR ¶meterName, float value) |
| Sets float parameter. |
|
| GraphicsDriverAPI void | SetFloatParameter (int index, float value) |
| Sets float parameter. |
|
| GraphicsDriverAPI void | SetFloatArrayParameter (const MSTR ¶meterName, const float *value, unsigned int count) |
| Sets float array parameter. |
|
| GraphicsDriverAPI void | SetFloatArrayParameter (int index, const float *value, unsigned int count) |
| Sets float array parameter. |
|
| GraphicsDriverAPI void | SetBoolParameter (const MSTR ¶meterName, BOOL value) |
| Sets bool parameter. |
|
| GraphicsDriverAPI void | SetBoolParameter (int index, BOOL value) |
| Sets bool parameter. |
|
| GraphicsDriverAPI void | SetBoolArrayParameter (const MSTR ¶meterName, const BOOL *value, unsigned int count) |
| Sets bool array parameter. |
|
| GraphicsDriverAPI void | SetBoolArrayParameter (int index, const BOOL *value, unsigned int count) |
| Sets bool array parameter. |
|
| GraphicsDriverAPI void | SetFloat4Parameter (const MSTR ¶meterName, const Point4 &value) |
| Sets float4 parameter. |
|
| GraphicsDriverAPI void | SetFloat4Parameter (int index, const Point4 &value) |
| Sets float4 parameter. |
|
| GraphicsDriverAPI void | SetFloat4ArrayParameter (const MSTR ¶meterName, const Point4 *value, unsigned int count) |
| Sets float4 array parameter. |
|
| GraphicsDriverAPI void | SetFloat4ArrayParameter (int index, const Point4 *value, unsigned int count) |
| Sets float4 array parameter. |
|
| GraphicsDriverAPI void | SetFloat3Parameter (const MSTR ¶meterName, const Point3 &value) |
| Sets float3 parameter. |
|
| GraphicsDriverAPI void | SetFloat3Parameter (int index, const Point3 &value) |
| Sets float3 parameter. |
|
| GraphicsDriverAPI void | SetFloat3ArrayParameter (const MSTR ¶meterName, const Point3 *value, unsigned int count) |
| Sets float3 array parameter. |
|
| GraphicsDriverAPI void | SetFloat3ArrayParameter (int index, const Point3 *value, unsigned int count) |
| Sets float3 array parameter. |
|
| GraphicsDriverAPI void | SetMatrixParameter (const MSTR ¶meterName, const Matrix44 &value) |
| Sets matrix parameter. |
|
| GraphicsDriverAPI void | SetMatrixParameter (int index, const Matrix44 &value) |
| Sets matrix parameter. |
|
| GraphicsDriverAPI void | SetMatrixArrayParameter (const MSTR ¶meterName, const Matrix44 *value, unsigned int count) |
| Sets matrix array parameter. |
|
| GraphicsDriverAPI void | SetMatrixArrayParameter (int index, const Matrix44 *value, unsigned int count) |
| Sets matrix array parameter. |
|
| GraphicsDriverAPI void | SetTextureParameter (const MSTR ¶meterName, const TextureHandle &textureHandle) |
| Sets texture parameter. |
|
| GraphicsDriverAPI void | SetTextureParameter (int index, const TextureHandle &textureHandle) |
| Sets texture parameter. |
|
| GraphicsDriverAPI void | SetMapChannelParameter (int textureCoordinateIndex, int maxMapChannel) |
| Sets map channel parameter. |
|
| GraphicsDriverAPI void | SetActiveTechniqueName (const MSTR &techniqueName) |
| Sets technique name parameter. |
|
| enum ParameterType |
This is parameter type of HLSLMaterialHandle parameter.
| ParameterTypeUnknown |
unknown parameter type |
| ParameterTypeFloat |
float type |
| ParameterTypeInt |
int type |
| ParameterTypeBool |
BOOL type. |
| ParameterTypePoint3 |
Point3 type. |
| ParameterTypePoint4 |
Point4 type. |
| ParameterTypeMatrix |
Matrix type. |
| ParameterTypeTexture |
texture type |
| ParameterTypeFloatArray |
float array type |
| ParameterTypeIntArray |
int array type |
| ParameterTypeBoolArray |
BOOL array type. |
| ParameterTypePoint3Array |
Point3 array type. |
| ParameterTypePoint4Array |
Point4 array type. |
| ParameterTypeMatrixArray |
Matrix array type. |
{
ParameterTypeUnknown,
ParameterTypeFloat,
ParameterTypeInt,
ParameterTypeBool,
ParameterTypePoint3,
ParameterTypePoint4,
ParameterTypeMatrix,
ParameterTypeTexture,
ParameterTypeFloatArray,
ParameterTypeIntArray,
ParameterTypeBoolArray,
ParameterTypePoint3Array,
ParameterTypePoint4Array,
ParameterTypeMatrixArray,
};
| GraphicsDriverAPI HLSLMaterialHandle | ( | ) |
| GraphicsDriverAPI HLSLMaterialHandle | ( | const HLSLMaterialHandle & | from | ) |
| virtual GraphicsDriverAPI ~HLSLMaterialHandle | ( | ) | [virtual] |
| GraphicsDriverAPI HLSLMaterialHandle& operator= | ( | const HLSLMaterialHandle & | from | ) |
| GraphicsDriverAPI bool InitializeWithFile | ( | const MSTR & | fileName | ) |
Initialize an instance of HLSLMaterialHandle.
A HLSLMaterialHandle should be initialized before it's used.
| [in] | fileName | HLSL shader file name. |
| GraphicsDriverAPI bool InitializeWithString | ( | const CStr & | shaderContent | ) |
Initialize an instance of HLSLMaterialHandle with shader string.
A HLSLMaterialHandle should be initialized before it's used.
| [in] | shaderContent | HLSL shader content. |
| virtual GraphicsDriverAPI const MaterialRequiredStreams* GetRequiredStreams | ( | ) | const [virtual] |
Returns the material required streams to tell how to setup mesh data.
Reimplemented from BaseMaterialHandle.
| GraphicsDriverAPI int GetParameterCount | ( | ) | const |
| GraphicsDriverAPI bool GetParameterDescription | ( | int | index, |
| ParameterDesc & | parameterDesc | ||
| ) | const |
Returns the description of parameter.
| [in] | index | The parameter index. |
| [out] | parameterDesc | The parameter description |
| GraphicsDriverAPI int GetParameterIndex | ( | const MSTR & | parameterName | ) | const |
Returns the index of parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| GraphicsDriverAPI void SetIntParameter | ( | const MSTR & | parameterName, |
| int | value | ||
| ) |
Sets int parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The int parameter value. |
| GraphicsDriverAPI void SetIntParameter | ( | int | index, |
| int | value | ||
| ) |
Sets int parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The int parameter value. |
| GraphicsDriverAPI void SetIntArrayParameter | ( | const MSTR & | parameterName, |
| const int * | value, | ||
| unsigned int | count | ||
| ) |
Sets int array parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The pointer of int array parameter value. |
| [in] | count | The count of int array. |
| GraphicsDriverAPI void SetIntArrayParameter | ( | int | index, |
| const int * | value, | ||
| unsigned int | count | ||
| ) |
Sets int array parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The pointer of int array parameter value. |
| [in] | count | The count of int array. |
| GraphicsDriverAPI void SetFloatParameter | ( | const MSTR & | parameterName, |
| float | value | ||
| ) |
Sets float parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The parameter value. |
| GraphicsDriverAPI void SetFloatParameter | ( | int | index, |
| float | value | ||
| ) |
Sets float parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The parameter value. |
| GraphicsDriverAPI void SetFloatArrayParameter | ( | const MSTR & | parameterName, |
| const float * | value, | ||
| unsigned int | count | ||
| ) |
Sets float array parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The pointer of float array parameter value. |
| [in] | count | The count of float array. |
| GraphicsDriverAPI void SetFloatArrayParameter | ( | int | index, |
| const float * | value, | ||
| unsigned int | count | ||
| ) |
Sets float array parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The pointer of float array parameter value. |
| [in] | count | The count of float array. |
| GraphicsDriverAPI void SetBoolParameter | ( | const MSTR & | parameterName, |
| BOOL | value | ||
| ) |
Sets bool parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The parameter value. |
| GraphicsDriverAPI void SetBoolParameter | ( | int | index, |
| BOOL | value | ||
| ) |
Sets bool parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The parameter value. |
| GraphicsDriverAPI void SetBoolArrayParameter | ( | const MSTR & | parameterName, |
| const BOOL * | value, | ||
| unsigned int | count | ||
| ) |
Sets bool array parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The pointer of bool array parameter value. |
| [in] | count | The count of bool array. |
| GraphicsDriverAPI void SetBoolArrayParameter | ( | int | index, |
| const BOOL * | value, | ||
| unsigned int | count | ||
| ) |
Sets bool array parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The pointer of bool array parameter value. |
| [in] | count | The count of bool array. |
Sets float4 parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The parameter value. |
| GraphicsDriverAPI void SetFloat4Parameter | ( | int | index, |
| const Point4 & | value | ||
| ) |
Sets float4 parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The parameter value. |
| GraphicsDriverAPI void SetFloat4ArrayParameter | ( | const MSTR & | parameterName, |
| const Point4 * | value, | ||
| unsigned int | count | ||
| ) |
Sets float4 array parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The pointer of float4 array parameter value. |
| [in] | count | The count of float4 array. |
| GraphicsDriverAPI void SetFloat4ArrayParameter | ( | int | index, |
| const Point4 * | value, | ||
| unsigned int | count | ||
| ) |
Sets float4 array parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The pointer of float4 array parameter value. |
| [in] | count | The count of float4 array. |
Sets float3 parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The parameter value. |
| GraphicsDriverAPI void SetFloat3Parameter | ( | int | index, |
| const Point3 & | value | ||
| ) |
Sets float3 parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The parameter value. |
| GraphicsDriverAPI void SetFloat3ArrayParameter | ( | const MSTR & | parameterName, |
| const Point3 * | value, | ||
| unsigned int | count | ||
| ) |
Sets float3 array parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The pointer of float3 array parameter value. |
| [in] | count | The count of float3 array. |
| GraphicsDriverAPI void SetFloat3ArrayParameter | ( | int | index, |
| const Point3 * | value, | ||
| unsigned int | count | ||
| ) |
Sets float3 array parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The pointer of float3 array parameter value. |
| [in] | count | The count of float3 array. |
Sets matrix parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The parameter value. |
| GraphicsDriverAPI void SetMatrixParameter | ( | int | index, |
| const Matrix44 & | value | ||
| ) |
Sets matrix parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The parameter value. |
| GraphicsDriverAPI void SetMatrixArrayParameter | ( | const MSTR & | parameterName, |
| const Matrix44 * | value, | ||
| unsigned int | count | ||
| ) |
Sets matrix array parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The pointer of matrix array parameter value. |
| [in] | count | The count of matrix array. |
| GraphicsDriverAPI void SetMatrixArrayParameter | ( | int | index, |
| const Matrix44 * | value, | ||
| unsigned int | count | ||
| ) |
Sets matrix array parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The pointer of matrix array parameter value. |
| [in] | count | The count of matrix array. |
| GraphicsDriverAPI void SetTextureParameter | ( | const MSTR & | parameterName, |
| const TextureHandle & | textureHandle | ||
| ) |
Sets texture parameter.
| [in] | parameterName | The unique parameter name of the parameter. |
| [in] | value | The parameter texture handle value. |
| GraphicsDriverAPI void SetTextureParameter | ( | int | index, |
| const TextureHandle & | textureHandle | ||
| ) |
Sets texture parameter.
| [in] | index | The parameter index of the parameter. |
| [in] | value | The parameter texture handle value. |
| GraphicsDriverAPI void SetMapChannelParameter | ( | int | textureCoordinateIndex, |
| int | maxMapChannel | ||
| ) |
Sets map channel parameter.
| [in] | textureCoordinateIndex | The texture coordinate index of shader. |
| [in] | maxMapChannel | Map channel value of 3ds max. |
| GraphicsDriverAPI void SetActiveTechniqueName | ( | const MSTR & | techniqueName | ) |
Sets technique name parameter.
| [in] | techniqueName | The active technique name. |