Build for 2cffa7b643abf909daa3db10ba5ccf4a326ff91b

a484fda1a6925b1e86a1bef470964f5b64c71a26
662ba3c645fa696e95f07b45e39e9c039bf24bc3
85c8b599a029607d5303695e895170fe520842e4
8e7a85d1a6addf8db6adeefc341e5470b7e1b8fd
c00f0f55fc3daecac9fddfda99923e2d5d48c5bf
1fa97d248b2cfcacac041fd8eb97c99101ef4c5f
a62d52a2d0655be3680c637fdaa05f2061e724fc
f1ac1a8211de8fc551846a60e3c38b7262031bd5
14018f5ff66f8b401944fc4741ecaa93ce4e0b02
7629b2ab6d3b854ba5c85390e5eca76cdc3bf68d
d261b57cd182fb654b515fbbf86103fae6efb5c5
d813dd91913fe2d8f927411e09d3f7a8ae60bbb3
053092c85b769a4686a3a78776e984324d0801be
9fa35524de0fa0261f62cc28608a770e2ef9b1e3
d7d1f92a131e94c8d0f7df717cedbb0a1c263cb2
59337ef8b5186487204855ebf49d0ef849770076
09dc67fa83ad34dd454f475610e8552f3b4b79c6
856f919970cbd74387c32bbd9f3945a68721b0f5
9f26ab17eb3ef3ca5a311ad1777ab506439338a6
d91ddf415851460095eb063059810d3441a1b469
201ceaba7752d75fc2cd9c4425b4920d2fbc0ad8
a6c8be822603fa120a4abc945fdd7edd64863aa8
89402a88c7e1953ee6bb7f70ef1dd39cb84896d6
278cddf04e9bf7f9da9a761be103f17bb4d824ac
fb3f677e2c39cb04e7e49302eefef9b76a7b270d
a5fb65ebebf614840017298e6d834c5c5e10af9b
2b81b791b325b3d02f12754ca99e3727d0705a0d
042f0f035304fd342d4657134844a126a2c74409
69821db56f549a311d4ea633354e20bcccf962d4
3277584da98b012d545ab9bfaa224ff74d64ec98
19bb8b99c33c87266aacfb9997a788dbb28e859a
bf26fe41e8effeccd29be8ac6af04addc78b52f8
92fc916b866854767ac0f43ba56447c454b92af1
f5cd625be8baa78d0665abbbabeda7367407cc2f
b8cc5f5245160eb02e1c2e2eb4854434f6956b96
47b5d07497cc59eeaa3affdf3013e759951f958e
672947ca56cb6b88ace0e58c11fae43dc642dd5b
fc7db059784667af806c3cc0ba01044b95406d50
3dca142bb931c9dcd76930efdaaa9c9a1dcbc7f9
894ada4960514199cdbce1f04fcb53f5ab6f1ff5
86ae0d63e3fe4fad55d737b882c8725580c96d95
5c75fc011265679cbfa5f8af6f12edaa3236a974
543f05d6d41221c011af4ff962087e29669a4053
ef100bf91ee1f0f0a451c6fad49f9204ecd365e0
b00ec4c50100223c043556363f990e8fd9d27848
ad94df4afe7eea6e2cfadb5503065aa643a78e6d
2c9e17d486da7585dda6548885b5b00b185ef356
f3a80c3429a11fb9d22f24d1f08f7efc4d414d9c
73ae8c205d7b817c1bc56b5516204e69c7418b6d
fc10df7e412b7d2b0954431ef871518f2d744215
f0dae7aa482f4d7772b52a16e6eac82dcf8a5bab
b74f9448f5a2ca66cc23bd1bc3f90be75a989b1a
04cebb9eedf2dab517a9e1303e3b1dea5a16693e
aeefe8e5a3f4298cb0a17d30b870da7d2713d64a
1edb753ac8db8e60742662673d3140f9936845c1
91cc797c3b6ddeb6dcea453b2b623025106bb588
bb357ba8bcc7465833bc7827e23177634091c045
a21bd1aff1da9ee5d111340ed9fea91a68aa2899
1040189e2763b33c6612bb1ec93e39779d017657
74deedba1b00e5d3019d3c9ea94b8498d8550c59
9f59b42901f6ee5ecf47d0c0b1efbac628614ad9
This commit is contained in:
GitHub 2016-10-19 21:04:30 +00:00
parent db98f7347b
commit 8af20d9fbf

