Class: TextureRenderable

TextureRenderable(myTexture) → {TextureRenderable}

Supports the drawing of an entire file texture mapped onto an entire Renderable

Found in Chapter 5, page 201 of the textbook

Example: 5.1 Texture Shader

Constructor

new TextureRenderable(myTexture) → {TextureRenderable}

Parameters:
Name Type Description
myTexture string the path to the image file to use as texture
Source:
Returns:
a new TextureRenderable instance
Type
TextureRenderable

Extends

  • Renderable

Methods

draw(camera)

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

getTexture() → {string}

Return the path to image file associated with this TextureRenderable
Source:
Returns:
mTexture - path to image file
Type
string

pixelTouches(other, wcTouchPos) → {boolean}

Determines if this GameObject has an overlapping pixel with otherObj
Parameters:
Name Type Description
other TextureRenderable the other TextureRenderable
wcTouchPos vec2 vector to store the first world coordinates where the pixels touch
Source:
Returns:
pixelTouch - whether this TextureRenderable has a pixel overlapping the other
Type
boolean

setColorArray()

If the color array is null sets the color array of this TextureRenderable to the color array of its texture
Source:

setTexture(newTexture)

Set the image file to serve as the texture for this TextureRenderable
Parameters:
Name Type Description
newTexture string path to new image file
Source: