mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merge branch 'development'
This commit is contained in:
commit
935c139ab4
@ -6,16 +6,12 @@ A large part of this documentation is being generated based on code but over tim
|
||||
|
||||
## Plugins
|
||||
Artemis 2.0 has been developed from the ground up with plugins in mind. This means almost all functionality can be expanded. The following plugin types are currently available and fully implemented:
|
||||
- [DataModelExpansion\<T\>](api/Artemis.Core.DataModelExpansions.DataModelExpansion-1.html)
|
||||
- [DeviceProvider](api/Artemis.Core.DeviceProviders.DeviceProvider.html)
|
||||
- [LayerBrush\<T\>](api/Artemis.Core.LayerBrushes.LayerBrush-1.html)
|
||||
- [PerLedLayerBrush\<T\>](api/Artemis.Core.LayerBrushes.PerLedLayerBrush-1.html)
|
||||
- [RgbNetLayerBrush\<T\>](api/Artemis.Core.LayerBrushes.RgbNetLayerBrush-1.html)
|
||||
- [LayerEffect](api/Artemis.Core.LayerEffects.LayerEffect-1.html)
|
||||
- [Module](api/Artemis.Core.Modules.Module.html)
|
||||
- [Module\<T\>](api/Artemis.Core.Modules.Module-1.html)
|
||||
- [ProfileModule](api/Artemis.Core.Modules.ProfileModule.html),
|
||||
- [ProfileModule\<T\>](api/Artemis.Core.Modules.ProfileModule-1.html)
|
||||
|
||||
These allow you to expand on Artemis's functionality. For quick and interactive plugin creation, use the [Visual Studio template extension](https://marketplace.visualstudio.com/items?itemName=SpoinkyNL.ArtemisTemplates).
|
||||
|
||||
@ -25,6 +21,6 @@ Example implementations of these plugins can be found on [GitHub](https://github
|
||||
Artemis provides plugins with an API through a range of services.
|
||||
All the services are available to plugins by using dependency injection in your plugin's constructor. Dependency injection is also available for the different view models plugins may provide.
|
||||
|
||||
- [Core Services](api/Artemis.Core.Services.Interfaces.html)
|
||||
- [UI Services](api/Artemis.UI.Shared.Services.Interfaces.html)
|
||||
- [Core Services](api/Artemis.Core.Services.html#interfaces)
|
||||
- [UI Services](api/Artemis.UI.Shared.Services.html#interfaces)
|
||||
|
||||
|
||||
@ -208,6 +208,7 @@ namespace Artemis.Core.Services
|
||||
);
|
||||
_logger.Information("Startup arguments: {args}", StartupArguments);
|
||||
_logger.Information("Elevated permissions: {perms}", IsElevated);
|
||||
_logger.Information("Stopwatch high resolution: {perms}", Stopwatch.IsHighResolution);
|
||||
|
||||
ApplyLoggingLevel();
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
d:DataContext="{d:DesignInstance local:PerformanceDebugViewModel}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
@ -19,7 +20,18 @@
|
||||
If you are having performance issues, below you can find out which plugin might be the culprit.
|
||||
</TextBlock>
|
||||
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<TextBlock Grid.Row="1" HorizontalAlignment="Right" Margin="0,5,5,0">
|
||||
<Run Text="FPS: " />
|
||||
<Run FontWeight="Bold" Text="{Binding CurrentFps}" />
|
||||
<Run Text="at" />
|
||||
<Run Text="{Binding RenderWidth}" /><Run Text="x" /><Run Text="{Binding RenderHeight}" />
|
||||
<Run Text="- Renderer:"></Run>
|
||||
<Run Text="{Binding Renderer}"></Run>
|
||||
<Run Text="- RGB.NET delta:"></Run>
|
||||
<Run Text="{Binding Delta}"></Run>
|
||||
</TextBlock>
|
||||
|
||||
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<ItemsControl ItemsSource="{Binding Items}" Margin="0 0 10 0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.Views.WPF;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.Settings.Debug.Tabs.Performance
|
||||
@ -10,14 +16,56 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs.Performance
|
||||
{
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly Timer _updateTimer;
|
||||
private readonly ICoreService _coreService;
|
||||
private readonly Timer _fpsTimer;
|
||||
private double _currentFps;
|
||||
private int _renderWidth;
|
||||
private int _renderHeight;
|
||||
private string _renderer;
|
||||
private int _frames;
|
||||
private double _delta;
|
||||
private double _lastDelta;
|
||||
|
||||
public PerformanceDebugViewModel(IPluginManagementService pluginManagementService)
|
||||
public PerformanceDebugViewModel(ICoreService coreService, IPluginManagementService pluginManagementService)
|
||||
{
|
||||
_coreService = coreService;
|
||||
_pluginManagementService = pluginManagementService;
|
||||
_updateTimer = new Timer(500);
|
||||
|
||||
_fpsTimer = new Timer(1000);
|
||||
|
||||
DisplayName = "PERFORMANCE";
|
||||
_updateTimer.Elapsed += UpdateTimerOnElapsed;
|
||||
_fpsTimer.Start();
|
||||
}
|
||||
|
||||
public double CurrentFps
|
||||
{
|
||||
get => _currentFps;
|
||||
set => SetAndNotify(ref _currentFps, value);
|
||||
}
|
||||
|
||||
public int RenderWidth
|
||||
{
|
||||
get => _renderWidth;
|
||||
set => SetAndNotify(ref _renderWidth, value);
|
||||
}
|
||||
|
||||
public int RenderHeight
|
||||
{
|
||||
get => _renderHeight;
|
||||
set => SetAndNotify(ref _renderHeight, value);
|
||||
}
|
||||
|
||||
public string Renderer
|
||||
{
|
||||
get => _renderer;
|
||||
set => SetAndNotify(ref _renderer, value);
|
||||
}
|
||||
|
||||
public double Delta
|
||||
{
|
||||
get => _delta;
|
||||
set => SetAndNotify(ref _delta, value);
|
||||
}
|
||||
|
||||
private void UpdateTimerOnElapsed(object sender, ElapsedEventArgs e)
|
||||
@ -57,6 +105,10 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs.Performance
|
||||
_pluginManagementService.PluginDisabled += PluginToggled;
|
||||
_pluginManagementService.PluginFeatureEnabled += FeatureToggled;
|
||||
_pluginManagementService.PluginFeatureDisabled += FeatureToggled;
|
||||
_coreService.FrameRendering += CoreServiceOnFrameRendering;
|
||||
_coreService.FrameRendered += CoreServiceOnFrameRendered;
|
||||
_fpsTimer.Elapsed += FpsTimerOnElapsed;
|
||||
|
||||
base.OnActivate();
|
||||
}
|
||||
|
||||
@ -68,10 +120,43 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs.Performance
|
||||
_pluginManagementService.PluginDisabled -= PluginToggled;
|
||||
_pluginManagementService.PluginFeatureEnabled -= FeatureToggled;
|
||||
_pluginManagementService.PluginFeatureDisabled -= FeatureToggled;
|
||||
_coreService.FrameRendering -= CoreServiceOnFrameRendering;
|
||||
_coreService.FrameRendered -= CoreServiceOnFrameRendered;
|
||||
_fpsTimer.Elapsed -= FpsTimerOnElapsed;
|
||||
|
||||
Items.Clear();
|
||||
base.OnDeactivate();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnClose()
|
||||
{
|
||||
_fpsTimer.Dispose();
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void FpsTimerOnElapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Delta = _lastDelta;
|
||||
CurrentFps = _frames;
|
||||
Renderer = Constants.ManagedGraphicsContext != null ? Constants.ManagedGraphicsContext.GetType().Name : "Software";
|
||||
_frames = 0;
|
||||
}
|
||||
|
||||
private void CoreServiceOnFrameRendering(object? sender, FrameRenderingEventArgs e)
|
||||
{
|
||||
_lastDelta = e.DeltaTime;
|
||||
}
|
||||
|
||||
private void CoreServiceOnFrameRendered(object sender, FrameRenderedEventArgs e)
|
||||
{
|
||||
_frames++;
|
||||
|
||||
SKImageInfo bitmapInfo = e.Texture.ImageInfo;
|
||||
RenderHeight = bitmapInfo.Height;
|
||||
RenderWidth = bitmapInfo.Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -36,6 +36,8 @@
|
||||
<Run Text="{Binding RenderWidth}" /><Run Text="x" /><Run Text="{Binding RenderHeight}" />
|
||||
<Run Text="- Renderer:"></Run>
|
||||
<Run Text="{Binding Renderer}"></Run>
|
||||
<Run Text="- RGB.NET delta:"></Run>
|
||||
<Run Text="{Binding Delta}"></Run>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
|
||||
@ -25,6 +25,8 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
||||
private string _frameTargetPath;
|
||||
private string _renderer;
|
||||
private int _frames;
|
||||
private double _delta;
|
||||
private double _lastDelta;
|
||||
|
||||
public RenderDebugViewModel(ICoreService coreService)
|
||||
{
|
||||
@ -64,6 +66,12 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
||||
set => SetAndNotify(ref _renderer, value);
|
||||
}
|
||||
|
||||
public double Delta
|
||||
{
|
||||
get => _delta;
|
||||
set => SetAndNotify(ref _delta, value);
|
||||
}
|
||||
|
||||
public void SaveFrame()
|
||||
{
|
||||
VistaSaveFileDialog dialog = new VistaSaveFileDialog {Filter = "Portable network graphic (*.png)|*.png", Title = "Save render frame"};
|
||||
@ -80,6 +88,7 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
||||
|
||||
protected override void OnActivate()
|
||||
{
|
||||
_coreService.FrameRendering += CoreServiceOnFrameRendering;
|
||||
_coreService.FrameRendered += CoreServiceOnFrameRendered;
|
||||
_fpsTimer.Elapsed += FpsTimerOnElapsed;
|
||||
base.OnActivate();
|
||||
@ -87,6 +96,7 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
||||
|
||||
protected override void OnDeactivate()
|
||||
{
|
||||
_coreService.FrameRendering -= CoreServiceOnFrameRendering;
|
||||
_coreService.FrameRendered -= CoreServiceOnFrameRendered;
|
||||
_fpsTimer.Elapsed -= FpsTimerOnElapsed;
|
||||
base.OnDeactivate();
|
||||
@ -98,6 +108,10 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
private void CoreServiceOnFrameRendering(object? sender, FrameRenderingEventArgs e)
|
||||
{
|
||||
_lastDelta = e.DeltaTime;
|
||||
}
|
||||
|
||||
private void CoreServiceOnFrameRendered(object sender, FrameRenderedEventArgs e)
|
||||
{
|
||||
@ -145,9 +159,9 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
|
||||
|
||||
private void FpsTimerOnElapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
Delta = _lastDelta;
|
||||
CurrentFps = _frames;
|
||||
// Renderer = Constants.ManagedGraphicsContext != null ? Constants.ManagedGraphicsContext.GetType().Name : "Software";
|
||||
Renderer = $"HighAccuracyTimers: {Stopwatch.IsHighResolution}";
|
||||
Renderer = Constants.ManagedGraphicsContext != null ? Constants.ManagedGraphicsContext.GetType().Name : "Software";
|
||||
_frames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user