3ds Max C++ API Reference
MeshEdgeRenderItem Class Reference

This class is designed for small meshes that only renders edge element. More...

#include <MeshEdgeRenderItem.h>

+ Inheritance diagram for MeshEdgeRenderItem:

Public Member Functions

DefaultRenderItemAPI MeshEdgeRenderItem (Mesh *pMesh, bool fixedSize, bool copyMesh)
 Constructor. More...
 
virtual DefaultRenderItemAPI ~MeshEdgeRenderItem ()
 
DefaultRenderItemAPI DWORD CheckFlags (DWORD flag)
 Return value of the flag. More...
 
DefaultRenderItemAPI void ClearFlags (DWORD flag)
 Set the specified flag to 0. More...
 
DefaultRenderItemAPI void SetFlags (DWORD flag)
 Set the specified flag to 1. More...
 
DefaultRenderItemAPI void SetBackfaceCull (bool value)
 Set back-face cull status of the item Note this value must same as key's back-face cull value. More...
 
DefaultRenderItemAPI bool GetBackfaceCull ()
 Get back-face cull status. More...
 
DefaultRenderItemAPI void GetEdgeList (Edge *&pEdgeOut, size_t &count)
 Get mesh edge list. More...
 
DefaultRenderItemAPI void SetColor (Color &color)
 Set color of the edges. More...
 
DefaultRenderItemAPI Color GetColor ()
 Get the color of edges. More...
 
DefaultRenderItemAPI MeshGetMesh ()
 Get the mesh used by render item. More...
 
virtual DefaultRenderItemAPI void Realize (DrawContext &drawContext)
 Build mesh data used by consolidation. More...
 
virtual DefaultRenderItemAPI void Display (DrawContext &drawContext)
 Dummy Display() function Since MeshEdgeRenderItem is a immediate consolidation item, display is handled by consolidation item. More...
 
virtual DefaultRenderItemAPI void HitTest (HitTestContext &hittestContext, DrawContext &drawContext)
 Hit Test function for this render item Since the meshes are always rendered by consolidation item, in the render item's hit test function we need to build separate data to draw the item. More...
 
virtual DefaultRenderItemAPI size_t GetPrimitiveCount () const
 Get number of primitives contained by this item. More...
 
virtual DefaultRenderItemAPI void SetMeshIsInvalid ()
 When the Mesh is shared by several classes, use this method to set it as invalid, meaning it should not be used any more. More...
 
- Public Member Functions inherited from ICustomRenderItem
virtual void OnHit (HitTestContext &, DrawContext &)
 This function will be called when the render item is hit. More...
 
- Public Member Functions inherited from ARefObject
GraphicsUtilityAPI ARefObject ()
 
virtual GraphicsUtilityAPI long AddRef ()
 from IRefObject, see comments in IRefObject More...
 
virtual GraphicsUtilityAPI long Release ()
 decrease reference count of this object by one, if the decreased reference count equals zero, the object will be deleted. More...
 
GraphicsUtilityAPI IRefObjectQueryInterface (Interface_ID classID)
 Try query an interface from the ref object using a given interface id. More...
 
- Public Member Functions inherited from IRefObject
GraphicsUtilityAPI IRefObject ()
 
virtual GraphicsUtilityAPI ~IRefObject ()
 
- Public Member Functions inherited from BaseInterfaceServer
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
virtual UtilExport int NumInterfaces () const
 
virtual UtilExport BaseInterfaceGetInterfaceAt (int i) const
 
virtual UtilExport ~BaseInterfaceServer ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Friends

class MeshEdgeConsolidationItemDX11
 

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...
 
- Protected Member Functions inherited from ARefObject
virtual GraphicsUtilityAPI void DeleteThis ()
 This function will be called when the reference count of an ARefObject equals zero. More...
 
virtual GraphicsUtilityAPI ~ARefObject ()
 
- Protected Member Functions inherited from Noncopyable
 Noncopyable ()
 
 ~Noncopyable ()
 
