diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2022-01-02 18:23:36 +0000 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2022-01-02 18:23:36 +0000 |
| commit | e075667cd2dc878dd9dceb07c85719f6712bcda1 (patch) | |
| tree | 414e76418d92a39c59b1f5faf08289c0a729ddb4 /src/RaytraceContext.ts | |
| parent | 7ad1b7efabea1349107669a432e6c88305f8d825 (diff) | |
| download | js-raytracer-e075667cd2dc878dd9dceb07c85719f6712bcda1.tar.xz js-raytracer-e075667cd2dc878dd9dceb07c85719f6712bcda1.zip | |
Implement multi-threaded rendering
Diffstat (limited to 'src/RaytraceContext.ts')
| -rw-r--r-- | src/RaytraceContext.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/RaytraceContext.ts b/src/RaytraceContext.ts new file mode 100644 index 0000000..3629f5a --- /dev/null +++ b/src/RaytraceContext.ts @@ -0,0 +1,35 @@ +import {Type} from 'class-transformer'; +import {Plane, Sphere} from './Geometry'; +import {Light} from './Light'; + +export class RaytraceContext { + @Type(() => Sphere) + readonly spheres: Sphere[]; + @Type(() => Plane) + readonly planes: Plane[]; + @Type(() => Light) + readonly lights: Light[]; + constructor( + readonly height: number, + readonly width: number, + readonly fov: number, + spheres: Sphere[], + planes: Plane[], + lights: Light[], + readonly options: RaytracerOptions + ) { + this.spheres = spheres; + this.planes = planes; + this.lights = lights; + } +} + +export interface RaytracerOptions { + numThreads: number; + shadows: boolean; + diffuseLighting: boolean; + specularLighting: boolean; + reflections: boolean; + maxRecurseDepth: number; + maxDrawDistance: number; +} |