IViewportShadingMgr Class Reference

IViewportShadingMgr Class Referenceabstract

#include <IViewportShadingMgr.h>

Class Description

Viewport manager to control general illumination, including shadow support in the viewport.

New to 3ds Max 2008, the IViewportShadingMgr gives access to the new viewport Shading feature. The viewports have been redesigned to support more realistic rendering including Shadows. The interface also provides access to various flags that control how lights are used in the viewport. This is used closely with the new INodeShadingProperites API, that manages the actual flags set by IViewportShadingMgr The developer can get access to the CORE interface by using

+ Inheritance diagram for IViewportShadingMgr:

Public Types

enum  EViewportDisplayQuality { kNone, kGood, kBest }
 
enum  EViewportLightFlags { kShadowCasting, kIlluminating, kLocked }
 Please refer to INodeShadingProperties for more details. More...
 
- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease, immediateRelease, wantsRelease, serverControlled }
 

Public Member Functions

virtual void SetViewportShadingLimits (int limit, bool bQuiet=true)=0
 Define the viewports shading quality. More...
 
virtual int GetViewportShadingLimits ()=0
 Retrieve the viewport quality. More...
 
virtual bool GetAutoDisplayOfSelLights ()=0
 Get the current state of the Auto Display Selected light flag. More...
 
virtual void SetAutoDisplayOfSelLights (bool bSet)=0
 Set the state of the Auto Display of Selected lights flag. More...
 
virtual void SetCastShadowDefaultLights (bool bSet)=0
 Flag controlling shadow generation for default lights. More...
 
virtual bool GetCastShadowDefaultLights ()=0
 Access the flag defining whether shadows are generated for default lights. More...
 
virtual void DisplayOnlySelectedLights ()=0
 A method that defines that the current selected lights will be part of viewport rendering. More...
 
virtual void LockSelectedLights (bool bSet)=0
 Lock the current selected lights. More...
 
virtual void GetViewportShadingLights (Tab< INode * > &lightList, int type)=0
 A method to retrieve lights based on the usage in the scene. More...
 
virtual void SetGlobalShadowIntensity (float intensity)=0
 Sets the global intensity override for the shadows. More...
 
virtual float GetGlobalShadowIntensity ()=0
 Retrieve the Global shadow intensity. More...
 
virtual void SetUseTransparencyInShadows (bool bSet)=0
 Defines whether the viewport shading code supports transparent object/materials in the shadow code. More...
 
virtual bool GetUseTransparencyInShadows ()=0
 Get the current Transparency in shadows flag. More...
 
virtual void SetUpdateShadowInActiveViewOnly (bool bSet)=0
 Defines whether the viewport shading code updates the shadows for all windows or just the active viewport. More...
 
virtual bool GetUpdateShadowInActiveViewOnly ()=0
 Get the current update shadow in active view only flag. More...
 
virtual bool IsShadingLimitValid (int limit)=0
 Determine whether the shading limit is compatible with the current graphics hardware. More...
 
virtual Color GetLightIconColor (INode &lightNode)=0
 Get the light icon color based on the current viewport shading limits. More...
 
virtual void SetUseTransparencyInGI (bool bSet)=0
 Set whether the GI viewport system works with Transparent objects. More...
 
virtual bool GetUseTransparencyInGI ()=0
 Get whether the GI viewport system uses Transparency. More...
 
virtual void SetShadowFilterSize (float filterSize)=0
 Set the shadow filter size of soft-edge shadow. More...
 
virtual float GetShadowFilterSize ()=0
 Get the shadow filter size of soft-edge shadow. More...
 
- Public Member Functions inherited from FPInterfaceDesc
CoreExport FPInterfaceDesc ()
 
CoreExport FPInterfaceDesc (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, ULONG flag,...)
 
CoreExport ~FPInterfaceDesc ()
 
virtual void Init ()
 
LifetimeType LifetimeControl ()
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 
CoreExport void LoadDescriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *pCD, ULONG flag,...)
 
CoreExport void AppendFunction (int id,...)
 Add a new function to this interface descriptor. More...
 
CoreExport void AppendProperty (int id,...)
 Add a new property to this interface descriptor. More...
 
CoreExport void AppendEnum (int id,...)
 Add a new enum to this interface descriptor. More...
 
CoreExport void SetClassDesc (ClassDesc *i_cd)
 
CoreExport va_list check_fn (va_list ap, int id)
 
CoreExport va_list scan_fn (va_list ap, int id, int index)
 
CoreExport va_list check_prop (va_list ap, int id)
 
CoreExport va_list scan_prop (va_list ap, int id, int index)
 
CoreExport va_list check_enum (va_list ap, EnumID id)
 
