diff options
| author | chai <chaifix@163.com> | 2019-03-29 22:51:04 +0800 |
|---|---|---|
| committer | chai <chaifix@163.com> | 2019-03-29 22:51:04 +0800 |
| commit | c302f5ae5f9e30a28e487e8a764d9cc31546bbea (patch) | |
| tree | 7f18bedeece950600336ea7ced7c52c468552c98 /source/libs/asura-lib-core/graphics/shader.h | |
| parent | 157530b8b6e11efc5573d5a0db8987a440197aa1 (diff) | |
*rename
Diffstat (limited to 'source/libs/asura-lib-core/graphics/shader.h')
| -rw-r--r-- | source/libs/asura-lib-core/graphics/shader.h | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/source/libs/asura-lib-core/graphics/shader.h b/source/libs/asura-lib-core/graphics/shader.h deleted file mode 100644 index 1c81355..0000000 --- a/source/libs/asura-lib-core/graphics/shader.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef __ASURA_ENGINE_SHADER_H__ -#define __ASURA_ENGINE_SHADER_H__ - -#include <map> -#include <string> - -#include <asura-lib-utils/scripting/portable.hpp> -#include <asura-lib-utils/io/reloadable.h> -#include <asura-lib-utils/math/vector2.hpp> -#include <asura-lib-utils/math/vector3.hpp> -#include <asura-lib-utils/math/vector4.h> -#include <asura-lib-utils/math/matrix44.h> -#include <asura-lib-utils/stringmap.hpp> -#include <asura-lib-utils/manager.hpp> - -#include "color.h" -#include "texture.h" -#include "gl.h" - -namespace AsuraEngine -{ - namespace Graphics - { - - /// - /// Ò»¸öshaderÊÇÒ»¸öÔÚ²ÄÖʼ乲ÏíµÄ³ÌÐò¡£Shader±¾Éí²»±£´æuniformsºÍ¶¥µãÊý¾Ý£¬Ö»ÌṩÉèÖÃuniformsºÍuse×ÅÉ«Æ÷µÄ·½·¨¡£±à¼ - /// Æ÷Õë¶Ôÿ¸öshader£¬»áͨ¹ýshader´úÂëÕÒµ½ÉùÃ÷µÄuniforms±äÁ¿£¬²¢±©Â¶¸øframeworkµÄmaterialÉèÖᣠ- /// - class Shader ASURA_FINAL - : public Scripting::Portable<Shader> - , public AEIO::Reloadable - { - public: - - Shader(); - - ~Shader(); - - /// - /// ´Ó´úÂë±àÒëshader£¬±àÒëʱ»áÏȼì²âÊÇ·ñÓÐÉϴλº´æµÄuniforms location map¡£Ê¹ÓÃglAttachShaderÖØÐ±àÒëÉú³É×ÅÉ«Æ÷£¬ - /// ²»»áÖØÐÂÉêÇë×ÅÉ«Æ÷³ÌÐò¡£ - /// - bool Load(const std::string& vertexShader, const std::string& fragmentShader); - - /// - /// ½«µ±ÆÚshaderÉèÖÃΪ»î¶¯ - /// - void Use(); - - /// - /// ½«µ±ÆÚshaderÉèÖÃΪ·Ç»î¶¯ - /// - void Unuse(); - - /// - /// ÔÚÒѾ֪µÀuniform locationµÄÇé¿öÏ£¬ÉèÖÃÖµ¡£ - /// - void SetUniformFloat(uint loc, float value); - void SetUniformTexture(uint loc, const Texture& texture); - void SetUniformVector2(uint loc, const Math::Vector2f& vec2); - void SetUniformVector3(uint loc, const Math::Vector3f& vec3); - void SetUniformVector4(uint loc, const Math::Vector4f& vec4); - void SetUniformColor(uint loc, const Color& color); - void SetUniformMatrix44(uint loc, const Math::Matrix44& mat44); - - uint GetUniformLocation(const std::string& uniform); - - bool HasUniform(const std::string& uniform); - - GLuint GetGLProgramHandle(); - - /// - /// »ñµÃtexture unitÊýÁ¿£¬Ò»°ãΪ16¸ö - /// - static uint GetGLTextureUnitCount(); - - private: - - /// - /// µ±Ç°»î¶¯µÄshader - /// - static Shader* mCurrentShader; - - /// - /// ÉèÖÃÄÚÖñäÁ¿£º - /// vec2 Asura_Time xֵΪ½øÈ뵱ǰ³¡¾°¿ªÊ¼µÄʱ¼ä£¬yֵΪÉÏÒ»Ö¡µÄʱ¼ä¼ä¸ô - /// vec2 Asura_RenderTargetSize RTµÄ´óС£¬ÒÔÏñËØÎªµ¥Î» - /// Texture Asura_MainTexture Ö÷ÎÆÀí - /// - void SetBuiltInUniforms(); - - /// - /// OpenGL shader program handle. - /// - GLuint mProgramHandle; - - //------------------------------------------------------------------------------// - - public: - - LUAX_DECL_FACTORY(SimShader); - - LUAX_DECL_METHOD(_New); - LUAX_DECL_METHOD(_Use); - LUAX_DECL_METHOD(_Unuse); - LUAX_DECL_METHOD(_Load); - LUAX_DECL_METHOD(_HasUniform); - LUAX_DECL_METHOD(_GetUniformLocation); - LUAX_DECL_METHOD(_SetBuiltInUniforms); - LUAX_DECL_METHOD(_SetUniformFloat); - LUAX_DECL_METHOD(_SetUniformTexture); - LUAX_DECL_METHOD(_SetUniformVector2); - LUAX_DECL_METHOD(_SetUniformVector3); - LUAX_DECL_METHOD(_SetUniformVector4); - LUAX_DECL_METHOD(_SetUniformColor); - - private: - - Luax::LuaxMemberRef mCodeLuaRef; - - }; - - } -} - -#endif
\ No newline at end of file |
