IEffectParser Class Reference

#include <RTMax.h>

Class Description

Implemented by Effect Parser.

Effect parsers will implement this interface in order to actually render the effect

+ Inheritance diagram for IEffectParser:

Public Member Functions

virtual bool ParseEffectFile (LPVOID pDevice, const MaxSDK::AssetManagement::AssetUser &file, IEffectManager *em)=0
 Parse the actual effect file. More...
 
virtual bool LoadTexture (LPVOID pDevice, const MCHAR *paramName, const MCHAR *filename, bool forceReload, PBBitmap *pBitmap=NULL)=0
 The UI code will use this to make sure the effect has all the textures loaded and applied to the effect when they change from the UI. More...
 
virtual void DestroyParser ()=0
 Remove the parser. More...
 
virtual bool PreRender (LPVOID pDevice, IRenderMesh *rmesh, ILightManager *lm, IParameterManager *pm, D3DCOLOR bkgColor, int width, int height)=0
 Any initialisation or one off setup, before the render passes happens here. More...
 
virtual bool Render (LPVOID pDevice, IRenderMesh *rmesh, D3DXHANDLE primaryTechnique)=0
 Render the actual object, based on the data supplied in the effect file. More...
 
virtual void SetMappingChannel (D3DXHANDLE handle, int Channel)=0
 Alows the user to change the mapping channel used by the texture in the UI. More...
 
virtual void SetUseLPRT (bool state)
 Used internally. More...
 
virtual bool LoadEffect (LPVOID pDevice, IEffectManager *em, const char *effect, bool fileType, bool forceReload)=0
 Load a shader based on the filename supplied. More...
 
virtual const MCHARGetLastParserError ()=0
 retrieves the last error message maintained by the parser More...
 
virtual ~IEffectParser ()
 virtual destructor More...
 
virtual int GetNumberOfLightParameters ()=0
 Allow the EffectManager access to lighting data, so it can expose it through the public interfaces. More...
 
virtual MaxSemantics GetLightSemantic (int index)=0
 The light parameter usage. More...
 
virtual D3DXHANDLE GetLightHandle (int index)=0
 Get a handle to the light based on the index supplied. More...
 
virtual void OnLostDevice ()=0
 Called when a Lost Device is detected - free any resources here. More...
 
virtual void OnResetDevice ()=0
 Called when a ResetDevice is detected - free and rebuild any resources here. More...
 
virtual bool LoadTexture (LPVOID pTexture, const MCHAR *paramName)=0
 Provides the ability to load a texture created out side the parser. 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...
 

Constructor & Destructor Documentation

virtual ~IEffectParser ( )
inlinevirtual

virtual destructor

299 {}

Member Function Documentation

virtual bool ParseEffectFile ( LPVOID  pDevice,
const MaxSDK::AssetManagement::AssetUser file,
IEffectManager em 
)
pure virtual

Parse the actual effect file.

All data that is needed to actually render the effect is extracted here. If a UI is needed, then the IEffectManager interface can be used for this purpose

Parameters
pDeviceThe main D3D device
fileThe actual file asset that represents the effect file
*emA pointer to the Effect Manager
Returns
true/false depending on whether the parsing was successful
virtual bool LoadTexture ( LPVOID  pDevice,
const MCHAR paramName,
const MCHAR filename,
bool  forceReload,
PBBitmap pBitmap = NULL 
)
pure virtual

The UI code will use this to make sure the effect has all the textures loaded and applied to the effect when they change from the UI.

Parameters
pDeviceThe main D3D device
paramNameThe handle of the texture parameter from the effect file
*filenameThe name of the texture to load
forceReloadIf true don't pull the texture from a cache, you need to load from disk
*pBitmapIf supplied the DirectX resource system will use data contained in PBBitmap to load the file based on the user's settings. This will be used when the DirectX texture loader fails to load the file directly, at which point the internal 3ds Max representation could be used as pointed to by the PBBitmap structure.
Returns
true/false depending on whether loading was successful
virtual void DestroyParser ( )
pure virtual

Remove the parser.

virtual bool PreRender ( LPVOID  pDevice,
IRenderMesh rmesh,
ILightManager lm,
IParameterManager pm,
D3DCOLOR  bkgColor,
int  width,
int  height 
)
pure virtual

Any initialisation or one off setup, before the render passes happens here.

If new rendertargets are needed or back buffers, this is the place to do it

Parameters
pDeviceThe main D3D device
*rmeshThe render mesh that needs to be drawn
*lmA pointer to the light manager
*pmA pointer to the Parameter manager
bkgColorThe color of the background to clear to
widthThe width of the viewport
heightThe height of the viewport
Returns
True/False
virtual bool Render ( LPVOID  pDevice,
IRenderMesh rmesh,
D3DXHANDLE  primaryTechnique 
)
pure virtual

Render the actual object, based on the data supplied in the effect file.

Parameters
pDeviceThe main D3D device
*rmeshThe render mesh that needs to be drawn
primaryTechniqueThe actual technique that should be used for the final result.
virtual void SetMappingChannel ( D3DXHANDLE  handle,
int  Channel 
)
pure virtual

Alows the user to change the mapping channel used by the texture in the UI.

Parameters
handleThe handle of the parameter to set
ChannelThe value of the mapping channel
virtual void SetUseLPRT ( bool  state)
inlinevirtual

Used internally.

282 { UNUSED_PARAM(state); };
#define UNUSED_PARAM(x)
Definition: BuildWarnings.h:18
virtual bool LoadEffect ( LPVOID  pDevice,
IEffectManager em,
const char *  effect,
bool  fileType,
bool  forceReload 
)
pure virtual

Load a shader based on the filename supplied.

The parser must keep a pointer to this effect, and manage any resources associated with it

Parameters
pDeviceThe DirectX device
emA pointer to the IEffectManager instance
effectA string containing the effect - this can either be a filename or a buffer contaning the effect
fileTypeDefines whether the string contains a file name or a buffer
forceReloadIf true don't pull the effect from a cache, you need to reload from disk
Returns
True if successful
virtual const MCHAR* GetLastParserError ( )
pure virtual

retrieves the last error message maintained by the parser

virtual int GetNumberOfLightParameters ( )
pure virtual

Allow the EffectManager access to lighting data, so it can expose it through the public interfaces.

The EffectManager used to maintain all the lights, now it simply host the UI. This means the parser needs to keep tabs on the lights, or at least what parameters of the lights are needed. This is simple for the parser, as it will need to keep a local list of the light data so it can request the actual 3ds Max data from the LightManager.The number of light based parameters the effect contains

virtual MaxSemantics GetLightSemantic ( int  index)
pure virtual

The light parameter usage.

virtual D3DXHANDLE GetLightHandle ( int  index)
pure virtual

Get a handle to the light based on the index supplied.

virtual void OnLostDevice ( )
pure virtual

Called when a Lost Device is detected - free any resources here.

virtual void OnResetDevice ( )
pure virtual

Called when a ResetDevice is detected - free and rebuild any resources here.

virtual bool LoadTexture ( LPVOID  pTexture,
const MCHAR paramName 
)
pure virtual

Provides the ability to load a texture created out side the parser.

Parameters
pTextureA pointer to DirectX texture resource
paramNameThe name of the parameter who should receive the texture
Returns
True/False depending on whether the texture was uploaded correctly