Expose skin/costume size ()

* Expose skin/costume size

* Return skin size as a copy
This commit is contained in:
Tim Mickel 2016-10-11 18:43:57 -04:00 committed by GitHub
parent a62d52a2d0
commit 1fa97d248b
2 changed files with 17 additions and 0 deletions

View file

@ -380,6 +380,14 @@ Drawable.prototype._setSkinSize = function (width, height, costumeResolution) {
this.setConvexHullDirty();
};
/**
* Get the size of the Drawable's current skin.
* @return {Array.<number>} Skin size, width and height.
*/
Drawable.prototype.getSkinSize = function () {
return this._uniforms.u_skinSize.slice();
};
/**
* Calculate the transform to use when rendering this Drawable.
* @private

View file

@ -225,6 +225,15 @@ RenderWebGL.prototype.getBounds = function (drawableID) {
return bounds;
};
/**
* Get the current skin (costume) size of a Drawable.
* @param {int} drawableID The ID of the Drawable to measure.
* @return {Array.<number>} Skin size, width and height.
*/
RenderWebGL.prototype.getSkinSize = function (drawableID) {
const drawable = Drawable.getDrawableByID(drawableID);
return drawable.getSkinSize();
};
/**
* Check if a particular Drawable is touching a particular color.