From e17756e700a47bdb1857551268ee385533c9feca Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 5 Feb 2019 11:13:09 -0800 Subject: SL-10443 Make fix which gets 10276 and 10443, but leaves the bizarre flip at the zenith so that the sun/moon textures are always upright w.r.t the viewer. --- indra/newview/llvosky.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 678f1fe748..96363045d3 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -1212,10 +1212,19 @@ bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const S32 index_offset; LLFace *facep; + LLQuaternion rot = hb.getRotation(); - LLVector3 to_dir = LLVector3::x_axis * rot; - LLVector3 hb_right = LLVector3::y_axis_neg * rot; - LLVector3 hb_up = LLVector3::z_axis * rot; + LLVector3 to_dir = LLVector3::x_axis * rot; + + LLVector3 hb_right = to_dir % LLVector3::z_axis; + LLVector3 hb_up = hb_right % to_dir; + + // at zenith so math below fails spectacularly + if ((to_dir * LLVector3::z_axis) > 0.99f) + { + hb_right = LLVector3::y_axis_neg * rot; + hb_up = LLVector3::z_axis * rot; + } LLVector3 draw_pos = to_dir * HEAVENLY_BODY_DIST; -- cgit v1.2.3