1.0.14
NUGET-Changes: + Materials now have a method to draw. That should allow more freedom on how materials can have a effect on the resulting shader. ~ PostProcessEffect.Draw now needs a source ColorAttachment. ~ Added some missing summaries GIT-/SOLUTION-Changes: Remade the folder structure, to something more senseable.
This commit is contained in:
parent
db7f01dca1
commit
89de4258e1
181 changed files with 584 additions and 698 deletions
6
tests/SM_TEST/App.config
Normal file
6
tests/SM_TEST/App.config
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
25
tests/SM_TEST/OpenTK.dll.config
Normal file
25
tests/SM_TEST/OpenTK.dll.config
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<configuration>
|
||||
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
|
||||
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
|
||||
<dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
|
||||
<dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
|
||||
<dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
|
||||
<dllmap os="linux" dll="libX11" target="libX11.so.6"/>
|
||||
<dllmap os="linux" dll="libXi" target="libXi.so.6"/>
|
||||
<dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/>
|
||||
<dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
|
||||
<dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
|
||||
<dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
|
||||
<dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
|
||||
<dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
|
||||
<dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
|
||||
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
|
||||
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
|
||||
<!-- XQuartz compatibility (X11 on Mac) -->
|
||||
<dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
|
||||
<dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
|
||||
<dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
|
||||
<dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
|
||||
<dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
|
||||
<dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
|
||||
</configuration>
|
||||
97
tests/SM_TEST/Program.cs
Normal file
97
tests/SM_TEST/Program.cs
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
using ShaderToolParser;
|
||||
using SM.Base;
|
||||
using SM.Base.Animation;
|
||||
using SM.Base.Controls;
|
||||
using SM.Base.Drawing;
|
||||
using SM.Base.Time;
|
||||
using SM.Base.Window;
|
||||
using SM.Intergrations.ShaderTool;
|
||||
using SM2D;
|
||||
using SM2D.Controls;
|
||||
using SM2D.Drawing;
|
||||
using SM2D.Object;
|
||||
using SM2D.Scene;
|
||||
using Font = SM.Base.Drawing.Text.Font;
|
||||
|
||||
namespace SM_TEST
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static Scene scene;
|
||||
private static GLWindow window;
|
||||
private static PolyLine line;
|
||||
|
||||
private static ItemCollection test;
|
||||
private static DrawParticles particles;
|
||||
|
||||
private static InterpolationProcess interpolation;
|
||||
|
||||
public static STPProject portal;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Font font = new Font(@"C:\Windows\Fonts\Arial.ttf")
|
||||
{
|
||||
FontSize = 30,
|
||||
};
|
||||
font.RegenerateTexture();
|
||||
|
||||
portal = STPProject.CreateFromZIP("portal.zip");
|
||||
|
||||
window = new GLWindow(1280, 720, "0ms", WindowFlags.Window, VSyncMode.Off);
|
||||
window.ApplySetup(new Window2DSetup());
|
||||
window.SetRenderPipeline(new TestRenderPipeline());
|
||||
|
||||
window.SetScene(scene = new Scene()
|
||||
{
|
||||
ShowAxisHelper = true
|
||||
});
|
||||
scene.Background.Color = Color4.Red;
|
||||
scene.Camera = new Camera()
|
||||
{
|
||||
|
||||
};
|
||||
DrawObject2D obj = new DrawObject2D()
|
||||
{
|
||||
Material = new STMaterial(portal.DrawNodes.First(a => a.Variables.ContainsKey("_MATColor")))
|
||||
{
|
||||
ShaderArguments = {
|
||||
{ "RingLoc", .33f },
|
||||
|
||||
}
|
||||
},
|
||||
Mesh = Polygon.GenerateCircle()
|
||||
};
|
||||
obj.Transform.Size.Set(200);
|
||||
scene.Objects.Add(obj);
|
||||
|
||||
window.UpdateFrame += WindowOnUpdateFrame;
|
||||
window.RenderFrame += Window_RenderFrame;
|
||||
window.Run();
|
||||
|
||||
Debug.WriteLine("Window Closed");
|
||||
}
|
||||
|
||||
private static void Window_RenderFrame(object sender, FrameEventArgs e)
|
||||
{
|
||||
window.Title = Math.Floor(e.Time * 1000) + "ms";
|
||||
}
|
||||
|
||||
private static void WindowOnUpdateFrame(object sender, FrameEventArgs e)
|
||||
{
|
||||
/*
|
||||
if (Mouse.LeftClick)
|
||||
particles.Trigger();
|
||||
if (Mouse.RightClick)
|
||||
particles.ContinuousInterval = .05f;*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
35
tests/SM_TEST/Properties/AssemblyInfo.cs
Normal file
35
tests/SM_TEST/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SM_TEST")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("SM_TEST")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("6d4fb8e6-4d0b-4928-8f9e-ef5c2fbf44e8")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// 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")]
|
||||
101
tests/SM_TEST/SM_TEST.csproj
Normal file
101
tests/SM_TEST/SM_TEST.csproj
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\packages\SharpFont.4.0.1\build\SharpFont.props" Condition="Exists('..\..\packages\SharpFont.4.0.1\build\SharpFont.props')" />
|
||||
<Import Project="..\..\packages\SharpFont.Dependencies.2.6\build\SharpFont.Dependencies.props" Condition="Exists('..\..\packages\SharpFont.Dependencies.2.6\build\SharpFont.Dependencies.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{6D4FB8E6-4D0B-4928-8F9E-EF5C2FBF44E8}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>SM_TEST</RootNamespace>
|
||||
<AssemblyName>SM_TEST</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<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="ShaderToolParser, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\ShaderToolParser.1.0.0-pre3\lib\net450\ShaderToolParser.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="SharpFont, Version=4.0.1.200, Culture=neutral, PublicKeyToken=48add4c483071cdf, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\SharpFont.4.0.1\lib\net45\SharpFont.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestRenderPipeline.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="OpenTK.dll.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\optionals\SM.Intergrations\SM.Intergrations.csproj">
|
||||
<Project>{4cb351f4-b3f2-4f77-acc2-02f21dbf5ec2}</Project>
|
||||
<Name>SM.Intergrations</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\renderer\SM.Base\SM.Base.csproj">
|
||||
<Project>{8e733844-4204-43e7-b3dc-3913cddabb0d}</Project>
|
||||
<Name>SM.Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\renderer\SM.OGL\SM.OGL.csproj">
|
||||
<Project>{f604d684-bc1d-4819-88b5-8b5d03a17be0}</Project>
|
||||
<Name>SM.OGL</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\renderer\SM2D\SM2D.csproj">
|
||||
<Project>{a4565538-625a-42c6-a330-dd4f1abb3986}</Project>
|
||||
<Name>SM2D</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\SharpFont.Dependencies.2.6\build\SharpFont.Dependencies.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SharpFont.Dependencies.2.6\build\SharpFont.Dependencies.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\SharpFont.4.0.1\build\SharpFont.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SharpFont.4.0.1\build\SharpFont.props'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
65
tests/SM_TEST/TestRenderPipeline.cs
Normal file
65
tests/SM_TEST/TestRenderPipeline.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
using OpenTK.Graphics.OpenGL4;
|
||||
using SM.Base.PostEffects;
|
||||
using SM.Base.Window;
|
||||
using SM.Intergrations.ShaderTool;
|
||||
using SM.OGL.Framebuffer;
|
||||
using SM.OGL.Texture;
|
||||
|
||||
namespace SM_TEST
|
||||
{
|
||||
public class TestRenderPipeline : RenderPipeline
|
||||
{
|
||||
private BloomEffect _bloom;
|
||||
private STPostProcessEffect _vittage;
|
||||
|
||||
private Framebuffer _postBuffer;
|
||||
|
||||
public override void Initialization()
|
||||
{
|
||||
|
||||
MainFramebuffer = CreateWindowFramebuffer(16, PixelInformation.RGBA_HDR);
|
||||
|
||||
_postBuffer = CreateWindowFramebuffer(0, PixelInformation.RGBA_HDR, depth: true);
|
||||
Framebuffers.Add(_postBuffer);
|
||||
_bloom = new BloomEffect(_postBuffer, hdr: true, .75f)
|
||||
{
|
||||
};
|
||||
_bloom.Initilize(this);
|
||||
|
||||
_vittage = new STPostProcessEffect(Program.portal.DrawNodes.Find(a => a.Variables.ContainsKey("_ViewportSize")))
|
||||
{
|
||||
Arguments =
|
||||
{
|
||||
{"CheckSize", 10f},
|
||||
{"Strength", .25f},
|
||||
{"TargetSize", 5f},
|
||||
{"Move", 3.33f}
|
||||
}
|
||||
};
|
||||
_vittage.Initilize(this);
|
||||
|
||||
base.Initialization();
|
||||
}
|
||||
|
||||
protected override void RenderProcess(ref DrawContext context)
|
||||
{
|
||||
GL.Enable(EnableCap.DepthTest);
|
||||
MainFramebuffer.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
context.Scene.DrawBackground(context);
|
||||
context.Scene.DrawMainObjects(context);
|
||||
context.Scene.DrawHUD(context);
|
||||
|
||||
GL.Disable(EnableCap.DepthTest);
|
||||
_postBuffer.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
PostProcessUtility.ResolveMultisampledBuffers(MainFramebuffer, _postBuffer);
|
||||
|
||||
_vittage.Draw(_postBuffer["color"], context);
|
||||
_bloom.Draw(_postBuffer["color"], context);
|
||||
Framebuffer.Screen.Activate(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
|
||||
PostProcessUtility.FinalizeHDR(_postBuffer["color"], .1f);
|
||||
|
||||
context.Scene.DrawDebug(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
9
tests/SM_TEST/packages.config
Normal file
9
tests/SM_TEST/packages.config
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="OpenTK" version="3.3.1" targetFramework="net452" />
|
||||
<package id="ShaderToolParser" version="1.0.0-pre3" targetFramework="net452" />
|
||||
<package id="SharpDX" version="4.2.0" targetFramework="net452" />
|
||||
<package id="SharpDX.XInput" version="4.2.0" targetFramework="net452" />
|
||||
<package id="SharpFont" version="4.0.1" targetFramework="net452" />
|
||||
<package id="SharpFont.Dependencies" version="2.6" targetFramework="net452" />
|
||||
</packages>
|
||||
Loading…
Add table
Add a link
Reference in a new issue