-
Notifications
You must be signed in to change notification settings - Fork 0
/
raytracer.h
77 lines (62 loc) · 1.01 KB
/
raytracer.h
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef __RTCL_RAYTRACER__
#define __RTCL_RAYTRACER__
#include <OpenCL/opencl.h>
#define v_X (0)
#define v_Y (1)
#define v_Z (2)
#define v_W (3)
#define c_R (0)
#define c_G (1)
#define c_B (2)
#define c_A (3)
#define MATTE 1
#define MIRROR 2
#define LIGHT 3
typedef struct vec3 {
float s[3];
} vec3;
typedef struct vec4 {
float s[4];
} vec4;
typedef struct color3 {
float s[3];
} color3;
typedef struct color4 {
float s[4];
} color4;
struct ray {
vec3 position;
vec3 direction;
};
struct pixel {
color4 color;
};
struct camera {
vec3 position;
vec3 direction;
float clip_near;
float clip_far;
float focal_length;
int screen_width;
int screen_height;
};
struct sphere {
vec3 position;
float radius;
color4 color;
float material_type;
};
struct plane {
vec3 position;
vec3 normal;
color4 color;
float material_type;
};
struct box {
vec3 position;
vec3 vmin;
vec3 vmax;
color4 color;
float material_type;
};
#endif