3ds Max C++ API Reference
MaterialRequiredStreamElement Struct Reference

This struct describes a single stream element that will be used by the hardware shader of a material. More...

#include <MaterialRequiredStreams.h>

+ Inheritance diagram for MaterialRequiredStreamElement:

Classes

union  DataUnion
 

Public Member Functions

DataBridgeAPI MaterialRequiredStreamElement ()
 
DataBridgeAPI MaterialRequiredStreamElement (const MaterialRequiredStreamElement &from)
 
DataBridgeAPI MaterialRequiredStreamElementoperator= (const MaterialRequiredStreamElement &from)
 
DataBridgeAPI ~MaterialRequiredStreamElement ()
 
DataBridgeAPI int Compare (const MaterialRequiredStreamElement &rhs) const
 Compare two MaterialRequiredStreamElement. More...
 
int GetChannelID () const
 Get the max channel id which record where is the element come from. More...
 
DataBridgeAPI VertexFieldType GetType () const
 Get the vertex field type of the stream element. More...
 
MeshChannelCategory GetChannelCategory () const
 Get the channel category of the stream element. More...
 
unsigned short GetUsageIndex () const
 Get the usage index of the stream element. More...
 
void SetChannelID (int maxMapChannel)
 Set the max channel id which record where is the element come from. More...
 
DataBridgeAPI void SetType (VertexFieldType type)
 Set the vertex element type. More...
 
void SetChannelCategory (MeshChannelCategory channelCategory)
 Set the channel category of the element. More...
 
void SetUsageIndex (unsigned short usageIndex)
 Set the usage index of the stream element. More...
 
DataBridgeAPI bool GetIsInstanceStream () const
 Get whether this stream contains instance data. More...
 
DataBridgeAPI void SetIsInstanceStream (bool value)
 Set whether this stream contains instance data. More...
 
DataBridgeAPI void SetOffset (unsigned short offset)
 
DataBridgeAPI unsigned short GetOffset () const
 
DataBridgeAPI void SetStreamIndex (unsigned char index)
 
DataBridgeAPI unsigned char GetStreamIndex () const
 
bool operator== (const MaterialRequiredStreamElement &rhs) const
 
bool operator!= (const MaterialRequiredStreamElement &rhs) const
 
bool operator< (const MaterialRequiredStreamElement &rhs) const
 
bool operator<= (const MaterialRequiredStreamElement &rhs) const
 
bool operator> (const MaterialRequiredStreamElement &rhs) const
 
bool operator>= (const MaterialRequiredStreamElement &rhs) const
 

Protected Attributes

DataUnion mData
 

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 struct describes a single stream element that will be used by the hardware shader of a material.

More specifically, it defines one input parameter of vertex shader. Based on the structure we know exactly how to bind a max mesh channel to a vertex shader input parameter.

Constructor & Destructor Documentation

◆ MaterialRequiredStreamElement() [1/2]

◆ MaterialRequiredStreamElement() [2/2]

◆ ~MaterialRequiredStreamElement()

Member Function Documentation

◆ operator=()

◆ Compare()

DataBridgeAPI int Compare ( const MaterialRequiredStreamElement rhs) const

Compare two MaterialRequiredStreamElement.

Parameters
rhsthe "right-hand-side" MaterialRequiredStreamElement of the compare function.
Returns
1 if this object is greater than rhs, -1 if this object is less than rhs, zero otherwise.

◆ GetChannelID()

int GetChannelID ( ) const
inline

Get the max channel id which record where is the element come from.

Remarks
this function is used for channels related to texture coordinates like uv, tangent and bitangent. Since a mesh may have multiple texture coordinates, this id is used to differentiate those coordinates. For other vertex buffers like position and normal, the channel id is zero.
Returns
the max channel id.
299 {
300  return (int)((unsigned int)(mData.mChannelId));
301 }
MAXMEM_EXTERN_C UtilExport int(__cdecl *MAX_heapchk)(void)
DataUnion mData
Definition: MaterialRequiredStreams.h:150
char mChannelId
Definition: MaterialRequiredStreams.h:139

◆ GetType()

DataBridgeAPI VertexFieldType GetType ( ) const

Get the vertex field type of the stream element.

Returns
the vertex field type.

◆ GetChannelCategory()

MeshChannelCategory GetChannelCategory ( ) const
inline

Get the channel category of the stream element.

