26 Sep 2021
General: + Added Summaries Renderer ------- SM.Base: + SM.Base.Controls.Mouse now has a feature to disable tracking. + Replaced Bloom Effect with the similar system how blender use it. + You can now disable ANY post processing effects. + Interpolation for CVectors. + MathUtils + RenderPipelines now have a central list for post processing effects. ~ Log-System is now ignored if a debugger is attached. ~ Post Processing Shader does now send the texel size as the "renderedTextureTexelSize"-uniform. ~ Improved Text Rendering SM.OGL: + ColorAttachments now contain a reference to the framebuffer its connected. + ColorAttachments can now have a own size. + Framebuffer.Append(string key, Vector2 size, int pos) +Framebuffers now have a method to completely reset itself. + Framebuffers now have a Blit-method called "CopyTo". ~ Framebuffer.GetCurrentlyActive() will now return an actual SM.OGL.Framebuffer-object. ~ Renderbuffers now are a class and contain the ID by itself. ~ Renamed Uniform-function to its class-name: f.E. SetBool, SetFloat instead of SetUniform1 Optionals: Controls: + Framecache for the GameController.GetState()
This commit is contained in:
parent
dffa581596
commit
9b52d401e7
61 changed files with 1529 additions and 818 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
|
|
|||
10
tests/SM_TEST/Default Fragment Shader1.frag
Normal file
10
tests/SM_TEST/Default Fragment Shader1.frag
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#version 330 core
|
||||
|
||||
uniform vec4 Color;
|
||||
uniform float Scale;
|
||||
|
||||
layout(location = 0) out vec4 color;
|
||||
|
||||
void main() {
|
||||
color = Color * Scale;
|
||||
}
|
||||
|
|
@ -3,15 +3,20 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
using ShaderToolParser;
|
||||
using SharpDX.XInput;
|
||||
using SM.Base;
|
||||
using SM.Base.Animation;
|
||||
using SM.Base.Controls;
|
||||
using SM.Base.Drawing;
|
||||
using SM.Base.Drawing.Text;
|
||||
using SM.Base.Shaders;
|
||||
using SM.Base.Time;
|
||||
using SM.Base.Utility;
|
||||
using SM.Base.Window;
|
||||
using SM.Intergrations.ShaderTool;
|
||||
using SM.Utils.Controls;
|
||||
|
|
@ -28,25 +33,25 @@ namespace SM_TEST
|
|||
{
|
||||
static Scene scene;
|
||||
private static GLWindow window;
|
||||
private static PolyLine line;
|
||||
private static GameController controller;
|
||||
|
||||
private static ItemCollection test;
|
||||
private static DrawParticles particles;
|
||||
|
||||
private static InterpolationProcess interpolation;
|
||||
private static GameKeybindActor actor;
|
||||
|
||||
public static STPProject portal;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
static void Main(string[] args){
|
||||
Font font = new Font(@".\GapSansBold.ttf")
|
||||
{
|
||||
FontSize = 51,
|
||||
CharSet = new char[]
|
||||
{
|
||||
'I', 'A','M','T','W','O'
|
||||
}
|
||||
};
|
||||
font.RegenerateTexture();
|
||||
|
||||
controller = new GameController(0);
|
||||
GameKeybindHost host = new GameKeybindHost(new GameKeybindList()
|
||||
{
|
||||
{"g_test", context => Keyboard.IsAnyKeyPressed, context => context.ControllerState.Buttons[GamepadButtonFlags.A, true]}
|
||||
});
|
||||
actor = GameKeybindActor.CreateControllerActor(controller);
|
||||
actor.ConnectHost(host);
|
||||
|
||||
|
||||
portal = STPProject.CreateFromZIP("portal.zip");
|
||||
|
||||
|
|
@ -58,18 +63,45 @@ namespace SM_TEST
|
|||
{
|
||||
ShowAxisHelper = true
|
||||
});
|
||||
scene.Background.Color = Color4.Red;
|
||||
//scene.Background.Color = Color4.Red;
|
||||
scene.Camera = new Camera()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
DrawText obj = new DrawText(font, "I AM\n\tTWO")
|
||||
{};
|
||||
SimpleShader shader = new SimpleShader("basic", AssemblyUtility.ReadAssemblyFile("SM_TEST.Default Fragment Shader1.frag"), (a, b) => {
|
||||
a["Color"].SetColor(b.Material.Tint);
|
||||
a["Scale"].SetFloat(b.Material.ShaderArguments.Get("Scale", 1f));
|
||||
|
||||
});
|
||||
DrawObject2D obj = new DrawObject2D()
|
||||
{
|
||||
Material =
|
||||
{
|
||||
CustomShader = shader,
|
||||
Tint = new Color4(1f, 0.151217f, 0.050313f, 1),
|
||||
ShaderArguments =
|
||||
{
|
||||
["Scale"] = 50f
|
||||
}
|
||||
}
|
||||
};/*
|
||||
DrawObject2D obj2 = new DrawObject2D()
|
||||
{
|
||||
Material =
|
||||
{
|
||||
Tint = Color4.Aqua,
|
||||
CustomShader = shader,
|
||||
ShaderArguments =
|
||||
{
|
||||
["Scale"] = 1000f
|
||||
}
|
||||
}
|
||||
};
|
||||
obj2.Transform.Position.Set(300);*/
|
||||
|
||||
scene.Objects.Add(obj);
|
||||
|
||||
window.UpdateFrame += WindowOnUpdateFrame;
|
||||
window.RenderFrame += Window_RenderFrame;
|
||||
window.Run();
|
||||
|
||||
|
|
@ -80,11 +112,5 @@ namespace SM_TEST
|
|||
{
|
||||
window.Title = Math.Floor(e.Time * 1000) + "ms";
|
||||
}
|
||||
|
||||
private static void WindowOnUpdateFrame(object sender, FrameEventArgs e)
|
||||
{
|
||||
bool interactions = new GameController(0).GetState().AnyInteraction;
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,12 +10,13 @@
|
|||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>SM_TEST</RootNamespace>
|
||||
<AssemblyName>SM_TEST</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
|
@ -66,6 +67,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<EmbeddedResource Include="Default Fragment Shader1.frag" />
|
||||
<None Include="OpenTK.dll.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using OpenTK.Graphics.OpenGL4;
|
||||
using SM.Base.Legacy.PostProcessing;
|
||||
using SM.Base.PostEffects;
|
||||
using SM.Base.Window;
|
||||
using SM.Intergrations.ShaderTool;
|
||||
|
|
@ -9,6 +10,7 @@ namespace SM_TEST
|
|||
{
|
||||
public class TestRenderPipeline : RenderPipeline
|
||||
{
|
||||
private BloomEffectOld _bloomObsolete;
|
||||
private BloomEffect _bloom;
|
||||
private STPostProcessEffect _vittage;
|
||||
|
||||
|
|
@ -17,16 +19,15 @@ namespace SM_TEST
|
|||
public override void Initialization()
|
||||
{
|
||||
|
||||
MainFramebuffer = CreateWindowFramebuffer(16, PixelInformation.RGBA_HDR);
|
||||
MainFramebuffer = CreateWindowFramebuffer(0, PixelInformation.RGBA_HDR, true);
|
||||
|
||||
_postBuffer = CreateWindowFramebuffer(0, PixelInformation.RGBA_HDR, depth: true);
|
||||
Framebuffers.Add(_postBuffer);
|
||||
_bloom = new BloomEffect(_postBuffer, hdr: true, .75f)
|
||||
_bloom = new BloomEffect(true)
|
||||
{
|
||||
Radius = 20,
|
||||
};
|
||||
_bloom.Initilize(this);
|
||||
PostProcessEffects.Add(_bloom);
|
||||
|
||||
_vittage = new STPostProcessEffect(Program.portal.DrawNodes.Find(a => a.Variables.ContainsKey("_ViewportSize")))
|
||||
/*_vittage = new STPostProcessEffect(Program.portal.DrawNodes.Find(a => a.Variables.ContainsKey("_ViewportSize")))
|
||||
{
|
||||
Arguments =
|
||||
{
|
||||
|
|
@ -36,7 +37,8 @@ namespace SM_TEST
|
|||
{"Move", 3.33f}
|
||||
}
|
||||
};
|
||||
_vittage.Initilize(this);
|
||||
_vittage.Initilize(this);*/
|
||||
InitizePostProcessing();
|
||||
|
||||
base.Initialization();
|
||||
}
|
||||
|
|
@ -50,16 +52,17 @@ namespace SM_TEST
|
|||
context.Scene.DrawHUD(context);
|
||||
|
||||
GL.Disable(EnableCap.DepthTest);
|
||||
_postBuffer.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
PostProcessUtility.ResolveMultisampledBuffers(MainFramebuffer, _postBuffer);
|
||||
//_postBuffer.Activate(ClearBufferMask.ColorBufferBit);
|
||||
//PostProcessUtility.ResolveMultisampledBuffers(MainFramebuffer, _postBuffer);
|
||||
|
||||
_vittage.Draw(_postBuffer["color"], context);
|
||||
_bloom.Draw(_postBuffer["color"], context);
|
||||
//_vittage.Draw(MainFramebuffer["color"], context);
|
||||
//_bloom.Draw(MainFramebuffer["color"], context);
|
||||
_bloomObsolete.Draw(MainFramebuffer["color"], context);
|
||||
Framebuffer.Screen.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
|
||||
PostProcessUtility.FinalizeHDR(_postBuffer["color"], .1f);
|
||||
PostProcessUtility.FinalizeHDR(MainFramebuffer["color"], 1f);
|
||||
|
||||
context.Scene.DrawDebug(context);
|
||||
//context.Scene.DrawDebug(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue