1 | <UserControl x:Class="HeuristicLab.Problems.BinPacking.Views.Container3DView"
|
---|
2 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
---|
3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
---|
4 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
---|
5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
---|
6 | mc:Ignorable="d"
|
---|
7 | d:DesignHeight="300" d:DesignWidth="300"
|
---|
8 | MouseMove="Container3DView_MouseMove" MouseDown="Container3DView_MouseDown" MouseUp="Container3DView_MouseUp"
|
---|
9 | MouseWheel="Container3DView_OnMouseWheel"
|
---|
10 | MouseEnter="Container3DView_OnMouseEnter"
|
---|
11 | Focusable="true"
|
---|
12 | >
|
---|
13 | <Grid>
|
---|
14 | <Viewport3D Name="viewport3D1" >
|
---|
15 | <Viewport3D.Camera>
|
---|
16 | <PerspectiveCamera x:Name="camMain" Position="0.5 5 5" LookDirection="0 -1 -1"> <!-- camera position for design time-->
|
---|
17 | </PerspectiveCamera>
|
---|
18 | </Viewport3D.Camera>
|
---|
19 | <ModelVisual3D>
|
---|
20 | <ModelVisual3D.Content>
|
---|
21 | <DirectionalLight x:Name="dirLightMain" Direction="0,-1,-1"/>
|
---|
22 | </ModelVisual3D.Content>
|
---|
23 | </ModelVisual3D>
|
---|
24 | <ModelVisual3D>
|
---|
25 | </ModelVisual3D>
|
---|
26 | <ModelVisual3D x:Name="MyModel">
|
---|
27 | <ModelVisual3D.Content>
|
---|
28 | <Model3DGroup>
|
---|
29 | <GeometryModel3D>
|
---|
30 | <GeometryModel3D.Geometry>
|
---|
31 | <!-- two opaque cubes, one in front one in back-->
|
---|
32 | <MeshGeometry3D x:Name="meshMain"
|
---|
33 | Positions="0 0 -2.5 1 0 -2.5 0 1 -2.5 1 1 -2.5 0 0 -1.5 1 0 -1.5 0 1 -1.5 1 1 -1.5
|
---|
34 | 0 0 0 1 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 1 1"
|
---|
35 | TriangleIndices="10 11 9 10 9 8 15 9 11 15 13 9 14 13 15 14 12 13 14 10 12 10 8 12 10 15 11 10 14 15 0 9 13 8 13 12
|
---|
36 | 2 3 1 2 1 0 7 1 3 7 5 1 6 5 7 6 4 5 6 2 4 2 0 4 2 7 3 2 6 7 0 1 5 0 5 4 ">
|
---|
37 | </MeshGeometry3D>
|
---|
38 | </GeometryModel3D.Geometry>
|
---|
39 | <GeometryModel3D.Material>
|
---|
40 | <DiffuseMaterial>
|
---|
41 | <DiffuseMaterial.Brush>
|
---|
42 | <SolidColorBrush Color="LightGreen"/>
|
---|
43 | </DiffuseMaterial.Brush>
|
---|
44 | </DiffuseMaterial>
|
---|
45 | </GeometryModel3D.Material>
|
---|
46 | </GeometryModel3D>
|
---|
47 | <GeometryModel3D>
|
---|
48 | <GeometryModel3D.Geometry>
|
---|
49 | <!-- two transparent cubes, one in front one in back-->
|
---|
50 | <!-- draw transparent cubes from back to front and always draw outer and inner triangles and draw from front to back-->
|
---|
51 | <MeshGeometry3D x:Name="meshInsides"
|
---|
52 | Positions="-1 -1 -1 2 -1 -1 -1 2 -1 2 2 -1 -1 -1 2 2 -1 2 -1 2 2 2 2 2
|
---|
53 | -1 -1 -3 2 -1 -3 -1 2 -3 2 2 -3 -1 -1 -1 2 -1 -1 -1 2 -1 2 2 -1"
|
---|
54 | TriangleIndices="9 11 10 8 9 10 11 9 15 9 13 15 15 13 14 13 12 14 12 10 14 12 8 10 11 15 10 15 14 10 13 9 8 12 13 8
|
---|
55 | 1 3 2 0 1 2 3 1 7 1 5 7 7 5 6 5 4 6 4 2 6 4 0 2 3 7 2 7 6 2 5 1 0 4 5 0
|
---|
56 | ">
|
---|
57 | </MeshGeometry3D>
|
---|
58 | </GeometryModel3D.Geometry>
|
---|
59 | <GeometryModel3D.Material>
|
---|
60 | <MaterialGroup>
|
---|
61 | <DiffuseMaterial>
|
---|
62 | <DiffuseMaterial.Brush>
|
---|
63 | <SolidColorBrush Opacity="0.1" Color="DarkGray"/>
|
---|
64 | </DiffuseMaterial.Brush>
|
---|
65 | </DiffuseMaterial>
|
---|
66 | </MaterialGroup>
|
---|
67 | </GeometryModel3D.Material>
|
---|
68 | </GeometryModel3D>
|
---|
69 | <GeometryModel3D>
|
---|
70 | <GeometryModel3D.Geometry>
|
---|
71 | <!-- two transparent cubes, one in front one in back-->
|
---|
72 | <!-- draw transparent cubes from back to front and always draw outer and inner triangles and draw from front to back-->
|
---|
73 | <MeshGeometry3D x:Name="meshTransparent"
|
---|
74 | Positions="-1 -1 -1 2 -1 -1 -1 2 -1 2 2 -1 -1 -1 2 2 -1 2 -1 2 2 2 2 2
|
---|
75 | -1 -1 -3 2 -1 -3 -1 2 -3 2 2 -3 -1 -1 -1 2 -1 -1 -1 2 -1 2 2 -1"
|
---|
76 | TriangleIndices="2 3 1 2 1 0 7 1 3 7 5 1 6 5 7 6 4 5 6 2 4 2 0 4 2 7 3 2 6 7 0 1 5 0 5 4
|
---|
77 | 10 11 9 10 9 8 15 9 11 15 13 9 14 13 15 14 12 13 14 10 12 10 8 12 10 15 11 10 14 15 0 9 13 8 13 12
|
---|
78 | ">
|
---|
79 | </MeshGeometry3D>
|
---|
80 | </GeometryModel3D.Geometry>
|
---|
81 | <GeometryModel3D.Material>
|
---|
82 | <MaterialGroup>
|
---|
83 | <DiffuseMaterial>
|
---|
84 | <DiffuseMaterial.Brush>
|
---|
85 | <SolidColorBrush Opacity="0.1" Color="DarkGray"/>
|
---|
86 | </DiffuseMaterial.Brush>
|
---|
87 | </DiffuseMaterial>
|
---|
88 | </MaterialGroup>
|
---|
89 | </GeometryModel3D.Material>
|
---|
90 | </GeometryModel3D>
|
---|
91 |
|
---|
92 | </Model3DGroup>
|
---|
93 | </ModelVisual3D.Content>
|
---|
94 | <ModelVisual3D.Transform>
|
---|
95 | <Transform3DGroup>
|
---|
96 | <ScaleTransform3D x:Name="scale" ScaleX="1" ScaleY="1" ScaleZ="1"/>
|
---|
97 | <TranslateTransform3D OffsetX="-0.5" OffsetY="-0.5" OffsetZ="-0.5" />
|
---|
98 | <RotateTransform3D>
|
---|
99 | <RotateTransform3D.Rotation>
|
---|
100 | <AxisAngleRotation3D x:Name="rotateX" Axis="0 1 0"/>
|
---|
101 | </RotateTransform3D.Rotation>
|
---|
102 | </RotateTransform3D>
|
---|
103 | <RotateTransform3D>
|
---|
104 | <RotateTransform3D.Rotation>
|
---|
105 | <AxisAngleRotation3D x:Name="rotateY" Axis="1 0 0"/>
|
---|
106 | </RotateTransform3D.Rotation>
|
---|
107 | </RotateTransform3D>
|
---|
108 | <TranslateTransform3D OffsetX="0.5" OffsetY="0.5" OffsetZ="0.5" />
|
---|
109 | <ScaleTransform3D x:Name="scaleZoom" CenterX="0.5" CenterY="0.5" CenterZ="0.5" ScaleX="1" ScaleY="1" ScaleZ="1"/>
|
---|
110 | </Transform3DGroup>
|
---|
111 | </ModelVisual3D.Transform>
|
---|
112 | </ModelVisual3D>
|
---|
113 | </Viewport3D>
|
---|
114 | </Grid>
|
---|
115 | </UserControl>
|
---|