Class IViewportShaderManager

3DS Max Plug-In SDK

Class IViewportShaderManager

See Also: : Class IDXShaderManagerInterface

 

class IViewportShaderManager : public FPStaticInterface

 

Description:

This class is only available in release 5 or later.

The class provides access to the Viewport Shaders the Viewport manager hosts.

 

Methods:

Prototype:

virtual int GetNumEffects()=0

Remarks:

This will return the number of viewport shaders the ViewportManager has in its database.

 

Prototype:

virtual ReferenceTarget* GetActiveEffect()=0

 

Remarks:

This will return the effect that is currently active in the viewport. This ReferenceTarget can be queried for any Interfaces it may be hosting including .

The following code can be used to get an IDXDataBridge interface where effect is a ReferenceTarget

 

IDXDataBridge * vp = (IDXDataBridge*)effect->GetInterface(VIEWPORT_SHADER_CLIENT_INTERFACE);

 

Prototype:

virtual TCHAR * GetEffectName(int i)=0

 

Remarks:

This will return the name of the effect based on the index passed in. This is a 1 based index, so that it can be used from Maxscript directly. The reason for this is that internally position “0” is reserved for the “None” element in the drop down list.

 

Parameters:

int i

The index of the effect whose name will be returned

 

Prototype:

virtual ReferenceTarget * SetViewportEffect(int i)=0

Remarks:

This will set the active effect and return a pointer to it for further setup etc

 

Parameters:

int i

The index of the effect the set.

 

Prototype:

virtual void ActivateEffect(MtlBase * mtl, BOOL State)=0

 

Remarks:

For a shader to be initialized and allowed to draw in the viewport the material needs to be told that it contains a Hardware Shader (or effect). This method controls this flag.

Parameters:

MtlBase * mtl

The material whose flag is to be set

BOOL State

True if the flag is to be set or FALSE to clear it