X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fvideo%2Fgl_lightmap.cpp;h=014fb736c0935ef4cbf349500df982052502e0e1;hb=8c205abd2d811ba36e1a3639f5bfab6263bf9077;hp=6649a0e57a2288a505a634bc2c79acf2d797e22c;hpb=20efd7620620892d92b1c7df124c3a0c8df22a82;p=supertux.git diff --git a/src/video/gl_lightmap.cpp b/src/video/gl_lightmap.cpp index 6649a0e57..014fb736c 100644 --- a/src/video/gl_lightmap.cpp +++ b/src/video/gl_lightmap.cpp @@ -32,6 +32,7 @@ #include "glutil.hpp" #include "gl_lightmap.hpp" +#include "gl_surface_data.hpp" #include "drawing_context.hpp" #include "drawing_request.hpp" #include "renderer.hpp" @@ -42,7 +43,6 @@ #include "gl_texture.hpp" #include "texture_manager.hpp" #include "obstack/obstackpp.hpp" -#define LIGHTMAP_DIV 5 namespace { @@ -195,14 +195,16 @@ namespace GL { const Surface* surface = (const Surface*) request.request_data; GL::Texture *gltexture = dynamic_cast(surface->get_texture()); + GL::SurfaceData *surface_data = reinterpret_cast(surface->get_surface_data()); + glBindTexture(GL_TEXTURE_2D, gltexture->get_handle()); intern_draw(request.pos.x, request.pos.y, request.pos.x + surface->get_width(), request.pos.y + surface->get_height(), - surface->get_uv_left(), - surface->get_uv_top(), - surface->get_uv_right(), - surface->get_uv_bottom(), + surface_data->get_uv_left(), + surface_data->get_uv_top(), + surface_data->get_uv_right(), + surface_data->get_uv_bottom(), request.angle, request.alpha, request.color, @@ -217,14 +219,15 @@ namespace GL = (SurfacePartRequest*) request.request_data; const Surface *surface = surfacepartrequest->surface; GL::Texture *gltexture = dynamic_cast(surface->get_texture()); + GL::SurfaceData *surface_data = reinterpret_cast(surface->get_surface_data()); - float uv_width = surface->get_uv_right() - surface->get_uv_left(); - float uv_height = surface->get_uv_bottom() - surface->get_uv_top(); + float uv_width = surface_data->get_uv_right() - surface_data->get_uv_left(); + float uv_height = surface_data->get_uv_bottom() - surface_data->get_uv_top(); - float uv_left = surface->get_uv_left() + (uv_width * surfacepartrequest->source.x) / surface->get_width(); - float uv_top = surface->get_uv_top() + (uv_height * surfacepartrequest->source.y) / surface->get_height(); - float uv_right = surface->get_uv_left() + (uv_width * (surfacepartrequest->source.x + surfacepartrequest->size.x)) / surface->get_width(); - float uv_bottom = surface->get_uv_top() + (uv_height * (surfacepartrequest->source.y + surfacepartrequest->size.y)) / surface->get_height(); + float uv_left = surface_data->get_uv_left() + (uv_width * surfacepartrequest->source.x) / surface->get_width(); + float uv_top = surface_data->get_uv_top() + (uv_height * surfacepartrequest->source.y) / surface->get_height(); + float uv_right = surface_data->get_uv_left() + (uv_width * (surfacepartrequest->source.x + surfacepartrequest->size.x)) / surface->get_width(); + float uv_bottom = surface_data->get_uv_top() + (uv_height * (surfacepartrequest->source.y + surfacepartrequest->size.y)) / surface->get_height(); glBindTexture(GL_TEXTURE_2D, gltexture->get_handle()); intern_draw(request.pos.x, request.pos.y, @@ -263,15 +266,6 @@ namespace GL } void - Lightmap::draw_text(const DrawingRequest& /*request*/) - { - //const TextRequest* textrequest = (TextRequest*) request.request_data; - - //textrequest->font->draw(textrequest->text, request.pos, - // textrequest->alignment, request.drawing_effect, request.alpha); - } - - void Lightmap::draw_filled_rect(const DrawingRequest& request) { const FillRectRequest* fillrectrequest