Skip to content

Commit

Permalink
Merge pull request #1673 from helix-toolkit/release/2.20.0
Browse files Browse the repository at this point in the history
Release/2.20.0
  • Loading branch information
holance committed Nov 1, 2021
2 parents abb9b75 + 72ca7c0 commit 388c691
Show file tree
Hide file tree
Showing 55 changed files with 951 additions and 230 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log
All notable changes to this project will be documented in this file.

## Next Release
### Added
1. Post effect support in screen spaced group. (WPF.SharpDX/UWP/Core)
1. Supports software rendering as config for effects manager. (WPF.SharpDX/UWP/Core)

## [2.19.0] - 2021-10-11
### Fixed
1. Fix shadow is showing on the back of the object #1649 (WPF.SharpDX/UWP/Core)
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,22 @@ FXAA, Order Independant Transparent Rendering, Particle system, Tessellation.
## Bug Report
Please use the following template to report bugs.

- Version: [Example: 2.18]
- Version: [Example: 2.19]
- Package: [Example: Helixtoolkit.Wpf]
- Issue:
- Reproduce Steps:
- Sample Code:

## News
#### 2021-09-04
[v2.18.0](https://github.com/helix-toolkit/helix-toolkit/releases/tag/v2.18.0) releases are available on nuget. [Release Note](/CHANGELOG.md)
- [WPF](https://www.nuget.org/packages/HelixToolkit.Wpf/2.18.0)
- [Core.WPF](https://www.nuget.org/packages/HelixToolkit.Core.Wpf/2.18.0)
- [WPF.Input](https://www.nuget.org/packages/HelixToolkit.Wpf.Input/2.18.0)
- [WPF.SharpDX](https://www.nuget.org/packages/HelixToolkit.Wpf.SharpDX/2.18.0)
- [UWP](https://www.nuget.org/packages/HelixToolkit.UWP/2.18.0)
- [SharpDX.Core](https://www.nuget.org/packages/HelixToolkit.SharpDX.Core/2.18.0)
- [SharpDX.Core.Wpf](https://www.nuget.org/packages/HelixToolkit.SharpDX.Core.Wpf/2.18.0)
- [SharpDX.Assimp](https://www.nuget.org/packages/HelixToolkit.SharpDX.Assimp/2.18.0)
#### 2021-10-11
[v2.19.0](https://github.com/helix-toolkit/helix-toolkit/releases/tag/v2.19.0) releases are available on nuget. [Release Note](/CHANGELOG.md)
- [WPF](https://www.nuget.org/packages/HelixToolkit.Wpf/2.19.0)
- [Core.WPF](https://www.nuget.org/packages/HelixToolkit.Core.Wpf/2.19.0)
- [WPF.Input](https://www.nuget.org/packages/HelixToolkit.Wpf.Input/2.19.0)
- [WPF.SharpDX](https://www.nuget.org/packages/HelixToolkit.Wpf.SharpDX/2.19.0)
- [UWP](https://www.nuget.org/packages/HelixToolkit.UWP/2.19.0)
- [SharpDX.Core](https://www.nuget.org/packages/HelixToolkit.SharpDX.Core/2.19.0)
- [SharpDX.Core.Wpf](https://www.nuget.org/packages/HelixToolkit.SharpDX.Core.Wpf/2.19.0)
- [SharpDX.Assimp](https://www.nuget.org/packages/HelixToolkit.SharpDX.Assimp/2.19.0)

#### Changes (Please refer to [Release Note](https://github.com/helix-toolkit/helix-toolkit/blob/master/CHANGELOG.md) for details)
5 changes: 5 additions & 0 deletions Source/Examples/SharpDX.Core/CoreTest/ImGuiNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ static ImGuiNode()

public event EventHandler UpdatingImGuiUI;

public ImGuiNode()
{
AffectsGlobalVariable = true;
}

protected override RenderCore OnCreateRenderCore()
{
return new ImGuiRenderCore();
Expand Down
9 changes: 9 additions & 0 deletions Source/Examples/SharpDX.Core/DynamicPointsAndLines/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="PointsAndLinesBinding.App"
xmlns="http:https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http:https://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DynamicPointsAndLines"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
11 changes: 11 additions & 0 deletions Source/Examples/SharpDX.Core/DynamicPointsAndLines/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Windows;

namespace DynamicPointsAndLines
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
10 changes: 10 additions & 0 deletions Source/Examples/SharpDX.Core/DynamicPointsAndLines/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\HelixToolkit.SharpDX.Core.Assimp\HelixToolkit.SharpDX.Core.Assimp.csproj" />
<ProjectReference Include="..\..\..\HelixToolkit.SharpDX.Core.Wpf\HelixToolkit.SharpDX.Core.Wpf.csproj" />
</ItemGroup>

</Project>
176 changes: 176 additions & 0 deletions Source/Examples/SharpDX.Core/DynamicPointsAndLines/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="MainViewModel.cs" company="Helix Toolkit">
// Copyright (c) 2021 Helix Toolkit contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using HelixToolkit.Wpf.SharpDX;
using Point3D = System.Windows.Media.Media3D.Point3D;
using Transform3D = System.Windows.Media.Media3D.Transform3D;
using TranslateTransform3D = System.Windows.Media.Media3D.TranslateTransform3D;
using Vector3D = System.Windows.Media.Media3D.Vector3D;
using Color = System.Windows.Media.Color;
using Vector3 = SharpDX.Vector3;
using Colors = System.Windows.Media.Colors;
using System.Collections.Generic;
using System.Diagnostics;
using HelixToolkit.SharpDX.Core;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace DynamicPointsAndLines
{
public class MainViewModel : INotifyPropertyChanged, IDisposable
{
#region INotifyPropertyChanged Support
public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged([CallerMemberName] string info = "") => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(info));

protected bool SetValue<T>(ref T backingField, T value, [CallerMemberName] string propertyName = "")
{
if (object.Equals(backingField, value))
{
return false;
}

backingField = value;
this.OnPropertyChanged(propertyName);
return true;
}
#endregion

#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls

protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
// TODO: dispose managed state (managed objects).
}

// TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
// TODO: set large fields to null.
if (EffectsManager != null)
{
var effectManager = EffectsManager as IDisposable;
Disposer.RemoveAndDispose(ref effectManager);
}
disposedValue = true;
GC.SuppressFinalize(this);
}
}

// TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources.
~MainViewModel()
{
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
Dispose(false);
}

// This code added to correctly implement the disposable pattern.
public void Dispose()
{
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
Dispose(true);
// TODO: uncomment the following line if the finalizer is overridden above.
// GC.SuppressFinalize(this);
}
#endregion

public LineGeometry3D Lines { get; }
public PointGeometry3D Points { get; }
public Transform3D Lines1Transform { get; }
public Transform3D Lines2Transform { get; }
public Transform3D Points1Transform { get; }
public Vector3D DirectionalLightDirection { get; }
public Color DirectionalLightColor { get; }
public Color AmbientLightColor { get; }
public Stopwatch StopWatch { get; }

public IEffectsManager EffectsManager { get; }
public Camera Camera { get; }

private int numberOfPoints;
public int NumberOfPoints
{
get => numberOfPoints;
set
{
StopWatch.Stop();

SetValue(ref numberOfPoints, value);
Lines.Indices = new IntCollection(numberOfPoints * 2);
for (int i = 0; i < numberOfPoints * 2; i++)
{
Lines.Indices.Add(i);
}

StopWatch.Start();
}
}

public MainViewModel()
{
EffectsManager = new DefaultEffectsManager();
Camera = new PerspectiveCamera
{
Position = new Point3D(-90, 0, 95),
LookDirection = new Vector3D(110, 0, -105),
UpDirection = new Vector3D(0, 1, 0)
};

// setup lighting
AmbientLightColor = Colors.DimGray;
DirectionalLightColor = Colors.White;
DirectionalLightDirection = new Vector3D(-2, -5, -2);

// model trafos
Lines1Transform = new TranslateTransform3D(0, 0, 45);
Lines2Transform = new TranslateTransform3D(0, 0, -45);
Points1Transform = new TranslateTransform3D(0, 0, 0);

Lines = new LineGeometry3D { IsDynamic = true };
Points = new PointGeometry3D { IsDynamic = true };

StopWatch = new Stopwatch();
StopWatch.Start();

NumberOfPoints = 900;
}

public void UpdatePoints()
{
if (StopWatch.IsRunning)
{
var vectors = new Vector3Collection(GeneratePoints(NumberOfPoints, StopWatch.ElapsedMilliseconds * 0.003));
Points.Positions = vectors;
Lines.Positions = vectors;
}
}

private static IEnumerable<Vector3> GeneratePoints(int n, double time)
{
const double R = 30;
const double Q = 5;
for (int i = 0; i < n; i++)
{
double t = Math.PI * 2 * i / (n - 1);
double u = (t * 24) + (time * 5);
var pt = new Vector3(
(float)(Math.Cos(t) * (R + (Q * Math.Cos(u)))),
(float)(Math.Sin(t) * (R + (Q * Math.Cos(u)))),
(float)(Q * Math.Sin(u)));
yield return pt;
if (i > 0 && i < n - 1)
{
yield return pt;
}
}
}
}
}
109 changes: 109 additions & 0 deletions Source/Examples/SharpDX.Core/DynamicPointsAndLines/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<Window x:Class="DynamicPointsAndLines.MainWindow"
xmlns="http:https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http:https://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http:https://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http:https://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DynamicPointsAndLines"
xmlns:hx="http:https://helix-toolkit.org/wpf/SharpDX"
Title="DynamicPointsAndLines"
Width="640"
Height="480"
d:DataContext="{d:DesignInstance local:MainViewModel}"
mc:Ignorable="d"
>
<DockPanel>
<DockPanel DockPanel.Dock="Bottom">
<StatusBar VerticalAlignment="Bottom">
<StatusBar.Background>
<SolidColorBrush Opacity="0.5" Color="WhiteSmoke" />
</StatusBar.Background>
<StatusBarItem>
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Top"
Text="{Binding FrameRate, ElementName=view1, StringFormat=D3D11 - \{0:0.00\} FPS}" />
</StatusBarItem>
<Separator />
<StatusBarItem>
<TextBlock Text="{Binding Camera.Position, StringFormat=Position: \{0:0.0\}}" />
</StatusBarItem>
<Separator />
<StatusBarItem>
<TextBlock Text="{Binding Camera.LookDirection, StringFormat=LookDirection: \{0:0.0\}}" />
</StatusBarItem>
<Separator />
<StatusBarItem>
<TextBlock Text="{Binding Camera.UpDirection, StringFormat=UpDirection: \{0:0.0\}}" />
</StatusBarItem>
<Separator />
<StatusBarItem>
<TextBlock Text="{Binding Items.Count, ElementName=view1, StringFormat=Children: \{0\}}" />
</StatusBarItem>
</StatusBar>
</DockPanel>
<DockPanel DockPanel.Dock="Bottom">
<TextBlock Width="80" Margin="2"
DockPanel.Dock="Left"
Text="{Binding NumberOfPoints, StringFormat='N = {0}'}"
TextAlignment="Center"
/>
<Slider Margin="2" LargeChange="100"
Maximum="10000" Minimum="75"
SmallChange="1"
Value="{Binding NumberOfPoints}"
/>
</DockPanel>
<hx:Viewport3DX
x:Name="view1"
Camera="{Binding Camera}"
EffectsManager="{Binding EffectsManager}"
Title="Dynamic Points and Lines"
SubTitle="change number of points and check FPS"
ShowCoordinateSystem="True"
CoordinateSystemLabelForeground="OrangeRed"
TextBrush="Black"
UseDefaultGestures="False">
<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="{Binding AmbientLightColor}" />
<hx:DirectionalLight3D Direction="{Binding DirectionalLightDirection}" Color="{Binding DirectionalLightColor}" />

<hx:LineGeometryModel3D
Geometry="{Binding Lines}"
Transform="{Binding Lines1Transform}"
FixedSize="True"
IsRendering="True"
Smoothness="1.0"
Thickness="1.0"
Color="Green" />

<hx:LineGeometryModel3D
Geometry="{Binding Lines}"
Transform="{Binding Lines2Transform}"
FixedSize="False"
IsRendering="True"
Smoothness="1.0"
Thickness="0.2"
Color="Blue" />

<hx:PointGeometryModel3D
Geometry="{Binding Points}"
Transform="{Binding Points1Transform}"
IsRendering="True"
FixedSize="True"
Size="5.5, 1.5"
Color="Red" />

</hx:Viewport3DX>
</DockPanel>
</Window>
Loading

0 comments on commit 388c691

Please sign in to comment.