MonoGdx.Scene2D.Group.ComputeTransform C# (CSharp) Method

ComputeTransform() protected method

protected ComputeTransform ( ) : Matrix
return Matrix
        protected Matrix ComputeTransform()
        {
            Matrix3 localTransform = (OriginX != 0 || OriginY != 0)
                ? Matrix3.CreateTranslation(OriginX, OriginY)
                : Matrix3.Identity;

            if (Rotation != 0)
                localTransform = Matrix3.CreateRotation(Rotation) * localTransform;
            if (ScaleX != 1 || ScaleY != 1)
                localTransform = Matrix3.CreateScale(ScaleX, ScaleY) * localTransform;
            if (OriginX != 0 || OriginY != 0)
                localTransform = Matrix3.CreateTranslation(-OriginX, -OriginY) * localTransform;
            localTransform.Translate(X, Y);

            // Find the first parent that transforms
            Group parentGroup = Parent;
            while (parentGroup != null) {
                if (parentGroup.IsTransform)
                    break;
                parentGroup = parentGroup.Parent;
            }

            _worldTransform = (parentGroup != null) ? localTransform * parentGroup._worldTransform : localTransform;

            return _worldTransform.ToMatrix();
        }