new BitmapSkin(idnon-null, renderernon-null)
Create a new Bitmap Skin.
Parameters:
Name | Type | Description |
---|---|---|
id |
int | The ID for this Skin. |
renderer |
RenderWebGL | The renderer which will use this skin. |
Extends
Members
(non-null) _costumeResolution :int
Type:
- int
_id :int
- Inherited From:
Type:
- int
(non-null) _renderer :RenderWebGL
Type:
_rotationCenter :Vec3
- Inherited From:
Type:
- Vec3
_texture :WebGLTexture
Type:
- WebGLTexture
_textureSize :Array.<int>
Type:
- Array.<int>
(private) _uniforms :Object.<string, *>
- Inherited From:
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
- Inherited From:
rotationCenter
- Inherited From:
size
- Overrides:
Methods
(private, static) _getBitmapSize(bitmapData) → {Array.<int>}
Parameters:
Name | Type | Description |
---|---|---|
bitmapData |
ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | bitmap data to inspect. |
Returns:
the width and height of the bitmap data, in pixels.
- Type
- Array.<int>
calculateRotationCenter() → {Array.<number>}
- Inherited From:
Get the center of the current bounding box
Returns:
the center of the current bounding box
- Type
- Array.<number>
dispose()
- Overrides:
Dispose of this object. Do not use it after calling this method.
getTexture(scale) → {WebGLTexture}
- Overrides:
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 scale.
- Type
- WebGLTexture
getUniforms(scale) → {object.<string, *>}
- Inherited From:
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, *>
setBitmap(bitmapData, costumeResolutionopt, rotationCenteropt)
Set the contents of this skin to a snapshot of the provided bitmap data.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
bitmapData |
ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | new contents for this skin. |
||
costumeResolution |
int |
<optional> |
1
|
The resolution to use for this bitmap. |
rotationCenter |
Array.<number> |
<optional> |
Optional rotation center for the bitmap. If not supplied, it will be calculated from the bounding box |
Fires:
setRotationCenter(x, y)
- Inherited From:
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. |