diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-03-19 02:06:57 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-03-19 02:06:57 +0400 |
commit | 53b7078343c1fa0e9361e038163a6a17f52da4e4 (patch) | |
tree | 53f6f12a5d32dbd64d0c98b7fd369601b9d00a96 /source/blender/blenkernel/BKE_DerivedMesh.h | |
parent | 709ca0ece9b28858cea8084f8040ce0b7455958a (diff) |
Fix [#30234] Various problems with CD layers and tesselation, related to modifiers stack.
Should also fix [#30266], [#29451], and partly [#30316].
Here are the changes made by this commit:
* It adds a "dirty" flag to DerivedMesh struct (for now, only DM_DIRTY_TESS_CDLAYERS, but more might be added as needed).
* It adds a new func, DM_update_tessface_data, which assumes tessfaces themselves are valid, but updates tessellated customdata from their poly/loop counter parts.
* At end of modstack, when valid tessellated faces are present in finaldm , but the cdlayers dirty flag is set, call that function (instead of recomputing the whole tessellation).
* Edits to the codes concerned (UVProject, DynamicPaint, and Subsurf modifiers).
* Also add to subsurf dm generation code the creation of a CD_POLYINDEX layer (mandatory for DM_update_tessface_data to work well, and imho all tessellated dm should have one).
Note: some pieces of old code are just #if 0’ed, will clean them later.
Diffstat (limited to 'source/blender/blenkernel/BKE_DerivedMesh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 493a5ec285f..aefa94d07de 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -147,6 +147,11 @@ typedef enum DMDrawFlag { DM_DRAW_ALWAYS_SMOOTH = 2 } DMDrawFlag; +typedef enum DMDirtyFlag { + /* dm has valid tessellated faces, but tessellated CDDATA need to be updated. */ + DM_DIRTY_TESS_CDLAYERS = 1 << 0, +} DMDirtyFlag; + typedef struct DerivedMesh DerivedMesh; struct DerivedMesh { /* Private DerivedMesh data, only for internal DerivedMesh use */ @@ -158,6 +163,7 @@ struct DerivedMesh { struct GPUDrawObject *drawObject; DerivedMeshType type; float auto_bump_scale; + DMDirtyFlag dirty; /* calculate vert and face normals */ void (*calcNormals)(DerivedMesh *dm); @@ -540,6 +546,8 @@ void DM_DupPolys(DerivedMesh *source, DerivedMesh *target); void DM_ensure_tessface(DerivedMesh *dm); +void DM_update_tessface_data(DerivedMesh *dm); + /* interpolates vertex data from the vertices indexed by src_indices in the * source mesh using the given weights and stores the result in the vertex * indexed by dest_index in the dest mesh |