Finish documentation

This commit is contained in:
schmelczerandras 2020-09-28 16:26:55 +02:00
parent 49473bf905
commit 31fcfd3d6b
86 changed files with 1383 additions and 8485 deletions

View file

@ -0,0 +1,15 @@
import { vec3, vec4 } from 'gl-matrix';
import { RuntimeSettings } from './runtime-settings';
/**
* Contains the default values used for [[RuntimeSettings]].
*/
export const defaultRuntimeSettings: RuntimeSettings = {
enableHighDpiRendering: true,
tileMultiplier: 8,
isWorldInverted: false,
lightCutoffDistance: 400,
backgroundColor: vec4.fromValues(1, 1, 1, 1),
colorPalette: [],
ambientLight: vec3.fromValues(0.25, 0.15, 0.25),
};

View file

@ -1,5 +1,8 @@
import { StartupSettings } from './startup-settings';
/**
* Contains the default values used for [[StartupSettings]].
*/
export const defaultStartupSettings: StartupSettings = {
shadowTraceCount: 16,
paletteSize: 256,

View file

@ -1,11 +1,59 @@
import { vec3, vec4 } from 'gl-matrix';
/**
* Interface for a configuration object containing the settings
* that can be changed during runtime.
*
* The default values for RuntimeSettings can be found in [[defaultRuntimeSettings]].
*/
export interface RuntimeSettings {
/**
* When set to `true` rendering will be done on the screen's real resolution.
*/
enableHighDpiRendering: boolean;
/**
* First, the SDF of the scene is evaluated at every single pixel.
* For speeding this process up, the screen is divided up into tiles,
* this way each having to deal with a fewer objects.
*
* For each tile, it is decided which objects are near its close vicinity.
* This comes with some overhead for the CPU, while saving the GPU from loads of
* calculations. The workload can be balanced between the CPU and the GPU by setting
* this number.
*/
tileMultiplier: number;
/**
* By default, every pixel is outside of objects. Flipping this value to `true` will
* result in every pixel being inside a large object. From then it only makes sense to
* draw inverted objects.
*/
isWorldInverted: boolean;
/**
* When lights reach the end of the display, they are slowly faded out. The length
* of this phaseout can be set through this value.
*/
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.
*/
colorPalette: Array<vec3 | vec4>;
/**
* A light affecting every pixel (even the ones inside objects).
*/
ambientLight: vec3;
}

View file

@ -1,5 +1,33 @@
/**
* Interface for a configuration object containing the settings
* that need to be given before shader compilation.
*
* The default values for StartupSettings can be found in [[defaultStartupSettings]].
*/
export interface StartupSettings {
/**
* The raytracing algorithm used for shadows requires a step count.
* Sensible values for this are between 8 and 32.
*
* The higher the number, the harder the shadows will get.
* Some ambient occlusion like effects can be visible on lower trace counts.
*/
shadowTraceCount: number;
/**
* Gives the number of possible object colors for the scene.
*
* When using WebGL, only 256 different colors can be used.
* On WebGL2, its value should not be larger than 4096 for
* maintaining compatibility with low-end devices.
*/
paletteSize: number;
/**
* When set to `true`, rendering will fall back to WebGL
* even when WebGL2 is present.
*
* Useful for testing compatibility.
*/
ignoreWebGL2: boolean;
}