我有一個立方體定義爲立方體的WPF紋理映射
<MeshGeometry3D Positions="0,0,0 180.31222920257,180.31222920257,0 90.1561146012848,360.624458405139,156.154971102428 -90.1561146012848,180.31222920257,156.154971102428 -90.1561146012848,180.31222920257,-156.154971102428 90.1561146012848,360.624458405139,-156.154971102428 0,540.936687607709,0 -180.31222920257,360.624458405139,0 "
TriangleIndices="0 1 3 1 2 3 0 3 4 3 7 4 0 4 1 4 5 1
1 5 2 5 6 2 3 2 7 2 6 7 4 7 5 5 7 6"/>
在其上欲映射此質地:
使得它形成具有下列連續的梯度在這些相應的位置處的顏色:
Black 0,0,0
Red 180.31222920257,180.31222920257,0
Yellow 90.1561146012848,360.624458405139,156.154971102428
Green -90.1561146012848,180.31222920257,156.154971102428
Blue -90.1561146012848,180.31222920257,-156.154971102428
Magenta 90.1561146012848,360.624458405139,-156.154971102428
White 0, 540.936687607709, 0
Cyan 180.31222920257, 360.624458405139, 0
在閱讀了一些關於萊有關WPF紋理映射,我想出了以下內容,不工作:
TextureCoordinates="0 , 0.666666667 0.25, 0.666666667 0 , 0.333333333
0.25, 0.666666667 0 , 0.666666667 0.25, 0.333333333
1 , 0.666666667 1 , 0.333333333 0.75, 0.666666667
1 , 0.333333333 0.75, 0.333333333 0.75, 0.666666667
0.75, 1 0.75, 0.666666667 0.5 , 1
0.75, 0.666666667 0.5 , 0.666666667 0.5 , 1
0.25, 0.666666667 0.5 , 0.666666667 0.25, 0.333333333
0.5 , 0.666666667 0.5 , 0.333333333 0.25, 0.333333333
0.75, 0 0.5 , 0 0.75, 0.333333333
0.5 , 0 0.5 , 0.333333333 0.75, 0.333333333
0.75, 0.666666667 0.75, 0.333333333 0.5 , 0.666666667
0.5 , 0.666666667 0.75, 0.333333333 0.5 , 0.333333333"
該映射具有紋理以45個角用怪異的伸展下去。
什麼是我想要的適當的映射,以及你怎麼產生的呢?
全XAML,按要求
<Window x:Class="cube.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Viewport3D>
<Viewport3D.Camera>
<PerspectiveCamera Position="-800,1000,800" LookDirection="40,-40,-40 "
UpDirection="0,1,0" />
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<Model3DGroup>
<DirectionalLight Color="White" Direction="-1,-1,-3" />
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D Positions="0,0,0 180.31222920257,180.31222920257,0 90.1561146012848,360.624458405139,156.154971102428 -90.1561146012848,180.31222920257,156.154971102428 -90.1561146012848,180.31222920257,-156.154971102428 90.1561146012848,360.624458405139,-156.154971102428 0,540.936687607709,0 -180.31222920257,360.624458405139,0 "
TriangleIndices="0 1 3 1 2 3 0 3 4 3 7 4 0 4 1 4 5 1
1 5 2 5 6 2 3 2 7 2 6 7 4 7 5 5 7 6"
TextureCoordinates="0 , 0.666666667 0.25, 0.666666667 0 , 0.333333333
0.25, 0.666666667 0 , 0.666666667 0.25, 0.333333333
1 , 0.666666667 1 , 0.333333333 0.75, 0.666666667
1 , 0.333333333 0.75, 0.333333333 0.75, 0.666666667
0.75, 1 0.75, 0.666666667 0.5 , 1
0.75, 0.666666667 0.5 , 0.666666667 0.5 , 1
0.25, 0.666666667 0.5 , 0.666666667 0.25, 0.333333333
0.5 , 0.666666667 0.5 , 0.333333333 0.25, 0.333333333
0.75, 0 0.5 , 0 0.75, 0.333333333
0.5 , 0 0.5 , 0.333333333 0.75, 0.333333333
0.75, 0.666666667 0.75, 0.333333333 0.5 , 0.666666667
0.5 , 0.666666667 0.75, 0.333333333 0.5 , 0.333333333"/>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial>
<DiffuseMaterial.Brush>
<ImageBrush ImageSource="texture.png"/>
</DiffuseMaterial.Brush>
</DiffuseMaterial>
</GeometryModel3D.Material>
</GeometryModel3D>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
</Viewport3D>
</Grid>
請將您的XAML數據全部複製/添加到問題中,這裏的部分代碼不足以重現您的問題。 –