diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-02-05 16:24:48 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-02-05 16:32:57 +0300 |
commit | 138c9dba9be67a93c91717ae3fcd8855aced9185 (patch) | |
tree | dfb5d14d965297a069386148bdcff4236ca1f23b /source/blender/blenkernel/intern/mesh.c | |
parent | 7bae9ee6b62dbc5defffb698ec3d3f39ce460254 (diff) |
Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.
See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.
Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.
Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.
Also, bumping subversion, and fix mess in 2.70 versioning code.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 8ad20df18db..7757babaca2 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -414,6 +414,16 @@ void BKE_mesh_update_customdata_pointers(Mesh *me, const bool do_ensure_tess_cd) me->mloopuv = CustomData_get_layer(&me->ldata, CD_MLOOPUV); } +bool BKE_mesh_has_custom_loop_normals(Mesh *me) +{ + if (me->edit_btmesh) { + return CustomData_has_layer(&me->edit_btmesh->bm->ldata, CD_CUSTOMLOOPNORMAL); + } + else { + return CustomData_has_layer(&me->ldata, CD_CUSTOMLOOPNORMAL); + } +} + /* Note: unlinking is called when me->id.us is 0, question remains how * much unlinking of Library data in Mesh should be done... probably * we need a more generic method, like the expand() functions in |