Skip to content

Commit

Permalink
Merge pull request #1863 from helix-toolkit/release/2.23.0
Browse files Browse the repository at this point in the history
Release/2.23.0
  • Loading branch information
holance committed Nov 28, 2022
2 parents a5905f9 + d3f469d commit 5f2fea2
Show file tree
Hide file tree
Showing 50 changed files with 584 additions and 171 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Change Log
All notable changes to this project will be documented in this file.

## Next Release

### Added
1. Add feature of enabling rotation/translation/scale control in every axis for TransformManipulator3D (WPF.SharpDX/UWP/WinUI)
1. Decouple `HelixToolkit.Wpf` and `HelixToolkit.Core.Wpf` packages from `HelixToolkit` core library. `HelixToolkit` package will no longer be a dependency for both `HelixToolkit.Wpf` and `HelixToolkit.Core.Wpf`. (WPF)

### Improvement
1. Automatic invert up direction for rotation mode = turntable (WPF.SharpDX/UWP/Core/WinUI)
1. Improve swapchain framerate under SharpDX.WPF (WPF.SharpDX)
1. Adds function to invalidate bone matrices/morph target weights manually (WPF.SharpDX/UWP/Core/WinUI)

### Fixed
1. Fix models are not rendered by adding them directly into viewport3DX.Items. (WPF.SharpDX)
1. Correct y axis color typo (WPF.SharpDX/UWP/Core/WinUI)
1. Fix potential null ref exception in HelixToolkit.WinUI. (WinUI)
1. Fix null reference exception in GeometryRenderCore.OnAttachBuffers(). (WPF.SharpDX/UWP/Core/WinUI)
1. Fix shadow map light camera property update does not trigger re-rendering. (WPF.SharpDX/UWP/Core/WinUI)

## [2.22.0]

### Improvement
Expand Down
59 changes: 34 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,29 @@ FXAA, Order Independant Transparent Rendering, Particle system, Tessellation.

#### 4. [Wiki](https://github.com/helix-toolkit/helix-toolkit/wiki) and useful [External Resources](https://github.com/helix-toolkit/helix-toolkit/wiki/External-References) on Computer Graphics.

## HelixToolkit Library Relationship
- HelixToolkit
- .NET WPF
- HelixToolkit.WPF
- SharpDX DX11 Engine
- .NET WPF
- HelixToolkit.WPF.SharpDX
- UWP
- Helixtoolkit.UWP
- .NET CORE
- HelixToolkit.SharpDX.Core
- HelixToolkit.SharpDX.Core.Wpf
- HelixToolkit.WinUI
- HelixToolkit.Assimp
## HelixToolkit Library Structure

### WPF Internal 3D Engine (DirectX9)

```mermaid
graph TD
wpf[WPF Framework] --> hxWpf[HelixToolkit.Wpf]
wpf --> hxCoreWpf[HelixToolkit.Core.Wpf]
```
### HelixToolkit DirectX11 Engine

```mermaid
graph TD
hx[HelixToolkit] --> dx11[DirectX11 Engine]
dx11 --> hxSharpDX[HelixToolkit.Wpf.SharpDX]
dx11 --> hxUWP[HelixToolkit.UWP]
dx11 --> hxCore[HelixToolkit.SharpDX.Core]
hxCore --> hxWinUI[HelixToolkit.SharpDX.Core.Wpf]
hxCore --> hxSharpDXCoreWpf[HelixToolkit.WinUI]
hxSharpDX --> hxAssimp[HelixToolkit.SharpDX.Assimp]
hxUWP --> hxAssimp
hxCore --> hxAssimp
```

## Bug Report
Please use the following template to report bugs.
Expand All @@ -94,16 +103,16 @@ Please use the following template to report bugs.
- Sample Code:

