mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 02:52:39 +08:00
Fix simple sprite rendering issue with rotated frame
This commit is contained in:
@@ -55,12 +55,12 @@ module.exports = {
|
||||
texh = texture._height;
|
||||
let frame = sprite.spriteFrame;
|
||||
let rect = frame._rect;
|
||||
let l = texw === 0 ? 0 : rect.x / texw;
|
||||
let r = texw === 0 ? 0 : (rect.x + rect.width) / texw;
|
||||
let b = texh === 0 ? 0 : (rect.y + rect.height) / texh;
|
||||
let t = texh === 0 ? 0 : rect.y / texh;
|
||||
|
||||
if (frame._rotated) {
|
||||
let l = texw === 0 ? 0 : rect.x / texw;
|
||||
let r = texw === 0 ? 0 : (rect.x + rect.height) / texw;
|
||||
let b = texh === 0 ? 0 : (rect.y + rect.width) / texh;
|
||||
let t = texh === 0 ? 0 : rect.y / texh;
|
||||
data[0].u = l;
|
||||
data[0].v = t;
|
||||
data[1].u = l;
|
||||
@@ -71,6 +71,10 @@ module.exports = {
|
||||
data[3].v = b;
|
||||
}
|
||||
else {
|
||||
let l = texw === 0 ? 0 : rect.x / texw;
|
||||
let r = texw === 0 ? 0 : (rect.x + rect.width) / texw;
|
||||
let b = texh === 0 ? 0 : (rect.y + rect.height) / texh;
|
||||
let t = texh === 0 ? 0 : rect.y / texh;
|
||||
data[0].u = l;
|
||||
data[0].v = b;
|
||||
data[1].u = r;
|
||||
|
||||
Reference in New Issue
Block a user