RenderMapsContext Class Reference

RenderMapsContext Class Referenceabstract

#include <RenderMapsContext.h>

Class Description

An instance of this class is passed into the MtlBase::BuildMaps() method.

This is used for the Mirror and Automatic Cubic maps. These maps callback to methods of this class to perform a rendering from a particular view. Sample code using these methods is available in /MAXSDK/SAMPLES/MATERIALS/MIRROR.CPP and ACUBIC.CPP. All methods of this class are implemented by the system.

See also
Class INode, Class ViewParams, Structure SubRendParams, Class Matrix3, Class Box3, Class Point4, Class Bitmap, Class RenderGlobalContext.
+ Inheritance diagram for RenderMapsContext:

Public Member Functions

virtual ~RenderMapsContext ()
 Destructor. More...
 
virtual INodeGetNode ()=0
 Returns the INode pointer of the node being rendered. More...
 
virtual int NodeRenderID ()=0
 Returns the node ID for the item being rendered or -1 if not set. More...
 
virtual void GetCurrentViewParams (ViewParams &vp)=0
 Retrieves the current view dependent parameters. More...
 
virtual void GetSubRendParams (SubRendParams &srp)=0
 Retrieves the sub-render parameters. More...
 
virtual int SubMtlIndex ()=0
 Returns the current sub material index or -1 if at node material level. More...
 
virtual void SetSubMtlIndex (int mindex)=0
 
virtual void FindMtlPlane (float pl[4])=0
 Computes the plane containing the current material or sub material. More...
 
virtual void FindMtlScreenBox (Rect &sbox, Matrix3 *viewTM=NULL, int mtlIndex=-1)=0
 This method computes the rectangle in screen space of the specified material. More...
 
virtual Box3 CameraSpaceBoundingBox ()=0
 
virtual Box3 ObjectSpaceBoundingBox ()=0
 
virtual Matrix3 ObjectToWorldTM ()=0
 
virtual RenderGlobalContextGetGlobalContext ()
 
virtual int Render (Bitmap *bm, ViewParams &vp, SubRendParams &srp, Point4 *clipPlanes=NULL, int nClipPlanes=0)=0
 Renders the scene and stores in the result into bm. More...
 
virtual INT_PTR Execute (int, ULONG_PTR=0, ULONG_PTR=0, ULONG_PTR=0)
 

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...
 

Constructor & Destructor Documentation

virtual ~RenderMapsContext ( )
inlinevirtual

Destructor.

36 { }

Member Function Documentation

virtual INode* GetNode ( )
pure virtual

Returns the INode pointer of the node being rendered.

This pointer allows a developer to access the properties of the node. See Class INode.

virtual int NodeRenderID ( )
pure virtual

Returns the node ID for the item being rendered or -1 if not set.

This ID is assigned when the scene is being rendered - each node is simply given an ID: 0, 1, 2, 3, etc. The NodeRenderID() is simply a number automatically assigned to every node being rendered so that they can be differentiated in texture maps such as the Auto-cubic, which needs to store a cubic map for each node it is applied to.

virtual void GetCurrentViewParams ( ViewParams vp)
pure virtual

Retrieves the current view dependent parameters.

Parameters:
ViewParams &vp

The ViewParams instance to update.
virtual void GetSubRendParams ( SubRendParams srp)
pure virtual

Retrieves the sub-render parameters.

Parameters:
SubRendParams &srp

The SubRendParams instance to update.
virtual int SubMtlIndex ( )
pure virtual

Returns the current sub material index or -1 if at node material level.

virtual void SetSubMtlIndex ( int  mindex)
pure virtual
virtual void FindMtlPlane ( float  pl[4])
pure virtual

Computes the plane containing the current material or sub material.

This is used by the Flat Mirror material.

Parameters:
float pl[4]

The plane containing the current material or sub material. The four float values in pl[4] represent the plane equation. If you call the four values A,B,C and D, then the plane equation of the plane is Ax + By + cZ + D = 0.
virtual void FindMtlScreenBox ( Rect sbox,
Matrix3 viewTM = NULL,
int  mtlIndex = -1 
)
pure virtual

This method computes the rectangle in screen space of the specified material.

This uses the viewTM, but assumes the remaining view params (devWidth, devHeight, devAspect, fov) are the same as the main render. This method is specific to the Flat Mirror material.

Parameters:
Rect &sbox

The resulting 2D box.

Matrix3* viewTM=NULL

The view matrix.

int mtlIndex=-1

The material index, or -1 if a node level material.
virtual Box3 CameraSpaceBoundingBox ( )
pure virtual
Remarks
This method computes the bounding box in camera space of the object associated with the reflection or refraction map being built in a call to a map's BuildMaps() method.
virtual Box3 ObjectSpaceBoundingBox ( )
pure virtual
Remarks
This method computes the bounding box in object space of the object associated with the reflection or refraction map being built in a call to a map's BuildMaps() method.
virtual Matrix3 ObjectToWorldTM ( )
pure virtual
Remarks
This method returns the object to world transformation.
virtual RenderGlobalContext* GetGlobalContext ( )
inlinevirtual
Remarks
Returns a pointer to a class that describes properties of the rendering environment.
95 { return NULL; }
#define NULL
Definition: autoptr.h:18
virtual int Render ( Bitmap bm,
ViewParams vp,
SubRendParams srp,
Point4 clipPlanes = NULL,
int  nClipPlanes = 0 
)
pure virtual

Renders the scene and stores in the result into bm.

Parameters:
Bitmap *bm

The Bitmap to render the result to. The properties of this bitmap define the properties of the render (such as the width and height).

ViewParams &vp

The ViewParams.

SubRendParams &srp

The SubRendParams.

Point4 *clipPlanes=NULL

This is a pointer to an array of Point4s, each of which represents a clip plane. If it is non-null, the renderer will clip all objects against these planes in addition to the normal left/right/top/bottom clipping. This is used by the Mirror material to clip away stuff that is behind the mirror. If not needed this may default to NULL.

int nClipPlanes=0

The number of clipping planes above. A maximum of 6 is possible.
Returns
Nonzero on success; otherwise zero.
virtual INT_PTR Execute ( int  ,
ULONG_PTR  = 0,
ULONG_PTR  = 0,
ULONG_PTR  = 0 
)
inlinevirtual
Remarks
This is a general purpose function that allows the API to be extended in the future. The 3ds Max development team can assign new cmd numbers and continue to add functionality to this class without having to 'break' the API.
Parameters:
int cmd

The index of the command to execute.

ULONG_PTR arg1=0

Optional argument 1. See the documentation where the cmd option is discussed for more details on these parameters.

ULONG_PTR arg2=0

Optional argument 2.

ULONG_PTR arg3=0

Optional argument 3.
Returns
An integer return value. See the documentation where the cmd option is discussed for more details on the meaning of this value.
130 { return 0; }