需要帮助ModelVisual3DS

黑暗的

成员
加入
2014年6月16日
消息
16
编程经验
Beginner
我正试福彩12选5走势图自由旋转的Rubicks Cube的福彩12选5走势图一样。每侧九个福彩12选5走势图,整个东西都可以旋转。

现在我试图查找如何做到这一点并找到

它注意到:???????? ? ???????? 3d ?????? ? WPF.

我不明白这种语言,但这是我想要的最接近的事情。

现在我完全是3D WPF的东西和动画,而且通过纯粹的力量将在重做这段代码以满足我的需求方面取得了一点进展。我已经重新处理了它们每侧都有福彩12选5走势图,并且我调整了它以形成多维数据集而不是矩形。

C#:
<Window x:Class="WPFApplication1.Sample"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="3D Demo" Height="500" Width="500">
    <Window.Resources>




        <VisualBrush x:Key="mainCover">
            <VisualBrush.Visual>
                <Border Background="Yellow" BorderThickness="2">
                    <Image Source="image.jpg" />
                </Border>
            </VisualBrush.Visual>
        </VisualBrush>


        <SolidColorBrush x:Key="top" Color="BurlyWood" />
        <SolidColorBrush x:Key="pages" Color="BurlyWood" />
        <SolidColorBrush x:Key="back" Color="BurlyWood" />
        <SolidColorBrush x:Key="side" Color="BurlyWood" />
    </Window.Resources>
    <Viewport3D>
        <Viewport3D.Camera>
            <PerspectiveCamera Position="0,-15,50" LookDirection="15,6,-50" />
        </Viewport3D.Camera>


        <ModelVisual3D>
            <ModelVisual3D.Content>
                <!--<AmbientLight Color="White" />-->
                <SpotLight Color="White" InnerConeAngle="20" OuterConeAngle="60" Direction="15,6,-50" Position="0,0,25" />
            </ModelVisual3D.Content>
        </ModelVisual3D>


        <ModelVisual3D>
            <ModelVisual3D.Content>
                <Model3DGroup>


                    <!-- front -->
                    <GeometryModel3D>
                        <GeometryModel3D.Geometry>
                            <MeshGeometry3D
                                Positions="0 0 0, 16 0 0, 0 16 0, 16 16 0, 16 0 0"
                                TriangleIndices="0, 1, 2, 2, 4, 3"
                                TextureCoordinates="0 1, 1 1, 0 0, 1 0, 1 1"
                                />
                        </GeometryModel3D.Geometry>


                        <GeometryModel3D.Material>
                            <MaterialGroup>
                                <SpecularMaterial SpecularPower="99">
                                    <SpecularMaterial.Brush>
                                        <SolidColorBrush>Yellow</SolidColorBrush>
                                    </SpecularMaterial.Brush>
                                </SpecularMaterial>
                                <DiffuseMaterial Brush="{StaticResource mainCover}" />
                            </MaterialGroup>


                        </GeometryModel3D.Material>
                    </GeometryModel3D>






                    <!-- left -->
                    <GeometryModel3D>
                        <GeometryModel3D.Geometry>
                            <MeshGeometry3D
                            Positions="0 0 -16, 0 0 0, 0 16 -16, 0 16 0, 0 0 0"
                                TriangleIndices="0, 1, 2, 2, 4, 3"
                            TextureCoordinates="0 1, 1 1, 0 0, 1 0, 1 1"/>
                        </GeometryModel3D.Geometry>




                        <GeometryModel3D.Material>
                            <MaterialGroup>
                                <SpecularMaterial SpecularPower="99">
                                    <SpecularMaterial.Brush>
                                        <SolidColorBrush>Yellow</SolidColorBrush>
                                    </SpecularMaterial.Brush>
                                </SpecularMaterial>
                                <DiffuseMaterial Brush="{StaticResource mainCover}" />
                            </MaterialGroup>


                        </GeometryModel3D.Material>
                    </GeometryModel3D>


                    <!-- right  -->
                    <GeometryModel3D>
                        <GeometryModel3D.Geometry>
                            <MeshGeometry3D
                            Positions="16 0 0, 16 0 -16, 16 16 0, 16 16 -16, 16 0 -16"
                                TriangleIndices="0, 1, 2, 2, 4, 3"
                            TextureCoordinates="0 1, 1 1, 0 0, 1 0, 1 1"/>
                        </GeometryModel3D.Geometry>




                        <GeometryModel3D.Material>
                            <MaterialGroup>
                                <SpecularMaterial SpecularPower="99">
                                    <SpecularMaterial.Brush>
                                        <SolidColorBrush>Yellow</SolidColorBrush>
                                    </SpecularMaterial.Brush>
                                </SpecularMaterial>
                                <DiffuseMaterial Brush="{StaticResource mainCover}" />
                            </MaterialGroup>


                        </GeometryModel3D.Material>
                    </GeometryModel3D>




                    <!-- top side -->
                    <GeometryModel3D>
                        <GeometryModel3D.Geometry>
                            <MeshGeometry3D
                            Positions="0 16 0, 0 16 -16, 16 16 0, 16 16 -16, 0 16 -16"
                                TriangleIndices="0, 2, 1, 2, 3, 4"
                                TextureCoordinates="0 1, 1 1, 0 0, 1 0, 1 1"
                                />
                        </GeometryModel3D.Geometry>




                        <GeometryModel3D.Material>
                            <MaterialGroup>
                                <SpecularMaterial SpecularPower="99">
                                    <SpecularMaterial.Brush>
                                        <SolidColorBrush>Yellow</SolidColorBrush>
                                    </SpecularMaterial.Brush>
                                </SpecularMaterial>
                                <DiffuseMaterial Brush="{StaticResource mainCover}" />
                            </MaterialGroup>


                        </GeometryModel3D.Material>
                    </GeometryModel3D>


                    <!-- bottom -->
                    <GeometryModel3D>
                        <GeometryModel3D.Geometry>
                            <MeshGeometry3D
                            Positions="0 0 0, 0 0 -16, 16 0 0, 16 0 -16, 0 0 -16"
                                TriangleIndices="0, 1, 2, 2, 4, 3"
                            TextureCoordinates="0 1, 1 1, 0 0, 1 0, 1 1"/>
                        </GeometryModel3D.Geometry>




                        <GeometryModel3D.Material>
                            <MaterialGroup>
                                <SpecularMaterial SpecularPower="99">
                                    <SpecularMaterial.Brush>
                                        <SolidColorBrush>Yellow</SolidColorBrush>
                                    </SpecularMaterial.Brush>
                                </SpecularMaterial>
                                <DiffuseMaterial Brush="{StaticResource mainCover}" />
                            </MaterialGroup>


                        </GeometryModel3D.Material>
                    </GeometryModel3D>


                    <!-- back -->
                    <GeometryModel3D>
                        <GeometryModel3D.Geometry>
                            <MeshGeometry3D
                            Positions="0 0 -16, 16 0 -16, 0 16 -16, 16 16 -16, 16 0 -16"
                                TriangleIndices="0, 2, 1, 2, 3, 4"
                            TextureCoordinates="0 1, 1 1, 0 0, 1 0, 1 1"/>
                        </GeometryModel3D.Geometry>




                        <GeometryModel3D.Material>
                            <MaterialGroup>
                                <SpecularMaterial SpecularPower="99">
                                    <SpecularMaterial.Brush>
                                        <SolidColorBrush>Yellow</SolidColorBrush>
                                    </SpecularMaterial.Brush>
                                </SpecularMaterial>
                                <DiffuseMaterial Brush="{StaticResource mainCover}" />
                            </MaterialGroup>


                        </GeometryModel3D.Material>
                    </GeometryModel3D>




                    <Model3DGroup.Transform>
                        <RotateTransform3D CenterX="0" CenterY="0" CenterZ="0">
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D x:Name="angle" Axis="-1,-1,-1" Angle="70" />
                            </RotateTransform3D.Rotation>


                        </RotateTransform3D>
                    </Model3DGroup.Transform>


                </Model3DGroup>


            </ModelVisual3D.Content>
        </ModelVisual3D>


    </Viewport3D>
    <Window.Triggers>
        <EventTrigger RoutedEvent="Window.Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation From="0" To="360" Duration="00:00:10" Storyboard.TargetName="angle" Storyboard.TargetProperty="Angle" RepeatBehavior="Forever" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Window.Triggers>
</Window>

现在我想做的是,首先改变旋转轴,使其位于多维数据集的中心。现在,它已经出路,在它旋转时使立方体飞行。我无法找到对我的生活混乱的正确属性......

然后我想改变它充满了明亮。就像我不想要一些花哨的照明系统一样,我只是想看到一张完全点燃的福彩12选5走势图。

最后,有一个良好的初学者教程解释了所有这些,因为MSDN是痛苦的缺乏信息。
 
最佳 底部