1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Fixed Bugs & Joypad in Android

================================

-resolved many graphical glitches with multiple lights in GLES2 render
-fixes and WIP apk expansion
-joystick support for Android by Ariel
This commit is contained in:
Juan Linietsky
2014-07-02 00:09:36 -03:00
parent 77a15e2a3e
commit e9da61411a
8 changed files with 359 additions and 14 deletions

View File

@@ -4239,9 +4239,10 @@ void RasterizerGLES2::_add_geometry( const Geometry* p_geometry, const InstanceD
LightInstance *li=light_instance_owner.get( liptr[i] );
if (!li || li->last_pass!=scene_pass) //lit by light not in visible scene
continue;
uint8_t light_type=li->base->type;
if (li->base->shadow_enabled)
uint8_t light_type=li->base->type|0x40; //penalty to ensure directionals always go first
if (li->base->shadow_enabled) {
light_type|=0x8;
}
uint16_t sort_key =li->sort_key;
RenderList::Element *ec;
@@ -4598,7 +4599,7 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material
material_shader.set_uniform(MaterialShaderGLES2::FOG_COLOR_END,Vector3(col_end.r,col_end.g,col_end.b));
}
material_shader.set_uniform(MaterialShaderGLES2::CONST_LIGHT_MULT,p_no_const_light?0.0:1.0);
//material_shader.set_uniform(MaterialShaderGLES2::TIME,Math::fmod(last_time,300.0));
//if uses TIME - draw_next_frame=true
@@ -5668,7 +5669,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans
case VS::MATERIAL_BLEND_MODE_ADD: {
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glBlendFunc(p_alpha_pass?GL_SRC_ALPHA:GL_ONE,GL_ONE);
} break;
case VS::MATERIAL_BLEND_MODE_SUB: {
@@ -5833,7 +5834,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans
}
material_shader.set_uniform(MaterialShaderGLES2::NORMAL_MULT, e->mirror?-1.0:1.0);
material_shader.set_uniform(MaterialShaderGLES2::CONST_LIGHT_MULT,additive?0.0:1.0);
_render(e->geometry, material, skeleton,e->owner,e->instance->transform);
@@ -6097,6 +6098,9 @@ void RasterizerGLES2::_draw_tex_bg() {
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
glColorMask(1,1,1,1);
RID texture;
@@ -6132,6 +6136,7 @@ void RasterizerGLES2::_draw_tex_bg() {
copy_shader.set_conditional(CopyShaderGLES2::USE_CUSTOM_ALPHA,true);
copy_shader.bind();
if (current_env->bg_mode==VS::ENV_BG_TEXTURE || current_env->bg_mode==VS::ENV_BG_TEXTURE_RGBE) {
@@ -6350,6 +6355,7 @@ void RasterizerGLES2::end_scene() {
_render_list_forward(&opaque_render_list,camera_transform,camera_transform_inverse,camera_projection,false,fragment_lighting);
if (draw_tex_background) {
//most 3D vendors recommend drawing a texture bg or skybox here,
//after opaque geometry has been drawn
//so the zbuffer can get rid of most pixels