#include <mesh.h>
This class is used for per -'something' floating-point information.
For example, it is used with Meshes to keep track of such per-vertex information as weighted (Affect Region or Soft) selections and vertex weights. It is used in MNMesh to store per-edge data (edge weights). Currently there's only one "type" of data supported, floating point values, but this may be extended in the future. PerData arrays in Meshes and MNMeshes cannot be reserved for plug-ins at this time; 3ds Max maintains the list in MESH.H of the reserved vertex data channels, and in MNMESH.H for the MNEdge data channels. The methods of this class are deliberately made to look like Tab<> methods. All methods of this class are implemented by the system.
Public Member Functions | |
PerData () | |
Constructor. More... | |
PerData (int n, int tp) | |
Constructor. More... | |
~PerData () | |
Destructor. More... | |
DllExport void * | AllocData (int num) |
Allocates and returns a pointer to an array of floats of the specified size. More... | |
DllExport void | FreeData (void *addr) |
Deletes the specified array of floats. More... | |
DllExport int | DataSize () |
Returns the number of bytes used by the base data type for the vertex data. More... | |
void * | Addr (void *ptr, int at) |
Returns the address of the specified element in the array passed. More... | |
void * | Addr (int at) |
Returns the address of the specified element in the data array. More... | |
DllExport void | CopyData (void *to, void *from, int num=1) |
Copies the specified number of elements between the two data arrays. More... | |
DllExport void | CopyData (int to, int from, int num=1) |
Copies the specified number of elements between the two specified locations in the data array. More... | |
DllExport void | WeightedSum (void *to, void *fr1, float prop1, void *fr2, float prop2) |
Computes the weighted sum of the arguments passed. More... | |
DllExport void | WeightedSum (int to, int fr1, float prop1, int fr2, float prop2) |
Computes the weighted sum of the arguments passed. More... | |
DllExport void | setAlloc (int num, BOOL keep=TRUE) |
Sets the number of elements allocated in the data array. More... | |
void | SetCount (int num, BOOL keep=FALSE) |
Sets the number of elements allocated in the data array and sets the dnum member to num. More... | |
void | Shrink () |
Reduces the size of the data array to contain dnum elements. More... | |
int | Count () |
Returns the number of elements used (dnum) More... | |
DllExport void | Clear () |
Clears (deletes) any allocated data and sets the count and type to 0. More... | |
DllExport void | DeleteSet (BitArray del) |
Removes any element whose corresponding element in the BitArray is not set. More... | |
DllExport void | Delete (int at, int num) |
Deletes the specified number of elements from the specified location in the data array. More... | |
DllExport void | Insert (int at, int num, void *el) |
Inserts the specified number of data elements into the specified location in the data array. More... | |
DllExport void | Append (int num, void *el) |
Appends the specified elements to the data array. More... | |
DllExport void | InsertCopies (int at, int num, void *el) |
Inserts the specified number of elements into the data array at the given location. More... | |
DllExport void | AppendCopies (int num, void *el) |
Appends the specified number of elements to the data array. More... | |
DllExport void | SwapContents (PerData &from) |
Swaps the contents of this PerData object and the specified one. More... | |
DllExport PerData & | operator= (const PerData &from) |
Assignment operator. More... | |
DllExport void | MyDebugPrint () |
Public Attributes | |
int | dnum |
The number of elements of per-vertex data. More... | |
int | type |
The type of data held by this class. More... | |
int | alloc |
The number of elements currently allocated in the data array. More... | |
void * | data |
Points to the actual data. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from MaxHeapOperators | |
static UtilExport void * | operator new (size_t size) |
Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | operator new[] (size_t size, int block_type, const char *filename, int line) |
New operator used to allocate arrays of objects. More... | |
static UtilExport void * | operator 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 void * | operator 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 void * | operator 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 void * | operator 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 void * | aligned_malloc (size_t size, size_t alignment) |
Allocates memory on a specified alignment boundary. More... | |
static UtilExport void * | aligned_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... | |
|
inline |
Constructor.
The number of elements is set to 0, the type is set to 0 and the data pointer is set to NULL.
Constructor.
n | The number of elements to allocate. |
tp | The type to set. |
|
inline |
Destructor.
Any allocated data is freed and the count and type are set to 0.
Allocates and returns a pointer to an array of floats of the specified size.
num | The number of floats to allocate. |
Deletes the specified array of floats.
addr | Pointer to the array of floats to free. |
Returns the number of bytes used by the base data type for the vertex data.
This is only implemented for a type of VDATA_TYPE_FLOAT in which case it returns sizeof(float). Other cases simply return 0.
Returns the address of the specified element in the array passed.
ptr | The array whose at-th element address is returned. |
at | The zero based index of the element. |
Returns the address of the specified element in the data array.
at | The zero based index of the element. |
Copies the specified number of elements between the two data arrays.
to | Points to the destination data array. |
from | Points to the source data array. |
num | The number of elements to copy. |
Copies the specified number of elements between the two specified locations in the data array.
to | The zero based index into the data array of the destination. |
from | The zero based index into the data array of the source. |
num | The number of elements to copy. |
Computes the weighted sum of the arguments passed.
This is effectively c = a*prop1 + b*prop2. This is used, for example, in splitting an edge, where we would want to interpolate the vertex weight values from the edge's endpoints to create the weight for the new vertex.
to | A pointer to the location in which the result should be stored. |
fr1 | A pointer to the first value to be summed. |
prop1 | The weight given to the first value. |
fr2 | A pointer to the second value. |
prop2 | The weight given to the second value. |
Computes the weighted sum of the arguments passed.
This is similar to the method above except to, fr1, and fr2 are indices of the values in the PerData array. That is, PerData::WeightedSum (c, a, prop1, b, prop2), where a, b, and c are ints between 0 and PerData::dnum-1, is equivalent to the call PerData::WeightedSum (PerData::Addr(c), PerData::Addr(a), prop1, PerData::Addr(b), prop2).
to | The index in the PerData array of the location in which the result should be stored. |
fr1 | The index of the first value to be summed in the PerData array. |
prop1 | The weight given to the first value. |
fr2 | The index of the second value to be summed in the PerData array. |
prop2 | The weight given to the second value. |
Sets the number of elements allocated in the data array.
num | The number of elements to allocate. |
keep | If TRUE previous values are kept (copied to the new storage); otherwise they are discarded. Defaults to TRUE. |
Sets the number of elements allocated in the data array and sets the dnum member to num.
num | The number of elements to allocate. |
keep | If TRUE previous values are kept (copied to the new storage); otherwise they are discarded. Defaults to FALSE. |
|
inline |
Reduces the size of the data array to contain dnum elements.
|
inline |
Returns the number of elements used (dnum)
Removes any element whose corresponding element in the BitArray is not set.
del | Specifies which elements to delete. Data elelemts corresponding to bits that are on remain; for bits that are off the elements are deleted. |
Deletes the specified number of elements from the specified location in the data array.
at | The location to delete elements. |
num | The number of elements to delete. |
Inserts the specified number of data elements into the specified location in the data array.
at | The zero based index of the location for the insert. |
num | The number of elements to insert. |
el | The data to insert. |
Appends the specified elements to the data array.
num | The number of elements to append. |
el | The data to append. |
Inserts the specified number of elements into the data array at the given location.
at | The zero based index of the location to insert the data. |
num | The number of elements to insert. |
el | The data to insert. |
Appends the specified number of elements to the data array.
num | The number of elements to append. |
el | The data to append. |
Swaps the contents of this PerData object and the specified one.
from | The object to swap with. |
Assignment operator.
from | The VertexData source. |
int dnum |
The number of elements of per-vertex data.
int type |
The type of data held by this class.
int alloc |
The number of elements currently allocated in the data array.
void* data |
Points to the actual data.