summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-06-06 22:06:58 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-06-06 22:06:58 -0300
commitb524b40fdc5325c840192ce92dbed8108ccef2d9 (patch)
treeec7f74db082b4b91f7614ed4391c53bc73b60bfd /scene/resources
parent14c4c1b568ffa40a179332fbc77e9b52c6bdf514 (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.cpp3
-rw-r--r--scene/resources/shader.h19
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;