Я создал один 3d-куб, используя Viewport3D в WPF. Я создал 6 GeometryModel3D внутри Viewport, так как я хочу показать различное содержимое на каждом лице. Я хочу вставить один элемент управления кнопками userinteractice на одно лицо (переднюю грань) куба. Я знаю, что мы должны использовать Viewport2DVisual3D для этой цели. Но я не могу найти решение, как я могу вставить 2-й элемент управления на лицо с помощью Viewport2DVisual3D. 1001 *
<Grid>
<Viewport3D>
<Viewport3D.Camera>
<PerspectiveCamera Position="0,0,25" 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, 10 0 0, 0 16 0, 10 16 0, 10 0 0"
TriangleIndices="0, 1, 2, 2, 4, 3"
TextureCoordinates="0 1, 1 1, 0 0, 1 0, 1 1"
/>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial Brush="White"/>
</GeometryModel3D.Material>
<Viewport2DVisual3D>
<StackPanel>
<Button>Hello, 3D</Button>
</StackPanel>
</Viewport2DVisual3D>
</GeometryModel3D>
<!-- left -->
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="0 0 -.5, 0 0 0, 0 14 -.5, 0 14 0, 0 0 0"
TriangleIndices="0, 1, 2, 2, 4, 3" />
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<MaterialGroup>
<DiffuseMaterial Brush="{StaticResource side}" />
</MaterialGroup>
</GeometryModel3D.Material>
<GeometryModel3D.BackMaterial>
<DiffuseMaterial Color="Blue" />
</GeometryModel3D.BackMaterial>
</GeometryModel3D>
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="0 14 -4, 0 14 0, 0 16 -4, 0 16 0, 0 14 0"
TriangleIndices="0, 1, 2, 2, 4, 3" />
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<MaterialGroup>
<DiffuseMaterial Brush="{StaticResource top}" />
</MaterialGroup>
</GeometryModel3D.Material>
<GeometryModel3D.BackMaterial>
<DiffuseMaterial Color="Blue" />
</GeometryModel3D.BackMaterial>
</GeometryModel3D>
<!-- right -->
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="10 0 0, 10 0 -.5, 10 16 0, 10 16 -.5, 10 0 -.5"
TriangleIndices="0, 1, 2, 2, 4, 3" />
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<MaterialGroup>
<DiffuseMaterial Brush="{StaticResource top}" />
</MaterialGroup>
</GeometryModel3D.Material>
<GeometryModel3D.BackMaterial>
<DiffuseMaterial Color="Blue" />
</GeometryModel3D.BackMaterial>
</GeometryModel3D>
<!-- top side -->
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="0 16 0, 0 16 -.5, 10 16 0, 10 16 -.5, 0 16 -.5"
TriangleIndices="0, 2, 1, 2, 3, 4"
TextureCoordinates="0 1, 0 0, 1 1, 1 0, 0 0"
/>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<MaterialGroup>
<DiffuseMaterial Brush="{StaticResource pages}" />
</MaterialGroup>
</GeometryModel3D.Material>
<GeometryModel3D.BackMaterial>
<DiffuseMaterial Color="Blue" />
</GeometryModel3D.BackMaterial>
</GeometryModel3D>
<!-- bottom -->
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="0 0 0, 0 0 -.5, 10 0 0, 10 0 -.5, 0 0 -.5"
TriangleIndices="0, 1, 2, 2, 4, 3"
TextureCoordinates="0 1, 0 0, 1 1, 1 0, 0 0"
/>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial Brush="{StaticResource pages}" />
</GeometryModel3D.Material>
<GeometryModel3D.BackMaterial>
<DiffuseMaterial Color="Blue" />
</GeometryModel3D.BackMaterial>
</GeometryModel3D>
<!-- back -->
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="0 0 -.5, 10 0 -.5, 0 16 -.5, 10 16 -.5, 10 0 -.5"
TriangleIndices="0, 2, 1, 2, 3, 4" />
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<MaterialGroup>
<DiffuseMaterial Brush="{StaticResource back}" />
</MaterialGroup>
</GeometryModel3D.Material>
<GeometryModel3D.BackMaterial>
<DiffuseMaterial Color="Blue" />
</GeometryModel3D.BackMaterial>
</GeometryModel3D>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
</Viewport3D>
</Grid>