Skip to content

Commit

Permalink
added afternoon/morning red tint
Browse files Browse the repository at this point in the history
  • Loading branch information
kaadmy authored and Ekdohibs committed Apr 15, 2017
1 parent 0f955bf commit aedc81b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/mapblock_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,16 @@ u16 getSmoothLight(v3s16 p, v3s16 corner, MeshMakeData *data)
}

void get_sunlight_color(video::SColorf *sunlight, u32 daynight_ratio){
f32 rg = daynight_ratio / 1000.0f - 0.04f;
f32 r = daynight_ratio / 1000.0f - 0.04f;
f32 g = daynight_ratio / 1000.0f - 0.04f;
f32 b = (0.98f * daynight_ratio) / 1000.0f + 0.078f;
sunlight->r = rg;
sunlight->g = rg;

// Morning/Afternoon is red
g -= MYMAX(0.0f, 0.1f - fabs(daynight_ratio / 1000.0f - 0.5f));
b -= MYMAX(0.0f, 0.1f - fabs(daynight_ratio / 1000.0f - 0.5f));

sunlight->r = r;
sunlight->g = g;
sunlight->b = b;
}

Expand Down

0 comments on commit aedc81b

Please sign in to comment.