MeshAttributeClassInterface Class Reference

#include <mesh_attribute_base.h>

Inheritance diagram for MeshAttributeClassInterface:

Detailed Description

By implementing this interface, it is possible to define a new mesh attribute type so that a data type can be attached to mesh vertices or to mesh polyvertices. The interface needs to be implemented with the data type description, which has to be registered using MAXON_MESHATTRIBUTE and MAXON_DATATYPE, and all arithmetic and comparison functions.

Public Member Functions

const MAXON_METHOD DataTypeGetDataType () const
 
MAXON_METHOD void InterpolateLinear (void *data1, const void *data2, Float blend) const
 
MAXON_METHOD void InterpolateInOutline (void *data, const Block< void * > &outline, const Block< Float > &weights) const
 
MAXON_METHOD void GetDefaultValue (void *data) const
 
MAXON_METHOD Bool AtrLessThen (const void *data1, const void *data2) const
 
MAXON_METHOD Bool AtrIsEqual (const void *data1, const void *data2) const
 
MAXON_METHOD void AtrAdd (void *data1, const void *data2) const
 
MAXON_METHOD void AtrSubstract (void *data1, const void *data2) const
 
MAXON_METHOD void AtrMultiply (void *data1, const void *data2) const
 
MAXON_METHOD void AtrMultiply (void *data, Float value) const
 
MAXON_METHOD void AtrDivide (void *data1, const void *data2) const
 
MAXON_METHOD void AtrDivide (void *data, Float value) const
 
MAXON_METHOD String AtrToString (const void *data, const FormatStatement *formatStatement) const
 

Private Member Functions

 MAXON_INTERFACE (MeshAttributeClassInterface, MAXON_REFERENCE_CONST, "net.maxon.mesh_misc.interface.meshattributeclass")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( MeshAttributeClassInterface  ,
MAXON_REFERENCE_CONST  ,
"net.maxon.mesh_misc.interface.meshattributeclass"   
)
private

◆ GetDataType()

const MAXON_METHOD DataType& GetDataType ( ) const

Returns the DataType this class manages, e.g. Vector2d32 for UV maps.

Returns
The DataType.

◆ InterpolateLinear()

MAXON_METHOD void InterpolateLinear ( void *  data1,
const void *  data2,
Float  blend 
) const

Interpolates linearly between two values. Both addresses need to be cast to the appropriate data type.

Parameters
[in,out]data1The address of the first value. The value will be overwritten with the result.
[in]data2The address of the second value.
[in]blendThe blend percentage [0.0..blend..1.0]

◆ InterpolateInOutline()

MAXON_METHOD void InterpolateInOutline ( void *  data,
const Block< void * > &  outline,
const Block< Float > &  weights 
) const

Interpolates a value in the outline using the specified weights. The addresses in data and outline need to be cast to the appropriate data type.

Parameters
[in,out]dataThe address of the value. The value will be overwritten with the result.
[in]outlineThe outline data used to perform the interpolation.
[in]weightsWeights to be used for the interpolation, represent the interpolation distance from each outline edge.

◆ GetDefaultValue()

MAXON_METHOD void GetDefaultValue ( void *  data) const

Returns the default value for this attribute. The caller owns the passed pointer.

Parameters
[out]dataA pointer filled with the default value.

◆ AtrLessThen()

MAXON_METHOD Bool AtrLessThen ( const void *  data1,
const void *  data2 
) const

Compares two data values for "less than". In most cases this returns the MeshAttributeClassInterface::GetDataType()Compare() but the developer is free to customize comparison if needed.

Parameters
[in]data1First data to compare.
[in]data2Second data to compare.
Returns
True if the content of data1 is smaller then data2.

◆ AtrIsEqual()

MAXON_METHOD Bool AtrIsEqual ( const void *  data1,
const void *  data2 
) const

Compares two data values for equality. In most of cases just returns the MeshAttributeClassInterface::GetDataType()IsEqual() but the developer is free to customize comparison if needed.

Parameters
[in]data1First data to compare.
[in]data2Second data to compare.
Returns
True if the content of data1 is equal to data2.

◆ AtrAdd()

MAXON_METHOD void AtrAdd ( void *  data1,
const void *  data2 
) const

Defines how to add two data values.

Parameters
[in,out]data1The address of the first value. The value will be overwritten with the result.
[in]data2The address of the second value.

◆ AtrSubstract()

MAXON_METHOD void AtrSubstract ( void *  data1,
const void *  data2 
) const

Defines how to subtract two data values.

Parameters
[in,out]data1The address of the first value. The value will be overwritten with the result.
[in]data2The address of the second value.

◆ AtrMultiply() [1/2]

MAXON_METHOD void AtrMultiply ( void *  data1,
const void *  data2 
) const

Defines how to multiply two data values.

Parameters
[in,out]data1The address of the first value. The value will be overwritten with the result.
[in]data2The address of the second value.

◆ AtrMultiply() [2/2]

MAXON_METHOD void AtrMultiply ( void *  data,
Float  value 
) const

Defines how to multiply a data value by a float value.

Parameters
[in,out]dataThe address of the data value. The value will be overwritten with the result.
[in]valueThe value to be used for the multiplication.

◆ AtrDivide() [1/2]

MAXON_METHOD void AtrDivide ( void *  data1,
const void *  data2 
) const

Defines how to divide two data values.

Parameters
[in,out]data1The address of the first value. The value will be overwritten with the result.
[in]data2The address of the second value.

◆ AtrDivide() [2/2]

MAXON_METHOD void AtrDivide ( void *  data,
Float  value 
) const

Defines how to divide a data value by a float value.

Parameters
[in,out]dataThe address of the data value. The value will be overwritten with the result.
[in]valueThe value to be used for the division.

◆ AtrToString()

MAXON_METHOD String AtrToString ( const void *  data,
const FormatStatement formatStatement 
) const

Returns a readable string of the content of a data pointer.

Parameters
[in,out]dataThe address of the data value.
[in]formatStatementNullptr or additional formatting instructions. Currently no additional formatting instructions are supported.
Returns
The converted result.