<commit_before>﻿<Window x:Class="ShadowMapDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"      
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"         
        xmlns:sys="clr-namespace:System;assembly=mscorlib" 
        xmlns:sdxm="clr-namespace:SharpDX;assembly=SharpDX.Mathematics" 
        xmlns:hx="http://helix-toolkit.org/wpf/SharpDX"
        xmlns:local="clr-namespace:ShadowMapDemo"
        mc:Ignorable="d"         
        Title="{Binding Title}"
        Height="500" Width="900">
    <Window.Resources>
        <hx:RenderTechniqueConverter x:Key="RenderTechniqueConverter"/>
    </Window.Resources>
    <Window.DataContext>
        <local:MainViewModel/>
    </Window.DataContext>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <!--<RowDefinition Height="Auto"/>-->
        </Grid.RowDefinitions>
        <Menu Grid.Row="0" VerticalAlignment="Top">
            <Menu.Background>
                <SolidColorBrush Opacity="0.5" Color="WhiteSmoke"/>
            </Menu.Background>
            <MenuItem Header="View">
                <MenuItem Header="Zoom extents" Command="hx:ViewportCommands.ZoomExtents"/>
            </MenuItem>
        </Menu>

        <hx:Viewport3DX 
            Grid.Row="1" 
            x:Name="view1" 
            Camera="{Binding Camera}"
            Title="{Binding Title}"
            SubTitle="{Binding SubTitle}"
            TextBrush="Black"                       
            CoordinateSystemLabelForeground="White"
            UseDefaultGestures="False"   ModelUpDirection="0,1,0"
            IsShadowMappingEnabled="True" ShowCoordinateSystem="True"
            RenderTechnique="{Binding RenderTechnique}"
            EffectsManager="{Binding EffectsManager}"
            >
            <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 Gesture="Control+E" Command="hx:ViewportCommands.ZoomExtents"/>
                <MouseBinding Gesture="RightClick" Command="hx:ViewportCommands.Rotate"/>
                <MouseBinding Gesture="MiddleClick" Command="hx:ViewportCommands.Zoom"/>
                <MouseBinding Gesture="Shift+RightClick" Command="hx:ViewportCommands.Pan"/>
            </hx:Viewport3DX.InputBindings>
            
            <hx:AmbientLight3D Color="#717171"/>
            <hx:SpotLight3D x:Name="spotLight" Direction="{Binding Camera1.LookDirection, Mode=OneWay}" Range="{Binding Camera1.FarPlaneDistance}" OuterAngle="{Binding Camera1.FieldOfView}"
                            Position="{Binding Camera1.Position, Mode=OneWay}"
                            Color="{Binding DirectionalLightColor}"/>
            <!--<hx:DirectionalLight3D Color="#646464" Direction="0,-1,0"/>-->
            <hx:ShadowMap3D x:Name="shadowMap" Resolution="{Binding ShadowMapResolution}" LightCamera="{Binding Camera1}"/>
            <hx:CameraModel3D x:Name="lightCamera" Camera="{Binding Camera1}"/>
            <hx:UICompositeManipulator3D  CanRotateX="true" CanRotateY="true" CanRotateZ="true"                                                                                    
                                          CanTranslateX="False" CanTranslateY="False" CanTranslateZ="False"
                                          Diameter="2"                                                                                                
                                          TargetTransform="{Binding Transform,ElementName=lightCamera}"/>
            <hx:MeshGeometryModel3D x:Name="model1" CullMode="Back" IsThrowingShadow="True" Geometry="{Binding Model}" Transform="{Binding Model1Transform}" Material="{Binding RedMaterial}"  />
            <hx:MeshGeometryModel3D x:Name="model2" CullMode="Back" IsThrowingShadow="True"  Geometry="{Binding Model}" Transform="{Binding Model2Transform}" Material="{Binding GreenMaterial}" Instances="{Binding Instances}"/>
            <hx:MeshGeometryModel3D x:Name="model3" CullMode="Back" IsThrowingShadow="True"  Geometry="{Binding Model}" Transform="{Binding Model3Transform}" Material="{Binding BlueMaterial}" />
            <hx:MeshGeometryModel3D x:Name="plane" CullMode="Back"  IsThrowingShadow="false"  Geometry="{Binding Plane}" Transform="{Binding PlaneTransform}"  Material="{Binding GrayMaterial}" />
            <hx:LineGeometryModel3D x:Name="lines" IsThrowingShadow="True"   Geometry="{Binding Lines}" Transform="{Binding Model1Transform}" Color="Black"/>
            <hx:LineGeometryModel3D x:Name="grid"  IsThrowingShadow="True"   Geometry="{Binding Grid}"  Transform="{Binding GridTransform}"   Color="{Binding GridColor}"/>
        </hx:Viewport3DX>
        
        <StackPanel Grid.Row="1" >
            <Expander Header="Render Technique" x:Name="shadingPanel" HorizontalAlignment="Right" Width="150" VerticalAlignment="Top" BorderBrush="LightGray" IsExpanded="True" Margin="10">
                <Expander.Background>
                    <SolidColorBrush Opacity="0.25" Color="WhiteSmoke"/>
                </Expander.Background>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="23*"/>
                        <ColumnDefinition Width="51*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <ComboBox  Grid.Row="0" 
                               IsReadOnly="True" 
                               Margin="3" 
                               Grid.ColumnSpan="2"
                               DisplayMemberPath="Key" 
                               SelectedValuePath="Value" 
                               ItemsSource="{Binding RenderTechniquesManager.RenderTechniques}" 
                               SelectedItem="{Binding RenderTechnique, Converter={StaticResource RenderTechniqueConverter}}" 
                               SelectedValue="{Binding RenderTechnique, Converter={StaticResource RenderTechniqueConverter}}"/>
                </Grid>
            </Expander>
            <Expander Header="Shadows" HorizontalAlignment="Right" Width="150" VerticalAlignment="Top" BorderBrush="LightGray" IsExpanded="True" Margin="10">
                <Expander.Background>
                    <SolidColorBrush Opacity="0.25" Color="WhiteSmoke"/>
                </Expander.Background>
                <StackPanel Orientation="Vertical">
                    <CheckBox IsChecked="{Binding IsThrowingShadow, ElementName=model1}" Margin="3">Model 1</CheckBox>
                    <CheckBox IsChecked="{Binding IsThrowingShadow, ElementName=model2}" Margin="3">Model 2</CheckBox>
                    <CheckBox IsChecked="{Binding IsThrowingShadow, ElementName=model3}" Margin="3">Model 3</CheckBox>
                    <CheckBox IsChecked="{Binding IsThrowingShadow, ElementName=lines}" Margin="3">Bounding Box</CheckBox>
                    <Separator></Separator>
                    <CheckBox IsChecked="{Binding IsShadowMappingEnabled, ElementName=view1}" Margin="3">Shadow Mapping</CheckBox>
                    <StackPanel Orientation="Horizontal" IsEnabled="{Binding IsRendering, ElementName=shadowMap}" Margin="0">
                        <TextBlock Margin="3">Int:</TextBlock>
                        <Slider x:Name="sliderInt" Width="70" Value="{Binding Intensity, ElementName=shadowMap}" Minimum="0" Maximum="1" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Value, ElementName=sliderInt}"></TextBox>
                    </StackPanel>
                    <StackPanel  Orientation="Horizontal" IsEnabled="{Binding IsRendering, ElementName=shadowMap}" Margin="0">
                        <TextBlock Margin="3">Bias:</TextBlock>
                        <Slider x:Name="sliderBias" Width="70" Value="{Binding Bias, ElementName=shadowMap}" Minimum="0.00001" Maximum="0.002" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Value, ElementName=sliderBias}"></TextBox>
                    </StackPanel>
                </StackPanel>
            </Expander>
            <Expander Header="Spot Light" HorizontalAlignment="Right" Width="200" VerticalAlignment="Top" BorderBrush="LightGray" IsExpanded="True" Margin="10">
                <Expander.Background>
                    <SolidColorBrush Opacity="0.25" Color="WhiteSmoke"/>
                </Expander.Background>
                <StackPanel Orientation="Vertical">
                    <StackPanel  Orientation="Horizontal" Margin="0">
                        <TextBlock Margin="3">Fall off:</TextBlock>
                        <Slider Width="70" Value="{Binding Falloff, ElementName=spotLight}" Minimum="0.1" Maximum="5" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Falloff, ElementName=spotLight}"></TextBox>
                    </StackPanel>
                    <StackPanel  Orientation="Horizontal" Margin="0">
                        <TextBlock Margin="3">Outer Angle:</TextBlock>
                        <Slider Width="70" Value="{Binding OuterAngle, ElementName=spotLight}" Minimum="15" Maximum="90" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Falloff, ElementName=spotLight}"></TextBox>
                    </StackPanel>
                    <StackPanel  Orientation="Horizontal" Margin="0">
                        <TextBlock Margin="3">Inner Angle:</TextBlock>
                        <Slider Width="70" Value="{Binding InnerAngle, ElementName=spotLight}" Minimum="0" Maximum="75" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Falloff, ElementName=spotLight}"></TextBox>
                    </StackPanel>
                    <StackPanel  Orientation="Horizontal" Margin="0">
                        <TextBlock Margin="3">Range:</TextBlock>
                        <Slider Width="70" Value="{Binding Range, ElementName=spotLight}" Minimum="1" Maximum="500" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Range, ElementName=spotLight}"></TextBox>
                    </StackPanel>
                </StackPanel>
            </Expander>
            <Button HorizontalAlignment="Right" Click="Button_Click">MultiViewports</Button>
        </StackPanel>
                
        <StatusBar Grid.Row="1" VerticalAlignment="Bottom">
            <StatusBar.Background>
                <SolidColorBrush Opacity="0.5" Color="WhiteSmoke"/>
            </StatusBar.Background>
            <StatusBarItem>
                <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="{Binding FpsCounter.Value, ElementName=view1, StringFormat=D3D11 - \{0:0.00\} FPS}"/>
            </StatusBarItem><commit_msg>Demo update<commit_after>﻿<Window x:Class="ShadowMapDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"      
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"         
        xmlns:sys="clr-namespace:System;assembly=mscorlib" 
        xmlns:sdxm="clr-namespace:SharpDX;assembly=SharpDX.Mathematics" 
        xmlns:hx="http://helix-toolkit.org/wpf/SharpDX"
        xmlns:local="clr-namespace:ShadowMapDemo"
        mc:Ignorable="d"         
        Title="{Binding Title}"
        Height="500" Width="900">
    <Window.Resources>
        <hx:RenderTechniqueConverter x:Key="RenderTechniqueConverter"/>
    </Window.Resources>
    <Window.DataContext>
        <local:MainViewModel/>
    </Window.DataContext>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Menu Grid.Row="0" VerticalAlignment="Top">
            <Menu.Background>
                <SolidColorBrush Opacity="0.5" Color="WhiteSmoke"/>
            </Menu.Background>
            <MenuItem Header="View">
                <MenuItem Header="Zoom extents" Command="hx:ViewportCommands.ZoomExtents"/>
            </MenuItem>
        </Menu>

        <hx:Viewport3DX 
            Grid.Row="1" Grid.Column="0"
            x:Name="view1" 
            Camera="{Binding Camera}"
            Title="{Binding Title}"
            SubTitle="{Binding SubTitle}"
            TextBrush="Black"                       
            CoordinateSystemLabelForeground="#616161"
            UseDefaultGestures="False"   ModelUpDirection="0,1,0"
            IsShadowMappingEnabled="True" ShowCoordinateSystem="True"
            RenderTechnique="{Binding RenderTechnique}"
            EffectsManager="{Binding EffectsManager}"
            >
            <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 Gesture="Control+E" Command="hx:ViewportCommands.ZoomExtents"/>
                <MouseBinding Gesture="RightClick" Command="hx:ViewportCommands.Rotate"/>
                <MouseBinding Gesture="MiddleClick" Command="hx:ViewportCommands.Zoom"/>
                <MouseBinding Gesture="Shift+LeftClick" Command="hx:ViewportCommands.Pan"/>
            </hx:Viewport3DX.InputBindings>
            
            <hx:AmbientLight3D Color="#717171"/>
            <hx:SpotLight3D x:Name="spotLight" Direction="{Binding Camera1.LookDirection, Mode=OneWay}" Range="{Binding Camera1.FarPlaneDistance}" OuterAngle="{Binding Camera1.FieldOfView}"
                            Position="{Binding Camera1.Position, Mode=OneWay}"
                            Color="{Binding DirectionalLightColor}"/>
            <!--<hx:DirectionalLight3D Color="#646464" Direction="0,-1,0"/>-->
            <hx:ShadowMap3D x:Name="shadowMap" Resolution="{Binding ShadowMapResolution}" LightCamera="{Binding Camera1}"/>
            <hx:CameraModel3D x:Name="lightCamera" Camera="{Binding Camera1}"/>
            <hx:UICompositeManipulator3D  CanRotateX="true" CanRotateY="true" CanRotateZ="true"                                                                                    
                                          CanTranslateX="False" CanTranslateY="False" CanTranslateZ="False"
                                          Diameter="2"                                                                                                
                                          TargetTransform="{Binding Transform,ElementName=lightCamera}"/>
            <hx:MeshGeometryModel3D x:Name="model1" CullMode="Back" IsThrowingShadow="True" Geometry="{Binding Model}" Transform="{Binding Model1Transform}" Material="{Binding RedMaterial}"  />
            <hx:MeshGeometryModel3D x:Name="model2" CullMode="Back" IsThrowingShadow="True"  Geometry="{Binding Model}" Transform="{Binding Model2Transform}" Material="{Binding GreenMaterial}" Instances="{Binding Instances}"/>
            <hx:MeshGeometryModel3D x:Name="model3" CullMode="Back" IsThrowingShadow="True"  Geometry="{Binding Model}" Transform="{Binding Model3Transform}" Material="{Binding BlueMaterial}" />
            <hx:MeshGeometryModel3D x:Name="plane" CullMode="Back"  IsThrowingShadow="false"  Geometry="{Binding Plane}" Transform="{Binding PlaneTransform}"  Material="{Binding GrayMaterial}" />
            <hx:LineGeometryModel3D x:Name="lines" IsThrowingShadow="True"   Geometry="{Binding Lines}" Transform="{Binding Model1Transform}" Color="Black"/>
            <hx:LineGeometryModel3D x:Name="grid"  IsThrowingShadow="True"   Geometry="{Binding Grid}"  Transform="{Binding GridTransform}"   Color="{Binding GridColor}"/>
        </hx:Viewport3DX>
        
        <StackPanel Grid.Row="1" Grid.Column="1">
            <Expander Header="Render Technique" x:Name="shadingPanel" HorizontalAlignment="Right" Width="150" VerticalAlignment="Top" BorderBrush="LightGray" IsExpanded="True" Margin="10">
                <Expander.Background>
                    <SolidColorBrush Opacity="0.25" Color="WhiteSmoke"/>
                </Expander.Background>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="23*"/>
                        <ColumnDefinition Width="51*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <ComboBox  Grid.Row="0" 
                               IsReadOnly="True" 
                               Margin="3" 
                               Grid.ColumnSpan="2"
                               DisplayMemberPath="Key" 
                               SelectedValuePath="Value" 
                               ItemsSource="{Binding RenderTechniquesManager.RenderTechniques}" 
                               SelectedItem="{Binding RenderTechnique, Converter={StaticResource RenderTechniqueConverter}}" 
                               SelectedValue="{Binding RenderTechnique, Converter={StaticResource RenderTechniqueConverter}}"/>
                </Grid>
            </Expander>
            <Expander Header="Shadows" HorizontalAlignment="Right" Width="150" VerticalAlignment="Top" BorderBrush="LightGray" IsExpanded="True" Margin="10">
                <Expander.Background>
                    <SolidColorBrush Opacity="0.25" Color="WhiteSmoke"/>
                </Expander.Background>
                <StackPanel Orientation="Vertical">
                    <CheckBox IsChecked="{Binding IsThrowingShadow, ElementName=model1}" Margin="3">Model 1</CheckBox>
                    <CheckBox IsChecked="{Binding IsThrowingShadow, ElementName=model2}" Margin="3">Model 2</CheckBox>
                    <CheckBox IsChecked="{Binding IsThrowingShadow, ElementName=model3}" Margin="3">Model 3</CheckBox>
                    <CheckBox IsChecked="{Binding IsThrowingShadow, ElementName=lines}" Margin="3">Bounding Box</CheckBox>
                    <Separator></Separator>
                    <CheckBox IsChecked="{Binding IsShadowMappingEnabled, ElementName=view1}" Margin="3">Shadow Mapping</CheckBox>
                    <StackPanel Orientation="Horizontal" IsEnabled="{Binding IsRendering, ElementName=shadowMap}" Margin="0">
                        <TextBlock Margin="3">Int:</TextBlock>
                        <Slider x:Name="sliderInt" Width="70" Value="{Binding Intensity, ElementName=shadowMap}" Minimum="0" Maximum="1" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Value, ElementName=sliderInt}"></TextBox>
                    </StackPanel>
                    <StackPanel  Orientation="Horizontal" IsEnabled="{Binding IsRendering, ElementName=shadowMap}" Margin="0">
                        <TextBlock Margin="3">Bias:</TextBlock>
                        <Slider x:Name="sliderBias" Width="70" Value="{Binding Bias, ElementName=shadowMap}" Minimum="0.00001" Maximum="0.002" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Value, ElementName=sliderBias}"></TextBox>
                    </StackPanel>
                </StackPanel>
            </Expander>
            <Expander Header="Spot Light" HorizontalAlignment="Right" Width="200" VerticalAlignment="Top" BorderBrush="LightGray" IsExpanded="True" Margin="10">
                <Expander.Background>
                    <SolidColorBrush Opacity="0.25" Color="WhiteSmoke"/>
                </Expander.Background>
                <StackPanel Orientation="Vertical">
                    <StackPanel  Orientation="Horizontal" Margin="0">
                        <TextBlock Margin="3">Fall off:</TextBlock>
                        <Slider Width="70" Value="{Binding Falloff, ElementName=spotLight}" Minimum="0.1" Maximum="5" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Falloff, ElementName=spotLight}"></TextBox>
                    </StackPanel>
                    <StackPanel  Orientation="Horizontal" Margin="0">
                        <TextBlock Margin="3">Outer Angle:</TextBlock>
                        <Slider Width="70" Value="{Binding OuterAngle, ElementName=spotLight}" Minimum="15" Maximum="90" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Falloff, ElementName=spotLight}"></TextBox>
                    </StackPanel>
                    <StackPanel  Orientation="Horizontal" Margin="0">
                        <TextBlock Margin="3">Inner Angle:</TextBlock>
                        <Slider Width="70" Value="{Binding InnerAngle, ElementName=spotLight}" Minimum="0" Maximum="75" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Falloff, ElementName=spotLight}"></TextBox>
                    </StackPanel>
                    <StackPanel  Orientation="Horizontal" Margin="0">
                        <TextBlock Margin="3">Range:</TextBlock>
                        <Slider Width="70" Value="{Binding Range, ElementName=spotLight}" Minimum="1" Maximum="500" Margin="3"/>
                        <TextBox Margin="3" Width="35" Text="{Binding Range, ElementName=spotLight}"></TextBox>
                    </StackPanel>
                </StackPanel>
            </Expander>
            <Button HorizontalAlignment="Right" Click="Button_Click">MultiViewports</Button>
        </StackPanel>
                
        <StatusBar Grid.Row="2" VerticalAlignment="Bottom">
            <StatusBar.Background>
                <SolidColorBrush Opacity="0.5" Color="WhiteSmoke"/>
            </StatusBar.Background>
            <StatusBarItem>
                <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="{Binding FpsCounter.Value, ElementName=view1, StringFormat=D3D11 - \{0:0.00\} FPS}"/>
            </StatusBarItem>
{'fraction_non_alphanumeric': 0.12840938609403413, 'fraction_numerical': 0.018010217334834183, 'mean_word_length': 2.220270458664436, 'pattern_counts': {'":': 0, '<': 292, '<?xml version=': 0, '>': 292, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 18}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6813085', 'n_tokens_mistral': 6373, 'n_tokens_neox': 5708, 'n_words': 932}