mirror of https://github.com/axmolengine/axmol.git
Merge pull request #12863 from fusijie/fix_polygonsprite_setColor
fix polygon sprite setColor, setOpacity, setTexture, setTextureRect.
This commit is contained in:
commit
a72ea73e60
|
@ -265,7 +265,6 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
|
|||
setTexture(texture);
|
||||
setTextureRect(rect, rotated, rect.size);
|
||||
|
||||
_polyInfo.setQuad(&_quad);
|
||||
// by default use "Self Render".
|
||||
// if the sprite is added to a batchnode, then it will automatically switch to "batchnode Render"
|
||||
setBatchNode(nullptr);
|
||||
|
@ -424,6 +423,8 @@ void Sprite::setTextureRect(const Rect& rect, bool rotated, const Size& untrimme
|
|||
_quad.tl.vertices.set(x1, y2, 0.0f);
|
||||
_quad.tr.vertices.set(x2, y2, 0.0f);
|
||||
}
|
||||
|
||||
_polyInfo.setQuad(&_quad);
|
||||
}
|
||||
|
||||
void Sprite::debugDraw(bool on)
|
||||
|
@ -943,10 +944,9 @@ void Sprite::updateColor(void)
|
|||
color4.b *= _displayedOpacity/255.0f;
|
||||
}
|
||||
|
||||
_quad.bl.colors = color4;
|
||||
_quad.br.colors = color4;
|
||||
_quad.tl.colors = color4;
|
||||
_quad.tr.colors = color4;
|
||||
for (ssize_t i = 0; i < _polyInfo.triangles.vertCount; i++) {
|
||||
_polyInfo.triangles.verts[i].colors = color4;
|
||||
}
|
||||
|
||||
// renders using batch node
|
||||
if (_batchNode)
|
||||
|
|
Loading…
Reference in New Issue