Skin

Skin

new Skin(id)

Create a Skin, which stores and/or generates textures for use in rendering.

Parameters:
Name Type Description
id int

The unique ID for this Skin.

Members

(static) Events :string

Properties:
Name Type Description
WasAltered string

These are the events which can be emitted by instances of this class.

Type:
  • string

_id :int

Type:
  • int

_rotationCenter :Vec3

Type:
  • Vec3

(private) _uniforms :Object.<string, *>

The uniforms to be used by the vertex and pixel shaders. Some of these are used by other parts of the renderer as well.

Type:
  • Object.<string, *>

id

rotationCenter

(abstract) size

Methods

calculateRotationCenter() → {Array.<number>}

Get the center of the current bounding box

Returns:

the center of the current bounding box

Type
Array.<number>

dispose()

Dispose of this object. Do not use it after calling this method.

(abstract) getTexture(scale) → {WebGLTexture}

Parameters:
Name Type Description
scale Array.<number>

The scaling factors to be used.

Returns:

The GL texture representation of this skin when drawing at the given size.

Type
WebGLTexture

getUniforms(scale) → {object.<string, *>}

Update and returns the uniforms for this skin.

Parameters:
Name Type Description
scale Array.<number>

The scaling factors to be used.

Returns:

the shader uniforms to be used when rendering with this Skin.

Type
object.<string, *>

setRotationCenter(x, y)

Set the origin, in object space, about which this Skin should rotate.

Parameters:
Name Type Description
x number

The x coordinate of the new rotation center.

y number

The y coordinate of the new rotation center.

Fires:

Events

event:WasAltered

Emitted when anything about the Skin has been altered, such as the appearance or rotation center.