diff --git a/Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestEffect.cs similarity index 83% rename from Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestEffect.cs rename to Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestEffect.cs index bcb0fcb..da36ebd 100644 --- a/Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestEffect.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestEffect.cs @@ -10,10 +10,7 @@ namespace Rokojori [GlobalClass] public partial class AlphaGrabTestEffect:SingleShaderCompositorEffect { - public static readonly string shaderPath = - RokojoriPlugin.Path( "Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl" ); - - + public static readonly string shaderPath = Path( "AlphaGrabTest/AlphaGrabTestShader.glsl" ); protected override void OnConfigure() { @@ -29,12 +26,13 @@ namespace Rokojori byte[] _data; bool _ready = false; bool _canDraw = true; + public async Task GetImageTexture( System.Func waiter ) { var fmt = _bufferTexture.format; var imgF = Image.Format.Rgbah; - var data = _rd.TextureGetData( _bufferTexture.rid, 0 ); + var data = context.renderingDevice.TextureGetData( _bufferTexture.rid, 0 ); var image = Image.CreateFromData( (int) fmt.Width, (int)fmt.Height, false, imgF, data ); return ImageTexture.CreateFromImage( image ); @@ -54,8 +52,8 @@ namespace Rokojori protected override void RenderView() { - _bufferTexture = RDTexture.EnsureScreenSizeTexture( _bufferTexture, this ); - _copyTexture = RDTexture.EnsureScreenSizeTexture( _copyTexture, this ); + _bufferTexture = RDTexture.EnsureScreenSizeTexture( _bufferTexture, context ); + _copyTexture = RDTexture.EnsureScreenSizeTexture( _copyTexture, context ); context.AssignScreenColorTexture(); context.AssignTexture( _bufferTexture ); @@ -63,7 +61,7 @@ namespace Rokojori // context.pushConstants = constants; - context.Render(); + context.ProcessComputeProgram(); } } diff --git a/Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestEffect.cs.uid similarity index 100% rename from Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestEffect.cs.uid rename to Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestEffect.cs.uid diff --git a/Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl b/Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl.import new file mode 100644 index 0000000..891b658 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://b0sbxsqka4svp" +path="res://.godot/imported/AlphaGrabTestShader.glsl-5702cdc3b0621155b6f7f01fc32fd0e7.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl" +dest_files=["res://.godot/imported/AlphaGrabTestShader.glsl-5702cdc3b0621155b6f7f01fc32fd0e7.res"] + +[params] + diff --git a/Runtime/Rendering/CompositorEffects/Blur/BlurCompositorEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurCompositorEffect.cs similarity index 98% rename from Runtime/Rendering/CompositorEffects/Blur/BlurCompositorEffect.cs rename to Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurCompositorEffect.cs index 870f5bf..1460725 100644 --- a/Runtime/Rendering/CompositorEffects/Blur/BlurCompositorEffect.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurCompositorEffect.cs @@ -64,7 +64,7 @@ namespace Rokojori RJLog.Log( "Initializing succeed, loading shader" ); //Make sure this is correctly pointing to the GLSL file - RDShaderFile glslFile = ( RDShaderFile ) GD.Load( "res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/Blur/BlurEffect.glsl" ); + RDShaderFile glslFile = ( RDShaderFile ) GD.Load( RokojoriCompositorEffect.Path( "Blur/BlurEffect.glsl" ) ); shader = rd.ShaderCreateFromSpirV( glslFile.GetSpirV() ); pipeline = rd.ComputePipelineCreate( shader ); diff --git a/Runtime/Rendering/CompositorEffects/Blur/BlurCompositorEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurCompositorEffect.cs.uid similarity index 100% rename from Runtime/Rendering/CompositorEffects/Blur/BlurCompositorEffect.cs.uid rename to Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurCompositorEffect.cs.uid diff --git a/Runtime/Rendering/CompositorEffects/Blur/BlurEffect.glsl b/Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurEffect.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/Blur/BlurEffect.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurEffect.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurEffect.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurEffect.glsl.import new file mode 100644 index 0000000..81b8b01 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurEffect.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://b7s44e3k68axi" +path="res://.godot/imported/BlurEffect.glsl-2976c2aaa6ede28da3481e2bef2cf488.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Blur/BlurEffect.glsl" +dest_files=["res://.godot/imported/BlurEffect.glsl-2976c2aaa6ede28da3481e2bef2cf488.res"] + +[params] + diff --git a/Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingEffect.cs similarity index 84% rename from Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingEffect.cs rename to Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingEffect.cs index ac3626f..0d67ffe 100644 --- a/Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingEffect.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingEffect.cs @@ -9,9 +9,7 @@ namespace Rokojori [GlobalClass] public partial class DepthAntiAliasingEffect:SingleShaderCompositorEffect { - public static readonly string shaderPath = - RokojoriPlugin.Path( "Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl" ); - + public static readonly string shaderPath = Path( "DepthAntiAliasing/DepthAntiAliasingShader.glsl" ); RDSampler sampler; @@ -50,7 +48,7 @@ namespace Rokojori { base.OnInitialize(); - sampler = Sampler( RenderingDevice.SamplerFilter.Nearest, RenderingDevice.SamplerRepeatMode.ClampToEdge ); + sampler = context.Sampler( RenderingDevice.SamplerFilter.Nearest, RenderingDevice.SamplerRepeatMode.ClampToEdge ); } @@ -76,7 +74,7 @@ namespace Rokojori context.pushConstants = constants; - context.Render(); + context.ProcessComputeProgram(); } } diff --git a/Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingEffect.cs.uid similarity index 100% rename from Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingEffect.cs.uid rename to Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingEffect.cs.uid diff --git a/Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl b/Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl diff --git a/Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl.import similarity index 50% rename from Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl.import rename to Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl.import index 17d37f1..1c0f3be 100644 --- a/Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl.import +++ b/Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl.import @@ -3,12 +3,12 @@ importer="glsl" type="RDShaderFile" uid="uid://us4n0un8oo2v" -path="res://.godot/imported/DepthAntiAliasingShader.glsl-ea5a9a21bccd9baeec39a54eb65d5afd.res" +path="res://.godot/imported/DepthAntiAliasingShader.glsl-51ad5443a76812922ed37cac7bc9291d.res" [deps] -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl" -dest_files=["res://.godot/imported/DepthAntiAliasingShader.glsl-ea5a9a21bccd9baeec39a54eb65d5afd.res"] +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/DepthAntiAliasing/DepthAntiAliasingShader.glsl" +dest_files=["res://.godot/imported/DepthAntiAliasingShader.glsl-51ad5443a76812922ed37cac7bc9291d.res"] [params] diff --git a/Runtime/Rendering/CompositorEffects/DepthView/DepthViewEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewEffect.cs similarity index 76% rename from Runtime/Rendering/CompositorEffects/DepthView/DepthViewEffect.cs rename to Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewEffect.cs index 02c4d8c..ca3c4ca 100644 --- a/Runtime/Rendering/CompositorEffects/DepthView/DepthViewEffect.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewEffect.cs @@ -9,11 +9,8 @@ namespace Rokojori [GlobalClass] public partial class DepthViewEffect:SingleShaderCompositorEffect { - public static readonly string shaderPath = - RokojoriPlugin.Path( "Runtime/Rendering/CompositorEffects/DepthView/DepthViewShader.glsl" ); + public static readonly string shaderPath = Path( "DepthView/DepthViewShader.glsl" ); - - RDPushConstants constants = new RDPushConstants(); RDSampler sampler; [Export( PropertyHint.Range, "0,1") ] @@ -36,7 +33,7 @@ namespace Rokojori { base.OnInitialize(); - sampler = Sampler( RenderingDevice.SamplerFilter.Nearest, RenderingDevice.SamplerRepeatMode.ClampToEdge ); + sampler = context.Sampler( RenderingDevice.SamplerFilter.Nearest, RenderingDevice.SamplerRepeatMode.ClampToEdge ); } protected override void SetConstants() @@ -55,7 +52,7 @@ namespace Rokojori context.pushConstants = constants; - context.Render(); + context.ProcessComputeProgram(); } } diff --git a/Runtime/Rendering/CompositorEffects/DepthView/DepthViewEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewEffect.cs.uid similarity index 100% rename from Runtime/Rendering/CompositorEffects/DepthView/DepthViewEffect.cs.uid rename to Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewEffect.cs.uid diff --git a/Runtime/Rendering/CompositorEffects/DepthView/DepthViewShader.glsl b/Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewShader.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/DepthView/DepthViewShader.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewShader.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewShader.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewShader.glsl.import new file mode 100644 index 0000000..1f33f9b --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewShader.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://ccufacegh2n8s" +path="res://.godot/imported/DepthViewShader.glsl-d09858ccee0b4cebdfc21e9d288c8d06.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/DepthView/DepthViewShader.glsl" +dest_files=["res://.godot/imported/DepthViewShader.glsl-d09858ccee0b4cebdfc21e9d288c8d06.res"] + +[params] + diff --git a/Runtime/Rendering/CompositorEffects/GreyScale/GrayScaleShader.glsl b/Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GrayScaleShader.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/GreyScale/GrayScaleShader.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GrayScaleShader.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GrayScaleShader.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GrayScaleShader.glsl.import new file mode 100644 index 0000000..15fce41 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GrayScaleShader.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://biw2n3t4ci7t" +path="res://.godot/imported/GrayScaleShader.glsl-0a4b79670c58543930a6cf627ff753f4.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GrayScaleShader.glsl" +dest_files=["res://.godot/imported/GrayScaleShader.glsl-0a4b79670c58543930a6cf627ff753f4.res"] + +[params] + diff --git a/Runtime/Rendering/CompositorEffects/GreyScale/GreyScaleEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GreyScaleEffect.cs similarity index 79% rename from Runtime/Rendering/CompositorEffects/GreyScale/GreyScaleEffect.cs rename to Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GreyScaleEffect.cs index 7afc836..128c8af 100644 --- a/Runtime/Rendering/CompositorEffects/GreyScale/GreyScaleEffect.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GreyScaleEffect.cs @@ -9,8 +9,7 @@ namespace Rokojori [GlobalClass] public partial class GreyScaleEffect:SingleShaderCompositorEffect { - public static readonly string shaderPath = - RokojoriPlugin.Path( "Runtime/Rendering/CompositorEffects/GreyScale/GrayScaleShader.glsl" ); + public static readonly string shaderPath = Path( "GreyScale/GrayScaleShader.glsl" ); protected override void OnConfigure() @@ -34,7 +33,7 @@ namespace Rokojori context.pushConstants = constants; - context.Render(); + context.ProcessComputeProgram(); } } diff --git a/Runtime/Rendering/CompositorEffects/GreyScale/GreyScaleEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GreyScaleEffect.cs.uid similarity index 100% rename from Runtime/Rendering/CompositorEffects/GreyScale/GreyScaleEffect.cs.uid rename to Runtime/Rendering/Compositor/CompositorEffects/GreyScale/GreyScaleEffect.cs.uid diff --git a/Runtime/Rendering/CompositorEffects/Pixelation/PixelationEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationEffect.cs similarity index 82% rename from Runtime/Rendering/CompositorEffects/Pixelation/PixelationEffect.cs rename to Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationEffect.cs index ac49280..159f0df 100644 --- a/Runtime/Rendering/CompositorEffects/Pixelation/PixelationEffect.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationEffect.cs @@ -9,8 +9,7 @@ namespace Rokojori [GlobalClass] public partial class PixelationEffect:SingleShaderCompositorEffect { - public static readonly string shaderPath = - RokojoriPlugin.Path( "Runtime/Rendering/CompositorEffects/Pixelation/PixelationShader.glsl" ); + public static readonly string shaderPath = Path( "Pixelation/PixelationShader.glsl" ); [Export] public float pixelSize = 1f; @@ -39,7 +38,7 @@ namespace Rokojori context.pushConstants = constants; - context.Render(); + context.ProcessComputeProgram(); } } diff --git a/Runtime/Rendering/CompositorEffects/Pixelation/PixelationEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationEffect.cs.uid similarity index 100% rename from Runtime/Rendering/CompositorEffects/Pixelation/PixelationEffect.cs.uid rename to Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationEffect.cs.uid diff --git a/Runtime/Rendering/CompositorEffects/Pixelation/PixelationShader.glsl b/Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationShader.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/Pixelation/PixelationShader.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationShader.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationShader.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationShader.glsl.import new file mode 100644 index 0000000..8bfda39 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationShader.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://ghbawysn1d3c" +path="res://.godot/imported/PixelationShader.glsl-927856b0a13769ea6d6a031cc7878cd6.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Pixelation/PixelationShader.glsl" +dest_files=["res://.godot/imported/PixelationShader.glsl-927856b0a13769ea6d6a031cc7878cd6.res"] + +[params] + diff --git a/Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurEffect.cs similarity index 83% rename from Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurEffect.cs rename to Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurEffect.cs index 1e9e668..c980a65 100644 --- a/Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurEffect.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurEffect.cs @@ -9,8 +9,7 @@ namespace Rokojori [GlobalClass] public partial class RadialBlurEffect:SingleShaderCompositorEffect { - public static readonly string shaderPath = - RokojoriPlugin.Path( "Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurShader.glsl" ); + public static readonly string shaderPath = Path( "RadialBlur/RadialBlurShader.glsl" ); [Export] public Vector2 center = new Vector2( 0.5f, 0.5f ); @@ -49,7 +48,7 @@ namespace Rokojori context.pushConstants = constants; - context.Render(); + context.ProcessComputeProgram(); } } diff --git a/Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurEffect.cs.uid similarity index 100% rename from Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurEffect.cs.uid rename to Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurEffect.cs.uid diff --git a/Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurShader.glsl b/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurShader.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurShader.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurShader.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurShader.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurShader.glsl.import new file mode 100644 index 0000000..a31cdc9 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurShader.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://yioccj34hlex" +path="res://.godot/imported/RadialBlurShader.glsl-2f269c12bf2dd3e246c931195b015d45.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur/RadialBlurShader.glsl" +dest_files=["res://.godot/imported/RadialBlurShader.glsl-2f269c12bf2dd3e246c931195b015d45.res"] + +[params] + diff --git a/Runtime/Rendering/CompositorEffects/RadialBlur2/RadialBlur2.cs b/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur2/RadialBlur2.cs similarity index 53% rename from Runtime/Rendering/CompositorEffects/RadialBlur2/RadialBlur2.cs rename to Runtime/Rendering/Compositor/CompositorEffects/RadialBlur2/RadialBlur2.cs index 5ee3a7d..c3cc240 100644 --- a/Runtime/Rendering/CompositorEffects/RadialBlur2/RadialBlur2.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur2/RadialBlur2.cs @@ -7,9 +7,9 @@ namespace Rokojori { [Tool] [GlobalClass] - public partial class RadialBlur2:_XX_CompositorEffectGraph + public partial class RadialBlur2:RDGraphCompositorEffect { - public RadialBlur2() + public RadialBlur2():base() { Initialize(); } @@ -31,41 +31,33 @@ namespace Rokojori CEG_BufferTexture bufferTexture; CEG_Copy copy; - CEG_RadialBlur radialBlur; - + CEG_RadialBlur radialBlur; void Initialize() { - CreateGraphNodes(); - ConnectGraph(); - AssignData(); - } + screenColorTexture = new CEG_ScreenColorTexure( graph ); + bufferTexture = CEG_BufferTexture.ScreenSize( graph ); - void CreateGraphNodes() - { - screenColorTexture = new CEG_ScreenColorTexure( this ); - bufferTexture = CEG_BufferTexture.ScreenSize( this ); + copy = new CEG_Copy( graph ); + radialBlur = new CEG_RadialBlur( graph ); - copy = new CEG_Copy( this ); - radialBlur = new CEG_RadialBlur( this ); - _processors = new List{ screenColorTexture, bufferTexture, copy, radialBlur }; - _processors.ForEach( p => p.Initialize() ); - } + graph.InitializeNodes(); + + - void ConnectGraph() - { copy.SetTextureSlotInputs( screenColorTexture, bufferTexture ); radialBlur.SetTextureSlotInputs( copy.output, copy.input ); - SetProcessOrder( + graph.SetProcessOrder( screenColorTexture, bufferTexture, copy, radialBlur ); } - - void AssignData() + + + protected override void ForAllViews() { radialBlur.constants.Set( center, @@ -76,10 +68,6 @@ namespace Rokojori ); } - protected override void OnPreProcess() - { - AssignData(); - } - + } } \ No newline at end of file diff --git a/Runtime/Rendering/CompositorEffects/RadialBlur2/RadialBlur2.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/RadialBlur2/RadialBlur2.cs.uid similarity index 100% rename from Runtime/Rendering/CompositorEffects/RadialBlur2/RadialBlur2.cs.uid rename to Runtime/Rendering/Compositor/CompositorEffects/RadialBlur2/RadialBlur2.cs.uid diff --git a/Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmear.glsl b/Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmear.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmear.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmear.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmear.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmear.glsl.import new file mode 100644 index 0000000..b656a5a --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmear.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://cd1ysd752pjrn" +path="res://.godot/imported/TemporalSmear.glsl-9560df032a34c0eac9345bfb92a4fe20.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmear.glsl" +dest_files=["res://.godot/imported/TemporalSmear.glsl-9560df032a34c0eac9345bfb92a4fe20.res"] + +[params] + diff --git a/Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmearEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmearEffect.cs similarity index 88% rename from Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmearEffect.cs rename to Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmearEffect.cs index 55d8e5e..155a8a6 100644 --- a/Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmearEffect.cs +++ b/Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmearEffect.cs @@ -9,8 +9,7 @@ namespace Rokojori [GlobalClass] public partial class TemporalSmearEffect:SingleShaderCompositorEffect { - public static readonly string shaderPath = - RokojoriPlugin.Path( "Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmear.glsl" ); + public static readonly string shaderPath = Path( "TemporalSmear/TemporalSmear.glsl" ); [Export( PropertyHint.Range, "0,1")] public float amount = 1f; @@ -58,7 +57,7 @@ namespace Rokojori protected override void RenderView() { - _bufferTexture = RDTexture.EnsureScreenSizeTexture( _bufferTexture, this ); + _bufferTexture = RDTexture.EnsureScreenSizeTexture( _bufferTexture, context ); context.AssignTexture( _bufferTexture ); context.AssignScreenColorTexture(); @@ -66,7 +65,7 @@ namespace Rokojori context.pushConstants = constants; - context.Render(); + context.ProcessComputeProgram(); } } diff --git a/Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmearEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmearEffect.cs.uid similarity index 100% rename from Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmearEffect.cs.uid rename to Runtime/Rendering/Compositor/CompositorEffects/TemporalSmear/TemporalSmearEffect.cs.uid diff --git a/Runtime/Rendering/CompositorEffects/TextureDilation/Copy.glsl b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/Copy.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/TextureDilation/Copy.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/Copy.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/Copy.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/Copy.glsl.import new file mode 100644 index 0000000..d862623 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/Copy.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://b281d2ovcc1wm" +path="res://.godot/imported/Copy.glsl-691649f2edc1532cdaf82fe24cf0a825.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/Copy.glsl" +dest_files=["res://.godot/imported/Copy.glsl-691649f2edc1532cdaf82fe24cf0a825.res"] + +[params] + diff --git a/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Assign.glsl b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Assign.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Assign.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Assign.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Assign.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Assign.glsl.import new file mode 100644 index 0000000..bb81636 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Assign.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://fjarrr31htov" +path="res://.godot/imported/JFA_Assign.glsl-60af4dba5fb8c409e694413cad0c1fc1.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Assign.glsl" +dest_files=["res://.godot/imported/JFA_Assign.glsl-60af4dba5fb8c409e694413cad0c1fc1.res"] + +[params] + diff --git a/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Initialize.glsl b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Initialize.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Initialize.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Initialize.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Initialize.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Initialize.glsl.import new file mode 100644 index 0000000..66c81ad --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Initialize.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://eqgl8l1lmgrl" +path="res://.godot/imported/JFA_Initialize.glsl-eaec1fd1e6da355b3a37aafdebae382c.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Initialize.glsl" +dest_files=["res://.godot/imported/JFA_Initialize.glsl-eaec1fd1e6da355b3a37aafdebae382c.res"] + +[params] + diff --git a/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Step.glsl b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Step.glsl similarity index 100% rename from Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Step.glsl rename to Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Step.glsl diff --git a/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Step.glsl.import b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Step.glsl.import new file mode 100644 index 0000000..f2b79e5 --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Step.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://b263k73iy5pbl" +path="res://.godot/imported/JFA_Step.glsl-f98466c4d4be76f4e3f5470b1ad291a6.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/JFA_Step.glsl" +dest_files=["res://.godot/imported/JFA_Step.glsl-f98466c4d4be76f4e3f5470b1ad291a6.res"] + +[params] + diff --git a/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/TextureDilationCompositerEffect.cs b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/TextureDilationCompositerEffect.cs new file mode 100644 index 0000000..1133b7d --- /dev/null +++ b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/TextureDilationCompositerEffect.cs @@ -0,0 +1,19 @@ + +using System.Diagnostics; +using System.Collections; +using System.Collections.Generic; +using System; +using Godot; + + + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class TextureDilationCompositerEffect:RDGraphCompositorEffect + { + + } + +} \ No newline at end of file diff --git a/Runtime/Rendering/CompositorEffects/TextureDilation/TextureDilationCompositerEffect.cs.uid b/Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/TextureDilationCompositerEffect.cs.uid similarity index 100% rename from Runtime/Rendering/CompositorEffects/TextureDilation/TextureDilationCompositerEffect.cs.uid rename to Runtime/Rendering/Compositor/CompositorEffects/TextureDilation/TextureDilationCompositerEffect.cs.uid diff --git a/Runtime/Rendering/Compositor/RDGraphCompositorEffect.cs b/Runtime/Rendering/Compositor/RDGraphCompositorEffect.cs new file mode 100644 index 0000000..a788944 --- /dev/null +++ b/Runtime/Rendering/Compositor/RDGraphCompositorEffect.cs @@ -0,0 +1,26 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class RDGraphCompositorEffect:RokojoriCompositorEffect + { + protected RDGraph _graph; + public RDGraph graph => _graph; + + protected override void OnInitialize() + { + _graph = new RDGraph( context ); + } + + protected override void RenderView() + { + _graph.ProcessForView(); + } + + + } +} diff --git a/Runtime/Rendering/Compositor/RDGraphCompositorEffect.cs.uid b/Runtime/Rendering/Compositor/RDGraphCompositorEffect.cs.uid new file mode 100644 index 0000000..e102674 --- /dev/null +++ b/Runtime/Rendering/Compositor/RDGraphCompositorEffect.cs.uid @@ -0,0 +1 @@ +uid://c14vrtrstrhi8 diff --git a/Runtime/Rendering/Compositor/RokojoriCompositorEffect.cs b/Runtime/Rendering/Compositor/RokojoriCompositorEffect.cs new file mode 100644 index 0000000..0305845 --- /dev/null +++ b/Runtime/Rendering/Compositor/RokojoriCompositorEffect.cs @@ -0,0 +1,130 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + [Tool] + [GlobalClass] + public partial class RokojoriCompositorEffect:CompositorEffect + { + public static readonly string effectsPath = "res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects"; + public static string Path( string path ) + { + return effectsPath + "/" + path; + } + + RDContext _context; + public RDContext context => _context; + + protected virtual void OnConfigure(){} + protected virtual void OnInitialize(){} + protected virtual void ForAllViews(){} + protected virtual void RenderView(){} + + public RokojoriCompositorEffect():base() + { + RenderingServer.CallOnRenderThread( Callable.From( _InitializeCompositorEffect ) ); + } + + protected void _InitializeCompositorEffect() + { + OnConfigure(); + + _context = new RDContext(); + _context.Initialize(); + + OnInitialize(); + + } + + bool _hasError = false; + + public override void _RenderCallback( int effectCallbackType, RenderData renderData ) + { + if ( _hasError || context.HasError() ) + { + this.LogInfo( context.messages ); + return; + } + + context.messages.Clear(); + + try + { + + if ( context.renderingDevice == null ) + { + context.Error( "No render device" ); + return; + } + + var sceneBuffers = ( RenderSceneBuffersRD ) renderData.GetRenderSceneBuffers(); + var sceneData = ( RenderSceneDataRD ) renderData.GetRenderSceneData(); + + if ( sceneBuffers == null && sceneData == null ) + { + context.Error( "sceneBuffers == null && sceneData == null" ); + return; + } + + + + var size = sceneBuffers.GetInternalSize(); + + if ( size.X == 0 || size.Y == 0 ) + { + context.Warning( "InternalSize.X == 0 || InternalSize.Y == 0" ); + return; + } + + _context.SetRenderData( renderData, sceneBuffers, sceneData ); + _context.SetView( -1 ); + + ForAllViews(); + + int viewCount = ( int ) sceneBuffers.GetViewCount(); + + for ( int i = 0; i < viewCount; i++ ) + { + _context.SetView( i ); + RenderView(); + } + + } + catch( System.Exception e ) + { + this.LogError( e ); + _hasError = true; + } + + if ( context.HasError() ) + { + _hasError = true; + } + + } + + public override void _Notification( int what ) + { + var _shader = context.shader; + + context.Verbose( "Got notification: ", what ); + + if ( what != NotificationPredelete || ( _shader == null || !_shader.valid ) || context.renderingDevice == null ) + { + context.Verbose( + "what != NotificationPredelete", what != NotificationPredelete, + "( _shader == null || !_shader.valid )", ( _shader == null || !_shader.valid ), + "rd == null", context.renderingDevice == null + ); + return; + } + + context.Free( _shader, "Shader" ); + context.CleanUp(); + + } + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Objects/RokojoriCompositorEffect.cs.uid b/Runtime/Rendering/Compositor/RokojoriCompositorEffect.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/RokojoriCompositorEffect.cs.uid rename to Runtime/Rendering/Compositor/RokojoriCompositorEffect.cs.uid diff --git a/Runtime/Rendering/Objects/SingleShaderCompositorEffect.cs b/Runtime/Rendering/Compositor/SingleShaderCompositorEffect.cs similarity index 62% rename from Runtime/Rendering/Objects/SingleShaderCompositorEffect.cs rename to Runtime/Rendering/Compositor/SingleShaderCompositorEffect.cs index 46d2085..483baf5 100644 --- a/Runtime/Rendering/Objects/SingleShaderCompositorEffect.cs +++ b/Runtime/Rendering/Compositor/SingleShaderCompositorEffect.cs @@ -16,11 +16,11 @@ namespace Rokojori protected override void OnInitialize() { - Verbose( "Trying to load shader: ", _shaderPath ); + context.Verbose( "Trying to load shader: ", _shaderPath ); if ( _shaderPath == null ) { - Error( "_shaderPath == null" ); + context.Error( "_shaderPath == null" ); return; } @@ -28,27 +28,27 @@ namespace Rokojori if ( glslFile == null ) { - Error( "Couldn't load shader at path:", _shaderPath ); + context.Error( "Couldn't load shader at path:", _shaderPath ); return; } - _shader = RDShader.CreateFromSpirV( this, glslFile.GetSpirV() ); + _shader = RDShader.CreateFromSpirV( context, glslFile.GetSpirV() ); if ( _shader == null ) { - Error( "Couldn't create shader from code, path:", _shaderPath ); + context.Error( "Couldn't create shader from code, path:", _shaderPath ); return; } - _pipeline = RDPipeline.Create( this, _shader ); + _pipeline = RDPipeline.Create( context, _shader ); if ( _shader == null ) { - Error( "Couldn't create pipeline from compiled shader, path:", _shaderPath ); + context.Error( "Couldn't create pipeline from compiled shader, path:", _shaderPath ); return; } - Verbose( "Created shader at path: ", _shaderPath ); + context.Verbose( "Created shader at path: ", _shaderPath ); context.SetShaderAndPipeline( _shader, _pipeline ); } @@ -58,7 +58,7 @@ namespace Rokojori protected override void ForAllViews() { - context.ComputeGroups( _groupSize ); + context.CalculateComputeGroups( _groupSize ); SetConstants(); } diff --git a/Runtime/Rendering/Objects/SingleShaderCompositorEffect.cs.uid b/Runtime/Rendering/Compositor/SingleShaderCompositorEffect.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/SingleShaderCompositorEffect.cs.uid rename to Runtime/Rendering/Compositor/SingleShaderCompositorEffect.cs.uid diff --git a/Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl.import b/Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl.import deleted file mode 100644 index 773a099..0000000 --- a/Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://b0sbxsqka4svp" -path="res://.godot/imported/AlphaGrabTestShader.glsl-6c0893a67e5a07d0f4ca62efdf6123e9.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/AlphaGrabTest/AlphaGrabTestShader.glsl" -dest_files=["res://.godot/imported/AlphaGrabTestShader.glsl-6c0893a67e5a07d0f4ca62efdf6123e9.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/Blur/BlurEffect.glsl.import b/Runtime/Rendering/CompositorEffects/Blur/BlurEffect.glsl.import deleted file mode 100644 index 1ed8d62..0000000 --- a/Runtime/Rendering/CompositorEffects/Blur/BlurEffect.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://b7s44e3k68axi" -path="res://.godot/imported/BlurEffect.glsl-adc1ff46efeaf20c40c851da38f62fae.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/Blur/BlurEffect.glsl" -dest_files=["res://.godot/imported/BlurEffect.glsl-adc1ff46efeaf20c40c851da38f62fae.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/DepthView/DepthViewShader.glsl.import b/Runtime/Rendering/CompositorEffects/DepthView/DepthViewShader.glsl.import deleted file mode 100644 index df1af13..0000000 --- a/Runtime/Rendering/CompositorEffects/DepthView/DepthViewShader.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://ccufacegh2n8s" -path="res://.godot/imported/DepthViewShader.glsl-c19eff884d9bff6ff641a138482426b5.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/DepthView/DepthViewShader.glsl" -dest_files=["res://.godot/imported/DepthViewShader.glsl-c19eff884d9bff6ff641a138482426b5.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/GreyScale/GrayScaleShader.glsl.import b/Runtime/Rendering/CompositorEffects/GreyScale/GrayScaleShader.glsl.import deleted file mode 100644 index 1baa77d..0000000 --- a/Runtime/Rendering/CompositorEffects/GreyScale/GrayScaleShader.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://biw2n3t4ci7t" -path="res://.godot/imported/GrayScaleShader.glsl-89be3b50af0d77c6515222d93b33ffb3.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/GreyScale/GrayScaleShader.glsl" -dest_files=["res://.godot/imported/GrayScaleShader.glsl-89be3b50af0d77c6515222d93b33ffb3.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/Pixelation/PixelationShader.glsl.import b/Runtime/Rendering/CompositorEffects/Pixelation/PixelationShader.glsl.import deleted file mode 100644 index 8b33dbb..0000000 --- a/Runtime/Rendering/CompositorEffects/Pixelation/PixelationShader.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://ghbawysn1d3c" -path="res://.godot/imported/PixelationShader.glsl-7bf34134c1434ce83105711f1252021f.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/Pixelation/PixelationShader.glsl" -dest_files=["res://.godot/imported/PixelationShader.glsl-7bf34134c1434ce83105711f1252021f.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurShader.glsl.import b/Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurShader.glsl.import deleted file mode 100644 index af2dae9..0000000 --- a/Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurShader.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://yioccj34hlex" -path="res://.godot/imported/RadialBlurShader.glsl-495ace3264af9b141d13d88646f4d37b.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/RadialBlur/RadialBlurShader.glsl" -dest_files=["res://.godot/imported/RadialBlurShader.glsl-495ace3264af9b141d13d88646f4d37b.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmear.glsl.import b/Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmear.glsl.import deleted file mode 100644 index 37e2a5f..0000000 --- a/Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmear.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://cd1ysd752pjrn" -path="res://.godot/imported/TemporalSmear.glsl-b228c3fd9c0b0985d61f64e14d6b8842.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/TemporalSmear/TemporalSmear.glsl" -dest_files=["res://.godot/imported/TemporalSmear.glsl-b228c3fd9c0b0985d61f64e14d6b8842.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/TextureDilation/Copy.glsl.import b/Runtime/Rendering/CompositorEffects/TextureDilation/Copy.glsl.import deleted file mode 100644 index c9b384e..0000000 --- a/Runtime/Rendering/CompositorEffects/TextureDilation/Copy.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://b281d2ovcc1wm" -path="res://.godot/imported/Copy.glsl-440875809e1224bd8f12ab4747b61bfc.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/TextureDilation/Copy.glsl" -dest_files=["res://.godot/imported/Copy.glsl-440875809e1224bd8f12ab4747b61bfc.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Assign.glsl.import b/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Assign.glsl.import deleted file mode 100644 index 347ab56..0000000 --- a/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Assign.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://fjarrr31htov" -path="res://.godot/imported/JFA_Assign.glsl-d64da3d1862c7dbd2f410c2e5f98e270.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Assign.glsl" -dest_files=["res://.godot/imported/JFA_Assign.glsl-d64da3d1862c7dbd2f410c2e5f98e270.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Initialize.glsl.import b/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Initialize.glsl.import deleted file mode 100644 index c3d5f31..0000000 --- a/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Initialize.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://eqgl8l1lmgrl" -path="res://.godot/imported/JFA_Initialize.glsl-8eec6889b219c52896e1b7597ec3dbbd.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Initialize.glsl" -dest_files=["res://.godot/imported/JFA_Initialize.glsl-8eec6889b219c52896e1b7597ec3dbbd.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Step.glsl.import b/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Step.glsl.import deleted file mode 100644 index c96300e..0000000 --- a/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Step.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://b263k73iy5pbl" -path="res://.godot/imported/JFA_Step.glsl-89a0d568e1c875744d558d5c62c00f0b.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/CompositorEffects/TextureDilation/JFA_Step.glsl" -dest_files=["res://.godot/imported/JFA_Step.glsl-89a0d568e1c875744d558d5c62c00f0b.res"] - -[params] - diff --git a/Runtime/Rendering/CompositorEffects/TextureDilation/TextureDilationCompositerEffect.cs b/Runtime/Rendering/CompositorEffects/TextureDilation/TextureDilationCompositerEffect.cs deleted file mode 100644 index 3543cee..0000000 --- a/Runtime/Rendering/CompositorEffects/TextureDilation/TextureDilationCompositerEffect.cs +++ /dev/null @@ -1,32 +0,0 @@ - -using System.Diagnostics; -using System.Collections; -using System.Collections.Generic; -using System; -using Godot; - - - -namespace Rokojori -{ - [Tool] - [GlobalClass] - public partial class TextureDilationCompositerEffect:_XX_CompositorEffectGraph - { - public TextureDilationCompositerEffect() - { - CreateGraph(); - } - - void CreateGraph() - { - - } - - void AssignData() - { - - } - } - -} \ No newline at end of file diff --git a/Runtime/Rendering/Context/RDContext.CleanUp.cs b/Runtime/Rendering/Context/RDContext.CleanUp.cs new file mode 100644 index 0000000..78b6f8a --- /dev/null +++ b/Runtime/Rendering/Context/RDContext.CleanUp.cs @@ -0,0 +1,65 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public partial class RDContext + { + protected List _cleanUps = new List(); + protected List _cleanUpInfo = new List(); + + public void Free( RenderingObject ro, string info = null ) + { + if ( ro == null ) + { + Warning( "ro == null, couldn't clean up: ", info ); + return; + } + + Verbose( "Cleaning up: ", info, ro.rid ); + renderingDevice.FreeRid( ro.rid ); + } + + + public void CleanUp() + { + var index = 0; + + _cleanUps.ForEach( + c => + { + Free( c, "_cleanUps[" + index + "]"); + index ++; + } + ); + + _cleanUps.Clear(); + } + + public void AddToCleanUp( RenderingObject ro, string info = null ) + { + if ( _cleanUps.Contains( ro ) ) + { + return; + } + + _cleanUps.Add( ro ); + _cleanUpInfo.Add( info ); + } + + public void AddToCleanUp( List ro, string info = null ) + { + var index = 0; + info = info == null ? "" : info; + + ro.ForEach( + r => + { + AddToCleanUp( r, info + "["+ index + "]" ); + index ++; + } + ); + } + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Context/RDContext.CleanUp.cs.uid b/Runtime/Rendering/Context/RDContext.CleanUp.cs.uid new file mode 100644 index 0000000..9d70d6c --- /dev/null +++ b/Runtime/Rendering/Context/RDContext.CleanUp.cs.uid @@ -0,0 +1 @@ +uid://tvdeo52a18qd diff --git a/Runtime/Rendering/Context/RDContext.Create.cs b/Runtime/Rendering/Context/RDContext.Create.cs new file mode 100644 index 0000000..4efb384 --- /dev/null +++ b/Runtime/Rendering/Context/RDContext.Create.cs @@ -0,0 +1,38 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public partial class RDContext + { + public RDSampler Sampler( RDSamplerState state = null) + { + if ( state == null ) + { + state = new RDSamplerState(); + state.MinFilter = RenderingDevice.SamplerFilter.Linear; + state.MagFilter = RenderingDevice.SamplerFilter.Linear; + state.RepeatU = RenderingDevice.SamplerRepeatMode.Repeat; + state.RepeatV = RenderingDevice.SamplerRepeatMode.Repeat; + } + + var sampler = RDSampler.Create( this, state ); + return sampler; + } + + public RDSampler Sampler( RenderingDevice.SamplerFilter filter, RenderingDevice.SamplerRepeatMode repeatMode) + { + var state = new RDSamplerState(); + + state.MinFilter = filter; + state.MagFilter = filter; + + state.RepeatU = repeatMode; + state.RepeatV = repeatMode; + + return Sampler( state ); + } + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Context/RDContext.Create.cs.uid b/Runtime/Rendering/Context/RDContext.Create.cs.uid new file mode 100644 index 0000000..2889e7c --- /dev/null +++ b/Runtime/Rendering/Context/RDContext.Create.cs.uid @@ -0,0 +1 @@ +uid://dkjlvi7ir3qur diff --git a/Runtime/Rendering/Context/RDContext.Messages.cs b/Runtime/Rendering/Context/RDContext.Messages.cs new file mode 100644 index 0000000..23cfe0f --- /dev/null +++ b/Runtime/Rendering/Context/RDContext.Messages.cs @@ -0,0 +1,69 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public partial class RDContext + { + protected List _messages = new List(); + public List messages => _messages; + public bool logMessages = true; + public int messageLogLevel = Messages.GetLevel( MessageType.Info ); + + public bool HasError() + { + return Messages.HasError( _messages ); + } + + + public void Error( params object[] messages ) + { + var message = RJLog.GetLogString( messages ); + + Messages.Error( _messages, message ); + + if ( logMessages ) + { + RJLog.Log( message ); + } + } + + public void Warning( params object[] messages ) + { + var message = RJLog.GetLogString( messages ); + + Messages.Warning( _messages, message ); + + if ( logMessages && Messages.GetLevel( MessageType.Warning ) >= messageLogLevel ) + { + RJLog.Log( message ); + } + } + + public void Info( params object[] messages ) + { + var message = RJLog.GetLogString( messages ); + + Messages.Info( _messages, message ); + + if ( logMessages && Messages.GetLevel( MessageType.Info ) >= messageLogLevel ) + { + RJLog.Log( message ); + } + } + + public void Verbose( params object[] messages ) + { + var message = RJLog.GetLogString( messages ); + + Messages.Verbose( _messages, message ); + + if ( logMessages && Messages.GetLevel( MessageType.Verbose ) >= messageLogLevel ) + { + RJLog.Log( message ); + } + } + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Context/RDContext.Messages.cs.uid b/Runtime/Rendering/Context/RDContext.Messages.cs.uid new file mode 100644 index 0000000..fadd953 --- /dev/null +++ b/Runtime/Rendering/Context/RDContext.Messages.cs.uid @@ -0,0 +1 @@ +uid://bq4mu4ti38oj8 diff --git a/Runtime/Rendering/Objects/RokojoriCompositorContext.cs b/Runtime/Rendering/Context/RDContext.cs similarity index 77% rename from Runtime/Rendering/Objects/RokojoriCompositorContext.cs rename to Runtime/Rendering/Context/RDContext.cs index 000475e..fa64b91 100644 --- a/Runtime/Rendering/Objects/RokojoriCompositorContext.cs +++ b/Runtime/Rendering/Context/RDContext.cs @@ -4,33 +4,24 @@ using System.Collections.Generic; namespace Rokojori { - public class RokojoriCompositorContext + public partial class RDContext { - protected RokojoriCompositorEffect _effect; - public RokojoriCompositorEffect effect => _effect; - + protected RenderingDevice _renderingDevice; + public RenderingDevice renderingDevice => _renderingDevice; + protected RDShader _shader; public RDShader shader => _shader; protected RDPipeline _pipeline; public RDPipeline pipeline => _pipeline; - public void SetShaderAndPipeline( RDShader shader, RDPipeline pipeline ) + public void Initialize( bool local = false) { - if ( shader == null || pipeline == null ) - { - _shader = null; - _pipeline = null; - effect.Error( "Shader Pipeline is null", shader, pipeline ); - return; - } - - effect.Verbose( "Set Shader Pipeline", shader, pipeline ); - _shader = shader; - _pipeline = pipeline; - + _renderingDevice = local ? RenderingServer.Singleton.CreateLocalRenderingDevice(): + RenderingServer.Singleton.GetRenderingDevice(); } + protected int _view = -1; public int view => _view; @@ -40,7 +31,6 @@ namespace Rokojori protected RenderData _renderData; public RenderData renderData => _renderData; - protected RenderSceneBuffersRD _sceneBuffers; public RenderSceneBuffersRD sceneBuffers => _sceneBuffers; @@ -62,6 +52,23 @@ namespace Rokojori return RDTexture.Depth( this ); } + + public void SetShaderAndPipeline( RDShader shader, RDPipeline pipeline ) + { + if ( shader == null || pipeline == null ) + { + _shader = null; + _pipeline = null; + Error( "Shader Pipeline is null", shader, pipeline ); + return; + } + + Verbose( "Set Shader Pipeline", shader, pipeline ); + _shader = shader; + _pipeline = pipeline; + + } + public void AssignScreenColorTexture( RDSampler sampler = null, int setIndex = -1 ) { AssignTexture( GetScreenColorTexture(), sampler, setIndex ); @@ -86,12 +93,12 @@ namespace Rokojori if ( sampler == null ) { // effect.Verbose( "Adding Image" ); - AddUniformSet( RDUniformSet.Image( _effect, texture, setIndex ) ); + AddUniformSet( RDUniformSet.Image( this, texture, setIndex ) ); } else { // effect.Verbose( "Adding Sampler" ); - AddUniformSet( RDUniformSet.Sampler( _effect, sampler,texture, setIndex ) ); + AddUniformSet( RDUniformSet.Sampler( this, sampler,texture, setIndex ) ); } } @@ -109,17 +116,17 @@ namespace Rokojori pushConstants = null; } - public void SetGroups( Vector3I groups ) + public void SetComputeGroups( Vector3I groups ) { this._groups = groups; } - public void ComputeGroups( int groupSize ) + public void CalculateComputeGroups( int groupSize ) { - ComputeGroups( new Vector3I( groupSize, groupSize, 0 ) ); + CalculateComputeGroups( new Vector3I( groupSize, groupSize, 0 ) ); } - public void ComputeGroups( Vector3I groupSize ) + public void CalculateComputeGroups( Vector3I groupSize ) { var size = sceneBuffers.GetInternalSize(); @@ -127,15 +134,15 @@ namespace Rokojori var yGroups = groupSize.Y == 0 ? 1 : Mathf.CeilToInt( size.Y / (float) groupSize.Y ); var zGroups = groupSize.Z == 0 ? 1 : Mathf.CeilToInt( size.Y / (float) groupSize.Y ); - SetGroups( new Vector3I( xGroups, yGroups, zGroups ) ); + SetComputeGroups( new Vector3I( xGroups, yGroups, zGroups ) ); } - public void Render() + public void ProcessComputeProgram() { try { - var computeList = RDComputeList.Begin( _effect.rd ); + var computeList = RDComputeList.Begin( _renderingDevice ); computeList.BindPipeline( pipeline ); @@ -161,21 +168,12 @@ namespace Rokojori } catch( System.Exception e ) { - effect.Error( e ); + Error( e ); } Clear(); } - } - - public class EditableRokojoriCompositorContext:RokojoriCompositorContext - { - public void SetEffect( RokojoriCompositorEffect effect ) - { - this._effect = effect; - } - public void SetRenderData( RenderData renderData, RenderSceneBuffersRD buffers, RenderSceneDataRD sceneData ) { this._renderData = renderData; @@ -188,6 +186,5 @@ namespace Rokojori this._view = view; } - } } \ No newline at end of file diff --git a/Runtime/Rendering/Objects/RokojoriCompositorContext.cs.uid b/Runtime/Rendering/Context/RDContext.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/RokojoriCompositorContext.cs.uid rename to Runtime/Rendering/Context/RDContext.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphConnection.cs b/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphConnection.cs deleted file mode 100644 index 905351c..0000000 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphConnection.cs +++ /dev/null @@ -1,16 +0,0 @@ - -using Godot; - -namespace Rokojori -{ - public class CompositorEffectGraphConnection:CompositorEffectGraphNode - { - protected CompositorEffectGraphProcessor _processor; - - public CompositorEffectGraphConnection( CompositorEffectGraphProcessor processor ):base( processor.graph ) - { - _processor = processor; - } - - } -} \ No newline at end of file diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphNode.cs b/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphNode.cs deleted file mode 100644 index d8761e4..0000000 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphNode.cs +++ /dev/null @@ -1,16 +0,0 @@ - -using Godot; - -namespace Rokojori -{ - public class CompositorEffectGraphNode - { - _XX_CompositorEffectGraph _graph; - public _XX_CompositorEffectGraph graph => _graph; - - public CompositorEffectGraphNode( _XX_CompositorEffectGraph graph ) - { - _graph = graph; - } - } -} \ No newline at end of file diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl.import b/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl.import deleted file mode 100644 index cc01625..0000000 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://bqsb2a6poa7b0" -path="res://.godot/imported/RadialBlur.glsl-2a7bbca9e049b45a9edfab7b714dd886.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl" -dest_files=["res://.godot/imported/RadialBlur.glsl-2a7bbca9e049b45a9edfab7b714dd886.res"] - -[params] - diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/Copy.glsl.import b/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/Copy.glsl.import deleted file mode 100644 index aa66041..0000000 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/Copy.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://dkmulxqa0tvis" -path="res://.godot/imported/Copy.glsl-04e877248c733e7d624480658e605c4c.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/Copy.glsl" -dest_files=["res://.godot/imported/Copy.glsl-04e877248c733e7d624480658e605c4c.res"] - -[params] - diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Initialize.glsl.import b/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Initialize.glsl.import deleted file mode 100644 index 8d82ffc..0000000 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Initialize.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://diia0hlqqkna" -path="res://.godot/imported/JFA_Initialize.glsl-805a62d8bfe18f03d3fff707518fb98e.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Initialize.glsl" -dest_files=["res://.godot/imported/JFA_Initialize.glsl-805a62d8bfe18f03d3fff707518fb98e.res"] - -[params] - diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Iterate.glsl.import b/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Iterate.glsl.import deleted file mode 100644 index 678c50e..0000000 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Iterate.glsl.import +++ /dev/null @@ -1,14 +0,0 @@ -[remap] - -importer="glsl" -type="RDShaderFile" -uid="uid://dntu82sa6clb4" -path="res://.godot/imported/JFA_Iterate.glsl-7375b6aced2100cd0023eb6c61803e61.res" - -[deps] - -source_file="res://addons/rokojori_action_library/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Iterate.glsl" -dest_files=["res://.godot/imported/JFA_Iterate.glsl-7375b6aced2100cd0023eb6c61803e61.res"] - -[params] - diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/_XX_CompositorEffectGraph.cs b/Runtime/Rendering/Objects/CompositorEffectGraph/_XX_CompositorEffectGraph.cs deleted file mode 100644 index ccecba0..0000000 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/_XX_CompositorEffectGraph.cs +++ /dev/null @@ -1,58 +0,0 @@ - -using Godot; -using System.Collections.Generic; - -namespace Rokojori -{ - [Tool] - [GlobalClass] - public partial class _XX_CompositorEffectGraph:RokojoriCompositorEffect - { - public static readonly string path = "res://addons/rokojori_action_library/Runtime/Rendering/Objects/CompositorEffectGraph"; - public static string Path( string subPath ) - { - return path + "/" + subPath; - } - - protected List _nodes = new List(); - protected List _processors = new List(); - protected List _processOrder = new List(); - - protected void SetProcessOrder( List order ) - { - _processOrder.Clear(); - _processOrder.AddRange( order ); - } - - protected void SetProcessOrder( params CompositorEffectGraphProcessor[] order ) - { - _processOrder.Clear(); - _processOrder.AddRange( order ); - } - - protected override void RenderView() - { - OnPreProcess(); - - _processOrder.ForEach( - p => - { - Verbose( p.GetType() ); - p.Process(); - } - ); - - OnPostProcess(); - } - - protected virtual void OnPreProcess() - { - - } - - protected virtual void OnPostProcess() - { - - } - } -} \ No newline at end of file diff --git a/Runtime/Rendering/Objects/RDPipeline.cs b/Runtime/Rendering/Objects/RDPipeline.cs index 1713563..307fabe 100644 --- a/Runtime/Rendering/Objects/RDPipeline.cs +++ b/Runtime/Rendering/Objects/RDPipeline.cs @@ -5,12 +5,12 @@ namespace Rokojori { public class RDPipeline: RenderingObject { - public RDPipeline( RokojoriCompositorEffect effect, Rid rid ):base( effect, rid ) + public RDPipeline( RDContext context, Rid rid ):base( context, rid ) {} - public static RDPipeline Create( RokojoriCompositorEffect effect, RDShader shader ) + public static RDPipeline Create( RDContext context, RDShader shader ) { - return new RDPipeline( effect, effect.rd.ComputePipelineCreate( shader.rid ) ); + return new RDPipeline( context, context.renderingDevice.ComputePipelineCreate( shader.rid ) ); } } } \ No newline at end of file diff --git a/Runtime/Rendering/Objects/RDProgram.cs b/Runtime/Rendering/Objects/RDProgram.cs new file mode 100644 index 0000000..9e4634f --- /dev/null +++ b/Runtime/Rendering/Objects/RDProgram.cs @@ -0,0 +1,25 @@ + +using Godot; +using Godot.Collections; + +namespace Rokojori +{ + + public class RDProgram + { + public enum Type + { + VertexFragment, + Compute + } + + protected Type _type; + public Type type => _type; + + protected RDShader _shader; + public RDShader shader; + + protected RDPipeline _pipeline; + public RDPipeline pipeline; + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Objects/RDProgram.cs.uid b/Runtime/Rendering/Objects/RDProgram.cs.uid new file mode 100644 index 0000000..86003a4 --- /dev/null +++ b/Runtime/Rendering/Objects/RDProgram.cs.uid @@ -0,0 +1 @@ +uid://c1s1t05wskad0 diff --git a/Runtime/Rendering/Objects/RDSampler.cs b/Runtime/Rendering/Objects/RDSampler.cs index 2761908..6ba9751 100644 --- a/Runtime/Rendering/Objects/RDSampler.cs +++ b/Runtime/Rendering/Objects/RDSampler.cs @@ -5,12 +5,12 @@ namespace Rokojori { public class RDSampler: RenderingObject { - public RDSampler( RokojoriCompositorEffect effect, Rid rid ):base( effect, rid ) + public RDSampler( RDContext effect, Rid rid ):base( effect, rid ) {} - public static RDSampler Create( RokojoriCompositorEffect effect, RDSamplerState samplerState ) + public static RDSampler Create( RDContext context, RDSamplerState samplerState ) { - return new RDSampler( effect, effect.rd.SamplerCreate( samplerState ) ); + return new RDSampler( context, context.renderingDevice.SamplerCreate( samplerState ) ); } } } \ No newline at end of file diff --git a/Runtime/Rendering/Objects/RDShader.cs b/Runtime/Rendering/Objects/RDShader.cs index 4bbcca6..1d30b49 100644 --- a/Runtime/Rendering/Objects/RDShader.cs +++ b/Runtime/Rendering/Objects/RDShader.cs @@ -5,13 +5,13 @@ namespace Rokojori { public class RDShader: RenderingObject { - public RDShader( RokojoriCompositorEffect effect, Rid rid ):base( effect, rid ) + public RDShader( RDContext context, Rid rid ):base( context, rid ) {} - public static RDShader CreateFromSpirV( RokojoriCompositorEffect effect, RDShaderSpirV rDShaderSpirV ) + public static RDShader CreateFromSpirV( RDContext context, RDShaderSpirV rDShaderSpirV ) { - var shaderID = effect.rd.ShaderCreateFromSpirV( rDShaderSpirV ); - return new RDShader( effect, shaderID ); + var shaderID = context.renderingDevice.ShaderCreateFromSpirV( rDShaderSpirV ); + return new RDShader( context, shaderID ); } } } \ No newline at end of file diff --git a/Runtime/Rendering/Objects/RDTexture.cs b/Runtime/Rendering/Objects/RDTexture.cs index 1b343d8..d0fd50d 100644 --- a/Runtime/Rendering/Objects/RDTexture.cs +++ b/Runtime/Rendering/Objects/RDTexture.cs @@ -5,32 +5,32 @@ namespace Rokojori { public class RDTexture: RenderingObject { - public RDTexture( RokojoriCompositorEffect effect, Rid rid ):base( effect, rid ){} + public RDTexture( RDContext context, Rid rid ):base( context, rid ){} - public static RDTexture Create( RokojoriCompositorEffect effect, RDTextureFormat format, RDTextureView view ) + public static RDTexture Create( RDContext effect, RDTextureFormat format, RDTextureView view ) { - return new RDTexture( effect, effect.rd.TextureCreate( format, view ) ); + return new RDTexture( effect, effect.renderingDevice.TextureCreate( format, view ) ); } - public static RDTexture Color( RokojoriCompositorContext context ) + public static RDTexture Color( RDContext context ) { var rid = context.sceneBuffers.GetColorLayer( (uint) context.view ); - return new RDTexture( context.effect, rid ); + return new RDTexture( context, rid ); } - public static RDTexture Depth( RokojoriCompositorContext context ) + public static RDTexture Depth( RDContext context ) { var rid = context.sceneBuffers.GetDepthLayer( (uint) context.view ); - return new RDTexture( context.effect, rid ); + return new RDTexture( context, rid ); } public RDTextureFormat format { get { - return effect.rd.TextureGetFormat( rid ); + return context.renderingDevice.TextureGetFormat( rid ); } } @@ -43,28 +43,28 @@ namespace Rokojori } } - public static RDTexture EnsureScreenSizeTexture( RDTexture texture, RokojoriCompositorEffect effect, bool cleanUp = true ) + public static RDTexture EnsureScreenSizeTexture( RDTexture texture, RDContext context, bool cleanUp = true ) { - var size = effect.context.internalSize; + var size = context.internalSize; if ( texture == null || texture.size != size ) { if ( cleanUp && texture != null ) { - effect.rd.FreeRid( texture.rid ); + context.Free( texture, "Old Screen Size Texture" ); } - texture = Create( effect, size ); + texture = Create( context, size ); } return texture; } - public static RDTexture Create( RokojoriCompositorEffect effect, RDTextureFormat format ) + public static RDTexture Create( RDContext context, RDTextureFormat format ) { var view = new RDTextureView(); - var rid = effect.rd.TextureCreate( format, view ); - return new RDTexture( effect, rid ); + var rid = context.renderingDevice.TextureCreate( format, view ); + return new RDTexture( context, rid ); } public static RDTextureFormat DefaultFormat( int w, int h, RenderingDevice.DataFormat dataFormat = RenderingDevice.DataFormat.R16G16B16A16Unorm ) @@ -118,19 +118,19 @@ namespace Rokojori } - public static RDTexture Create( RokojoriCompositorEffect effect, Vector2I size, RenderingDevice.DataFormat dataFormat = RenderingDevice.DataFormat.R16G16B16A16Unorm ) + public static RDTexture Create( RDContext context, Vector2I size, RenderingDevice.DataFormat dataFormat = RenderingDevice.DataFormat.R16G16B16A16Unorm ) { - return Create( effect, size.X, size.Y, dataFormat ); + return Create( context, size.X, size.Y, dataFormat ); } - public static RDTexture Create( RokojoriCompositorEffect effect, int width, int height, + public static RDTexture Create( RDContext context, int width, int height, RenderingDevice.DataFormat dataFormat = RenderingDevice.DataFormat.R16G16B16A16Unorm ) { var view = new RDTextureView(); var format = DefaultFormat( width, height, dataFormat ); - var rid = effect.rd.TextureCreate( format, view ); - return new RDTexture( effect, rid ); + var rid = context.renderingDevice.TextureCreate( format, view ); + return new RDTexture( context, rid ); } } } \ No newline at end of file diff --git a/Runtime/Rendering/Objects/RDUniformSet.cs b/Runtime/Rendering/Objects/RDUniformSet.cs index 63dc42c..1d44dec 100644 --- a/Runtime/Rendering/Objects/RDUniformSet.cs +++ b/Runtime/Rendering/Objects/RDUniformSet.cs @@ -9,26 +9,26 @@ namespace Rokojori protected int _setIndex = -1; public int setIndex => _setIndex; - public RDUniformSet( RokojoriCompositorEffect effect, int setIndex, Rid rid ):base( effect, rid ) + public RDUniformSet( RDContext effect, int setIndex, Rid rid ):base( effect, rid ) { _setIndex =setIndex; } - public static RDUniformSet Image( RokojoriCompositorEffect effect, RDTexture texture, int setIndex ) + public static RDUniformSet Image( RDContext context, RDTexture texture, int setIndex ) { var uniform = new RDUniform(); uniform.UniformType = RenderingDevice.UniformType.Image; uniform.Binding = 0; uniform.AddId( texture.rid ); - var rd = effect.rd; - var rid = UniformSetCacheRD.GetCache( effect.context.shader.rid, (uint) setIndex, new Array{ uniform } ); + var rd = context.renderingDevice; + var rid = UniformSetCacheRD.GetCache( context.shader.rid, (uint) setIndex, new Array { uniform } ); // var rid = rd.UniformSetCreate( new Array{ uniform }, effect.context.shader.rid, (uint) setIndex ); - return new RDUniformSet( effect, setIndex, rid ); + return new RDUniformSet( context, setIndex, rid ); } - public static RDUniformSet Sampler( RokojoriCompositorEffect effect, RDSampler sampler, RDTexture texture, int setIndex ) + public static RDUniformSet Sampler( RDContext context, RDSampler sampler, RDTexture texture, int setIndex ) { var uniform = new RDUniform(); uniform.UniformType = RenderingDevice.UniformType.SamplerWithTexture; @@ -36,12 +36,12 @@ namespace Rokojori uniform.AddId( sampler.rid ); uniform.AddId( texture.rid ) ; - var rd = effect.rd; + var rd = context.renderingDevice; - var rid = UniformSetCacheRD.GetCache( effect.context.shader.rid, (uint) setIndex, new Array{ uniform } ); + var rid = UniformSetCacheRD.GetCache( context.shader.rid, (uint) setIndex, new Array{ uniform } ); // var rid = rd.UniformSetCreate( new Array{ uniform }, effect.context.shader.rid, (uint) setIndex ); - return new RDUniformSet( effect, setIndex, rid ); + return new RDUniformSet( context, setIndex, rid ); } } } \ No newline at end of file diff --git a/Runtime/Rendering/Objects/RenderingObject.cs b/Runtime/Rendering/Objects/RenderingObject.cs index fb7950a..9162766 100644 --- a/Runtime/Rendering/Objects/RenderingObject.cs +++ b/Runtime/Rendering/Objects/RenderingObject.cs @@ -5,17 +5,17 @@ namespace Rokojori { public class RenderingObject { - protected RokojoriCompositorEffect _effect; - public RokojoriCompositorEffect effect => _effect; + protected RDContext _context; + public RDContext context => _context; protected Rid _rid; public Rid rid => _rid; public bool valid => _rid.IsValid; - public RenderingObject( RokojoriCompositorEffect effect, Rid rid ) + public RenderingObject( RDContext context, Rid rid ) { - this._effect = effect; + this._context = context; this._rid = rid; } diff --git a/Runtime/Rendering/Objects/RokojoriCompositorEffect.cs b/Runtime/Rendering/Objects/RokojoriCompositorEffect.cs deleted file mode 100644 index 59293be..0000000 --- a/Runtime/Rendering/Objects/RokojoriCompositorEffect.cs +++ /dev/null @@ -1,308 +0,0 @@ - -using Godot; -using System.Collections.Generic; - -namespace Rokojori -{ - [Tool] - [GlobalClass] - public partial class RokojoriCompositorEffect:CompositorEffect - { - protected RenderingDevice _rd; - public RenderingDevice rd => _rd; - - - protected List _cleanUps = new List(); - protected List _cleanUpInfo = new List(); - - EditableRokojoriCompositorContext _context; - protected bool _hasContext = false; - public RokojoriCompositorContext context => _hasContext ? _context : null; - - protected List _messages = new List(); - public List messages => _messages; - public bool logMessages = true; - public int messageLogLevel = Messages.GetLevel( MessageType.Info ); - - protected virtual void OnConfigure(){} - protected virtual void OnInitialize(){} - protected virtual void ForAllViews(){} - protected virtual void RenderView(){} - - public RokojoriCompositorEffect():base() - { - RenderingServer.CallOnRenderThread( Callable.From( _InitializeCompositorEffect ) ); - } - - protected void _InitializeCompositorEffect() - { - OnConfigure(); - - _rd = RenderingServer.Singleton.GetRenderingDevice(); - - if ( _rd == null ) - { - Error( "Found no rendering device" ); - return; - } - - _context = new EditableRokojoriCompositorContext(); - _context.SetEffect( this ); - - _hasContext = true; - OnInitialize(); - _hasContext = false; - - } - - bool _hasError = false; - - protected bool HasError() - { - return Messages.HasError( _messages ); - } - - public override void _RenderCallback( int effectCallbackType, RenderData renderData ) - { - - - if ( _hasError || HasError() ) - { - this.LogInfo( _messages ); - return; - } - - _messages.Clear(); - _hasContext = false; - - try - { - - if ( rd == null ) - { - Error( "No render device" ); - return; - } - - var sceneBuffers = ( RenderSceneBuffersRD ) renderData.GetRenderSceneBuffers(); - var sceneData = ( RenderSceneDataRD ) renderData.GetRenderSceneData(); - - if ( sceneBuffers == null && sceneData == null ) - { - Error( "sceneBuffers == null && sceneData == null" ); - return; - } - - - - var size = sceneBuffers.GetInternalSize(); - - if ( size.X == 0 || size.Y == 0 ) - { - Warning( "InternalSize.X == 0 || InternalSize.Y == 0" ); - return; - } - - _context.SetRenderData( renderData, sceneBuffers, sceneData ); - _context.SetView( -1 ); - - _hasContext = true; - - ForAllViews(); - - - - int viewCount = ( int ) sceneBuffers.GetViewCount(); - - for ( int i = 0; i < viewCount; i++ ) - { - _context.SetView( i ); - RenderView(); - } - - } - catch( System.Exception e ) - { - this.LogError( e ); - _hasError = true; - } - - if ( HasError() ) - { - _hasError = true; - } - - _hasContext = false; - } - - - - - public override void _Notification( int what ) - { - var _shader = context.shader; - - Verbose( "Got notification: ", what ); - - if ( what != NotificationPredelete || ( _shader == null || !_shader.valid ) || rd == null ) - { - Verbose( - "what != NotificationPredelete", what != NotificationPredelete, - "( _shader == null || !_shader.valid )", ( _shader == null || !_shader.valid ), - "rd == null", rd == null - ); - return; - } - - CleanUp( _shader, "Shader" ); - - var index = 0; - - _cleanUps.ForEach( - c => - { - CleanUp( c, "_cleanUps[" + index + "]"); - index ++; - } - ); - - _cleanUps.Clear(); - - } - - public void AddToCleanUp( RenderingObject ro, string info = null ) - { - var _shader = context.shader; - - if ( _cleanUps.Contains( ro ) || _shader == ro ) - { - return; - } - - _cleanUps.Add( ro ); - _cleanUpInfo.Add( info ); - } - - public void AddToCleanUp( List ro, string info = null ) - { - var index = 0; - info = info == null ? "" : info; - - ro.ForEach( - r => - { - AddToCleanUp( r, info + "["+ index + "]" ); - index ++; - } - ); - } - - void CleanUp( RenderingObject ro, string info ) - { - if ( ro == null ) - { - Warning( "ro == null, couldn't clean up: ", info ); - return; - } - - Verbose( "Cleaning up: ", info, ro.rid ); - rd.FreeRid( ro.rid ); - } - - - - // --------------------------------------------- - // --------------------------------------------- - // CONVINIENCE - // --------------------------------------------- - // --------------------------------------------- - - public RDSampler Sampler( RDSamplerState state = null) - { - if ( state == null ) - { - state = new RDSamplerState(); - state.MinFilter = RenderingDevice.SamplerFilter.Linear; - state.MagFilter = RenderingDevice.SamplerFilter.Linear; - state.RepeatU = RenderingDevice.SamplerRepeatMode.Repeat; - state.RepeatV = RenderingDevice.SamplerRepeatMode.Repeat; - } - - var sampler = RDSampler.Create( this, state ); - return sampler; - } - - public RDSampler Sampler( RenderingDevice.SamplerFilter filter, RenderingDevice.SamplerRepeatMode repeatMode) - { - var state = new RDSamplerState(); - - state.MinFilter = filter; - state.MagFilter = filter; - - state.RepeatU = repeatMode; - state.RepeatV = repeatMode; - - return Sampler( state ); - } - - - - // --------------------------------------------- - // --------------------------------------------- - // MESSAGES - // --------------------------------------------- - // --------------------------------------------- - - - public void Error( params object[] messages ) - { - var message = RJLog.GetLogString( messages ); - - Messages.Error( _messages, message ); - - if ( logMessages ) - { - this.LogError( message ); - } - } - - public void Warning( params object[] messages ) - { - var message = RJLog.GetLogString( messages ); - - Messages.Warning( _messages, message ); - - if ( logMessages && Messages.GetLevel( MessageType.Warning ) >= messageLogLevel ) - { - this.LogInfo( message ); - } - } - - public void Info( params object[] messages ) - { - var message = RJLog.GetLogString( messages ); - - Messages.Info( _messages, message ); - - if ( logMessages && Messages.GetLevel( MessageType.Info ) >= messageLogLevel ) - { - this.LogInfo( message ); - } - } - - public void Verbose( params object[] messages ) - { - var message = RJLog.GetLogString( messages ); - - Messages.Verbose( _messages, message ); - - if ( logMessages && Messages.GetLevel( MessageType.Verbose ) >= messageLogLevel ) - { - this.LogInfo( message ); - } - } - - - - } -} \ No newline at end of file diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/CEG_RadialBlur.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/CEG_RadialBlur.cs similarity index 51% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/CEG_RadialBlur.cs rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/CEG_RadialBlur.cs index c82036a..be41ff8 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/CEG_RadialBlur.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/CEG_RadialBlur.cs @@ -7,9 +7,9 @@ namespace Rokojori public class CEG_RadialBlur:CEG_ImageProcessor { public static readonly string shaderPath = - _XX_CompositorEffectGraph.Path( "Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl" ); + RDGraph.Path( "Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl" ); - public CEG_RadialBlur( _XX_CompositorEffectGraph graph ):base( graph, shaderPath ) + public CEG_RadialBlur( RDGraph graph ):base( graph, shaderPath ) {} diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/CEG_RadialBlur.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/CEG_RadialBlur.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/CEG_RadialBlur.cs.uid rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/CEG_RadialBlur.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl.import new file mode 100644 index 0000000..780af38 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://bqsb2a6poa7b0" +path="res://.godot/imported/RadialBlur.glsl-35b5275b6d1793a0225f9e56654817ba.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Blurs/RadialBlur/RadialBlur.glsl" +dest_files=["res://.godot/imported/RadialBlur.glsl-35b5275b6d1793a0225f9e56654817ba.res"] + +[params] + diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/CEG_Copy.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/CEG_Copy.cs similarity index 54% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/CEG_Copy.cs rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/CEG_Copy.cs index af6fe0f..9dd3be3 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/CEG_Copy.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/CEG_Copy.cs @@ -7,9 +7,9 @@ namespace Rokojori public class CEG_Copy:CEG_ImageProcessor { public static readonly string shaderPath = - _XX_CompositorEffectGraph.Path( "Nodes/Processors/Copy/Copy.glsl" ); + RDGraph.Path( "Nodes/Processors/Copy/Copy.glsl" ); - public CEG_Copy( _XX_CompositorEffectGraph graph ):base( graph, shaderPath ) + public CEG_Copy( RDGraph graph ):base( graph, shaderPath ) {} diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/CEG_Copy.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/CEG_Copy.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/CEG_Copy.cs.uid rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/CEG_Copy.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/Copy.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Copy.glsl similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Copy/Copy.glsl rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Copy.glsl diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Copy.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Copy.glsl.import new file mode 100644 index 0000000..3550a1b --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Copy.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://dkmulxqa0tvis" +path="res://.godot/imported/Copy.glsl-a0f0f39536a9da8f32ba3e28463a2f50.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/Copy/Copy.glsl" +dest_files=["res://.godot/imported/Copy.glsl-a0f0f39536a9da8f32ba3e28463a2f50.res"] + +[params] + diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs similarity index 69% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs index 339c05f..001bdf9 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs @@ -19,7 +19,7 @@ namespace Rokojori } - public virtual RDTexture Create( RDTexture texture, _XX_CompositorEffectGraph graph ) + public virtual RDTexture Create( RDTexture texture, RDGraph graph ) { return texture; } @@ -30,15 +30,15 @@ namespace Rokojori public RDTextureFormat format = RDTexture.DefaultFormat( -1, -1 ); public Vector2 scale = Vector2.One; - public override RDTexture Create( RDTexture texture, _XX_CompositorEffectGraph graph ) + public override RDTexture Create( RDTexture texture, RDGraph graph ) { Vector2I scaledSize = (Vector2I) ( graph.context.internalSize * scale ); if ( texture == null || scaledSize != texture.size ) { - AutoClean( texture, graph.rd ); + AutoClean( texture, graph.context.renderingDevice ); format = RDTexture.FormatChangeSize( format, scaledSize ); - texture = RDTexture.Create( graph, format ); + texture = RDTexture.Create( graph.context, format ); } return texture; @@ -49,14 +49,14 @@ namespace Rokojori { public RDTextureFormat format = RDTexture.DefaultFormat( -1, -1 ); - public override RDTexture Create( RDTexture texture, _XX_CompositorEffectGraph graph ) + public override RDTexture Create( RDTexture texture, RDGraph graph ) { var formatSize = new Vector2I( (int) format.Width, (int) format.Height ); if ( texture == null || texture.size != formatSize ) { - AutoClean( texture, graph.rd ); - texture = RDTexture.Create( graph, format ); + AutoClean( texture, graph.context.renderingDevice ); + texture = RDTexture.Create( graph.context, format ); } return texture; @@ -65,7 +65,7 @@ namespace Rokojori - public class CEG_BufferTexture:CompositorEffectGraphProcessor, CompositorEffectGraphTextureSlotInput + public class CEG_BufferTexture:RGGraphProcessor, RDGraphTextureSlotInput { RDTexture _texture; @@ -77,7 +77,7 @@ namespace Rokojori return _texture; } - public CompositorEffectGraphProcessor GetProcessor() + public RGGraphProcessor GetProcessor() { return this; } @@ -89,19 +89,19 @@ namespace Rokojori _connectedSlots.Add( slot ); } - public CEG_BufferTexture( _XX_CompositorEffectGraph graph, CEG_TextureCreator creator ):base( graph ) + public CEG_BufferTexture( RDGraph graph, CEG_TextureCreator creator ):base( graph ) { _creator = creator; } - public static CEG_BufferTexture ScreenSize( _XX_CompositorEffectGraph graph, Vector2? scale = null ) + public static CEG_BufferTexture ScreenSize( RDGraph graph, Vector2? scale = null ) { var screenSize = new CEG_TextureCreator_ScreenSize(); screenSize.scale = scale == null ? Vector2.One : (Vector2) scale; return new CEG_BufferTexture( graph, screenSize ); } - public static CEG_BufferTexture FixedSize( _XX_CompositorEffectGraph graph ) + public static CEG_BufferTexture FixedSize( RDGraph graph ) { return new CEG_BufferTexture( graph, new CEG_TextureCreator_FixedSize() ); } diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs.uid rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_BufferTexture.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs similarity index 69% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs index 320078d..9b74dff 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs @@ -4,12 +4,12 @@ using System.Collections.Generic; namespace Rokojori { - public class CEG_ImageProcessor:CompositorEffectShaderProcessor + public class CEG_ImageProcessor:RDShaderProcessor { public readonly CompositorEffectGraphTextureSlot input; public readonly CompositorEffectGraphTextureSlot output; - public CEG_ImageProcessor( _XX_CompositorEffectGraph graph, string shaderPath ):base( graph, shaderPath ) + public CEG_ImageProcessor( RDGraph graph, string shaderPath ):base( graph, shaderPath ) { input = new CompositorEffectGraphTextureSlot( this ); output = new CompositorEffectGraphTextureSlot( this ); @@ -17,7 +17,7 @@ namespace Rokojori _textureSlots.AddRange( new List{ input, output } ); } - public void SetTextureSlotInputs( CompositorEffectGraphTextureSlotInput inputSlot, CompositorEffectGraphTextureSlotInput outputSlot ) + public void SetTextureSlotInputs( RDGraphTextureSlotInput inputSlot, RDGraphTextureSlotInput outputSlot ) { inputSlot.ConnectTo( input ); outputSlot.ConnectTo( output ); diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs.uid rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ImageProcessor.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs similarity index 72% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs index 3e346f8..39ea8c3 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace Rokojori { - public class CEG_ScreenColorTexure:CompositorEffectGraphProcessor, CompositorEffectGraphTextureSlotInput + public class CEG_ScreenColorTexure:RGGraphProcessor, RDGraphTextureSlotInput { RDTexture _texture; @@ -13,7 +13,7 @@ namespace Rokojori return _texture; } - public CompositorEffectGraphProcessor GetProcessor() + public RGGraphProcessor GetProcessor() { return this; } @@ -25,7 +25,7 @@ namespace Rokojori _connectedSlots.Add( slot ); } - public CEG_ScreenColorTexure( _XX_CompositorEffectGraph graph ):base( graph ) + public CEG_ScreenColorTexure( RDGraph graph ):base( graph ) {} public override void Process() diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs.uid rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenColorTexture.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs similarity index 72% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs index 55aae21..178df49 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace Rokojori { - public class CEG_ScreenDepthTexture:CompositorEffectGraphProcessor, CompositorEffectGraphTextureSlotInput + public class CEG_ScreenDepthTexture:RGGraphProcessor, RDGraphTextureSlotInput { RDTexture _texture; @@ -13,7 +13,7 @@ namespace Rokojori return _texture; } - public CompositorEffectGraphProcessor GetProcessor() + public RGGraphProcessor GetProcessor() { return this; } @@ -25,7 +25,7 @@ namespace Rokojori _connectedSlots.Add( slot ); } - public CEG_ScreenDepthTexture( _XX_CompositorEffectGraph graph ):base( graph ) + public CEG_ScreenDepthTexture( RDGraph graph ):base( graph ) {} public override void Process() diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs.uid rename to Runtime/Rendering/RenderGraph/Nodes/Processors/Generic/CEG_ScreenDepthTexture.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/CEG_JFAInitialize.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/CEG_JFAInitialize.cs similarity index 52% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/CEG_JFAInitialize.cs rename to Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/CEG_JFAInitialize.cs index adaa796..92d5e15 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/CEG_JFAInitialize.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/CEG_JFAInitialize.cs @@ -7,9 +7,9 @@ namespace Rokojori public class CEG_JFAInitialize:CEG_ImageProcessor { public static readonly string shaderPath = - _XX_CompositorEffectGraph.Path( "Nodes/Processors/JFA/JFA_Initialize.glsl" ); + RDGraph.Path( "Nodes/Processors/JFA/JFA_Initialize.glsl" ); - public CEG_JFAInitialize( _XX_CompositorEffectGraph graph ):base( graph, shaderPath ) + public CEG_JFAInitialize( RDGraph graph ):base( graph, shaderPath ) {} diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/CEG_JFAInitialize.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/CEG_JFAInitialize.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/CEG_JFAInitialize.cs.uid rename to Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/CEG_JFAInitialize.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/CEG_JFAIterate.cs b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/CEG_JFAIterate.cs similarity index 53% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/CEG_JFAIterate.cs rename to Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/CEG_JFAIterate.cs index 7ff5623..dde13fa 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/CEG_JFAIterate.cs +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/CEG_JFAIterate.cs @@ -7,9 +7,9 @@ namespace Rokojori public class CEG_JFAIterate:CEG_ImageProcessor { public static readonly string shaderPath = - _XX_CompositorEffectGraph.Path( "Nodes/Processors/JFA/JFA_Iterate.glsl" ); + RDGraph.Path( "Nodes/Processors/JFA/JFA_Iterate.glsl" ); - public CEG_JFAIterate( _XX_CompositorEffectGraph graph ):base( graph, shaderPath ) + public CEG_JFAIterate( RDGraph graph ):base( graph, shaderPath ) {} diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/CEG_JFAIterate.cs.uid b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/CEG_JFAIterate.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/CEG_JFAIterate.cs.uid rename to Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/CEG_JFAIterate.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Initialize.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Initialize.glsl similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Initialize.glsl rename to Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Initialize.glsl diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Initialize.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Initialize.glsl.import new file mode 100644 index 0000000..ef3434d --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Initialize.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://diia0hlqqkna" +path="res://.godot/imported/JFA_Initialize.glsl-b2dc9db2157aa2b07d636441b1db6e3a.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Initialize.glsl" +dest_files=["res://.godot/imported/JFA_Initialize.glsl-b2dc9db2157aa2b07d636441b1db6e3a.res"] + +[params] + diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Iterate.glsl b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Iterate.glsl similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/Nodes/Processors/JFA/JFA_Iterate.glsl rename to Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Iterate.glsl diff --git a/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Iterate.glsl.import b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Iterate.glsl.import new file mode 100644 index 0000000..491c87c --- /dev/null +++ b/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Iterate.glsl.import @@ -0,0 +1,14 @@ +[remap] + +importer="glsl" +type="RDShaderFile" +uid="uid://dntu82sa6clb4" +path="res://.godot/imported/JFA_Iterate.glsl-dbdaa793bc8f1e1de45b2361214d6872.res" + +[deps] + +source_file="res://addons/rokojori_action_library/Runtime/Rendering/RenderGraph/Nodes/Processors/JFA/JFA_Iterate.glsl" +dest_files=["res://.godot/imported/JFA_Iterate.glsl-dbdaa793bc8f1e1de45b2361214d6872.res"] + +[params] + diff --git a/Runtime/Rendering/RenderGraph/RDGraph.cs b/Runtime/Rendering/RenderGraph/RDGraph.cs new file mode 100644 index 0000000..0df1adb --- /dev/null +++ b/Runtime/Rendering/RenderGraph/RDGraph.cs @@ -0,0 +1,67 @@ + +using Godot; +using System.Collections.Generic; + +namespace Rokojori +{ + public class RDGraph + { + public RDGraph( RDContext context ) + { + _context = context; + } + + protected RDContext _context; + public RDContext context => _context; + public static readonly string path = "res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectGraph"; + public static string Path( string subPath ) + { + return path + "/" + subPath; + } + + protected List _nodes = new List(); + protected List _processors = new List(); + protected List _processOrder = new List(); + + + public void Register( RDGraphNode node ) + { + _nodes.Add( node ); + + if ( node is RGGraphProcessor p ) + { + _processors.Add( p ); + } + } + + public void InitializeNodes() + { + _processors.ForEach( p => p.Initialize() ); + } + + public void SetProcessOrder( List order ) + { + _processOrder.Clear(); + _processOrder.AddRange( order ); + } + + public void SetProcessOrder( params RGGraphProcessor[] order ) + { + _processOrder.Clear(); + _processOrder.AddRange( order ); + } + + public void ProcessForView() + { + + _processOrder.ForEach( + p => + { + context.Verbose( p.GetType() ); + p.Process(); + } + ); + + } + } +} \ No newline at end of file diff --git a/Runtime/Rendering/RenderGraph/RDGraph.cs.uid b/Runtime/Rendering/RenderGraph/RDGraph.cs.uid new file mode 100644 index 0000000..87e825d --- /dev/null +++ b/Runtime/Rendering/RenderGraph/RDGraph.cs.uid @@ -0,0 +1 @@ +uid://bh8pwn5820854 diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/_XX_CompositorEffectGraph.cs.uid b/Runtime/Rendering/RenderGraph/RDGraph.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/_XX_CompositorEffectGraph.cs.uid rename to Runtime/Rendering/RenderGraph/RDGraph.uid diff --git a/Runtime/Rendering/RenderGraph/RDGraphConnection.cs b/Runtime/Rendering/RenderGraph/RDGraphConnection.cs new file mode 100644 index 0000000..b6fdb5a --- /dev/null +++ b/Runtime/Rendering/RenderGraph/RDGraphConnection.cs @@ -0,0 +1,16 @@ + +using Godot; + +namespace Rokojori +{ + public class RDGraphConnection:RDGraphNode + { + protected RGGraphProcessor _processor; + + public RDGraphConnection( RGGraphProcessor processor ):base( processor.graph ) + { + _processor = processor; + } + + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphConnection.cs.uid b/Runtime/Rendering/RenderGraph/RDGraphConnection.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphConnection.cs.uid rename to Runtime/Rendering/RenderGraph/RDGraphConnection.cs.uid diff --git a/Runtime/Rendering/RenderGraph/RDGraphNode.cs b/Runtime/Rendering/RenderGraph/RDGraphNode.cs new file mode 100644 index 0000000..b0888b6 --- /dev/null +++ b/Runtime/Rendering/RenderGraph/RDGraphNode.cs @@ -0,0 +1,17 @@ + +using Godot; + +namespace Rokojori +{ + public class RDGraphNode + { + RDGraph _graph; + public RDGraph graph => _graph; + + public RDGraphNode( RDGraph graph ) + { + _graph = graph; + _graph.Register( this ); + } + } +} \ No newline at end of file diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphNode.cs.uid b/Runtime/Rendering/RenderGraph/RDGraphNode.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphNode.cs.uid rename to Runtime/Rendering/RenderGraph/RDGraphNode.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphProcessor.cs b/Runtime/Rendering/RenderGraph/RDGraphProcessor.cs similarity index 55% rename from Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphProcessor.cs rename to Runtime/Rendering/RenderGraph/RDGraphProcessor.cs index 6743ebb..8c54646 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphProcessor.cs +++ b/Runtime/Rendering/RenderGraph/RDGraphProcessor.cs @@ -4,11 +4,11 @@ using System.Collections.Generic; namespace Rokojori { - public class CompositorEffectGraphProcessor:CompositorEffectGraphNode + public class RGGraphProcessor:RDGraphNode { - protected List _connections = new List(); + protected List _connections = new List(); - public CompositorEffectGraphProcessor( _XX_CompositorEffectGraph graph ):base( graph ){} + public RGGraphProcessor( RDGraph graph ):base( graph ){} bool _initialized = false; diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphProcessor.cs.uid b/Runtime/Rendering/RenderGraph/RDGraphProcessor.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphProcessor.cs.uid rename to Runtime/Rendering/RenderGraph/RDGraphProcessor.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphTextureSlot.cs b/Runtime/Rendering/RenderGraph/RDGraphTextureSlot.cs similarity index 61% rename from Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphTextureSlot.cs rename to Runtime/Rendering/RenderGraph/RDGraphTextureSlot.cs index b3c029e..68ef80c 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphTextureSlot.cs +++ b/Runtime/Rendering/RenderGraph/RDGraphTextureSlot.cs @@ -4,18 +4,18 @@ using System.Collections.Generic; namespace Rokojori { - public interface CompositorEffectGraphTextureSlotInput + public interface RDGraphTextureSlotInput { public RDTexture GetTexture(); - public CompositorEffectGraphProcessor GetProcessor(); + public RGGraphProcessor GetProcessor(); public void SetConnected( CompositorEffectGraphTextureSlot slot ); public void ConnectTo( CompositorEffectGraphTextureSlot slot ); } - public class CompositorEffectGraphTextureSlot:CompositorEffectGraphConnection, CompositorEffectGraphTextureSlotInput + public class CompositorEffectGraphTextureSlot:RDGraphConnection, RDGraphTextureSlotInput { - protected CompositorEffectGraphTextureSlotInput _input; - public CompositorEffectGraphTextureSlotInput input => _input; + protected RDGraphTextureSlotInput _input; + public RDGraphTextureSlotInput input => _input; public RDSampler sampler; @@ -31,7 +31,7 @@ namespace Rokojori return _texture = _input.GetTexture(); } - public CompositorEffectGraphProcessor GetProcessor() + public RGGraphProcessor GetProcessor() { return _processor; } @@ -43,12 +43,12 @@ namespace Rokojori _connectedSlots.Add( slot ); } - public CompositorEffectGraphTextureSlot( CompositorEffectGraphProcessor processor ):base( processor ) + public CompositorEffectGraphTextureSlot( RGGraphProcessor processor ):base( processor ) { } - public void SetInput( CompositorEffectGraphTextureSlotInput input ) + public void SetInput( RDGraphTextureSlotInput input ) { _input = input; input.SetConnected( this ); diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphTextureSlot.cs.uid b/Runtime/Rendering/RenderGraph/RDGraphTextureSlot.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectGraphTextureSlot.cs.uid rename to Runtime/Rendering/RenderGraph/RDGraphTextureSlot.cs.uid diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectShaderProcessor.cs b/Runtime/Rendering/RenderGraph/RDShaderProcessor.cs similarity index 61% rename from Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectShaderProcessor.cs rename to Runtime/Rendering/RenderGraph/RDShaderProcessor.cs index 375db27..016603e 100644 --- a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectShaderProcessor.cs +++ b/Runtime/Rendering/RenderGraph/RDShaderProcessor.cs @@ -4,11 +4,11 @@ using System.Collections.Generic; namespace Rokojori { - public class CompositorEffectShaderProcessor:CompositorEffectGraphProcessor + public class RDShaderProcessor:RGGraphProcessor { protected string _shaderPath; - public CompositorEffectShaderProcessor( _XX_CompositorEffectGraph graph, string shaderPath ):base( graph ) + public RDShaderProcessor( RDGraph graph, string shaderPath ):base( graph ) { this._shaderPath = shaderPath; } @@ -22,11 +22,11 @@ namespace Rokojori protected override void OnInitialize() { - graph.Verbose( "Trying to load shader: ", _shaderPath ); + graph.context.Verbose( "Trying to load shader: ", _shaderPath ); if ( _shaderPath == null ) { - graph.Error( "_shaderPath == null" ); + graph.context.Error( "_shaderPath == null" ); return; } @@ -34,27 +34,27 @@ namespace Rokojori if ( glslFile == null ) { - graph.Error( "Couldn't load shader at path:", _shaderPath ); + graph.context.Error( "Couldn't load shader at path:", _shaderPath ); return; } - _shader = RDShader.CreateFromSpirV( graph, glslFile.GetSpirV() ); + _shader = RDShader.CreateFromSpirV( graph.context, glslFile.GetSpirV() ); if ( _shader == null ) { - graph.Error( "Couldn't create shader from code, path:", _shaderPath ); + graph.context.Error( "Couldn't create shader from code, path:", _shaderPath ); return; } - _pipeline = RDPipeline.Create( graph, _shader ); + _pipeline = RDPipeline.Create( graph.context, _shader ); if ( _shader == null ) { - graph.Error( "Couldn't create pipeline from compiled shader, path:", _shaderPath ); + graph.context.Error( "Couldn't create pipeline from compiled shader, path:", _shaderPath ); return; } - graph.Verbose( "Created shader at path: ", _shaderPath ); + graph.context.Verbose( "Created shader at path: ", _shaderPath ); } public override void Process() @@ -62,7 +62,7 @@ namespace Rokojori var context = graph.context; context.Clear(); - context.ComputeGroups( _groupSize ); + context.CalculateComputeGroups( _groupSize ); context.SetShaderAndPipeline( _shader, _pipeline ); _textureSlots.ForEach( t => @@ -77,7 +77,7 @@ namespace Rokojori context.pushConstants = _constants; } - context.Render(); + context.ProcessComputeProgram(); } } } \ No newline at end of file diff --git a/Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectShaderProcessor.cs.uid b/Runtime/Rendering/RenderGraph/RDShaderProcessor.cs.uid similarity index 100% rename from Runtime/Rendering/Objects/CompositorEffectGraph/CompositorEffectShaderProcessor.cs.uid rename to Runtime/Rendering/RenderGraph/RDShaderProcessor.cs.uid diff --git a/Runtime/Rendering/SilhouetteOutlines/SilhouetteOutlineCompositer.cs b/Runtime/Rendering/SilhouetteOutlines/SilhouetteOutlineCompositer.cs deleted file mode 100644 index b20015b..0000000 --- a/Runtime/Rendering/SilhouetteOutlines/SilhouetteOutlineCompositer.cs +++ /dev/null @@ -1,61 +0,0 @@ - -using System.Diagnostics; -using System.Collections; -using System.Collections.Generic; -using System; -using Godot; - - -// https://github.com/jamesdimick/godot-compositor-effect-csharp-test/blob/main/TestCompositorEffect.cs -// https://github.com/txnsor/godot-datamosher/blob/main/shaders/datamosher.glsl -// https://github.com/DevPoodle/godot-compositor-outline/blob/main/outline_effect.gd - -namespace Rokojori -{ - [Tool] - [GlobalClass] - public partial class SilhouetteOutlineCompositer:CompositorEffect - { - RenderingDevice renderingDevice; - Rid frameBuffer; - - public void _Init() - { - EffectCallbackType = EffectCallbackTypeEnum.PostOpaque; - renderingDevice = RenderingServer.GetRenderingDevice(); - - } - - public override void _Notification(int what) - { - - } - - public override void _RenderCallback( int effectCallbackType, RenderData renderData ) - { - if ( renderingDevice == null || effectCallbackType != (int) EffectCallbackTypeEnum.PostOpaque ) - { - return; - } - - var renderBuffers = (RenderSceneBuffersRD) renderData.GetRenderSceneBuffers(); - - if ( renderBuffers == null ) - { - return; - } - - var size = renderBuffers.GetInternalSize(); - - if ( size.X == 0 || size.Y == 0 ) - { - return; - } - - var groups = new Vector3((size.X - 1.0f) / 8.0f + 1.0f, (size.Y - 1.0f) / 8.0f + 1.0f, 1.0f).Floor(); - - - } - } - -} \ No newline at end of file diff --git a/Runtime/Rendering/SilhouetteOutlines/SilhouetteOutlineCompositer.cs.uid b/Runtime/Rendering/SilhouetteOutlines/SilhouetteOutlineCompositer.cs.uid deleted file mode 100644 index c61e815..0000000 --- a/Runtime/Rendering/SilhouetteOutlines/SilhouetteOutlineCompositer.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://3awb3ydcy1vh