Skip to content
Snippets Groups Projects
Commit e7474eb4 authored by David Parks's avatar David Parks
Browse files

SH-2120 Better fix for water being very dark when basic shaders disabled (sinA might be negative)

parent 531c5c4e
No related branches found
No related tags found
No related merge requests found
...@@ -754,7 +754,12 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo ...@@ -754,7 +754,12 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
{ {
// project the direction ray onto the sky dome. // project the direction ray onto the sky dome.
F32 phi = acos(Pn[1]); F32 phi = acos(Pn[1]);
F32 sinA = llmax(sin(F_PI - phi), 0.01f); F32 sinA = sin(F_PI - phi);
if (fabsf(sinA) < 0.01f)
{ //avoid division by zero
sinA = 0.01f;
}
F32 Plen = dome_radius * sin(F_PI + phi + asin(dome_offset_ratio * sinA)) / sinA; F32 Plen = dome_radius * sin(F_PI + phi + asin(dome_offset_ratio * sinA)) / sinA;
Pn *= Plen; Pn *= Plen;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment