tinygi

view src/shape.h @ 2:72752a1b3dbe

images and shapes
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 21 Jul 2015 04:30:00 +0300
parents
children
line source
1 #ifndef TGI_SHAPE_H_
2 #define TGI_SHAPE_H_
4 #include "tinygi.h"
5 #include "vmath/vmath.h"
7 struct tgi_hitpoint {
8 float t;
9 ray_t ray, local_ray;
10 vec3_t pos, norm;
11 vec2_t uv;
12 struct tgi_shape *shape;
13 };
15 struct tgi_shape {
16 void *data; /* shape-specific data */
17 struct tgi_object *obj;
19 int (*intersect)(struct tgi_shape *shape, ray_t ray, struct tgi_hitpoint *hit);
20 };
22 struct tgi_sphere_data {
23 vec3_t pos;
24 float rad;
25 };
27 struct tgi_box_data {
28 vec3_t vmin, vmax;
29 };
31 #endif /* TGI_SHAPE_H_ */