3ds Max C++ API Reference
IEffectParser Class Referenceabstract

Implemented by Effect Parser. More...

#include <RTMax.h>

+ 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...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

Implemented by Effect Parser.

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

Constructor & Destructor Documentation

◆ ~IEffectParser()

virtual ~IEffectParser ( )
inlinevirtual

virtual destructor

297 {}

Member Function Documentation

◆ ParseEffectFile()

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

◆ LoadTexture() [1/2]

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

◆ DestroyParser()

virtual void DestroyParser ( )
pure virtual

Remove the parser.

◆ PreRender()

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

◆ Render()

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.

◆ SetMappingChannel()

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

◆ SetUseLPRT()

virtual void SetUseLPRT ( bool  state)
inlinevirtual

Used internally.

280 { UNUSED_PARAM(state); };
#define UNUSED_PARAM(x)
Definition: BuildWarnings.h:18

◆ LoadEffect()

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

◆ GetLastParserError()

virtual const MCHAR* GetLastParserError ( )
pure virtual

retrieves the last error message maintained by the parser

◆ GetNumberOfLightParameters()

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

◆ GetLightSemantic()

virtual MaxSemantics GetLightSemantic ( int  index)
pure virtual

The light parameter usage.

◆ GetLightHandle()

virtual D3DXHANDLE GetLightHandle ( int  index)
pure virtual

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

◆ OnLostDevice()

virtual void OnLostDevice ( )
pure virtual

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

◆ OnResetDevice()

virtual void OnResetDevice ( )
pure virtual

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

◆ LoadTexture() [2/2]

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