3ds Max C++ API Reference
MeshEdgeConsolidationItemDX11 Class Reference

This class collects mesh edge render items and build hardware buffers for them. More...

#include <MeshEdgeRenderItem.h>

+ Inheritance diagram for MeshEdgeConsolidationItemDX11:

Classes

struct  ConsolidationData
 

Public Member Functions

DefaultRenderItemAPI MeshEdgeConsolidationItemDX11 (bool bFixedSize, bool bBackfaceCull)
 Constructor. More...
 
virtual DefaultRenderItemAPI ~MeshEdgeConsolidationItemDX11 ()
 
virtual DefaultRenderItemAPI void Realize (DrawContext &drawContext)
 This function creates hardware buffers if any of the items are dirty. More...
 
virtual DefaultRenderItemAPI void Display (DrawContext &drawContext)
 This function renders the mesh edges. More...
 
virtual DefaultRenderItemAPI size_t GetPrimitiveCount () const
 Return number of triangles(not edges) in this item. More...
 
virtual DefaultRenderItemAPI void ClearSourceItems ()
 This function clears all line data comes from AddSourceItem() More...
 
virtual DefaultRenderItemAPI bool AddSourceItem (ICustomRenderItemPtr &pSourceItem, DrawContext &dc)
 This function handle pSourceItem which has same consolidation key. More...
 
- Public Member Functions inherited from ICustomRenderItem
virtual void HitTest (HitTestContext &, DrawContext &drawContext)
 This function is called in a hit test pass. More...
 
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 ()
 

Protected Member Functions

virtual DefaultRenderItemAPI void BuildIndexBuffer ()
 
virtual DefaultRenderItemAPI void BuildVertexBuffer (DrawContext &drawContext)
 
- 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

size_t mCull0Count
 number of triangles that have edge 0 invisible More...
 
size_t mCull01Count
 number of triangles that have edge 0 and 1 invisible More...
 
size_t mNoCullingCount
 number of triangles that all edges are visible More...
 
size_t mPrimitiveCount
 number of triangle count in total More...
 
bool mbFixedSize
 whether the item needs to recalculate mesh size every frame More...
 
bool mbBackfaceCull
 whether enable back-face cull More...
 
bool mbIsDirty
 dirty flag More...
 
MaxSDK::Array< ConsolidationDatamDataArray
 
MaterialRequiredStreams mFormat
 
VertexBufferHandleArray mMeshVB
 
IndexBufferHandle mNoCullingIdx
 index array which contains triangles that all edges are visible More...
 
IndexBufferHandle mCull0Idx
 index array which contains triangles that only edge 0 is invisible More...
 
IndexBufferHandle mCull01Idx
 index array which contains triangles that edge 0 and 1 are invisible More...
 
MaxSDK::Graphics::RasterizerState mRasterState
 wireframe render state More...
 
- Protected Attributes inherited from BaseInterfaceServer
Tab< BaseInterface * > interfaces
 

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

This class collects mesh edge render items and build hardware buffers for them.

It also uses a shader to do hardware edge culling. With this shader, we can do efficient edge back-face cull.

Constructor & Destructor Documentation

◆ MeshEdgeConsolidationItemDX11()

DefaultRenderItemAPI MeshEdgeConsolidationItemDX11 ( bool  bFixedSize,
bool  bBackfaceCull 
)

Constructor.

Parameters
bFixedSizewhether this item recalculate mesh size frame-by-frame
bBackfaceCullwhether this item enables back-face cull

◆ ~MeshEdgeConsolidationItemDX11()

284 {}

Member Function Documentation

◆ BuildIndexBuffer()

virtual DefaultRenderItemAPI void BuildIndexBuffer ( )
protectedvirtual

◆ BuildVertexBuffer()

virtual DefaultRenderItemAPI void BuildVertexBuffer ( DrawContext drawContext)
protectedvirtual

◆ Realize()

virtual DefaultRenderItemAPI void Realize ( DrawContext drawContext)
virtual

This function creates hardware buffers if any of the items are dirty.

Parameters
drawContextdraw context used by the function

Implements ICustomRenderItem.

Reimplemented in MeshEdgeConsolidationItemDX9.

◆ Display()

virtual DefaultRenderItemAPI void Display ( DrawContext drawContext)
virtual

This function renders the mesh edges.

Parameters
drawContextdraw context used by the functions

Implements ICustomRenderItem.

Reimplemented in MeshEdgeConsolidationItemDX9.

◆ GetPrimitiveCount()

virtual DefaultRenderItemAPI size_t GetPrimitiveCount ( ) const
inlinevirtual

Return number of triangles(not edges) in this item.

Implements ICustomRenderItem.

298 {return mPrimitiveCount;}
size_t mPrimitiveCount
number of triangle count in total
Definition: MeshEdgeRenderItem.h:249

◆ ClearSourceItems()

virtual DefaultRenderItemAPI void ClearSourceItems ( )
virtual

This function clears all line data comes from AddSourceItem()

Implements IConsolidationRenderItem.

◆ AddSourceItem()

virtual DefaultRenderItemAPI bool AddSourceItem ( ICustomRenderItemPtr pSourceItem,
DrawContext dc 
)
virtual

This function handle pSourceItem which has same consolidation key.

Parameters
pSourceIteman instance of MeshRenderItem
dcdraw context of the incoming item

Implements IConsolidationRenderItem.

Member Data Documentation

◆ mCull0Count

size_t mCull0Count
protected

number of triangles that have edge 0 invisible

◆ mCull01Count

size_t mCull01Count
protected

number of triangles that have edge 0 and 1 invisible

◆ mNoCullingCount

size_t mNoCullingCount
protected

number of triangles that all edges are visible

◆ mPrimitiveCount

size_t mPrimitiveCount
protected

number of triangle count in total

◆ mbFixedSize

bool mbFixedSize
protected

whether the item needs to recalculate mesh size every frame

◆ mbBackfaceCull

bool mbBackfaceCull
protected

whether enable back-face cull

◆ mbIsDirty

bool mbIsDirty
protected

dirty flag

◆ mDataArray

MaxSDK::Array<ConsolidationData> mDataArray
protected

◆ mFormat

MaterialRequiredStreams mFormat
protected

◆ mMeshVB

VertexBufferHandleArray mMeshVB
protected

◆ mNoCullingIdx

IndexBufferHandle mNoCullingIdx
protected

index array which contains triangles that all edges are visible

◆ mCull0Idx

IndexBufferHandle mCull0Idx
protected

index array which contains triangles that only edge 0 is invisible

◆ mCull01Idx

IndexBufferHandle mCull01Idx
protected

index array which contains triangles that edge 0 and 1 are invisible

◆ mRasterState

MaxSDK::Graphics::RasterizerState mRasterState
protected

wireframe render state