From 7efc75c7092b085fe3f5ef2dcab3669d466dfadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 19 Apr 2018 11:03:58 +0200 Subject: =?UTF-8?q?Modifiers:=20Simple=20Deform=20&=20Build,=20DerivedMesh?= =?UTF-8?q?=20=E2=86=92=20Mesh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit introduces `EditMeshData`. The fields in this struct are extracted from `EditDerivedBMesh` into their own struct `EditMeshData`, which can then also be used by the `Mesh` struct. This allows passing deformed vertices efficiently to the draw routines. The modifier code constructs a new Mesh instead of writing to ob->data; even when ob->data is a CoW copy, it can still be used by different objects and thus shouldn't be modified by a modifier. --- source/blender/makesdna/DNA_mesh_types.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/blender/makesdna/DNA_mesh_types.h') diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 505b1f7157b..e8790a86fc5 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -52,6 +52,19 @@ struct Material; struct Mesh; struct Multires; +# +# +typedef struct EditMeshData { + /** when set, \a vertexNos, polyNos are lazy initialized */ + const float (*vertexCos)[3]; + + /** lazy initialize (when \a vertexCos is set) */ + float const (*vertexNos)[3]; + float const (*polyNos)[3]; + /** also lazy init but dont depend on \a vertexCos */ + const float (*polyCos)[3]; +} EditMeshData; + typedef struct Mesh { ID id; struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ @@ -87,6 +100,7 @@ typedef struct Mesh { /* When the object is available, the preferred access method is: BKE_editmesh_from_object(ob) */ struct BMEditMesh *edit_btmesh; /* not saved in file! */ + struct EditMeshData *emd; /* not saved in file! */ struct CustomData vdata, edata, fdata; -- cgit v1.2.3