00001 // SuperTux 00002 // Copyright (C) 2006 Matthias Braun <matze@braunis.de> 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 #ifndef HEADER_SUPERTUX_VIDEO_GL_LIGHTMAP_HPP 00018 #define HEADER_SUPERTUX_VIDEO_GL_LIGHTMAP_HPP 00019 00020 #include "video/lightmap.hpp" 00021 00022 struct DrawingRequest; 00023 00024 class Texture; 00025 00026 class GLLightmap : public Lightmap 00027 { 00028 public: 00029 GLLightmap(); 00030 ~GLLightmap(); 00031 00032 void start_draw(const Color &ambient_color); 00033 void end_draw(); 00034 void do_draw(); 00035 void draw_surface(const DrawingRequest& request); 00036 void draw_surface_part(const DrawingRequest& request); 00037 void draw_text(const DrawingRequest& request); 00038 void draw_gradient(const DrawingRequest& request); 00039 void draw_filled_rect(const DrawingRequest& request); 00040 void get_light(const DrawingRequest& request) const; 00041 00042 private: 00043 static const int LIGHTMAP_DIV = 5; 00044 00045 SDL_Surface* screen; 00046 boost::shared_ptr<GLTexture> lightmap; 00047 int lightmap_width; 00048 int lightmap_height; 00049 float lightmap_uv_right; 00050 float lightmap_uv_bottom; 00051 GLfloat old_viewport[4]; //holds vieport before redefining in start_draw - returned from glGet 00052 00053 private: 00054 GLLightmap(const GLLightmap&); 00055 GLLightmap& operator=(const GLLightmap&); 00056 }; 00057 00058 #endif 00059 00060 /* EOF */