diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_cdderivedmesh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_cdderivedmesh.h | 60 |
1 files changed, 52 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h index c71c86e110d..db9f8e0527f 100644 --- a/source/blender/blenkernel/BKE_cdderivedmesh.h +++ b/source/blender/blenkernel/BKE_cdderivedmesh.h @@ -38,12 +38,17 @@ #include "BKE_DerivedMesh.h" struct DerivedMesh; +struct BMEditMesh; struct EditMesh; struct Mesh; struct Object; /* creates a new CDDerivedMesh */ -struct DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces); +struct DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces, + int numLoops, int numPolys); + +/*tests if a given DerivedMesh is a CDDM*/ +int CDDM_Check(struct DerivedMesh *dm); /* creates a CDDerivedMesh from the given Mesh, this will reference the original data in Mesh, but it is safe to apply vertex coordinates or @@ -51,8 +56,11 @@ struct DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces); data to not overwrite the original */ struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh, struct Object *ob); -/* creates a CDDerivedMesh from the given EditMesh */ -struct DerivedMesh *CDDM_from_editmesh(struct EditMesh *em, struct Mesh *me); +/* creates a CDDerivedMesh from the given BMEditMesh */ +DerivedMesh *CDDM_from_BMEditMesh(struct BMEditMesh *em, struct Mesh *me, int use_mdisps, int use_tessface); + +/* merge verts */ +DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap); /* creates a CDDerivedMesh from the given curve object */ struct DerivedMesh *CDDM_from_curve(struct Object *ob); @@ -61,17 +69,27 @@ struct DerivedMesh *CDDM_from_curve(struct Object *ob); /* useful for OrcoDM creation for curves with constructive modifiers */ DerivedMesh *CDDM_from_curve_customDB(struct Object *ob, struct ListBase *dispbase); +struct BMEditMesh *CDDM_To_BMesh(struct Object *ob, struct DerivedMesh *dm, + struct BMEditMesh *existing, int do_tesselate); + + /* Copies the given DerivedMesh with verts, faces & edges stored as * custom element data. */ -struct DerivedMesh *CDDM_copy(struct DerivedMesh *dm); +struct DerivedMesh *CDDM_copy(struct DerivedMesh *dm, int faces_from_tessfaces); /* creates a CDDerivedMesh with the same layer stack configuration as the * given DerivedMesh and containing the requested numbers of elements. * elements are initialised to all zeros */ struct DerivedMesh *CDDM_from_template(struct DerivedMesh *source, - int numVerts, int numEdges, int numFaces); + int numVerts, int numEdges, int numFaces, + int numLoops, int numPolys); + +/*converts mfaces to mpolys. note things may break if there are not valid + *medges surrounding each mface. + */ +void CDDM_tessfaces_to_faces(struct DerivedMesh *dm); /* applies vertex coordinates or normals to a CDDerivedMesh. if the MVert * layer is a referenced layer, it will be duplicate to not overwrite the @@ -82,19 +100,31 @@ void CDDM_apply_vert_normals(struct DerivedMesh *cddm, short (*vertNormals)[3]); /* recalculates vertex and face normals for a CDDerivedMesh */ +void CDDM_calc_normals_mapping(struct DerivedMesh *dm); void CDDM_calc_normals(struct DerivedMesh *dm); +void CDDM_calc_normals_tessface(struct DerivedMesh *dm); /* calculates edges for a CDDerivedMesh (from face data) * this completely replaces the current edge data in the DerivedMesh + * builds edges from the tesselated face data. */ +void CDDM_calc_edges_tessface(struct DerivedMesh *dm); + +/* same as CDDM_calc_edges_tessface only makes edges from ngon faces instead of tesselation + faces*/ void CDDM_calc_edges(struct DerivedMesh *dm); +/* reconstitute face triangulation */ +void CDDM_recalc_tesselation(struct DerivedMesh *dm); +void CDDM_recalc_tesselation_ex(struct DerivedMesh *dm, const int do_face_nor_cpy); + /* lowers the number of vertices/edges/faces in a CDDerivedMesh * the layer data stays the same size */ void CDDM_lower_num_verts(struct DerivedMesh *dm, int numVerts); void CDDM_lower_num_edges(struct DerivedMesh *dm, int numEdges); -void CDDM_lower_num_faces(struct DerivedMesh *dm, int numFaces); +void CDDM_lower_num_polys(struct DerivedMesh *dm, int numPolys); +void CDDM_lower_num_tessfaces(DerivedMesh *dm, int numTessFaces); /* vertex/edge/face access functions * should always succeed if index is within bounds @@ -102,7 +132,9 @@ void CDDM_lower_num_faces(struct DerivedMesh *dm, int numFaces); */ struct MVert *CDDM_get_vert(struct DerivedMesh *dm, int index); struct MEdge *CDDM_get_edge(struct DerivedMesh *dm, int index); -struct MFace *CDDM_get_face(struct DerivedMesh *dm, int index); +struct MFace *CDDM_get_tessface(struct DerivedMesh *dm, int index); +struct MLoop *CDDM_get_loop(struct DerivedMesh *dm, int index); +struct MPoly *CDDM_get_face(struct DerivedMesh *dm, int index); /* vertex/edge/face array access functions - return the array holding the * desired data @@ -111,6 +143,18 @@ struct MFace *CDDM_get_face(struct DerivedMesh *dm, int index); */ struct MVert *CDDM_get_verts(struct DerivedMesh *dm); struct MEdge *CDDM_get_edges(struct DerivedMesh *dm); -struct MFace *CDDM_get_faces(struct DerivedMesh *dm); +struct MFace *CDDM_get_tessfaces(struct DerivedMesh *dm); +struct MLoop *CDDM_get_loops(struct DerivedMesh *dm); +struct MPoly *CDDM_get_polys(struct DerivedMesh *dm); + +/*Assigns news m*** layers to the cddm. Note that you must handle + freeing the old ones yourself. Also you must ensure dm->num****Data + is correct.*/ +void CDDM_set_mvert(struct DerivedMesh *dm, struct MVert *mvert); +void CDDM_set_medge(struct DerivedMesh *dm, struct MEdge *medge); +void CDDM_set_mface(struct DerivedMesh *dm, struct MFace *mface); +void CDDM_set_mloop(struct DerivedMesh *dm, struct MLoop *mloop); +void CDDM_set_mpoly(struct DerivedMesh *dm, struct MPoly *mpoly); + #endif |