Skip to content

Commit

Permalink
Fix directional fog color in front view
Browse files Browse the repository at this point in the history
  • Loading branch information
BlockMen committed Apr 25, 2014
1 parent f2a1900 commit c532401
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "util/numeric.h" // MYMIN
#include <cmath>
#include "settings.h"
#include "camera.h" // CameraModes

//! constructor
Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id, LocalPlayer* player):
Expand Down Expand Up @@ -577,8 +578,11 @@ void Sky::update(float time_of_day, float time_brightness,
if (m_directional_colored_fog) {
if (m_horizon_blend() != 0)
{
// calculate hemisphere value from yaw
f32 pointcolor_blend = wrapDegrees_0_360(m_player->getYaw() + 90);
// calculate hemisphere value from yaw, (inverted in third person front view)
s8 dir_factor = 1;
if (m_player->camera_mode > CAMERA_MODE_THIRD)
dir_factor = -1;
f32 pointcolor_blend = wrapDegrees_0_360(m_player->getYaw()*dir_factor + 90);
if (pointcolor_blend > 180)
pointcolor_blend = 360 - pointcolor_blend;
pointcolor_blend /= 180;
Expand Down

0 comments on commit c532401

Please sign in to comment.