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,29 @@
import { TexturePool } from '../../../rendering/renderers/shared/texture/TexturePool.mjs';
import { Bounds } from '../../container/bounds/Bounds.mjs';
"use strict";
const tempBounds = new Bounds();
function getPo2TextureFromSource(image, width, height, resolution) {
const bounds = tempBounds;
bounds.minX = 0;
bounds.minY = 0;
bounds.maxX = image.width / resolution | 0;
bounds.maxY = image.height / resolution | 0;
const texture = TexturePool.getOptimalTexture(
bounds.width,
bounds.height,
resolution,
false
);
texture.source.uploadMethodId = "image";
texture.source.resource = image;
texture.source.alphaMode = "premultiply-alpha-on-upload";
texture.frame.width = width / resolution;
texture.frame.height = height / resolution;
texture.source.emit("update", texture.source);
texture.updateUvs();
return texture;
}
export { getPo2TextureFromSource };
//# sourceMappingURL=getPo2TextureFromSource.mjs.map