3ds Max C++ API Reference
HWVertex Class Reference

This class is used to help with managing hardware(hw) vertex buffer. More...

#include <HWVertex.h>

+ Inheritance diagram for HWVertex:

Public Member Functions

DllExport HWVertex (DWORD vType)
 Constructor. More...
 
DllExport HWVertex ()
 
DllExport ~HWVertex ()
 
DllExport void SetVertexType (DWORD vType)
 Lets you set the vertex type ie whether it is just a pos, pos+normal, pos+normal+UVW0 etc. More...
 
DllExport DWORD GetVertexType ()
 Lets you get the vertex type. More...
 
DllExport void SetUVWSize (unsigned int id, unsigned int size)
 This sets the size of each UVW channel. More...
 
DllExport unsigned int GetUVWSize (unsigned int id)
 This gets the size of a specific UVW channel. More...
 
DllExport void SetBuffer (BYTE *vertexBuffer)
 This lets you map the hw vertex to a buffer. More...
 
DllExport unsigned int GetStride ()
 Returns the stride of the hw vertex in bytes. More...
 
DllExport Point3 GetPos ()
 Gets the Position component if there is one
More...
 
DllExport void SetPos (Point3 p)
 Sets the Position component if there is one. More...
 
DllExport Point3GetPosPtr ()
 Returns the pointer to position portion of the vertex
More...
 
DllExport Point3 GetNormal ()
 Gets the Normal component if there is one. More...
 
DllExport void SetNormal (Point3 p)
 Sets the Normal component if there is one. More...
 
DllExport Point3GetNormalPtr ()
 Returns the pointer to normal portion of the vertex
More...
 
DllExport unsigned int GetMaxVC ()
 Returns the maximum number of supported color channel. More...
 
DllExport DWORD GetVC (unsigned int id)
 gets the color component if there is one (RBGA byte format) More...
 
DllExport void SetVC (unsigned int id, DWORD c)
 sets the color component if there is one (RBGA byte format) More...
 
DllExport DWORD * GetVCPtr (unsigned int id)
 Returns the pointer to vertex color portion of the vertex
More...
 
DllExport unsigned int GetMaxUVW ()
 Returns the maximum number of supported UVW/texture channel
More...
 
DllExport float * GetUVW (unsigned int id)
 Gets sets the UVW component if there is one returning *float to the start of the uwv coord. More...
 
DllExport void SetUVW (unsigned int id, float *uv)
 Sets sets the UVW component if there is one returning *float to the start of the uwv coord. More...
 
DllExport Point3 GetTangent ()
 gets the Tangent component if there is one More...
 
DllExport Point3GetTangentPtr ()
 gets the pointer Tangent component if there is one More...
 
DllExport void SetTangent (Point3 p)
 sets the Tangent component if there is one More...
 
DllExport Point3 GetBinormal ()
 gets the BiNormal component if there is one More...
 
DllExport Point3GetBinormalPtr ()
 gets the pointer BiNormal component if there is one More...
 
DllExport void SetBinormal (Point3 p)
 sets the BiNormal component if there is one More...
 
DllExport void CopyDataFrom (HWVertex &hwVertSource)
 This lets you copy the vertex data from another vertex. More...
 
DllExport BYTE * GetRawBufferPointer ()
 Returns a raw pointer the vertex buffer
More...
 

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 is used to help with managing hardware(hw) vertex buffer.

It is not designed to be used as representation of an entire vertex buffer but used to map into an existing buffer.

Constructor & Destructor Documentation

◆ HWVertex() [1/2]

DllExport HWVertex ( DWORD  vType)

Constructor.

Parameters
[in]vTypethe description of the HW vertex which can be any combination of VertexType

◆ HWVertex() [2/2]

◆ ~HWVertex()

Member Function Documentation

◆ SetVertexType()

DllExport void SetVertexType ( DWORD  vType)

Lets you set the vertex type ie whether it is just a pos, pos+normal, pos+normal+UVW0 etc.

Parameters
[in]vTypethe description of the HW vertex which can be any combination of VertexType

◆ GetVertexType()

DllExport DWORD GetVertexType ( )

Lets you get the vertex type.

◆ SetUVWSize()

