blob: 1f22d32d2c3203929d7c58cd44908a4c231fb23c (
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
44
45
46
47
48
49
50
51
|
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;
directMemoryTransfer: boolean;
chunkSize: number;
chunkAllocationMode: ChunkAllocationMode;
}
export enum ChunkAllocationMode {
SEQUENTIAL,
RANDOM,
CENTER_TO_EDGE,
EDGE_TO_CENTER
}
|