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
This commit is contained in:
Juan Linietsky
2014-06-27 23:21:45 -03:00
parent 1cc96a4d74
commit 2af2a84a03
74 changed files with 1416 additions and 662 deletions
+63 -12
View File
@@ -78,7 +78,7 @@ uniform highp float hdr_glow_scale;
uniform sampler2D hdr_source;
uniform highp float tonemap_exposure;
uniform highp float tonemap_white;
#endif
#ifdef USE_BCS
@@ -318,6 +318,7 @@ void main() {
#ifdef USE_HDR
highp float white_mult = 1.0;
#ifdef USE_8BIT_HDR
highp vec4 _mult = vec4(1.0 / (256.0 * 256.0 * 256.0),1.0 / (256.0 * 256.0),1.0 / 256.0,1);
@@ -325,11 +326,37 @@ void main() {
color.rgb*=LUM_RANGE;
hdr_lum*=LUM_RANGE; //restore to full range
#else
highp float hdr_lum = texture2D( hdr_source, vec2(0.0) ).r;
highp vec2 lv = texture2D( hdr_source, vec2(0.0) ).rg;
highp float hdr_lum = lv.r;
#ifdef USE_AUTOWHITE
white_mult=lv.g;
#endif
#endif
#ifdef USE_REINHARDT_TONEMAPPER
float src_lum = dot(color.rgb,vec3(0.3, 0.58, 0.12));
float lp = tonemap_exposure/hdr_lum*src_lum;
float white = tonemap_white;
#ifdef USE_AUTOWHITE
white_mult = (white_mult + 1.0 * white_mult);
white_mult*=white_mult;
white*=white_mult;
#endif
lp = ( lp * ( 1.0 + ( lp / ( white) ) ) ) / ( 1.0 + lp );
color.rgb*=lp;
#else
#ifdef USE_LOG_TONEMAPPER
color.rgb = tonemap_exposure * log(color.rgb+1.0)/log(hdr_lum+1.0);
#else
highp float tone_scale = tonemap_exposure / hdr_lum; //only linear supported
color.rgb*=tone_scale;
#endif
#endif
#endif
@@ -393,7 +420,11 @@ void main() {
#ifdef USE_HDR_COPY
//highp float lum = dot(color.rgb,highp vec3(1.0/3.0,1.0/3.0,1.0/3.0));
highp float lum = max(color.r,max(color.g,color.b));
//highp float lum = max(color.r,max(color.g,color.b));
highp float lum = dot(color.rgb,vec3(0.3, 0.58, 0.12));
//lum=log(lum+0.0001); //everyone does it
#ifdef USE_8BIT_HDR
highp vec4 comp = fract(lum * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0));
comp -= comp.xxyz * vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
@@ -422,21 +453,33 @@ void main() {
#else
highp float lum_accum = color.r;
lum_accum += texture2D( source, uv_interp+vec2(-pixel_size.x,-pixel_size.y) ).r;
lum_accum += texture2D( source, uv_interp+vec2(0.0,-pixel_size.y) ).r;
lum_accum += texture2D( source, uv_interp+vec2(pixel_size.x,-pixel_size.y) ).r;
lum_accum += texture2D( source, uv_interp+vec2(-pixel_size.x,0.0) ).r;
lum_accum += texture2D( source, uv_interp+vec2(pixel_size.x,0.0) ).r;
lum_accum += texture2D( source, uv_interp+vec2(-pixel_size.x,pixel_size.y) ).r;
lum_accum += texture2D( source, uv_interp+vec2(0.0,pixel_size.y) ).r;
lum_accum += texture2D( source, uv_interp+vec2(pixel_size.x,pixel_size.y) ).r;
highp float lum_max = color.g;
#define LUM_REDUCE(m_uv) \
{\
vec2 val = texture2D( source, uv_interp+m_uv ).rg;\
lum_accum+=val.x;\
lum_max=max(val.y,lum_max);\
}
LUM_REDUCE( vec2(-pixel_size.x,-pixel_size.y) );
LUM_REDUCE( vec2(0.0,-pixel_size.y) );
LUM_REDUCE( vec2(pixel_size.x,-pixel_size.y) );
LUM_REDUCE( vec2(-pixel_size.x,0.0) );
LUM_REDUCE( vec2(pixel_size.x,0.0) );
LUM_REDUCE( vec2(-pixel_size.x,pixel_size.y) );
LUM_REDUCE( vec2(0.0,pixel_size.y) );
LUM_REDUCE( vec2(pixel_size.x,pixel_size.y) );
lum_accum/=9.0;
#endif
#ifdef USE_HDR_STORE
#ifdef USE_8BIT_HDR
//lum_accum=exp(lum_accum);
#ifdef USE_8BIT_HDR
highp float vd_lum = dot(texture2D( source_vd_lum, vec2(0.0) ), _multcv );
lum_accum = clamp( vd_lum + (lum_accum-vd_lum)*hdr_time_delta*hdr_exp_adj_speed,min_luminance*(1.0/LUM_RANGE),max_luminance*(1.0/LUM_RANGE));
#else
@@ -450,6 +493,10 @@ void main() {
highp vec4 comp = fract(lum_accum * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0));
comp -= comp.xxyz * vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
color=comp;
#else
#ifdef USE_AUTOWHITE
color.r=lum_accum;
color.g=lum_max;
#else
color.rgb=vec3(lum_accum);
#endif
@@ -457,6 +504,10 @@ void main() {
#endif
#endif
#ifdef USE_RGBE
color.rgb = pow(color.rgb,color.a*255.0-(8.0+128.0));
+40 -22
View File
@@ -115,7 +115,6 @@ uniform vec3 light_pos;
uniform vec3 light_direction;
uniform vec3 light_attenuation;
uniform vec3 light_spot_attenuation;
uniform vec3 light_ambient;
uniform vec3 light_diffuse;
uniform vec3 light_specular;
@@ -132,6 +131,7 @@ varying vec3 specular_interp;
uniform float time;
uniform float instance_id;
uniform vec3 ambient_light;
#if !defined(USE_DEPTH_SHADOWS) && defined(USE_SHADOW_PASS)
@@ -404,7 +404,7 @@ VERTEX_SHADER_CODE
float NdotL = max(0.0,dot( normal_interp, light_dir ));
vec3 half_vec = normalize(light_dir + eye_vec);
float eye_light = max(dot(normal_interp, half_vec),0.0);
diffuse_interp.rgb=light_diffuse * NdotL * attenuation;// + light_ambient;
diffuse_interp.rgb=light_diffuse * NdotL * attenuation;
diffuse_interp.a=attenuation;
if (NdotL > 0.0) {
specular_interp=light_specular * pow( eye_light, vertex_specular_exp ) * attenuation;
@@ -510,28 +510,16 @@ uniform vec3 light_pos;
uniform vec3 light_direction;
uniform vec3 light_attenuation;
uniform vec3 light_spot_attenuation;
uniform vec3 light_ambient;
uniform vec3 light_diffuse;
uniform vec3 light_specular;
uniform vec3 ambient_light;
#ifdef USE_FRAGMENT_LIGHTING
vec3 process_shade(in vec3 normal, in vec3 light_dir, in vec3 eye_vec, in vec3 diffuse, in vec3 specular, in float specular_exp, in float attenuation) {
float NdotL = max(0.0,dot( normal, light_dir ));
vec3 half_vec = normalize(light_dir + eye_vec);
float eye_light = max(dot(normal, half_vec),0.0);
vec3 ret = light_ambient *diffuse + light_diffuse * diffuse * NdotL * attenuation;
if (NdotL > 0.0) {
ret+=light_specular * specular * pow( eye_light, specular_exp ) * attenuation;
}
return ret;
}
# ifdef USE_DEPTH_SHADOWS
# else
# endif
@@ -770,9 +758,12 @@ void main() {
bool discard_=false;
#endif
{
FRAGMENT_SHADER_CODE
}
#if defined(ENABLE_DISCARD)
if (discard_) {
@@ -1009,9 +1000,8 @@ FRAGMENT_SHADER_CODE
#ifdef LIGHT_TYPE_DIRECTIONAL
vec3 light_dir = -light_direction;
float light_attenuation = light_attenuation.r;
float attenuation = light_attenuation.r;
diffuse.rgb=process_shade(normal,light_dir,eye_vec,diffuse.rgb,specular,specular_exp,shadow_attenuation)*light_attenuation;
#endif
@@ -1023,7 +1013,6 @@ FRAGMENT_SHADER_CODE
light_dir=normalize(light_dir);
float attenuation = pow( max(1.0 - dist/radius, 0.0), light_attenuation.b ) * light_attenuation.r;
diffuse.rgb=process_shade(normal,light_dir,eye_vec,diffuse.rgb,specular,specular_exp,shadow_attenuation)*attenuation;
#endif
@@ -1040,10 +1029,39 @@ FRAGMENT_SHADER_CODE
float rim = (1.0 - scos) / (1.0 - spot_cutoff);
attenuation *= 1.0 - pow( rim, light_spot_attenuation.g);
diffuse.rgb=process_shade(normal,light_dir,eye_vec,diffuse.rgb,specular,specular_exp,shadow_attenuation)*attenuation;
#endif
# if defined(LIGHT_TYPE_DIRECTIONAL) || defined(LIGHT_TYPE_OMNI) || defined (LIGHT_TYPE_SPOT)
{
vec3 mdiffuse = diffuse.rgb;
vec3 light;
#if defined(USE_LIGHT_SHADER_CODE)
//light is written by the light shader
{
LIGHT_SHADER_CODE
}
#else
//traditional lambert + blinn
float NdotL = max(0.0,dot( normal, light_dir ));
vec3 half_vec = normalize(light_dir + eye_vec);
float eye_light = max(dot(normal, half_vec),0.0);
light = light_diffuse * mdiffuse * NdotL;
if (NdotL > 0.0) {
light+=specular * light_specular * pow( eye_light, specular_exp );
}
#endif
diffuse.rgb = ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation;
}
# endif
# if !defined(LIGHT_TYPE_DIRECTIONAL) && !defined(LIGHT_TYPE_OMNI) && !defined (LIGHT_TYPE_SPOT)
//none
@@ -1062,7 +1080,7 @@ FRAGMENT_SHADER_CODE
#ifdef USE_VERTEX_LIGHTING
vec3 ambient = light_ambient*diffuse.rgb;
vec3 ambient = ambient_light*diffuse.rgb;
# if defined(LIGHT_TYPE_OMNI) || defined (LIGHT_TYPE_SPOT)
ambient*=diffuse_interp.a; //attenuation affects ambient too
# endif