Fixed few problems with render pipeline.

This commit is contained in:
Michel Fedde 2021-03-19 22:57:10 +01:00
parent e24f7ebfb9
commit a9c53a1e52
5 changed files with 19 additions and 45 deletions

View file

@ -53,9 +53,10 @@ namespace SM.Base.Window
/// <inheritdoc/>
public virtual void Initialization()
{
MainFramebuffer.Name = GetType().Name + ".MainFramebuffer";
if (MainFramebuffer != null) Framebuffers.Add(MainFramebuffer);
if (MainFramebuffer != null) {
Framebuffers.Add(MainFramebuffer);
MainFramebuffer.Name = GetType().Name + ".MainFramebuffer";
}
DefaultShader ??= SMRenderer.DefaultMaterialShader;
}

View file

@ -1,5 +1,7 @@
using SM.Base.Shaders;
using OpenTK.Graphics.OpenGL4;
using SM.Base.Shaders;
using SM.Base.Window;
using SM.OGL.Framebuffer;
using SM2D.Shader;
namespace SM2D.Pipelines
@ -12,7 +14,8 @@ namespace SM2D.Pipelines
/// <summary>
/// The access to the pipeline.
/// </summary>
public static Basic2DPipeline Pipeline = new Basic2DPipeline();
public static Basic2DPipeline Pipeline =
new Basic2DPipeline();
/// <inheritdoc />
public override MaterialShader DefaultShader { get; protected set; } = ShaderCollection.Instanced;
@ -22,6 +25,8 @@ namespace SM2D.Pipelines
/// <inheritdoc />
protected override void RenderProcess(ref DrawContext context)
{
Framebuffer.Screen.Activate(FramebufferTarget.Framebuffer, ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
context.Scene?.Draw(context);
}
}

View file

@ -35,5 +35,4 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.1")]

View file

@ -3,9 +3,8 @@ using OpenTK.Graphics;
using OpenTK.Input;
using SM.Base;
using SM.Base.Window;
using SM.Game.Controls;
using SM2D;
using SM2D.Drawing;
using SM2D.Pipelines;
using SM2D.Scene;
using Font = SM.Base.Drawing.Text.Font;
using Vector2 = OpenTK.Vector2;
@ -19,20 +18,10 @@ namespace SM_TEST
private static GLWindow window;
static void Main(string[] args)
{
font = new Font(@"C:\Windows\Fonts\Arial.ttf")
{
FontSize = 16
};
//Log.SetLogFile(compressionFolder:"logs");
window = new GLWindow {VSync = VSyncMode.Off};
window = new GLWindow();
window.ApplySetup(new Window2DSetup());
window.SetRenderPipeline(new TestRenderPipeline());
window.SetRenderPipeline(Basic2DPipeline.Pipeline);
window.SetScene(scene = new Scene());
window.RunFixedUpdate(60);
window.Load += WindowOnLoad;
window.RenderFrame += WindowOnUpdateFrame;
window.Run();
}
@ -41,19 +30,6 @@ namespace SM_TEST
}
private static void WindowOnLoad(IGenericWindow window)
{
scene.ShowAxisHelper = true;
//scene.Background.Color = Color4.White;
DrawObject2D box = new DrawObject2D();
scene.Objects.Add(box);
DrawText text = new DrawText(font, "Test Text");
text.Transform.Position.Set(50, 0);
text.Transform.Size.Set(2);
scene.HUD.Add(text);
//particles.Trigger();
}
{ }
}
}

View file

@ -36,12 +36,6 @@
<Reference Include="OpenTK, Version=3.3.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>..\packages\OpenTK.3.3.1\lib\net20\OpenTK.dll</HintPath>
</Reference>
<Reference Include="SharpDX, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll</HintPath>
</Reference>
<Reference Include="SharpDX.XInput, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.XInput.4.2.0\lib\net45\SharpDX.XInput.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
@ -56,6 +50,9 @@
<None Include="OpenTK.dll.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SMCode\SM.Base\SM.Base.csproj">
<Project>{8e733844-4204-43e7-b3dc-3913cddabb0d}</Project>
@ -69,10 +66,6 @@
<Project>{a4565538-625a-42c6-a330-dd4f1abb3986}</Project>
<Name>SM2D</Name>
</ProjectReference>
<ProjectReference Include="..\SMOptionals\SM.Game\SM.Game.csproj">
<Project>{079bab31-3dc4-40da-90c7-efaa8517c647}</Project>
<Name>SM.Game</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>