forked from helix-toolkit/helix-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
136 lines (134 loc) · 6.41 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<Window
x:Class="FileLoadDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hx="http://helix-toolkit.org/wpf/SharpDX"
Title="FileLoadDemo"
Width="1000"
Height="800">
<Grid>
<Grid.Resources>
<BooleanToVisibilityConverter x:Key="boolToVisibilityConverter" />
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<hx:Viewport3DX
x:Name="view"
Grid.Row="1"
BackgroundColor="#595959"
Camera="{Binding Camera}"
CameraMode="Inspect"
CameraRotationMode="Trackball"
EffectsManager="{Binding EffectsManager}"
FXAALevel="Low">
<hx:Viewport3DX.InputBindings>
<KeyBinding Key="B" Command="hx:ViewportCommands.BackView" />
<KeyBinding Key="F" Command="hx:ViewportCommands.FrontView" />
<KeyBinding Key="U" Command="hx:ViewportCommands.TopView" />
<KeyBinding Key="D" Command="hx:ViewportCommands.BottomView" />
<KeyBinding Key="L" Command="hx:ViewportCommands.LeftView" />
<KeyBinding Key="R" Command="hx:ViewportCommands.RightView" />
<KeyBinding Command="hx:ViewportCommands.ZoomExtents" Gesture="Control+E" />
<MouseBinding Command="hx:ViewportCommands.Rotate" Gesture="RightClick" />
<MouseBinding Command="hx:ViewportCommands.Zoom" Gesture="MiddleClick" />
<MouseBinding Command="hx:ViewportCommands.Pan" Gesture="LeftClick" />
</hx:Viewport3DX.InputBindings>
<hx:AmbientLight3D Color="#363636" />
<hx:DirectionalLight3D Direction="{Binding Camera.LookDirection}" Color="#D6D6D6" />
<hx:EnvironmentMap3D IsRendering="{Binding RenderEnvironmentMap}" Texture="{Binding EnvironmentMap}" />
<hx:Element3DPresenter Content="{Binding GroupModel}" />
<hx:PostEffectMeshBorderHighlight EffectName="highlight" />
</hx:Viewport3DX>
<Grid
Grid.Row="1"
Background="#7B363636"
Visibility="{Binding IsLoading, Converter={StaticResource boolToVisibilityConverter}}">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Vertical">
<TextBlock Foreground="White">Loading Model</TextBlock>
<ProgressBar
Grid.Row="1"
Width="200"
Height="30"
IsIndeterminate="True" />
</StackPanel>
</Grid>
<Menu
Grid.Row="0"
Height="20"
VerticalAlignment="Top">
<MenuItem Header="File">
<MenuItem Command="{Binding OpenFileCommand}" Header="Open File" />
<MenuItem Command="{Binding ExportCommand}" Header="Export" />
</MenuItem>
</Menu>
<Grid
Grid.Row="1"
Grid.Column="1"
Width="250"
VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel
Margin="4"
HorizontalAlignment="Stretch"
Orientation="Vertical">
<Button Command="{Binding ResetCameraCommand}">
Reset Camera
</Button>
<Separator />
<CheckBox Margin="4" IsChecked="{Binding ShowWireframe}">Show Wireframe</CheckBox>
<CheckBox Margin="4" IsChecked="{Binding ElementName=view, Path=EnableSSAO}">Enable SSAO</CheckBox>
<CheckBox Margin="4" IsChecked="{Binding RenderEnvironmentMap}">Render EnvironmentMap</CheckBox>
<CheckBox Margin="4" IsChecked="{Binding RenderFlat}">Flat Shading</CheckBox>
<Separator />
<CheckBox Margin="4" IsChecked="{Binding EnableAnimation}">Enable Animation</CheckBox>
<TextBlock>Animations</TextBlock>
<ComboBox
DisplayMemberPath="Name"
ItemsSource="{Binding Animations}"
SelectedItem="{Binding SelectedAnimation}" />
<Separator />
<TextBlock>Scene Graph</TextBlock>
</StackPanel>
<ScrollViewer Grid.Row="1">
<TreeView ItemsSource="{Binding GroupModel.GroupNode.Items}">
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem">
<Setter Property="IsSelected" Value="{Binding Tag.Selected, Mode=TwoWay}" />
<Setter Property="IsExpanded" Value="{Binding Tag.Expanded, Mode=TwoWay}" />
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Items}">
<TextBlock Text="{Binding Name}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Setters>
<Setter Property="Foreground" Value="Black" />
</Style.Setters>
<Style.Triggers>
<DataTrigger Binding="{Binding IsAnimationNode}" Value="true">
<Setter Property="Foreground" Value="Blue" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</ScrollViewer>
</Grid>
</Grid>
</Window>