Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2006-11-20 07:28:02 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2006-11-20 07:28:02 +0300
commite435fbc3c5a00e5b63c1cd2609ab6828187660d3 (patch)
tree3f1da9c51451dee55a203cd001d37f8774d2582f /source/blender/blenkernel/BKE_cdderivedmesh.h
parent0a7c43c6e5fc7d5d75a4645eca1164cede2d03a6 (diff)
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are still used of course, but allocating, copying or freeing these arrays should be done through the CustomData API. Work in progress documentation on this is here: http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData Replaced TFace by MTFace: This is the same struct, except that it does not contain color, that now always stays separated in MCol. This was not a good design decision to begin with, and it is needed for adding multiple color layers later. Note that this does mean older Blender versions will not be able to read UV coordinates from the next release, due to an SDNA limitation. Removed DispListMesh: This now fully replaced by DerivedMesh. To provide access to arrays of vertices, edges and faces, like DispListMesh does. The semantics of the DerivedMesh.getVertArray() and similar functions were changed to return a pointer to an array if one exists, or otherwise allocate a temporary one. On releasing the DerivedMesh, this temporary array will be removed automatically. Removed ssDM and meshDM DerivedMesh backends: The ssDM backend was for DispListMesh, so that became obsolete automatically. The meshDM backend was replaced by the custom data backend, that now figures out which layers need to be modified, and only duplicates those. This changes code in many places, and overall removes 2514 lines of code. So, there's a good chance this might break some stuff, although I've been testing it for a few days now. The good news is, adding multiple color and uv layers should now become easy.
Diffstat (limited to 'source/blender/blenkernel/BKE_cdderivedmesh.h')
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index b8313440551..a570b4fe598 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -40,12 +40,16 @@
struct DerivedMesh;
struct EditMesh;
struct Mesh;
+struct Object;
/* creates a new CDDerivedMesh */
struct DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces);
-/* creates a CDDerivedMesh from the given Mesh */
-struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh);
+/* creates a CDDerivedMesh from the given Mesh, this will reference the
+ original data in Mesh, but it is safe to apply vertex coordinates or
+ calculate normals as those functions will automtically create new
+ 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);
@@ -62,11 +66,14 @@ struct DerivedMesh *CDDM_copy(struct DerivedMesh *dm);
struct DerivedMesh *CDDM_from_template(struct DerivedMesh *source,
int numVerts, int numEdges, int numFaces);
-/* applies vertex coordinates to a CDDerivedMesh
+/* applies vertex coordinates or normals to a CDDerivedMesh. if the MVert
+ * layer is a referenced layer, it will be duplicate to not overwrite the
+ * original
*/
void CDDM_apply_vert_coords(struct DerivedMesh *cddm, float (*vertCoords)[3]);
+void CDDM_apply_vert_normals(struct DerivedMesh *cddm, short (*vertNormals)[3]);
-/* recalculates normals for a CDDerivedMesh
+/* recalculates vertex and face normals for a CDDerivedMesh
*/
void CDDM_calc_normals(struct DerivedMesh *dm);
@@ -75,12 +82,12 @@ void CDDM_calc_normals(struct DerivedMesh *dm);
*/
void CDDM_calc_edges(struct DerivedMesh *dm);
-/* sets the number of vertices/edges/faces in a CDDerivedMesh
- * if the value given is more than the maximum, the maximum is used
+/* lowers the number of vertices/edges/faces in a CDDerivedMesh
+ * the layer data stays the same size
*/
-void CDDM_set_num_verts(struct DerivedMesh *dm, int numVerts);
-void CDDM_set_num_edges(struct DerivedMesh *dm, int numEdges);
-void CDDM_set_num_faces(struct DerivedMesh *dm, int numFaces);
+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);
/* vertex/edge/face access functions
* should always succeed if index is within bounds