Class: WebGLSystem
WebGLSystem handles rendering to an HTML5 canvas using WebGL. Takes in renderables created by pre rendering steps and renders them onto a canvas.
Hierarchy
-
↳ WebGLSystem
Table of contents
Constructors
Properties
- entities
- messageBus
- renderables
- scene
- subscriberID
- MESSAGE_DEREGISTER
- MESSAGE_LOAD_RENDERABLES
- MESSAGE_REGISTER
- MESSAGE_UPDATE
Methods
Constructors
constructor
+ new WebGLSystem(messageBus: IMessageBus, gl: WebGL2RenderingContext, scene?: IScene, renderables?: IRenderable[], defaultShaderAssets?: ShaderAsset[], shaders?: Map<string, [WebGLShader, GLSLShader]>, textures?: Map<string, WebGLTexture>, programs?: Map<string, WebGLProgram>, entities?: SystemEntity[], subscriberID?: number): WebGLSystem
Parameters:
| Name | Type |
|---|---|
messageBus |
IMessageBus |
gl |
WebGL2RenderingContext |
scene? |
IScene |
renderables? |
IRenderable[] |
defaultShaderAssets |
ShaderAsset[] |
shaders |
Map<string, [WebGLShader, GLSLShader]> |
textures |
Map<string, WebGLTexture> |
programs |
Map<string, WebGLProgram> |
entities? |
SystemEntity[] |
subscriberID? |
number |
Returns: WebGLSystem
Inherited from: RenderSystem
Properties
entities
• Protected entities: SystemEntity[]
The list of entities the system is tracking.
Inherited from: RenderSystem.entities
messageBus
• Protected messageBus: IMessageBus
Reference to the message bus, the fundamental piece of JamJar for communicating with other parts of the engine.
Inherited from: RenderSystem.messageBus
renderables
• Protected renderables: IRenderable[]
A list of things to be rendered.
Inherited from: RenderSystem.renderables
scene
• Protected Optional scene: undefined | IScene
Any scene this system is part of, will change the lifecycle of the system to be part of the scene's lifecycle - it will be destroyed when the scene is destroyed.
Inherited from: RenderSystem.scene
subscriberID
• subscriberID: number
Inherited from: RenderSystem.subscriberID
MESSAGE_DEREGISTER
▪ Readonly Static MESSAGE_DEREGISTER: stateful_system_deregister= "stateful_system_deregister"
Message to deregister an entity + components with a system so it is no longer tracked.
Inherited from: RenderSystem.MESSAGE_DEREGISTER
MESSAGE_LOAD_RENDERABLES
▪ Readonly Static MESSAGE_LOAD_RENDERABLES: load_renderables= "load_renderables"
Message used to add new renderables into the render system's render list.
Inherited from: RenderSystem.MESSAGE_LOAD_RENDERABLES
MESSAGE_REGISTER
▪ Readonly Static MESSAGE_REGISTER: stateful_system_register= "stateful_system_register"
Message to register an entity + components with a system so it can be tracked.
Inherited from: RenderSystem.MESSAGE_REGISTER
MESSAGE_UPDATE
▪ Readonly Static MESSAGE_UPDATE: system_update= "system_update"
Inherited from: RenderSystem.MESSAGE_UPDATE
Methods
Destroy
▸ Destroy(): void
Destroy destroys the System and unsubscribes it from all messages. The System should be garbage collected after this, unless a direct reference to it exists somewhere. Therefore direct references to systems are discouraged; communication should all be through the message bus.
Returns: void
Inherited from: RenderSystem
OnDestroy
▸ ProtectedOnDestroy(): void
Custom Destroy logic should go here to facilitate garbage collection, for example removing listeners.
Returns: void
Inherited from: RenderSystem
OnMessage
▸ OnMessage(message: IMessage): void
Parameters:
| Name | Type |
|---|---|
message |
IMessage |
Returns: void
Overrides: RenderSystem
Update
▸ ProtectedUpdate(dt: number): void
General update method, default empty. Override with custom logic.
Parameters:
| Name | Type | Description |
|---|---|---|
dt |
number | DeltaTime |
Returns: void
Inherited from: RenderSystem
register
▸ Protectedregister(entity: IEntity, components: Component[]): void
Parameters:
| Name | Type |
|---|---|
entity |
IEntity |
components |
Component[] |
Returns: void
Inherited from: RenderSystem
remove
▸ Protectedremove(entity: IEntity): void
Parameters:
| Name | Type |
|---|---|
entity |
IEntity |
Returns: void
Inherited from: RenderSystem