/* * CG Experiment Headers * 1996/10 KAMEDA Yoshinari */ #define AX 0 #define AY 1 #define AZ 2 #define AA 3 #define AR 0 #define AG 1 #define AB 2 #define D_PARA_LIGHT 0 #define D_POINT_LIGHT 1 #define D_DIFF_LIGHT 0 #define D_SPEC_LIGHT 1 #define D_AMBI_LIGHT 2 #define Z_LOWEST ((float)-3.40282346638528860e+38) #define MBS 256 typedef unsigned char uchar; typedef double Matrix[4][4]; typedef double APos[4]; typedef double ACol[4]; typedef int Tri[3]; typedef struct { int w; /* width */ int h; /* height */ uchar *b; /* pointer to the PPM image buffer */ double *z; /* pointer to the z buffer */ } ImgBuf; typedef struct { APos o; /* Original Euclid Coordinate (3D)*/ APos p; /* Projected Euclid Coordinate (2D)*/ } Vert; typedef struct { ACol i; /* Light Intensity in RGB*/ APos d; /* Light Direction (Parallel Source) */ APos p; /* Light Source Location (Point Light) */ int pp; /* 0:parallel, 1:point */ int s; /* 0:DIFFUSE, 1:SPECULAR, 2:AMBIENT */ } Lelem; typedef struct { ACol diff; /* Diffuse in RGB */ ACol spec; /* Specular in RGB */ ACol ambi; /* Ambient in RGB */ double shine; /* Shiness */ } Oelem; typedef struct { APos p; /* Camera Position */ APos d; /* Direction to look at */ double f; /* Focus */ } Celem; typedef struct { APos *v; /* Vertex List */ Tri *t; /* Triangle list */ int nv; /* number of vertice */ int nt; /* number of triangles */ } Selem;