■ Viewport3D 클래스 사용하기

------------------------------------------------------------------------------------------------------------------------


TestProject.zip


MainWindow.xaml

 

 

<Window x:Class="TestProject.MainWindow"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Width="800"

    Height="600"

    Title="Viewport3D 클래스 사용하기"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid>

        <Viewport3D>

            <Viewport3D.Camera>

                <PerspectiveCamera Position="0 0 5" />

            </Viewport3D.Camera>

            <Viewport2DVisual3D>

                <Viewport2DVisual3D.Transform>

                    <RotateTransform3D>

                        <RotateTransform3D.Rotation>

                            <AxisAngleRotation3D

                                Angle="30"

                                Axis="0 1 0" />

                        </RotateTransform3D.Rotation>

                    </RotateTransform3D>

                </Viewport2DVisual3D.Transform>

                <Viewport2DVisual3D.Geometry>

                    <MeshGeometry3D

                        Positions="-1 1 0 -1 -1 0 1 -1 0 1 1 0"

                        TextureCoordinates="0 0 0 1 1 1 1 0"

                        TriangleIndices="0 1 2 0 2 3" />

                </Viewport2DVisual3D.Geometry>

                <Viewport2DVisual3D.Material>

                    <DiffuseMaterial

                        Viewport2DVisual3D.IsVisualHostMaterial="True"

                        Brush="White" />

                </Viewport2DVisual3D.Material>

                <Button>테스트 3D</Button>

            </Viewport2DVisual3D>

            <ModelVisual3D>

                <ModelVisual3D.Content>

                    <DirectionalLight

                        Color="#ffffffff"

                        Direction="0 0 -1" />

                </ModelVisual3D.Content>

            </ModelVisual3D>

        </Viewport3D>

    </Grid>

</Window>

 

 

MainWindow.xaml.cs

 

 

using System.Windows;

 

namespace TestProject

{

    /// <summary>

    /// 메인 윈도우

    /// </summary>

    public partial class MainWindow : Window

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

        ////////////////////////////////////////////////////////////////////////////////////////// Public

 

        #region 생성자 - MainWindow()

 

        /// <summary>

        /// 생성자

        /// </summary>

        public MainWindow()

        {

            InitializeComponent();

        }

 

        #endregion

    }

}

 

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker

댓글을 달아 주세요