This commit is contained in:
Akko
2025-08-04 18:57:35 +02:00
parent 8cf6e78a79
commit 9495868c2e
5030 changed files with 518594 additions and 17609 deletions

View File

@@ -0,0 +1,4 @@
import { MeshGeometry } from '../../mesh/shared/MeshGeometry';
export declare class QuadGeometry extends MeshGeometry {
constructor();
}

View File

@@ -0,0 +1,17 @@
'use strict';
var MeshGeometry = require('../../mesh/shared/MeshGeometry.js');
"use strict";
class QuadGeometry extends MeshGeometry.MeshGeometry {
constructor() {
super({
positions: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
indices: new Uint32Array([0, 1, 2, 0, 2, 3])
});
}
}
exports.QuadGeometry = QuadGeometry;
//# sourceMappingURL=QuadGeometry.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"QuadGeometry.js","sources":["../../../../src/scene/sprite-tiling/utils/QuadGeometry.ts"],"sourcesContent":["import { MeshGeometry } from '../../mesh/shared/MeshGeometry';\n\nexport class QuadGeometry extends MeshGeometry\n{\n constructor()\n {\n super({\n positions: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),\n uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),\n indices: new Uint32Array([0, 1, 2, 0, 2, 3]),\n });\n }\n}\n"],"names":["MeshGeometry"],"mappings":";;;;;AAEO,MAAM,qBAAqBA,yBAClC,CAAA;AAAA,EACI,WACA,GAAA;AACI,IAAM,KAAA,CAAA;AAAA,MACF,SAAW,EAAA,IAAI,YAAa,CAAA,CAAC,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAC,CAAC,CAAA;AAAA,MACpD,GAAK,EAAA,IAAI,YAAa,CAAA,CAAC,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAC,CAAC,CAAA;AAAA,MAC9C,OAAA,EAAS,IAAI,WAAA,CAAY,CAAC,CAAA,EAAG,GAAG,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAC,CAAC,CAAA;AAAA,KAC9C,CAAA,CAAA;AAAA,GACL;AACJ;;;;"}

View File

@@ -0,0 +1,15 @@
import { MeshGeometry } from '../../mesh/shared/MeshGeometry.mjs';
"use strict";
class QuadGeometry extends MeshGeometry {
constructor() {
super({
positions: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
indices: new Uint32Array([0, 1, 2, 0, 2, 3])
});
}
}
export { QuadGeometry };
//# sourceMappingURL=QuadGeometry.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"QuadGeometry.mjs","sources":["../../../../src/scene/sprite-tiling/utils/QuadGeometry.ts"],"sourcesContent":["import { MeshGeometry } from '../../mesh/shared/MeshGeometry';\n\nexport class QuadGeometry extends MeshGeometry\n{\n constructor()\n {\n super({\n positions: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),\n uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),\n indices: new Uint32Array([0, 1, 2, 0, 2, 3]),\n });\n }\n}\n"],"names":[],"mappings":";;;AAEO,MAAM,qBAAqB,YAClC,CAAA;AAAA,EACI,WACA,GAAA;AACI,IAAM,KAAA,CAAA;AAAA,MACF,SAAW,EAAA,IAAI,YAAa,CAAA,CAAC,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAC,CAAC,CAAA;AAAA,MACpD,GAAK,EAAA,IAAI,YAAa,CAAA,CAAC,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAC,CAAC,CAAA;AAAA,MAC9C,OAAA,EAAS,IAAI,WAAA,CAAY,CAAC,CAAA,EAAG,GAAG,CAAG,EAAA,CAAA,EAAG,CAAG,EAAA,CAAC,CAAC,CAAA;AAAA,KAC9C,CAAA,CAAA;AAAA,GACL;AACJ;;;;"}

View File

@@ -0,0 +1,3 @@
import type { Matrix } from '../../../maths/matrix/Matrix';
import type { TypedArray } from '../../../rendering/renderers/shared/buffer/Buffer';
export declare function applyMatrix(array: TypedArray, stride: number, offset: number, matrix: Matrix): void;

View File

