3ds Max C++ API Reference
MarkerRenderItem Class Reference

Base class for marker render items. More...

#include <MarkerRenderItem.h>

+ Inheritance diagram for MarkerRenderItem:

Public Member Functions

DefaultRenderItemAPI MarkerRenderItem ()
 
virtual DefaultRenderItemAPI ~MarkerRenderItem ()
 
DefaultRenderItemAPI bool DirtyFlag ()
 Return dirty status of this item. More...
 
DefaultRenderItemAPI void ClearDirty ()
 Sets dirty status of this item. More...
 
virtual DefaultRenderItemAPI void Realize (DrawContext &drawContext)
 Default realize function. More...
 
virtual DefaultRenderItemAPI void Display (DrawContext &drawContext)
 Default display function This class is used for immediate consolidation. More...
 
virtual DefaultRenderItemAPI void HitTest (HitTestContext &hittestContext, DrawContext &drawContext)
 Hit Test function for this render item Since the markers 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 primitive count of this item. More...
 
DefaultRenderItemAPI bool HasData ()
 Return whether this item contains marker data Empty item will be skipped when consolidation. More...
 
DefaultRenderItemAPI void AddMarkers (MaxSDK::Array< Point3 > &positionArray, MaxSDK::Array< DWORD > &colorArray, MaxSDK::Array< int > &markerTypeArray)
 Add marker data by array The position array and color array must has same length. More...
 
DefaultRenderItemAPI void AddMarkers (const Point3 *positionArray, const Color *colorArray, const MarkerType type, size_t count)
 Add marker data by raw pointers with custom color. More...
 
DefaultRenderItemAPI void AddMarkers (const Point3 *positionArray, const Color &color, const MarkerType type, size_t count)
 Add marker data by raw pointers, with same color for all markers. More...
 
DefaultRenderItemAPI void ClearMarkers ()
 Clear marker data. More...
 
DefaultRenderItemAPI MaxSDK::Array< Point3 > & GetPositionArray ()
 Get position array. More...
 
DefaultRenderItemAPI MaxSDK::Array< DWORD > & GetColorArray ()
 Get color array. 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 ()
 

Protected Attributes

MaxSDK::Array< Point3mPositionArray
 
MaxSDK::Array< DWORD > mColorArray
 
VertexBufferHandleArray mMarkerVB
 
bool mbIsDirty
 
- 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...
 
- 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 ()
 

Detailed Description

Base class for marker render items.

This class is also an alternate solution for marker functions in GraphicsWindow. Usually plugins needs to inherit this class and implement Realize() function to generate marker data unless the plugin has static data that never changes after creation. This class is designed for simple marker data that can be immediate consolidated. So it actually doesn't need to implement Display() fucntion because the display part is handled by MarkerConsolidationItem. This item simply store data in system memory arrays, which has fast read performance.

If plugin's data like particle system is too complex and can't be generated in real time, we suggest the plugin to implements both Realize() and Display() functions. Then use a non-immediate consolidation strategy. So that the complex marker item won't slow down other marker items. A reference complexity of the marker item is if it has more than 1K markers, we suggest to disable immediate consolidation.

Constructor & Destructor Documentation

◆ MarkerRenderItem()

◆ ~MarkerRenderItem()

virtual DefaultRenderItemAPI ~MarkerRenderItem ( )
virtual

Member Function Documentation

◆ DirtyFlag()

DefaultRenderItemAPI bool DirtyFlag ( )
inline

Return dirty status of this item.

Returns
true if dirty, false if not
127 {return mbIsDirty;}
bool mbIsDirty
Definition: MarkerRenderItem.h:118

◆ ClearDirty()

DefaultRenderItemAPI void ClearDirty ( )
inline

Sets dirty status of this item.

130 {mbIsDirty = false;}

◆ Realize()

virtual DefaultRenderItemAPI void Realize ( DrawContext drawContext)
virtual

Default realize function.

Plugins should implement Realize() function to handle object changes. In this function, plugins need to fill position, color and index buffers, and set mbIsDirty to true to notify consolidation item.

Parameters
drawContext

Implements ICustomRenderItem.

◆ Display()

virtual DefaultRenderItemAPI void Display ( DrawContext drawContext)
virtual

Default display function This class is used for immediate consolidation.

So it doesn't need display function.

Parameters
drawContext

Implements ICustomRenderItem.

◆ HitTest()

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

Hit Test function for this render item Since the markers 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
inlinevirtual

Get primitive count of this item.

Returns
primitive count of this item

Implements ICustomRenderItem.

157 {return mPositionArray.lengthUsed();}
size_t lengthUsed() const
Returns the number of elements used (as opposed to simply allocated/reserved) in the array.
Definition: Array.inline.h:169
MaxSDK::Array< Point3 > mPositionArray
Definition: MarkerRenderItem.h:115

◆ HasData()

DefaultRenderItemAPI bool HasData ( )
inline

Return whether this item contains marker data Empty item will be skipped when consolidation.

Returns
true if there's marker data. Otherwise false.
163 {return mPositionArray.length() > 0;}
size_t length() const
Returns the number of used elements (as opposed to simply allocated/reserved) in the array.
Definition: Array.inline.h:159

◆ AddMarkers() [1/3]

DefaultRenderItemAPI void AddMarkers ( MaxSDK::Array< Point3 > &  positionArray,
MaxSDK::Array< DWORD > &  colorArray,
MaxSDK::Array< int > &  markerTypeArray 
)

Add marker data by array The position array and color array must has same length.

Parameters
positionArrayarray contains marker position data
colorArrayarray contains DWORD color data. Can be generated by Color.toRGB().
markerTypeArrayarray of MarkerType.

◆ AddMarkers() [2/3]

DefaultRenderItemAPI void AddMarkers ( const Point3 positionArray,
const Color colorArray,
const MarkerType  type,
size_t  count 
)

Add marker data by raw pointers with custom color.

Parameters
positionArraypointers of position data
colorArraypointers of color data.
typeMarker type
countnumber of positions to add.

◆ AddMarkers() [3/3]

DefaultRenderItemAPI void AddMarkers ( const Point3 positionArray,
const Color color,
const MarkerType  type,
size_t  count 
)

Add marker data by raw pointers, with same color for all markers.

Parameters
positionArraypointers of position data
colorreference of color data.
typeMarker type
countnumber of positions to add.

◆ ClearMarkers()

DefaultRenderItemAPI void ClearMarkers ( )

Clear marker data.

◆ GetPositionArray()

DefaultRenderItemAPI MaxSDK::Array<Point3>& GetPositionArray ( )
inline

Get position array.

Returns
position array
196 {return mPositionArray;}

◆ GetColorArray()

DefaultRenderItemAPI MaxSDK::Array<DWORD>& GetColorArray ( )
inline

Get color array.

Returns
color array
201 {return mColorArray;}
MaxSDK::Array< DWORD > mColorArray
Definition: MarkerRenderItem.h:116

Member Data Documentation

◆ mPositionArray

MaxSDK::Array<Point3> mPositionArray
protected

◆ mColorArray

MaxSDK::Array<DWORD> mColorArray
protected

◆ mMarkerVB

VertexBufferHandleArray mMarkerVB
protected

◆ mbIsDirty

bool mbIsDirty
protected