[gimp] plug-ins: fix directional light mode in map-object
- From: Mikael Magnusson <mikachu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: fix directional light mode in map-object
- Date: Sun, 20 Feb 2011 12:55:09 +0000 (UTC)
commit 8be41fa9b7607bff008cb3d2ed05b0472c297c4a
Author: Mikael Magnusson <mikachu src gnome org>
Date: Sun Feb 20 13:31:23 2011 +0100
plug-ins: fix directional light mode in map-object
plug-ins/map-object/map-object-shade.c | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/plug-ins/map-object/map-object-shade.c b/plug-ins/map-object/map-object-shade.c
index 2349849..c8f70a3 100644
--- a/plug-ins/map-object/map-object-shade.c
+++ b/plug-ins/map-object/map-object-shade.c
@@ -35,14 +35,18 @@ static GimpRGB
phong_shade (GimpVector3 *pos,
GimpVector3 *viewpoint,
GimpVector3 *normal,
- GimpVector3 *light,
- GimpRGB *diff_col,
- GimpRGB *spec_col,
- gint type)
+ GimpRGB *diff_col,
+ GimpRGB *spec_col,
+ LightType type)
{
GimpRGB ambientcolor, diffusecolor, specularcolor;
gdouble NL, RV, dist;
GimpVector3 L, NN, V, N;
+ GimpVector3 *light;
+
+ light = mapvals.lightsource.type == DIRECTIONAL_LIGHT
+ ? &mapvals.lightsource.direction
+ : &mapvals.lightsource.position,
/* Compute ambient intensity */
/* ========================= */
@@ -210,7 +214,6 @@ get_ray_color_plane (GimpVector3 *pos)
color = phong_shade (&spos,
&mapvals.viewpoint,
&mapvals.normal,
- &mapvals.lightsource.position,
&color,
&mapvals.lightsource.color,
mapvals.lightsource.type);
@@ -367,7 +370,6 @@ get_ray_color_sphere (GimpVector3 *pos)
color = phong_shade (&spos1,
&mapvals.viewpoint,
&normal,
- &mapvals.lightsource.position,
&color,
&mapvals.lightsource.color,
mapvals.lightsource.type);
@@ -387,7 +389,6 @@ get_ray_color_sphere (GimpVector3 *pos)
color2 = phong_shade (&spos2,
&mapvals.viewpoint,
&normal,
- &mapvals.lightsource.position,
&color2,
&mapvals.lightsource.color,
mapvals.lightsource.type);
@@ -410,7 +411,6 @@ get_ray_color_sphere (GimpVector3 *pos)
color = phong_shade (&spos1,
&mapvals.viewpoint,
&normal,
- &mapvals.lightsource.position,
&color,
&mapvals.lightsource.color,
mapvals.lightsource.type);
@@ -920,7 +920,6 @@ get_ray_color_box (GimpVector3 *pos)
color = phong_shade (&face_intersect[0].s,
&mapvals.viewpoint,
&face_intersect[0].n,
- &mapvals.lightsource.position,
&color,
&mapvals.lightsource.color,
mapvals.lightsource.type);
@@ -939,7 +938,6 @@ get_ray_color_box (GimpVector3 *pos)
color2 = phong_shade (&face_intersect[1].s,
&mapvals.viewpoint,
&face_intersect[1].n,
- &mapvals.lightsource.position,
&color2,
&mapvals.lightsource.color,
mapvals.lightsource.type);
@@ -963,7 +961,6 @@ get_ray_color_box (GimpVector3 *pos)
color = phong_shade (&face_intersect[0].s,
&mapvals.viewpoint,
&face_intersect[0].n,
- &mapvals.lightsource.position,
&color,
&mapvals.lightsource.color,
mapvals.lightsource.type);
@@ -1199,7 +1196,6 @@ get_ray_color_cylinder (GimpVector3 *pos)
color = phong_shade (&face_intersect[0].s,
&mapvals.viewpoint,
&face_intersect[0].n,
- &mapvals.lightsource.position,
&color,
&mapvals.lightsource.color,
mapvals.lightsource.type);
@@ -1218,7 +1214,6 @@ get_ray_color_cylinder (GimpVector3 *pos)
color2 = phong_shade (&face_intersect[1].s,
&mapvals.viewpoint,
&face_intersect[1].n,
- &mapvals.lightsource.position,
&color2,
&mapvals.lightsource.color,
mapvals.lightsource.type);
@@ -1242,7 +1237,6 @@ get_ray_color_cylinder (GimpVector3 *pos)
color = phong_shade (&face_intersect[0].s,
&mapvals.viewpoint,
&face_intersect[0].n,
- &mapvals.lightsource.position,
&color,
&mapvals.lightsource.color,
mapvals.lightsource.type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]