Mesh Attributes Interfaces

内容表

关于

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 :

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 MAXON_MESHATTRIBUTE ( maxon::Float , VERTEXSCALAR); // declare corresponding data type MAXON_DATATYPE (VERTEXSCALAR_MESHATTRIBUTE, "net.maxonexample.meshattribute.scalar" );

注意
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:

注意
Multiplication and division has to be implemented for both the operation on the data type itself and on a maxon::Float 值。

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 .

另请参阅 BaseView / BaseDraw Manual .

延伸阅读

MAXON_MESHATTRIBUTE
#define MAXON_MESHATTRIBUTE(T, Name)
定义: mesh_attribute_base.h:56
MAXON_DATATYPE
#define MAXON_DATATYPE(type, id)
定义: datatype.h:309
maxon::Float
Float64 Float
定义: apibase.h:193

Copyright  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1