Esempio n. 1
0
File: lang.c Progetto: mattjakob/s3d
Val view_parse(int pass, Pval *pl)
{
  Val v = {V_NULL, 0};
  if (pass == T_EXEC) {
    View *view = initview();

    Vector3 ref = pvl_get_v3(pl, "from", v3_make(0,-5,0));
    Vector3 at = pvl_get_v3(pl, "at", v3_make(0,0,0));
    Vector3 up = pvl_get_v3(pl, "up", v3_make(0,0,1));
    double fov = pvl_get_num(pl, "fov", 90);
    double w = pvl_get_num(pl, "imgw", 320);
    double h = pvl_get_num(pl, "imgh", 240);

    lookat(view, ref.x, ref.y, ref.z, at.x, at.y, at.z, up.x, up.y, up.z);
    setviewpoint(ref.x, ref.y, ref.z);
    setviewnormal(at.x - ref.x ,at.y - ref.y, at.z - ref.z);
    makeviewV();

    perspective(view, fov * DTOR, w/h, 1.0, 100000.0);
    viewport(view, 0.,0., w, h);

    v.type = V_CAMERA;
    v.u.v = view;
  }
  return v;
}
Esempio n. 2
0
File: cylin.c Progetto: cheque/s3d
Val cylin_parse(int pass, Pval *pl)
{
  Val v = {V_NULL, {0}};

  if (pass == T_EXEC) {
    Vector3 bc = pvl_get_v3(pl, "center", v3_make(0,0,0));
    double h = pvl_get_num(pl, "height", 1);
    double r = pvl_get_num(pl, "radius", 1);
    v.type = V_PRIM;
    cylin_set(v.u.v = cylin_instance(&cylin_funcs), bc, h, r);
  };
  return v;
}
Esempio n. 3
0
File: torus.c Progetto: cheque/s3d
Val torus_parse(int pass, Pval *pl)
{
  Val v = {V_NULL, {0}};

  if (pass == T_EXEC) {
    Vector3 c = pvl_get_v3(pl, "center", v3_make(0,0,0));
    double r = pvl_get_num(pl, "radius", 1);
    double R = pvl_get_num(pl, "Radius", 2);
    v.type = V_PRIM;
    torus_set(v.u.v = torus_instance(&torus_funcs), c, r, R);
  }
  return v;
}