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, Material Plug-in Display Interface.
#include <IHLSLMaterialTranslator.h>
Facilitates translation of material parameter values to their shaders representation.
Materials can use programmable shaders to describe their appearance when displayed in the Nitrous viewport and rendered with Quicksilver. Programmable shaders allow for a more realistic and complex visual appearance than ISimpleMaterial does. Besides MetaSL shader ( See IShaderManager and IParameterTranslatorfor more details), 3ds Max 2014 starts to support HLSL shader.
IHLSLMaterialTranslator give a proper chance in UpdateHLSLMaterial() to update parameters of HLSLMaterialHandle, such as parameter values, map channel values. See HLSLMaterialHandle for more details.
Plug-ins derive from IHLSLMaterialTranslator. They rather need to create instances of HLSLMaterialHandle. 3ds Max will query the plug-in for its IHLSLMaterialTranslator via a request for the interface identified by IHLSL_MATERIAL_TRANSLATOR_INTERFACE_ID. Then get HLSLMaterialHandle via GetHLSLMaterialHandle() of IHLSLMaterialTranslator. Typically a plug-in would implement GetHLSLMaterialHandle of IHLSLMaterialTranslator in response to this request and its override of Animatable::GetInterface(Interface_ID) for IHLSLMaterialTranslator
The following code snippet illustrates how a material plug-in may implement IHLSLMaterialTranslator:
#include <./graphics/IHLSLMaterialTranslator.h> // A material plug-in that has HLSLMaterialHandle and needs to update HLSLMaterial parameters. class MyMtlPlugin : public MtlBase, public MaxSDK::Graphics::IHLSLMaterialTranslator { // HLSLMaetrialHandle omitted for brevity private: HLSLMaetrialHandle mHLSLMaterialHandle; public: virtual bool UpdateHLSLMaterial(const TimeValue t, GraphicFeatureLevel featureLevel) { mHLSLMaterialHandle.SetFloatParameter(_M("myFloatShaderParam"), floatValue); mHLSLMaterialHandle.SetIntParameter(_M("myIntShaderParam"), intValue); return true; } virtual const HLSLMaterialHandle& GetHLSLMaterialHandle(GraphicFeatureLevel featureLevel) { return mHLSLMaterialHandle; } BaseInterface* GetInterface(Interface_ID iid) { if (IHLSL_MATERIAL_TRANSLATOR_INTERFACE_ID == iid) return static_cast<IHLSLMaterialTranslator*>(this); else return MtlBase::GetInterface(iid); } }
Public Member Functions |
|
virtual Interface_ID | GetID () |
Retrieves the interface ID of
IHLSLMaterialTranslator. |
|
virtual bool | UpdateHLSLMaterial (const TimeValue t, GraphicFeatureLevel featureLevel)=0 |
Update HLSLMaterial parameters. |
|
virtual const HLSLMaterialHandle & | GetHLSLMaterialHandle (GraphicFeatureLevel featureLevel)=0 |
Get
HLSLMaterialHandle. |
virtual Interface_ID GetID | ( | ) | [inline, virtual] |
Retrieves the interface ID of IHLSLMaterialTranslator.
Reimplemented from BaseInterface.
{ return IHLSL_MATERIAL_TRANSLATOR_INTERFACE_ID; }
virtual bool UpdateHLSLMaterial | ( | const TimeValue | t, |
GraphicFeatureLevel | featureLevel | ||
) | [pure virtual] |
Update HLSLMaterial parameters.
[in] | t | The time at which to update the plug-in's parameter value |
[in] | featureLevel | The device's feature level |
virtual const HLSLMaterialHandle& GetHLSLMaterialHandle | ( | GraphicFeatureLevel | featureLevel | ) | [pure virtual] |
Get HLSLMaterialHandle.
[in] | shaderVersion | The device's feature level |