16.09.2020
~ Fixed shading import ~ Fixed "Plate" mesh ~ Move the dll files into "SMCode"
This commit is contained in:
parent
421d03f91d
commit
9889366317
27 changed files with 30 additions and 17 deletions
34
SMCode/SM.OGL/Shaders/UniformCollection.cs
Normal file
34
SMCode/SM.OGL/Shaders/UniformCollection.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue