Renderable
Extends:
Direct Subclass:
Indirect Subclass:
Base Renderable Component for all Components that want to draw to the screen. If you want to show something on screen, it should derive Renderable.
Contained in the class are functions for attaching the Renderable to viewports, and updating Transform data into matricies for use with the Render Manager.
The Renderable Component contains data on how the Renderable expects to be rendered. Programs, render vectors, shader data, and other data that is on a per-object basis for rendering is defined here.
Classes which derive a Renderable should handle all base data and add or modify data as needed to achieve certain effects.
Constructor Summary
Public Constructor | ||
public |
constructor(program: Program) Constructor for the Renderable component. |
Member Summary
Public Members | ||
public |
color: * |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
program: * |
|
public |
|
|
public |
textures: *[] |
Private Members | ||
private |
|
|
private |
|
|
private |
|
|
private |
_matrixScale: * |
|
private |
|
Method Summary
Public Methods | ||
public |
addToViewport(viewportID: number): * Adds this component to another viewport to be drawn. |
|
public |
getMatrix(): * Returns a joined matrix of position, scale, rotation and origin adjustment. |
|
public |
Called immediatly after the Render component is added to a game object. |
|
public |
onEnd() |
|
public |
Removes the renderable from all viewports. |
|
public |
|
|
public |
setColor(r: *, g: *, b: *, a: *) |
|
public |
setDepth(depth: *) |
|
public |
setOriginOffset(point: Point) Sets the origin offset matrix to the new position point assigned. |
|
public |
setPosition(point: Point) Sets the position matrix to the new position point assigned. |
|
public |
setRotation(rotation: number) Sets the rotation matrix to the new rotation value assigned. |
|
public |
Sets the scale matrix to the new scale point assigned. |
|
public |
setSubIndex(spriteIndex: *) |
|
public |
setTexture(textureObject: *) |
|
public |
setUniformData(positionMatrix: *): boolean |
Inherited Summary
From class Updateable | ||
public |
deregister: * |
|
public |
|
|
public |
|
|
public |
id: * |
|
public |
Cleanup code for when destroying an Updateable. |
|
public |
end() Base call function for when this Updateable is to be ended. |
|
public |
onEnd() Called when the object is being removed or cleaned up from usage. |
|
public |
onPause() Called when the object is intended to be paused. |
|
public |
onStart() Called when the the object is first introduced. |
|
public |
Called when the object is to be unpaused from paused state. |
|
public |
onUpdate() Called on every update within the game, once the object has had onStart called. |
|
public |
pause() Base call function for when this Updateable is to be paused. |
|
public |
start() Base call function for when this Updateable is to be started. |
|
public |
unpause() Base call function for when this Updateable is to be unpaused. |
|
public |
update() Base call function for when this Updateable is to be updated. |
From class Component | ||
public |
|
|
public |
isUnique: * |
|
public |
Called when the component is successfully added to a GameObject. |
Public Constructors
public constructor(program: Program) source
Constructor for the Renderable component. Allows defaults to be assigned without having to call setter functions later.
Override:
Component#constructorParams:
Name | Type | Attribute | Description |
program | Program | A Program Object from the ProgramManager. |
Public Members
public color: * source
public deregisterViewports: {} source
public primitiveType: * source
public program: * source
public textures: *[] source
Private Members
private _matrixOriginOffset: * source
private _matrixPosition: * source
private _matrixRotation: * source
private _matrixScale: * source
Public Methods
public addToViewport(viewportID: number): * source
Adds this component to another viewport to be drawn.
Params:
Name | Type | Attribute | Description |
viewportID | number | Object ID of the viewport. |
Return:
* |
public getMatrix(): * source
Returns a joined matrix of position, scale, rotation and origin adjustment.
Return:
* |
public onAddComponent() source
Called immediatly after the Render component is added to a game object.
Updates the data of this renderable to the current Transform data.
Override:
Component#onAddComponentpublic onEnd() source
Called when the object is being removed or cleaned up from usage.
Override:
Updateable#onEndpublic requestRedraw() source
public setColor(r: *, g: *, b: *, a: *) source
Params:
Name | Type | Attribute | Description |
r | * | ||
g | * | ||
b | * | ||
a | * |
public setDepth(depth: *) source
Params:
Name | Type | Attribute | Description |
depth | * |
public setOriginOffset(point: Point) source
Sets the origin offset matrix to the new position point assigned. This matrix reacts differently from other matrix assignment. 0,0 is regular top left corner origin, -0.5, -0.5 centers the origin to the center of the Transform, and -1, -1 will align the origin to the bottom right.
Params:
Name | Type | Attribute | Description |
point | Point | Origin offset point. |
public setPosition(point: Point) source
Sets the position matrix to the new position point assigned.
Params:
Name | Type | Attribute | Description |
point | Point | A position point. |
public setRotation(rotation: number) source
Sets the rotation matrix to the new rotation value assigned.
TODO: Change to a rotation point for x, y, z rotation instead of just z.
Params:
Name | Type | Attribute | Description |
rotation | number | A rotation in degrees. |
public setScale(scale: Point) source
Sets the scale matrix to the new scale point assigned.
Params:
Name | Type | Attribute | Description |
scale | Point | A scale point. |
public setSubIndex(spriteIndex: *) source
Params:
Name | Type | Attribute | Description |
spriteIndex | * |
public setTexture(textureObject: *) source
Params:
Name | Type | Attribute | Description |
textureObject | * |