mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Added Blit-Class
This commit is contained in:
@@ -109,17 +109,7 @@ abstract class UltralightWindow
|
||||
|
||||
RenderCommand.Clear(_window.SwapChain.BackBuffer, .Color, .(0.7f, 0.2f, 0.2f), 1.0f, 0);
|
||||
|
||||
RenderCommand.UnbindRenderTargets();
|
||||
RenderCommand.SetRenderTarget(_window.SwapChain.BackBuffer);
|
||||
RenderCommand.BindRenderTargets();
|
||||
RenderCommand.SetViewport(_window.SwapChain.BackbufferViewport);
|
||||
|
||||
Effect copy = Content.GetAsset<Effect>(UltralightLayer._copyEffect);
|
||||
copy.SetTexture("Texture", _texture);
|
||||
copy.ApplyChanges();
|
||||
copy.Bind();
|
||||
|
||||
FullscreenQuad.Draw();
|
||||
Blit.Blit(_texture, _window.SwapChain.BackBuffer, viewport: _window.SwapChain.BackbufferViewport);
|
||||
}
|
||||
|
||||
public void Render()
|
||||
|
||||
@@ -13,8 +13,6 @@ class UltralightLayer : Layer
|
||||
{
|
||||
public static ULRenderer renderer;
|
||||
|
||||
public static AssetHandle<Effect> _copyEffect;
|
||||
|
||||
private List<UltralightWindow> _windows = new .() ~ DeleteContainerAndItems!(_);
|
||||
|
||||
public UltralightMainWindow EntityHierarchyWindow;
|
||||
@@ -31,8 +29,6 @@ class UltralightLayer : Layer
|
||||
|
||||
EntityHierarchyWindow = new UltralightMainWindow();
|
||||
_windows.Add(EntityHierarchyWindow);
|
||||
|
||||
_copyEffect = Content.LoadAsset("Resources/Shaders/Copy.hlsl");
|
||||
}
|
||||
private static void InitClipboard()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using GlitchyEngine.Content;
|
||||
|
||||
namespace GlitchyEngine.Renderer;
|
||||
|
||||
static class Blit
|
||||
{
|
||||
public static AssetHandle<Effect> _copyEffect;
|
||||
|
||||
internal static void Init()
|
||||
{
|
||||
_copyEffect = Content.LoadAsset("Resources/Shaders/Copy.hlsl");
|
||||
}
|
||||
|
||||
public static void Blit(Texture2D source, RenderTarget2D destination, Effect blitEffect = _copyEffect, Viewport? viewport = null)
|
||||
{
|
||||
RenderCommand.UnbindRenderTargets();
|
||||
RenderCommand.SetRenderTarget(destination);
|
||||
RenderCommand.BindRenderTargets();
|
||||
RenderCommand.SetViewport(viewport ?? Viewport(0, 0, destination.Width, destination.Height));
|
||||
|
||||
blitEffect.SetTexture("Texture", source);
|
||||
blitEffect.ApplyChanges();
|
||||
blitEffect.Bind();
|
||||
|
||||
FullscreenQuad.Draw();
|
||||
}
|
||||
}
|
||||
@@ -414,6 +414,8 @@ namespace GlitchyEngine.Renderer
|
||||
|
||||
FontRenderer.Init();
|
||||
|
||||
Blit.Init();
|
||||
|
||||
#if DEBUG
|
||||
s_initialized = true;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user