mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Load effects via content manager + virtual InitContentManager in App
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using GlitchyEngine.Content;
|
||||
|
||||
namespace GlitchyEngine.Renderer
|
||||
{
|
||||
public class PixelShader : Shader
|
||||
{
|
||||
[AllowAppend]
|
||||
public this(StringView code, StringView? fileName, String entryPoint, ShaderDefine[] macros = null)
|
||||
: base(code, fileName, entryPoint, macros) { }
|
||||
public this(StringView code, StringView? fileName, String entryPoint, IContentManager contentManager, ShaderDefine[] macros = null)
|
||||
: base(code, fileName, entryPoint, contentManager, macros) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace GlitchyEngine.Renderer
|
||||
private Vector3 _padding;
|
||||
}
|
||||
|
||||
public static void Init(EffectLibrary effectLibrary)
|
||||
public static void Init()
|
||||
{
|
||||
Debug.Profiler.ProfileFunction!();
|
||||
|
||||
@@ -112,8 +112,8 @@ namespace GlitchyEngine.Renderer
|
||||
Renderer2D.Init();
|
||||
FullscreenQuad.Init();
|
||||
|
||||
InitLineRenderer(effectLibrary);
|
||||
InitDeferredRenderer(effectLibrary);
|
||||
InitLineRenderer();
|
||||
InitDeferredRenderer();
|
||||
}
|
||||
|
||||
public static void Deinit()
|
||||
@@ -128,11 +128,11 @@ namespace GlitchyEngine.Renderer
|
||||
Renderer2D.Deinit();
|
||||
}
|
||||
|
||||
static void InitLineRenderer(EffectLibrary effectLibrary)
|
||||
static void InitLineRenderer()
|
||||
{
|
||||
Debug.Profiler.ProfileFunction!();
|
||||
|
||||
LineEffect = effectLibrary.Load("content\\Shaders\\lineShader.hlsl");
|
||||
LineEffect = Content.LoadAsset<Effect>("Shaders\\lineShader.hlsl");
|
||||
|
||||
LineGeometry = new GeometryBinding();
|
||||
LineGeometry.SetPrimitiveTopology(.LineList);
|
||||
@@ -161,10 +161,10 @@ namespace GlitchyEngine.Renderer
|
||||
LineEffect.ReleaseRef();
|
||||
}
|
||||
|
||||
static void InitDeferredRenderer(EffectLibrary effectLibrary)
|
||||
static void InitDeferredRenderer()
|
||||
{
|
||||
TestFullscreenEffect = effectLibrary.Load("content\\Shaders\\simpleLight.hlsl");
|
||||
s_tonemappingEffect = effectLibrary.Load("content\\Shaders\\SimpleTonemapping.hlsl");
|
||||
TestFullscreenEffect = Content.LoadAsset<Effect>("Shaders\\simpleLight.hlsl");
|
||||
s_tonemappingEffect = Content.LoadAsset<Effect>("Shaders\\SimpleTonemapping.hlsl");
|
||||
|
||||
_gBuffer = new GBuffer();
|
||||
BlendStateDescription gBufferBlendDesc = .Default;
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using GlitchyEngine.Core;
|
||||
using GlitchyEngine.Content;
|
||||
|
||||
namespace GlitchyEngine.Renderer
|
||||
{
|
||||
@@ -30,7 +31,7 @@ namespace GlitchyEngine.Renderer
|
||||
public ShaderTextureCollection Textures => _textures;
|
||||
|
||||
[AllowAppend]
|
||||
public this(StringView code, StringView? fileName, String entryPoint, ShaderDefine[] macros = null)
|
||||
public this(StringView code, StringView? fileName, String entryPoint, IContentManager contentManager, ShaderDefine[] macros = null)
|
||||
{
|
||||
Debug.Profiler.ProfileResourceFunction!();
|
||||
|
||||
@@ -39,7 +40,7 @@ namespace GlitchyEngine.Renderer
|
||||
_buffers = new BufferCollection();
|
||||
_textures = new ShaderTextureCollection();
|
||||
|
||||
CompileFromSource(code, fileName, entryPoint);
|
||||
CompileFromSource(code, fileName, entryPoint, contentManager);
|
||||
}
|
||||
|
||||
public ~this()
|
||||
@@ -47,19 +48,19 @@ namespace GlitchyEngine.Renderer
|
||||
Debug.Profiler.ProfileResourceFunction!();
|
||||
}
|
||||
|
||||
public static mixin FromFile<T>(String fileName, String entryPoint, ShaderDefine[] macros = null) where T : Shader
|
||||
/*public static mixin FromFile<T>(String fileName, String entryPoint, IContentManager contentManager, ShaderDefine[] macros = null) where T : Shader
|
||||
{
|
||||
Debug.Profiler.ProfileResourceFunction!();
|
||||
|
||||
String fileContent = new String();
|
||||
File.ReadAllText(fileName, fileContent, true);
|
||||
T shader = new T(fileContent, (StringView)fileName, entryPoint, macros);
|
||||
T shader = new T(fileContent, (StringView)fileName, contentManager, entryPoint, macros);
|
||||
|
||||
delete fileContent;
|
||||
|
||||
shader
|
||||
}
|
||||
}*/
|
||||
|
||||
public abstract void CompileFromSource(StringView code, StringView? fileName, String entryPoint, ShaderDefine[] macros = null);
|
||||
public abstract void CompileFromSource(StringView code, StringView? fileName, String entryPoint, IContentManager contentManager, ShaderDefine[] macros = null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using GlitchyEngine.Content;
|
||||
|
||||
namespace GlitchyEngine.Renderer
|
||||
{
|
||||
public class VertexShader : Shader
|
||||
{
|
||||
[AllowAppend]
|
||||
public this(StringView code, StringView? fileName, String entryPoint, ShaderDefine[] macros = null)
|
||||
: base(code, fileName, entryPoint, macros) { }
|
||||
public this(StringView code, StringView? fileName, String entryPoint, IContentManager contentManager = null, ShaderDefine[] macros = null)
|
||||
: base(code, fileName, entryPoint, contentManager, macros) { }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user