-
Notifications
You must be signed in to change notification settings - Fork 0
/
raytrace.h
executable file
·55 lines (46 loc) · 919 Bytes
/
raytrace.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
#ifndef __RAYTRACE_H
#define __RAYTRACE_H
#include "Definition.h"
//material with reflection coefficient and color
struct material {
float reflection;
float red, green, blue;
int mode;
float power;
float specular;
};
//sphere with origin, radius and material
struct sphere {
point pos;
float size;
int materialId;
};
//plane with a point, normal and material
struct plane {
point pos;
vector3d normal;
int materialId;
};
struct disc {
point pos;
float size;
vector3d normal;
int materialId;
};
//triangle with three points, normal and material
struct triangle{
point v0,v1,v2;
int materialId;
};
//light with a position and color intensity
struct light {
point pos;
color intensity;
};
//ray with a position and direction
struct ray {
point start;
vector3d dir;
};
#define invsqrtf(x) ((1.0f) / sqrtf(x))
#endif