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

WPF,3D图形纹理映射,为什么没有正确显示图片呢?

<Grid>
    <Viewport3D Name="myViewport" >
        <Viewport3D.Camera>
            <PerspectiveCamera Position="1,3,2" LookDirection="0,-3,-2" />
        </Viewport3D.Camera>
        <ModelVisual3D>
            <ModelVisual3D.Content>
                <DirectionalLight Color="White" Direction="0,2,0"/>
            </ModelVisual3D.Content>
        </ModelVisual3D>
        <ModelVisual3D>
            <ModelVisual3D.Content>
                <GeometryModel3D>
                    <GeometryModel3D.Geometry>
                        <MeshGeometry3D Positions="0,0,0 0,1,0 2,0,0 2,1,0" TriangleIndices="0,2,1 1,2,3" TextureCoordinates="1,1 0,1 1,0 0,0"/>
                    </GeometryModel3D.Geometry>
                    <GeometryModel3D.Material>
                        <DiffuseMaterial>
                            <DiffuseMaterial.Brush>
                                <ImageBrush ImageSource="6.jpg"/>
                            </DiffuseMaterial.Brush>
                        </DiffuseMaterial>
                    </GeometryModel3D.Material>
                </GeometryModel3D>
            </ModelVisual3D.Content>
        </ModelVisual3D>
    </Viewport3D>
</Grid>


上面代码中,3D矩形,设置了纹理映射,为什么没有显示图片呢?