3ds Max C++ API Reference
DrawContext Class Referenceabstract

Typically ICustomRenderItem::Draw() and ICustomRenderItem::HitTest() bring instance of this class as parameter. More...

#include <DrawContext.h>

+ Inheritance diagram for DrawContext:

Public Member Functions

virtual const Matrix44GetWorldMatrix () const =0
 Get current world matrix Note: If you want change the world matrix, you must first copy it to another instance, then apply the world matrix via SetWorldMatrix(). More...
 
virtual void SetWorldMatrix (const Matrix44 &matrix)=0
 Set current world matrix Note: If you want change the world matrix, you must first copy it to another instance, then apply the world matrix via SetWorldMatrix(). More...
 
virtual void SetWorldMatrix (const Matrix3 &matrix)=0
 Set current world matrix /param matrix new world matrix. More...
 
virtual const Matrix44GetViewMatrix () const =0
 Get current view matrix Note: If you want change the view matrix, you must first copy it to another instance, then apply the view matrix via SetViewMatrix(). More...
 
virtual void SetViewMatrix (const Matrix44 &matrix)=0
 Set current world matrix Note: If you want change the world matrix, you must first copy it to another instance, then apply the world matrix via SetWorldMatrix(). More...
 
virtual const Matrix44GetProjectionMatrix () const =0
 Get current projection matrix Note: If you want change the projection matrix, you must first copy it to another instance, then apply the projection matrix via SetProjectionatrix(). More...
 
virtual void SetProjectionMatrix (const Matrix44 &matrix)=0
 Set current projection matrix Note: If you want change the projection matrix, you must first copy it to another instance, then apply the projection matrix via SetProjectionatrix(). More...
 
virtual IVirtualDeviceGetVirtualDevice ()=0
 Get virtual device Note: Don't store the virtual device on client side. More...
 
virtual INodeGetCurrentNode ()=0
 Get current INode object /return INode object. More...
 
virtual int GetExtendedDisplayMode () const =0
 Get node's extended display mode /return extended display mode flag from node. More...
 
virtual const ViewExpGetViewExp () const =0
 Get current ViewExp Note: Legacy GraphicsWindow object also available in the ViewExp. More...
 
virtual const MaxSDK::Graphics::BaseMaterialHandleGetMaterial () const =0
 Get current material handle /return current material handle Note: the handle might be invalid. More...
 
virtual int GetFrameStamp ()=0
 Get current frame stamp return current frame stamp. More...
 
virtual TimeValue GetTime () const =0
 Get current animation time return current animation time. More...
 
virtual bool GetAlphaTestEnabled () const =0
 Get the alpha test enabled flag. More...
 
virtual void SetAlphaTestEnabled (bool value)=0
 Set the alpha test enabled flag. More...
 
virtual CompareFunction GetAlphaTestFunction ()=0
 Gets the alpha test comparison function. More...
 
virtual void SetAlphaTestFunction (CompareFunction value)=0
 Sets the alpha test comparison function. More...
 
virtual float GetAlphaTestReference () const =0
 Gets the alpha test reference value. More...
 
virtual void SetAlphaTestReference (float value)=0
 Sets the alpha test reference value. More...
 
virtual const MaxSDK::Graphics::IViewportViewSettingGetViewportSettings () const =0
 Gets viewport settings /return viewport settings. More...
 
virtual bool IsHitTest () const =0
 Get if this draw context is used for hit test /return true if the draw context is used for hit test pass. More...
 

Protected Member Functions

virtual ~DrawContext ()
 

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

Typically ICustomRenderItem::Draw() and ICustomRenderItem::HitTest() bring instance of this class as parameter.

It contains the complete state of a single item being drawn all system supplied variables are contained here, for example, current virtual device and matrices. Developers may need these information to determine Display and HitTest code paths.

Constructor & Destructor Documentation

◆ ~DrawContext()

virtual ~DrawContext ( )
inlineprotectedvirtual
31 {}

Member Function Documentation

◆ GetWorldMatrix()

virtual const Matrix44& GetWorldMatrix ( ) const
pure virtual

Get current world matrix Note: If you want change the world matrix, you must first copy it to another instance, then apply the world matrix via SetWorldMatrix().

/return current world matrix.

◆ SetWorldMatrix() [1/2]

virtual void SetWorldMatrix ( const Matrix44 matrix)
pure virtual

