@ -7,7 +7,7 @@ using std::vector;
namespace lighting {
namespace lighting {
void LightRender : : render_circle_light ( LightSource source , Point at , PointList & has_light ) {
void LightRender : : render_circle_light ( LightSource source , Point at , PointList & has_light ) {
for ( matrix : : circle it { $ lightmap , at , source . distance + 1 } ; it . next ( ) ; ) {
for ( matrix : : circle it { $ lightmap , at , source . radius } ; it . next ( ) ; ) {
for ( int x = it . left ; x < it . right ; x + + ) {
for ( int x = it . left ; x < it . right ; x + + ) {
$ lightmap [ it . y ] [ x ] = light_level ( source . strength , x , it . y ) ;
$ lightmap [ it . y ] [ x ] = light_level ( source . strength , x , it . y ) ;
has_light . push_back ( { ( size_t ) x , ( size_t ) it . y } ) ;
has_light . push_back ( { ( size_t ) x , ( size_t ) it . y } ) ;
@ -25,7 +25,7 @@ namespace lighting {
}
}
void LightRender : : render_square_light ( LightSource source , Point at , PointList & has_light ) {
void LightRender : : render_square_light ( LightSource source , Point at , PointList & has_light ) {
for ( matrix : : in_box it { $ lightmap , at . x , at . y , ( size_t ) source . distance } ; it . next ( ) ; ) {
for ( matrix : : in_box it { $ lightmap , at . x , at . y , ( size_t ) floor ( source . radius ) } ; it . next ( ) ; ) {
if ( $ paths . $ paths [ it . y ] [ it . x ] ! = WALL_PATH_LIMIT ) {
if ( $ paths . $ paths [ it . y ] [ it . x ] ! = WALL_PATH_LIMIT ) {
$ lightmap [ it . y ] [ it . x ] = light_level ( source . strength , it . x , it . y ) ;
$ lightmap [ it . y ] [ it . x ] = light_level ( source . strength , it . x , it . y ) ;
has_light . push_back ( { it . x , it . y } ) ;
has_light . push_back ( { it . x , it . y } ) ;
@ -38,9 +38,9 @@ namespace lighting {
clear_light_target ( at ) ;
clear_light_target ( at ) ;
PointList has_light ;
PointList has_light ;
if ( source . distance = = 0 ) {
if ( source . radius < 1.5f ) {
render_compass_light ( source , at , has_light ) ;
render_compass_light ( source , at , has_light ) ;
} else if ( source . distance = = 1 ) {
} else if ( source . radius < 2.0f ) {
render_square_light ( source , at , has_light ) ;
render_square_light ( source , at , has_light ) ;
} else {
} else {
render_circle_light ( source , at , has_light ) ;
render_circle_light ( source , at , has_light ) ;