From 7894c2971626f9560b4ec77a1ce5a9a64a4f3810 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 21 Jun 2019 22:47:36 +0800 Subject: =?UTF-8?q?*=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/modules/asura-core/graphics/shader.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'source/modules/asura-core/graphics/shader.h') diff --git a/source/modules/asura-core/graphics/shader.h b/source/modules/asura-core/graphics/shader.h index 61aa6f1..30a386e 100644 --- a/source/modules/asura-core/graphics/shader.h +++ b/source/modules/asura-core/graphics/shader.h @@ -26,9 +26,9 @@ namespace AsuraEngine { /// - /// 一个shader是一个在材质间共享的程序。Shader本身不保存uniforms和顶点数据,只提供设置 - /// uniforms和use着色器的方法。编辑器针对每个shader,会通过shader代码找到声明的uniforms - /// 变量,并暴露给framework的material设置。 + /// 一个shader是一个在材质间共享的程序。Shader本身不保存uniforms和顶点数据,只提供设置 uniforms和use着色 + /// 器的方法。编辑器针对每个shader,会通过shader代码找到声明的uniforms变量,并暴露给framework的material + /// 设置。 /// class Shader ASURA_FINAL : public Scripting::Portable @@ -40,10 +40,16 @@ namespace AsuraEngine ~Shader(); + static void SetActive(Shader* shader); + static Shader* GetActive(); + bool Load(const std::string& vert, const std::string& frag) ASURA_THROW(Exception); - void OnUse(); - void OnUnuse(); + // 使用SetActive切换shader时调用 + void OnEnable(); + void OnDisable(); + // Draw call之后调用 + void OnUsed(); void SetAttribute(int loc, VertexBuffer* vbo, uint offseti = 0, uint stridei = 0, bool normalized = false); int GetAttributeLocation(const std::string& attribute); @@ -105,7 +111,6 @@ namespace AsuraEngine }; - // 别名,用于表明这是一个GPU程序 typedef Shader GpuProgram; } -- cgit v1.1-26-g67d0