diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-15 00:55:18 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-15 00:55:18 +0300 |
commit | a83b2d3fd93cde482db3cfe4f481a5ff7df49c63 (patch) | |
tree | 39f864d4db4206d2a5069ebd6039d46e1a1f3b27 /intern/cycles | |
parent | 1862fbf203b84b622d80846bd6d2f76f3cada434 (diff) |
Cycles: Fix wrong attribute count calculation in prevous commit
The workaround for generated texture coordinates is to be done before
calculating number of elements for attribute, otherwise counter wouldn't
include those attributes.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/render/mesh.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index e672aab49d9..9c7310d4a05 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -913,6 +913,16 @@ void MeshManager::device_update_attributes(Device *device, DeviceScene *dscene, foreach(AttributeRequest& req, attributes.requests) { Attribute *triangle_mattr = mesh->attributes.find(req); Attribute *curve_mattr = mesh->curve_attributes.find(req); + + /* todo: get rid of this exception, it's only here for giving some + * working texture coordinate for subdivision as we can't preserve + * any attributes yet */ + if(!triangle_mattr && req.std == ATTR_STD_GENERATED) { + triangle_mattr = mesh->attributes.add(ATTR_STD_GENERATED); + if(mesh->verts.size()) + memcpy(triangle_mattr->data_float3(), &mesh->verts[0], sizeof(float3)*mesh->verts.size()); + } + update_attribute_element_size(mesh, triangle_mattr, &attr_float_size, @@ -945,15 +955,6 @@ void MeshManager::device_update_attributes(Device *device, DeviceScene *dscene, Attribute *triangle_mattr = mesh->attributes.find(req); Attribute *curve_mattr = mesh->curve_attributes.find(req); - /* todo: get rid of this exception, it's only here for giving some - * working texture coordinate for subdivision as we can't preserve - * any attributes yet */ - if(!triangle_mattr && req.std == ATTR_STD_GENERATED) { - triangle_mattr = mesh->attributes.add(ATTR_STD_GENERATED); - if(mesh->verts.size()) - memcpy(triangle_mattr->data_float3(), &mesh->verts[0], sizeof(float3)*mesh->verts.size()); - } - update_attribute_element_offset(mesh, attr_float, attr_float_offset, attr_float3, attr_float3_offset, |