View File

@ -19612,6 +19612,7 @@
this._position = twgl.v3.create(0, 0);
this._scale = twgl.v3.create(100, 100);
this._rotationCenter = twgl.v3.create(0, 0);
this._direction = 90;
this._transformDirty = true;
this._visible = true;
@ -19704,8 +19705,9 @@
* The Drawable will continue using the existing skin until the new one loads.
* If there is no existing skin, the Drawable will use a 1x1 transparent image.
* @param {string} skin_url The URL of the skin.
* @param {number=} opt_costumeResolution Optionally, a resolution for the skin.
*/
Drawable.prototype.setSkin = function (skin_url) {
Drawable.prototype.setSkin = function (skin_url, opt_costumeResolution) {
// TODO: cache Skins instead of loading each time. Ref count them?
// TODO: share Skins across Drawables - see also destroy()
if (skin_url) {
@ -19718,7 +19720,7 @@
this._setSkinSVG(skin_url);
break;
default:
this._setSkinBitmap(skin_url);
this._setSkinBitmap(skin_url, opt_costumeResolution);
break;
}
} else {
@ -19758,11 +19760,12 @@
/**
* Load a bitmap skin. Supports the same formats as the Image element.
* @param {string} skin_md5ext The MD5 and file extension of the bitmap skin.
* @param {number=} opt_costumeResolution Optionally, a resolution for the skin.
* @private
*/
Drawable.prototype._setSkinBitmap = function (skin_md5ext) {
Drawable.prototype._setSkinBitmap = function (skin_md5ext, opt_costumeResolution) {
var url = skin_md5ext;
this._setSkinCore(url, 2);
this._setSkinCore(url, opt_costumeResolution);
};
/**
@ -19854,7 +19857,7 @@
Drawable.prototype.updateProperties = function (properties) {
var dirty = false;
if ('skin' in properties) {
this.setSkin(properties.skin);
this.setSkin(properties.skin, properties.costumeResolution);
this.setConvexHullDirty();
}
if ('position' in properties && (this._position[0] != properties.position[0] || this._position[1] != properties.position[1])) {
@ -19871,6 +19874,11 @@
this._scale[1] = properties.scale[1];
dirty = true;
}
if ('rotationCenter' in properties && (this._rotationCenter[0] != properties.rotationCenter[0] || this._rotationCenter[1] != properties.rotationCenter[1])) {
this._rotationCenter[0] = properties.rotationCenter[0];
this._rotationCenter[1] = properties.rotationCenter[1];
dirty = true;
}
if ('visible' in properties) {
this._visible = properties.visible;
this.setConvexHullDirty();
@ -19938,6 +19946,13 @@
var rotation = (270 - this._direction) * Math.PI / 180;
twgl.m4.rotateZ(modelMatrix, rotation, modelMatrix);
// Adjust rotation center relative to the skin.
var rotationAdjusted = twgl.v3.subtract(this._rotationCenter, twgl.v3.divScalar(this._uniforms.u_skinSize, 2));
rotationAdjusted[1] *= -1; // Y flipped to Scratch coordinate.
rotationAdjusted[2] = 0; // Z coordinate is 0.
twgl.m4.translate(modelMatrix, rotationAdjusted, modelMatrix);
var scaledSize = twgl.v3.divScalar(twgl.v3.multiply(this._uniforms.u_skinSize, this._scale), 100);
scaledSize[2] = 0; // was NaN because the vectors have only 2 components.
twgl.m4.scale(modelMatrix, scaledSize, modelMatrix);