Skip to content
Permalink
Browse files

Add support for arbitrary point/vertex/face attributes

  • Loading branch information
eliemichel committed Feb 8, 2020
1 parent 6498c2c commit 099d4a3ab80999ae73eb71dc7a3cb0baaefc33d3
Showing with 165 additions and 40 deletions.
  1. +3 −7 include/ofxCore.h
  2. +162 −33 include/ofxMeshEffect.h
@@ -957,15 +957,11 @@ General status codes start at 1 and continue until 999
}
#endif

/** @mainpage Open Mesh Effect: An open plug-in API for cross-software procedural mesh effects
/** @mainpage OFX : Open Plug-Ins For Special Effects
This page represents the automatically extracted HTML documentation of the source headers for the OFX Mesh Effect API. The documentation was extracted by doxygen (http://www.doxygen.org). It breaks documentation into sets of pages, use the links at the top of this page (marked 'Modules', 'Compound List' and especially 'File List' etcc) to browse through the doc.
This page represents the automatically extracted HTML documentation of the source headers for the OFX Image Effect API. The documentation was extracted by doxygen (http://www.doxygen.org). It breaks documentation into sets of pages, use the links at the top of this page (marked 'Modules', 'Compound List' and especially 'File List' etcc) to browse through the OFX doc.
The original source files and examples are available at https://github.com/eliemichel/OpenMeshEffect .
It is recommended to first read the OpenFX core documentation (no need to dive too much into the Image Effect part, though): http://openeffects.org/documentation/reference/ .
Then, the specificities of the Mesh Effect API can be found in \ref OfxMeshEffectSuiteV1 or \ref MeshEffectPropDefines for example.
A more complete reference manual is http://openfx.sourceforge.net .
*/

@@ -4,7 +4,7 @@
/*
Software License :
Copyright (c) 2019, Elie Michel. All rights reserved.
Copyright (c) 2019 - 2020, Elie Michel. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -60,6 +60,10 @@ typedef struct OfxMeshEffectStruct *OfxMeshEffectHandle;
*/
typedef struct OfxMeshInputStruct *OfxMeshInputHandle;

/** @brief Blind declaration of an OFX geometry data
*/
typedef struct OfxMeshStruct *OfxMeshHandle;

/** @brief Use to define the generator mesh effect context See \ref ::kOfxMeshEffectPropContext */
#define kOfxMeshEffectContextGenerator "OfxMeshEffectContextGenerator"

@@ -77,6 +81,51 @@ typedef struct OfxMeshInputStruct *OfxMeshInputHandle;
*/
#define kOfxMeshMainOutput "OfxMeshMainOutput"

/**
\defgroup MeshAttrib attachements
Mesh attributes can be attached to either points, vertices, faces or the whole mesh. Mandatory
attributes include a position for points, a point index for vertices and a vertex count for faces.
*/
/*@{*/
/** @brief Mesh attribute attachement to points
*/
#define kOfxMeshAttribPoint "OfxMeshAttribPoint"

/** @brief Mesh attribute attachement to vertex
*/
#define kOfxMeshAttribVertex "OfxMeshAttribVertex"

/** @brief Mesh attribute attachement to faces
*/
#define kOfxMeshAttribFace "OfxMeshAttribFace"

/** @brief Mesh attribute attachement to the whole mesh
*/
#define kOfxMeshAttribMesh "OfxMeshAttribMesh"

/** @brief Name of the point attribut for position
*/
#define kOfxMeshAttribPointPosition "OfxMeshAttribPointPosition"

/** @brief Name of the vertex attribut for point index
*/
#define kOfxMeshAttribVertexPoint "OfxMeshAttribVertexPoint"

/** @brief Name of the face attribut for vertex count
*/
#define kOfxMeshAttribFaceCounts "OfxMeshAttribFaceCounts"

/** @brief Attribute type integer 32 bit
*/
#define kOfxMeshAttribTypeInt "OfxMeshAttribTypeInt"

/** @brief Attribute type float 32 bit
*/
#define kOfxMeshAttribTypeFloat "OfxMeshAttribTypeFloat"

/*@}*/

/**
\addtogroup ActionsAll
*/
@@ -276,32 +325,44 @@ This property is the number of faces allocated in the mesh object.
*/
#define kOfxMeshPropFaceCount "OfxMeshPropFaceCount"