@@ -0,0 +1,25 @@
'use strict';
"use strict";
function applyMatrix(array, stride, offset, matrix) {
let index = 0;
const size = array.length / (stride || 2);
const a = matrix.a;
const b = matrix.b;
const c = matrix.c;
const d = matrix.d;
const tx = matrix.tx;
const ty = matrix.ty;
offset *= stride;
while (index < size) {
const x = array[offset];
const y = array[offset + 1];
array[offset] = a * x + c * y + tx;
array[offset + 1] = b * x + d * y + ty;
offset += stride;
index++;
}
}
exports.applyMatrix = applyMatrix;
//# sourceMappingURL=applyMatrix.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"applyMatrix.js","sources":["../../../../src/scene/sprite-tiling/utils/applyMatrix.ts"],"sourcesContent":["import type { Matrix } from '../../../maths/matrix/Matrix';\nimport type { TypedArray } from '../../../rendering/renderers/shared/buffer/Buffer';\n\nexport function applyMatrix(array: TypedArray, stride: number, offset: number, matrix: Matrix)\n{\n let index = 0;\n const size = array.length / (stride || 2);\n\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n offset *= stride;\n\n while (index < size)\n {\n const x = array[offset];\n const y = array[offset + 1];\n\n array[offset] = (a * x) + (c * y) + tx;\n array[offset + 1] = (b * x) + (d * y) + ty;\n\n offset += stride;\n\n index++;\n }\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,WAAY,CAAA,KAAA,EAAmB,MAAgB,EAAA,MAAA,EAAgB,MAC/E,EAAA;AACI,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAM,MAAA,IAAA,GAAO,KAAM,CAAA,MAAA,IAAU,MAAU,IAAA,CAAA,CAAA,CAAA;AAEvC,EAAA,MAAM,IAAI,MAAO,CAAA,CAAA,CAAA;AACjB,EAAA,MAAM,IAAI,MAAO,CAAA,CAAA,CAAA;AACjB,EAAA,MAAM,IAAI,MAAO,CAAA,CAAA,CAAA;AACjB,EAAA,MAAM,IAAI,MAAO,CAAA,CAAA,CAAA;AACjB,EAAA,MAAM,KAAK,MAAO,CAAA,EAAA,CAAA;AAClB,EAAA,MAAM,KAAK,MAAO,CAAA,EAAA,CAAA;AAElB,EAAU,MAAA,IAAA,MAAA,CAAA;AAEV,EAAA,OAAO,QAAQ,IACf,EAAA;AACI,IAAM,MAAA,CAAA,GAAI,MAAM,MAAM,CAAA,CAAA;AACtB,IAAM,MAAA,CAAA,GAAI,KAAM,CAAA,MAAA,GAAS,CAAC,CAAA,CAAA;AAE1B,IAAA,KAAA,CAAM,MAAM,CAAA,GAAK,CAAI,GAAA,CAAA,GAAM,IAAI,CAAK,GAAA,EAAA,CAAA;AACpC,IAAA,KAAA,CAAM,SAAS,CAAC,CAAA,GAAK,CAAI,GAAA,CAAA,GAAM,IAAI,CAAK,GAAA,EAAA,CAAA;AAExC,IAAU,MAAA,IAAA,MAAA,CAAA;AAEV,IAAA,KAAA,EAAA,CAAA;AAAA,GACJ;AACJ;;;;"}

View File

@@ -0,0 +1,23 @@
"use strict";
function applyMatrix(array, stride, offset, matrix) {
let index = 0;
const size = array.length / (stride || 2);
const a = matrix.a;
const b = matrix.b;
const c = matrix.c;
const d = matrix.d;
const tx = matrix.tx;
const ty = matrix.ty;
offset *= stride;
while (index < size) {
const x = array[offset];
const y = array[offset + 1];
array[offset] = a * x + c * y + tx;
array[offset + 1] = b * x + d * y + ty;
offset += stride;
index++;
}
}
export { applyMatrix };
//# sourceMappingURL=applyMatrix.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"applyMatrix.mjs","sources":["../../../../src/scene/sprite-tiling/utils/applyMatrix.ts"],"sourcesContent":["import type { Matrix } from '../../../maths/matrix/Matrix';\nimport type { TypedArray } from '../../../rendering/renderers/shared/buffer/Buffer';\n\nexport function applyMatrix(array: TypedArray, stride: number, offset: number, matrix: Matrix)\n{\n let index = 0;\n const size = array.length / (stride || 2);\n\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n offset *= stride;\n\n while (index < size)\n {\n const x = array[offset];\n const y = array[offset + 1];\n\n array[offset] = (a * x) + (c * y) + tx;\n array[offset + 1] = (b * x) + (d * y) + ty;\n\n offset += stride;\n\n index++;\n }\n}\n"],"names":[],"mappings":";AAGO,SAAS,WAAY,CAAA,KAAA,EAAmB,MAAgB,EAAA,MAAA,EAAgB,MAC/E,EAAA;AACI,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAM,MAAA,IAAA,GAAO,KAAM,CAAA,MAAA,IAAU,MAAU,IAAA,CAAA,CAAA,CAAA;AAEvC,EAAA,MAAM,IAAI,MAAO,CAAA,CAAA,CAAA;AACjB,EAAA,MAAM,IAAI,MAAO,CAAA,CAAA,CAAA;AACjB,EAAA,MAAM,IAAI,MAAO,CAAA,CAAA,CAAA;AACjB,EAAA,MAAM,IAAI,MAAO,CAAA,CAAA,CAAA;AACjB,EAAA,MAAM,KAAK,MAAO,CAAA,EAAA,CAAA;AAClB,EAAA,MAAM,KAAK,MAAO,CAAA,EAAA,CAAA;AAElB,EAAU,MAAA,IAAA,MAAA,CAAA;AAEV,EAAA,OAAO,QAAQ,IACf,EAAA;AACI,IAAM,MAAA,CAAA,GAAI,MAAM,MAAM,CAAA,CAAA;AACtB,IAAM,MAAA,CAAA,GAAI,KAAM,CAAA,MAAA,GAAS,CAAC,CAAA,CAAA;AAE1B,IAAA,KAAA,CAAM,MAAM,CAAA,GAAK,CAAI,GAAA,CAAA,GAAM,IAAI,CAAK,GAAA,EAAA,CAAA;AACpC,IAAA,KAAA,CAAM,SAAS,CAAC,CAAA,GAAK,CAAI,GAAA,CAAA,GAAM,IAAI,CAAK,GAAA,EAAA,CAAA;AAExC,IAAU,MAAA,IAAA,MAAA,CAAA;AAEV,IAAA,KAAA,EAAA,CAAA;AAAA,GACJ;AACJ;;;;"}

View File

@@ -0,0 +1,2 @@
import type { TilingSprite } from '../TilingSprite';
export declare function setPositions(tilingSprite: TilingSprite, positions: Float32Array): void;

View File

