tinygi

annotate 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
rev   line source
nuclear@2 1 #ifndef TGI_SHAPE_H_
nuclear@2 2 #define TGI_SHAPE_H_
nuclear@2 3
nuclear@2 4 #include "tinygi.h"
nuclear@2 5 #include "vmath/vmath.h"
nuclear@2 6
nuclear@2 7 struct tgi_hitpoint {
nuclear@2 8 float t;
nuclear@2 9 ray_t ray, local_ray;
nuclear@2 10 vec3_t pos, norm;
nuclear@2 11 vec2_t uv;
nuclear@2 12 struct tgi_shape *shape;
nuclear@2 13 };
nuclear@2 14
nuclear@2 15 struct tgi_shape {
nuclear@2 16 void *data; /* shape-specific data */
nuclear@2 17 struct tgi_object *obj;
nuclear@2 18
nuclear@2 19 int (*intersect)(struct tgi_shape *shape, ray_t ray, struct tgi_hitpoint *hit);
nuclear@2 20 };
nuclear@2 21
nuclear@2 22 struct tgi_sphere_data {
nuclear@2 23 vec3_t pos;
nuclear@2 24 float rad;
nuclear@2 25 };
nuclear@2 26
nuclear@2 27 struct tgi_box_data {
nuclear@2 28 vec3_t vmin, vmax;
nuclear@2 29 };
nuclear@2 30
nuclear@2 31 #endif /* TGI_SHAPE_H_ */