cocos2dx 3.3多相机下_transformUpdated bug

 

uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFlags)

{

    if(_usingNormalizedPosition) {

        CCASSERT(_parent, "setNormalizedPosition() doesn't work with orphan nodes");

        if ((parentFlags & FLAGS_CONTENT_SIZE_DIRTY) || _normalizedPositionDirty) {

            auto s = _parent->getContentSize();

            _position.x = _normalizedPosition.x * s.width;

            _position.y = _normalizedPosition.y * s.height;

            _transformUpdated = _transformDirty = _inverseDirty = true;

            _normalizedPositionDirty = false;

        }

    }

    

    uint32_t flags = parentFlags;

    flags |= (_transformUpdated ? FLAGS_TRANSFORM_DIRTY : 0);

    flags |= (_contentSizeDirty ? FLAGS_CONTENT_SIZE_DIRTY : 0);

    

 

    if(flags & FLAGS_DIRTY_MASK)

        _modelViewTransform = this->transform(parentTransform);

 

    _transformUpdated = false;

    _contentSizeDirty = false;

 

    return flags;

}

 改成:

 

uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFlags)

{

    if(_usingNormalizedPosition) {

        CCASSERT(_parent, "setNormalizedPosition() doesn't work with orphan nodes");

        if ((parentFlags & FLAGS_CONTENT_SIZE_DIRTY) || _normalizedPositionDirty) {

            auto s = _parent->getContentSize();

            _position.x = _normalizedPosition.x * s.width;

            _position.y = _normalizedPosition.y * s.height;

            _transformUpdated = _transformDirty = _inverseDirty = true;

            _normalizedPositionDirty = false;

        }

    }

    

    uint32_t flags = parentFlags;

    flags |= (_transformUpdated ? FLAGS_TRANSFORM_DIRTY : 0);

    flags |= (_contentSizeDirty ? FLAGS_CONTENT_SIZE_DIRTY : 0);

    

 

    if(flags & FLAGS_DIRTY_MASK)

        _modelViewTransform = this->transform(parentTransform);

 

    if(isVisitableByVisitingCamera())//if the camera is not match this node, do not consume _transformUpdated.  [wantnon,  yuanotes]. see: https://github.com/cocos2d/cocos2d-x/issues/10063

    {

        _transformUpdated = false;

        _contentSizeDirty = false;

    }

    return flags;

}

 

 

posted on 2015-03-16 13:12  wantnon  阅读(492)  评论(0编辑  收藏  举报

导航