mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-01 08:15:48 +00:00
Shader - Added ShaderSource.cs
This commit is contained in:
@@ -158,6 +158,7 @@
|
||||
<Compile Include="Rendering\Renderer.cs" />
|
||||
<Compile Include="Rendering\RenderGroup.cs" />
|
||||
<Compile Include="Rendering\Shader.cs" />
|
||||
<Compile Include="Rendering\ShaderSource.cs" />
|
||||
<Compile Include="Rendering\SkinRenderer.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -98,12 +98,12 @@ namespace PckStudio.Rendering
|
||||
public static Shader Create(string vertexSource, string fragmentSource)
|
||||
{
|
||||
return Create(
|
||||
new KeyValuePair<ShaderType, string>(ShaderType.VertexShader, vertexSource),
|
||||
new KeyValuePair<ShaderType, string>(ShaderType.FragmentShader, fragmentSource)
|
||||
new ShaderSource(ShaderType.VertexShader, vertexSource),
|
||||
new ShaderSource(ShaderType.FragmentShader, fragmentSource)
|
||||
);
|
||||
}
|
||||
|
||||
public static Shader Create(params KeyValuePair<ShaderType, string>[] shaderSources)
|
||||
public static Shader Create(params ShaderSource[] shaderSources)
|
||||
{
|
||||
int programId = GL.CreateProgram();
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace PckStudio.Rendering
|
||||
|
||||
foreach (var shaderSource in shaderSources)
|
||||
{
|
||||
int shaderId = CompileShader(shaderSource.Key, shaderSource.Value);
|
||||
int shaderId = CompileShader(shaderSource.Type, shaderSource.Source);
|
||||
GL.AttachShader(programId, shaderId);
|
||||
shaderIds.Add(shaderId);
|
||||
}
|
||||
|
||||
21
PCK-Studio/Rendering/ShaderSource.cs
Normal file
21
PCK-Studio/Rendering/ShaderSource.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
|
||||
namespace PckStudio.Rendering
|
||||
{
|
||||
internal readonly struct ShaderSource
|
||||
{
|
||||
public readonly ShaderType Type;
|
||||
public readonly string Source;
|
||||
|
||||
public ShaderSource(ShaderType type, string source)
|
||||
{
|
||||
Type = type;
|
||||
Source = source;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user