Files
nothoughts/node_modules/pixi.js/lib/scene/mesh/shared/BatchableMesh.mjs
2025-08-04 18:57:35 +02:00

67 lines
1.8 KiB
JavaScript

"use strict";
class BatchableMesh {
constructor() {
this.batcherName = "default";
this.packAsQuad = false;
this.indexOffset = 0;
this.attributeOffset = 0;
this.roundPixels = 0;
this._batcher = null;
this._batch = null;
this._uvUpdateId = -1;
this._textureMatrixUpdateId = -1;
}
get blendMode() {
return this.renderable.groupBlendMode;
}
reset() {
this.renderable = null;
this.texture = null;
this._batcher = null;
this._batch = null;
this.geometry = null;
this._uvUpdateId = -1;
this._textureMatrixUpdateId = -1;
}
get uvs() {
const geometry = this.geometry;
const uvBuffer = geometry.getBuffer("aUV");
const uvs = uvBuffer.data;
let transformedUvs = uvs;
const textureMatrix = this.texture.textureMatrix;
if (!textureMatrix.isSimple) {
transformedUvs = this._transformedUvs;
if (this._textureMatrixUpdateId !== textureMatrix._updateID || this._uvUpdateId !== uvBuffer._updateID) {
if (!transformedUvs || transformedUvs.length < uvs.length) {
transformedUvs = this._transformedUvs = new Float32Array(uvs.length);
}
this._textureMatrixUpdateId = textureMatrix._updateID;
this._uvUpdateId = uvBuffer._updateID;
textureMatrix.multiplyUvs(uvs, transformedUvs);
}
}
return transformedUvs;
}
get positions() {
return this.geometry.positions;
}
get indices() {
return this.geometry.indices;
}
get color() {
return this.renderable.groupColorAlpha;
}
get groupTransform() {
return this.renderable.groupTransform;
}
get attributeSize() {
return this.geometry.positions.length / 2;
}
get indexSize() {
return this.geometry.indices.length;
}
}
export { BatchableMesh };
//# sourceMappingURL=BatchableMesh.mjs.map