pixi.js
Version:
PixiJS — The HTML5 Creation Engine =============
38 lines (35 loc) • 968 B
JavaScript
;
;
function buildUvs(vertices, verticesStride, verticesOffset, uvs, uvsOffset, uvsStride, size, matrix = null) {
let index = 0;
verticesOffset *= verticesStride;
uvsOffset *= uvsStride;
const a = matrix.a;
const b = matrix.b;
const c = matrix.c;
const d = matrix.d;
const tx = matrix.tx;
const ty = matrix.ty;
while (index < size) {
const x = vertices[verticesOffset];
const y = vertices[verticesOffset + 1];
uvs[uvsOffset] = a * x + c * y + tx;
uvs[uvsOffset + 1] = b * x + d * y + ty;
uvsOffset += uvsStride;
verticesOffset += verticesStride;
index++;
}
}
function buildSimpleUvs(uvs, uvsOffset, uvsStride, size) {
let index = 0;
uvsOffset *= uvsStride;
while (index < size) {
uvs[uvsOffset] = 0;
uvs[uvsOffset + 1] = 0;
uvsOffset += uvsStride;
index++;
}
}
exports.buildSimpleUvs = buildSimpleUvs;
exports.buildUvs = buildUvs;
//# sourceMappingURL=buildUvs.js.map