Constructor
new SystemRender($parameters)
- Description:
- Creates a new render system.
- Source:
Examples
// minimal
const system = new SystemRender({$container, $resolution});
system.initiate();
system.tick($stage);
// full
const system = new SystemRender({$color, $container, $resolution});
system.initiate();
system.tick($stage);
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
$parameters |
object | The given parameters. | |
$parameters.$color |
Vector3 |
<optional> |
The rendering background color to use. |
$parameters.$container |
HTMLElement | The container on which to attach the canvas. | |
$parameters.$resolution |
Vector2 | The rendering resolution to use. |
Members
(readonly) UNIT_TEXTURE_0 :0
- Description:
- Stores the texture unit for the textures to preload.
- Source:
Stores the texture unit for the textures to preload.
Type:
- 0
(readonly) UNIT_TEXTURE_1 :1
- Description:
- Stores the texture unit for the textures.
- Source:
Stores the texture unit for the textures.
Type:
- 1
Methods
getTranslationFromScreen($stage, $vector) → {Vector2}
- Description:
- Gets the position in the current stage from the given clipped position in the screen.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$stage |
Stage | The current stage. |
$vector |
Vector2 | The position in the screen (with values in [-1, 1] ranges). |
Returns:
- Type
- Vector2
hasAssetLoaded($asset) → {boolean}
- Description:
- Checks if the system has loaded the given asset.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$asset |
string | The asset source. |
Returns:
- Type
- boolean
loadTexture($content) → {Promise.<WebGLTexture>}
- Description:
- Loads the texture from the given texture file content.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$content |
Response | The texture file content. |
Returns:
- Type
- Promise.<WebGLTexture>
onInitiate()
- Description:
- Called when the system is being initiated.
- Source:
onTerminate() → {undefined|Promise.<void>}
- Description:
- Called when the system is being terminated.
- Source:
Returns:
- Type
- undefined | Promise.<void>
onTick($parameters)
- Description:
- Called when the system is being updated by one tick update.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$parameters |
object | The given parameters. |
$parameters.$stage |
Stage | The stage on which to execute the system. |
$parameters.$timetick |
number | The tick duration (in ms). |
removePointerNative()
- Description:
- Removes the native pointer display.
- Source:
setColor($color)
- Description:
- Sets the rendering background color.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$color |
Vector3 | The rendering background color to set. |
setResolution($resolution)
- Description:
- Sets the rendering resolution.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$resolution |
Vector2 | The rendering resolution to set. |