mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Implemented animated simplex noise
This commit is contained in:
parent
33d0fca15e
commit
8430f28fa7
@ -68,33 +68,35 @@ namespace Artemis.Core.Models.Profile
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
canvas.Save();
|
canvas.Save();
|
||||||
|
lock (_renderBitmap)
|
||||||
foreach (var layerElement in LayerElements)
|
|
||||||
layerElement.RenderPreProcess(surface, canvas);
|
|
||||||
|
|
||||||
_renderCanvas.Clear();
|
|
||||||
foreach (var layerElement in LayerElements)
|
|
||||||
layerElement.Render(surface, _renderCanvas);
|
|
||||||
|
|
||||||
var baseShader = SKShader.CreateBitmap(_renderBitmap, SKShaderTileMode.Repeat, SKShaderTileMode.Repeat, SKMatrix.MakeTranslation(RenderRectangle.Left, RenderRectangle.Top));
|
|
||||||
foreach (var layerElement in LayerElements)
|
|
||||||
{
|
{
|
||||||
var newBaseShader = layerElement.RenderPostProcess(surface, _renderBitmap, baseShader);
|
foreach (var layerElement in LayerElements)
|
||||||
if (newBaseShader == null)
|
layerElement.RenderPreProcess(surface, canvas);
|
||||||
continue;
|
|
||||||
|
|
||||||
// Dispose the old base shader if the layer element provided a new one
|
_renderCanvas.Clear();
|
||||||
if (!ReferenceEquals(baseShader, newBaseShader))
|
foreach (var layerElement in LayerElements)
|
||||||
baseShader.Dispose();
|
layerElement.Render(surface, _renderCanvas);
|
||||||
|
|
||||||
baseShader = newBaseShader;
|
var baseShader = SKShader.CreateBitmap(_renderBitmap, SKShaderTileMode.Repeat, SKShaderTileMode.Repeat, SKMatrix.MakeTranslation(RenderRectangle.Left, RenderRectangle.Top));
|
||||||
|
foreach (var layerElement in LayerElements)
|
||||||
|
{
|
||||||
|
var newBaseShader = layerElement.RenderPostProcess(surface, _renderBitmap, baseShader);
|
||||||
|
if (newBaseShader == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Dispose the old base shader if the layer element provided a new one
|
||||||
|
if (!ReferenceEquals(baseShader, newBaseShader))
|
||||||
|
baseShader.Dispose();
|
||||||
|
|
||||||
|
baseShader = newBaseShader;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.ClipPath(RenderPath);
|
||||||
|
canvas.DrawRect(RenderRectangle, new SKPaint {Shader = baseShader, FilterQuality = SKFilterQuality.Low});
|
||||||
|
baseShader.Dispose();
|
||||||
|
|
||||||
|
canvas.Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.ClipPath(RenderPath);
|
|
||||||
canvas.DrawRect(RenderRectangle, new SKPaint {Shader = baseShader, FilterQuality = SKFilterQuality.Low});
|
|
||||||
baseShader.Dispose();
|
|
||||||
|
|
||||||
canvas.Restore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override void ApplyToEntity()
|
internal override void ApplyToEntity()
|
||||||
@ -206,12 +208,24 @@ namespace Artemis.Core.Models.Profile
|
|||||||
|
|
||||||
RenderPath = path;
|
RenderPath = path;
|
||||||
|
|
||||||
var oldBitmap = _renderBitmap;
|
if (_renderBitmap != null)
|
||||||
var oldCanvas = _renderCanvas;
|
{
|
||||||
_renderBitmap = new SKBitmap(new SKImageInfo((int) RenderRectangle.Width, (int) RenderRectangle.Height));
|
lock (_renderBitmap)
|
||||||
_renderCanvas = new SKCanvas(_renderBitmap);
|
{
|
||||||
oldBitmap?.Dispose();
|
var oldBitmap = _renderBitmap;
|
||||||
oldCanvas?.Dispose();
|
var oldCanvas = _renderCanvas;
|
||||||
|
_renderBitmap = new SKBitmap(new SKImageInfo((int) RenderRectangle.Width, (int) RenderRectangle.Height));
|
||||||
|
_renderCanvas = new SKCanvas(_renderBitmap);
|
||||||
|
oldBitmap?.Dispose();
|
||||||
|
oldCanvas?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_renderBitmap = new SKBitmap(new SKImageInfo((int) RenderRectangle.Width, (int) RenderRectangle.Height));
|
||||||
|
_renderCanvas = new SKCanvas(_renderBitmap);
|
||||||
|
}
|
||||||
|
|
||||||
OnRenderPropertiesUpdated();
|
OnRenderPropertiesUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
<NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>
|
||||||
</NuGetPackageImportStamp>
|
</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -23,6 +24,7 @@
|
|||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<LangVersion>7</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
@ -33,10 +35,24 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="MaterialDesignColors, Version=1.2.0.325, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\MaterialDesignColors.1.2.0\lib\net45\MaterialDesignColors.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="MaterialDesignThemes.Wpf">
|
||||||
|
<HintPath>..\packages\MaterialDesignThemes.2.6.0\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="RGB.NET.Core, Version=0.1.25.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\..\RGB.NET\bin\net45\RGB.NET.Core.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SkiaSharp.1.68.1\lib\net45\SkiaSharp.dll</HintPath>
|
<HintPath>..\packages\SkiaSharp.1.68.1\lib\net45\SkiaSharp.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Stylet, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Stylet, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Stylet.1.3.0\lib\net45\Stylet.dll</HintPath>
|
<HintPath>..\packages\Stylet.1.3.0\lib\net45\Stylet.dll</HintPath>
|
||||||
@ -56,6 +72,12 @@
|
|||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@ -65,17 +87,19 @@
|
|||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="NoiseLayerElement.cs" />
|
|
||||||
<Compile Include="NoiseLayerElementProvider.cs" />
|
|
||||||
<Compile Include="NoiseLayerElementSettings.cs" />
|
<Compile Include="NoiseLayerElementSettings.cs" />
|
||||||
<Compile Include="NoiseLayerElementViewModel.cs" />
|
<Compile Include="NoiseLayerElementViewModel.cs" />
|
||||||
|
<Compile Include="NoiseLayerElement.cs" />
|
||||||
|
<Compile Include="NoiseLayerElementProvider.cs" />
|
||||||
|
<Compile Include="OpenSimplexNoise.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="NoiseLayerElementView.xaml">
|
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Project>{9b811f9b-86b9-4771-87af-72bae7078a36}</Project>
|
||||||
<SubType>Designer</SubType>
|
<Name>Artemis.Core</Name>
|
||||||
</Page>
|
<Private>False</Private>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
@ -85,12 +109,17 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj">
|
<Page Include="NoiseLayerElementView.xaml">
|
||||||
<Project>{9b811f9b-86b9-4771-87af-72bae7078a36}</Project>
|
<SubType>Designer</SubType>
|
||||||
<Name>Artemis.Core</Name>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</ProjectReference>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>echo Copying plugin to Artemis.UI output directory
|
||||||
|
XCOPY "$(TargetDir.TrimEnd('\'))" "$(SolutionDir)\Artemis.UI\$(OutDir)Plugins\$(ProjectName)" /s /q /i /y</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
<Import Project="..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets')" />
|
<Import Project="..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.1.68.1\build\net45\SkiaSharp.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Models.Surface;
|
using Artemis.Core.Models.Surface;
|
||||||
using Artemis.Core.Plugins.LayerElement;
|
using Artemis.Core.Plugins.LayerElement;
|
||||||
@ -10,42 +8,26 @@ namespace Artemis.Plugins.LayerElements.Noise
|
|||||||
{
|
{
|
||||||
public class NoiseLayerElement : LayerElement
|
public class NoiseLayerElement : LayerElement
|
||||||
{
|
{
|
||||||
private SKShader _shader;
|
private readonly OpenSimplexNoise _noise;
|
||||||
private List<SKColor> _testColors;
|
private float _z;
|
||||||
private SKPaint _paint;
|
|
||||||
|
|
||||||
public NoiseLayerElement(Layer layer, Guid guid, NoiseLayerElementSettings settings, LayerElementDescriptor descriptor) : base(layer, guid, settings, descriptor)
|
public NoiseLayerElement(Layer layer, Guid guid, NoiseLayerElementSettings settings, LayerElementDescriptor descriptor) : base(layer, guid, settings, descriptor)
|
||||||
{
|
{
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
|
|
||||||
_testColors = new List<SKColor>();
|
_z = 0.001f;
|
||||||
for (var i = 0; i < 9; i++)
|
_noise = new OpenSimplexNoise(Guid.GetHashCode());
|
||||||
{
|
|
||||||
if (i != 8)
|
|
||||||
_testColors.Add(SKColor.FromHsv(i * 32, 100, 100));
|
|
||||||
else
|
|
||||||
_testColors.Add(SKColor.FromHsv(0, 100, 100));
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateShader();
|
|
||||||
Layer.RenderPropertiesUpdated += (sender, args) => CreateShader();
|
|
||||||
Settings.PropertyChanged += (sender, args) => CreateShader();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateShader()
|
|
||||||
{
|
|
||||||
var shader = SKShader.CreatePerlinNoiseFractalNoise(1, 1, 1, 1);
|
|
||||||
|
|
||||||
var oldShader = _shader;
|
|
||||||
var oldPaint = _paint;
|
|
||||||
_shader = shader;
|
|
||||||
_paint = new SKPaint {Shader = _shader, FilterQuality = SKFilterQuality.Low};
|
|
||||||
oldShader?.Dispose();
|
|
||||||
oldPaint?.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public new NoiseLayerElementSettings Settings { get; }
|
public new NoiseLayerElementSettings Settings { get; }
|
||||||
|
|
||||||
|
|
||||||
|
public override void Update(double deltaTime)
|
||||||
|
{
|
||||||
|
_z += Settings.AnimationSpeed;
|
||||||
|
base.Update(deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
public override LayerElementViewModel GetViewModel()
|
public override LayerElementViewModel GetViewModel()
|
||||||
{
|
{
|
||||||
return new NoiseLayerElementViewModel(this);
|
return new NoiseLayerElementViewModel(this);
|
||||||
@ -53,7 +35,21 @@ namespace Artemis.Plugins.LayerElements.Noise
|
|||||||
|
|
||||||
public override void Render(ArtemisSurface surface, SKCanvas canvas)
|
public override void Render(ArtemisSurface surface, SKCanvas canvas)
|
||||||
{
|
{
|
||||||
canvas.DrawRect(Layer.AbsoluteRenderRectangle, _paint);
|
var width = Layer.AbsoluteRenderRectangle.Width / 2;
|
||||||
|
var height = Layer.AbsoluteRenderRectangle.Height / 2;
|
||||||
|
using (var bitmap = new SKBitmap(new SKImageInfo((int) Layer.AbsoluteRenderRectangle.Width, (int) Layer.AbsoluteRenderRectangle.Height)))
|
||||||
|
{
|
||||||
|
for (var x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
for (var y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
var v = _noise.Evaluate(Settings.XScale * x / width, Settings.YScale * y / height, _z);
|
||||||
|
bitmap.SetPixel(x, y, new SKColor(255, 255, 255, (byte) ((v + 1) * 127)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.DrawBitmap(bitmap, SKRect.Create(0, 0, width, height), Layer.AbsoluteRenderRectangle, new SKPaint {BlendMode = Settings.BlendMode});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,46 +1,46 @@
|
|||||||
using System.Collections.Generic;
|
using Artemis.Core.Plugins.LayerElement;
|
||||||
using System.ComponentModel;
|
|
||||||
using Artemis.Core.Plugins.LayerElement;
|
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.Plugins.LayerElements.Noise
|
namespace Artemis.Plugins.LayerElements.Noise
|
||||||
{
|
{
|
||||||
public class NoiseLayerElementSettings : LayerElementSettings
|
public class NoiseLayerElementSettings : LayerElementSettings
|
||||||
{
|
{
|
||||||
private BrushType _brushType;
|
private SKBlendMode _blendMode;
|
||||||
private List<SKColor> _colors;
|
private float _xScale;
|
||||||
|
private float _yScale;
|
||||||
|
private float _animationSpeed;
|
||||||
|
|
||||||
|
|
||||||
public NoiseLayerElementSettings()
|
public NoiseLayerElementSettings()
|
||||||
{
|
{
|
||||||
BrushType = BrushType.Solid;
|
BlendMode = SKBlendMode.Color;
|
||||||
Colors = new List<SKColor>();
|
XScale = 0.5f;
|
||||||
|
YScale = 0.5f;
|
||||||
|
AnimationSpeed = 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BrushType BrushType
|
public float XScale
|
||||||
{
|
{
|
||||||
get => _brushType;
|
get => _xScale;
|
||||||
set => SetAndNotify(ref _brushType, value);
|
set => SetAndNotify(ref _xScale, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SKColor> Colors
|
public float YScale
|
||||||
{
|
{
|
||||||
get => _colors;
|
get => _yScale;
|
||||||
set => SetAndNotify(ref _colors, value);
|
set => SetAndNotify(ref _yScale, value);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public enum BrushType
|
public float AnimationSpeed
|
||||||
{
|
{
|
||||||
[Description("Solid")]
|
get => _animationSpeed;
|
||||||
Solid,
|
set => SetAndNotify(ref _animationSpeed, value);
|
||||||
|
}
|
||||||
|
|
||||||
[Description("Linear Gradient")]
|
public SKBlendMode BlendMode
|
||||||
LinearGradient,
|
{
|
||||||
|
get => _blendMode;
|
||||||
[Description("Radial Gradient")]
|
set => SetAndNotify(ref _blendMode, value);
|
||||||
RadialGradient,
|
}
|
||||||
|
|
||||||
[Description("Sweep Gradient")]
|
|
||||||
SweepGradient
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,12 +1,13 @@
|
|||||||
<UserControl x:Class="Artemis.Plugins.LayerElements.Noise.BrushLayerElementView"
|
<UserControl x:Class="Artemis.Plugins.LayerElements.Noise.NoiseLayerElementView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:brushLayer="clr-namespace:Artemis.Plugins.LayerElements.Brush"
|
xmlns:noiseLayer="clr-namespace:Artemis.Plugins.LayerElements.Noise"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
d:DataContext="{d:DesignInstance {x:Type noiseLayer:NoiseLayerElementViewModel}}">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
@ -28,8 +29,30 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0">
|
||||||
|
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Blend mode</TextBlock>
|
||||||
|
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Affects how the noise is rendered on the rest of the layer</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||||
|
<ComboBox HorizontalAlignment="Left"
|
||||||
|
ItemsSource="{Binding Path=BlendModes}"
|
||||||
|
SelectedValuePath="Value"
|
||||||
|
DisplayMemberPath="Description"
|
||||||
|
Width="100"
|
||||||
|
SelectedValue="{Binding Path=LayerElement.Settings.BlendMode}" />
|
||||||
|
</StackPanel>
|
||||||
|
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<!-- Sample 1 -->
|
|
||||||
<Grid Grid.Row="2">
|
<Grid Grid.Row="2">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
@ -40,11 +63,10 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel Grid.Column="0">
|
<StackPanel Grid.Column="0">
|
||||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Setting title</TextBlock>
|
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">X Scale</TextBlock>
|
||||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Setting subtitle</TextBlock>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Default ToggleButton Style" />
|
<Slider Orientation="Horizontal" TickFrequency="0.5" Minimum="0.5" Maximum="20" Value="{Binding LayerElement.Settings.XScale}" Width="100"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -60,11 +82,10 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel Grid.Column="0">
|
<StackPanel Grid.Column="0">
|
||||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Setting title</TextBlock>
|
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Y Scale</TextBlock>
|
||||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Setting subtitle</TextBlock>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Default ToggleButton Style" />
|
<Slider Orientation="Horizontal" TickFrequency="0.5" Minimum="0.5" Maximum="20" Value="{Binding LayerElement.Settings.YScale}" Width="100"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -80,31 +101,10 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel Grid.Column="0">
|
<StackPanel Grid.Column="0">
|
||||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Setting title</TextBlock>
|
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Animation speed</TextBlock>
|
||||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Setting subtitle</TextBlock>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Default ToggleButton Style" />
|
<Slider Orientation="Horizontal" TickFrequency="0.05" Minimum="0.05" Maximum="1" Value="{Binding LayerElement.Settings.YScale}" Width="100"/>
|
||||||
</StackPanel>
|
|
||||||
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<!-- Setting 2 -->
|
|
||||||
<Grid Grid.Row="5">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition />
|
|
||||||
<RowDefinition />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<StackPanel Grid.Column="0">
|
|
||||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}">Setting title</TextBlock>
|
|
||||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}">Setting subtitle</TextBlock>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
|
||||||
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" ToolTip="Default ToggleButton Style" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignSeparator}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using Artemis.Core.Plugins.LayerElement;
|
using System.Collections.Generic;
|
||||||
|
using Artemis.Core.Plugins.LayerElement;
|
||||||
|
using Artemis.Core.Utilities;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.Plugins.LayerElements.Noise
|
namespace Artemis.Plugins.LayerElements.Noise
|
||||||
{
|
{
|
||||||
@ -10,5 +13,6 @@ namespace Artemis.Plugins.LayerElements.Noise
|
|||||||
}
|
}
|
||||||
|
|
||||||
public new NoiseLayerElement LayerElement { get; }
|
public new NoiseLayerElement LayerElement { get; }
|
||||||
|
public IEnumerable<ValueDescription> BlendModes => EnumUtilities.GetAllValuesAndDescriptions(typeof(SKBlendMode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
448
src/Artemis.Plugins.LayerElements.Noise/OpenSimplexNoise.cs
Normal file
448
src/Artemis.Plugins.LayerElements.Noise/OpenSimplexNoise.cs
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user