Class IDXDataBridge

3DS Max Plug-In SDK

Class IDXDataBridge

See Also: : Class IDXShaderManagerInterface, Class IViewportShaderManager, Class IHardwareMaterial

 

class IDXDataBridge: public BaseInterface

 

Description:

This class is only available in release 5 or later.

This is the interfaced used by the Viewport Shader plugins. For the manager to load up a Viewport Shader it must implement this class.

 

As well as implementing the dialog loading it also provides a link to the GFX. This means the developer is free use IDX8VertexShader and IDX8PixelShader interfaces, for more advanced shaders. Examples of these shaders are

\MAXSDK\SAMPLES\HardwareShaders\Cubemap\Cubemap.cpp and

\MAXSDK\SAMPLES\HardwareShaders\Membrane\Membrane.cpp

 

An important point to make with the usage of these plugins is in the way the ViewportManager loads them up. To determine whether the plugin is a shader it checks the Category in the ClassDesc. This must return “DXViewportEffect” otherwise it will not be listed in the database. The reason for this is that the Manager supports deferred loading, and this is one way of checking the plugin without requiring a full DLL load.

 

For an example of this class in use by ViewportShader plug-ins see \MAXSDK\SAMPLES\HardwareShaders\LightMap\Lightmap.cpp

 

If the Viewport Shader plugin hosts any animated parameters that will be viewed in the Trackview then it is important the plugin implements the following Reference Message in the

 

RefResult LightMap::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message )

{

 switch (message)

 {

  //this allows the manager to control the TV better.

  case REFMSG_WANT_SHOWPARAMLEVEL:

  {

   BOOL * pb = (BOOL*)(partID);

   *pb = TRUE;

   return REF_STOP;

  }

 }

 return(REF_SUCCEED);

}

 

This will make sure that the Parameters show up under the Viewport Manager in the correct format.

 

All methods of this class are implemented by the plug-in.

 

Methods:

 

Prototype:

virtual Interface_ID  GetID()

Remarks:

The returns the unique ID for this interface. By default it will return VIEWPORT_SHADER_CLIENT_INTERFACE

 

Prototype:

virtual ParamDlg * CreateEffectDlg(HWND hWnd, IMtlParams * imp)= 0

Remarks:

This allows the Viewport shader to create a UI. This will be added as a child of the Viewport Manager.

Parameters:

HWND hWnd

The window handle to the parent window

IMtlParams * imp

This can be used in the call to CreateParamsDlg.

 

Prototype:

virtual void DisableUI()=0

Remarks:

Currently this method is not used

 

Prototype:

virtual TCHAR * GetName()=0

 

Remarks:

This allows the plugin to return a name to be used in max. This may be extended for future use, but currently it is only used in the trackview.

 

Prototype:

virtual void SetDXData(IHardwareMaterial * pHWMtl, Mtl * pMtl)=0

 

Remarks:

This allows the plugin to use methods of Class IHardwareMaterial to perform custom drawing of an object. This could be special texture setups and control over the Render States and Texture Stages. If the developer needs finer control over the object, then the r4 interfaces IDX8VertShader can be used instead, and this function will not do anything. This method will be called whenever the object needs drawing. For a detailed example of this usage, please look at the Lightmap sample in the sdk

 

Parameters:

IHardwareMaterial * pHWMtl

Provides access to various drawing techniques

Mtl * pMtl

A pointer to the parent material.