其他ai修复了这个问题,3.3.11版本引擎修改代码如下,大家有这种问题的可以参考修改:
GraphicsRunner.ts代码中
drawTriangles(...已有参数, pixelSnap?: boolean):void {
...
...
var rgba = this._mixRGBandAlpha(colorNum, this._alpha * alpha);
let positions: number[];
if (!this._drawTriUseAbsMatrix) {
if (!matrix) {
tmpMat.a = 1; tmpMat.b = 0; tmpMat.c = 0; tmpMat.d = 1; tmpMat.tx = x; tmpMat.ty = y;
} else {
tmpMat.a = matrix.a; tmpMat.b = matrix.b; tmpMat.c = matrix.c; tmpMat.d = matrix.d; tmpMat.tx = matrix.tx + x; tmpMat.ty = matrix.ty + y;
}
Matrix.mul(tmpMat, this._curMat, tmpMat);
//由于2d动画部分的uvs是绝对的(例如图集的话就是相对图集的)所以最后不传uvrect了。
positions = this.appendData(vertices, indices, vertexResult, submit, uvs, rgba, tmpMat, null, !!tex, colors, uvRange, pixelSnap);
}
else {
// 这种情况是drawtexture转成的drawTriangle,直接使用matrix就行,传入的xy都是0
let m = this._curMat == matrix ? (this._matrixChanged ? this._curMat : null) : matrix;
positions = this.appendData(vertices, indices, vertexResult, submit, uvs, rgba, m, null, !!tex, colors, uvRange, pixelSnap);
}
....
....
}
appendData(...已有参数, pixelSnap?: boolean) {
......
......
positions[pi] = localX;
positions[pi + 1] = localY;
vbdata[vi] = localX * globalMatrix.a + localY * globalMatrix.c + globalMatrix.tx;
vbdata[vi + 1] = localX * globalMatrix.b + localY * globalMatrix.d + globalMatrix.ty;
// 下面这段是添加的
if (pixelSnap) {
vbdata[vi] = Math.round(vbdata[vi]);
vbdata[vi + 1] = Math.round(vbdata[vi + 1]);
}
......
......
}
Draw9GridTextureCmd.ts修改如下:
run(runner: GraphicsRunner, gx: number, gy: number): void {
... ...
... ...
// 删除下面这段代码
/* let uvrect = this.texture.uvrect;
if (
(uvrect[0] !== 0 || uvrect[1] !== 0 || uvrect[2] !== 1 || uvrect[3] !== 1)
) {
let bitmapW = this.texture.bitmap.width;
let bitmapH = this.texture.bitmap.height;
if (bitmapW > 0 && bitmapH > 0) {
let halfTexelU = 0.5 / bitmapW;
let halfTexelV = 0.5 / bitmapH;
vb.uvRect.x += halfTexelU;
vb.uvRect.y += halfTexelV;
vb.uvRect.width -= halfTexelU * 2;
vb.uvRect.height -= halfTexelV * 2;
}
}
*/
... ...
... ...
}