chore: 贴图裁剪范围检查

This commit is contained in:
unanmed 2025-10-25 12:10:18 +08:00
parent 1087de639d
commit ce7be406cb
2 changed files with 9 additions and 0 deletions

View File

@ -106,6 +106,9 @@
"72": "Frame count delivered to frame-based animater need to exactly divide texture's height.",
"73": "Consistent size is needed when using WebGL2 composer.",
"74": "Frame size not match texture's size, incomplete data will be skipped.",
"75": "Material count splitted by grid does not match alias count, some material may have no alias or some alias may not map to a texture. Splitted: $1, alias: $2.",
"76": "Cannot pipe texture store when asset builder is started.",
"77": "Texture is clipped to an area of 0. Ensure that the texture contains your clip rect and clip rect's area is not zero.",
"1001": "Item-detail extension needs 'floor-binder' and 'floor-damage' extension as dependency.",
"1101": "Cannot add new effect to point effect instance, for there's no more reserve space for it. Please increase the max count of the instance."
}

View File

@ -53,6 +53,12 @@ export class Texture<T = unknown, A = unknown> implements ITexture<T, A> {
const top = Math.max(0, y);
const right = Math.min(this.width, r);
const bottom = Math.min(this.height, b);
const width = right - left;
const height = bottom - top;
if (width <= 0 || height <= 0) {
logger.warn(77);
return;
}
this.cl = left;
this.ct = top;
this.width = right - left;