diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-07-30 15:43:58 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-07-30 15:43:58 +0300 |
commit | 2ec00ea0c1be1ace7cd0c7b68e43cc8e87dd07c7 (patch) | |
tree | bcea6f830039d7ef67dcd1a9a95b767d2af19958 /source/blender/blenkernel/intern/cdderivedmesh.c | |
parent | 9d335d29c775939b22dffedc303ecce9fec4e52f (diff) |
Move tangents and baking to looptris:
Notes:
* Code in rendering and in game engine will still convert
tangents to a tessface representation. Added code that
takes care of tangent layer only, might be removed
when BGE and rendering goes full mlooptri mode.
* Baking should work discovered some dead code while
I was working on the patch, also tangents are broken
when baking from multires (also in master), but those
are separate issues that can be fixed later.
This should fix T45491 as well
Diffstat (limited to 'source/blender/blenkernel/intern/cdderivedmesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index b5ff4f6ee5f..9a3a74103f8 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1076,15 +1076,13 @@ static void cdDM_drawMappedFacesGLSL( offset += sizeof(unsigned char) * 4; } } - /* TODO, handle tangents */ if (matconv[i].attribs.tottang && matconv[i].attribs.tang.array) { - const float *tang = matconv[i].attribs.tang.array[i * 4 + 0]; - copy_v4_v4((float *)&varray[offset], tang); - tang = matconv[i].attribs.tang.array[i * 4 + 1]; - copy_v4_v4((float *)&varray[offset + max_element_size], tang); - tang = matconv[i].attribs.tang.array[i * 4 + 2]; - copy_v4_v4((float *)&varray[offset + max_element_size * 2], tang); - offset += sizeof(float) * 4; + if (matconv[i].attribs.tface[b].array) { + const float (*looptang)[4] = (const float (*)[4])matconv[i].attribs.tang.array; + for (j = 0; j < mpoly->totloop; j++) + copy_v4_v4((float *)&varray[offset + j * max_element_size], looptang[mpoly->loopstart + j]); + offset += sizeof(float) * 4; + } } } |