Skip to content

Commit

Permalink
Backporting CleverRaven#49949
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhilkinSerg committed Aug 12, 2021
1 parent fd22a13 commit 0d469f9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lightmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ static constexpr float LIGHT_TRANSPARENCY_OPEN_AIR = 0.038376418216f;
// indicates starting (full) visibility (for seen_cache)
static constexpr float VISIBILITY_FULL = 1.0f;

#define LIGHT_RANGE(b) static_cast<int>( -std::log(LIGHT_AMBIENT_LOW / static_cast<float>(b)) * (1.0 / LIGHT_TRANSPARENCY_OPEN_AIR) )
constexpr inline int LIGHT_RANGE( float b )
{
if( b <= LIGHT_AMBIENT_LOW ) {
return 0;
}
return static_cast<int>( -std::log( LIGHT_AMBIENT_LOW / b ) * ( 1.0 /
LIGHT_TRANSPARENCY_OPEN_AIR ) );
}

enum class lit_level : int {
DARK = 0,
Expand Down

0 comments on commit 0d469f9

Please sign in to comment.