Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/render/light.cpp')
-rw-r--r--intern/cycles/render/light.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 664217d6f26..509637aedd9 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -232,7 +232,10 @@ void LightManager::disable_ineffective_light(Scene *scene)
bool LightManager::object_usable_as_light(Object *object)
{
- Mesh *mesh = object->mesh;
+ Geometry *geom = object->geometry;
+ if (geom->type != Geometry::MESH) {
+ return false;
+ }
/* Skip objects with NaNs */
if (!object->bounds.valid()) {
return false;
@@ -243,10 +246,10 @@ bool LightManager::object_usable_as_light(Object *object)
}
/* Skip if we have no emission shaders. */
/* TODO(sergey): Ideally we want to avoid such duplicated loop, since it'll
- * iterate all mesh shaders twice (when counting and when calculating
+ * iterate all geometry shaders twice (when counting and when calculating
* triangle area.
*/
- foreach (const Shader *shader, mesh->used_shaders) {
+ foreach (const Shader *shader, geom->used_shaders) {
if (shader->use_mis && shader->has_surface_emission) {
return true;
}
@@ -285,8 +288,9 @@ void LightManager::device_update_distribution(Device *,
if (!object_usable_as_light(object)) {
continue;
}
+
/* Count triangles. */
- Mesh *mesh = object->mesh;
+ Mesh *mesh = static_cast<Mesh *>(object->geometry);
size_t mesh_num_triangles = mesh->num_triangles();
for (size_t i = 0; i < mesh_num_triangles; i++) {
int shader_index = mesh->shader[i];
@@ -320,7 +324,7 @@ void LightManager::device_update_distribution(Device *,
continue;
}
/* Sum area. */
- Mesh *mesh = object->mesh;
+ Mesh *mesh = static_cast<Mesh *>(object->geometry);
bool transform_applied = mesh->transform_applied;
Transform tfm = object->tfm;
int object_id = j;
@@ -352,7 +356,7 @@ void LightManager::device_update_distribution(Device *,
if (shader->use_mis && shader->has_surface_emission) {
distribution[offset].totarea = totarea;
- distribution[offset].prim = i + mesh->tri_offset;
+ distribution[offset].prim = i + mesh->prim_offset;
distribution[offset].mesh_light.shader_flag = shader_flag;
distribution[offset].mesh_light.object_id = object_id;
offset++;