3ds Max C++ API Reference
IHLSLMaterialTranslator Class Referenceabstract

Facilitates translation of material parameter values to their shaders representation. More...

#include <IHLSLMaterialTranslator.h>

+ Inheritance diagram for IHLSLMaterialTranslator:

Public Member Functions

virtual Interface_ID GetID ()
 Retrieves the interface ID of IHLSLMaterialTranslator. More...
 
virtual bool UpdateHLSLMaterial (const TimeValue t, GraphicFeatureLevel featureLevel)=0
 Update HLSLMaterial parameters. More...
 
virtual const HLSLMaterialHandleGetHLSLMaterialHandle (GraphicFeatureLevel featureLevel)=0
 Get HLSLMaterialHandle. More...
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
virtual LifetimeType LifetimeControl ()
 
virtual bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual BaseInterfaceAcquireInterface ()
 
virtual void ReleaseInterface ()
 
virtual void DeleteInterface ()
 
virtual BaseInterfaceCloneInterface (void *remapDir=NULL)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Additional Inherited Members

- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease , immediateRelease , wantsRelease , serverControlled }
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

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;
}
return static_cast<IHLSLMaterialTranslator*>(this);
else
return MtlBase::GetInterface(iid);
}
}
#define IHLSL_MATERIAL_TRANSLATOR_INTERFACE_ID
Interface ID of class IHLSLMaterialTranslator.
Definition: IHLSLMaterialTranslator.h:17
Definition: baseinterface.h:78
UtilExport BaseInterface * GetInterface(Interface_ID id)
Definition: maxtypes.h:215
Facilitates translation of material parameter values to their shaders representation.
Definition: IHLSLMaterialTranslator.h:65
virtual bool UpdateHLSLMaterial(const TimeValue t, GraphicFeatureLevel featureLevel)=0
Update HLSLMaterial parameters.
virtual const HLSLMaterialHandle & GetHLSLMaterialHandle(GraphicFeatureLevel featureLevel)=0
Get HLSLMaterialHandle.
Definition: MtlBase.h:159
virtual CoreExport void * GetInterface(ULONG id)
Inherited from Animatable.
int TimeValue
Definition: maxtypes.h:118
GraphicFeatureLevel
This enum specifies the feature levels device supported.
Definition: RenderEnums.h:577
#define _M(x)
Used to wrap string literals.
Definition: strbasic.h:67

Member Function Documentation

◆ GetID()

virtual Interface_ID GetID ( )
inlinevirtual

Retrieves the interface ID of IHLSLMaterialTranslator.

Reimplemented from BaseInterface.

◆ UpdateHLSLMaterial()

virtual bool UpdateHLSLMaterial ( const TimeValue  t,
GraphicFeatureLevel  featureLevel 
)
pure virtual

Update HLSLMaterial parameters.

Parameters
[in]tThe time at which to update the plug-in's parameter value
[in]featureLevelThe device's feature level
Returns
Returns true if successful, false otherwise.

◆ GetHLSLMaterialHandle()

virtual const HLSLMaterialHandle& GetHLSLMaterialHandle ( GraphicFeatureLevel  featureLevel)
pure virtual

Get HLSLMaterialHandle.

Parameters
[in]featureLevelThe device's feature level
Returns
Returns the HLSLMaterialHandle.