-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhitable.h
More file actions
32 lines (24 loc) · 703 Bytes
/
hitable.h
File metadata and controls
32 lines (24 loc) · 703 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
#ifndef _HITABLE_H_
#define _HITABLE_H_
#include <stdbool.h>
#include "ray.h"
#define HITABLE_MEMBER(TYPE) \
bool (*hit)(const TYPE t, const Ray r, float t_min, float t_max, Hit_Record *rec);
typedef struct hit_record Hit_Record;
typedef struct hitable Hitable;
struct material;
struct hit_record {
float t;
Vector p;
Vector normal;
struct {
void *inst;
bool (*scatter)(const void *t, const Ray r_in, const Hit_Record rec, Vector *attenuation, Ray *scattered);
} mat_ptr;
};
struct hitable {
//HITABLE_MEMBER(Hitable);
void *inst;
bool (*hit)(const void *t, const Ray r, float t_min, float t_max, Hit_Record *rec);
};
#endif /* _HITABLE_H_ */