mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2026-11-11 04:56:44 +00:00
Refactored brushes to perform a multi-pass rendering.
This allows effects to change the calculated values.
This commit is contained in:
1 parent
ba80ef9848
commit
8d32c73b6d
15 files changed
+159
-97
No files matched your search
@@ -28,17 +28,17 @@ namespace Example_AudioAnalyzer_full
|
||||
|
||||
#region Methods
|
||||
|
||||
public override Color GetColorAtPoint(RectangleF rectangle, PointF point)
|
||||
protected override Color GetColorAtPoint(RectangleF rectangle, BrushRenderTarget renderTarget)
|
||||
{
|
||||
if (_soundDataProcessor?.BarValues == null) return Color.Transparent;
|
||||
|
||||
// This logic is also stolen from AterialDawn
|
||||
int barSampleIndex = (int)Math.Floor(_soundDataProcessor.BarValues.Length * (point.X / (rectangle.X + rectangle.Width))); // Calculate bar sampling index
|
||||
int barSampleIndex = (int)Math.Floor(_soundDataProcessor.BarValues.Length * (renderTarget.Point.X / (rectangle.X + rectangle.Width))); // Calculate bar sampling index
|
||||
float curBarHeight = 1f - Utility.Clamp(_soundDataProcessor.BarValues[barSampleIndex], 0f, 1f); // Invert this value since the keyboard is laid out with topleft being point 0,0
|
||||
float verticalPos = (point.Y / rectangle.Height);
|
||||
float verticalPos = (renderTarget.Point.Y / rectangle.Height);
|
||||
|
||||
// If the barHeight is lower than the vertical pos currently calculated return the brush value. Otherwise do nothing by returning transparent.
|
||||
return curBarHeight <= verticalPos ? base.GetColorAtPoint(rectangle, point) : Color.Transparent;
|
||||
return curBarHeight <= verticalPos ? base.GetColorAtPoint(rectangle, renderTarget) : Color.Transparent;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in new issue
Block a user