summaryrefslogtreecommitdiffstats
path: root/drivers/gles2/shader_gles2.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-06-27 23:21:45 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-06-27 23:21:45 -0300
commit2af2a84a03fd707cfa4c682aff34d722343d8985 (patch)
tree50d064e8bba7d5efb5974e3fa3a67e076fb5ef8b /drivers/gles2/shader_gles2.cpp
parent1cc96a4d7440d9e8a20f7dbf17cf5771170de83d (diff)
downloadredot-engine-2af2a84a03fd707cfa4c682aff34d722343d8985.tar.gz
Misc Fixes
========== -NOTIFICATION_WM_QUIT fixed on android (seems tha way this is reported changed in newer sdk) -WIP implementation of APK Expansion APIs for publishing games larger than 50mb in Play Store -Feaures in the new tutorials are all present in the sourcecode -This (hopefully) should get rid of the animation list order getting corrupted -Improved 3D Scene Importer (Skeletons, Animations and other stuff were not being merged). Anything missing? -In code editor, the automatic syntax checker will only use file_exists() to check preload() else it might freeze the editor too much while typing if the preload is a big resource -Fixed bugs in PolygonPathFinder, stil pending to do a node and a demo
Diffstat (limited to 'drivers/gles2/shader_gles2.cpp')
-rw-r--r--drivers/gles2/shader_gles2.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index bcd3e6ad4b..dc68ee489a 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -285,6 +285,7 @@ ShaderGLES2::Version* ShaderGLES2::get_current_version() {
//keep them around during the function
CharString code_string;
+ CharString code_string2;
CharString code_globals;
@@ -437,6 +438,14 @@ ShaderGLES2::Version* ShaderGLES2::get_current_version() {
}
strings.push_back(fragment_code2.get_data());
+
+ if (cc) {
+ code_string2=cc->light.ascii();
+ strings.push_back(code_string2.get_data());
+ }
+
+ strings.push_back(fragment_code3.get_data());
+
#ifdef DEBUG_SHADER
DEBUG_PRINT("\nFragment Code:\n\n"+String(code_string.get_data()));
for(int i=0;i<strings.size();i++) {
@@ -630,6 +639,7 @@ void ShaderGLES2::setup(const char** p_conditional_defines, int p_conditional_co
{
String globals_tag="\nFRAGMENT_SHADER_GLOBALS";
String code_tag="\nFRAGMENT_SHADER_CODE";
+ String light_code_tag="\nLIGHT_SHADER_CODE";
String code = fragment_code;
int cpos = code.find(globals_tag);
if (cpos==-1) {
@@ -645,7 +655,16 @@ void ShaderGLES2::setup(const char** p_conditional_defines, int p_conditional_co
} else {
fragment_code1=code.substr(0,cpos).ascii();
- fragment_code2=code.substr(cpos+code_tag.length(),code.length()).ascii();
+ String code2 = code.substr(cpos+code_tag.length(),code.length());
+
+ cpos = code2.find(light_code_tag);
+ if (cpos==-1) {
+ fragment_code2=code2.ascii();
+ } else {
+
+ fragment_code2=code2.substr(0,cpos).ascii();
+ fragment_code3 = code2.substr(cpos+light_code_tag.length(),code2.length()).ascii();
+ }
}
}
}
@@ -696,7 +715,7 @@ uint32_t ShaderGLES2::create_custom_shader() {
return last_custom_code++;
}
-void ShaderGLES2::set_custom_shader_code(uint32_t p_code_id, const String& p_vertex, const String& p_vertex_globals,const String& p_fragment, const String& p_fragment_globals,const Vector<StringName>& p_uniforms,const Vector<const char*> &p_custom_defines) {
+void ShaderGLES2::set_custom_shader_code(uint32_t p_code_id, const String& p_vertex, const String& p_vertex_globals,const String& p_fragment,const String& p_light, const String& p_fragment_globals,const Vector<StringName>& p_uniforms,const Vector<const char*> &p_custom_defines) {
ERR_FAIL_COND(!custom_code_map.has(p_code_id));
CustomCode *cc=&custom_code_map[p_code_id];
@@ -705,6 +724,7 @@ void ShaderGLES2::set_custom_shader_code(uint32_t p_code_id, const String& p_ver
cc->vertex_globals=p_vertex_globals;
cc->fragment=p_fragment;
cc->fragment_globals=p_fragment_globals;
+ cc->light=p_light;
cc->custom_uniforms=p_uniforms;
cc->custom_defines=p_custom_defines;
cc->version++;