Set current world matrix Note: If you want change the world matrix, you must first copy it to another instance, then apply the world matrix via SetWorldMatrix().

/param matrix new world matrix.

◆ SetWorldMatrix() [2/2]

virtual void SetWorldMatrix ( const Matrix3 matrix)
pure virtual

Set current world matrix /param matrix new world matrix.

◆ GetViewMatrix()

virtual const Matrix44& GetViewMatrix ( ) const
pure virtual

Get current view matrix Note: If you want change the view matrix, you must first copy it to another instance, then apply the view matrix via SetViewMatrix().

/return current view matrix.

◆ SetViewMatrix()

virtual void SetViewMatrix ( const Matrix44 matrix)
pure virtual

Set current world matrix Note: If you want change the world matrix, you must first copy it to another instance, then apply the world matrix via SetWorldMatrix().

/param matrix new world matrix.

◆ GetProjectionMatrix()

virtual const Matrix44& GetProjectionMatrix ( ) const
pure virtual

Get current projection matrix Note: If you want change the projection matrix, you must first copy it to another instance, then apply the projection matrix via SetProjectionatrix().

/return current projection matrix.

◆ SetProjectionMatrix()

virtual void SetProjectionMatrix ( const Matrix44 matrix)
pure virtual

Set current projection matrix Note: If you want change the projection matrix, you must first copy it to another instance, then apply the projection matrix via SetProjectionatrix().

/param matrix new projection matrix.

◆ GetVirtualDevice()

virtual IVirtualDevice& GetVirtualDevice ( )
pure virtual

Get virtual device Note: Don't store the virtual device on client side.

You should always use the virtual device in the pipeline context. Because in DX11 multi-thread environment, the device may different in each call. /return virtual device.

◆ GetCurrentNode()

virtual INode* GetCurrentNode ( )
pure virtual

Get current INode object /return INode object.

◆ GetExtendedDisplayMode()

virtual int GetExtendedDisplayMode ( ) const
pure virtual

Get node's extended display mode /return extended display mode flag from node.

◆ GetViewExp()

virtual const ViewExp* GetViewExp ( ) const
pure virtual

Get current ViewExp Note: Legacy GraphicsWindow object also available in the ViewExp.

But we recommend to use new VirtualDevice object to do rendering task. /return ViewExp object

◆ GetMaterial()

virtual const MaxSDK::Graphics::BaseMaterialHandle& GetMaterial ( ) const
pure virtual

Get current material handle /return current material handle Note: the handle might be invalid.

Which means current item don't have material.

◆ GetFrameStamp()

virtual int GetFrameStamp ( )
pure virtual

Get current frame stamp return current frame stamp.

◆ GetTime()

virtual TimeValue GetTime ( ) const
pure virtual

Get current animation time return current animation time.

◆ GetAlphaTestEnabled()

virtual bool GetAlphaTestEnabled ( ) const
pure virtual

Get the alpha test enabled flag.

The default value is false (disabled). /return current alpha test flag. True means enabled, false means disabled.

◆ SetAlphaTestEnabled()

virtual void SetAlphaTestEnabled ( bool  value)
pure virtual

Set the alpha test enabled flag.

The default value is false (disabled). /param value new alpha test flag. True means enabled, false means disabled.

◆ GetAlphaTestFunction()

virtual CompareFunction GetAlphaTestFunction ( )
pure virtual

Gets the alpha test comparison function.

The default value is CompareFunctionAlways. /return current alpha test comparison function.

◆ SetAlphaTestFunction()

virtual void SetAlphaTestFunction ( CompareFunction  value)
pure virtual

Sets the alpha test comparison function.

The default value is CompareFunctionAlways. /param value the new alpha test comparison function.

◆ GetAlphaTestReference()

virtual float GetAlphaTestReference ( ) const
pure virtual

Gets the alpha test reference value.

The default value is 0.0f. /return alpha test reference value.

◆ SetAlphaTestReference()

virtual void SetAlphaTestReference ( float  value)
pure virtual

Sets the alpha test reference value.

The value must be in the range [0.0, 1.0]. /param value new alpha test reference value

◆ GetViewportSettings()

virtual const MaxSDK::Graphics::IViewportViewSetting* GetViewportSettings ( ) const
pure virtual

Gets viewport settings /return viewport settings.

◆ IsHitTest()

virtual bool IsHitTest ( ) const
pure virtual

Get if this draw context is used for hit test /return true if the draw context is used for hit test pass.