diff options
Diffstat (limited to 'drivers/gles3/rasterizer_scene_gles3.cpp')
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 71 |
1 files changed, 12 insertions, 59 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 0ed2637a11..27173d317b 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1146,47 +1146,6 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_m state.current_depth_draw = p_material->shader->spatial.depth_draw_mode; } -#if 0 - //blend mode - if (state.current_blend_mode!=p_material->shader->spatial.blend_mode) { - - switch(p_material->shader->spatial.blend_mode) { - - case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MIX: { - glBlendEquation(GL_FUNC_ADD); - if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } else { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - - } break; - case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_ADD: { - - glBlendEquation(GL_FUNC_ADD); - glBlendFunc(p_alpha_pass?GL_SRC_ALPHA:GL_ONE,GL_ONE); - - } break; - case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_SUB: { - - glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); - glBlendFunc(GL_SRC_ALPHA,GL_ONE); - } break; - case RasterizerStorageGLES3::Shader::Spatial::BLEND_MODE_MUL: { - glBlendEquation(GL_FUNC_ADD); - if (storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT]) { - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } else { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - - } break; - } - - state.current_blend_mode=p_material->shader->spatial.blend_mode; - - } -#endif //material parameters state.scene_shader.set_custom_shader(p_material->shader->custom_code_id); @@ -2538,14 +2497,14 @@ void RasterizerSceneGLES3::_draw_sky(RasterizerStorageGLES3::Sky *p_sky, const C }; if (!asymmetrical) { - float vw, vh, zn; - camera.get_viewport_size(vw, vh); + Vector2 vp_he = camera.get_viewport_half_extents(); + float zn; zn = p_projection.get_z_near(); for (int i = 0; i < 4; i++) { Vector3 uv = vertices[i * 2 + 1]; - uv.x = (uv.x * 2.0 - 1.0) * vw; - uv.y = -(uv.y * 2.0 - 1.0) * vh; + uv.x = (uv.x * 2.0 - 1.0) * vp_he.x; + uv.y = -(uv.y * 2.0 - 1.0) * vp_he.y; uv.z = -zn; vertices[i * 2 + 1] = p_transform.basis.xform(uv).normalized(); vertices[i * 2 + 1].z = -vertices[i * 2 + 1].z; @@ -3007,16 +2966,6 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result, int p_light_c li->light_index = state.spot_light_count; copymem(&state.spot_array_tmp[li->light_index * state.ubo_light_size], &ubo_data, state.ubo_light_size); state.spot_light_count++; - -#if 0 - if (li->light_ptr->shadow_enabled) { - CameraMatrix bias; - bias.set_light_bias(); - Transform modelview=Transform(camera_transform_inverse * li->transform).inverse(); - li->shadow_projection[0] = bias * li->projection * modelview; - lights_use_shadow=true; - } -#endif } break; } @@ -4181,11 +4130,15 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const state.ubo_data.shadow_dual_paraboloid_render_zfar = 0; state.ubo_data.opaque_prepass_threshold = 0.99; - p_cam_projection.get_viewport_size(state.ubo_data.viewport_size[0], state.ubo_data.viewport_size[1]); - if (storage->frame.current_rt) { - state.ubo_data.screen_pixel_size[0] = 1.0 / storage->frame.current_rt->width; - state.ubo_data.screen_pixel_size[1] = 1.0 / storage->frame.current_rt->height; + int viewport_width_pixels = storage->frame.current_rt->width; + int viewport_height_pixels = storage->frame.current_rt->height; + + state.ubo_data.viewport_size[0] = viewport_width_pixels; + state.ubo_data.viewport_size[1] = viewport_height_pixels; + + state.ubo_data.screen_pixel_size[0] = 1.0 / viewport_width_pixels; + state.ubo_data.screen_pixel_size[1] = 1.0 / viewport_height_pixels; } _setup_environment(env, p_cam_projection, p_cam_transform, p_reflection_probe.is_valid()); |