@@ -0,0 +1,18 @@
'use strict';
"use strict";
function setPositions(tilingSprite, positions) {
const anchorX = tilingSprite.anchor.x;
const anchorY = tilingSprite.anchor.y;
positions[0] = -anchorX * tilingSprite.width;
positions[1] = -anchorY * tilingSprite.height;
positions[2] = (1 - anchorX) * tilingSprite.width;
positions[3] = -anchorY * tilingSprite.height;
positions[4] = (1 - anchorX) * tilingSprite.width;
positions[5] = (1 - anchorY) * tilingSprite.height;
positions[6] = -anchorX * tilingSprite.width;
positions[7] = (1 - anchorY) * tilingSprite.height;
}
exports.setPositions = setPositions;
//# sourceMappingURL=setPositions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"setPositions.js","sources":["../../../../src/scene/sprite-tiling/utils/setPositions.ts"],"sourcesContent":["import type { TilingSprite } from '../TilingSprite';\n\nexport function setPositions(tilingSprite: TilingSprite, positions: Float32Array)\n{\n const anchorX = tilingSprite.anchor.x;\n const anchorY = tilingSprite.anchor.y;\n\n positions[0] = -anchorX * tilingSprite.width;\n positions[1] = -anchorY * tilingSprite.height;\n positions[2] = (1 - anchorX) * tilingSprite.width;\n positions[3] = -anchorY * tilingSprite.height;\n positions[4] = (1 - anchorX) * tilingSprite.width;\n positions[5] = (1 - anchorY) * tilingSprite.height;\n positions[6] = -anchorX * tilingSprite.width;\n positions[7] = (1 - anchorY) * tilingSprite.height;\n}\n"],"names":[],"mappings":";;;AAEgB,SAAA,YAAA,CAAa,cAA4B,SACzD,EAAA;AACI,EAAM,MAAA,OAAA,GAAU,aAAa,MAAO,CAAA,CAAA,CAAA;AACpC,EAAM,MAAA,OAAA,GAAU,aAAa,MAAO,CAAA,CAAA,CAAA;AAEpC,EAAA,SAAA,CAAU,CAAC,CAAA,GAAI,CAAC,OAAA,GAAU,YAAa,CAAA,KAAA,CAAA;AACvC,EAAA,SAAA,CAAU,CAAC,CAAA,GAAI,CAAC,OAAA,GAAU,YAAa,CAAA,MAAA,CAAA;AACvC,EAAA,SAAA,CAAU,CAAC,CAAA,GAAA,CAAK,CAAI,GAAA,OAAA,IAAW,YAAa,CAAA,KAAA,CAAA;AAC5C,EAAA,SAAA,CAAU,CAAC,CAAA,GAAI,CAAC,OAAA,GAAU,YAAa,CAAA,MAAA,CAAA;AACvC,EAAA,SAAA,CAAU,CAAC,CAAA,GAAA,CAAK,CAAI,GAAA,OAAA,IAAW,YAAa,CAAA,KAAA,CAAA;AAC5C,EAAA,SAAA,CAAU,CAAC,CAAA,GAAA,CAAK,CAAI,GAAA,OAAA,IAAW,YAAa,CAAA,MAAA,CAAA;AAC5C,EAAA,SAAA,CAAU,CAAC,CAAA,GAAI,CAAC,OAAA,GAAU,YAAa,CAAA,KAAA,CAAA;AACvC,EAAA,SAAA,CAAU,CAAC,CAAA,GAAA,CAAK,CAAI,GAAA,OAAA,IAAW,YAAa,CAAA,MAAA,CAAA;AAChD;;;;"}

View File

@@ -0,0 +1,16 @@
"use strict";
function setPositions(tilingSprite, positions) {
const anchorX = tilingSprite.anchor.x;
const anchorY = tilingSprite.anchor.y;
positions[0] = -anchorX * tilingSprite.width;
positions[1] = -anchorY * tilingSprite.height;
positions[2] = (1 - anchorX) * tilingSprite.width;
positions[3] = -anchorY * tilingSprite.height;
positions[4] = (1 - anchorX) * tilingSprite.width;
positions[5] = (1 - anchorY) * tilingSprite.height;
positions[6] = -anchorX * tilingSprite.width;
positions[7] = (1 - anchorY) * tilingSprite.height;
}
export { setPositions };
//# sourceMappingURL=setPositions.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"setPositions.mjs","sources":["../../../../src/scene/sprite-tiling/utils/setPositions.ts"],"sourcesContent":["import type { TilingSprite } from '../TilingSprite';\n\nexport function setPositions(tilingSprite: TilingSprite, positions: Float32Array)\n{\n const anchorX = tilingSprite.anchor.x;\n const anchorY = tilingSprite.anchor.y;\n\n positions[0] = -anchorX * tilingSprite.width;\n positions[1] = -anchorY * tilingSprite.height;\n positions[2] = (1 - anchorX) * tilingSprite.width;\n positions[3] = -anchorY * tilingSprite.height;\n positions[4] = (1 - anchorX) * tilingSprite.width;\n positions[5] = (1 - anchorY) * tilingSprite.height;\n positions[6] = -anchorX * tilingSprite.width;\n positions[7] = (1 - anchorY) * tilingSprite.height;\n}\n"],"names":[],"mappings":";AAEgB,SAAA,YAAA,CAAa,cAA4B,SACzD,EAAA;AACI,EAAM,MAAA,OAAA,GAAU,aAAa,MAAO,CAAA,CAAA,CAAA;AACpC,EAAM,MAAA,OAAA,GAAU,aAAa,MAAO,CAAA,CAAA,CAAA;AAEpC,EAAA,SAAA,CAAU,CAAC,CAAA,GAAI,CAAC,OAAA,GAAU,YAAa,CAAA,KAAA,CAAA;AACvC,EAAA,SAAA,CAAU,CAAC,CAAA,GAAI,CAAC,OAAA,GAAU,YAAa,CAAA,MAAA,CAAA;AACvC,EAAA,SAAA,CAAU,CAAC,CAAA,GAAA,CAAK,CAAI,GAAA,OAAA,IAAW,YAAa,CAAA,KAAA,CAAA;AAC5C,EAAA,SAAA,CAAU,CAAC,CAAA,GAAI,CAAC,OAAA,GAAU,YAAa,CAAA,MAAA,CAAA;AACvC,EAAA,SAAA,CAAU,CAAC,CAAA,GAAA,CAAK,CAAI,GAAA,OAAA,IAAW,YAAa,CAAA,KAAA,CAAA;AAC5C,EAAA,SAAA,CAAU,CAAC,CAAA,GAAA,CAAK,CAAI,GAAA,OAAA,IAAW,YAAa,CAAA,MAAA,CAAA;AAC5C,EAAA,SAAA,CAAU,CAAC,CAAA,GAAI,CAAC,OAAA,GAAU,YAAa,CAAA,KAAA,CAAA;AACvC,EAAA,SAAA,CAAU,CAAC,CAAA,GAAA,CAAK,CAAI,GAAA,OAAA,IAAW,YAAa,CAAA,MAAA,CAAA;AAChD;;;;"}