/** @brief The point data pointer of a mesh.
/** @brief The number of attribtues in a mesh
- Type - pointer X 1
- Type - integer X 1
- Property Set - a mesh instance (read only)
This property contains a pointer to memory where mesh point data is stored
*/
#define kOfxMeshPropPointData "OfxMeshPropPointData"
This property is the number of attribtues stored in the mesh object. Attributes can be attached to
either points, vertices, faces or the whole mesh. There are at least three attributes in a geometry
namely the point's position, the vertex' point association and the face's vertex count.
*/
#define kOfxMeshPropAttributeCount "OfxMeshPropAttributeCount"

/** @brief The vertex data pointer of a mesh.
/** @brief The data pointer of an attribute.
- Type - pointer X 1
- Property Set - a mesh instance (read only)
This property contains a pointer to memory where mesh vertex data is stored
This property contains a pointer to memory where attribute data is stored, whose size depend on the
attribute attachement (point/vertex/face/mesh) and attribute type (int, float, vector, etc.)
*/
#define kOfxMeshPropVertexData "OfxMeshPropVertexData"
#define kOfxMeshAttribPropData "OfxMeshAttribPropData"

/** @brief The face data pointer of a mesh.
/** @brief The number of components an attribute.
- Type - pointer X 1
- Property Set - a mesh instance (read only)
- Type - int X 1
- Property Set - a mesh attribute (read only)
An attribute can have between 1 and 4 components.
*/
#define kOfxMeshAttribPropComponentCount "OfxMeshAttribPropComponentCount"

This property contains a pointer to memory where mesh face data is stored
/** @brief The type of an attribute.
- Type - string X 1
- Property Set - a mesh attribute (read only)
An attribute can have type kOfxMeshAttribTypeFloat or kOfxMeshAttribTypeInt
*/
#define kOfxMeshPropFaceData "OfxMeshPropFaceData"
#define kOfxMeshAttribPropType "OfxMeshAttribPropType"

/*@}*/
/*@}*/
@@ -406,23 +467,24 @@ typedef struct OfxMeshEffectSuiteV1 {
/** @brief Retrieves the property set for a given input
\arg input input effect to get the property set for
\arg propHandle pointer to a the property set handle, value is returned hier
\arg propHandle pointer to a the property set handle, value is returned here
The property handle is valid for the lifetime of the input, which is generally the lifetime of the instance.
@returns
- ::kOfxStatOK - the property set was found and returned
- ::kOfxStatErrBadHandle - if the paramter handle was invalid
- ::kOfxStatErrBadHandle - if the input handle was invalid
- ::kOfxStatErrUnknown - if the type is unknown
*/
OfxStatus (*inputGetPropertySet)(OfxMeshInputHandle input,
OfxPropertySetHandle *propHandle);

/** @brief Get a handle for a mesh in an input at the indicated time
\arg input - the input to extract the mesh from
\arg time - time to fetch the mesh at
\arg meshHandle - property set containing the mesh's data
\arg input - the input to extract the mesh from
\arg time - time to fetch the mesh at
\arg meshHandle - mesh containing the mesh's data
\arg propertySet - property set containing the mesh properties (may be NULL)
A mesh is fetched from an input at the indicated time and returned in the meshHandle.
@@ -445,7 +507,8 @@ If inputGetMesh is called twice with the same parameters, then two separate mesh
*/
OfxStatus (*inputGetMesh)(OfxMeshInputHandle input,
OfxTime time,
OfxPropertySetHandle *meshHandle);
OfxMeshHandle *meshHandle,
OfxPropertySetHandle *propertySet);

/** @brief Releases the mesh handle previously returned by inputGetMesh
@@ -456,38 +519,104 @@ If inputGetMesh is called twice with the same parameters, then two separate mesh
- all operations on meshHandle will be invalid
@returns
- ::kOfxStatOK - the mesh was successfully fetched and returned in the handle,
- ::kOfxStatOK - the mesh was successfully released,
- ::kOfxStatErrBadHandle - the mesh handle was invalid,
*/
OfxStatus (*inputReleaseMesh)(OfxMeshHandle meshHandle);

