diff options
author | chai <chaifix@163.com> | 2019-04-06 07:39:49 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-04-06 07:39:49 +0800 |
commit | e47baca4f23db43ec91fbf64d5d06d7c0dbee495 (patch) | |
tree | 9e909413bbf61834570e7dbdbe37fc8705f12730 /source/modules/asura-core/graphics/shader.h | |
parent | e13616b5c40f912853be99f0603f0e4c97b22062 (diff) |
*misc
Diffstat (limited to 'source/modules/asura-core/graphics/shader.h')
-rw-r--r-- | source/modules/asura-core/graphics/shader.h | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/source/modules/asura-core/graphics/shader.h b/source/modules/asura-core/graphics/shader.h index f4bce25..9cf9653 100644 --- a/source/modules/asura-core/graphics/shader.h +++ b/source/modules/asura-core/graphics/shader.h @@ -14,7 +14,6 @@ #include <asura-utils/stringmap.hpp> #include <asura-utils/manager.hpp> -#include "shader_source.h" #include "color.h" #include "texture.h" #include "gl.h" @@ -35,31 +34,14 @@ namespace AsuraEngine { public: - LUAX_DECL_FACTORY(Shader); - - Shader() asura_throw(Exception); + Shader(); ~Shader(); - /// - /// ӴshaderʱȼǷϴλuniforms location mapʹ - /// glAttachShader±ɫɫ - /// - bool Update(AEIO::DecodedData* decodeData) override; - - /// - /// shaderΪ - /// - void Use(); - - /// - /// shaderΪǻ - /// - void Unuse(); - - /// - /// Ѿ֪uniform location£ֵ - /// + bool Load(const std::string& vert, const std::string& frag); + + uint GetAttributeLocation(const std::string& name); + void SetUniformFloat(uint loc, float value); void SetUniformTexture(uint loc, const Texture& texture); void SetUniformVector2(uint loc, const Math::Vector2f& vec2); @@ -68,40 +50,32 @@ namespace AsuraEngine void SetUniformColor(uint loc, const Color& color); void SetUniformMatrix44(uint loc, const Math::Matrix44& mat44); + float GetUniformFloat(uint loc); + AEMath::Vector2f GetUniformVector2(uint loc); + AEMath::Vector3f GetUniformVector3(uint loc); + AEMath::Vector4f GetUniformVector4s(uint loc); + AEMath::Matrix44 GetUniformMatrix44(uint loc); + uint GetUniformLocation(const std::string& uniform); bool HasUniform(const std::string& uniform); GLuint GetGLProgramHandle(); - /// - /// texture unitһΪ16 - /// static uint GetGLTextureUnitCount(); private: - /// - /// ñ - /// vec2 Asura_Time xֵΪ뵱ǰʼʱ䣬yֵΪһ֡ʱ - /// vec2 Asura_RenderTargetSize RTĴСΪλ - /// Texture Asura_MainTexture - /// - void SetBuiltInUniforms(); - - /// - /// OpenGL shader program handle. - /// GLuint mProgram; GLuint mVertShader; GLuint mFragShader; - Luax::LuaxMemberRef mCodeRef; - private: //----------------------------------------------------------------------------// + LUAX_DECL_FACTORY(Shader); + LUAX_DECL_METHOD(_New); LUAX_DECL_METHOD(_Use); LUAX_DECL_METHOD(_Unuse); |