IDXDataBridge Class Reference

#include <IViewportManager.h>

Class 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.

\sa  : Class IDXShaderManagerInterface, Class IViewportShaderManager, Class IHardwareMaterial\n\n

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(const Interval& changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message, BOOL propagate )
{
switch (message) {
//this allows the manager to control the TV better.
{
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.

+ Inheritance diagram for IDXDataBridge:

Public Member Functions

virtual Interface_ID GetID ()
 
virtual LifetimeType LifetimeControl ()
 
virtual ParamDlgCreateEffectDlg (HWND hWnd, IMtlParams *imp)=0
 The Viewport Manager will call this to display the dialog (if needed) More...
 
virtual void DisableUI ()=0
 This is no longer used. More...
 
virtual const MCHARGetName ()=0
 Get the UI name of the effect - this is only used for Viewport MAnager effects - not materials. More...
 
virtual void SetDXData (IHardwareMaterial *pHWMtl, Mtl *pMtl)=0
 For effects that will be using the fixed function pipeline. More...
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
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...
 

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...
 

Member Function Documentation

virtual Interface_ID GetID ( )
inlinevirtual
Remarks
The returns the unique ID for this interface. By default it will return VIEWPORT_SHADER_CLIENT_INTERFACE

Reimplemented from BaseInterface.

Reimplemented in IDX9DataBridge.

#define VIEWPORT_SHADER_CLIENT_INTERFACE
Definition: IViewportManager.h:32
virtual LifetimeType LifetimeControl ( )
inlinevirtual
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.

218 { return noRelease; }
Definition: baseinterface.h:94
virtual ParamDlg* CreateEffectDlg ( HWND  hWnd,
IMtlParams imp 
)
pure virtual

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

Parameters
hWndThe parent window handle
*impA 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 const 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
*pHWMtlA pointer to the internal hardware material.
*pMtlA 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.