View File

@@ -0,0 +1,2 @@
import type { TilingSprite } from '../TilingSprite';
export declare function setUvs(tilingSprite: TilingSprite, uvs: Float32Array): void;

View File

@@ -0,0 +1,31 @@
'use strict';
var Matrix = require('../../../maths/matrix/Matrix.js');
var applyMatrix = require('./applyMatrix.js');
"use strict";
function setUvs(tilingSprite, uvs) {
const texture = tilingSprite.texture;
const width = texture.frame.width;
const height = texture.frame.height;
let anchorX = 0;
let anchorY = 0;
if (tilingSprite._applyAnchorToTexture) {
anchorX = tilingSprite.anchor.x;
anchorY = tilingSprite.anchor.y;
}
uvs[0] = uvs[6] = -anchorX;
uvs[2] = uvs[4] = 1 - anchorX;
uvs[1] = uvs[3] = -anchorY;
uvs[5] = uvs[7] = 1 - anchorY;
const textureMatrix = Matrix.Matrix.shared;
textureMatrix.copyFrom(tilingSprite._tileTransform.matrix);
textureMatrix.tx /= tilingSprite.width;
textureMatrix.ty /= tilingSprite.height;
textureMatrix.invert();
textureMatrix.scale(tilingSprite.width / width, tilingSprite.height / height);
applyMatrix.applyMatrix(uvs, 2, 0, textureMatrix);
}
exports.setUvs = setUvs;
//# sourceMappingURL=setUvs.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"setUvs.js","sources":["../../../../src/scene/sprite-tiling/utils/setUvs.ts"],"sourcesContent":["import { Matrix } from '../../../maths/matrix/Matrix';\nimport { applyMatrix } from './applyMatrix';\n\nimport type { TilingSprite } from '../TilingSprite';\n\nexport function setUvs(tilingSprite: TilingSprite, uvs: Float32Array)\n{\n const texture = tilingSprite.texture;\n\n const width = texture.frame.width;\n const height = texture.frame.height;\n\n let anchorX = 0;\n let anchorY = 0;\n\n if (tilingSprite._applyAnchorToTexture)\n {\n anchorX = tilingSprite.anchor.x;\n anchorY = tilingSprite.anchor.y;\n }\n\n uvs[0] = uvs[6] = -anchorX;\n uvs[2] = uvs[4] = 1 - anchorX;\n uvs[1] = uvs[3] = -anchorY;\n uvs[5] = uvs[7] = 1 - anchorY;\n\n const textureMatrix = Matrix.shared;\n\n textureMatrix.copyFrom(tilingSprite._tileTransform.matrix);\n\n textureMatrix.tx /= tilingSprite.width;\n textureMatrix.ty /= tilingSprite.height;\n\n textureMatrix.invert();\n\n textureMatrix.scale(tilingSprite.width / width, tilingSprite.height / height);\n\n applyMatrix(uvs, 2, 0, textureMatrix);\n}\n"],"names":["Matrix","applyMatrix"],"mappings":";;;;;;AAKgB,SAAA,MAAA,CAAO,cAA4B,GACnD,EAAA;AACI,EAAA,MAAM,UAAU,YAAa,CAAA,OAAA,CAAA;AAE7B,EAAM,MAAA,KAAA,GAAQ,QAAQ,KAAM,CAAA,KAAA,CAAA;AAC5B,EAAM,MAAA,MAAA,GAAS,QAAQ,KAAM,CAAA,MAAA,CAAA;AAE7B,EAAA,IAAI,OAAU,GAAA,CAAA,CAAA;AACd,EAAA,IAAI,OAAU,GAAA,CAAA,CAAA;AAEd,EAAA,IAAI,aAAa,qBACjB,EAAA;AACI,IAAA,OAAA,GAAU,aAAa,MAAO,CAAA,CAAA,CAAA;AAC9B,IAAA,OAAA,GAAU,aAAa,MAAO,CAAA,CAAA,CAAA;AAAA,GAClC;AAEA,EAAA,GAAA,CAAI,CAAC,CAAA,GAAI,GAAI,CAAA,CAAC,IAAI,CAAC,OAAA,CAAA;AACnB,EAAA,GAAA,CAAI,CAAC,CAAA,GAAI,GAAI,CAAA,CAAC,IAAI,CAAI,GAAA,OAAA,CAAA;AACtB,EAAA,GAAA,CAAI,CAAC,CAAA,GAAI,GAAI,CAAA,CAAC,IAAI,CAAC,OAAA,CAAA;AACnB,EAAA,GAAA,CAAI,CAAC,CAAA,GAAI,GAAI,CAAA,CAAC,IAAI,CAAI,GAAA,OAAA,CAAA;AAEtB,EAAA,MAAM,gBAAgBA,aAAO,CAAA,MAAA,CAAA;AAE7B,EAAc,aAAA,CAAA,QAAA,CAAS,YAAa,CAAA,cAAA,CAAe,MAAM,CAAA,CAAA;AAEzD,EAAA,aAAA,CAAc,MAAM,YAAa,CAAA,KAAA,CAAA;AACjC,EAAA,aAAA,CAAc,MAAM,YAAa,CAAA,MAAA,CAAA;AAEjC,EAAA,aAAA,CAAc,MAAO,EAAA,CAAA;AAErB,EAAA,aAAA,CAAc,MAAM,YAAa,CAAA,KAAA,GAAQ,KAAO,EAAA,YAAA,CAAa,SAAS,MAAM,CAAA,CAAA;AAE5E,EAAYC,uBAAA,CAAA,GAAA,EAAK,CAAG,EAAA,CAAA,EAAG,aAAa,CAAA,CAAA;AACxC;;;;"}

