Improve color handling approach

This commit is contained in:
schmelczerandras 2020-10-13 22:37:23 +02:00
parent e53ca905af
commit f29293c475
22 changed files with 259 additions and 181 deletions

View file

@ -1,4 +1,4 @@
import { vec3, vec4 } from 'gl-matrix';
import { vec3 } from 'gl-matrix';
import { RuntimeSettings } from './runtime-settings';
/**
@ -9,7 +9,6 @@ export const defaultRuntimeSettings: RuntimeSettings = {
tileMultiplier: 8,
isWorldInverted: false,
lightCutoffDistance: 400,
backgroundColor: vec4.fromValues(1, 1, 1, 1),
colorPalette: [],
ambientLight: vec3.fromValues(0.25, 0.15, 0.25),
textures: {},

View file

@ -1,3 +1,4 @@
import { vec4 } from 'gl-matrix';
import { StartupSettings } from './startup-settings';
/**
@ -7,5 +8,6 @@ export const defaultStartupSettings: StartupSettings = {
shadowTraceCount: 16,
paletteSize: 256,
ignoreWebGL2: false,
backgroundColor: vec4.fromValues(1, 1, 1, 1),
enableStopwatch: false,
};

View file

@ -38,18 +38,13 @@ export interface RuntimeSettings {
*/
lightCutoffDistance: number;
/**
* The default background color of the scene, can have transparency.
*/
backgroundColor: vec3 | vec4;
/**
* Its length should be less than the one specified in [[StartupSettings]].paletteSize.
*
* The possible colors for the objects. Each color is referenced by its index in the
* palette.
*
* Can have transparency.
* Can have transparency, but only if WebGL2 support is enabled.
*/
colorPalette: Array<vec3 | vec4>;

View file

@ -1,3 +1,5 @@
import { vec3, vec4 } from 'gl-matrix';
/**
* Interface for a configuration object containing the settings
* that need to be given before shader compilation.
@ -31,6 +33,11 @@ export interface StartupSettings {
*/
paletteSize: number;
/**
* The default background color of the scene, can have transparency on every platform.
*/
backgroundColor: vec3 | vec4;
/**
* When set to `true`, rendering will fall back to WebGL
* even when WebGL2 is present.