MfxMesh

This document currently is a largely undocumented draft so it is more informational to refer to the C API at the moment: Open Mesh Effect 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

void FetchProperties(MfxMeshProps &props)

Populate the provided props structure with this mesh’s properties

MfxAttribute GetAttribute(const char *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 GetVertexAttribute(const char *name)
MfxAttribute GetFaceAttribute(const char *name)
MfxAttribute GetMeshAttribute(const char *name)
bool HasAttribute(const char *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 HasVertexAttribute(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(const char *attachment, const char *name, int componentCount, const char *type, const char *semantic = NULL)

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.

MfxAttribute AddPointAttribute(const char *name, int componentCount, const char *type, const char *semantic = NULL)
MfxAttribute AddVertexAttribute(const char *name, int componentCount, const char *type, const char *semantic = NULL)
MfxAttribute AddFaceAttribute(const char *name, int componentCount, const char *type, const char *semantic = NULL)
MfxAttribute AddMeshAttribute(const char *name, int componentCount, const char *type, const char *semantic = NULL)
void Allocate(int pointCount, int vertCount, int faceCount, bool noLooseEdge = true, int constantFaceCount = -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.