mirror of https://github.com/axmolengine/axmol.git
- Optimization in CCClippingNode.
Disable visiting when no objects has to be drawn under stencil.
This commit is contained in:
parent
6c67c6921d
commit
7c355a087b
|
@ -231,7 +231,7 @@ void ClippingNode::drawFullScreenQuadClearStencil()
|
|||
|
||||
void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
||||
{
|
||||
if(!_visible)
|
||||
if (!_visible || !hasContent())
|
||||
return;
|
||||
|
||||
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
||||
|
@ -327,6 +327,11 @@ void ClippingNode::setStencil(Node *stencil)
|
|||
_stencil = stencil;
|
||||
}
|
||||
|
||||
bool ClippingNode::hasContent()
|
||||
{
|
||||
return _children.size() > 0;
|
||||
}
|
||||
|
||||
GLfloat ClippingNode::getAlphaThreshold() const
|
||||
{
|
||||
return _alphaThreshold;
|
||||
|
|
|
@ -58,7 +58,14 @@ public:
|
|||
*/
|
||||
Node* getStencil() const;
|
||||
void setStencil(Node *stencil);
|
||||
|
||||
|
||||
/** If stencil has no childre it will not be drawn.
|
||||
If you have custom stencil-based node with stencil drawing mechanics other then children-based,
|
||||
then this method should return true every time you wish stencil to be visited.
|
||||
By default returns true if has any children attached.
|
||||
*/
|
||||
virtual bool hasContent();
|
||||
|
||||
/** The alpha threshold.
|
||||
The content is drawn only where the stencil have pixel with alpha greater than the alphaThreshold.
|
||||
Should be a float between 0 and 1.
|
||||
|
|
Loading…
Reference in New Issue