- Protected Attributes inherited from BaseInterfaceServer
Tab< BaseInterface * > interfaces
 

Detailed Description

This class is designed for small meshes that only renders edge element.

This use case is typically used by gizmos like dummy, lights which originally uses mesh.render with GW_EDGES_ONLY flag to draw edges. The back-face cull calculation is done by software under DX9 and using hardware shader under DX11.

Constructor & Destructor Documentation

◆ MeshEdgeRenderItem()

DefaultRenderItemAPI MeshEdgeRenderItem ( Mesh pMesh,
bool  fixedSize,
bool  copyMesh 
)

Constructor.

Parameters
pMeshmesh to display
fixedSizeindicate whether this item's mesh has fixed size on the screen
copyMeshwhether to make a copy of the mesh. If true, the item will manage the copied new mesh's life time. If the mesh is created on the stack and released after constructing the item, plugin needs to set this flag true to make sure the mesh is still available when realizing.

◆ ~MeshEdgeRenderItem()

Member Function Documentation

◆ CheckFlags()

DefaultRenderItemAPI DWORD CheckFlags ( DWORD  flag)

Return value of the flag.

Parameters
flagspecifies the flag to set

◆ ClearFlags()

DefaultRenderItemAPI void ClearFlags ( DWORD  flag)

Set the specified flag to 0.

Parameters
flagthe flag to clear

◆ SetFlags()

DefaultRenderItemAPI void SetFlags ( DWORD  flag)

Set the specified flag to 1.

Parameters
flagthe flag to set

◆ SetBackfaceCull()

DefaultRenderItemAPI void SetBackfaceCull ( bool  value)

Set back-face cull status of the item Note this value must same as key's back-face cull value.

Otherwise this item might be consolidated by incorrect consolidation item.

Parameters
valuetrue to enable back-face cull. false to disable.

◆ GetBackfaceCull()

DefaultRenderItemAPI bool GetBackfaceCull ( )

Get back-face cull status.

Returns
back-face cull status of the item

◆ GetEdgeList()

DefaultRenderItemAPI void GetEdgeList ( Edge *&  pEdgeOut,
size_t count 
)

Get mesh edge list.

Parameters
[out]pEdgeOutedge list of the mesh
[out]countnumber of data in the array

◆ SetColor()

DefaultRenderItemAPI void SetColor ( Color color)

Set color of the edges.

Parameters
colorcolor the the edges

◆ GetColor()

Get the color of edges.

Returns
color of the edge

◆ GetMesh()

DefaultRenderItemAPI Mesh* GetMesh ( )

Get the mesh used by render item.

Returns
pointer of the mesh

◆ Realize()

virtual DefaultRenderItemAPI void Realize ( DrawContext drawContext)
virtual

Build mesh data used by consolidation.

Implements ICustomRenderItem.

◆ Display()

virtual DefaultRenderItemAPI void Display ( DrawContext drawContext)
virtual

Dummy Display() function Since MeshEdgeRenderItem is a immediate consolidation item, display is handled by consolidation item.

This function should never be called.

Implements ICustomRenderItem.

◆ HitTest()

virtual DefaultRenderItemAPI void HitTest ( HitTestContext hittestContext,
DrawContext drawContext 
)
virtual

Hit Test function for this render item Since the meshes are always rendered by consolidation item, in the render item's hit test function we need to build separate data to draw the item.

Parameters
hittestContext
drawContext

Reimplemented from ICustomRenderItem.

◆ GetPrimitiveCount()

virtual DefaultRenderItemAPI size_t GetPrimitiveCount ( ) const
virtual

Get number of primitives contained by this item.

Returns
edge count of the mesh

Implements ICustomRenderItem.

◆ SetMeshIsInvalid()

virtual DefaultRenderItemAPI void SetMeshIsInvalid ( )
virtual

When the Mesh is shared by several classes, use this method to set it as invalid, meaning it should not be used any more.

Friends And Related Function Documentation

◆ MeshEdgeConsolidationItemDX11

friend class MeshEdgeConsolidationItemDX11
friend