diff options
author | Alex Piola <alex@axeeel.com> | 2016-07-28 18:04:04 +0200 |
---|---|---|
committer | Alex Piola <alex@axeeel.com> | 2016-08-01 14:00:30 +0200 |
commit | c3b9ef82296c89b09b1c4285a41b10f7a0e18d2a (patch) | |
tree | 6f25ef47b6d3cb7cc853120acb6e73724e206a02 /drivers/gles2 | |
parent | 2dd83e28b97d7bc070e6641b7d6939b02b4067bc (diff) |
Implements Y billboard
Y billboard wasn't hooked up. This commit implements it.
Diffstat (limited to 'drivers/gles2')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index ba93a26a2d..acd4614785 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -6778,7 +6778,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 +6809,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 { |