diff options
-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) |