rj-action-library/Runtime/Rendering/RenderGraph/RDGraphTextureSlot.cs

62 lines
1.4 KiB
C#
Raw Normal View History

2025-04-24 13:39:00 +00:00
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
2025-04-26 20:04:11 +00:00
public interface RDGraphTextureSlotInput
2025-04-24 13:39:00 +00:00
{
public RDTexture GetTexture();
2025-04-26 20:04:11 +00:00
public RGGraphProcessor GetProcessor();
2025-04-24 13:39:00 +00:00
public void SetConnected( CompositorEffectGraphTextureSlot slot );
public void ConnectTo( CompositorEffectGraphTextureSlot slot );
}
2025-04-26 20:04:11 +00:00
public class CompositorEffectGraphTextureSlot:RDGraphConnection, RDGraphTextureSlotInput
2025-04-24 13:39:00 +00:00
{
2025-04-26 20:04:11 +00:00
protected RDGraphTextureSlotInput _input;
public RDGraphTextureSlotInput input => _input;
2025-04-24 13:39:00 +00:00
public RDSampler sampler;
RDTexture _texture;
public RDTexture GetTexture()
{
return _texture;
}
public RDTexture ResolveTexture()
{
return _texture = _input.GetTexture();
}
2025-04-26 20:04:11 +00:00
public RGGraphProcessor GetProcessor()
2025-04-24 13:39:00 +00:00
{
return _processor;
}
List<CompositorEffectGraphTextureSlot> _connectedSlots = new List<CompositorEffectGraphTextureSlot>();
public void SetConnected( CompositorEffectGraphTextureSlot slot )
{
_connectedSlots.Add( slot );
}
2025-04-26 20:04:11 +00:00
public CompositorEffectGraphTextureSlot( RGGraphProcessor processor ):base( processor )
2025-04-24 13:39:00 +00:00
{
}
2025-04-26 20:04:11 +00:00
public void SetInput( RDGraphTextureSlotInput input )
2025-04-24 13:39:00 +00:00
{
_input = input;
input.SetConnected( this );
}
public void ConnectTo( CompositorEffectGraphTextureSlot slot )
{
slot.SetInput( this );
}
}
}