-
Notifications
You must be signed in to change notification settings - Fork 1
/
Types.fs
49 lines (39 loc) · 950 Bytes
/
Types.fs
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
namespace DummyPathtracer.Types
open System.Numerics
[<Struct>]
type Color = Color of Vector3
[<Struct>]
type Point3 = Point3 of Vector3
[<Struct>]
type Ray = { Origin: Point3; Direction: Vector3 }
[<Struct>]
type Material =
| Lambertian of albedo: Color
| Metal of metalAlbedo: Color * fuzz: float32
| Dielectric of indexOfRefraction: float32
[<Struct>]
type HitRecord =
{ P: Point3
Normal: Vector3
T: float32
FrontFace: bool
Material: Material }
[<Struct>]
type Sphere =
{ Center: Point3
Radius: float32
Material: Material }
[<Struct>]
type Hittable =
| Sphere of sphere: Sphere
| HittableList of list: HittableList
and [<Struct>] HittableList = { Objects: Hittable array }
type Camera =
{ CameraOrigin: Point3
LowerLeftCorner: Point3
Horizontal: Vector3
Vertical: Vector3
U: Vector3
V: Vector3
W: Vector3
LensRadius: float32 }