smrendererv3/SM.Core/Shaders/UniformCollection.cs
Michel Fedde 421d03f91d 15.09.2020
Everything currently don't work / can't be tested.

+ Generic Shader-Implermentation
+ Mesh-System + Plate-Mesh
2020-09-15 22:16:18 +02:00

34 lines
No EOL
907 B
C#

using System;
using System.Collections.Generic;
using OpenTK.Graphics.OpenGL4;
namespace SM.OGL.Shaders
{
public class UniformCollection : Dictionary<string, Uniform>
{
internal GenericShader _parentShader;
public new Uniform this[string key]
{
get
{
try
{
return base[key];
}
catch (KeyNotFoundException)
{
Console.WriteLine("[Error] Uniform '"+key+"' was not found. Tried to recreate it.");
Uniform u = new Uniform(GL.GetUniformLocation(_parentShader, key), this);
Add(key, u);
return u;
}
}
}
public void Add(string key, int location)
{
base.Add(key, new Uniform(location, this));
}
}
}