-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstage.c
More file actions
41 lines (36 loc) · 748 Bytes
/
Copy pathstage.c
File metadata and controls
41 lines (36 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "raytracer.h"
char *stage_tos(stage stg)
{
char buf[512];
int i;
for (i=0; i<512; i++)
buf[i] = '\0';
char *sc = camera_tos(stg.c);
char *ss = scene_tos(stg.s);
sprintf(buf,"%s%s", sc, ss);
free(sc);
free(ss);
return strdup(buf);
}
void stage_show(FILE *f, stage stg)
{
char *sc = camera_tos(stg.c);
char *ss = scene_tos(stg.s);
fprintf(f,"%s%s", sc, ss);
free(sc);
free(ss);
}
/* get_stage : returns a valid stage */
stage get_stage(unsigned int selection)
{
xyz loc = xyz_expr(0,0,0);
camera c = {loc, selection, selection};
color col = color_expr(0,0,0);
scene s = {col, NULL};
stage st = {c,s};
return st;
}