Module: config

API for the engine's global configuration.

Use the set()/get() method to change/get the value of a property. Use the reset() method to reset all properties to their default state. Any change in configuration must occur before engine initialization. Keep in mind that some of the properties are affected by the quality profile and the user's hardware/browser. In the former case use the P_CUSTOM profile in order to change such properties.

Normally, the users should not alter these parameters.

Configuration Parameters Available

allow_cors
Boolean, allow cross-origin resource sharing.
allow_hidpi
Boolean, allow HIDPI mode on supported devices (use the P_CUSTOM profile in order to change this parameter).
alpha
Boolean, enable WebGL canvas transparency.
alpha_sort
Boolean, enable z-sorting for transparent materials.
alpha_sort_threshold
Number, camera distance threshold for transparency z-sorting.
anaglyph_use
Deprecated, use "stereo" instead. Boolean, enable anaglyph stereo rendering.
animation_framerate
Number, animation framerate.
anisotropic_filtering
Boolean, enable anisotropic filtering.
antialiasing
Boolean, enable postprocess-based anti-aliasing (use the P_CUSTOM profile in order to change this parameter).
assets_dds_available
Boolean, allow the engine to use compressed DDS textures.
assets_gzip_available
Boolean, enable loading gzipped versions of json/bin/dds/pvr files. It's worth doing it if gzip compression is not set up on a server. A gzipped file must be placed near the original one and its name must be the same as the name of the original file + the ".gz" extension. For example:
 my_folder/
     my_project.json
     my_project.json.gz
     my_project.bin
     my_project.bin.gz
assets_min50_available
Boolean, allow the engine to use halved textures. The halved textures should be present near the source textures in order to be picked up.
assets_path
String, path to the assets directory (for get_assets_path() and get_std_assets_path()).
assets_pvr_available
Boolean, allow the engine to use compressed PVRTC textures. These textures should be present near the source textures in order to be picked up.
audio
Boolean, enable Web Audio.
background_color
Array, RGBA values to use as a background color for the WebGL canvas.
bloom
Boolean, enable bloom.
built_in_module_name
String, name of the module which stores exported data (HTML export only).
canvas_resolution_factor
Number, set the resolution factor for the canvas. Requires the following call to apply changes: container.resize_to_container(true).
compositing
Boolean, enable compositing.
console_verbose
Boolean, print more debug info in the browser console.
debug_view
Boolean, enable debug view mode.
dof
Boolean, enable the Depth of Field effect.
do_not_load_resources
Boolean, disable loading of assets (textures and sounds).
glow_materials
Boolean, enable glow materials.
god_rays
Boolean, enable god rays.
enable_outlining
Boolean, enable object outlining.
enable_selectable
Boolean, enable object selection.
gl_debug
Boolean, enable gl errors check. Very slow.
is_mobile_device
Boolean, check mobile device. Read-only.
lod_leap_smooth_threshold
Number, the maximum amount of the camera movement (in meters) that still can trigger a smooth transition during the LOD switching. Low values can be useful to prevent noticeable smooth transitions while teleporting. High values can be useful to keep smooth transitions for fast moving cameras (e.g. flight simulators).
lod_smooth_transitions
Boolean, enable smooth transitions between LOD levels.
max_fps
Number, maximum FPS limit.
max_fps_physics
Number, maximum physics FPS limit.
media_auto_activation
Boolean, activate media data context on mobile devices using a popup dialog.
motion_blur
Boolean, enable motion_blur.
outlining_overview_mode
Boolean, make all objects selectable, enable object outlining and outlining on selection.
physics_calc_fps
Boolean, return physics FPS in the FPSCallback.
physics_enabled
Boolean, use the uranium.js physics engine.
physics_uranium_path
String, path to the directory of uranium.js file. If not specified, search in the directory with the engine's sources.
physics_use_workers
Boolean, simulate physics in workers (default) or not.
physics_use_wasm
Boolean, use WebAssembly for physics or not(default).
precision
String, preferred GLSL floating point precision (use the P_CUSTOM profile in order to change this parameter).
prevent_caching
Boolean, prevent assets caching by appending timestamp suffix to their URLs (default) or not.
quality
Number, preferred rendering quality profile (one of P_LOW, P_HIGH, P_ULTRA, P_CUSTOM enums).
reflections
Boolean, enable reflections.
reflection_quality
String, quality of reflections. It can be "LOW", "MEDIUM" or "HIGH".
refractions
Boolean, enable refractions.
sfx_mix_mode
Boolean, enable the mixer mode in the SFX subsystem.
shaders_path
String, path to the shaders directory (developer version only).
shadows
Boolean, enable shadows.
shadow_blur_samples
String, number of shadow border blur samples. It can be "16x", "8x" or "4x".
show_hud_debug_info
Boolean, show HUD with debug information.
smaa
Deprecated. Boolean, enable SMAA anti-aliasing (use the P_CUSTOM profile in order to change this parameter).
smaa_area_texture_path
Deprecated. String, path to the SMAA "area" texture. If not specified, search in the directory with the engine's sources.
smaa_search_texture_path
Deprecated. String, path to the SMAA "search" texture. If not specified, search in the directory with the engine's sources.
srgb_type
String, the quality of the "Linear <-> sRGB" color conversions. Can be one of the following: "SRGB_SIMPLE" - a bit faster, but less accurate, which is especially noticeable for the dark tones; "SRGB_PROPER" - a bit slower, but more precise.
ssao
Boolean, enable SSAO.
stereo
String, stereoscopic mode: "ANAGLYPH", "HMD" or "NONE".
use_min50
Boolean, enable min50 textures.

Summary

Members

Methods

Type Definitions

Detailed Description

Members

P_AUTO

Auto quality profile: cannot be used directly, only for quality auto configurators.
Type:
Source:

P_CUSTOM

Custom quality profile: use engine defaults, allow customization.
Type:
Source:

P_HIGH

High quality profile: use all requested features.
Type:
Source:

P_LOW

Low quality profile: maximize engine performance, minimize memory consumption.
Type:
Source:

P_ULTRA

Ultra quality profile: use all requested features and maximize quality.
Type:
Source:

Methods

apply_quality(quality)

Set the engine's quality profile.
Parameters:
Name Type Description
quality QualityProfile Quality profile
Source:

get(prop) → {*}

Get the value of the config property of the engine.
Parameters:
Name Type Description
prop string Property name
Returns:
Value of property
Type
*
Source:

get_assets_path(name) → {string}

Get the path to the project's assets directory.
Parameters:
Name Type Description
name string Name of the project
Returns:
Path to assets
Type
string
Source:
See:

get_std_assets_path() → {string}

Get the path to the standard assets directory inside the SDK.
Returns:
Path to assets
Type
string
Source:

reset()

Reset all the engine's config properties to defaults.
Source:

reset_limits()

Reset context limit properties to minimum.
Source:

set(prop, value)

Set the value of the config property of the engine.
Parameters:
Name Type Description
prop string Property name
value * New property value
Source:

Type Definitions

QualityProfile

Quality profile enum. One of P_LOW, P_HIGH, P_ULTRA, P_CUSTOM.
Type:
  • number
Source: