Use primary constructors in remaining projects

このコミットが含まれているのは:
Sergio Pedri committed 2023-11-20 23:06:22 +01:00
1 親 46a6b25756
コミット 6897ecfcb2
14ファイル変更
+55 -174

検索条件に一致するファイルはありません

+3 -16
ファイルの表示
@@ -56,7 +56,8 @@ public abstract class PixelShaderEffect : CanvasEffect
/// An effect for an animated pixel shader.
/// </summary>
/// <typeparam name="T">The type of pixel shader to render.</typeparam>
public sealed class For<T> : PixelShaderEffect
/// <param name="factory">The input <typeparamref name="T"/> factory.</param>
public sealed class For<T>(For<T>.Factory factory) : PixelShaderEffect
where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor<T>
{
/// <summary>
@@ -64,20 +65,6 @@ public abstract class PixelShaderEffect : CanvasEffect
/// </summary>
private static readonly EffectNode<PixelShaderEffect<T>> Effect = new();
/// <summary>
/// The <typeparamref name="T"/> factory to use.
/// </summary>
private readonly Factory factory;
/// <summary>
/// Creates a new <see cref="For{T}"/> instance with the specified parameters.
/// </summary>
/// <param name="factory">The input <typeparamref name="T"/> factory.</param>
public For(Factory factory)
{
this.factory = factory;
}
/// <inheritdoc/>
protected override void BuildEffectGraph(EffectGraph effectGraph)
{
@@ -87,7 +74,7 @@ public abstract class PixelShaderEffect : CanvasEffect
/// <inheritdoc/>
protected override void ConfigureEffectGraph(EffectGraph effectGraph)
{
effectGraph.GetNode(Effect).ConstantBuffer = this.factory(ElapsedTime, ScreenWidth, ScreenHeight);
effectGraph.GetNode(Effect).ConstantBuffer = factory(ElapsedTime, ScreenWidth, ScreenHeight);
}
/// <summary>
+10 -17
ファイルの表示
@@ -7,35 +7,28 @@ namespace ComputeSharp.SwapChain.Core.ViewModels;
/// <summary>
/// A viewmodel for a compute shader.
/// </summary>
public sealed partial class ShaderRunnerViewModel : ObservableObject
/// <param name="shaderType">The name of the shader type to execute.</param>
/// <param name="shaderRunner">The <see cref="IShaderRunner"/> instance to execute.</param>
/// <param name="pixelShaderEffect">The <see cref="Shaders.PixelShaderEffect"/> instance to execute.</param>
public sealed partial class ShaderRunnerViewModel(
string shaderType,
IShaderRunner shaderRunner,
PixelShaderEffect pixelShaderEffect) : ObservableObject
{
/// <summary>
/// Creates a new <see cref="ShaderRunnerViewModel"/> instance.
/// </summary>
/// <param name="shaderType">The name of the shader type to execute.</param>
/// <param name="shaderRunner">The <see cref="IShaderRunner"/> instance to execute.</param>
/// <param name="pixelShaderEffect">The <see cref="Shaders.PixelShaderEffect"/> instance to execute.</param>
public ShaderRunnerViewModel(string shaderType, IShaderRunner shaderRunner, PixelShaderEffect pixelShaderEffect)
{
ShaderType = shaderType;
ShaderRunner = shaderRunner;
PixelShaderEffect = pixelShaderEffect;
}
/// <summary>
/// Gets the name of the shader type to execute.
/// </summary>
public string ShaderType { get; }
public string ShaderType => shaderType;
/// <summary>
/// Gets the <see cref="IShaderRunner"/> instance to execute.
/// </summary>
public IShaderRunner ShaderRunner { get; }
public IShaderRunner ShaderRunner => shaderRunner;
/// <summary>
/// Gets the <see cref="PixelShaderEffect"/> instance to execute.
/// </summary>
public PixelShaderEffect PixelShaderEffect { get; }
public PixelShaderEffect PixelShaderEffect => pixelShaderEffect;
/// <summary>
/// Gets or sets whether the current shader is selected.