From 40d40edcdeef4978a0d9c7333b7007d1fa4c0bc6 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 28 Oct 2021 16:24:34 +0800 Subject: *misc --- Runtime/Graphics/Shader.h | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'Runtime/Graphics/Shader.h') diff --git a/Runtime/Graphics/Shader.h b/Runtime/Graphics/Shader.h index 7cca768..614e127 100644 --- a/Runtime/Graphics/Shader.h +++ b/Runtime/Graphics/Shader.h @@ -4,14 +4,16 @@ #include "Runtime/Graphics/OpenGL.h" #include "Runtime/Lua/LuaHelper.h" #include "Runtime/Utilities/UtilMacros.h" +#include "Runtime/Utilities/Assert.h" #include "runtime/Debug/Log.h" // ×ÅÉ«Æ÷³ÌÐò class Shader : public LuaBind::NativeClass { public: - Shader(LuaBind::VM*vm, bool keepSrc = false); - Shader(LuaBind::VM*vm, std::string& vert, std::string& frag, bool keepSrc = false)/*throw(ShaderCompileExecption)*/; + Shader(LuaBind::VM*vm, bool keepSrc = false)/*throw(ShaderCompileExecption)*/; + Shader(LuaBind::VM*vm, std::string& glslShader, bool keepSrc = false)/*throw(ShaderCompileExecption)*/; + Shader(LuaBind::VM*vm, const char* vert, const char* frag, bool keepSrc = false)/*throw(ShaderCompileExecption)*/; ~Shader(); void ReCompile(std::string& vert, std::string frag)/*throw(ShaderCompileExecption)*/; @@ -23,6 +25,8 @@ public: GET(GLint, ID, m_ProgramID); private: + void CompileProgram(const char* vert, const char* frag, bool keepSrc = false); + bool m_KeepSrc; std::string m_VertSrc; @@ -47,14 +51,8 @@ private: class ShaderCompileExecption : public std::exception { public: - ShaderCompileExecption(std::string& err) - { - m_Err = err; - } - char const* what() const override - { - return m_Err.c_str(); + ShaderCompileExecption(const char* what) + : std::exception(what) + { } -private: - std::string m_Err; -}; \ No newline at end of file +}; -- cgit v1.1-26-g67d0