summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-04-09 00:29:21 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-04-09 00:29:21 -0300
commitd148a0384821a05f8714099cf00e1b521643a2ad (patch)
treeb260c213e2c15d8ff4ce9664d784bf0ed39a3935
parente18c6ef63bb57290b023fde01391f8bdcdfe5aed (diff)
-Fixes bug in ShaderGraph material, when uniform property is not used, fixes #1634 and #1610
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp3
-rw-r--r--scene/resources/shader.cpp5
-rw-r--r--scene/resources/shader_graph.cpp3
-rw-r--r--servers/visual_server.cpp3
4 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 4f486897d1..3c7026daf1 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -1652,6 +1652,9 @@ void RasterizerGLES2::material_set_param(RID p_material, const StringName& p_par
}
} else {
+ if (p_value.get_type()==Variant::NIL)
+ return;
+
Material::UniformData ud;
ud.index=-1;
ud.value=p_value;
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index 42251124bd..c15288fdb4 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -136,8 +136,10 @@ void Shader::_set_code(const Dictionary& p_string) {
if (p_string.has("default_tex")) {
Array arr=p_string["default_tex"];
if ((arr.size()&1)==0) {
- for(int i=0;i<arr.size();i+=2)
+ for(int i=0;i<arr.size();i+=2) {
+
set_default_texture_param(arr[i],arr[i+1]);
+ }
}
}
}
@@ -338,7 +340,6 @@ RES ResourceFormatLoaderShader::load(const String &p_path,const String& p_origin
String type = right.substr(0,popenpos);
String param = right.substr(popenpos+1,pclosepos-popenpos-1).strip_edges();
- print_line("type: "+type+" param: "+param);
if (type=="tex") {
diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp
index f7fdaeec69..78265045dd 100644
--- a/scene/resources/shader_graph.cpp
+++ b/scene/resources/shader_graph.cpp
@@ -92,6 +92,7 @@ void ShaderGraph::_set_data(const Dictionary &p_data) {
}
}
+ _pending_update_shader=true;
_update_shader();
}
@@ -1607,6 +1608,7 @@ void ShaderGraph::_update_shader() {
get_default_texture_param_list(&names);
for (List<StringName>::Element *E=names.front();E;E=E->next()) {
+
set_default_texture_param(E->get(),Ref<Texture>());
}
@@ -1750,6 +1752,7 @@ void ShaderGraph::_update_shader() {
if (n->type==NODE_TEXTURE_INPUT || n->type==NODE_CUBEMAP_INPUT) {
set_default_texture_param(n->param1,n->param2);
+
}
_add_node_code(ShaderType(i),n,inputs,code[i]);
}
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 5ddfaf7967..1dd078731b 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -146,7 +146,6 @@ RID VisualServer::_make_test_cube() {
tangents.push_back( normal_points[m_idx][0] );\
tangents.push_back( 1.0 );\
uvs.push_back( Vector3(uv_points[m_idx*2+0],uv_points[m_idx*2+1],0) );\
- print_line(itos( (face_points[m_idx][0]>0?1:0)|(face_points[m_idx][1]>0?2:0)|(face_points[m_idx][2]>0?4:0)));\
vtx_idx++;\
for (int i=0;i<6;i++) {
@@ -207,7 +206,7 @@ RID VisualServer::_make_test_cube() {
//material_set_flag(material, MATERIAL_FLAG_BILLBOARD_TOGGLE,true);
fixed_material_set_texture( material, FIXED_MATERIAL_PARAM_DIFFUSE, get_test_texture() );
fixed_material_set_param( material, FIXED_MATERIAL_PARAM_SPECULAR_EXP, 70 );
- fixed_material_set_param( material, FIXED_MATERIAL_PARAM_EMISSION, Vector3(0.2,0.2,0.2) );
+ fixed_material_set_param( material, FIXED_MATERIAL_PARAM_EMISSION, Color(0.2,0.2,0.2) );
fixed_material_set_param( material, FIXED_MATERIAL_PARAM_DIFFUSE, Color(1, 1, 1) );
fixed_material_set_param( material, FIXED_MATERIAL_PARAM_SPECULAR, Color(1,1,1) );