651b64e52036564c822203b593996141e3631f16
[csgray] / src / csgray.h
1 #ifndef CSGRAY_H_
2 #define CSGRAY_H_
3
4 typedef union csg_object csg_object;
5
6 int csg_init(void);
7 void csg_destroy(void);
8
9 void csg_view(float x, float y, float z, float tx, float ty, float tz);
10 void csg_fov(float fov);
11
12 int csg_load(const char *fname);
13 int csg_save(const char *fname);
14
15 void csg_add_object(csg_object *parent, csg_object *child);
16 void csg_remove_object(csg_object *parent, csg_object *child);
17 void csg_free_object(csg_object *o);
18
19 csg_object *csg_null(float x, float y, float z);
20 csg_object *csg_sphere(float x, float y, float z, float r);
21 csg_object *csg_cylinder(float x0, float y0, float z0, float x1, float y1, float z1, float r);
22 csg_object *csg_plane(float x, float y, float z, float nx, float ny, float nz);
23 csg_object *csg_box(float x, float y, float z, float xsz, float ysz, float zsz);
24
25 csg_object *csg_union(csg_object *a, csg_object *b);
26 csg_object *csg_intersection(csg_object *a, csg_object *b);
27 csg_object *csg_subtraction(csg_object *a, csg_object *b);
28
29 void csg_emission(csg_object *o, float r, float g, float b);
30 void csg_color(csg_object *o, float r, float g, float b);
31 void csg_roughness(csg_object *o, float r);
32 void csg_opacity(csg_object *o, float p);
33
34 void csg_render_pixel(int x, int y, float *color);
35 void csg_render_image(float *pixels, int width, int height);
36
37 #endif  /* CSGRAY_H_ */