Mesh Attributes Interfaces

About

The maxon::MeshAttributeClassInterface allows to implement a new mesh attribute. Such a mesh attribute describes any kind of data assigned to the points of a mesh or the polygon points of a mesh. Such data could be normal data, UV coordinates, vertex colors etc.

The data is stored in a CustomDataTag that also gives access to the data assigned to a specific polygon object. See CustomDataTag Manual.

The behaviour of this CustomDataTag is defined by implementing maxon::CustomDataTagClassInterface and maxon::CustomDataTagDisplayInterface.

MeshAttribute

A maxon::MeshAttribute represents the data assigned to a point or polygon point. It can be accessed from the CustomDataTag:

See CustomDataTag Manual.

Macros

A new mesh attribute is introduced by using the macro MAXON_MESHATTRIBUTE: The created data type name is the given name plus "_MESHATTRIBUTE"

// This example declares a new mesh attribute based on a Float value.
// declare mesh attribute
// declare corresponding data type
MAXON_DATATYPE(VERTEXSCALAR_MESHATTRIBUTE, "net.maxonexample.meshattribute.scalar");
Float64 Float
Definition: apibase.h:222
#define MAXON_DATATYPE(type, id)
Definition: datatype.h:295
#define MAXON_MESHATTRIBUTE(T, Name)
Definition: mesh_attribute_base.h:55
Note
The data type must be registered as usual. See MAXON Data Type.

MeshAttributeClassInterface

An implementation of maxon::MeshAttributeClassInterface defines how the custom mesh data should be interpolated. This allows to automatically calculate correct values for new points or polygons that are created in various modeling operations.

An implementation must be registered at CustomDataTagDisplayClasses.

The data type handled by this attribute is accessed with:

The interpolation of attribute values is defined with:

Further mathematical operations on the attribute values are defined with:

Note
Multiplication and division has to be implemented for both the operation on the data type itself and on a maxon::Float value.

CustomDataTagClassInterface

An implementation of maxon::CustomDataTagClassInterface defines how the CustomDataTag that stores the custom data should behave. Such an implementation can also be easily be written with the MAXON_CUSTOMDATATAG macro. maxon::CustomDataTagClassInterface is based on maxon::MeshAttributeClassInterface.

CustomDataTagDisplayInterface

An implementation of maxon::CustomDataTagDisplayInterface is optional. It defines how an internal scene hook should draw the attribute data in the viewport. An implementation must be registered at maxon::CustomDataTagDisplayClasses.

See also BaseView / BaseDraw Manual.

Further Reading