mirror of https://github.com/axmolengine/axmol.git
Label:support auto batch with bitmap font or char map.
This commit is contained in:
parent
744fa0b565
commit
2363622a67
|
@ -1208,10 +1208,20 @@ void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|||
if (_insideBounds)
|
||||
#endif
|
||||
{
|
||||
_customCommand.init(_globalZOrder, transform, flags);
|
||||
_customCommand.func = CC_CALLBACK_0(Label::onDraw, this, transform, transformUpdated);
|
||||
if (!_shadowEnabled && (_currentLabelType == LabelType::BMFONT || _currentLabelType == LabelType::CHARMAP))
|
||||
{
|
||||
auto textureAtlas = _batchNodes.at(0)->getTextureAtlas();
|
||||
_quadCommand.init(_globalZOrder, textureAtlas->getTexture()->getName(), getGLProgramState(),
|
||||
_blendFunc, textureAtlas->getQuads(), textureAtlas->getTotalQuads(), transform, flags);
|
||||
renderer->addCommand(&_quadCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
_customCommand.init(_globalZOrder, transform, flags);
|
||||
_customCommand.func = CC_CALLBACK_0(Label::onDraw, this, transform, transformUpdated);
|
||||
|
||||
renderer->addCommand(&_customCommand);
|
||||
renderer->addCommand(&_customCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "2d/CCNode.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
#include "renderer/CCQuadCommand.h"
|
||||
#include "2d/CCFontAtlas.h"
|
||||
#include "base/ccTypes.h"
|
||||
|
||||
|
@ -573,6 +574,7 @@ protected:
|
|||
Color4B _textColor;
|
||||
Color4F _textColorF;
|
||||
|
||||
QuadCommand _quadCommand;
|
||||
CustomCommand _customCommand;
|
||||
Mat4 _shadowTransform;
|
||||
GLuint _uniformEffectColor;
|
||||
|
|
Loading…
Reference in New Issue