3ds Max C++ API Reference
HWTupleMesh Class Reference

This class is a container for vertex and index buffers. More...

#include <HWMesh.h>

+ Inheritance diagram for HWTupleMesh:

Public Member Functions

DllExport HWTupleMesh (DWORD vertexType)
 Constructor. More...
 
DllExport ~HWTupleMesh ()
 Destructor. More...
 
DllExport unsigned int Size ()
 Returns the size of the buffers in bytes.
More...
 
DllExport HWVertexBufferGetHWVertexBuffer ()
 This returns the hw vertex buffer for this hw mesh. More...
 
DllExport unsigned int AddHWIndexBuffer (unsigned int numberPrimitives, PrimitiveType primitive, bool use16Bit)
 This lets you add a index buffer to the mesh. More...
 
DllExport HWIndexBufferGetHWIndexBuffer (unsigned int id)
 This returns a particular index buffer.
More...
 
DllExport bool ReleaseHWIndexBuffer (unsigned int id)
 This lets you delete a particular index buffer. It returns true if successful. More...
 
DllExport unsigned int GetHWIndexCount ()
 This returns the number of index buffers. More...
 
DllExport DWORD GetMatID ()
 This lets you get the material id for this mesh. More...
 
DllExport void SetMatID (DWORD matID)
 This lets you set the material id for this mesh. More...
 
DllExport void SetGFXMesh (IHWSubMesh *msh)
 This lets you set the IHWDrawMesh asssociated with this mesh.
More...
 
DllExport IHWSubMeshGetGFXMesh ()
 This lets you get the IHWDrawMesh asssociated with this mesh. More...
 
DllExport void UpdateVertexBuffer (Point3 *vertexList, Point3 *gfxNormalList, Point3 *faceNormalList, BitArray &changedVerts, int count)
 This allows you to update the buffers. 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 a container for vertex and index buffers.

This class is a container for vertex and index buffers. It represents mesh that has one material on it. It allows you to generate buffers and fill them out. It has one vertex buffer and 2 index buffers, one for the shaded mesh and one for the wire frame.

Constructor & Destructor Documentation

◆ HWTupleMesh()

DllExport HWTupleMesh ( DWORD  vertexType)

Constructor.

Parameters
vertexTypeis the vertex type ie Pos|Normals|UVWs etc that this mesh will use. See HWVertex.h, enum VertexType for the list of supported types

◆ ~HWTupleMesh()

Destructor.

Member Function Documentation

◆ Size()

DllExport unsigned int Size ( )

Returns the size of the buffers in bytes.

◆ GetHWVertexBuffer()

DllExport HWVertexBuffer* GetHWVertexBuffer ( )

This returns the hw vertex buffer for this hw mesh.

Typical usage it to create the mesh. Get the hw vertex buffer, set it parameters, create it, then fill it out.

◆ AddHWIndexBuffer()

DllExport unsigned int AddHWIndexBuffer ( unsigned int  numberPrimitives,
PrimitiveType  primitive,
bool  use16Bit 
)

This lets you add a index buffer to the mesh.

We support 2 index buffer per mesh so that different draw primtives can share the same vertex buffer. The first is the shaded face buffer the second is the wire frame line list. It returns the id of this index buffer

Parameters
numberPrimitivesis the number of primitives ie triangleList, lineList etc for this buffer
primitiveis the type of primitive it is ie trianglelist, linelist etc.
use16Bitis whether the buffer buffer will be 16 bit or 32 bit indices

◆ GetHWIndexBuffer()

DllExport HWIndexBuffer* GetHWIndexBuffer ( unsigned int  id)

This returns a particular index buffer.

◆ ReleaseHWIndexBuffer()

DllExport bool ReleaseHWIndexBuffer ( unsigned int  id)

This lets you delete a particular index buffer. It returns true if successful.

◆ GetHWIndexCount()

DllExport unsigned int GetHWIndexCount ( )

This returns the number of index buffers.

◆ GetMatID()

DllExport DWORD GetMatID ( )

This lets you get the material id for this mesh.

This lets you associate the mesh with a material. We only allow one material per mesh.

◆ SetMatID()

DllExport void SetMatID ( DWORD  matID)

This lets you set the material id for this mesh.

This lets you get the associate material for this mesh. We only allow one material per mesh.

◆ SetGFXMesh()

DllExport void SetGFXMesh ( IHWSubMesh msh)

This lets you set the IHWDrawMesh asssociated with this mesh.

The IHWDrawMesh contains the low level hardware buffers specific to the current device ie Direct9, 10, OGL etc

◆ GetGFXMesh()

DllExport IHWSubMesh* GetGFXMesh ( )

This lets you get the IHWDrawMesh asssociated with this mesh.

The IHWDrawMesh contains the low level hardware buffers specific to the current device ie Direct9, 10, OGL etc

◆ UpdateVertexBuffer()

DllExport void UpdateVertexBuffer ( Point3 vertexList,
Point3 gfxNormalList,
Point3 faceNormalList,
BitArray changedVerts,
int  count 
)

This allows you to update the buffers.

This allows you to change the position and normals of the mesh without recreating the hwmesh.

Parameters
vertexListThis is a pointer of all the vertices on the mesh
gfxNormalListThis is a pointer of all the gfx normals on the mesh
faceNormalListThis is a pointer of all the face normals on the mesh
changedVertsThis is a bitarray of the changed verts
countThis is number of vertices in vertex List