Skip to content

Commit

Permalink
Merge pull request #1778 from helix-toolkit/release/2.21.1
Browse files Browse the repository at this point in the history
Release/2.21.1
  • Loading branch information
holance committed Jun 16, 2022
2 parents 2463752 + 93a594f commit 8b01daa
Show file tree
Hide file tree
Showing 48 changed files with 210 additions and 422 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![HelixToolkit](https://img.shields.io/badge/-Helix%20Toolkit-blue)](https://github.com/helix-toolkit/helix-toolkit)

<img src='https://avatars3.githubusercontent.com/u/8432523?s=200&v=4' width='64' />

# Helix Toolkit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.3">
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.1">
<IncludeAssets>build</IncludeAssets>
</PackageReference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Source/Examples/WinUI/App1/App1/App1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.3" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.1" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

Expand Down
4 changes: 4 additions & 0 deletions Source/HelixToolkit.Core.Wpf/HelixToolkit.Core.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/HelixToolkit.Shared/Geometry/MeshGeometryHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public static MeshGeometry3D NoSharedVertices(this MeshGeometry3D input)
ti.Add(i0);
ti.Add(i1);
ti.Add(i2);
if (n != null)
if (n != null && input.Normals.Count>0)
{
n.Add(input.Normals[index0]);
n.Add(input.Normals[index1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ protected override void OnUpdate(RenderContext context, DeviceContextProxy devic
// Get consume buffer count.
//Due to some intel integrated graphic card having issue copy structure count directly into constant buffer.
//Has to use staging buffer to read and pass into constant buffer
FrameVariables.NumParticles = (uint)ReadCount("", deviceContext, BufferProxies[0]);
FrameVariables.NumParticles = (uint)ReadCount(string.Empty, deviceContext, BufferProxies[0]);
perFrameCB.Upload(deviceContext, ref FrameVariables);
#endregion

Expand Down
8 changes: 8 additions & 0 deletions Source/HelixToolkit.SharpDX.Shared/Core/SkyBoxRenderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ public SamplerStateDescription SamplerDescription
/// The name of the shader cube texture sampler.
/// </value>
public string ShaderCubeTextureSamplerName { set; get; } = DefaultSamplerStateNames.CubeMapSampler;
/// <summary>
/// Skip environment map rendering, but still keep it available for other object to use.
/// </summary>
public bool SkipRendering { set; get; }
#endregion

/// <summary>
Expand Down Expand Up @@ -237,6 +241,10 @@ protected override void OnRender(RenderContext context, DeviceContextProxy devic
}
context.SharedResource.EnvironementMap = cubeTextureRes;
context.SharedResource.EnvironmentMapMipLevels = MipMapLevels;
if (SkipRendering)
{
return;
}
DefaultShaderPass.BindShader(deviceContext);
DefaultShaderPass.BindStates(deviceContext, StateType.BlendState | StateType.DepthStencilState);
DefaultShaderPass.PixelShader.BindTexture(deviceContext, cubeTextureSlot, cubeTextureRes);
Expand Down
10 changes: 10 additions & 0 deletions Source/HelixToolkit.SharpDX.Shared/Core/SkyDomeRenderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ public SamplerStateDescription SamplerDescription
/// The name of the shader cube texture sampler.
/// </value>
public string ShaderCubeTextureSamplerName { set; get; } = DefaultSamplerStateNames.CubeMapSampler;
/// <summary>
/// Skip environment map rendering, but still keep it available for other object to use.
/// </summary>
public bool SkipRendering { set; get; }

#endregion

/// <summary>
Expand Down Expand Up @@ -187,6 +192,11 @@ protected void OnDefaultPassChanged(ShaderPass pass)
protected override void OnRender(RenderContext context, DeviceContextProxy deviceContext)
{
context.SharedResource.EnvironementMap = cubeTextureRes;
context.SharedResource.EnvironmentMapMipLevels = MipMapLevels;
if (SkipRendering)
{
return;
}
DefaultShaderPass.BindShader(deviceContext);
DefaultShaderPass.BindStates(deviceContext, StateType.BlendState | StateType.DepthStencilState);
DefaultShaderPass.PixelShader.BindTexture(deviceContext, cubeTextureSlot, cubeTextureRes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public D2D.Brush Background
private Factory factory;
private TextFormat format;
private RectangleF renderBound = new RectangleF(0, 0, 100, 0);
private string previousStr = "";
private string previousStr = string.Empty;
/// <summary>
/// Called when [attach].
/// </summary>
Expand All @@ -87,7 +87,7 @@ protected override bool OnAttach(IRenderHost target)
{
factory = new Factory(FactoryType.Isolated);
format = new TextFormat(factory, "Arial", 12 * target.DpiScale);
previousStr = "";
previousStr = string.Empty;
this.statistics = target.RenderStatistics;
return base.OnAttach(target);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Core2D
{
public class TextRenderCore2D : RenderCore2DBase
{
private string text = "";
private string text = string.Empty;
public string Text
{
set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Render\RenderHost\DefaultRenderHostPartial_Properties.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Render\RenderHost\DX11RenderHostConfiguration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utilities\DepthStencilFormatHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utilities\StringHelper.cs" />
<Compile Include="..\HelixToolkit.SharpDX.Shared\ShaderManager\StructArrayPool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ShaderManager\MaterialVariablePool.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ShaderManager\TextureResourceManager.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,13 @@ TextureModel CubeTexture
{
set; get;
}
/// <summary>
/// Skip environment map rendering, but still keep it available for other object to use.
/// </summary>
bool SkipRendering
{
set; get;
}
}
/// <summary>
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class AnimationGroupUpdater : IAnimationUpdater
public string Name
{
set; get;
} = "";
} = string.Empty;

private List<IAnimationUpdater> children = new List<IAnimationUpdater>();
public IList<IAnimationUpdater> Children => children;
Expand Down Expand Up @@ -57,12 +57,12 @@ public AnimationRepeatMode RepeatMode
}
}

public AnimationGroupUpdater(string name = "")
public AnimationGroupUpdater(string name = StringHelper.EmptyStr)
{
Name = name;
}

public AnimationGroupUpdater(IEnumerable<IAnimationUpdater> updaters, string name = "")
public AnimationGroupUpdater(IEnumerable<IAnimationUpdater> updaters, string name = StringHelper.EmptyStr)
: this(name)
{
children.AddRange(updaters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class KeyFrameUpdater : IAnimationUpdater
public string Name
{
set; get;
} = "";
} = string.Empty;

public Animation Animation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class MorphTargetKeyFrameUpdater : IAnimationUpdater
public string Name
{
set; get;
} = "";
} = string.Empty;
public Animation animation
{
get;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private struct IndexTime
public string Name
{
set; get;
} = "";
} = string.Empty;

public Animation Animation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override BillboardType Type
}
}

private TextInfo mTextInfo = new TextInfo("", new Vector3());
private TextInfo mTextInfo = new TextInfo(string.Empty, new Vector3());
/// <summary>
/// Gets or sets the text information.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public GenericLineMaterialCore(ShaderPass shaderPass, string modelMaterialConsta
public override MaterialVariable CreateMaterialVariables(IEffectsManager manager, IRenderTechnique technique)
{
return new GenericMeshMaterialVariable(manager, technique, this, cbDescription,
MaterialPassName, ShadowPassName, "");
MaterialPassName, ShadowPassName, string.Empty);
}
}
[DataContract]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public sealed class GenericPointMaterialVariable : GenericMaterialVariable
GenericMaterialCore materialCore, ConstantBufferDescription constantBufferDescription,
string materialShaderPassName = DefaultPassNames.Default,
string shadowShaderPassName = DefaultPassNames.ShadowPass)
: base(manager, technique, materialCore, constantBufferDescription, materialShaderPassName, shadowShaderPassName, "")
: base(manager, technique, materialCore, constantBufferDescription, materialShaderPassName, shadowShaderPassName, string.Empty)
{

}
Expand Down
6 changes: 3 additions & 3 deletions Source/HelixToolkit.SharpDX.Shared/Model/ObservableObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public bool DisablePropertyChangedEvent
}

public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged([CallerMemberName] string propertyName = "")
protected void RaisePropertyChanged([CallerMemberName] string propertyName = StringHelper.EmptyStr)
{
if (!DisablePropertyChangedEvent)
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

protected bool Set<T>(ref T backingField, T value, [CallerMemberName] string propertyName = "")
protected bool Set<T>(ref T backingField, T value, [CallerMemberName] string propertyName = StringHelper.EmptyStr)
{
if (EqualityComparer<T>.Default.Equals(backingField, value))
{
Expand All @@ -57,7 +57,7 @@ protected bool Set<T>(ref T backingField, T value, [CallerMemberName] string pro
return true;
}

protected bool Set<T>(ref T backingField, T value, bool raisePropertyChanged, [CallerMemberName] string propertyName = "")
protected bool Set<T>(ref T backingField, T value, bool raisePropertyChanged, [CallerMemberName] string propertyName = StringHelper.EmptyStr)
{
if (EqualityComparer<T>.Default.Equals(backingField, value))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private void UpdateModel()

private void UpdateAxisColor(int which, Color4 color)
{
var label = "";
var label = string.Empty;
switch (which)
{
case 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ public TextureModel Texture
return (RenderCore as ISkyboxRenderParams).CubeTexture;
}
}
/// <summary>
/// Skip environment map rendering, but still keep it available for other object to use.
/// </summary>
public bool SkipRendering
{
set
{
(RenderCore as ISkyboxRenderParams).SkipRendering = value;
}
get
{
return (RenderCore as ISkyboxRenderParams).SkipRendering;
}
}

private readonly bool UseSkyDome = false;
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Model.Scene2D

public class TextNode2D : SceneNode2D
{
private string text = "";
private string text = string.Empty;
public string Text
{
set
Expand Down
2 changes: 1 addition & 1 deletion Source/HelixToolkit.SharpDX.Shared/Render/RenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public IRenderHost RenderHost
/// <value>
/// The name of the custom pass.
/// </value>
public string CustomPassName = "";
public string CustomPassName = string.Empty;

/// <summary>
/// Gets or sets the time stamp.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ private void Clear(bool clearFrameRenderables, bool clearPerFrameRenderables)
/// </summary>
protected override void OnEndingD3D()
{
Logger.Log(LogLevel.Information, "", nameof(DefaultRenderHost));
Logger.Log(LogLevel.Information, string.Empty, nameof(DefaultRenderHost));
asyncTask?.Wait();
getTriangleCountTask?.Wait();
getPostEffectCoreTask?.Wait();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ public virtual void StartRendering()
{
lock (lockObj)
{
Log(LogLevel.Information, "");
Log(LogLevel.Information, string.Empty);
renderStatistics.Reset();
lastRenderingDuration = TimeSpan.Zero;
lastRenderTime = TimeSpan.Zero;
Expand All @@ -965,7 +965,7 @@ public virtual void StartRendering()
/// </summary>
protected void CreateAndBindBuffers()
{
Log(LogLevel.Information, "");
Log(LogLevel.Information, string.Empty);
RemoveAndDispose(ref renderBuffer);
renderBuffer = CreateRenderBuffer();
renderBuffer.OnNewBufferCreated += RenderBuffer_OnNewBufferCreated;
Expand Down Expand Up @@ -1024,7 +1024,7 @@ protected virtual void AttachRenderable(IDeviceResources deviceResources)
{
return;
}
Log(LogLevel.Information, "");
Log(LogLevel.Information, string.Empty);
if (EnableSharingModelMode && SharedModelContainer != null)
{
SharedModelContainer.CurrentRenderHost = this;
Expand Down Expand Up @@ -1062,7 +1062,7 @@ public void EndD3D()
{
lock (lockObj)
{
Log(LogLevel.Information, "");
Log(LogLevel.Information, string.Empty);
StopRendering();
IsInitialized = false;
RemoveAndDispose(ref immediateDeviceContext);
Expand All @@ -1081,23 +1081,23 @@ protected virtual void OnEndingD3D()

private void OnManagerDisposed(object sender, EventArgs args)
{
Log(LogLevel.Information, "");
Log(LogLevel.Information, string.Empty);
EndD3D();
}
/// <summary>
/// Stops the rendering.
/// </summary>
public virtual void StopRendering()
{
Log(LogLevel.Information, "");
Log(LogLevel.Information, string.Empty);
StopRenderLoop?.Invoke(this, EventArgs.Empty);
}
/// <summary>
/// Disposes the buffers.
/// </summary>
protected virtual void DisposeBuffers()
{
Log(LogLevel.Information, "");
Log(LogLevel.Information, string.Empty);
if (renderBuffer != null)
{
renderBuffer.OnNewBufferCreated -= RenderBuffer_OnNewBufferCreated;
Expand All @@ -1112,7 +1112,7 @@ protected virtual void DisposeBuffers()
/// </summary>
protected virtual void DetachRenderable()
{
Log(LogLevel.Information, "");
Log(LogLevel.Information, string.Empty);
RemoveAndDispose(ref renderContext);
RemoveAndDispose(ref renderContext2D);
Viewport?.Detach();
Expand Down Expand Up @@ -1229,7 +1229,7 @@ protected override void OnDispose(bool disposeManagedResources)
base.OnDispose(disposeManagedResources);
}

private void Log<Type>(LogLevel level, Type msg, [CallerMemberName] string caller = "", [CallerLineNumber] int sourceLineNumber = 0)
private void Log<Type>(LogLevel level, Type msg, [CallerMemberName] string caller = StringHelper.EmptyStr, [CallerLineNumber] int sourceLineNumber = 0)
{
Logger.Log(level, msg, nameof(DX11RenderHostBase), caller, sourceLineNumber);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public virtual void RenderToPingPongBuffer(RenderContext context, ref RenderPara
if (count > 0)
{
var buffer = context.RenderHost.RenderBuffer;
var depthStencilBuffer = buffer.DepthStencilBufferNoMSAA;
var depthStencilBuffer = parameter.IsMSAATexture ? buffer.DepthStencilBuffer : buffer.DepthStencilBufferNoMSAA;
ImmediateContext.SetRenderTargets(depthStencilBuffer, parameter.RenderTargetView);

for (var i = start; i < start + count; ++i)
Expand Down
Loading

0 comments on commit 8b01daa

Please sign in to comment.