Implemented Materials

- Shaders get Textureslots via reflection
- added Textureslots to Effect
This commit is contained in:
Simon Lübeß
2021-08-09 18:03:47 +02:00
parent 2326e69c0c
commit 344accea60
10 changed files with 463 additions and 75 deletions
+37 -3
View File
@@ -12,10 +12,10 @@ namespace GlitchyEngine.Renderer
private ShaderVariableType _type;
private uint32 _columns;
private uint32 _rows;
internal uint32 _columns;
internal uint32 _rows;
private uint32 _offset;
private uint32 _sizeInBytes;
internal uint32 _sizeInBytes;
private bool _isUsed;
@@ -25,6 +25,8 @@ namespace GlitchyEngine.Renderer
public String Name => _name;
public bool IsUsed => _isUsed;
/**
* Gets a pointer to the start of the variable in the constant buffers backing data.
*/
@@ -58,6 +60,38 @@ namespace GlitchyEngine.Renderer
Log.EngineLogger.Warning($"The types do not match: Expected \"{_type}\" but Received \"{type}\" instead. Variable: \"{_name}\" of buffer: \"{_constantBuffer.Name}\"");
#endif
}
public void EnsureTypeMatch<T>()
{
switch(typeof(T))
{
case typeof(bool):
EnsureTypeMatch(1, 1, .Bool);
case typeof(float):
EnsureTypeMatch(1, 1, .Float);
case typeof(Vector2):
EnsureTypeMatch(1, 2, .Float);
case typeof(Vector3):
EnsureTypeMatch(1, 3, .Float);
case typeof(Vector4):
EnsureTypeMatch(1, 4, .Float);
case typeof(Matrix4x3):
EnsureTypeMatch(4, 3, .Float);
case typeof(Matrix3x3):
EnsureTypeMatch(3, 3, .Float);
case typeof(Matrix):
EnsureTypeMatch(4, 4, .Float);
case typeof(ColorRGB):
EnsureTypeMatch(1, 3, .Float);
case typeof(ColorRGBA):
EnsureTypeMatch(1, 4, .Float);
case typeof(Color):
EnsureTypeMatch(1, 4, .Float);
}
}
public void SetData(bool value)
{