X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fvideo%2Fdrawing_context.cpp;h=7fcb205808e08faeaa280770f526feacdad2b3a9;hb=c62f4f7c11116b2ba6d6a9dfdb74bc7f07e840d0;hp=7bb36e41bd7a9e6a1e09287accfdef2c11181765;hpb=a113d3bd1feddd510e3b2852b0d42522735eee40;p=supertux.git diff --git a/src/video/drawing_context.cpp b/src/video/drawing_context.cpp index 7bb36e41b..7fcb20580 100644 --- a/src/video/drawing_context.cpp +++ b/src/video/drawing_context.cpp @@ -45,7 +45,8 @@ static inline int next_po2(int val) return result; } -DrawingContext::DrawingContext() +DrawingContext::DrawingContext(): + ambient_color( 1.0f, 1.0f, 1.0f, 1.0f ) { screen = SDL_GetVideoSurface(); @@ -319,7 +320,9 @@ DrawingContext::do_drawing() transformstack.clear(); target_stack.clear(); - bool use_lightmap = lightmap_requests.size() != 0; + //Use Lightmap if ambient color is not white. + bool use_lightmap = ( ambient_color.red != 1.0f || ambient_color.green != 1.0f || + ambient_color.blue != 1.0f ); // PART1: create lightmap if(use_lightmap) { @@ -330,8 +333,7 @@ DrawingContext::do_drawing() glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - // FIXME: Add ambient light support here - glClearColor(0.3, 0.3, 0.4, 1); + glClearColor( ambient_color.red, ambient_color.green, ambient_color.blue, 1 ); glClear(GL_COLOR_BUFFER_BIT); handle_drawing_requests(lightmap_requests); lightmap_requests.clear(); @@ -476,3 +478,9 @@ DrawingContext::set_target(Target target) else requests = &drawing_requests; } + +void +DrawingContext::set_ambient_color( Color new_color ) +{ + ambient_color = new_color; +}