15.09.2020
Everything currently don't work / can't be tested. + Generic Shader-Implermentation + Mesh-System + Plate-Mesh
This commit is contained in:
parent
551d393ac2
commit
421d03f91d
24 changed files with 726 additions and 4 deletions
34
SM.Core/Shaders/ShaderFileCollection.cs
Normal file
34
SM.Core/Shaders/ShaderFileCollection.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using OpenTK.Graphics.OpenGL4;
|
||||
|
||||
namespace SM.OGL.Shaders
|
||||
{
|
||||
public struct ShaderFileCollection
|
||||
{
|
||||
public ShaderFile Vertex;
|
||||
public ShaderFile Geometry;
|
||||
public ShaderFile Fragment;
|
||||
|
||||
public ShaderFileCollection(string vertex, string fragment) : this(new ShaderFile(vertex), new ShaderFile(fragment)) {}
|
||||
|
||||
public ShaderFileCollection(ShaderFile vertex, ShaderFile fragment, ShaderFile geometry = default)
|
||||
{
|
||||
Vertex = vertex;
|
||||
Geometry = geometry;
|
||||
Fragment = fragment;
|
||||
}
|
||||
|
||||
internal void Append(GenericShader shader)
|
||||
{
|
||||
Vertex.Compile(shader, ShaderType.VertexShader);
|
||||
Geometry?.Compile(shader, ShaderType.GeometryShader);
|
||||
Fragment.Compile(shader, ShaderType.FragmentShader);
|
||||
}
|
||||
|
||||
internal void Detach(GenericShader shader)
|
||||
{
|
||||
GL.DetachShader(Vertex, shader);
|
||||
if (Geometry != null) GL.DetachShader(Geometry, shader);
|
||||
GL.DetachShader(Fragment, shader);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue