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

60 lines
1.6 KiB
JavaScript

import { Matrix } from '../../../maths/matrix/Matrix.mjs';
import { multiplyHexColors } from '../../container/utils/multiplyHexColors.mjs';
"use strict";
const identityMatrix = new Matrix();
class BatchableGraphics {
constructor() {
this.packAsQuad = false;
this.batcherName = "default";
this.applyTransform = true;
this.roundPixels = 0;
this._batcher = null;
this._batch = null;
}
get uvs() {
return this.geometryData.uvs;
}
get positions() {
return this.geometryData.vertices;
}
get indices() {
return this.geometryData.indices;
}
get blendMode() {
if (this.applyTransform) {
return this.renderable.groupBlendMode;
}
return "normal";
}
get color() {
const rgb = this.baseColor;
const bgr = rgb >> 16 | rgb & 65280 | (rgb & 255) << 16;
const renderable = this.renderable;
if (renderable) {
return multiplyHexColors(bgr, renderable.groupColor) + (this.alpha * renderable.groupAlpha * 255 << 24);
}
return bgr + (this.alpha * 255 << 24);
}
get transform() {
return this.renderable?.groupTransform || identityMatrix;
}
copyTo(gpuBuffer) {
gpuBuffer.indexOffset = this.indexOffset;
gpuBuffer.indexSize = this.indexSize;
gpuBuffer.attributeOffset = this.attributeOffset;
gpuBuffer.attributeSize = this.attributeSize;
gpuBuffer.baseColor = this.baseColor;
gpuBuffer.alpha = this.alpha;
gpuBuffer.texture = this.texture;
gpuBuffer.geometryData = this.geometryData;
}
reset() {
this.applyTransform = true;
this.renderable = null;
}
}
export { BatchableGraphics };
//# sourceMappingURL=BatchableGraphics.mjs.map