diff options
author | chai <chaifix@163.com> | 2021-11-20 17:32:55 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-20 17:32:55 +0800 |
commit | bb452bba78dc1870d6316b383180472fe3a8a06a (patch) | |
tree | 6084d6c608e00f28fe4b1437e0df228d68c268de /Runtime/Scripting/Rendering/Shader.bind.cpp | |
parent | 74ca8143a7c2352425d549b681b2838bda5ee218 (diff) |
*gui
Diffstat (limited to 'Runtime/Scripting/Rendering/Shader.bind.cpp')
-rw-r--r-- | Runtime/Scripting/Rendering/Shader.bind.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Runtime/Scripting/Rendering/Shader.bind.cpp b/Runtime/Scripting/Rendering/Shader.bind.cpp index 4c0c321..a001633 100644 --- a/Runtime/Scripting/Rendering/Shader.bind.cpp +++ b/Runtime/Scripting/Rendering/Shader.bind.cpp @@ -16,12 +16,11 @@ LUA_BIND_REGISTRY(Shader) { "IsValid", _IsValid }, { "Use", _Use }, { "Unuse", _UnUse }, - //{ "SetColor", _SetColor }, + { "SetColor", _SetColor }, { "SetTexture", _SetTexture }, { "SetVector2", _SetVector2 }, { "SetVector3", _SetVector3 }, { "SetVector4", _SetVector4 }, - //{ "SetMatrix3", _SetMatrix3 }, { "SetMatrix44", _SetMatrix4 } ); } @@ -165,6 +164,20 @@ LUA_BIND_IMPL_METHOD(Shader, _SetVector4) return 1; } +// SetColor(name, color) +LUA_BIND_IMPL_METHOD(Shader, _SetColor) +{ + LUA_BIND_PREPARE(L, Shader); + LUA_BIND_CHECK(L, "ST"); + + cc8* name = state.GetValue(1, ""); + Color col = state.GetValue<Color>(2, Color()); + Vector4 v = Vector4(col.r, col.g, col.b, col.a); + + g_GfxDevice.SetUniformVec4(name, v); + return 1; +} + // shader.SetMatrix4(name, mat4) // shader.SetMatrix4(name, {}) LUA_BIND_IMPL_METHOD(Shader, _SetMatrix4) |