diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-12-12 16:16:35 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-12-12 16:16:35 +0300 |
commit | 31897978338936c6d6149e0a64d93a52a30132bc (patch) | |
tree | 71a883597f797b83ecb0bc3995a9d90967080f60 /source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp | |
parent | 643b73e60ee51aa9f342f246c3e340eefe017516 (diff) |
Fix for incorrect vertex normals in the case of smooth faces with
the R_TRANSFORMED flag enabled. Now vertex normals are properly
transformed by ObjectInstanceRen::nmat[3][3] and normalized. It is
noted that in the case of R_TRANSFORMED flat faces, surface normals
are transformed and normalized by RE_vlakren_get_normal().
The bug was reported by Stéphane Grabli via personal communication.
Thank you Stéphane for the careful code review!
Diffstat (limited to 'source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp')
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index e146a8673ef..3cff4d2cc33 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -314,6 +314,18 @@ void BlenderFileLoader::insertShapeNode(ObjectInstanceRen *obi, int id) copy_v3_v3(n2, vlr->v2->n); copy_v3_v3(n3, vlr->v3->n); if (vlr->v4) copy_v3_v3(n4, vlr->v4->n); + if (obi->flag & R_TRANSFORMED) { + mul_m3_v3(obi->nmat, n1); + mul_m3_v3(obi->nmat, n2); + mul_m3_v3(obi->nmat, n3); + normalize_v3(n1); + normalize_v3(n2); + normalize_v3(n3); + if (vlr->v4) { + mul_m3_v3(obi->nmat, n4); + normalize_v3(n4); + } + } } else { RE_vlakren_get_normal(_re, obi, vlr, facenormal); copy_v3_v3(n1, facenormal); |