/** @brief Ensure that an attribute is attached to a mesh
\arg meshHandle - mesh handle
\arg attachment - attribute attachment (see \ref MeshAttrib)
\arg name - attribute name
\arg componentCount - nomber of components in the attribute, from 1 to 4 (1 is a scalar
attribtue, 2 is a vector2, etc.)
\arg type - type of the attribute data (float or int, see \ref MeshAttrib)
\arg attributeHandle - property set for returning attribute properties, might be NULL.
\pre
- meshHandle was returned by inputGetMesh
- attachment is a valid attachement
\post
- attributeHandle is a valid attribute handle
@returns
- ::kOfxStatOK - the attribute was successfully fetched and returned in the handle,
- ::kOfxStatErrBadIndex - the attribute could not be fetched because it does not exist, or the
attachement is not valid.
- ::kOfxStatErrValue - the component count or type is not valid.
- ::kOfxStatErrBadHandle - the mesh handle was invalid,
*/
OfxStatus(*attributeDefine)(OfxMeshHandle meshHandle,
const char *attachment,
const char *name,
int componentCount,
const char *type,
OfxPropertySetHandle *attributeHandle);

/** @brief Get an attribute handle from a mesh
\arg meshHandle - mesh handle
\arg attachment - attribute attachement (see \ref MeshAttrib)
\arg name - attribute name
\arg attributeHandle - property set for returning attribute properties
\pre
- meshHandle was returned by inputGetMesh
- attachment is a valid attachement
\post
- attributeHandle is a valid attribute handle
@returns
- ::kOfxStatOK - the attribute was successfully fetched and returned in the handle,
- ::kOfxStatErrBadIndex - the attribute could not be fetched because it does not exist, or the
attachement is not valid.
- ::kOfxStatErrBadHandle - the mesh handle was invalid,
*/
OfxStatus (*inputReleaseMesh)(OfxPropertySetHandle meshHandle);
OfxStatus(*meshGetAttribute)(OfxMeshHandle meshHandle,
const char *attachment,
const char *name,
OfxPropertySetHandle *attributeHandle);

/** @brief Retrieves the property set for a given mesh
\arg mesh mesh to get the property set for
\arg propHandle pointer to a the property set handle, value is returned here
The property handle is valid for the lifetime of the mesh.
@returns
- ::kOfxStatOK - the property set was found and returned
- ::kOfxStatErrBadHandle - if the mesh handle was invalid
- ::kOfxStatErrUnknown - if the type is unknown
*/
OfxStatus (*meshGetPropertySet)(OfxMeshHandle mesh,
OfxPropertySetHandle *propHandle);

/** @brief Allocate memory of a mesh in an output input
\arg meshHandle - property set containing the mesh's data
\arg pointCount - number of point data to allocate
\arg vertexCount - number of vertex data to allocate
\arg faceCount - number of face data to allocate
\arg meshHandle - mesh handle
\pre
- meshHandle was not allocated yet
- meshHandle was returned by inputGetMesh
- inputReleaseMesh has not been called yet
- meshHandle kOfxMeshPropPointCount, kOfxMeshPropVertexCount, kOfxMeshPropFaceCount properties
must have been set.
\post
- meshHandle kOfxMeshPropPointCount property is set to pointCount, and kOfxMeshPropPointData points to an array of pointCount valid point data
- meshHandle kOfxMeshPropVertexCount property is set to vertexCount, and kOfxMeshPropVertexData points to an array of vertexCount valid vertex data
- meshHandle kOfxMeshPropFaceCount property is set to faceCount, and kOfxMeshPropFaceData points to an array of faceCount valid face data
- all attribut data pointers have been allocated
- meshHandle attributes will no longer change (no call to meshDefineAttribute)
@returns
- ::kOfxStatOK - the mesh was successfully allocated,
- ::kOfxStatErrBadHandle - the mesh handle was invalid,
- ::kOfxStatErrMemory - the host had not enough memory to complete the operation, plugin should abort whatever it was doing.
*/
OfxStatus (*meshAlloc)(OfxPropertySetHandle meshHandle,
int pointCount,
int vertexCount,
int faceCount);
OfxStatus (*meshAlloc)(OfxMeshHandle meshHandle);

/** @brief Returns whether to abort processing or not.

0 comments on commit 099d4a3

Please sign in to comment.
You can’t perform that action at this time.