diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-07-16 20:36:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-07-16 20:55:14 +0300 |
commit | 595a491e63d6f3f3462675d38cfa71b4e784fe9c (patch) | |
tree | df32ec17691b9280d7b2fa675cd5e5a0f87ea849 /source/blender/blenkernel/BKE_DerivedMesh.h | |
parent | c8f6313487dfbbee030c6796220cc0d91228d658 (diff) |
Add tessellation data to DerivedMesh (LoopTri)
This stores loop indices into the loop array giving easier acess
to data such as vertex-colors and UV's,
removing the need to store an MFace duplicate of custom-data.
This doesn't yet move all internal code from MFace to LoopTri just yet.
Only applies to:
- opengl drawing
- sculpting (pbvh)
- vertex/weight paint
Thanks to @psy-fi for review, fixes and improvements to drawing!
Diffstat (limited to 'source/blender/blenkernel/BKE_DerivedMesh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 62c68380289..0a4cc7f543f 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -185,6 +185,15 @@ struct DerivedMesh { int totmat; /* total materials. Will be valid only before object drawing. */ struct Material **mat; /* material array. Will be valid only before object drawing */ + /** + * \warning Typical access is done via #getLoopTriArray, #getNumLoopTri. + */ + struct { + struct MLoopTri *array; + int num; + int num_alloc; + } looptris; + /* use for converting to BMesh which doesn't store bevel weight and edge crease by default */ char cd_flag; @@ -201,6 +210,12 @@ struct DerivedMesh { /** Recalculates mesh tessellation */ void (*recalcTessellation)(DerivedMesh *dm); + /** Loop tessellation cache */ + void (*recalcLoopTri)(DerivedMesh *dm); + /** accessor functions */ + const struct MLoopTri *(*getLoopTriArray)(DerivedMesh * dm); + int (*getNumLoopTri)(DerivedMesh *dm); + /* Misc. Queries */ /* Also called in Editmode */ @@ -594,10 +609,14 @@ void DM_DupPolys(DerivedMesh *source, DerivedMesh *target); void DM_ensure_normals(DerivedMesh *dm); void DM_ensure_tessface(DerivedMesh *dm); +void DM_ensure_looptri_data(DerivedMesh *dm); +void DM_ensure_looptri(DerivedMesh *dm); + void DM_update_tessface_data(DerivedMesh *dm); void DM_update_materials(DerivedMesh *dm, struct Object *ob); struct MTFace *DM_paint_uvlayer_active_get(DerivedMesh *dm, int mat_nr); +struct MLoopUV *DM_paint_uvlayer_active_get_mloopuv(DerivedMesh *dm, int mat_nr); void DM_interp_vert_data( struct DerivedMesh *source, struct DerivedMesh *dest, @@ -721,12 +740,12 @@ void DM_update_weight_mcol( * the DerivedMesh, with both a pointer for arrays and an offset for editmesh */ typedef struct DMVertexAttribs { struct { - struct MTFace *array; + struct MLoopUV *array; int em_offset, gl_index, gl_texco; } tface[MAX_MTFACE]; struct { - struct MCol *array; + struct MLoopCol *array; int em_offset, gl_index; } mcol[MAX_MCOL]; @@ -747,7 +766,7 @@ void DM_vertex_attributes_from_gpu( DerivedMesh *dm, struct GPUVertexAttribs *gattribs, DMVertexAttribs *attribs); -void DM_draw_attrib_vertex(DMVertexAttribs *attribs, int a, int index, int vert); +void DM_draw_attrib_vertex(DMVertexAttribs *attribs, int a, int index, int vert, int loop); void DM_add_tangent_layer(DerivedMesh *dm); void DM_calc_auto_bump_scale(DerivedMesh *dm); |