Returns
the vertex channel category.
304 {
306 }
MeshChannelCategory
Indicates the data source of a vertex field of a mesh vertex buffer.
Definition: GeometryEnums.h:130
unsigned char mChannelCategory
Definition: MaterialRequiredStreams.h:145

◆ GetUsageIndex()

unsigned short GetUsageIndex ( ) const
inline

Get the usage index of the stream element.

Returns
the usage index.
309 {
310  return mData.mUsageIndex;
311 }
unsigned char mUsageIndex
Definition: MaterialRequiredStreams.h:142

◆ SetChannelID()

void SetChannelID ( int  maxMapChannel)
inline

Set the max channel id which record where is the element come from.

Parameters
maxMapChannelthe channel id.
314 {
315  mData.mChannelId = (char)maxMapChannel;
316 }

◆ SetType()

void SetType ( VertexFieldType  type)
inline

Set the vertex element type.

Parameters
typethe vertex element type.
319 {
320  mData.mFieldType = (unsigned char)type;
321 }
unsigned char mFieldType
Definition: MaterialRequiredStreams.h:144

◆ SetChannelCategory()

void SetChannelCategory ( MeshChannelCategory  channelCategory)
inline

Set the channel category of the element.

Parameters
channelCategorythe channel category of the element.
324 {
325  mData.mChannelCategory = (unsigned char)channelCategory;
326 }

◆ SetUsageIndex()

void SetUsageIndex ( unsigned short  usageIndex)
inline

Set the usage index of the stream element.

Parameters
usageIndexthe usage index of the stream element.
329 {
330  mData.mUsageIndex = (unsigned char)usageIndex;
331 }

◆ GetIsInstanceStream()

DataBridgeAPI bool GetIsInstanceStream ( ) const

Get whether this stream contains instance data.

Returns
true if it's a instance data stream

◆ SetIsInstanceStream()

DataBridgeAPI void SetIsInstanceStream ( bool  value)

Set whether this stream contains instance data.

Note: only the last vertex buffer of a vertex buffer array can be used for instancing and the instance streams should come after the geometry streams in the streams definition

Vertex data array need to have the instance stream at the end: [geometry stream 0] Positions, float3 [geometry stream 1] Vertex normals, float3 [geometry stream 2] UVs map channel 0, float2 (could be float3) ... [geometry stream n] [instance stream] (say : contains positions, UVs map channel 0 and colors overrides per instance in the same vertex buffer)

Vertex stream format array with instances streams at the end: [geometry stream 0 format] Positions, float3 [geometry stream 1 format] Vertex normals, float3 [geometry stream 2 format] UVs map channel 0, float2 (could be float3) ... [geometry stream n format] [instance format 0] (say positions) [instance format 1] (say UVs with an offset as sizeof(Point3) to skip the positions) [instance format 2] (say colors with an offset as sizeof(Point3)+sizeof(Point2 or Point3) to skip the positions and the UVs) See maxsdk\howto\Graphics\GPUParticle as an example about instancing

Parameters
valuetrue to indicate this is a instance stream

◆ SetOffset()

DataBridgeAPI void SetOffset ( unsigned short  offset)

◆ GetOffset()

DataBridgeAPI unsigned short GetOffset ( ) const

◆ SetStreamIndex()

DataBridgeAPI void SetStreamIndex ( unsigned char  index)

◆ GetStreamIndex()

DataBridgeAPI unsigned char GetStreamIndex ( ) const

◆ operator==()

bool operator== ( const MaterialRequiredStreamElement rhs) const
inline
335 {
336  return Compare(rhs) == 0;
337 }
DataBridgeAPI int Compare(const MaterialRequiredStreamElement &rhs) const
Compare two MaterialRequiredStreamElement.

◆ operator!=()

bool operator!= ( const MaterialRequiredStreamElement rhs) const
inline
341 {
342  return Compare(rhs) != 0;
343 }

◆ operator<()

bool operator< ( const MaterialRequiredStreamElement rhs) const
inline
347 {
348  return Compare(rhs) < 0;
349 }

◆ operator<=()

bool operator<= ( const MaterialRequiredStreamElement rhs) const
inline
353 {
354  return Compare(rhs) <= 0;
355 }

◆ operator>()

bool operator> ( const MaterialRequiredStreamElement rhs) const
inline
359 {
360  return Compare(rhs) > 0;
361 }

◆ operator>=()

bool operator>= ( const MaterialRequiredStreamElement rhs) const
inline
365 {
366  return Compare(rhs) >= 0;
367 }

Member Data Documentation

◆ mData

DataUnion mData
protected