@@ -391,6 +391,10 @@ declare module '@lightningjs/blits' {
391391 */
392392 h : number
393393 } ) => void
394+ /**
395+ * Updates the Renderer settings at runtime
396+ */
397+ $updateSettings : ( options : RendererSettings ) => void
394398 }
395399
396400 /**
@@ -771,13 +775,12 @@ declare module '@lightningjs/blits' {
771775 type ReactivityModes = 'Proxy' | 'defineProperty'
772776 type RenderModes = 'webgl' | 'canvas'
773777
774- /**
775- * Settings
778+ /**
779+ * Renderer Settings
776780 *
777- * Launcher function that sets up the Lightning renderer and instantiates
778- * the Blits App
781+ * Lightning Renderer settings that can be configured via the Blits Settings object
779782 */
780- export interface Settings {
783+ export interface RendererSettings {
781784 /**
782785 * Width of the Application
783786 */
@@ -786,6 +789,155 @@ declare module '@lightningjs/blits' {
786789 * Height of the Application
787790 */
788791 h ?: number ,
792+ /**
793+ * Configures the gpu memory settings used by the renderer
794+ */
795+ gpuMemory ?: {
796+ /**
797+ * Maximum GPU memory threshold (in `mb`) after which
798+ * the renderer will immediately start cleaning up textures to free
799+ * up graphical memory
800+ *
801+ * When setting to `0`, texture memory management is disabled
802+ *
803+ * @default `200`
804+ */
805+ max ?: number ,
806+ /**
807+ * Target threshold of GPU memory usage, defined as a fraction of
808+ * the max threshold. The renderer will attempt to keep memory
809+ * usage below this target by cleaning up non-renderable textures
810+ *
811+ * @default `0.8`
812+ */
813+ target ?: number ,
814+ /**
815+ * Interval at which regular texture cleanups occur (in `ms`)
816+ *
817+ * @default `5000`
818+ */
819+ cleanupInterval ?: number ,
820+ /**
821+ * Baseline GPU memory usage of the App (in `mb`), without rendering any
822+ * textures. This value will be used as a basis when calculating
823+ * the total memory usage towards the max and target memory
824+ * usage
825+ *
826+ * @default `25`
827+ */
828+ baseline ?: number ,
829+ /**
830+ * Whether or not the max threshold should be considered
831+ * as a strict number that can not be exceeded in any way
832+ *
833+ * When set to `true`, new textures won't be created when the
834+ * max threshold has been reached, until agressive texture cleanup
835+ * has brought the memory back down
836+ *
837+ * @default false
838+ */
839+ strict ?: boolean ,
840+ } ,
841+ /**
842+ * Add an extra margin to the viewport for earlier pre-loading of elements and components
843+ *
844+ * By default the Lightning renderer, only renders elements that are inside the defined viewport.
845+ * Everything outside of these bounds is removed from the render tree.
846+ *
847+ * With the viewportMargin you have the option to _virtually_ increase the viewport area,
848+ * to expedite the pre-loading of elements and / or delay the unloading of elements depending
849+ * on their position in the (virtual) viewport
850+ *
851+ * The margin can be specified in 4 directions by defining an array [top, right, bottom, left],
852+ * or as a single number which is then applied to all 4 directions equally.
853+ *
854+ * Defaults to `0`
855+ */
856+ viewportMargin ?: number | [ number , number , number , number ] ,
857+ /**
858+ * Custom pixel ratio of the device used to convert dimensions
859+ * and positions in the App code to the actual device logical coordinates
860+ *
861+ * Takes presedence over the `screenResolution` setting
862+ *
863+ * Defaults to 1 if not specified
864+ */
865+ pixelRatio ?: number
866+ /**
867+ * Controls the quality of the rendered App.
868+ *
869+ * Setting a lower quality leads to less detail on screen, but can positively affect overall
870+ * performance and smoothness of the App (i.e. a higher FPS).
871+ *
872+ * The render quality can be one of the following presets:
873+ *
874+ * - `low` => 66% quality
875+ * - `medium` => 85% quality
876+ * - `high` => 100% quality
877+ * - `retina` => 200% quality
878+ *
879+ * It's also possible to provide a custom value as a (decimal) number:
880+ *
881+ * - `0.2` => 20% quality
882+ * - `1.5` => 150% quality
883+ *
884+ * Defaults to 1 (high quality) when not specified
885+ */
886+ renderQuality ?: RenderQualities ,
887+ /**
888+ * Background color of the canvas (also known as the clearColor)
889+ *
890+ * Can be a color name (red, blue, silver), a hexadecimal color (`#000000`, `#ccc`),
891+ * or a color number in rgba order (`0xff0033ff`)
892+ *
893+ * Defauls to transparent (`0x00000000`)
894+ *
895+ */
896+ canvasColor ?: string ,
897+ /**
898+ * Enable inspector
899+ *
900+ * Enables the inspector tool for debugging and inspecting the application, the node tree
901+ * will be replicated in the DOM and can be inspected using the browser's developer tools
902+ *
903+ * Defaults to `false`
904+ */
905+ inspector ?: boolean ,
906+ /**
907+ * Interval in milliseconds to receive FPS updates
908+ *
909+ * @remarks
910+ * If set to `0`, FPS updates will be disabled.
911+ *
912+ * @defaultValue `1000` (disabled)
913+ */
914+ fpsInterval ?: number ,
915+ /**
916+ * The maximum amount of time the renderer is allowed to process textures in a
917+ * single frame. If the processing time exceeds this limit, the renderer will
918+ * skip processing the remaining textures and continue rendering the frame.
919+ *
920+ * Defaults to `10`
921+ */
922+ textureProcessingTimeLimit ?: number ,
923+ /**
924+ * Maximum FPS at which the App will be rendered
925+ *
926+ * Lowering the maximum FPS value can improve the overall experience on lower end devices.
927+ * Targetting a lower FPS may gives the CPU more time to construct each frame leading to a smoother rendering.
928+ *
929+ * Defaults to `0` which means no maximum
930+ */
931+ maxFPS ?: number
932+ }
933+
934+ /**
935+ * Settings
936+ *
937+ * Launcher function that sets up the Lightning renderer and instantiates
938+ * the Blits App
939+ */
940+ export interface Settings extends RendererSettings {
789941 /**
790942 * Whether to enable multithreaded
791943 */
@@ -849,136 +1001,13 @@ declare module '@lightningjs/blits' {
8491001 */
8501002 screenResolution ?: ScreenResolutions ,
8511003 /**
852- * Controls the quality of the rendered App.
853- *
854- * Setting a lower quality leads to less detail on screen, but can positively affect overall
855- * performance and smoothness of the App (i.e. a higher FPS).
856- *
857- * The render quality can be one of the following presets:
858- *
859- * - `low` => 66% quality
860- * - `medium` => 85% quality
861- * - `high` => 100% quality
862- * - `retina` => 200% quality
863- *
864- * It's also possible to provide a custom value as a (decimal) number:
865- *
866- * - `0.2` => 20% quality
867- * - `1.5` => 150% quality
868- *
869- * Defaults to 1 (high quality) when not specified
870- */
871- renderQuality ?: RenderQualities ,
872- /**
873- * Custom pixel ratio of the device used to convert dimensions
874- * and positions in the App code to the actual device logical coordinates
875- *
876- * Takes presedence over the `screenResolution` setting
877- *
878- * Defaults to 1 if not specified
879- */
880- pixelRatio ?: number
881- /**
882- * Interval in milliseconds to receive FPS updates
883- *
884- * @remarks
885- * If set to `0`, FPS updates will be disabled.
886- *
887- * @defaultValue `1000` (disabled)
888- */
889- fpsInterval ?: number
890- /**
8911004 * Maximum number of web workers to spin up simultaneously for offloading functionality such
8921005 * as image loading to separate threads (when supported by the browser)
8931006 *
8941007 * If not specified defaults to the number of logical processers available as reported by
8951008 * `navigator.hardwareConcurrency` (or 2 if `navigator.hardwareConcurrency` is not supported)
8961009 */
8971010 webWorkersLimit ?: number
898- /**
899- * Background color of the canvas (also known as the clearColor)
900- *
901- * Can be a color name (red, blue, silver), a hexadecimal color (`#000000`, `#ccc`),
902- * or a color number in rgba order (`0xff0033ff`)
903- *
904- * Defauls to transparent (`0x00000000`)
905- *
906- */
907- canvasColor ?: string ,
908- /**
909- * Enable inspector
910- *
911- * Enables the inspector tool for debugging and inspecting the application, the node tree
912- * will be replicated in the DOM and can be inspected using the browser's developer tools
913- *
914- * Defaults to `false`
915- */
916- inspector ?: boolean ,
917- /**
918- * Add an extra margin to the viewport for earlier pre-loading of elements and components
919- *
920- * By default the Lightning renderer, only renders elements that are inside the defined viewport.
921- * Everything outside of these bounds is removed from the render tree.
922- *
923- * With the viewportMargin you have the option to _virtually_ increase the viewport area,
924- * to expedite the pre-loading of elements and / or delay the unloading of elements depending
925- * on their position in the (virtual) viewport
926- *
927- * The margin can be specified in 4 directions by defining an array [top, right, bottom, left],
928- * or as a single number which is then applied to all 4 directions equally.
929- *
930- * Defaults to `0`
931- */
932- viewportMargin ?: number | [ number , number , number , number ] ,
933- /**
934- * Configures the gpu memory settings used by the renderer
935- */
936- gpuMemory ?: {
937- /**
938- * Maximum GPU memory threshold (in `mb`) after which
939- * the renderer will immediately start cleaning up textures to free
940- * up graphical memory
941- *
942- * When setting to `0`, texture memory management is disabled
943- *
944- * @default `200`
945- */
946- max ?: number ,
947- /**
948- * Target threshold of GPU memory usage, defined as a fraction of
949- * the max threshold. The renderer will attempt to keep memory
950- * usage below this target by cleaning up non-renderable textures
951- *
952- * @default `0.8`
953- */
954- target ?: number ,
955- /**
956- * Interval at which regular texture cleanups occur (in `ms`)
957- *
958- * @default `5000`
959- */
960- cleanupInterval ?: number ,
961- /**
962- * Baseline GPU memory usage of the App (in `mb`), without rendering any
963- * textures. This value will be used as a basis when calculating
964- * the total memory usage towards the max and target memory
965- * usage
966- *
967- * @default `25`
968- */
969- baseline ?: number ,
970- /**
971- * Whether or not the max threshold should be considered
972- * as a strict number that can not be exceeded in any way
973- *
974- * When set to `true`, new textures won't be created when the
975- * max threshold has been reached, until agressive texture cleanup
976- * has brought the memory back down
977- *
978- * @default false
979- */
980- strict ?: boolean ,
981- } ,
9821011 /**
9831012 * Defines which mode the renderer should operate in: `webgl` or `canvas`
9841013 *
@@ -988,7 +1017,6 @@ declare module '@lightningjs/blits' {
9881017 * Defaults to `webgl`
9891018 */
9901019 renderMode ?: RenderModes ,
991-
9921020 /**
9931021 * The time, in milliseconds, after which Blits considers a key press a _hold_ key press
9941022 *
@@ -1019,14 +1047,6 @@ declare module '@lightningjs/blits' {
10191047 * new Canvas element and inject it into the DOM
10201048 */
10211049 canvas ?: HTMLCanvasElement ,
1022- /**
1023- * The maximum amount of time the renderer is allowed to process textures in a
1024- * single frame. If the processing time exceeds this limit, the renderer will
1025- * skip processing the remaining textures and continue rendering the frame.
1026- *
1027- * Defaults to `10`
1028- */
1029- textureProcessingTimeLimit ?: number ,
10301050 /**
10311051 * Advanced renderer settings to override Blits launch settings, or configure
10321052 * settings that are not officially exposed in Blits yet
@@ -1049,15 +1069,6 @@ declare module '@lightningjs/blits' {
10491069 * @default false
10501070 */
10511071 announcer ?: boolean
1052- /**
1053- * Maximum FPS at which the App will be rendered
1054- *
1055- * Lowering the maximum FPS value can improve the overall experience on lower end devices.
1056- * Targetting a lower FPS may gives the CPU more time to construct each frame leading to a smoother rendering.
1057- *
1058- * Defaults to `0` which means no maximum
1059- */
1060- maxFPS ?: number
10611072 }
10621073
10631074 interface State {
0 commit comments