Initial setup of runtime. See initializeModule for the rest.
Entities by id. Only created entities should go here. Entities looked up created in Cogs.Core may be replaced by a new entity with same id.
OptionalnotifyCogsInternal: Used for ContinuousRendering support
CogsInternal: Do not use! Required for internal Cogs signaling Clients must use Control.addEventListener("postRender", e) to be notified after each render update.
CogsInternal: Do not use! Required for internal Cogs signaling Clients must use Control.addEventListener("postSystemsUpdate", e) to be notified before each render update.
CogsInternal: Do not use! Required for internal Cogs signaling Clients must use Control.addEventListener("preRender", e) to be notified before each render update.
Internal: Bridge
Gets callback manager. CogsInternal usage only
CogsInternal:
Gets class containing 'wrap' method. To get complete entity description from EntityId using: runtime.Entity.wrap(id: EntityId);
CogsInternal:
CogsInternal: Field lookup map.
Unique identifies a Runtime instance. Changed each time the context is reset or shut down. Can be used for async operations to detect if the Runtime is still valid. Can be used by client Resource loader to check if a resource has been loaded on a Runtime (Shader, Custom material etc) instead of keeping a reference to the runtime.
CogsInternal: Gets WebGL1 and WebGL2 common interface
CogsInternal: Gets WebGLRenderingContext. Requires webGLVersion === 1. Throws if invalid usage.
CogsInternal: Gets WebGL2RenderingContext. Requires webGLVersion === 1 Throws if invalid usage.
Height of canvas
Gets logging module. CogsInternal usage only
Gets typed WASM module
Get notification manager that handles component notifications.
Internal: Manages decompression of ArrayBuffers in web workers.
Using WebGPU insead of WebGL.
The WebGL renderer string if it was exposed.
The WebGL vendor string if it was exposed.
The actual version of the WebGL context, zero if there is no WebGL context.
Width of canvas
Initialize type system when Cogs ready
Just abort everything, should be called when the wasm heap is in an indeterminate state like after an exception was emitted.
Clear all entities and set up new context
ProtectedcreateProtectedcreateRemove entity from Cogs entity lookup table. Entity is destroyed if not in use by other entities.
Entity to remove.
Erase a Cogs config variable.
Full name of the variable
True if variable found.
Get a Cogs boolean config variable.
Full name of the variable
Variable value.
Get a Cogs number config variable.
Full name of the variable
Variable value.
Get miscellaneous resource statistics.
To get more precise numbers on allocations, passing 'malinfo': 1 in options invokes calling of malinfo that traverses the malloc allocation structures. This might be costly, so we have this as opt-in for now.
Optionaloptions: { malinfo?: boolean }Get a Cogs config variable.
Full name of the variable
Variable value.
Check if a Cogs config variable exists.
Full name of the variable
True if Variable exists.
Called by class Control during setup
Load scene graph from Resource url. The resource must be registered as a string resource using Resources.registerStringResource.
Resource url
Optional parent entity. Recommended for clean-up.
Optional Loading flags =AssetLoadFlags.NoDefault
true if success
Load scene graph from JSON definition.
Asset definition
Optional parent entity. Recommended for clean-up.
Optional Loading flags =AssetLoadFlags.NoDefault
true if success
Adds a new extension (e.g. Physics, Potree etc), returns true if extension found and loaded
Load scene graph from Resource url The resource must be registered as a string resource using Resources.registerStringResource.
Resource url
Loading flags. AssetLoadFlags.ClearScene can be used to clear scene contents. =AssetLoadFlags.NoDefault
true if success
Internal release of JS and WASM resources closing down this instance of Cogs.js
Reset counters for frame timings provided by \ref getResourceStatistics.
Resize drawing area
set DPI and scalingFactor
Set a Cogs config variable. Internally sent as string. Use getVariable/getBoolVariable/getDoubleVariable to get variable value.
Full name of the variable
New variable value.
Exposed as control.runtime
The Runtime class is a main class in Cogs.js owning the Scene, Bridge, Resources etc.
Entities and Components are exposed as data members on the runtime. Note: This definition is a static definition and members of extensions will not be available until the Extension is loaded.
In the TypeScript interface to Cogsengine can drill down into each entity to find the components that it consists of. Components are reused across entities.