Class: SpriteRenderable

SpriteRenderable(myTexture) → {SpriteRenderable}

Supports the drawing of one sprite element mapped onto entire renderable. Default size is the entire sprite sheet.

Found in Chapter 5, page 224 of the textbook

Example: 5.2 Sprite Shaders

Constructor

new SpriteRenderable(myTexture) → {SpriteRenderable}

Parameters:
Name Type Description
myTexture string the path to the sprite sheet image file
Source:
Returns:
a new SpriteRenderable
Type
SpriteRenderable

Members

(static, constant) eTexCoordArrayIndex

Enum for expected texture coordinate array
Source:

Methods

draw(camera)

Draw this SpriteRenderable to the camera
Parameters:
Name Type Description
camera Camera the Camera to draw to
Source:

getElementUVCoordinateArray() → {Array.<float>}

Returns a one dimensional array with UV coordinates of the corners of the sprite region for this SpriteRenderable
Source:
Returns:
top-right: [0][1], top-left: [2][3], bottom-right: [4][5], bottom-left: [6][7]
Type
Array.<float>

setElementPixelPositions(left, right, bottom, top)

Set the sprite element bounds in pixel coordinates (between 0 to image resolutions) for this Sprite Renderable
Parameters:
Name Type Description
left integer leftmost pixel position
right integer rightmost pixel position
bottom integer bottommost pixel position
top integer topmost pixel position
Source:

setElementUVCoordinate(left, right, bottom, top)

Set the sprite element bounds in UV texture coordinate (0-1) for this Sprite Renderable
Parameters:
Name Type Description
left float leftmost U coordinate
right float rightmost U coordinate
bottom float bottommost V coordinate
top float topmost V coordinate
Source: