Ejemplo n.º 1
0
Archivo: shade.c Proyecto: cheque/s3d
void gouraud_shade(Hpoly *c, Hpoly *p, Hpoly *n, Vector3 v, RContext *rc, Material *m)
{
  int i;
  for (i = 0; i < p->n; i++)
    c->v[i] = v4_v3conv((*m->luminance)(rc_set(rc, v3_unit(v3_sub(v, v3_v4conv(p->v[i]))), 
					       v3_v4conv(p->v[i]), v3_v4conv(n->v[i]), m)));
}
Ejemplo n.º 2
0
void
rc_set_int(guchar *key, gint value)
{
   guchar buf[20];

   sprintf(buf, "%i", value);
   rc_set(key, g_strdup(buf));
}
Ejemplo n.º 3
0
WORD gsx_start(VOID)
{
	WORD		char_height, nc, attrib[10];

	gl_xclip = 0;
	gl_yclip = 0;
	gl_width = gl_wclip = gl_ws.ws_xres + 1;
	gl_height = gl_hclip = gl_ws.ws_yres + 1;

	nc = gl_ws.ws_ncolors;
	gl_nplanes = 0;
	while (nc != 1)
	{
		nc >>= 1;
		gl_nplanes++;
	}
	vqt_attributes( gl_handle, &attrib[0] );
	gl_ws.ws_chmaxh = attrib[7];
	gl_ws.ws_pts2 = attrib[6];
	char_height = gl_ws.ws_chminh;
	vst_height( gl_handle, char_height,
				&gl_wsptschar, &gl_hsptschar, 
				&gl_wschar, &gl_hschar );
	char_height = gl_ws.ws_chmaxh;
	vst_height( gl_handle, char_height,
				&gl_wptschar, &gl_hptschar, 
				&gl_wchar, &gl_hchar );
	gl_ncols = gl_width / gl_wchar;
	gl_nrows = gl_height / gl_hchar;
	gl_hbox = gl_hchar + 3;
	gl_wbox = (gl_hbox * gl_ws.ws_hpixel) / gl_ws.ws_wpixel;
	vsl_type( gl_handle, 7 );
	vsl_width( gl_handle, 1 );
	vsl_udsty( gl_handle, 0xffff );
	rc_set(&gl_rscreen, 0, 0, gl_width, gl_height);
	rc_set(&gl_rfull, 0, gl_hbox, gl_width, (gl_height - gl_hbox));
	rc_set(&gl_rzero, 0, 0, 0, 0);
	rc_set(&gl_rcenter, (gl_width-gl_wbox)/2, (gl_height-(2*gl_hbox))/2, 
			gl_wbox, gl_hbox);
	rc_set(&gl_rmenu, 0, 0, gl_width, gl_hbox);
	ad_intin = (LONG)ADDR(&intin[0]);
	return (TRUE);
}
Ejemplo n.º 4
0
static void
rc_load_gtkseerc()
{
   FILE *file;
   guchar line[256], *value;
   gint len;

   if ((file = fopen(gtkseerc_file, "r")) == NULL) return;
   while (fgets(line, 255, file) != NULL)
   {
      if (line[0] == '#') continue;
      len = strlen(line);
      if (len < 4) continue;
      if (line[len - 1] == '\n')
      {
         line[len - 1] = '\0';
      }
      value = strchr(line, '=');
      if (value == NULL) continue;
      *value++ = '\0';
      rc_set(line, value);
   }
   fclose(file);
}
Ejemplo n.º 5
0
void
rc_init()
{
   guchar *home;
   struct stat st;
   FILE *file;

   /*
    * Setting up gtksee_dir.
    * Should be $HOME/.gtksee
    */
   if ((home = getenv("HOME")) == NULL)
   {
      rc_initialized = FALSE;
      return;
   }
   strcpy(gtksee_dir, home);
   if (gtksee_dir[strlen(gtksee_dir) - 1] != '/') strcat(gtksee_dir, "/");
   strcat(gtksee_dir, ".gtksee");
   if (stat(gtksee_dir, &st))
   {
      /* Cannot stat gtksee_dir.
       * Try to create a new one.
       */
      if (mkdir(gtksee_dir, 00755))
      {
         rc_initialized = FALSE;
         return;
      }
      g_print("Created directory: %s\n", gtksee_dir);
   }

   /*
    * Setting up gtkrc_file.
    * Should be $gtksee_dir/gtkrc
    */
   strcpy(gtkrc_file, gtksee_dir);
   strcat(gtkrc_file, "/gtkrc");
   if (stat(gtkrc_file, &st))
   {
      /* Cannot stat gtkrc file.
       * Try to create a new one.
       */
      if ((file = fopen(gtkrc_file, "w")) == NULL)
      {
         rc_initialized = FALSE;
         return;
      }
      /* Writing contents here for gtkrc */

      fclose(file);
      g_print("Created file: %s\n", gtkrc_file);
   } else
   {
      rc_load_gtkrc();
   }

   /*
    * Setting up gtkseerc_file.
    * Should be $gtksee_dir/gtkseerc
    */
   strcpy(gtkseerc_file, gtksee_dir);
   strcat(gtkseerc_file, "/gtkseerc");
   rc_conf = g_hash_table_new(
      (GHashFunc)strtohash,
      (GCompareFunc)rc_key_compare_func);
   if (stat(gtkseerc_file, &st))
   {
      /* Cannot stat gtkseerc file.
       * Try to create a new one.
       */
      if ((file = fopen(gtkseerc_file, "w")) == NULL)
      {
         rc_initialized = FALSE;
         return;
      }
      fclose(file);
      /* Setting default values */
      rc_set_int("slideshow_delay", 5000);
      rc_set_boolean("full_screen", FALSE);
      rc_set_boolean("fit_screen", FALSE);
      rc_set_boolean("show_hidden", FALSE);
      rc_set_boolean("hide_non_images", FALSE);
      rc_set_boolean("fast_preview", FALSE);
      rc_set_int("image_list_type", 0);
      rc_set_int("image_sort_type", 0);
      rc_set("root_directory", "/");
      rc_set("hidden_directory", "/dev:/proc:.xvpics");
      rc_save_gtkseerc();
      g_print("Created file: %s\n", gtkseerc_file);
   } else
   {
      rc_load_gtkseerc();
   }

   rc_initialized = TRUE;
}
Ejemplo n.º 6
0
void
rc_set_boolean(guchar *key, gboolean value)
{
   rc_set(key, value ? "1" : "0");
}
Ejemplo n.º 7
0
Archivo: shade.c Proyecto: cheque/s3d
Color point_shade(Vector3 p, Vector3 n, Vector3 v, RContext *rc, Material *m)
{
  return (*m->luminance)(rc_set(rc, v3_unit(v3_sub(v, p)), p, n, m));
}
Ejemplo n.º 8
0
Archivo: shade.c Proyecto: cheque/s3d
Color flat_shade(Hpoly *p, Vector3 v, RContext *rc, Material *m)
{
  Vector3 c = hpoly_centr(p);
  Vector3 n = hpoly_normal(p);
  return (*m->luminance)(rc_set(rc, v3_unit(v3_sub(v, c)), c, n, m));
}