mirror of https://github.com/axmolengine/axmol.git
fix polygon sprite setColor, setOpacity, setTexture, setTextureRect.
This commit is contained in:
parent
a204b02668
commit
e4b392d4c8
|
@ -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)
|
||||
|
@ -942,10 +943,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