rj-action-library/Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GreyScaleEffect.cs

40 lines
801 B
C#

using Godot;
using Godot.Collections;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class GreyScaleEffect:SingleShaderCompositorEffect
{
public static readonly string shaderPath = Path( "GreyScale/GrayScaleShader.glsl" );
protected override void OnConfigure()
{
EffectCallbackType = EffectCallbackTypeEnum.PostTransparent;
_shaderPath = shaderPath;
_groupSize = 8;
}
protected override void SetConstants()
{
constants.Set(
(Vector2)context.internalSize,
Vector2.Zero
);
}
protected override void RenderView()
{
context.AssignScreenColorTexture();
context.pushConstants = constants;
context.ProcessComputeProgram();
}
}
}