View File

@@ -0,0 +1,29 @@
import { Matrix } from '../../../maths/matrix/Matrix.mjs';
import { applyMatrix } from './applyMatrix.mjs';
"use strict";
function setUvs(tilingSprite, uvs) {
const texture = tilingSprite.texture;
const width = texture.frame.width;
const height = texture.frame.height;
let anchorX = 0;
let anchorY = 0;
if (tilingSprite._applyAnchorToTexture) {
anchorX = tilingSprite.anchor.x;
anchorY = tilingSprite.anchor.y;
}
uvs[0] = uvs[6] = -anchorX;
uvs[2] = uvs[4] = 1 - anchorX;
uvs[1] = uvs[3] = -anchorY;
uvs[5] = uvs[7] = 1 - anchorY;
const textureMatrix = Matrix.shared;
textureMatrix.copyFrom(tilingSprite._tileTransform.matrix);
textureMatrix.tx /= tilingSprite.width;
textureMatrix.ty /= tilingSprite.height;
textureMatrix.invert();
textureMatrix.scale(tilingSprite.width / width, tilingSprite.height / height);
applyMatrix(uvs, 2, 0, textureMatrix);
}
export { setUvs };
//# sourceMappingURL=setUvs.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"setUvs.mjs","sources":["../../../../src/scene/sprite-tiling/utils/setUvs.ts"],"sourcesContent":["import { Matrix } from '../../../maths/matrix/Matrix';\nimport { applyMatrix } from './applyMatrix';\n\nimport type { TilingSprite } from '../TilingSprite';\n\nexport function setUvs(tilingSprite: TilingSprite, uvs: Float32Array)\n{\n const texture = tilingSprite.texture;\n\n const width = texture.frame.width;\n const height = texture.frame.height;\n\n let anchorX = 0;\n let anchorY = 0;\n\n if (tilingSprite._applyAnchorToTexture)\n {\n anchorX = tilingSprite.anchor.x;\n anchorY = tilingSprite.anchor.y;\n }\n\n uvs[0] = uvs[6] = -anchorX;\n uvs[2] = uvs[4] = 1 - anchorX;\n uvs[1] = uvs[3] = -anchorY;\n uvs[5] = uvs[7] = 1 - anchorY;\n\n const textureMatrix = Matrix.shared;\n\n textureMatrix.copyFrom(tilingSprite._tileTransform.matrix);\n\n textureMatrix.tx /= tilingSprite.width;\n textureMatrix.ty /= tilingSprite.height;\n\n textureMatrix.invert();\n\n textureMatrix.scale(tilingSprite.width / width, tilingSprite.height / height);\n\n applyMatrix(uvs, 2, 0, textureMatrix);\n}\n"],"names":[],"mappings":";;;;AAKgB,SAAA,MAAA,CAAO,cAA4B,GACnD,EAAA;AACI,EAAA,MAAM,UAAU,YAAa,CAAA,OAAA,CAAA;AAE7B,EAAM,MAAA,KAAA,GAAQ,QAAQ,KAAM,CAAA,KAAA,CAAA;AAC5B,EAAM,MAAA,MAAA,GAAS,QAAQ,KAAM,CAAA,MAAA,CAAA;AAE7B,EAAA,IAAI,OAAU,GAAA,CAAA,CAAA;AACd,EAAA,IAAI,OAAU,GAAA,CAAA,CAAA;AAEd,EAAA,IAAI,aAAa,qBACjB,EAAA;AACI,IAAA,OAAA,GAAU,aAAa,MAAO,CAAA,CAAA,CAAA;AAC9B,IAAA,OAAA,GAAU,aAAa,MAAO,CAAA,CAAA,CAAA;AAAA,GAClC;AAEA,EAAA,GAAA,CAAI,CAAC,CAAA,GAAI,GAAI,CAAA,CAAC,IAAI,CAAC,OAAA,CAAA;AACnB,EAAA,GAAA,CAAI,CAAC,CAAA,GAAI,GAAI,CAAA,CAAC,IAAI,CAAI,GAAA,OAAA,CAAA;AACtB,EAAA,GAAA,CAAI,CAAC,CAAA,GAAI,GAAI,CAAA,CAAC,IAAI,CAAC,OAAA,CAAA;AACnB,EAAA,GAAA,CAAI,CAAC,CAAA,GAAI,GAAI,CAAA,CAAC,IAAI,CAAI,GAAA,OAAA,CAAA;AAEtB,EAAA,MAAM,gBAAgB,MAAO,CAAA,MAAA,CAAA;AAE7B,EAAc,aAAA,CAAA,QAAA,CAAS,YAAa,CAAA,cAAA,CAAe,MAAM,CAAA,CAAA;AAEzD,EAAA,aAAA,CAAc,MAAM,YAAa,CAAA,KAAA,CAAA;AACjC,EAAA,aAAA,CAAc,MAAM,YAAa,CAAA,MAAA,CAAA;AAEjC,EAAA,aAAA,CAAc,MAAO,EAAA,CAAA;AAErB,EAAA,aAAA,CAAc,MAAM,YAAa,CAAA,KAAA,GAAQ,KAAO,EAAA,YAAA,CAAa,SAAS,MAAM,CAAA,CAAA;AAE5E,EAAY,WAAA,CAAA,GAAA,EAAK,CAAG,EAAA,CAAA,EAAG,aAAa,CAAA,CAAA;AACxC;;;;"}