sources:


website:
more info here


screenshot:
studies/grafik2/Computergrafik-Code6/Aufgabe17/UTIL.H
download file

  1 #ifndef _UTIL_H
  2 #define _UTIL_H
  3
  4 #include "vector.h"
  5 #include "triangle.h"
  6 #include "box.h"
  7 #include "sphere.h"
  8 #include <fstream.h>
  9
 10
 11 // Color class
 12 typedef Vector Color;
 13
 14
 15 // Camera class
 16 class Camera {
 17 public:
 18     Camera(const Vector& f, const Vector& t, const Vector& u, double fo)
 19         : from(f), to(t), up(u.normalized()), fovy(fo) {}
 20     Vector from;
 21     Vector to;
 22     Vector up;
 23     double fovy;
 24 };
 25
 26 // Light class
 27 class Light {
 28 public:   
 29     Light(const Vector& p, double i, double a)
 30         : pos(p),intensity(i),ambient(a),att_constant(1), att_linear(0), att_quadric(0) {}
 31    
 32     Vector pos;                  /* position, world coordinate system */
 33     double intensity;            /* light source intensity [0,1] */
 34     double ambient;              /* ambient light contribution */
 35     double att_constant;         /* attenuation factors */
 36     double att_linear;
 37     double att_quadric;
 38 };
 39
 40
 41 // Material class
 42 class Material {
 43 public:
 44     Material(double ka_,double kd_,double ks_,double n_, double opacity_, double lightspeed_, Color c)
 45         : ka(ka_), kd(kd_), ks(ks_), n(n_), opacity(opacity_), lightspeed(lightspeed_), color(c) {}
 46    
 47     double ka;                   /* ambient reflection coefficient */
 48     double kd;                   /* diffuse reflection coefficient */
 49     double ks;                   /* specular reflection coefficient */
 50     double n;                    /* specular shininess */
 51     double opacity;                 /* opacity, 1=no refraction */
 52     double lightspeed;             /* speed of light, used for refraction */
 53     Color color;                 /* specular color */   
 54 };
 55
 56
 57 #endif // _UTIL_H
 58
 59