MfxMesh

This document currently is a largely undocumented draft so it is more informational to refer to the C API at the moment: OpenMfx API Reference.

class MfxMesh : public MfxBase

Mesh data coming from an input or being sent to an output. The instance of this class like all classes from this API except the structs whose name ends with “Props” does not actually contain data, it is only a reference and can hence be freely copied around without worrying about memory usage. You MUST call Release once and only once though.

Public Functions

bool IsValid() const

A mesh may be invalid if its parent input is not connected to any incoming link. If this returns false, none of the other methods must be called.

void FetchProperties(MfxMeshProps &props)

Populate the provided props structure with this mesh’s properties

void FetchTransform(double **matrix)

Populate the provided pointer to float array with this mesh’s transform matrix. Requires to have called RequestTransform during the describe action

MfxAttribute GetAttribute(MfxAttributeAttachment attachment, const char *name)

Get an attribute of an input or output mesh. The returned MfxAttribute can be used to get the data buffer and extra information like type, component count, stride, etc. Get*Attribute methods are shortcuts for the different values allowed for the attachment argument.

MfxAttribute GetPointAttribute(const char *name)
MfxAttribute GetCornerAttribute(const char *name)
MfxAttribute GetFaceAttribute(const char *name)
MfxAttribute GetMeshAttribute(const char *name)
bool HasAttribute(MfxAttributeAttachment attachment, const char *name)

Tells whether an attribute exists in the input or output mesh. Has*Attribute methods are shortcuts for the different values allowed for the attachment argument.

bool HasPointAttribute(const char *name)
bool HasCornerAttribute(const char *name)
bool HasFaceAttribute(const char *name)
bool HasMeshAttribute(const char *name)
void Release()

Always call this at some point, don’t use the object afterwise. (This is not in the dtor because there may be copies of the instance but Release must be called only once)

MfxAttribute AddAttribute(MfxAttributeAttachment attachment, const char *name, int componentCount, MfxAttributeType type, MfxAttributeSemantic semantic = MfxAttributeSemantic::None)

Define a new attribute on an output mesh. The returned MfxAttribute can be used to set additionnal properties such has whether the data is “owned” or borrowed/forwarded from an input. Add*Attribute methods are shortcuts for the different values allowed for the attachment argument.

Call

only for output meshes and before allocation:
See

attributeDefine from ofxMeshEffect.h for more information.

TODO: Have the type argument use MfxAttributeType enum as defined in MfxAttributeProps.h

MfxAttribute AddPointAttribute(const char *name, int componentCount, MfxAttributeType type, MfxAttributeSemantic semantic = MfxAttributeSemantic::None)
MfxAttribute AddCornerAttribute(const char *name, int componentCount, MfxAttributeType type, MfxAttributeSemantic semantic = MfxAttributeSemantic::None)
MfxAttribute AddFaceAttribute(const char *name, int componentCount, MfxAttributeType type, MfxAttributeSemantic semantic = MfxAttributeSemantic::None)
MfxAttribute AddMeshAttribute(const char *name, int componentCount, MfxAttributeType type, MfxAttributeSemantic semantic = MfxAttributeSemantic::None)
void Allocate(int pointCount, int cornerCount, int faceCount, bool noLooseEdge = true, int constantFaceSize = -1)

Allocate memory for new owned attributes according to the previously called AddAttribute and likes. Non own attributes are attributes pointing to externally allocated memory (for instance memory buffers forwarded from the input) and will hence not be newly allocate. Call only for output meshes.