aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/index.ts b/src/index.ts
index c19edfc..f58cc5b 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -4,7 +4,7 @@ import {Plane, Sphere} from './models/Geometry';
import {Light} from './models/Light';
import {Albedo, Material} from './models/Material';
import {RaytraceDispatcher} from './RaytraceDispatcher';
-import {RaytraceContext, RaytracerOptions} from './models/RaytraceContext';
+import {ChunkAllocationMode, RaytraceContext, RaytracerOptions} from './models/RaytraceContext';
import {Vector} from './models/Vector';
import {Logger} from './Logger';
@@ -109,8 +109,8 @@ function parseOptions(): RaytracerOptions {
refractions: getInputElement('refractions-toggle').checked,
maxRecurseDepth: 5,
maxDrawDistance: 1000,
- bufferDrawCalls: getInputElement('buffer-draw').checked,
directMemoryTransfer: getInputElement('direct-transfer').checked,
+ chunkAllocationMode: getChunkAllocationMode()
};
}
@@ -132,6 +132,20 @@ function parseResolution(): {width: number; height: number} {
}
}
+function getChunkAllocationMode(): ChunkAllocationMode {
+ switch (getInputElement('chunk-allocation-mode').value) {
+ case 'SEQUENTIAL':
+ default:
+ return ChunkAllocationMode.SEQUENTIAL;
+ case 'RANDOM':
+ return ChunkAllocationMode.RANDOM
+ case 'CENTER_TO_EDGE':
+ return ChunkAllocationMode.CENTER_TO_EDGE
+ case 'EDGE_TO_CENTER':
+ return ChunkAllocationMode.EDGE_TO_CENTER
+ }
+}
+
function registerEventListeners() {
getRenderButton().addEventListener('click', render);