From be2039179c5e8ad62e2cf9c9a7170d5a97bd4059 Mon Sep 17 00:00:00 2001 From: Simon Stucki Date: Wed, 14 Aug 2024 08:47:06 +0200 Subject: [PATCH] Refactor clear color to use boolean instead of null Passing null is more error-prone --- strahl-lib/src/path-tracer.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/strahl-lib/src/path-tracer.ts b/strahl-lib/src/path-tracer.ts index 0b7b805..cce6389 100644 --- a/strahl-lib/src/path-tracer.ts +++ b/strahl-lib/src/path-tracer.ts @@ -84,7 +84,7 @@ export type PathTracerOptions = { viewProjectionConfiguration?: ViewProjectionConfiguration; environmentLightConfiguration?: EnvironmentLightConfig; samplesPerIteration?: number; - clearColor?: number[]; + clearColor?: number[] | false; maxRayDepth?: number; finishedSampling?: (result: { bvhBuildTime: number; @@ -704,8 +704,8 @@ async function runPathTracer( sunPower: Math.pow(10, environmentLightConfiguration.sun.power), sunAngularSize: environmentLightConfiguration.sun.angularSize, sunColor: environmentLightConfiguration.sun.color, - clearColor: isNil(clearColor) ? [0, 0, 0] : clearColor, - enableClearColor: isNil(clearColor) ? 0 : 1, + clearColor: clearColor === false ? [0, 0, 0] : clearColor, + enableClearColor: clearColor === false ? 0 : 1, maxRayDepth, objectDefinitionLength: groups.length, });