aboutsummaryrefslogtreecommitdiff
path: root/src/RaytraceContext.ts
blob: acd43365bdd49af70b5680b2ad82b89c469a7a75 (plain)
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
import {Type} from 'class-transformer';
import {Colour} from './Colour';
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[];
  @Type(() => Colour)
  readonly backgroundColour: Colour;
  constructor(
    readonly height: number,
    readonly width: number,
    readonly fov: number,
    spheres: Sphere[],
    planes: Plane[],
    lights: Light[],
    backgroundColour: Colour,
    readonly options: RaytracerOptions
  ) {
    this.spheres = spheres;
    this.planes = planes;
    this.lights = lights;
    this.backgroundColour = backgroundColour;
  }
}

export interface RaytracerOptions {
  numThreads: number;
  shadows: boolean;
  diffuseLighting: boolean;
  specularLighting: boolean;
  reflections: boolean;
  refractions: boolean;
  maxRecurseDepth: number;
  maxDrawDistance: number;
  bufferDrawCalls: boolean;
  directMemoryTransfer: boolean;
}