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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-06-04 21:17:10 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-06-04 21:17:10 +0400
commit6548f7efefb2e9db25e8c6ca8b7d4ed6b9725543 (patch)
tree106465145a9e15e3e01ff6fbde850d880dbb7c2c /intern/cycles/render/light.cpp
parent0f1fd51c2169d45327eef4c40622551694c9dd9e (diff)
Cycles: spot lamp support.
Diffstat (limited to 'intern/cycles/render/light.cpp')
-rw-r--r--intern/cycles/render/light.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 267cb8e6d3a..1bf1cde4a1c 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -109,6 +109,9 @@ Light::Light()
map_resolution = 512;
+ spot_angle = M_PI_F/4.0f;
+ spot_smooth = 0.0f;
+
cast_shadow = true;
shader = 0;
}
@@ -451,6 +454,17 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce
light_data[i*LIGHT_SIZE + 2] = make_float4(0.0f, axisv.x, axisv.y, axisv.z);
light_data[i*LIGHT_SIZE + 3] = make_float4(0.0f, dir.x, dir.y, dir.z);
}
+ else if(light->type == LIGHT_SPOT) {
+ shader_id &= ~SHADER_AREA_LIGHT;
+
+ float spot_angle = cosf(light->spot_angle*0.5f);
+ float spot_smooth = (1.0f - spot_angle)*light->spot_smooth;
+
+ light_data[i*LIGHT_SIZE + 0] = make_float4(__int_as_float(light->type), co.x, co.y, co.z);
+ light_data[i*LIGHT_SIZE + 1] = make_float4(__int_as_float(shader_id), light->size, dir.x, dir.y);
+ light_data[i*LIGHT_SIZE + 2] = make_float4(dir.z, spot_angle, spot_smooth, 0.0f);
+ light_data[i*LIGHT_SIZE + 3] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ }
}
device->tex_alloc("__light_data", dscene->light_data);