Public Member Functions

IDXDataBridge Class Reference

Search for all occurrences

Detailed Description

Viewport DXEffect interface.

A Direct X 8.1 shader should implement this class. It is used by the system to get information from the shader If a material implements this class, then all it needs to do is pass back a pointer in the GetInterface implementation. All the other methods can simply be a no op.

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

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_HALT;
        }
    }
    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 virtual.

#include <IViewportManager.h>

Inheritance diagram for IDXDataBridge:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual Interface_ID  GetID ()
virtual LifetimeType  LifetimeControl ()
virtual ParamDlg CreateEffectDlg (HWND hWnd, IMtlParams *imp)=0
  The Viewport Manager will call this to display the dialog (if needed)
virtual void  DisableUI ()=0
  This is no longer used.
virtual MCHAR *  GetName ()=0
  Get the UI name of the effect - this is only used for Viewport MAnager effects - not materials.
virtual void  SetDXData (IHardwareMaterial *pHWMtl, Mtl *pMtl)=0
  For effects that will be using the fixed function pipeline.

Member Function Documentation

virtual Interface_ID GetID ( ) [inline, virtual]
Remarks:
The returns the unique ID for this interface. By default it will return VIEWPORT_SHADER_CLIENT_INTERFACE

Reimplemented from BaseInterface.

Reimplemented in IDX9DataBridge.

{ return VIEWPORT_SHADER_CLIENT_INTERFACE; }
virtual LifetimeType LifetimeControl ( ) [inline, virtual]
Remarks:
This method allows inquiries into the actual lifetime policy of a client and provide a server-controlled delete notify callback.
Returns:
One of the following LifetimeTypes:

noRelease

Do not call release, use interface as long as you like.

immediateRelease

The interface is only good for one calls. The release is implied so a call to release is not required.

wantsRelease

The clients are controlling the lifetime, so the interface needs a Release() when the client has finished. This is the default.

serverControlled

The server controls the lifetime and will use the InterfaceNotifyCallback to inform the code when it is gone.
Default Implementation:
{ return noRelease; }

Reimplemented from BaseInterface.

Reimplemented in IDX9DataBridge.

{ return noRelease; }
virtual ParamDlg* CreateEffectDlg ( HWND  hWnd,
IMtlParams imp 
) [pure virtual]

The Viewport Manager will call this to display the dialog (if needed)

Parameters:
hWnd The parent window handle
*imp A pointer to IMtlParam - see the main max SDK for info on this class
Returns:
A new ParamDlg pointer which the Viewport Manager will uses as a child of its window
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.

virtual void DisableUI ( ) [pure virtual]

This is no longer used.

Remarks:
Currently this method is not used

virtual MCHAR* GetName ( ) [pure virtual]

Get the UI name of the effect - this is only used for Viewport MAnager effects - not materials.

Returns:
A string containing the name
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.
virtual void SetDXData ( IHardwareMaterial pHWMtl,
Mtl pMtl 
) [pure virtual]

For effects that will be using the fixed function pipeline.

This provided access to the IHArdwareMaterial allowing access to DirectX FFP.

Parameters:
*pHWMtl A pointer to the internal hardware material.
*pMtl A pointer to the parent Material
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.

IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge
IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge IDXDataBridge