diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index b9d991555f..3058be1c4b 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -910,6 +910,18 @@ void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) } } +void Label::setCameraMask(unsigned short mask, bool applyChildren) +{ + if (_textSprite) + { + _textSprite->setCameraMask(mask, applyChildren); + } + if (_shadowNode) + { + _shadowNode->setCameraMask(mask, applyChildren); + } +} + void Label::createSpriteWithFontDefinition() { _currentLabelType = LabelType::STRING_TEXTURE; diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index e6d7c4715b..0fe7246f98 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -266,6 +266,8 @@ public: virtual void visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override; virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override; + virtual void setCameraMask(unsigned short mask, bool applyChildren) override; + CC_DEPRECATED_ATTRIBUTE static Label* create(const std::string& text, const std::string& font, float fontSize, const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT, TextVAlignment vAlignment = TextVAlignment::TOP);