tinygi

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/shape.h	Tue Jul 21 04:30:00 2015 +0300
     1.3 @@ -0,0 +1,31 @@
     1.4 +#ifndef TGI_SHAPE_H_
     1.5 +#define TGI_SHAPE_H_
     1.6 +
     1.7 +#include "tinygi.h"
     1.8 +#include "vmath/vmath.h"
     1.9 +
    1.10 +struct tgi_hitpoint {
    1.11 +	float t;
    1.12 +	ray_t ray, local_ray;
    1.13 +	vec3_t pos, norm;
    1.14 +	vec2_t uv;
    1.15 +	struct tgi_shape *shape;
    1.16 +};
    1.17 +
    1.18 +struct tgi_shape {
    1.19 +	void *data; /* shape-specific data */
    1.20 +	struct tgi_object *obj;
    1.21 +
    1.22 +	int (*intersect)(struct tgi_shape *shape, ray_t ray, struct tgi_hitpoint *hit);
    1.23 +};
    1.24 +
    1.25 +struct tgi_sphere_data {
    1.26 +	vec3_t pos;
    1.27 +	float rad;
    1.28 +};
    1.29 +
    1.30 +struct tgi_box_data {
    1.31 +	vec3_t vmin, vmax;
    1.32 +};
    1.33 +
    1.34 +#endif	/* TGI_SHAPE_H_ */