日期:2014-05-17  浏览次数:20869 次

WPF 3D中两个ViewPort3D对象是否可以重叠呢?
代码如下面所示:

 <Window x:Class="Instant_Swipe.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Height="768"
        Width="1366"  >

    <Grid  >
        <Canvas Name="m_LeftCanvas" MouseDown="OnLeftCanvasMouseDown" Height="768" Width="642" Margin="0,0,0,0" 
                HorizontalAlignment="Left" VerticalAlignment="Top"> 
        </Canvas>
        <Canvas  Height="768" Width="638" Margin="642,0,0,0">
            <Viewport3D Name="mainViewport" HorizontalAlignment="Left" VerticalAlignment="Top"  Margin="0,0,0,0" 
                        Opacity="1" Height="768" Width="638" ClipToBounds="False">
            </Viewport3D>

            <Viewport3D Canvas.Left="1069" Canvas.Top="446" Canvas.Right="1275" Canvas.Bottom="687" Width="206" Height="241">

                <Viewport3D.Camera>
                    <PerspectiveCamera
                    Position="0,0,15"
                    LookDirection="0,0,-15"
                    UpDirection="0,1,0" 
                    />
                </Viewport3D.Camera>

                <ModelVisual3D>
                    <ModelVisual3D.Content>
                        <DirectionalLight Color="Red" Direction="10,10,10" />
                    </ModelVisual3D.Content>
                </ModelVisual3D>

                <Viewport2DVisual3D>
                    <Viewpo