diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2022-01-03 21:09:23 +0000 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2022-01-03 21:09:23 +0000 |
| commit | 496c63266d02bc9369e3406353b877a8ebbae60a (patch) | |
| tree | 492af5590ac21a70099e2ac7cb38ca91dce3a694 /src/Geometry.ts | |
| parent | 026a006b410a0132c2cb573edff4352b4333b857 (diff) | |
| download | js-raytracer-496c63266d02bc9369e3406353b877a8ebbae60a.tar.xz js-raytracer-496c63266d02bc9369e3406353b877a8ebbae60a.zip | |
Implement refraction
Diffstat (limited to 'src/Geometry.ts')
| -rw-r--r-- | src/Geometry.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Geometry.ts b/src/Geometry.ts index 9bef1a7..41d6023 100644 --- a/src/Geometry.ts +++ b/src/Geometry.ts @@ -1,6 +1,6 @@ import {Type} from 'class-transformer'; import {Colour} from './Colour'; -import {Material} from './Material'; +import {Albedo, Material} from './Material'; import {Vector} from './Vector'; export class Sphere { @@ -29,11 +29,12 @@ export class Plane { getMaterialAtPoint(x: number, z: number): Material { let colour: Colour; + // prettier-ignore if ((Math.round(this.checkerboardScale * x) + Math.round(this.checkerboardScale * z)) & 1) { colour = new Colour(15, 15, 15); } else { colour = new Colour(200, 200, 200); } - return new Material(colour, 1, 0, 0, 0); + return new Material(colour, new Albedo(1, 0, 0, 0), 0, 1); } } |