diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-06-06 22:06:58 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-06-06 22:06:58 -0300 |
commit | b524b40fdc5325c840192ce92dbed8108ccef2d9 (patch) | |
tree | ec7f74db082b4b91f7614ed4391c53bc73b60bfd /scene/resources | |
parent | 14c4c1b568ffa40a179332fbc77e9b52c6bdf514 (diff) |
-fixed many memory initialization issues
-fixed deadlock on previews thread
-fixed compilation errors on unix
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/shader.cpp | 3 | ||||
-rw-r--r-- | scene/resources/shader.h | 19 |
2 files changed, 14 insertions, 8 deletions
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index 862669ecd8..90598ee789 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -36,7 +36,7 @@ Shader::Mode Shader::get_mode() const { - return (Mode)VisualServer::get_singleton()->shader_get_mode(shader); + return mode; } void Shader::set_code( const String& p_vertex, const String& p_fragment, const String& p_light,int p_fragment_ofs,int p_light_ofs) { @@ -203,6 +203,7 @@ void Shader::_bind_methods() { Shader::Shader(Mode p_mode) { + mode=p_mode; shader = VisualServer::get_singleton()->shader_create(VS::ShaderMode(p_mode)); params_cache_dirty=true; } diff --git a/scene/resources/shader.h b/scene/resources/shader.h index c5ef3777f7..b805cbec96 100644 --- a/scene/resources/shader.h +++ b/scene/resources/shader.h @@ -37,8 +37,18 @@ class Shader : public Resource { OBJ_TYPE(Shader,Resource); OBJ_SAVE_TYPE( Shader ); RES_BASE_EXTENSION("shd"); - RID shader; +public: + enum Mode { + + MODE_MATERIAL, + MODE_CANVAS_ITEM, + MODE_POST_PROCESS, + MODE_MAX + }; +private: + RID shader; + Mode mode; Dictionary _get_code(); void _set_code(const Dictionary& p_string); @@ -55,15 +65,10 @@ class Shader : public Resource { protected: + static void _bind_methods(); public: - enum Mode { - MODE_MATERIAL, - MODE_CANVAS_ITEM, - MODE_POST_PROCESS, - MODE_MAX - }; //void set_mode(Mode p_mode); Mode get_mode() const; |