## News
#### 2022-06-18
[v2.21.1](https://github.com/helix-toolkit/helix-toolkit/releases/tag/v2.21.1) releases are available on nuget. [Release Note](/CHANGELOG.md)
- [WPF](https://www.nuget.org/packages/HelixToolkit.Wpf/2.21.1)
- [Core.WPF](https://www.nuget.org/packages/HelixToolkit.Core.Wpf/2.21.1)
- [WPF.Input](https://www.nuget.org/packages/HelixToolkit.Wpf.Input/2.21.1)
- [WPF.SharpDX](https://www.nuget.org/packages/HelixToolkit.Wpf.SharpDX/2.21.1)
- [UWP](https://www.nuget.org/packages/HelixToolkit.UWP/2.21.1)
- [SharpDX.Core](https://www.nuget.org/packages/HelixToolkit.SharpDX.Core/2.21.1)
- [SharpDX.Core.Wpf](https://www.nuget.org/packages/HelixToolkit.SharpDX.Core.Wpf/2.21.1)
- [WinUI](https://www.nuget.org/packages/HelixToolkit.WinUI/2.21.1)
- [SharpDX.Assimp](https://www.nuget.org/packages/HelixToolkit.SharpDX.Assimp/2.21.1)
#### 2022-08-29
[v2.22.0](https://github.com/helix-toolkit/helix-toolkit/releases/tag/v2.22.0) releases are available on nuget. [Release Note](/CHANGELOG.md)
- [WPF](https://www.nuget.org/packages/HelixToolkit.Wpf/2.22.0)
- [Core.WPF](https://www.nuget.org/packages/HelixToolkit.Core.Wpf/2.22.0)
- [WPF.Input](https://www.nuget.org/packages/HelixToolkit.Wpf.Input/2.22.0)
- [WPF.SharpDX](https://www.nuget.org/packages/HelixToolkit.Wpf.SharpDX/2.22.0)
- [UWP](https://www.nuget.org/packages/HelixToolkit.UWP/2.22.0)
- [SharpDX.Core](https://www.nuget.org/packages/HelixToolkit.SharpDX.Core/2.22.0)
- [SharpDX.Core.Wpf](https://www.nuget.org/packages/HelixToolkit.SharpDX.Core.Wpf/2.22.0)
- [WinUI](https://www.nuget.org/packages/HelixToolkit.WinUI/2.22.0)
- [SharpDX.Assimp](https://www.nuget.org/packages/HelixToolkit.SharpDX.Assimp/2.22.0)

#### Changes (Please refer to [Release Note](https://github.com/helix-toolkit/helix-toolkit/blob/master/CHANGELOG.md) for details)
2 changes: 2 additions & 0 deletions Source/Examples/WPF.SharpDX/BoneSkinDemo/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public string SelectedAnimation
reset = true;
var curr = scene.Animations.Where(x => x.Name == value).FirstOrDefault();
animationUpdater = new NodeAnimationUpdater(curr);
animationUpdater.RepeatMode = selectedRepeatMode;
}
}
get { return selectedAnimation; }
Expand All @@ -101,6 +102,7 @@ public AnimationRepeatMode SelectedRepeatMode
if(SetValue(ref selectedRepeatMode, value))
{
reset = true;
if (animationUpdater != null) animationUpdater.RepeatMode = value;
}
}
get { return selectedRepeatMode; }
Expand Down
4 changes: 0 additions & 4 deletions Source/Examples/WPF/ExampleBrowser/ExampleBrowser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1060,10 +1060,6 @@
<Project>{3F3B4548-A9DB-4874-86F7-E7C4FEC8A351}</Project>
<Name>HelixToolkit.Wpf</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\HelixToolkit\HelixToolkit.csproj">
<Project>{7c0e987e-cc34-4b19-ba6b-b381aeabb530}</Project>
<Name>HelixToolkit</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NAudio">
Expand Down
4 changes: 0 additions & 4 deletions Source/Examples/WPF/SimpleDemo/SimpleDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@
<Project>{3F3B4548-A9DB-4874-86F7-E7C4FEC8A351}</Project>
<Name>HelixToolkit.Wpf</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\HelixToolkit\HelixToolkit.csproj">
<Project>{7c0e987e-cc34-4b19-ba6b-b381aeabb530}</Project>
<Name>HelixToolkit</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
Expand Down
4 changes: 0 additions & 4 deletions Source/Examples/WPF/SurfaceDemo/SurfaceDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,6 @@
<Project>{3F3B4548-A9DB-4874-86F7-E7C4FEC8A351}</Project>
<Name>HelixToolkit.Wpf</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\HelixToolkit\HelixToolkit.csproj">
<Project>{7c0e987e-cc34-4b19-ba6b-b381aeabb530}</Project>
<Name>HelixToolkit</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
4 changes: 2 additions & 2 deletions Source/Examples/WinUI/ModelViewer/ModelViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.4" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.8" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.5" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task<string> StartFilePicker(string[] filters)
picker.FileTypeFilter.Add(filter);
}
return await picker.PickSingleFileAsync().AsTask().ContinueWith((result) => {
return result is null ? string.Empty : result.Result.Path;
return result is null || result.Result is null ? string.Empty : result.Result.Path;
});
}
}
3 changes: 0 additions & 3 deletions Source/HelixToolkit.Core.Wpf.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
<description>Provides custom controls and extensions for .net core WPF 3D.</description>
<tags>wpf wpf3d 3D netcore</tags>
<dependencies>
<group targetFramework="netcoreapp3.1">
<dependency id="HelixToolkit" version="[$version$]" />
</group>
</dependencies>
</metadata>
<files>
Expand Down
2 changes: 1 addition & 1 deletion Source/HelixToolkit.Shared/Geometry/MeshBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3771,7 +3771,7 @@ public void AddTube(IList<Point3D> path, double diameter, int thetaDiv, bool isT

this.AddRectangularMeshTriangleIndices(index0, pathLength, sectionLength, isSectionClosed, isTubeClosed);

if (frontCap || backCap && path.Count > 1)
if (frontCap || backCap)
{
var normals = new Vector3D[section.Count];
var fanTextures = new Point[section.Count];
Expand Down
1 change: 1 addition & 0 deletions Source/HelixToolkit.Shared/HelixToolkit.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Helper\ContourHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\DoubleKeyDictionary.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\MathHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StringExtensions.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace HelixToolkit
#if SHARPDX
#if !NETFX_CORE
namespace HelixToolkit.Wpf.SharpDX
#else
#if CORE
namespace HelixToolkit.SharpDX.Core
#else
namespace HelixToolkit.UWP
#endif
#endif
#else
namespace HelixToolkit.Wpf
#endif
{
using System.Collections;
using System.Text;
Expand All @@ -21,7 +33,7 @@ public static class StringExtensions
/// <summary>
/// A regular expression containing "a one or more whitespaces" pattern.
/// </summary>
private static Regex oneOrMoreWhitespaces = new Regex(@"\s+");
private static readonly Regex oneOrMoreWhitespaces = new Regex(@"\s+");

/// <summary>
/// Splits the string on whitespace.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
</ItemGroup>
Expand Down
6 changes: 5 additions & 1 deletion Source/HelixToolkit.SharpDX.Core/Controls/RotateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public sealed class RotateHandler : MouseGestureHandler
/// The 3D rotation point.
/// </summary>
private Vector3 rotationPoint3D;

private bool invertUpDir = false;

/// <summary>
/// Gets the camera rotation mode.
/// </summary>
Expand Down Expand Up @@ -121,7 +124,7 @@ public void Rotate(Vector2 p0, Vector2 p1, Vector3 rotateAround, bool stopOther
case CameraRotationMode.Turntable:
var p = p1 - p0;
CameraMath.RotateTurntable(CameraMode, ref p, ref rotateAround, (float)RotationSensitivity,
Controller.Width, Controller.Height, Camera, inv, ModelUpDirection, out newPos, out newLook, out newUp);
Controller.Width, Controller.Height, Camera, inv, invertUpDir ? -ModelUpDirection : ModelUpDirection, out newPos, out newLook, out newUp);
break;
case CameraRotationMode.Turnball:
CameraMath.RotateTurnball(CameraMode, ref p0, ref p1, ref rotateAround, (float)RotationSensitivity,
Expand All @@ -143,6 +146,7 @@ protected override void Started(Vector2 e)
this.rotationPoint = new Vector2(
this.Controller.Width / 2, this.Controller.Height / 2);
this.rotationPoint3D = this.Camera.Target;
invertUpDir = Vector3.Dot(Controller.CameraUpDirection, ModelUpDirection) < 0;

switch (this.CameraMode)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ protected void OnBindRasterState(DeviceContextProxy context, bool isInvertCullMo
/// <param name="vertStartSlot"></param>
protected virtual bool OnAttachBuffers(DeviceContextProxy context, ref int vertStartSlot)
{
if (GeometryBuffer.AttachBuffers(context, ref vertStartSlot, EffectTechnique.EffectsManager))
if (GeometryBuffer != null && EffectTechnique != null &&
GeometryBuffer.AttachBuffers(context, ref vertStartSlot, EffectTechnique.EffectsManager))
{
InstanceBuffer.AttachBuffer(context, ref vertStartSlot);
return true;
Expand Down
10 changes: 10 additions & 0 deletions Source/HelixToolkit.SharpDX.Shared/Core/BoneSkinRenderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ public void SetWeight(int i, float w)
mtChanged = true;
internalMTBuffer.SetWeight(i, w);
}

public void InvalidateBoneMatrices()
{
matricsChanged = true;
}

public void InvalidateMorphTargetWeights()
{
mtChanged = true;
}
}
}
}
13 changes: 9 additions & 4 deletions Source/HelixToolkit.SharpDX.Shared/Core/BoneUploaderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public sealed class BoneUploaderCore : RenderCore
{
public event EventHandler BoneChanged;
private static readonly Matrix[] empty = new Matrix[0];
private bool matricsChanged = true;
private bool matricesChanged = true;
private Matrix[] boneMatrices = empty;
public Matrix[] BoneMatrices
{
set
{
if (SetAffectsRender(ref boneMatrices, value))
{
matricsChanged = true;
matricesChanged = true;
if (value == null)
{
boneMatrices = empty;
Expand Down Expand Up @@ -60,10 +60,10 @@ public override void Render(RenderContext context, DeviceContextProxy deviceCont

protected override void OnUpdate(RenderContext context, DeviceContextProxy deviceContext)
{
if (matricsChanged && BoneSkinSB != null)
if (matricesChanged && BoneSkinSB != null)
{
BoneSkinSB.UploadDataToBuffer(deviceContext, boneMatrices, boneMatrices.Length);
matricsChanged = false;
matricesChanged = false;
}
}

Expand All @@ -84,6 +84,11 @@ public void BindBuffer(DeviceContextProxy deviceContext, int slot)
{
deviceContext.SetShaderResource(VertexShader.Type, slot, BoneSkinSB);
}
}

public void InvalidateBoneMatrices()
{
matricesChanged = true;
}

protected override void OnDispose(bool disposeManagedResources)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static Vector3 FindAnyPerpendicular(this Vector3 n)
u = Vector3.Cross(new Vector3(1, 0, 0), n);
}

return u;
return u.Normalized();
}

/// <summary>
Expand All @@ -147,7 +147,7 @@ public static Vector3 FindAnyPerpendicular(this Vector3 n)
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsUndefined(this Vector3 v)
{
return float.IsNaN(v.X) && float.IsNaN(v.Y) && float.IsNaN(v.Z);
return float.IsNaN(v.X) || float.IsNaN(v.Y) || float.IsNaN(v.Z);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@
<Compile Include="$(MSBuildThisFileDirectory)Render\RenderHost\DX11RenderHostConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utilities\DepthStencilFormatHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utilities\StringHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Viewport\ViewportCore.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Viewport\ViewportCoreProperties.cs" />
<Compile Include="..\HelixToolkit.SharpDX.Shared\ShaderManager\StructArrayPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ShaderManager\MaterialVariablePool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ShaderManager\TextureResourceManager.cs" />
Expand Down
6 changes: 5 additions & 1 deletion Source/HelixToolkit.SharpDX.Shared/Interface/IRenderHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ FastList<SceneNode> PerFrameTransparentNodes
/// <summary>
/// Updates the and render.
/// </summary>
void UpdateAndRender();
bool UpdateAndRender();
/// <summary>
/// Invalidates the render.
/// </summary>
Expand Down Expand Up @@ -465,6 +465,10 @@ DX11RenderBufferProxyBase RenderBuffer
/// </summary>
event EventHandler SceneGraphUpdated;
/// <summary>
/// Occurs when effects manager is changed.
/// </summary>
event EventHandler<IEffectsManager> EffectsManagerChanged;
/// <summary>
/// Clears the render target.
/// </summary>
/// <param name="context">The context.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public void Update(long timeStamp, long frequency)
{
case AnimationRepeatMode.PlayOnce:
UpdateBoneSkinMesh();
isStartFrame = false;
SetToStart();
return;
case AnimationRepeatMode.PlayOnceHold:
Expand Down
Loading

0 comments on commit 5f2fea2

Please sign in to comment.