camera object
void camera_init(FILE*,camera_t**,int);
void camera_del(camera_t**);
void camera_load_attributes(FILE*, camera_t*);
void camera_print(camera_t*,FILE*);
char* camera_getname(camera_t*);
typedef struct model_type
{
camera_t *cam;
list_t *mats;
list_t *objs;
} model_t;
main()
routine works unaltered:
int main(int argc, char *argv[])
{
model_t *model;
FILE *model_file=NULL;
if(argc != 2) {
fprintf(stderr,"Usage: %s \n",argv[0]);
exit(1);
}
// open model file
if((model_file = fopen(argv[1],"r")) == NULL) {
printf("Error opening input file: %s\n",argv[1]);
return;
}
// create model
model = model_init(model_file);
// close file
fclose(model_file);
// verify that we have the model
// (can implement either way, with FILE* or without)
//model_print(model);
model_print(model,stdout);
// free up memory
model_del(model);
return(0);
}
camera cam1
{
pixeldim 640 480
worlddim 8 6
viewpoint 4 3 6
}
material green
{
ambient 0 5 0
}
material yellow
{
ambient 5 4 0
diffuse 4 4 0
specular 1 1 1
}
plane leftwall
{
material green
normal 3 0 1
point 0 0 0
}
plane rightwall
{
material yellow
normal -3 0 1
point 8 0 0
}
material gray
{
ambient 2 2 2
}
plane floor
{
material gray
normal 0 1 0
point 0 -0.2 0
}
loaded cam1
loaded green
loaded yellow
loaded leftwall
loaded rightwall
loaded gray
loaded floor
camera cam1
{
pixeldim 640 480
worlddim 8 6
viewpoint 4 3 6
}
material green
{
ambient 0 5 0
}
material yellow
{
ambient 5 4 0
diffuse 4 4 0
specular 1 1 1
}
material gray
{
ambient 2 2 2
}
plane leftwall
{
material green
normal 3 0 1
point 0 0 0
}
plane rightwall
{
material yellow
normal -3 0 1
point 8 0 0
}
plane floor
{
material gray
normal 0 1 0
point 0 -0.2 0
}
tar.gz
archive of your asg2/ directory, including:
README file containing
Makefile
.h headers and .c source)
make clean before tar)
submit notes.