IDxMaterial Class Reference

#include <IDxMaterial.h>

Class Description

An interface class to manage access to various parameters used by DirectX effects.

Description:
The Effect file has many internal presentations and as such the DxMaterial does not always store a one to one look up. Many parameters are stored in a ParamBlock and can be accessed that way. The paramblock index for the Effect is located at 0 (the material maintains 5 ParamBlocks) and hosts all the parameters with the param name being that of the parameter in the effect File.

However not all entries in the paramblock match the parameter type of the effect file directly. One such example is the light data, which in the paramblock will use a TYPE_INTLISTBOX, where in the Effect file it is a vector.

To overcome this, the interface provides direct access to the lights and textures used by the effect. It is possible to both get and set the bitmaps, but only read access is available for the lights.
+ Inheritance diagram for IDxMaterial:

Public Types

enum  LightSemantics {
  LIGHT_COLOR, LIGHT_DIRECTION, LIGHT_POSITION, LIGHT_FALLOFF,
  LIGHT_HOTSPOT, LIGHT_ATTENUATION
}
 
- Public Types inherited from BaseInterface
enum  LifetimeType { noRelease, immediateRelease, wantsRelease, serverControlled }
 

Public Member Functions

virtual void ReloadDXEffect ()=0
 Reloads the current active effect. More...
 
virtual int GetNumberOfEffectBitmaps ()=0
 Returns the number of bitmaps used by the currently loaded effect. More...
 
virtual PBBitmapGetEffectBitmap (int index)=0
 Gets the bitmap used by the effect. More...
 
virtual void SetEffectBitmap (int index, PBBitmap *bmap)=0
 Set the bitmap used by the effect. More...
 
virtual const MaxSDK::AssetManagement::AssetUserGetEffectFile ()=0
 Get the Dx Effect file AssetUser. More...
 
virtual void SetEffectFile (const MaxSDK::AssetManagement::AssetUser &file)=0
 Set the Dx Effect file AssetUser. More...
 
virtual PBBitmapGetSoftwareRenderBitmap ()=0
 Get the bitmap used for the software rendering overrride. More...
 
virtual void SetSoftwareRenderBitmap (PBBitmap *bmap)=0
 Set the bitmap to be used by the Renderer. More...
 
virtual int GetNumberOfLightParams ()=0
 Get the number of light based parameters. More...
 
virtual INodeGetLightNode (int index)=0
 The actual node used by the parameter. More...
 
virtual const MCHARGetLightParameterName (int index)=0
 The name of the parameter in the Effect file. More...
 
virtual LightSemantics GetLightSemantic (int index)=0
 The light semantic as defined in the effect file. More...
 
- Public Member Functions inherited from FPMixinInterface
 FPMixinInterface ()
 
virtual LifetimeType LifetimeControl ()
 
virtual CoreExport bool RegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
virtual void UnRegisterNotifyCallback (InterfaceNotifyCallback *incb)
 
CoreExport ~FPMixinInterface ()
 
virtual BaseInterfaceGetInterface (Interface_ID id)
 
virtual FPInterfaceDescGetDescByID (Interface_ID id)
 
virtual Interface_ID GetID ()
 
- Public Member Functions inherited from FPInterface
virtual FPInterfaceDescGetDesc ()=0
 
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)
 
virtual ActionTableGetActionTable ()
 
virtual void EnableActions (BOOL onOff)
 
- Public Member Functions inherited from BaseInterface
virtual UtilExport ~BaseInterface ()
 Destructor. More...
 
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...
 
- Static Public Attributes inherited from FPInterface
static CoreExport FPInterfaceDesc nullInterface
 
- Protected Member Functions inherited from FPMixinInterface
 FPMixinInterface (const FPMixinInterface &rhs)
 
FPMixinInterfaceoperator= (const FPMixinInterface &rhs)
 
- Protected Member Functions inherited from FPInterface
virtual FPStatus _dispatch_fn (FunctionID fid, TimeValue t, FPValue &result, FPParams *p)
 
- Protected Attributes inherited from FPMixinInterface
Tab< InterfaceNotifyCallback * > * interfaceNotifyCBs
 

Member Enumeration Documentation

Enumerator
LIGHT_COLOR 
LIGHT_DIRECTION 
LIGHT_POSITION 
LIGHT_FALLOFF 
LIGHT_HOTSPOT 
LIGHT_ATTENUATION 
49  {
56  };
Definition: IDxMaterial.h:55
Definition: IDxMaterial.h:51
Definition: IDxMaterial.h:52
Definition: IDxMaterial.h:53
Definition: IDxMaterial.h:54
Definition: IDxMaterial.h:50

Member Function Documentation

virtual void ReloadDXEffect ( )
pure virtual

Reloads the current active effect.

virtual int GetNumberOfEffectBitmaps ( )
pure virtual

Returns the number of bitmaps used by the currently loaded effect.

The number of bitmaps returned will be equal to the number of bitmap entries found in the effect file. This will include bitmap slots that haven't been assigned, so it is important to check the return value from the various Bitmap related functions that take an index.

Returns
The number of bitmaps
virtual PBBitmap* GetEffectBitmap ( int  index)
pure virtual

Gets the bitmap used by the effect.

Parameters
indexThe index of the bitmap to retrieve
Returns
A PBBitmap pointer for the bitmap used
virtual void SetEffectBitmap ( int  index,
PBBitmap bmap 
)
pure virtual

Set the bitmap used by the effect.

Parameters
indexThe index of the bitmap to set
*bmapA PBBitmap pointer for the bitmap to set
virtual const MaxSDK::AssetManagement::AssetUser& GetEffectFile ( )
pure virtual

Get the Dx Effect file AssetUser.

This can also be accessed via the paramblock, but it is simply provided for completeness

Returns
The effect file in use
virtual void SetEffectFile ( const MaxSDK::AssetManagement::AssetUser file)
pure virtual

Set the Dx Effect file AssetUser.

This can also be accessed via the paramblock, but it is simply provided for completeness

Parameters
fileThe effect file to set
virtual PBBitmap* GetSoftwareRenderBitmap ( )
pure virtual

Get the bitmap used for the software rendering overrride.

This can also be set by the Paramblock, it is just used for completeness return The Bitmap used

virtual void SetSoftwareRenderBitmap ( PBBitmap bmap)
pure virtual

Set the bitmap to be used by the Renderer.

This can also be set by the Paramblock, it is just used for completeness

Parameters
*bmapA PBBitmap specifiying the bitmap to use
virtual int GetNumberOfLightParams ( )
pure virtual

Get the number of light based parameters.

This will return the number of parameters that are light based, even Light Color. Care needs to be taken with Light Color as it could also have a Color Swatch associated with it, so could already have been exported as part of the ParamBlock.

Returns
The number of light based parameters
virtual INode* GetLightNode ( int  index)
pure virtual

The actual node used by the parameter.

This represent the light node used by the parameter. Care needs to taken as this could be a NULL pointer. There are two reason for this. The first is that the LightColor Semantic is stored internally as a LightElement, but the writer of the Effect file may not have specified a parentID for the light, this will result in a NULL. Secondly if the user has not actually assigned a light via the UI drop down list, then again this will again result in a NULL pointer.

Parameters
indexThe index of the light to return.
Returns
The INode for the active light.
virtual const MCHAR* GetLightParameterName ( int  index)
pure virtual

The name of the parameter in the Effect file.

virtual LightSemantics GetLightSemantic ( int  index)
pure virtual

The light semantic as defined in the effect file.