diff options
Diffstat (limited to 'drivers/gles2/rasterizer_gles2.cpp')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 4cd97a7f6a..8350fb0674 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -5210,7 +5210,6 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material material_shader.set_conditional(MaterialShaderGLES2::USE_FOG,current_env && current_env->fx_enabled[VS::ENV_FX_FOG]); //glDepthMask( true ); - } @@ -6778,7 +6777,7 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans } } - if (e->instance->billboard || e->instance->depth_scale) { + if (e->instance->billboard || e->instance->billboard_y || e->instance->depth_scale) { Transform xf=e->instance->transform; if (e->instance->depth_scale) { @@ -6809,6 +6808,21 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans xf.basis.scale(scale); } + + if (e->instance->billboard_y) { + + Vector3 scale = xf.basis.get_scale(); + Vector3 look_at = p_view_transform.get_origin(); + look_at.y = 0.0; + Vector3 look_at_norm = look_at.normalized(); + + if (current_rt && current_rt_vflip) { + xf.set_look_at(xf.origin,xf.origin + look_at_norm, Vector3(0.0, -1.0, 0.0)); + } else { + xf.set_look_at(xf.origin,xf.origin + look_at_norm, Vector3(0.0, 1.0, 0.0)); + } + xf.basis.scale(scale); + } material_shader.set_uniform(MaterialShaderGLES2::WORLD_TRANSFORM, xf); } else { @@ -8196,7 +8210,7 @@ RasterizerGLES2::Texture* RasterizerGLES2::_bind_canvas_texture(const RID& p_tex return NULL; } -void RasterizerGLES2::canvas_draw_line(const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width) { +void RasterizerGLES2::canvas_draw_line(const Point2& p_from, const Point2& p_to,const Color& p_color,float p_width,bool p_antialiased) { _bind_canvas_texture(RID()); Color c=p_color; @@ -8208,8 +8222,18 @@ void RasterizerGLES2::canvas_draw_line(const Point2& p_from, const Point2& p_to, Vector3(p_to.x,p_to.y,0) }; +#ifdef GLEW_ENABLED + if (p_antialiased) + glEnable(GL_LINE_SMOOTH); +#endif glLineWidth(p_width); _draw_primitive(2,verts,0,0,0); + +#ifdef GLEW_ENABLED + if (p_antialiased) + glDisable(GL_LINE_SMOOTH); +#endif + _rinfo.ci_draw_commands++; } @@ -9135,7 +9159,7 @@ void RasterizerGLES2::_canvas_item_render_commands(CanvasItem *p_item,CanvasItem case CanvasItem::Command::TYPE_LINE: { CanvasItem::CommandLine* line = static_cast<CanvasItem::CommandLine*>(c); - canvas_draw_line(line->from,line->to,line->color,line->width); + canvas_draw_line(line->from,line->to,line->color,line->width,line->antialiased); } break; case CanvasItem::Command::TYPE_RECT: { @@ -10788,8 +10812,17 @@ void RasterizerGLES2::init() { if (OS::get_singleton()->is_stdout_verbose()) { print_line(String("GLES2: Using GLEW ") + (const char*) glewGetString(GLEW_VERSION)); } -#endif + // Check for GL 2.1 compatibility, if not bail out + if (!glewIsSupported("GL_VERSION_2_1")) { + ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n" + "Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault."); + OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n" + "Godot Engine will self-destruct as soon as you acknowledge this error message.", + "Fatal error: Insufficient OpenGL / GLES drivers"); + // TODO: If it's even possible, we should stop the execution without segfault and memory leaks :) + } +#endif @@ -10824,6 +10857,11 @@ void RasterizerGLES2::init() { copy_shader.set_conditional(CopyShaderGLES2::USE_GLES_OVER_GL,true); #endif +#ifdef ANGLE_ENABLED + // Fix for ANGLE + material_shader.set_conditional(MaterialShaderGLES2::DISABLE_FRONT_FACING, true); +#endif + shadow=NULL; shadow_pass=0; @@ -10911,7 +10949,11 @@ void RasterizerGLES2::init() { srgb_supported=extensions.has("GL_EXT_sRGB"); +#ifndef ANGLE_ENABLED s3tc_srgb_supported = s3tc_supported && extensions.has("GL_EXT_texture_compression_s3tc"); +#else + s3tc_srgb_supported = s3tc_supported; +#endif latc_supported = extensions.has("GL_EXT_texture_compression_latc"); anisotropic_level=1.0; use_anisotropic_filter=extensions.has("GL_EXT_texture_filter_anisotropic"); |