DllExport void SetUVWSize ( unsigned int  id,
unsigned int  size 
)

This sets the size of each UVW channel.

By default a UVW channel is 2 floats just UV. You can change the size to just a U, UV, or UVW with this. This must be set before accessing any of the vertex data or calling SetBuffer

Parameters
[in]idwhich channel
[in]sizethe size of the channel 1 to 3

◆ GetUVWSize()

DllExport unsigned int GetUVWSize ( unsigned int  id)

This gets the size of a specific UVW channel.

By default a UVW channel is 2 floats just UV. You can change the size to just a U, UV, or UVW with this.

Parameters
[in]idwhich channel

◆ SetBuffer()

DllExport void SetBuffer ( BYTE *  vertexBuffer)

This lets you map the hw vertex to a buffer.

Note you need to call SetUVWSize first before calling this if you want to change the UVW channel sizes

Parameters
[in]vertexBufferthe buffer that you want to map onto

◆ GetStride()

DllExport unsigned int GetStride ( )

Returns the stride of the hw vertex in bytes.

◆ GetPos()

DllExport Point3 GetPos ( )

Gets the Position component if there is one

◆ SetPos()

DllExport void SetPos ( Point3  p)

Sets the Position component if there is one.

Parameters
[in]pthe new position value

◆ GetPosPtr()

DllExport Point3* GetPosPtr ( )

Returns the pointer to position portion of the vertex

◆ GetNormal()

DllExport Point3 GetNormal ( )

Gets the Normal component if there is one.

◆ SetNormal()

DllExport void SetNormal ( Point3  p)

Sets the Normal component if there is one.

Parameters
[in]pthe new normal value

◆ GetNormalPtr()

DllExport Point3* GetNormalPtr ( )

Returns the pointer to normal portion of the vertex

◆ GetMaxVC()

DllExport unsigned int GetMaxVC ( )

Returns the maximum number of supported color channel.

◆ GetVC()

DllExport DWORD GetVC ( unsigned int  id)

gets the color component if there is one (RBGA byte format)

Parameters
[in]idis which channel to get set

◆ SetVC()

DllExport void SetVC ( unsigned int  id,
DWORD  c 
)

sets the color component if there is one (RBGA byte format)

Parameters
[in]idis which channel to get set
[in]cis the color in RBGA byte format

◆ GetVCPtr()

DllExport DWORD* GetVCPtr ( unsigned int  id)

Returns the pointer to vertex color portion of the vertex

◆ GetMaxUVW()

DllExport unsigned int GetMaxUVW ( )

Returns the maximum number of supported UVW/texture channel

◆ GetUVW()

DllExport float* GetUVW ( unsigned int  id)

Gets sets the UVW component if there is one returning *float to the start of the uwv coord.

Parameters
[in]idis which channel to get set

◆ SetUVW()

DllExport void SetUVW ( unsigned int  id,
float *  uv 
)

Sets sets the UVW component if there is one returning *float to the start of the uwv coord.

Parameters
[in]idis which channel to get set
[in]uvthe uv data to set

◆ GetTangent()

DllExport Point3 GetTangent ( )

gets the Tangent component if there is one

◆ GetTangentPtr()

DllExport Point3* GetTangentPtr ( )

gets the pointer Tangent component if there is one

◆ SetTangent()

DllExport void SetTangent ( Point3  p)

sets the Tangent component if there is one

Parameters
[in]pthe tangent value

◆ GetBinormal()

DllExport Point3 GetBinormal ( )

gets the BiNormal component if there is one

◆ GetBinormalPtr()

DllExport Point3* GetBinormalPtr ( )

gets the pointer BiNormal component if there is one

◆ SetBinormal()

DllExport void SetBinormal ( Point3  p)

sets the BiNormal component if there is one

Parameters
[in]pthe BiNormal value

◆ CopyDataFrom()

DllExport void CopyDataFrom ( HWVertex hwVertSource)

This lets you copy the vertex data from another vertex.

Parameters
[in]hwVertSourcethis is the vertex that you want to copy from

◆ GetRawBufferPointer()

DllExport BYTE* GetRawBufferPointer ( )

Returns a raw pointer the vertex buffer