rj-action-library/Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurEffect.cs

57 lines
1.1 KiB
C#
Raw Normal View History

2025-04-23 12:00:43 +00:00
using Godot;
using Godot.Collections;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class RadialBlurEffect:SingleShaderCompositorEffect
{
public static readonly string shaderPath =
RokojoriPlugin.Path( "Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurShader.glsl" );
[Export]
public Vector2 center = new Vector2( 0.5f, 0.5f );
[Export]
public float radius = 0.5f;
[Export]
public float intensity = 0.5f;
[Export]
public float samples = 16f;
protected override void OnConfigure()
{
EffectCallbackType = EffectCallbackTypeEnum.PostTransparent;
_shaderPath = shaderPath;
_groupSize = 32;
}
RDPushConstants constants = new RDPushConstants();
protected override void ForAllViews()
{
constants.Set(
center,
radius,
intensity,
samples,
Vector2.Zero
);
}
protected override void RenderView()
{
context.Assign_ScreenColorTexture();
context.pushConstants = constants;
context.Render();
}
}
}