UpdateLayerTransforms() public method

public UpdateLayerTransforms ( ) : void
return void
Ejemplo n.º 1
0
    override public void Redraw(bool shouldForceDirty, bool shouldUpdateDepth)
    {
        bool didNeedDepthUpdate = _needsDepthUpdate || shouldUpdateDepth;

        _needsDepthUpdate = false;

        if (didNeedDepthUpdate)
        {
            shouldForceDirty  = true;
            shouldUpdateDepth = true;
            nextNodeDepth     = index * 10000;       //each stage will be 10000 higher in "depth" than the previous one
            _renderer.StartRender();
        }

        bool wasAlphaDirty = _isAlphaDirty;

        UpdateDepthMatrixAlpha(shouldForceDirty, shouldUpdateDepth);

        int childCount = _childNodes.Count;

        for (int c = 0; c < childCount; c++)
        {
            //key difference between Stage and Container: Stage doesn't force dirty if matrix is dirty
            //in other words, you can move the stage all you want and it won't force its children to redraw
            //this is especially handy for scrolling/zooming purposes
            _childNodes[c].Redraw(shouldForceDirty || wasAlphaDirty, shouldUpdateDepth);             //if the alpha is dirty or we're supposed to force it, do it!
        }

        UpdateFollow();

        if (didNeedDepthUpdate)
        {
            _renderer.EndRender();
            Futile.touchManager.HandleDepthChange();
        }

        if (_doesRendererNeedTransformChange)
        {
            _doesRendererNeedTransformChange = false;

            _transform.position   = new Vector3(_x, _y, 0);
            _transform.rotation   = Quaternion.AngleAxis(_rotation, Vector3.back);
            _transform.localScale = new Vector3(_scaleX * _visibleScale, _scaleX * _visibleScale, _scaleX * _visibleScale);       //uniform scale (should be better performance)

            _renderer.UpdateLayerTransforms();
        }
    }