From 7f618ec58ce8d293dc448c2b04e9bd626228cb47 Mon Sep 17 00:00:00 2001 From: routersys Date: Tue, 20 Oct 2026 18:34:23 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=91=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=81=AE=E8=AA=AD=E3=81=BF=E5=8F=96=E3=82=8A=E3=82=921?= =?UTF-8?q?=E3=81=A4=E3=81=AE=E9=96=A2=E6=95=B0=E3=81=AB=E3=81=BE=E3=81=A8?= =?UTF-8?q?=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inflate/InflateEffectProcessor.cs | 41 ++++++++++++++----------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/Inflate/InflateEffectProcessor.cs b/Inflate/InflateEffectProcessor.cs index ffc01a2..5f3c33e 100644 --- a/Inflate/InflateEffectProcessor.cs +++ b/Inflate/InflateEffectProcessor.cs @@ -63,17 +63,6 @@ internal sealed class InflateEffectProcessor : VideoEffectProcessorBase var length = effectDescription.ItemDuration.Frame; var fps = effectDescription.FPS; var amount = (float)(_item.Amount.GetValue(frame, length, fps) / 100.0); - var parameters = new InflatePipeline.Parameters( - _item.Quality, - (float)(_item.Height.GetValue(frame, length, fps) / 100.0), - (float)_item.LightDirection.GetValue(frame, length, fps), - (float)_item.LightElevation.GetValue(frame, length, fps), - (float)(_item.Ambient.GetValue(frame, length, fps) / 100.0), - (float)(_item.Specular.GetValue(frame, length, fps) / 100.0), - (float)(_item.Sharpness.GetValue(frame, length, fps) / 100.0), - (float)(_item.Reflection.GetValue(frame, length, fps) / 100.0), - (float)(_item.Rim.GetValue(frame, length, fps) / 100.0), - (float)(_item.ColorKeep.GetValue(frame, length, fps) / 100.0)); if (_isFirst || _amount != amount) _effect.Amount = amount; @@ -107,17 +96,7 @@ internal sealed class InflateEffectProcessor : VideoEffectProcessorBase RenderInput(new Vortice.RawRectF(bounds.Left, bounds.Top, bounds.Left + width, bounds.Top + height)); - var pipelineParameters = new InflatePipeline.Parameters( - parameters.Quality, - Math.Clamp(parameters.Height, 0f, InflateSettings.MaximumHeight), - Math.Clamp(parameters.LightAzimuth, -InflateSettings.LightAzimuthLimitDegrees, InflateSettings.LightAzimuthLimitDegrees), - Math.Clamp(parameters.LightElevation, 0f, InflateSettings.MaximumLightElevationDegrees), - Math.Clamp(parameters.Ambient, 0f, 1f), - Math.Clamp(parameters.Specular, 0f, InflateSettings.MaximumSpecular), - Math.Clamp(parameters.Sharpness, 0f, 1f), - Math.Clamp(parameters.Reflection, 0f, 1f), - Math.Clamp(parameters.Rim, 0f, 1f), - Math.Clamp(parameters.ColorKeep, 0f, 1f)); + var pipelineParameters = ReadParameters(frame, length, fps); var simulation = _pipeline.Simulate( _resourceSet.GetSourceComputeBinding(), @@ -176,6 +155,24 @@ internal sealed class InflateEffectProcessor : VideoEffectProcessorBase return effectDescription.DrawDescription; } + private InflatePipeline.Parameters ReadParameters(int frame, int length, int fps) + { + float Percent(Animation animation, float maximum) + => Math.Clamp((float)(animation.GetValue(frame, length, fps) / 100.0), 0f, maximum); + + return new InflatePipeline.Parameters( + _item.Quality, + Percent(_item.Height, InflateSettings.MaximumHeight), + Math.Clamp((float)_item.LightDirection.GetValue(frame, length, fps), -InflateSettings.LightAzimuthLimitDegrees, InflateSettings.LightAzimuthLimitDegrees), + Math.Clamp((float)_item.LightElevation.GetValue(frame, length, fps), 0f, InflateSettings.MaximumLightElevationDegrees), + Percent(_item.Ambient, 1f), + Percent(_item.Specular, InflateSettings.MaximumSpecular), + Percent(_item.Sharpness, 1f), + Percent(_item.Reflection, 1f), + Percent(_item.Rim, 1f), + Percent(_item.ColorKeep, 1f)); + } + private bool OutputCovers(int width, int height) => _outputLease is { IsDisposed: false } lease && lease.Width >= width &&