aboutsummaryrefslogtreecommitdiff
path: root/src/RaytraceContext.ts
diff options
context:
space:
mode:
authorJames Barnett <noreply@jamesbarnett.xyz>2022-01-02 18:23:36 +0000
committerJames Barnett <noreply@jamesbarnett.xyz>2022-01-02 18:23:36 +0000
commite075667cd2dc878dd9dceb07c85719f6712bcda1 (patch)
tree414e76418d92a39c59b1f5faf08289c0a729ddb4 /src/RaytraceContext.ts
parent7ad1b7efabea1349107669a432e6c88305f8d825 (diff)
downloadjs-raytracer-e075667cd2dc878dd9dceb07c85719f6712bcda1.tar.xz
js-raytracer-e075667cd2dc878dd9dceb07c85719f6712bcda1.zip
Implement multi-threaded rendering
Diffstat (limited to 'src/RaytraceContext.ts')
-rw-r--r--src/RaytraceContext.ts35
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;
+}