mirror of https://github.com/axmolengine/axmol.git
Little fixes for setNormalized
This commit is contained in:
parent
1b8d0d88df
commit
b24c674d25
|
@ -880,7 +880,7 @@ void Label::drawShadowWithoutBlur()
|
||||||
void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
void Label::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
// Don't do calculate the culling if the transform was not updated
|
// Don't do calculate the culling if the transform was not updated
|
||||||
_insideBounds = (flags & PARENT_DIRTY_MASK) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
|
_insideBounds = (flags & FLAGS_TRANSFORM_DIRTY) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
|
||||||
|
|
||||||
if(_insideBounds) {
|
if(_insideBounds) {
|
||||||
_customCommand.init(_globalZOrder);
|
_customCommand.init(_globalZOrder);
|
||||||
|
@ -1066,7 +1066,7 @@ void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t pare
|
||||||
|
|
||||||
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
||||||
|
|
||||||
if (_shadowEnabled && _shadowBlurRadius <= 0 && (_shadowDirty || (flags & PARENT_DIRTY_MASK)))
|
if (_shadowEnabled && _shadowBlurRadius <= 0 && (_shadowDirty || (flags & FLAGS_DIRTY_MASK)))
|
||||||
{
|
{
|
||||||
_position.x += _shadowOffset.width;
|
_position.x += _shadowOffset.width;
|
||||||
_position.y += _shadowOffset.height;
|
_position.y += _shadowOffset.height;
|
||||||
|
|
|
@ -976,10 +976,10 @@ void Node::visit()
|
||||||
uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFlags)
|
uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFlags)
|
||||||
{
|
{
|
||||||
uint32_t flags = parentFlags;
|
uint32_t flags = parentFlags;
|
||||||
flags |= (_transformUpdated ? PARENT_TRANSFORM_DIRTY : 0);
|
flags |= (_transformUpdated ? FLAGS_TRANSFORM_DIRTY : 0);
|
||||||
flags |= (_contentSizeDirty ? PARENT_CONTENT_SIZE_DIRTY : 0);
|
flags |= (_contentSizeDirty ? FLAGS_CONTENT_SIZE_DIRTY : 0);
|
||||||
|
|
||||||
if(_usingNormalizedPosition && (flags & PARENT_CONTENT_SIZE_DIRTY)) {
|
if(_usingNormalizedPosition && (flags & FLAGS_CONTENT_SIZE_DIRTY)) {
|
||||||
CCASSERT(_parent, "setNormalizedPosition() doesn't work with orphan nodes");
|
CCASSERT(_parent, "setNormalizedPosition() doesn't work with orphan nodes");
|
||||||
auto s = _parent->getContentSize();
|
auto s = _parent->getContentSize();
|
||||||
_position.x = _normalizedPosition.x * s.width;
|
_position.x = _normalizedPosition.x * s.width;
|
||||||
|
@ -987,7 +987,7 @@ uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFl
|
||||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flags & PARENT_DIRTY_MASK)
|
if(flags & FLAGS_DIRTY_MASK)
|
||||||
_modelViewTransform = this->transform(parentTransform);
|
_modelViewTransform = this->transform(parentTransform);
|
||||||
|
|
||||||
_transformUpdated = false;
|
_transformUpdated = false;
|
||||||
|
|
|
@ -108,10 +108,10 @@ public:
|
||||||
static const int INVALID_TAG = -1;
|
static const int INVALID_TAG = -1;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PARENT_TRANSFORM_DIRTY = (1 << 0),
|
FLAGS_TRANSFORM_DIRTY = (1 << 0),
|
||||||
PARENT_CONTENT_SIZE_DIRTY = (1 << 1),
|
FLAGS_CONTENT_SIZE_DIRTY = (1 << 1),
|
||||||
|
|
||||||
PARENT_DIRTY_MASK = (PARENT_TRANSFORM_DIRTY | PARENT_CONTENT_SIZE_DIRTY),
|
FLAGS_DIRTY_MASK = (FLAGS_TRANSFORM_DIRTY | FLAGS_CONTENT_SIZE_DIRTY),
|
||||||
};
|
};
|
||||||
/// @{
|
/// @{
|
||||||
/// @name Constructor, Destructor and Initializers
|
/// @name Constructor, Destructor and Initializers
|
||||||
|
|
|
@ -94,7 +94,7 @@ void NodeGrid::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t p
|
||||||
renderer->addCommand(&_groupCommand);
|
renderer->addCommand(&_groupCommand);
|
||||||
renderer->pushGroup(_groupCommand.getRenderQueueID());
|
renderer->pushGroup(_groupCommand.getRenderQueueID());
|
||||||
|
|
||||||
bool dirty = (parentFlags & PARENT_TRANSFORM_DIRTY) || _transformUpdated;
|
bool dirty = (parentFlags & FLAGS_TRANSFORM_DIRTY) || _transformUpdated;
|
||||||
if(dirty)
|
if(dirty)
|
||||||
_modelViewTransform = this->transform(parentTransform);
|
_modelViewTransform = this->transform(parentTransform);
|
||||||
_transformUpdated = false;
|
_transformUpdated = false;
|
||||||
|
|
|
@ -588,7 +588,7 @@ void Sprite::updateTransform(void)
|
||||||
void Sprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
void Sprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
// Don't do calculate the culling if the transform was not updated
|
// Don't do calculate the culling if the transform was not updated
|
||||||
_insideBounds = (flags & PARENT_DIRTY_MASK) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
|
_insideBounds = (flags & FLAGS_TRANSFORM_DIRTY) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
|
||||||
|
|
||||||
if(_insideBounds)
|
if(_insideBounds)
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,7 +151,7 @@ public:
|
||||||
void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override
|
void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override
|
||||||
{
|
{
|
||||||
// Don't do calculate the culling if the transform was not updated
|
// Don't do calculate the culling if the transform was not updated
|
||||||
_insideBounds = (flags & PARENT_DIRTY_MASK) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
|
_insideBounds = (flags & FLAGS_TRANSFORM_DIRTY) ? renderer->checkVisibility(transform, _contentSize) : _insideBounds;
|
||||||
|
|
||||||
if(_insideBounds)
|
if(_insideBounds)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue