3ds Max C++ API Reference
IRTShaderParameterBinding Class Referenceabstract

Interface for setting parameters in a compiled effect file. More...

#include <IRTShaderParameterBinding.h>

+ Inheritance diagram for IRTShaderParameterBinding:

Public Member Functions

virtual Interface_ID GetID ()
 
virtual void BindParameter (const MCHAR *paramName, LPVOID value)=0
 Assign the correct value based on the name parsed from the effect file. More...
 
virtual void BindParameter (const TimeValue t, const MCHAR *paramName, LPVOID value)=0
 Assign the correct value based on the name parsed from the effect file. More...
 
virtual void InitializeBinding ()=0
 Called once before the parameter list is parsed. 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

Interface for setting parameters in a compiled effect file.

A IRTShaderNode would implement this new interface to allow setting of parameters to the underlying graphics subsystem. When a shade tree is created a Microsoft Effect file is generated that contains all the parameters exposed during compiling of the tree. At runtime the subsystem needs to set values to these parameters. At this level it knows nothing about the underlying material structure, and simply has a bunch parameter names and data types. To aid this, at render time the hardware renderer will query the host for the IRTShaderParameterBinding interface, and will call BindParameter to have the data assigned to the effect frame work. The "value" passed to the method is the correct size for the underlying data type, so the BindParameter method must understand the data request. In general this would either be a float, or a D3DXVECTOR (or D3DCOLORVALUE) type for colors. This value is assigned directly to the effect framework. An example of setting a value can be seen below - taken from the Architectural and Design Material

if(_tcscmp(paramName,_M("mia_material_1_diffuse"))==0)
{
AColor val;
val = m_mainPB->GetAColor(kPar_Diffuse, t);
*(D3DCOLORVALUE*)value = GetD3DColor(val);
}
Definition: acolor.h:32
#define _M(x)
Used to wrap string literals.
Definition: strbasic.h:67

This checks the name of the parameter, accesses the correct data item from the paramblock, and sets the value correctly.

Member Function Documentation

◆ GetID()

virtual Interface_ID GetID ( )
inlinevirtual
Remarks
This method returns the unique interface ID.

Reimplemented from BaseInterface.

#define IRTSHADERPARAMETERBINDING_INTERFACE_ID
Definition: IRTShaderParameterBinding.h:19

◆ BindParameter() [1/2]

virtual void BindParameter ( const MCHAR paramName,
LPVOID  value 
)
pure virtual

Assign the correct value based on the name parsed from the effect file.

This method will be called for every parameter parsed from the effect file that the renderer doesn't understand

Parameters
[in]paramNameThe name of the parameter as parsed from the effect file
[out]valueThe pointer to a data structure that will receive the value to set

◆ BindParameter() [2/2]

virtual void BindParameter ( const TimeValue  t,
const MCHAR paramName,
LPVOID  value 
)
pure virtual

Assign the correct value based on the name parsed from the effect file.

This method will be called for every parameter parsed from the effect file that the renderer doesn't understand

Parameters
[in]tCurrent time value
[in]paramNameThe name of the parameter as parsed from the effect file
[out]valueThe pointer to a data structure that will receive the value to set

◆ InitializeBinding()

virtual void InitializeBinding ( )
pure virtual

Called once before the parameter list is parsed.

Allows for one time setup of data. This could be used to make sure all parameters are valid before being queried