Billboards were being displayed upside down when drawn to a render texture

Render texture's view transforms seem to be inverted, so when drawing
billboards, the 'up' vector given to set_look_at() is also inverted and
so the billboard gets drawn upside down.
This commit is contained in:
BenH 2015-06-24 21:06:31 +01:00
parent 48f1d02da4
commit d807a22981

View file

@ -6683,7 +6683,13 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans
if (e->instance->billboard) {
Vector3 scale = xf.basis.get_scale();
if (current_rt && current_rt_vflip) {
xf.set_look_at(xf.origin, xf.origin + p_view_transform.get_basis().get_axis(2), -p_view_transform.get_basis().get_axis(1));
} else {
xf.set_look_at(xf.origin, xf.origin + p_view_transform.get_basis().get_axis(2), p_view_transform.get_basis().get_axis(1));
}
xf.basis.scale(scale);
}
material_shader.set_uniform(MaterialShaderGLES2::WORLD_TRANSFORM, xf);