54 lines
2.3 KiB
JavaScript
54 lines
2.3 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$TextureUvs = function(global, require, module, exports) {
|
|
var groupD8 = require("module$node_modules$pixi_DOT_js$lib$maths$matrix$groupD8");
|
|
"use strict";
|
|
class TextureUvs {
|
|
constructor() {
|
|
this.y0 = this.x0 = 0;
|
|
this.x1 = 1;
|
|
this.y1 = 0;
|
|
this.y2 = this.x2 = 1;
|
|
this.x3 = 0;
|
|
this.y3 = 1;
|
|
this.uvsFloat32 = new Float32Array(8);
|
|
}
|
|
set(frame, baseFrame, rotate) {
|
|
var tw = baseFrame.width;
|
|
const th = baseFrame.height;
|
|
if (rotate) {
|
|
baseFrame = frame.width / 2 / tw;
|
|
const h2 = frame.height / 2 / th;
|
|
tw = frame.x / tw + baseFrame;
|
|
frame = frame.y / th + h2;
|
|
rotate = groupD8.groupD8.add(rotate, groupD8.groupD8.NW);
|
|
this.x0 = tw + baseFrame * groupD8.groupD8.uX(rotate);
|
|
this.y0 = frame + h2 * groupD8.groupD8.uY(rotate);
|
|
rotate = groupD8.groupD8.add(rotate, 2);
|
|
this.x1 = tw + baseFrame * groupD8.groupD8.uX(rotate);
|
|
this.y1 = frame + h2 * groupD8.groupD8.uY(rotate);
|
|
rotate = groupD8.groupD8.add(rotate, 2);
|
|
this.x2 = tw + baseFrame * groupD8.groupD8.uX(rotate);
|
|
this.y2 = frame + h2 * groupD8.groupD8.uY(rotate);
|
|
rotate = groupD8.groupD8.add(rotate, 2);
|
|
this.x3 = tw + baseFrame * groupD8.groupD8.uX(rotate);
|
|
this.y3 = frame + h2 * groupD8.groupD8.uY(rotate);
|
|
} else {
|
|
this.x0 = frame.x / tw, this.y0 = frame.y / th, this.x1 = (frame.x + frame.width) / tw, this.y1 = frame.y / th, this.x2 = (frame.x + frame.width) / tw, this.y2 = (frame.y + frame.height) / th, this.x3 = frame.x / tw, this.y3 = (frame.y + frame.height) / th;
|
|
}
|
|
this.uvsFloat32[0] = this.x0;
|
|
this.uvsFloat32[1] = this.y0;
|
|
this.uvsFloat32[2] = this.x1;
|
|
this.uvsFloat32[3] = this.y1;
|
|
this.uvsFloat32[4] = this.x2;
|
|
this.uvsFloat32[5] = this.y2;
|
|
this.uvsFloat32[6] = this.x3;
|
|
this.uvsFloat32[7] = this.y3;
|
|
}
|
|
toString() {
|
|
return `[pixi.js/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`;
|
|
}
|
|
}
|
|
exports.TextureUvs = TextureUvs;
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$TextureUvs.js.map
|