Exemplo n.º 1
0
        internal GeneralTransform2DTo3D(GeneralTransform transform2D,
                                        Viewport2DVisual3D containingVisual3D,
                                        GeneralTransform3D transform3D)
        {
            Visual child = containingVisual3D.Visual;

            Debug.Assert(child != null, "Going from 2D to 3D containingVisual3D.Visual should not be null");

            _transform3D = (GeneralTransform3D)transform3D.GetCurrentValueAsFrozen();

            // we also need to go one more level up to handle a transform being placed
            // on the Viewport2DVisual3D's child
            GeneralTransformGroup transformGroup = new GeneralTransformGroup();

            transformGroup.Children.Add((GeneralTransform)transform2D.GetCurrentValueAsFrozen());
            transformGroup.Children.Add((GeneralTransform)child.TransformToOuterSpace().GetCurrentValueAsFrozen());
            transformGroup.Freeze();
            _transform2D = transformGroup;

            _positions     = containingVisual3D.InternalPositionsCache;
            _textureCoords = containingVisual3D.InternalTextureCoordinatesCache;
            _triIndices    = containingVisual3D.InternalTriangleIndicesCache;

            _childBounds = child.CalculateSubgraphRenderBoundsOuterSpace();
        }