Public Member Functions

RenderMapsContext Class Reference

Search for all occurrences

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

#include <render.h>

Inheritance diagram for RenderMapsContext:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual  ~RenderMapsContext ()
  Destructor.
virtual INode GetNode ()=0
  Returns the INode pointer of the node being rendered.
virtual int  NodeRenderID ()=0
  Returns the node ID for the item being rendered or -1 if not set.
virtual void  GetCurrentViewParams (ViewParams &vp)=0
  Retrieves the current view dependent parameters.
virtual void  GetSubRendParams (SubRendParams &srp)=0
  Retrieves the sub-render parameters.
virtual int  SubMtlIndex ()=0
  Returns the current sub material index or -1 if at node material level.
virtual void  SetSubMtlIndex (int mindex)=0
virtual void  FindMtlPlane (float pl[4])=0
  Computes the plane containing the current material or sub material.
virtual void  FindMtlScreenBox (Rect &sbox, Matrix3 *viewTM=NULL, int mtlIndex=-1)=0
  This method computes the rectangle in screen space of the specified material.
virtual Box3  CameraSpaceBoundingBox ()=0
virtual Box3  ObjectSpaceBoundingBox ()=0
virtual Matrix3  ObjectToWorldTM ()=0
virtual RenderGlobalContext GetGlobalContext ()
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.
virtual INT_PTR  Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)

Constructor & Destructor Documentation

virtual ~RenderMapsContext ( ) [inline, virtual]

Destructor.

{ }

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 ( ) [inline, virtual]
Remarks:
Returns a pointer to a class that describes properties of the rendering environment.
{ return NULL; }
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 revised parameter is available in release 2.0 and later only.

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

This parameter is available in release 2.0 and later only.

The number of clipping planes above. A maximum of 6 is possible.
Returns:
Nonzero on success; otherwise zero.
virtual INT_PTR Execute ( int  cmd,
ULONG_PTR  arg1 = 0,
ULONG_PTR  arg2 = 0,
ULONG_PTR  arg3 = 0 
) [inline, virtual]
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.
{ return 0; } 

RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext
RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext RenderMapsContext