diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-07-31 19:05:16 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-07-31 19:05:16 +0400 |
commit | 314e26c02c8e08ccb6cd0f9fcf6cb5b22d9a18a1 (patch) | |
tree | 2cfa1ab903de8d89f0da8f0a059a5f3be8ce3623 /intern/cycles | |
parent | 6d8fb7c0e7b87091e12719f277d482a01243112f (diff) |
Fix cycles issue with wrong texture coordinates on a second render layer with
a mask layer enabled.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/render/light.cpp | 15 | ||||
-rw-r--r-- | intern/cycles/render/object.cpp | 5 |
2 files changed, 14 insertions, 6 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 6c03d0859a7..d00b242d153 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -194,10 +194,11 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen /* sum area */ if(have_emission) { + bool transform_applied = mesh->transform_applied; Transform tfm = object->tfm; int object_id = j; - if(mesh->transform_applied) + if(transform_applied) object_id = ~object_id; for(size_t i = 0; i < mesh->triangles.size(); i++) { @@ -211,9 +212,15 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen offset++; Mesh::Triangle t = mesh->triangles[i]; - float3 p1 = transform_point(&tfm, mesh->verts[t.v[0]]); - float3 p2 = transform_point(&tfm, mesh->verts[t.v[1]]); - float3 p3 = transform_point(&tfm, mesh->verts[t.v[2]]); + float3 p1 = mesh->verts[t.v[0]]; + float3 p2 = mesh->verts[t.v[1]]; + float3 p3 = mesh->verts[t.v[2]]; + + if(!transform_applied) { + p1 = transform_point(&tfm, p1); + p2 = transform_point(&tfm, p2); + p3 = transform_point(&tfm, p3); + } totarea += triangle_area(p1, p2, p3); } diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp index c4b25e633bf..0fe227fd171 100644 --- a/intern/cycles/render/object.cpp +++ b/intern/cycles/render/object.cpp @@ -111,8 +111,9 @@ void Object::apply_transform() mesh->compute_bounds(); compute_bounds(false); } - - tfm = transform_identity(); + + /* tfm is not reset to identity, all code that uses it needs to check the + transform_applied boolean */ } void Object::tag_update(Scene *scene) |