From a077eb38b01292611f4f6031b75e3e2c1c20f06e Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Aug 2019 08:54:08 +0800 Subject: *misc --- source/modules/asura-core/Graphics/Shader.h | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 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 615b028..6d7ef90 100644 --- a/source/modules/asura-core/Graphics/Shader.h +++ b/source/modules/asura-core/Graphics/Shader.h @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -23,10 +24,21 @@ namespace_begin(AsuraEngine) namespace_begin(Graphics) +enum ShaderChannel +{ + SHADER_CHANNEL_NONE = -1, + SHADER_CHANNEL_VERTEX = 0, // Vertex (vector3) + SHADER_CHANNEL_NORMAL, // Normal (vector3) + SHADER_CHANNEL_COLOR, // Vertex color + SHADER_CHANNEL_TEXCOORD0, // UV set 0 (vector2) + SHADER_CHANNEL_TEXCOORD1, // UV set 1 (vector2) + SHADER_CHANNEL_TANGENT, // Tangent (vector4) + SHADER_CHANNEL_COUNT, // Keep this last! +}; + /// -/// 一个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 @@ -64,10 +76,10 @@ public: bool SetUniformTexture(uint loc, const Texture& texture); float GetUniformFloat(uint loc); - AEMath::Vector2f GetUniformVector2(uint loc); - AEMath::Vector3f GetUniformVector3(uint loc); - AEMath::Vector4f GetUniformVector4s(uint loc); - AEMath::Matrix44 GetUniformMatrix44(uint loc); + Vector2f GetUniformVector2(uint loc); + Vector3f GetUniformVector3(uint loc); + Vector4f GetUniformVector4s(uint loc); + Matrix44 GetUniformMatrix44(uint loc); GLuint GetGLProgram(); @@ -109,6 +121,7 @@ luaxport: }; +// GPU program typedef Shader GpuProgram; namespace_end -- cgit v1.1-26-g67d0