Class: RenderableManager
Creates and updates renderable components.
Because runtime calls are performed asynchronously over IPC, procedurally building a renderable through a sequence of API calls can span multiple frames. To avoid exposing partially initialized content, such as placeholder shaders or incomplete meshes, keep the component disabled until setup is complete, then enable it once the renderable is ready.
Constructors
Constructor
new RenderableManager(): RenderableManager;
Returns
RenderableManager
Methods
Create()
static Create(entity, isSkinnedMesh?): Promise<boolean>;
Creates a renderable component on an entity.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
isSkinnedMesh? | boolean | Whether the renderable should be created as a skinned mesh. Defaults to false. Blend shapes only work when this is true. |
Returns
Promise<boolean>
A promise that resolves to true if the renderable component was
created, or false otherwise.
Destroy()
static Destroy(entity): Promise<boolean>;
Removes a renderable component from an entity.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
Returns
Promise<boolean>
A promise that resolves to true if the renderable component was
removed, or false otherwise.
HasComponent()
static HasComponent(entity): Promise<boolean>;
Checks whether an entity has a renderable component.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<boolean>
A promise that resolves to true if the entity has a renderable
component, or false otherwise.
SetEnabled()
static SetEnabled(entity, enabled): Promise<void>;
Sets whether a renderable component is enabled.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
enabled | boolean | Whether the renderable component is enabled. |
Returns
Promise<void>
A promise that resolves when the enabled state has been changed.
GetEnabled()
static GetEnabled(entity): Promise<boolean>;
Gets whether a renderable component is enabled.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<boolean>
A promise that resolves to true if the renderable component is
enabled, or false otherwise.
SetMesh()
static SetMesh(entity, mesh): Promise<void>;
Sets the mesh of a renderable component.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
mesh | number | The Mesh to assign. |
Returns
Promise<void>
A promise that resolves when the mesh has been changed.
GetMesh()
static GetMesh(entity): Promise<number>;
Gets the mesh of a renderable component.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<number>
A promise that resolves to the assigned Mesh.
Throws
An error if no mesh is assigned to the renderable component.
SetBlendShapeWeight()
static SetBlendShapeWeight(
entity,
index,
weight): Promise<void>;
Sets the weight of a blend shape.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
index | number | The blend shape index. |
weight | number | The blend shape weight in the range [0.0, 1.0]. |
Returns
Promise<void>
A promise that resolves when the blend shape weight has been changed.
GetBlendShapeWeight()
static GetBlendShapeWeight(entity, index): Promise<number>;
Gets the weight of a blend shape.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
index | number | The blend shape index. |
Returns
Promise<number>
A promise that resolves to the blend shape weight.
SetMaterial()
static SetMaterial(
entity,
material,
index?): Promise<void>;
Sets the material of a renderable component.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
material | number | The Material to assign. |
index? | number | The material index. Defaults to 0. |
Returns
Promise<void>
A promise that resolves when the material has been changed.
GetMaterial()
static GetMaterial(entity, index?): Promise<number>;
Gets the material of a renderable component.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
index? | number | The material index. Defaults to 0. |
Returns
Promise<number>
A promise that resolves to the assigned Material.
Throws
An error if no material is assigned to the renderable component at the given index.
SetReceiveShadows()
static SetReceiveShadows(entity, receive): Promise<void>;
Sets whether a renderable component receives shadows.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
receive | boolean | Whether the renderable component receives shadows. |
Returns
Promise<void>
A promise that resolves when the receive-shadows setting has been changed.
GetReceiveShadows()
static GetReceiveShadows(entity): Promise<boolean>;
Gets whether a renderable component receives shadows.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<boolean>
A promise that resolves to true if the renderable component
receives shadows, or false otherwise.
SetShadowMode()
static SetShadowMode(entity, shadowMode): Promise<void>;
Sets the shadow casting mode of a renderable component.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to update. |
shadowMode | ShadowCastingMode | The shadow casting mode to assign. |
Returns
Promise<void>
A promise that resolves when the shadow casting mode has been changed.
GetShadowMode()
static GetShadowMode(entity): Promise<ShadowCastingMode>;
Gets the shadow casting mode of a renderable component.
Parameters
| Parameter | Type | Description |
|---|---|---|
entity | number | The Entity to inspect. |
Returns
Promise<ShadowCastingMode>
A promise that resolves to the shadow casting mode.