■ Viewport3D 엘리먼트 사용하기

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

<Viewport3D>

    <Viewport3D.Children>

        <ModelVisual3D>

            <ModelVisual3D.Content>

                <GeometryModel3D>

                    <GeometryModel3D.Geometry>

                        <MeshGeometry3D

                            Positions="-0.5  0.5  0.5,  0.5  0.5  0.5,

                                       -0.5 -0.5  0.5,  0.5 -0.5  0.5,

                                        0.5  0.5 -0.5, -0.5  0.5 -0.5,

                                        0.5 -0.5 -0.5, -0.5 -0.5 -0.5,

                                       -0.5  0.5 -0.5, -0.5  0.5  0.5,

                                       -0.5 -0.5 -0.5, -0.5 -0.5  0.5,

                                        0.5  0.5  0.5,  0.5  0.5 -0.5,

                                        0.5 -0.5  0.5,  0.5 -0.5 -0.5,

                                       -0.5  0.5 -0.5,  0.5  0.5 -0.5,

                                       -0.5  0.5  0.5,  0.5  0.5  0.5,

                                        0.5 -0.5 -0.5, -0.5 -0.5 -0.5,

                                        0.5 -0.5  0.5, -0.5 -0.5  0.5"

                            TriangleIndices=" 0  2  1,  1  2  3,

                                              4  6  5,  5  6  7,

                                              8 10  9,  9 10 11,

                                             12 14 13, 13 14 15,

                                             16 18 17, 17 18 19,

                                             20 22 21, 21 22 23" />

                    </GeometryModel3D.Geometry>

                    <GeometryModel3D.Material>

                        <DiffuseMaterial Brush="RoyalBlue" />

                    </GeometryModel3D.Material>

                    <GeometryModel3D.BackMaterial>

                        <DiffuseMaterial Brush="Black" />

                    </GeometryModel3D.BackMaterial>

                </GeometryModel3D>

            </ModelVisual3D.Content>

        </ModelVisual3D>

        <ModelVisual3D>

            <ModelVisual3D.Content>

                <AmbientLight Color="#808080" />

            </ModelVisual3D.Content>

        </ModelVisual3D>

        <ModelVisual3D>

            <ModelVisual3D.Content>

                <DirectionalLight

                    Color="#c0c0c0"

                    Direction="2 -3 -1" />

            </ModelVisual3D.Content>

        </ModelVisual3D>

    </Viewport3D.Children>

    <Viewport3D.Camera>

        <PerspectiveCamera

            Position="0 1 6"

            LookDirection="0 -1 -6"

            UpDirection="0 1 0"

            FieldOfView="45" />

    </Viewport3D.Camera>

</Viewport3D>

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

Posted by 사용자 icodebroker