? g
? docs/C/geyes-C.omf.out
? docs/de/geyes-de.omf.out
? docs/es/geyes-es.omf.out
? docs/fr/geyes-fr.omf.out
? docs/it/geyes-it.omf.out
? docs/ja/geyes-ja.omf.out
? docs/ko/geyes-ko.omf.out
? docs/sv/geyes-sv.omf.out
? docs/zh_CN/geyes-zh_CN.omf.out
? docs/zh_TW/geyes-zh_TW.omf.out
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/ChangeLog,v
retrieving revision 1.93
diff -u -r1.93 ChangeLog
--- ChangeLog	15 Sep 2003 22:19:26 -0000	1.93
+++ ChangeLog	27 Oct 2003 11:47:32 -0000
@@ -1,3 +1,9 @@
+2003-10-27  Behdad Esfahbod <gnomeapplets@behdad.org>
+
+	* geyes.c, geyes.h:  Added 3d effect for pupil movement.
+	* themes.c:  Parse new tags crossed-eyes and eye-depth for 3d effect.
+	* themes/*/config:  Added 3d effect tags.
+
 Mon Sep 15 15:17:32 2003  George Lebl <jirka@5z.com>
 
 	* geyes.c: when started in lockdown mode, hide the preferences item
Index: README.themes
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/README.themes,v
retrieving revision 1.1
diff -u -r1.1 README.themes
--- README.themes	10 Jul 1999 01:32:17 -0000	1.1
+++ README.themes	27 Oct 2003 11:47:32 -0000
@@ -23,12 +23,14 @@
 * pupil-pixmap = "filename"
 Yes, the quotes have to be there.  Names the filename to use for the pupil 
 pixmap.
+* eye-depth = n
+Think of eye-depth as how far the eye is behind the monitor screen, in pixels.
+This is used for to create the 3d effect, which seems that the eye is located
+behind the screen, not *on* the screen.
+* crossed-eyes = b
+Where b is 0 or 1.  If 3d effect is on (eye-depth is set), makes it so that
+you can still get a crossed-eyes effect when putting the cursor between
+two of the eyes.
 
 Take a look at the themes that come with gEyes for examples, or the 
 geyes_applet(1) man page for another view of the process.
-
-
-
-
-
-
Index: geyes.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/geyes.c,v
retrieving revision 1.50
diff -u -r1.50 geyes.c
--- geyes.c	15 Sep 2003 22:19:26 -0000	1.50
+++ geyes.c	27 Oct 2003 11:47:32 -0000
@@ -116,38 +116,63 @@
         double cosa;
         double nx;
         double ny;
+	double dx;
+	double dy;
         double h;
         double temp;
      
         nx = x - ((double) eyes_applet->eye_width / 2);
         ny = y - ((double) eyes_applet->eye_height / 2);
        
-        h = hypot (nx, ny);
-        if (abs (h) 
-            < (abs (hypot (eyes_applet->eye_height / 2, eyes_applet->eye_width / 2)) - eyes_applet->wall_thickness - eyes_applet->pupil_height)) {
-                *pupil_x = x;
-                *pupil_y = y;
-                return;
-        }
-        
         angle = atan2 (nx, ny);
         sina = sin (angle);
         cosa = cos (angle);
         
-        temp = hypot ((eyes_applet->eye_height / 2) * cosa, (eyes_applet->eye_width / 2)* sina);
-        *pupil_x = temp * sina;
-        *pupil_y = temp * cosa;
+	/* calculate the real space */
+        *pupil_x = (eyes_applet->eye_width
+		  - eyes_applet->pupil_width
+		  - eyes_applet->wall_thickness) / 2;
+        *pupil_y = (eyes_applet->eye_height
+		  - eyes_applet->pupil_height
+		  - eyes_applet->wall_thickness) / 2;
+
+	/* circlize */
+	*pupil_x *= sina;
+	*pupil_y *= cosa;
        
-        temp = hypot ((eyes_applet->pupil_width / 2) * sina, (eyes_applet->pupil_height / 2)* cosa);
-        *pupil_x -= temp * sina;
-        *pupil_y -= temp * cosa;
-        
-        temp = hypot ((eyes_applet->wall_thickness / 2) * sina, (eyes_applet->wall_thickness / 2) * cosa);
-        *pupil_x -= temp * sina;
-        *pupil_y -= temp * cosa;
+
+	/* 3d effect */
+
+        h = hypot (nx, ny);
+
+	/* we check for eye_depth from theme,
+	   and fall back to 2d if not available */
+
+
+	/* TODO:
+	   implement 'bigbug' effect, that's to go crossed-eyes
+	   whenever gnome-panel-screenshot is taking a *photo*.
+	   (courtesy of Mohmmad 'bigbug' Toossi <mohammad@bamdad.org>)
+		-- Behdad Esfahbod <geyes@behdad.org>
+	*/
+
+	dx = eyes_applet->eye_depth;
+	if (dx == 0 || eyes_applet->crossed_eyes)
+		/* don't do 3d for x axis if crossed eyes asked for */
+		dx = *pupil_x;
+
+	dy = eyes_applet->eye_depth;
+	if (dy == 0)
+		dy = *pupil_y;
+
+	/* a simple projection */
+	*pupil_x *= h / sqrt(h*h + dx*dx);
+	*pupil_y *= h / sqrt(h*h + dy*dy);
         
