diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-05-08 01:09:08 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-05-28 19:31:00 +0300 |
commit | c96a4c8a2aeab761983b2b9c76104639c5721a2f (patch) | |
tree | 83f45ccbb3a9651df2785abb2ed8eb376a0e7c7e /intern/cycles/render/light.cpp | |
parent | b94bfe4cd8362abc4e8d256a081dc364c28a3117 (diff) |
Code refactor: modify mesh storage to use arrays rather than vectors, separate some arrays.
Differential Revision: https://developer.blender.org/D2016
Diffstat (limited to 'intern/cycles/render/light.cpp')
-rw-r--r-- | intern/cycles/render/light.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index c20bf6b5e9e..9ef35820254 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -247,7 +247,8 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen /* count triangles */ if(have_emission) { - for(size_t i = 0; i < mesh->triangles.size(); i++) { + size_t mesh_num_triangles = mesh->num_triangles(); + for(size_t i = 0; i < mesh_num_triangles; i++) { int shader_index = mesh->shader[i]; Shader *shader = (shader_index < mesh->used_shaders.size()) ? mesh->used_shaders[shader_index] : scene->default_surface; @@ -319,7 +320,8 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen use_light_visibility = true; } - for(size_t i = 0; i < mesh->triangles.size(); i++) { + size_t mesh_num_triangles = mesh->num_triangles(); + for(size_t i = 0; i < mesh_num_triangles; i++) { int shader_index = mesh->shader[i]; Shader *shader = (shader_index < mesh->used_shaders.size()) ? mesh->used_shaders[shader_index] : scene->default_surface; @@ -331,7 +333,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen distribution[offset].w = __int_as_float(object_id); offset++; - Mesh::Triangle t = mesh->triangles[i]; + Mesh::Triangle t = mesh->get_triangle(i); float3 p1 = mesh->verts[t.v[0]]; float3 p2 = mesh->verts[t.v[1]]; float3 p3 = mesh->verts[t.v[2]]; |