Exemple #1
0
main(int argc, char **argv)
{
  Prim *o;
  Color c; int u, v;
  Ray r; Inode *l;

  o = sphere_instance(&sphere_funcs);
  init_sdl();
  s = scene_read();
  init_render();

  for (v = s->view->sc.ll.y; v < s->view->sc.ur.y; v += 1) {
    for (u = s->view->sc.ll.x; u < s->view->sc.ur.x; u += 1) {
      r = ray_unit(ray_transform(ray_view(u, v), mclip));
      if ((l = ray_intersect(s->objs, r)) != NULL) 
        c = point_tshade(ray_point(r, l->t), l->n, s->view->center, rc, l->m, o);
      else 
	c = bgcolor;
      inode_free(l);
      img_putc(s->img, u, v, col_dpymap(c));
    }
  }
  img_write(s->img,"stdout",0);
  exit(0);
}
Exemple #2
0
void phong_shadepaint(Vector4 p, int n, int lv, Real lt, int rv, Real rt, Real st, void *data)
{
  PhongData *d = data;
  Vector3 pv = v3_v4conv(seg_bilerp(d->pnts, n, st, lv, lt, rv, rt));
  Vector3 pn = v3_unit(v3_v4conv(seg_bilerp(d->norms, n, st, lv, lt, rv, rt)));
  Color c = point_shade(pv, pn, d->v, d->rc, d->rc->m);
  img_putc(d->rc->img, p.x, p.y, col_dpymap(c));
}
Exemple #3
0
main(int argc, char **argv)
{
    Color c;
    int u, v;
    Ray r;

    init_sdl();
    s = scene_read();
    init_render();

    for (v = s->view->sc.ll.y; v < s->view->sc.ur.y; v += 1) {
        for (u = s->view->sc.ll.x; u < s->view->sc.ur.x; u += 1) {
            r = ray_unit(ray_transform(ray_view(u, v), mclip));
            c = ray_shade(0, 1., r, rc, s->objs);
            img_putc(s->img, u, v, col_dpymap(c));
        }
    }
    img_write(s->img,"stdout",0);
    exit(0);
}
Exemple #4
0
void gouraud_paint(Vector4 p, int n, int lv, Real lt, int rv, Real rt, Real st,void *data)
{
  GouraudData *d = data;
  Vector3 c = v3_v4conv(seg_bilerp(d->cols, n, st, lv, lt, rv, rt));
  img_putc(d->img, p.x, p.y, col_dpymap(c));
}
Exemple #5
0
void flat_paint(Vector4 p, int n, int lv, Real lt, int rv, Real rt, Real st, void *data)
{
  FlatData *d = data;
  img_putc(d->img, p.x, p.y, col_dpymap(d->c));
}