CoreExport va_list scan_enum (va_list ap, EnumID id, int index)
 
FPInterfaceDescGetDesc ()
 
Interface_ID GetID ()
 
CoreExport FPFunctionDefGetFnDef (FunctionID fid)
 
ActionTableGetActionTable ()
 
CoreExport void EnableActions (BOOL onOff)
 
virtual CoreExport HINSTANCE HInstance ()
 
virtual CoreExport const MCHARGetRsrcString (StringResID id)
 
- Public Member Functions inherited from FPInterface
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t=0, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPParams *params)
 
virtual CoreExport FPStatus Invoke (FunctionID fid, TimeValue t, FPValue &result, FPParams *params=NULL)
 
virtual FPStatus Invoke (FunctionID fid, FPValue &result, FPParams *params=NULL)
 
virtual CoreExport FunctionID FindFn (const MCHAR *name)
 
virtual CoreExport BOOL IsEnabled (FunctionID actionID)
 
virtual CoreExport BOOL IsChecked (FunctionID actionID)
 
virtual CoreExport BOOL IsVisible (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsEnabled (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsChecked (FunctionID actionID)
 
virtual CoreExport FunctionID GetIsVisible (FunctionID actionID)
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
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

- 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...
 
- Public Attributes inherited from FPInterfaceDesc
Interface_ID ID
 
MSTR internal_name
 
StringResID description
 
ClassDesccd
 
USHORT flags
 
Tab< FPFunctionDef * > functions
 
Tab< FPPropDef * > props
 
Tab< FPEnum * > enumerations
 
MSPluginClass * pc
 
Rolloutrollout
 
ActionTableaction_table
 
- Static Public Attributes inherited from FPInterface
static CoreExport FPInterfaceDesc nullInterface
 
- Protected Member Functions inherited from FPInterfaceDesc
CoreExport void load_descriptor (Interface_ID id, const MCHAR *int_name, StringResID descr, ClassDesc *cd, USHORT flag, va_list ap)
 
- Protected Member Functions inherited from FPInterface
virtual FPStatus _dispatch_fn (FunctionID fid, TimeValue t, FPValue &result, FPParams *p)
 

Member Enumeration Documentation

Enumerator
kNone 
kGood 

Hardware shading disabled.

kBest 

Hardware shading with DirectX shader model 2.0.

40  {
41  kNone,
42  kGood,
43  kBest,
44  };
Hardware shading disabled.
Definition: IViewportShadingMgr.h:42
Hardware shading with DirectX shader model 2.0.
Definition: IViewportShadingMgr.h:43
Definition: IViewportShadingMgr.h:41

Please refer to INodeShadingProperties for more details.

Enumerator
kShadowCasting 
kIlluminating 

Light is shadow casting.

kLocked 

Light is illuminating.

47  {
50  kLocked,
51  };
Light is illuminating.
Definition: IViewportShadingMgr.h:50
Definition: IViewportShadingMgr.h:48
Light is shadow casting.
Definition: IViewportShadingMgr.h:49

Member Function Documentation

virtual void SetViewportShadingLimits ( int  limit,
bool  bQuiet = true 
)
pure virtual

Define the viewports shading quality.

Set the viewport rendering quality to a value defined in EViewportDisplayQuality. Please make sure you call IsShadingLimitValid before this method to determine if the graphics hardware supports this shading level.

Parameters
limitThe shading limits as defined by EViewportDisplayQuality
bQuietTrue to enable quiet mode. No dialogs will be produced to provide user feedback. This defaults to true.
virtual int GetViewportShadingLimits ( )
pure virtual

Retrieve the viewport quality.

Get the viewport rendering quality, as defined by EViewportDisplayQuality

Returns
The rendering quality
virtual bool GetAutoDisplayOfSelLights ( )
pure virtual

Get the current state of the Auto Display Selected light flag.

This will return the current state of the Auto Display of selected lights flag Any lights that are selected will automatically have their illumination flag set and take part in viewport rendering. If they have their shadow flag set as well, they will become shadow casters.

Returns
The state of the flag
virtual void SetAutoDisplayOfSelLights ( bool  bSet)
pure virtual

Set the state of the Auto Display of Selected lights flag.

This will set the current state of the Auto Display of selected lights flag If set to true, any lights that are selected will automatically have their illumination flag set and take part in viewport rendering. If they have their shadow flag set as well, they will become shadow casters.

Parameters
bSetThe flag value
virtual void SetCastShadowDefaultLights ( bool  bSet)
pure virtual

Flag controlling shadow generation for default lights.

Defines whether default lights cast shadows in the viewport

Parameters
bSetThe flag value
virtual bool GetCastShadowDefaultLights ( )
pure virtual

Access the flag defining whether shadows are generated for default lights.

Returns
The state of the flag
virtual void DisplayOnlySelectedLights ( )
pure virtual

A method that defines that the current selected lights will be part of viewport rendering.

When used, all lights that are currently selected will have their Illumination flag set, and will be part of the viewport rendering. All unselected lights will be deactivated.

virtual void LockSelectedLights ( bool  bSet)
pure virtual

Lock the current selected lights.

A locked light will be active in the viewport rendering, regardless of other flags set This could be something like a sun light, that always illuminates and casts shadows. Any selected light will have this flag set depending on the parameter value

Parameters
bSetThe value of the flag to set.
virtual void GetViewportShadingLights ( Tab< INode * > &  lightList,
int  type 
)
pure virtual

A method to retrieve lights based on the usage in the scene.

This is a general method to retrieve a list of nodes based on EViewportLightFlags. This is a quick way off accessing all viewport shadow casting lights in the scene.

Parameters
&lightListA node tab to retrieve the node list based on type
typeThe light type to store based on EViewportLightFlags
virtual void SetGlobalShadowIntensity ( float  intensity)
pure virtual

Sets the global intensity override for the shadows.

The intensity value is a global override for the general appearance of the shadow. A value of 1.0, the default will provide the unaltered shadow. A value less than one will fade the shadow to produce different effects.

Parameters
intensityThe value to set the intensity. This should be between 0 and 1, but the function will clamp
virtual float GetGlobalShadowIntensity ( )
pure virtual

Retrieve the Global shadow intensity.

This will return the current intensity value for the shadows.

Returns
The intensity value
virtual void SetUseTransparencyInShadows ( bool  bSet)
pure virtual

Defines whether the viewport shading code supports transparent object/materials in the shadow code.

This is a performance flag. If it is turned off, then the viewport will become faster as less GPU resources are active. This flag is typically used by the Adaptive Degradation system

Parameters
bSetTrue to turn it on - False to turn it off
virtual bool GetUseTransparencyInShadows ( )
pure virtual

Get the current Transparency in shadows flag.

See SetUseTransparencyInShadows

Returns
The current state of the flag
virtual void SetUpdateShadowInActiveViewOnly ( bool  bSet)
pure virtual

Defines whether the viewport shading code updates the shadows for all windows or just the active viewport.

The us a performance flag. TO increase performance in the viewports, turning this flag on will only update shadows in the active viewport - if it is a supported mode.

Parameters
bSetTrue to turn it on - False to turn it off
virtual bool GetUpdateShadowInActiveViewOnly ( )
pure virtual

Get the current update shadow in active view only flag.

See SetUpdateShadowInActiveViewOnly

Returns
The current state of the flag
virtual bool IsShadingLimitValid ( int  limit)
pure virtual

Determine whether the shading limit is compatible with the current graphics hardware.

This method is used to determine if the graphics hardware can support the shading level. This will query the GPU to find out what pixel shader support exists. For "Best", shader model 3 is required, "Good" needs a minimum of shader model 2. The developer should call this method before calling SetViewportShadingLimits as that method will not perform any additional tests.

Parameters
limitThe shading limit to test
Returns
True is the shading limit is supported
virtual Color GetLightIconColor ( INode lightNode)
pure virtual

Get the light icon color based on the current viewport shading limits.

The light icon that gets drawn should reflect the current state of the viewport shading. When the light is shadow casting it will be displayed in a duller color. If the light is currently not illuminating again it will appear duller than the usual wireframe color. This method should be used for any lights that display a viewport icon and want to adhere to the new coloring scheme. The color returned can be used in the GraphicsWindow::setColor function.

Parameters
&lightNodeThe light node to check for the current state of viewport shading flags
Returns
The new altered color. If viewport shading is set to "None" - this will be the default wireframe color
virtual void SetUseTransparencyInGI ( bool  bSet)
pure virtual

Set whether the GI viewport system works with Transparent objects.

virtual bool GetUseTransparencyInGI ( )
pure virtual

Get whether the GI viewport system uses Transparency.

virtual void SetShadowFilterSize ( float  filterSize)
pure virtual

Set the shadow filter size of soft-edge shadow.

This method is used to control the softness of the shadow edge when the viewport shadow mode is set to soft-edge shadow. It has no effect when in hard-edge shadow mode or if an area light with viewport soft shadow turned on.

Parameters
filterSizeThe value to set the filter size. This should be between 0 and 1, but the function will clamp.
virtual float GetShadowFilterSize ( )
pure virtual

Get the shadow filter size of soft-edge shadow.

This will return the current filter size of soft-edge shadow.

Returns
The filter size value