rj-action-library/Runtime/Rendering/CompositorEffects/RadialBlur2/RadialBlur2.cs

82 lines
1.5 KiB
C#

using Godot;
using Godot.Collections;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class RadialBlur2:_XX_CompositorEffectGraph
{
public RadialBlur2()
{
CreateGraphNodes();
}
[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;
CEG_ScreenColorTexure screenColorTexture;
CEG_BufferTexture bufferTexture;
CEG_Copy copy;
CEG_RadialBlur radialBlur;
void Initialize()
{
CreateGraphNodes();
ConnectGraph();
AssignData();
}
void CreateGraphNodes()
{
screenColorTexture = new CEG_ScreenColorTexure( this );
bufferTexture = CEG_BufferTexture.ScreenSize( this );
copy = new CEG_Copy( this );
radialBlur = new CEG_RadialBlur( this );
}
void ConnectGraph()
{
copy.SetTextureSlotInputs( screenColorTexture, bufferTexture );
radialBlur.SetTextureSlotInputs( copy.output, copy.input );
SetProcessOrder(
screenColorTexture, bufferTexture,
copy, radialBlur
);
}
void AssignData()
{
radialBlur.constants.Set(
center,
radius,
intensity,
samples,
Vector2.Zero
);
}
protected override void OnPreProcess()
{
AssignData();
}
}
}