Noise brush - Greatly improved performance on large layouts

Profiles core - Pass real delta time brushes/effects
Profiles core - Allow main segment to be disabled on layers
General module - Removed test data model
General module - Removed expensive open window scan, was fun to try :P
Profile editor - Refactored segments
Profile editor - Updated segment visuals to scale well when really narrow
This commit is contained in:
SpoinkyNL committed 2020-07-25 23:01:37 +02:00
1 parent 64a1010100
commit beff2a0788
13 files changed
+584 -396

No files matched your search

+2 -2
View File
@@ -70,12 +70,12 @@ namespace Artemis.Core.Models.Profile
// Update the layer timeline, this will give us a new delta time which could be negative in case the main segment wrapped back
// to it's start
var timelineDeltaTime = UpdateTimeline(deltaTime);
UpdateTimeline(deltaTime);
foreach (var baseLayerEffect in LayerEffects.Where(e => e.Enabled))
{
baseLayerEffect.BaseProperties?.Update();
baseLayerEffect.Update(timelineDeltaTime);
baseLayerEffect.Update(deltaTime);
}
// Iterate the children in reverse because that's how they must be rendered too
+40 -5
View File
@@ -70,7 +70,6 @@ namespace Artemis.Core.Models.Profile
General.PropertyGroupInitialized += GeneralOnPropertyGroupInitialized;
ApplyRenderElementEntity();
ApplyRenderElementDefaults();
}
internal LayerEntity LayerEntity { get; set; }
@@ -224,17 +223,17 @@ namespace Artemis.Core.Models.Profile
// Update the layer timeline, this will give us a new delta time which could be negative in case the main segment wrapped back
// to it's start
var timelineDeltaTime = UpdateTimeline(deltaTime);
UpdateTimeline(deltaTime);
General.Update();
Transform.Update();
LayerBrush.BaseProperties?.Update();
LayerBrush.Update(timelineDeltaTime);
LayerBrush.Update(deltaTime);
foreach (var baseLayerEffect in LayerEffects.Where(e => e.Enabled))
{
baseLayerEffect.BaseProperties?.Update();
baseLayerEffect.Update(timelineDeltaTime);
baseLayerEffect.Update(deltaTime);
}
}
@@ -256,7 +255,10 @@ namespace Artemis.Core.Models.Profile
else
{
var progress = timeOverride.TotalMilliseconds % MainSegmentLength.TotalMilliseconds;
TimelinePosition = TimeSpan.FromMilliseconds(progress) + StartSegmentLength;
if (progress > 0)
TimelinePosition = TimeSpan.FromMilliseconds(progress) + StartSegmentLength;
else
TimelinePosition = StartSegmentLength;
}
}
else
@@ -437,6 +439,39 @@ namespace Artemis.Core.Models.Profile
return position;
}
/// <summary>
/// Excludes the provided path from the translations applied to the layer by applying translations that cancel the
/// layer translations out
/// </summary>
/// <param name="path"></param>
public void ExcludePathFromTranslation(SKPath path)
{
var sizeProperty = Transform.Scale.CurrentValue;
var rotationProperty = Transform.Rotation.CurrentValue;
var anchorPosition = GetLayerAnchorPosition(Path);
var anchorProperty = Transform.AnchorPoint.CurrentValue;
// Translation originates from the unscaled center of the shape and is tied to the anchor
var x = anchorPosition.X - Bounds.MidX - anchorProperty.X * Bounds.Width;
var y = anchorPosition.Y - Bounds.MidY - anchorProperty.Y * Bounds.Height;
var reversedXScale = 1f / (sizeProperty.Width / 100f);
var reversedYScale = 1f / (sizeProperty.Height / 100f);
if (General.FillType == LayerFillType.Stretch)
{
path.Transform(SKMatrix.MakeRotationDegrees(rotationProperty * -1, anchorPosition.X, anchorPosition.Y));
path.Transform(SKMatrix.MakeScale(reversedXScale, reversedYScale, anchorPosition.X, anchorPosition.Y));
path.Transform(SKMatrix.MakeTranslation(x * -1, y * -1));
}
else
{
path.Transform(SKMatrix.MakeRotationDegrees(rotationProperty * -1, anchorPosition.X, anchorPosition.Y));
path.Transform(SKMatrix.MakeTranslation(x * -1, y * -1));
}
}
#endregion
#region LED management
@@ -17,8 +17,7 @@ namespace Artemis.Core.Models.Profile
{
protected void ApplyRenderElementDefaults()
{
if (MainSegmentLength <= TimeSpan.Zero)
MainSegmentLength = TimeSpan.FromSeconds(5);
MainSegmentLength = TimeSpan.FromSeconds(5);
}
protected void ApplyRenderElementEntity()