diff options
Diffstat (limited to 'material.go')
| -rw-r--r-- | material.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/material.go b/material.go new file mode 100644 index 0000000..db1e4d6 --- /dev/null +++ b/material.go @@ -0,0 +1,16 @@ +package main + +type Material interface { + Scatter(ray Ray, hit HitRecord) (Ray, Color) +} + +type Lambertian struct { + albedo Color +} + +func (lambertian Lambertian) Scatter(ray Ray, hit HitRecord) (Ray, Color) { + // TODO: Use the correct distribution + direction := AddVec3D(hit.normal, RandomInUnitSphere()) + scattered := Ray{hit.point, direction} + return scattered, lambertian.albedo +} |
