Esempio n. 1
0
File: main.c Progetto: mattjakob/s3d
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);
}
Esempio n. 2
0
File: shade.c Progetto: cheque/s3d
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));
}
Esempio n. 3
0
File: main.c Progetto: mattjakob/s3d
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);
}
Esempio n. 4
0
File: shade.c Progetto: cheque/s3d
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));
}
Esempio n. 5
0
File: shade.c Progetto: cheque/s3d
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));
}