-        *pupil_x += (eyes_applet->eye_width / 2);
-        *pupil_y += (eyes_applet->eye_height / 2);
+
+	/* add offset */
+        *pupil_x += eyes_applet->eye_width / 2;
+        *pupil_y += eyes_applet->eye_height / 2;
 }
 
 static void 
Index: geyes.h
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/geyes.h,v
retrieving revision 1.10
diff -u -r1.10 geyes.h
--- geyes.h	4 Jun 2003 00:00:10 -0000	1.10
+++ geyes.h	27 Oct 2003 11:47:32 -0000
@@ -49,8 +49,10 @@
 	gchar *eye_filename;
 	gchar *pupil_filename;
 	gint num_eyes;
+	gint crossed_eyes;
 	gint eye_height;
 	gint eye_width;
+	gint eye_depth;
 	gint pupil_height;
 	gint pupil_width;
 	gint wall_thickness;
Index: themes.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/themes.c,v
retrieving revision 1.41
diff -u -r1.41 themes.c
--- themes.c	21 Jul 2003 23:41:41 -0000	1.41
+++ themes.c	27 Oct 2003 11:47:32 -0000
@@ -41,6 +41,9 @@
 {
         gchar line_buf [512]; /* prolly overkill */
         gchar *token;
+	/* eye-depth and crossed-eyes may not be specified */
+	eyes_applet->crossed_eyes = 0;
+	eyes_applet->eye_depth = 0;
         fgets (line_buf, 512, theme_file);
         while (!feof (theme_file)) {
                 token = strtok (line_buf, "=");
@@ -57,6 +60,18 @@
                                 token++;
                         }
                         sscanf (token, "%d", &eyes_applet->num_eyes);
+                } else if (strncmp (token, "crossed-eyes", strlen ("crossed-eyes")) == 0) {
+                        token += strlen ("crossed-eyes");
+                        while (!isdigit (*token)) {
+                                token++;
+                        }
+                        sscanf (token, "%d", &eyes_applet->crossed_eyes);
+                } else if (strncmp (token, "eye-depth", strlen ("eye-depth")) == 0) {
+                        token += strlen ("eye-depth");
+                        while (!isdigit (*token)) {
+                                token++;
+                        }
+                        sscanf (token, "%d", &eyes_applet->eye_depth);
                 } else if (strncmp (token, "eye-pixmap", strlen ("eye-pixmap")) == 0) {
                         token = strtok (NULL, "\"");
                         token = strtok (NULL, "\"");          
Index: themes/Bizarre/config
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/themes/Bizarre/config,v
retrieving revision 1.1
diff -u -r1.1 config
--- themes/Bizarre/config	10 Jul 1999 01:32:20 -0000	1.1
+++ themes/Bizarre/config	27 Oct 2003 11:47:34 -0000
@@ -1,4 +1,5 @@
 wall-thickness=2
 num-eyes = 3
+eye-depth = 300
 eye-pixmap = "Bizarre-eye.png"
 pupil-pixmap = "Bizarre-pupil.png"
Index: themes/Bloodshot/config
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/themes/Bloodshot/config,v
retrieving revision 1.1
diff -u -r1.1 config
--- themes/Bloodshot/config	10 Jul 1999 01:32:20 -0000	1.1
+++ themes/Bloodshot/config	27 Oct 2003 11:47:34 -0000
@@ -1,4 +1,6 @@
 wall-thickness = 5
 num-eyes = 2
+crossed-eyes = 1
+eye-depth = 300
 eye-pixmap = "Bloodshot-eye.png"
 pupil-pixmap = "Bloodshot-pupil.png"
Index: themes/Default/config
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/themes/Default/config,v
retrieving revision 1.1
diff -u -r1.1 config
--- themes/Default/config	10 Jul 1999 01:32:20 -0000	1.1
+++ themes/Default/config	27 Oct 2003 11:47:34 -0000
@@ -1,4 +1,6 @@
 wall-thickness = 6
 num-eyes = 2
+crossed-eyes = 1
+eye-depth = 300
 eye-pixmap = "Default-eye.png"
 pupil-pixmap = "Default-pupil.png"
Index: themes/Default-tiny/config
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/themes/Default-tiny/config,v
retrieving revision 1.1
diff -u -r1.1 config
--- themes/Default-tiny/config	26 Aug 1999 01:53:02 -0000	1.1
+++ themes/Default-tiny/config	27 Oct 2003 11:47:34 -0000
@@ -1,4 +1,6 @@
 wall-thickness = 3
 num-eyes = 2
+crossed-eyes = 1
+eye-depth = 300
 eye-pixmap = "Default-tiny-eye.png"
 pupil-pixmap = "Default-tiny-pupil.png"
Index: themes/Horrid/config
===================================================================
RCS file: /cvs/gnome/gnome-applets/geyes/themes/Horrid/config,v
retrieving revision 1.1
diff -u -r1.1 config
--- themes/Horrid/config	4 Aug 1999 02:00:09 -0000	1.1
+++ themes/Horrid/config	27 Oct 2003 11:47:34 -0000
@@ -1,4 +1,5 @@
 wall-thickness = 6
 num-eyes = 1
+eye-depth = 400
 eye-pixmap = "horrid_eye.png"
 pupil-pixmap = "horrid_pupil.png"

