Merge lp:~shevonar/widelands/opengl into lp:widelands

Proposed by Shevonar
Status: Merged
Merged at revision: 6242
Proposed branch: lp:~shevonar/widelands/opengl
Merge into: lp:widelands
Diff against target: 1106 lines (+541/-129)
16 files modified
ChangeLog (+7/-1)
src/graphic/graphic.cc (+20/-4)
src/graphic/graphic.h (+3/-1)
src/graphic/render/gameview.cc (+12/-79)
src/graphic/render/gameview.h (+6/-6)
src/graphic/render/gameview_opengl.cc (+101/-0)
src/graphic/render/gameview_opengl.h (+54/-0)
src/graphic/render/gameview_sdl.cc (+105/-0)
src/graphic/render/gameview_sdl.h (+50/-0)
src/graphic/render/terrain_opengl.h (+130/-19)
src/graphic/texture.cc (+31/-6)
src/graphic/texture.h (+2/-2)
src/ui_fsmenu/options.cc (+3/-3)
src/wlapplication.cc (+7/-4)
src/wui/mapview.cc (+10/-3)
worlds/greenland/terrainconf (+0/-1)
To merge this branch: bzr merge lp:~shevonar/widelands/opengl
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+93852@code.launchpad.net

Description of the change

This branch improves the OpenGL rendering:
- gameview is split into two subclasses: gameviewSDL and gameviewOpenGL
- terrain edges are dithered and rounded in OpenGL mode (via a texture mask)
- minimap is shaded correctly
- road textures should be fixed (resized to 64x64px)
- Made OpenGL the standard renderer and remove * highly experimental * from options menu
- fixed bug 649037

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2012-02-07 14:43:41 +0000
+++ ChangeLog 2012-02-20 16:00:42 +0000
@@ -12,6 +12,7 @@
12- Improved a lot of icons and button appearence.12- Improved a lot of icons and button appearence.
13- Improved statistics window.13- Improved statistics window.
14- Improved the Widelands code to use less resources.14- Improved the Widelands code to use less resources.
15- Improved OpenGL rendering which is now active by default.
15- Added a new piece of music to Widelands16- Added a new piece of music to Widelands
16- Added new states and animations for unoccupied buildings and empty mines,17- Added new states and animations for unoccupied buildings and empty mines,
17 to better indicate the current state of a building.18 to better indicate the current state of a building.
@@ -35,14 +36,16 @@
35- Fixed a bug that disallowed to connect to different servers (via36- Fixed a bug that disallowed to connect to different servers (via
36 metaserver) without prior restart of Widelands.37 metaserver) without prior restart of Widelands.
37- (Re)Fixed bug #536149: miner/master miner mixed up after enhancing38- (Re)Fixed bug #536149: miner/master miner mixed up after enhancing
38 to deep mine.39 to deep mine.
39- Fixed bug #565406: focus for save window40- Fixed bug #565406: focus for save window
40- Fixed bug #570055: Open house window on doubleclick even when minimized41- Fixed bug #570055: Open house window on doubleclick even when minimized
41- Fixed bug #590528: add more details to a replay42- Fixed bug #590528: add more details to a replay
42- Fixed bug #590631: All workers die, when warehouse/hq is destroyed43- Fixed bug #590631: All workers die, when warehouse/hq is destroyed
44- Fixed bug #594686: Roads not rendered correctly in opengl mode on some systems
43- Fixed bug #601400: Request::get_base_required_time:WARNING nr = 1 but45- Fixed bug #601400: Request::get_base_required_time:WARNING nr = 1 but
44 count is 1, which is not allowed according to the46 count is 1, which is not allowed according to the
45 comment for this function47 comment for this function
48- Fixed bug #649037: Many menus are not repainted in OpenGL mode
46- Fixed bug #657266: Unoccupied helmsmithy animation contains a person49- Fixed bug #657266: Unoccupied helmsmithy animation contains a person
47- Fixed bug #672085: New stock menu layout too high for small resolutions50- Fixed bug #672085: New stock menu layout too high for small resolutions
48- Fixed bug #672098: The priority buttons can be deactivated51- Fixed bug #672098: The priority buttons can be deactivated
@@ -50,7 +53,9 @@
50- Fixed bug #691928: Message icon is not updated in some cases when53- Fixed bug #691928: Message icon is not updated in some cases when
51 receiving focus54 receiving focus
52- Fixed bug #695035: Adjusted hotspots of buildings to fit into their space55- Fixed bug #695035: Adjusted hotspots of buildings to fit into their space
56- Fixed bug #722196: OpenGL terrain renderer does not dither between adjacent fields
53- Fixed bug #722793: Ducks on land on Three Warriors57- Fixed bug #722793: Ducks on land on Three Warriors
58- Fixed bug #722796: Minimap not shaded by terrain height in OpenGL
54- Fixed bug #723112: The name is not shown for resource coal in the 59- Fixed bug #723112: The name is not shown for resource coal in the
55 resource dialog in the editor60 resource dialog in the editor
56- Fixed bug #726699: Make the wares priority buttons in production sites61- Fixed bug #726699: Make the wares priority buttons in production sites
@@ -99,6 +104,7 @@
99- Fixed bug #886493: Default AI is set to none104- Fixed bug #886493: Default AI is set to none
100- Fixed bug #886572: After a while, increasing game speed makes the game105- Fixed bug #886572: After a while, increasing game speed makes the game
101 lag even at lower speeds106 lag even at lower speeds
107- Fixed bug #887093: Make OpenGL the standard renderer
102- Fixed bug #902765: Show buttons in the bottom toolbar in the same108- Fixed bug #902765: Show buttons in the bottom toolbar in the same
103 order, also for spectators109 order, also for spectators
104- Fixed bug #902823: Show "increase/decrease capacity" buttons only110- Fixed bug #902823: Show "increase/decrease capacity" buttons only
105111
=== modified file 'src/graphic/graphic.cc'
--- src/graphic/graphic.cc 2012-02-19 17:10:12 +0000
+++ src/graphic/graphic.cc 2012-02-20 16:00:42 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team2 * Copyright (C) 2002-2004, 2006-2012 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -1034,8 +1034,9 @@
1034*/1034*/
1035void Graphic::animate_maptextures(uint32_t time)1035void Graphic::animate_maptextures(uint32_t time)
1036{1036{
1037 for (uint32_t i = 0; i < m_maptextures.size(); ++i)1037 for (uint32_t i = 0; i < m_maptextures.size(); ++i) {
1038 m_maptextures[i]->animate(time);1038 m_maptextures[i]->animate(time);
1039 }
1039}1040}
10401041
1041/**1042/**
@@ -1043,8 +1044,9 @@
1043 */1044 */
1044void Graphic::reset_texture_animation_reminder()1045void Graphic::reset_texture_animation_reminder()
1045{1046{
1046 for (uint32_t i = 0; i < m_maptextures.size(); ++i)1047 for (uint32_t i = 0; i < m_maptextures.size(); ++i) {
1047 m_maptextures[i]->reset_was_animated();1048 m_maptextures[i]->reset_was_animated();
1049 }
1048}1050}
10491051
1050/**1052/**
@@ -1164,8 +1166,9 @@
1164 return 0;1166 return 0;
1165}1167}
11661168
1169
1167/**1170/**
1168 * Sets the name of the current world and loads the fitting road textures1171 * Sets the name of the current world and loads the fitting road and edge textures
1169 */1172 */
1170void Graphic::set_world(std::string worldname) {1173void Graphic::set_world(std::string worldname) {
1171 char buf[255];1174 char buf[255];
@@ -1179,6 +1182,10 @@
1179 m_roadtextures->pic_road_normal = get_picture(PicMod_Game, buf, false);1182 m_roadtextures->pic_road_normal = get_picture(PicMod_Game, buf, false);
1180 snprintf(buf, sizeof(buf), "worlds/%s/pics/roadt_busy.png", worldname.c_str());1183 snprintf(buf, sizeof(buf), "worlds/%s/pics/roadt_busy.png", worldname.c_str());
1181 m_roadtextures->pic_road_busy = get_picture(PicMod_Game, buf, false);1184 m_roadtextures->pic_road_busy = get_picture(PicMod_Game, buf, false);
1185
1186 // load edge texture
1187 snprintf(buf, sizeof(buf), "worlds/%s/pics/edge.png", worldname.c_str());
1188 m_edgetexture = get_picture(PicMod_Game, buf, false);
1182}1189}
11831190
1184/**1191/**
@@ -1191,3 +1198,12 @@
1191 return1198 return
1192 (roadtex == Widelands::Road_Normal ? m_roadtextures->pic_road_normal : m_roadtextures->pic_road_busy);1199 (roadtex == Widelands::Road_Normal ? m_roadtextures->pic_road_normal : m_roadtextures->pic_road_busy);
1193}1200}
1201
1202/**
1203 * Returns the alpha mask texture for edges.
1204 * \return The edge texture (alpha mask)
1205 */
1206PictureID Graphic::get_edge_texture()
1207{
1208 return m_edgetexture;
1209}
11941210
=== modified file 'src/graphic/graphic.h'
--- src/graphic/graphic.h 2011-11-30 21:38:37 +0000
+++ src/graphic/graphic.h 2012-02-20 16:00:42 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team2 * Copyright (C) 2002-2004, 2006-2012 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -189,6 +189,7 @@
189189
190 void set_world(std::string);190 void set_world(std::string);
191 PictureID get_road_texture(int32_t roadtex);191 PictureID get_road_texture(int32_t roadtex);
192 PictureID get_edge_texture();
192193
193 GraphicCaps const & caps() const throw () {return m_caps;}194 GraphicCaps const & caps() const throw () {return m_caps;}
194195
@@ -236,6 +237,7 @@
236 Picturemap m_picturemap;237 Picturemap m_picturemap;
237238
238 Road_Textures * m_roadtextures;239 Road_Textures * m_roadtextures;
240 PictureID m_edgetexture;
239 std::vector<Texture *> m_maptextures;241 std::vector<Texture *> m_maptextures;
240 std::vector<AnimationGfx *> m_animations;242 std::vector<AnimationGfx *> m_animations;
241};243};
242244
=== modified file 'src/graphic/render/gameview.cc'
--- src/graphic/render/gameview.cc 2012-02-12 17:17:26 +0000
+++ src/graphic/render/gameview.cc 2012-02-20 16:00:42 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2010-2011 by the Widelands Development Team2 * Copyright (C) 2010-2012 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -39,7 +39,6 @@
39#include "wui/overlay_manager.h"39#include "wui/overlay_manager.h"
4040
41#include "terrain_sdl.h"41#include "terrain_sdl.h"
42#include "terrain_opengl.h"
4342
44using Widelands::BaseImmovable;43using Widelands::BaseImmovable;
45using Widelands::Coords;44using Widelands::Coords;
@@ -214,8 +213,10 @@
214 f_vert.tx += TRIANGLE_WIDTH / 2;213 f_vert.tx += TRIANGLE_WIDTH / 2;
215 r_vert.tx += TRIANGLE_WIDTH / 2;214 r_vert.tx += TRIANGLE_WIDTH / 2;
216 } else {215 } else {
217 bl_vert.tx -= TRIANGLE_WIDTH / 2;216 f_vert.tx += TRIANGLE_WIDTH;
218 br_vert.tx -= TRIANGLE_WIDTH / 2;217 r_vert.tx += TRIANGLE_WIDTH;
218 bl_vert.tx += TRIANGLE_WIDTH / 2;
219 br_vert.tx += TRIANGLE_WIDTH / 2;
219 }220 }
220221
221 draw_field // Render ground222 draw_field // Render ground
@@ -986,16 +987,16 @@
986 * into the bitmap.987 * into the bitmap.
987 *988 *
988 * Vertices:989 * Vertices:
989 * - f_vert vertice of the field990 * - f_vert vertex of the field
990 * - r_vert vertice right of the field991 * - r_vert vertex right of the field
991 * - bl_vert vertice bottom left of the field992 * - bl_vert vertex bottom left of the field
992 * - br_vert vertice bottom right of the field993 * - br_vert vertex bottom right of the field
993 *994 *
994 * Textures:995 * Textures:
995 * - f_r_texture Terrain of the triangle right of the field996 * - f_r_texture Terrain of the triangle right of the field
996 * - f_d_texture Terrain of the triangle under of the field997 * - f_d_texture Terrain of the triangle under of the field
997 * - tr_d_texture Terrain of the triangle to of the right triangle ??998 * - tr_d_texture Terrain of the triangle top of the right triangle ??
998 * - l_r_texture Terrain of the triangle left if the down triangle ??999 * - l_r_texture Terrain of the triangle left of the down triangle ??
999 *1000 *
1000 * (tr_d)1001 * (tr_d)
1001 *1002 *
@@ -1018,43 +1019,7 @@
1018 Texture const & f_d_texture,1019 Texture const & f_d_texture,
1019 Texture const & f_r_texture)1020 Texture const & f_r_texture)
1020{1021{
1021 upcast(SurfaceSDL, sdlsurf, m_surface.get());1022
1022 if (sdlsurf)
1023 {
1024 sdlsurf->set_subwin(subwin);
1025 switch (sdlsurf->format().BytesPerPixel) {
1026 case 2:
1027 draw_field_int<Uint16>
1028 (*sdlsurf,
1029 f_vert, r_vert, bl_vert, br_vert,
1030 roads,
1031 tr_d_texture, l_r_texture, f_d_texture, f_r_texture);
1032 break;
1033 case 4:
1034 draw_field_int<Uint32>
1035 (*sdlsurf,
1036 f_vert, r_vert, bl_vert, br_vert,
1037 roads,
1038 tr_d_texture, l_r_texture, f_d_texture, f_r_texture);
1039 break;
1040 default:
1041 assert(false);
1042 }
1043 sdlsurf->unset_subwin();
1044 }
1045#ifdef USE_OPENGL
1046 else
1047 {
1048 // Draw triangle right (bottom) of the field
1049 draw_field_opengl
1050 (subwin, f_vert, br_vert, r_vert, f_r_texture);
1051 // Draw triangle bottom of the field
1052 draw_field_opengl
1053 (subwin, f_vert, bl_vert, br_vert, f_d_texture);
1054 // Draw the roads
1055 draw_roads_opengl(subwin, roads, f_vert, r_vert, bl_vert, br_vert);
1056 }
1057#endif
1058}1023}
10591024
1060/*1025/*
@@ -1376,35 +1341,3 @@
13761341
1377 m_surface->blit(Point(rc.x, rc.y), picture, rc2);1342 m_surface->blit(Point(rc.x, rc.y), picture, rc2);
1378}1343}
1379
1380void GameView::rendermap_init()
1381{
1382#ifdef USE_OPENGL
1383 if (g_opengl) {
1384 glMatrixMode(GL_TEXTURE);
1385 glLoadIdentity();
1386 glScalef
1387 (1.0f / static_cast<GLfloat>(TEXTURE_WIDTH),
1388 1.0f / static_cast<GLfloat>(TEXTURE_HEIGHT), 1);
1389 glDisable(GL_BLEND);
1390
1391 // Use scissor test to clip the window. This takes coordinates in screen
1392 // coordinates (y goes from bottom to top)
1393 glScissor
1394 (m_rect.x, g_gr->get_yres() - m_rect.y - m_rect.h,
1395 m_rect.w, m_rect.h);
1396 glEnable(GL_SCISSOR_TEST);
1397 }
1398#endif
1399}
1400
1401void GameView::rendermap_deint()
1402{
1403#ifdef USE_OPENGL
1404 if (g_opengl) {
1405 glDisable(GL_SCISSOR_TEST);
1406 glMatrixMode(GL_TEXTURE);
1407 glLoadIdentity();
1408 }
1409#endif
1410}
14111344
=== modified file 'src/graphic/render/gameview.h'
--- src/graphic/render/gameview.h 2012-01-09 21:10:43 +0000
+++ src/graphic/render/gameview.h 2012-02-20 16:00:42 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2010-2011 by the Widelands Development Team2 * Copyright (C) 2010-2012 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -46,7 +46,7 @@
46public:46public:
47 GameView(RenderTarget & rt):47 GameView(RenderTarget & rt):
48 RenderTarget(rt) {}48 RenderTarget(rt) {}
49 ~GameView() {}49 virtual ~GameView() {}
5050
51 /**51 /**
52 * Renders the map from a player's point of view into the current drawing52 * Renders the map from a player's point of view into the current drawing
@@ -80,12 +80,12 @@
80 Point viewpoint,80 Point viewpoint,
81 uint32_t flags);81 uint32_t flags);
8282
83private:83protected:
84 /**84 /**
85 * Helper function to draw two terrain triangles. This is called from the85 * Helper function to draw two terrain triangles. This is called from the
86 * rendermap() functions.86 * rendermap() functions.
87 */87 */
88 void draw_field88 virtual void draw_field
89 (Rect & subwin,89 (Rect & subwin,
90 Vertex const & f_vert,90 Vertex const & f_vert,
91 Vertex const & r_vert,91 Vertex const & r_vert,
@@ -109,12 +109,12 @@
109 /**109 /**
110 * This is called before the view of the game is rendered.110 * This is called before the view of the game is rendered.
111 */111 */
112 void rendermap_init();112 virtual void rendermap_init() {}
113113
114 /**114 /**
115 * This is called after the view of the game is rendered.115 * This is called after the view of the game is rendered.
116 */116 */
117 void rendermap_deint();117 virtual void rendermap_deint() {}
118};118};
119119
120#endif //WIDELANDS_GAMEVIEW_H120#endif //WIDELANDS_GAMEVIEW_H
121121
=== added file 'src/graphic/render/gameview_opengl.cc'
--- src/graphic/render/gameview_opengl.cc 1970-01-01 00:00:00 +0000
+++ src/graphic/render/gameview_opengl.cc 2012-02-20 16:00:42 +0000
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) 2011-2012 by the Widelands Development Team
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 */
19
20
21#include "gameview_opengl.h"
22
23#include "constants.h"
24#include "economy/road.h"
25#include "graphic/graphic.h"
26#include "graphic/texture.h"
27
28#include "terrain_opengl.h"
29
30using namespace Widelands;
31
32/**
33 * Draw ground textures and roads for the given parallelogram (two triangles)
34 * into the bitmap.
35 *
36 * Vertices:
37 * - f_vert vertex of the field
38 * - r_vert vertex right of the field
39 * - bl_vert vertex bottom left of the field
40 * - br_vert vertex bottom right of the field
41 *
42 * Textures:
43 * - f_r_texture Terrain of the triangle right of the field
44 * - f_d_texture Terrain of the triangle under of the field
45 * - tr_d_texture Terrain of the triangle top of the right triangle ??
46 * - l_r_texture Terrain of the triangle left of the down triangle ??
47 *
48 * (tr_d)
49 *
50 * (f) *------* (r)
51 * / \ r /
52 * (l_r) / \ /
53 * / d \/
54 * (bl) *------* (br)
55 */
56void GameViewOpenGL::draw_field
57 (Rect & subwin,
58 Vertex const & f_vert,
59 Vertex const & r_vert,
60 Vertex const & bl_vert,
61 Vertex const & br_vert,
62 uint8_t roads,
63 Texture const & tr_d_texture,
64 Texture const & l_r_texture,
65 Texture const & f_d_texture,
66 Texture const & f_r_texture)
67{
68 // Draw triangle right (bottom) of the field
69 draw_field_opengl
70 (subwin, f_vert, br_vert, r_vert, f_r_texture, f_d_texture, tr_d_texture);
71 // Draw triangle bottom of the field
72 draw_field_opengl
73 (subwin, f_vert, bl_vert, br_vert, f_d_texture, l_r_texture, f_d_texture);
74
75 // Draw the roads
76 draw_roads_opengl(subwin, roads, f_vert, r_vert, bl_vert, br_vert);
77}
78
79void GameViewOpenGL::rendermap_init()
80{
81 glMatrixMode(GL_TEXTURE);
82 glLoadIdentity();
83 glScalef
84 (1.0f / static_cast<GLfloat>(TEXTURE_WIDTH),
85 1.0f / static_cast<GLfloat>(TEXTURE_HEIGHT), 1);
86 glDisable(GL_BLEND);
87
88 // Use scissor test to clip the window. This takes coordinates in screen
89 // coordinates (y goes from bottom to top)
90 glScissor
91 (m_rect.x, g_gr->get_yres() - m_rect.y - m_rect.h,
92 m_rect.w, m_rect.h);
93 glEnable(GL_SCISSOR_TEST);
94}
95
96void GameViewOpenGL::rendermap_deint()
97{
98 glDisable(GL_SCISSOR_TEST);
99 glMatrixMode(GL_TEXTURE);
100 glLoadIdentity();
101}
0102
=== added file 'src/graphic/render/gameview_opengl.h'
--- src/graphic/render/gameview_opengl.h 1970-01-01 00:00:00 +0000
+++ src/graphic/render/gameview_opengl.h 2012-02-20 16:00:42 +0000
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 2011 by the Widelands Development Team
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 */
19
20#ifndef GAMEVIEW_OPENGL_H_
21#define GAMEVIEW_OPENGL_H_
22
23#include "gameview.h"
24
25class GameViewOpenGL : public GameView
26{
27public:
28 GameViewOpenGL(RenderTarget & rt):
29 GameView(rt) {}
30 ~GameViewOpenGL() {}
31
32protected:
33 /**
34 * Helper function to draw two terrain triangles. This is called from the
35 * rendermap() functions.
36 */
37 void draw_field
38 (Rect & subwin,
39 Vertex const & f_vert,
40 Vertex const & r_vert,
41 Vertex const & bl_vert,
42 Vertex const & br_vert,
43 uint8_t roads,
44 Texture const & tr_d_texture,
45 Texture const & l_r_texture,
46 Texture const & f_d_texture,
47 Texture const & f_r_texture);
48
49 void rendermap_init();
50 void rendermap_deint();
51};
52
53
54#endif /* GAMEVIEW_OPENGL_H_ */
055
=== added file 'src/graphic/render/gameview_sdl.cc'
--- src/graphic/render/gameview_sdl.cc 1970-01-01 00:00:00 +0000
+++ src/graphic/render/gameview_sdl.cc 2012-02-20 16:00:42 +0000
@@ -0,0 +1,105 @@
1/*
2 * Copyright (C) 2011-2012 by the Widelands Development Team
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 */
19
20#include "gameview_sdl.h"
21
22#include "upcast.h"
23
24#include "economy/road.h"
25#include "economy/flag.h"
26
27#include "wui/minimap.h"
28#include "wui/mapviewpixelconstants.h"
29
30#include "logic/field.h"
31#include "logic/map.h"
32#include "logic/player.h"
33
34#include "graphic/graphic.h"
35#include "graphic/rendertarget.h"
36#include "graphic/surface.h"
37#include "surface_sdl.h"
38#include "graphic/texture.h"
39
40#include "wui/overlay_manager.h"
41
42#include "terrain_sdl.h"
43
44
45/**
46 * Draw ground textures and roads for the given parallelogram (two triangles)
47 * into the bitmap.
48 *
49 * Vertices:
50 * - f_vert vertex of the field
51 * - r_vert vertex right of the field
52 * - bl_vert vertex bottom left of the field
53 * - br_vert vertex bottom right of the field
54 *
55 * Textures:
56 * - f_r_texture Terrain of the triangle right of the field
57 * - f_d_texture Terrain of the triangle under of the field
58 * - tr_d_texture Terrain of the triangle top of the right triangle ??
59 * - l_r_texture Terrain of the triangle left of the down triangle ??
60 *
61 * (tr_d)
62 *
63 * (f) *------* (r)
64 * / \ r /
65 * (l_r) / \ /
66 * / d \/
67 * (bl) *------* (br)
68 */
69void GameViewSDL::draw_field
70 (Rect & subwin,
71 Vertex const & f_vert,
72 Vertex const & r_vert,
73 Vertex const & bl_vert,
74 Vertex const & br_vert,
75 uint8_t roads,
76 Texture const & tr_d_texture,
77 Texture const & l_r_texture,
78 Texture const & f_d_texture,
79 Texture const & f_r_texture)
80{
81 upcast(SurfaceSDL, sdlsurf, m_surface.get());
82 if (sdlsurf)
83 {
84 sdlsurf->set_subwin(subwin);
85 switch (sdlsurf->format().BytesPerPixel) {
86 case 2:
87 draw_field_int<Uint16>
88 (*sdlsurf,
89 f_vert, r_vert, bl_vert, br_vert,
90 roads,
91 tr_d_texture, l_r_texture, f_d_texture, f_r_texture);
92 break;
93 case 4:
94 draw_field_int<Uint32>
95 (*sdlsurf,
96 f_vert, r_vert, bl_vert, br_vert,
97 roads,
98 tr_d_texture, l_r_texture, f_d_texture, f_r_texture);
99 break;
100 default:
101 assert(false);
102 }
103 sdlsurf->unset_subwin();
104 }
105}
0106
=== added file 'src/graphic/render/gameview_sdl.h'
--- src/graphic/render/gameview_sdl.h 1970-01-01 00:00:00 +0000
+++ src/graphic/render/gameview_sdl.h 2012-02-20 16:00:42 +0000
@@ -0,0 +1,50 @@
1/*
2 * Copyright (C) 2011-2012 by the Widelands Development Team
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 */
19
20#ifndef GAMEVIEW_SDL_H_
21#define GAMEVIEW_SDL_H_
22
23#include "gameview.h"
24
25class GameViewSDL : public GameView
26{
27public:
28 GameViewSDL(RenderTarget & rt):
29 GameView(rt) {}
30 ~GameViewSDL() {}
31
32protected:
33 /**
34 * Helper function to draw two terrain triangles. This is called from the
35 * rendermap() functions.
36 */
37 void draw_field
38 (Rect & subwin,
39 Vertex const & f_vert,
40 Vertex const & r_vert,
41 Vertex const & bl_vert,
42 Vertex const & br_vert,
43 uint8_t roads,
44 Texture const & tr_d_texture,
45 Texture const & l_r_texture,
46 Texture const & f_d_texture,
47 Texture const & f_r_texture);
48};
49
50#endif /* GAMEVIEW_SDL_H_ */
051
=== modified file 'src/graphic/render/terrain_opengl.h'
--- src/graphic/render/terrain_opengl.h 2011-11-30 21:38:37 +0000
+++ src/graphic/render/terrain_opengl.h 2012-02-20 16:00:42 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2010 by the Widelands Development Team2 * Copyright (C) 2010-2012 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -18,6 +18,8 @@
18 */18 */
1919
20#ifdef USE_OPENGL20#ifdef USE_OPENGL
21#ifndef TERRAIN_OPENGL_H
22#define TERRAIN_OPENGL_H
2123
22#include "gl_picture_texture.h"24#include "gl_picture_texture.h"
23#include "vertex.h"25#include "vertex.h"
@@ -28,13 +30,13 @@
28 Vertex const & p1,30 Vertex const & p1,
29 Vertex const & p2,31 Vertex const & p2,
30 Vertex const & p3,32 Vertex const & p3,
31 Texture const & texture)33 Texture const & texture,
34 Texture const & left_texture,
35 Texture const & top_texture)
32{36{
33 if (p1.b <= -128 and p2.b <= -128 and p3.b <= -128)37 if (p1.b <= -128 and p2.b <= -128 and p3.b <= -128)
34 return;38 return;
3539
36 glBindTexture(GL_TEXTURE_2D, texture.getTexture());
37
38 Vertex t1(p1), t2(p2), t3(p3);40 Vertex t1(p1), t2(p2), t3(p3);
3941
40 t1.x = p1.x + subwin.x;42 t1.x = p1.x + subwin.x;
@@ -49,39 +51,147 @@
49 if (t1.y < subwin.y and t2.y < subwin.y and t3.y < subwin.y)51 if (t1.y < subwin.y and t2.y < subwin.y and t3.y < subwin.y)
50 return;52 return;
5153
52 {54 int const subxr = subwin.x + subwin.w;
53 int const subxr = subwin.x + subwin.w;55 if (t1.x > subxr and t2.x > subxr and t3.x > subxr)
54 if (t1.x > subxr and t2.x > subxr and t3.x > subxr)56 return;
55 return;57
56 }58 int const subyd = subwin.y + subwin.h;
57 {59 if (t1.y > subyd and t2.y > subyd and t3.y > subyd)
58 int const subyd = subwin.y + subwin.h;60 return;
59 if (t1.y > subyd and t2.y > subyd and t3.y > subyd)61
60 return;62 glEnable(GL_BLEND);
61 }63
64 // load current texture
65 glActiveTexture(GL_TEXTURE0);
66 glEnable(GL_TEXTURE_2D);
67 glBindTexture(GL_TEXTURE_2D, texture.getTexture());
68 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
69
70 if ((&top_texture != &texture) and not (p1.b == -128 and p3.b == -128)) {
71 // load top texture
72 glActiveTexture(GL_TEXTURE1);
73 glEnable(GL_TEXTURE_2D);
74 glBindTexture(GL_TEXTURE_2D, top_texture.getTexture());
75 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
76 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
77 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
78 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
79
80 GLuint edge = dynamic_cast<GLPictureTexture const &>
81 (*g_gr->get_edge_texture()).get_gl_texture();
82
83 // combine current and top texture
84 glActiveTexture(GL_TEXTURE2);
85 glEnable(GL_TEXTURE_2D);
86 glBindTexture(GL_TEXTURE_2D, edge);
87 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
88 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
89 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
90 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE1);
91 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE);
92 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
93 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
94 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
95 }
96
97 if ((&left_texture != &texture) and not (p1.b == -128 and p2.b == -128)) {
98 // load left texture
99 glActiveTexture(GL_TEXTURE3);
100 glEnable(GL_TEXTURE_2D);
101 glBindTexture(GL_TEXTURE_2D, left_texture.getTexture());
102 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
103 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
104 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
105 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
106
107 GLuint edge = dynamic_cast<GLPictureTexture const &>
108 (*g_gr->get_edge_texture()).get_gl_texture();
109
110 // combine current and left texture
111 glActiveTexture(GL_TEXTURE4);
112 glEnable(GL_TEXTURE_2D);
113 glBindTexture(GL_TEXTURE_2D, edge);
114 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
115 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
116 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
117 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
118 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
119 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE3);
120 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_TEXTURE);
121 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
122 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
123 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR);
124 }
125
126 // Fade effect for fog of war
127 glActiveTexture(GL_TEXTURE5);
128 glEnable(GL_TEXTURE_2D);
129 // texture does not matter but one has to be bound
130 glBindTexture(GL_TEXTURE_2D, texture.getTexture());
131 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
132 glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
133 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
134 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
135 glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR);
136 glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
62137
63 glBegin(GL_TRIANGLES); {138 glBegin(GL_TRIANGLES); {
64 {139 {
65 GLfloat const brightness = (150.0 + p1.b) / 150.0;140 GLfloat const brightness = (150.0 + p1.b) / 150.0;
66 glColor3f(brightness, brightness, brightness);141 glColor3f(brightness, brightness, brightness);
67 }142 }
68 glTexCoord2i(t1.tx, t1.ty);143 glMultiTexCoord2i(GL_TEXTURE0, t1.tx, t1.ty);
144 glMultiTexCoord2f(GL_TEXTURE1, t1.tx / TEXTURE_WIDTH, t1.ty / TEXTURE_WIDTH);
145 glMultiTexCoord2f(GL_TEXTURE2, 0, 0);
146 glMultiTexCoord2f(GL_TEXTURE3, t1.tx / TEXTURE_WIDTH, t1.ty / TEXTURE_WIDTH);
147 glMultiTexCoord2f(GL_TEXTURE4, 1, 0);
148 glMultiTexCoord2f(GL_TEXTURE5, t1.tx / TEXTURE_WIDTH, t1.ty / TEXTURE_WIDTH);
69 glVertex2f(t1.x, t1.y);149 glVertex2f(t1.x, t1.y);
70150
71 {151 {
72 GLfloat const brightness = (150.0 + p2.b) / 150.0;152 GLfloat const brightness = (150.0 + p2.b) / 150.0;
73 glColor3f(brightness, brightness, brightness);153 glColor3f(brightness, brightness, brightness);
74 }154 }
75 glTexCoord2i(t2.tx, t2.ty);155 glMultiTexCoord2i(GL_TEXTURE0, t2.tx, t2.ty);
156 glMultiTexCoord2f(GL_TEXTURE1, t2.tx / TEXTURE_WIDTH, t2.ty / TEXTURE_WIDTH);
157 glMultiTexCoord2f(GL_TEXTURE2, 0.5, 1);
158 glMultiTexCoord2f(GL_TEXTURE3, t2.tx / TEXTURE_WIDTH, t2.ty / TEXTURE_WIDTH);
159 glMultiTexCoord2f(GL_TEXTURE4, 0, 0);
160 glMultiTexCoord2f(GL_TEXTURE5, t2.tx / TEXTURE_WIDTH, t2.ty / TEXTURE_WIDTH);
76 glVertex2f(t2.x, t2.y);161 glVertex2f(t2.x, t2.y);
77162
78 {163 {
79 GLfloat const brightness = (150.0 + p3.b) / 150.0;164 GLfloat const brightness = (150.0 + p3.b) / 150.0;
80 glColor3f(brightness, brightness, brightness);165 glColor3f(brightness, brightness, brightness);
81 }166 }
82 glTexCoord2i(t3.tx, t3.ty);167 glMultiTexCoord2i(GL_TEXTURE0, t3.tx, t3.ty);
168 glMultiTexCoord2f(GL_TEXTURE1, t3.tx / TEXTURE_WIDTH, t3.ty / TEXTURE_WIDTH);
169 glMultiTexCoord2f(GL_TEXTURE2, 1, 0);
170 glMultiTexCoord2f(GL_TEXTURE3, t3.tx / TEXTURE_WIDTH, t3.ty / TEXTURE_WIDTH);
171 glMultiTexCoord2f(GL_TEXTURE4, 0.5, 1);
172 glMultiTexCoord2f(GL_TEXTURE5, t3.tx / TEXTURE_WIDTH, t3.ty / TEXTURE_WIDTH);
83 glVertex2f(t3.x, t3.y);173 glVertex2f(t3.x, t3.y);
84 } glEnd();174 } glEnd();
175
176 // Cleanup OpenGL
177 glActiveTexture(GL_TEXTURE5);
178 glDisable(GL_TEXTURE_2D);
179 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
180 glActiveTexture(GL_TEXTURE4);
181 glDisable(GL_TEXTURE_2D);
182 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
183 glActiveTexture(GL_TEXTURE3);
184 glDisable(GL_TEXTURE_2D);
185 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
186 glActiveTexture(GL_TEXTURE2);
187 glDisable(GL_TEXTURE_2D);
188 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
189 glActiveTexture(GL_TEXTURE1);
190 glDisable(GL_TEXTURE_2D);
191 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
192 glActiveTexture(GL_TEXTURE0);
193 glEnable(GL_TEXTURE_2D);
194 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
85}195}
86196
87#define horiz_road_opengl(tex, start, end) \197#define horiz_road_opengl(tex, start, end) \
@@ -93,7 +203,7 @@
93 glVertex2f(subwin.x + end.x, subwin.y + end.y - 2); \203 glVertex2f(subwin.x + end.x, subwin.y + end.y - 2); \
94 glTexCoord2i(TEXTURE_WIDTH, 4); \204 glTexCoord2i(TEXTURE_WIDTH, 4); \
95 glVertex2f(subwin.x + end.x, subwin.y + end.y + 2); \205 glVertex2f(subwin.x + end.x, subwin.y + end.y + 2); \
96 glTexCoord2i(TEXTURE_WIDTH, 4); \206 glTexCoord2i(0, 4); \
97 glVertex2f(subwin.x + start.x, subwin.y + start.y + 2); \207 glVertex2f(subwin.x + start.x, subwin.y + start.y + 2); \
98 } glEnd(); \208 } glEnd(); \
99209
@@ -106,7 +216,7 @@
106 glVertex2f(subwin.x + start.x + 3, subwin.y + start.y); \216 glVertex2f(subwin.x + start.x + 3, subwin.y + start.y); \
107 glTexCoord2i(TEXTURE_WIDTH, TEXTURE_HEIGHT); \217 glTexCoord2i(TEXTURE_WIDTH, TEXTURE_HEIGHT); \
108 glVertex2f(subwin.x + end.x + 3, subwin.y + end.y); \218 glVertex2f(subwin.x + end.x + 3, subwin.y + end.y); \
109 glTexCoord2i(TEXTURE_WIDTH - 6, TEXTURE_HEIGHT); \219 glTexCoord2i(TEXTURE_WIDTH - 6, TEXTURE_HEIGHT); \
110 glVertex2f(subwin.x + end.x - 3, subwin.y + end.y); \220 glVertex2f(subwin.x + end.x - 3, subwin.y + end.y); \
111 } glEnd(); \221 } glEnd(); \
112222
@@ -174,3 +284,4 @@
174}284}
175285
176#endif286#endif
287#endif
177288
=== modified file 'src/graphic/texture.cc'
--- src/graphic/texture.cc 2011-11-30 21:38:37 +0000
+++ src/graphic/texture.cc 2012-02-20 16:00:42 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006, 2010 by the Widelands Development Team2 * Copyright (C) 2002-2004, 2006, 2010, 2012 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -106,16 +106,38 @@
106 boost::shared_ptr<GLPictureTexture> surface(new GLPictureTexture(surf));106 boost::shared_ptr<GLPictureTexture> surface(new GLPictureTexture(surf));
107 m_glFrames.push_back(surface);107 m_glFrames.push_back(surface);
108108
109 surface->lock(IPixelAccess::Lock_Normal);109 // calculate shades on the first frame
110 m_mmap_color = surface->get_pixel(0, 0);110 if (!m_nrframes) {
111 surface->unlock(IPixelAccess::Unlock_NoChange);111 surface->lock(IPixelAccess::Lock_Normal);
112 uint32_t mmap_color_base = surface->get_pixel(0, 0);
113 surface->unlock(IPixelAccess::Unlock_NoChange);
114
115 int32_t i, shade, r, g, b, a;
116 for (i = -128; i < 128; i++) {
117 shade = 128 + i;
118
119 a = (mmap_color_base & 0xff000000) >> 24;
120 b = (mmap_color_base & 0x00ff0000) >> 16;
121 g = (mmap_color_base & 0x0000ff00) >> 8;
122 r = (mmap_color_base & 0x000000ff);
123
124 b = (b * shade) >> 7;
125 g = (g * shade) >> 7;
126 r = (r * shade) >> 7;
127
128 if (b > 255) b = 255;
129 if (g > 255) g = 255;
130 if (r > 255) r = 255;
131
132 m_mmap_color[shade] = (a << 24) | (b << 16) | (g << 8) | r;
133 }
134 }
112135
113 ++m_nrframes;136 ++m_nrframes;
114 continue;137 continue;
115 }138 }
116#endif139#endif
117140
118
119 // Determine color map if it's the first frame141 // Determine color map if it's the first frame
120 if (!m_nrframes) {142 if (!m_nrframes) {
121 if (surf->format->BitsPerPixel == 8)143 if (surf->format->BitsPerPixel == 8)
@@ -187,8 +209,11 @@
187 * Return the basic terrain colour to be used in the minimap.209 * Return the basic terrain colour to be used in the minimap.
188*/210*/
189Uint32 Texture::get_minimap_color(const char shade) {211Uint32 Texture::get_minimap_color(const char shade) {
212 assert(shade >= -128);
213 assert(shade <= 127);
214
190 if (not m_pixels)215 if (not m_pixels)
191 return m_mmap_color;216 return m_mmap_color[128 + shade];
192217
193 uint8_t clr = m_pixels[0]; // just use the top-left pixel218 uint8_t clr = m_pixels[0]; // just use the top-left pixel
194 uint32_t table = static_cast<uint8_t>(shade);219 uint32_t table = static_cast<uint8_t>(shade);
195220
=== modified file 'src/graphic/texture.h'
--- src/graphic/texture.h 2012-01-09 21:10:43 +0000
+++ src/graphic/texture.h 2012-02-20 16:00:42 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006, 2008-2010 by the Widelands Development Team2 * Copyright (C) 2002-2004, 2006, 2008-2010, 2012 by the Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -71,7 +71,7 @@
71private:71private:
72 Colormap * m_colormap;72 Colormap * m_colormap;
73 uint8_t * m_pixels;73 uint8_t * m_pixels;
74 uint32_t m_mmap_color;74 uint32_t m_mmap_color[256];
75 uint8_t * m_curframe;75 uint8_t * m_curframe;
76 int32_t m_frame_num;76 int32_t m_frame_num;
77 char * m_texture_picture;77 char * m_texture_picture;
7878
=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc 2012-01-21 13:09:23 +0000
+++ src/ui_fsmenu/options.cc 2012-02-20 16:00:42 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2002-2004, 2006-2010 by Widelands Development Team2 * Copyright (C) 2002-2004, 2006-2010, 2012 by Widelands Development Team
3 *3 *
4 * This program is free software; you can redistribute it and/or4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License5 * modify it under the terms of the GNU General Public License
@@ -468,7 +468,7 @@
468 m_label_opengl468 m_label_opengl
469 (this,469 (this,
470 get_w() * 1313 / 10000, get_h() * 8330 / 10000,470 get_w() * 1313 / 10000, get_h() * 8330 / 10000,
471 _("OpenGL rendering *Highly experimental!*"), UI::Align_VCenter),471 _("OpenGL rendering"), UI::Align_VCenter),
472 m_transparent_chat (this, Point(get_w() * 19 / 200, get_h() * 8645 / 10000)),472 m_transparent_chat (this, Point(get_w() * 19 / 200, get_h() * 8645 / 10000)),
473 m_label_transparent_chat473 m_label_transparent_chat
474 (this,474 (this,
@@ -658,7 +658,7 @@
658 opt.remove_syncstreams = m_opt_section.get_bool658 opt.remove_syncstreams = m_opt_section.get_bool
659 ("remove_syncstreams", true);659 ("remove_syncstreams", true);
660 opt.opengl = m_opt_section.get_bool660 opt.opengl = m_opt_section.get_bool
661 ("opengl", false);661 ("opengl", true);
662 opt.transparent_chat = m_opt_section.get_bool662 opt.transparent_chat = m_opt_section.get_bool
663 ("transparent_chat", true);663 ("transparent_chat", true);
664 return opt;664 return opt;
665665
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2012-02-07 12:14:30 +0000
+++ src/wlapplication.cc 2012-02-20 16:00:42 +0000
@@ -264,7 +264,7 @@
264m_should_die (false),264m_should_die (false),
265m_gfx_w(0), m_gfx_h(0),265m_gfx_w(0), m_gfx_h(0),
266m_gfx_fullscreen (false),266m_gfx_fullscreen (false),
267m_gfx_opengl (false),267m_gfx_opengl (true),
268m_default_datadirs (true),268m_default_datadirs (true),
269m_homedir(FileSystem::GetHomedir() + "/.widelands"),269m_homedir(FileSystem::GetHomedir() + "/.widelands"),
270m_redirected_stdio(false)270m_redirected_stdio(false)
@@ -512,6 +512,10 @@
512 g_sound_handler.change_music();512 g_sound_handler.change_music();
513513
514 break;514 break;
515 case SDL_VIDEOEXPOSE:
516 //log ("SDL Video Window expose event: %i\n", ev.expose.type);
517 g_gr->update_fullscreen();
518 break;
515 }519 }
516 }520 }
517 }521 }
@@ -807,7 +811,7 @@
807 m_gfx_fullscreen = s.get_bool("fullscreen", false);811 m_gfx_fullscreen = s.get_bool("fullscreen", false);
808812
809#if USE_OPENGL813#if USE_OPENGL
810 m_gfx_opengl = s.get_bool("opengl", false);814 m_gfx_opengl = s.get_bool("opengl", true);
811#endif815#endif
812816
813 // KLUDGE!817 // KLUDGE!
@@ -1352,8 +1356,7 @@
1352 <<1356 <<
1353 _1357 _
1354 (" --opengl=[0|1]\n"1358 (" --opengl=[0|1]\n"
1355 " Enables opengl rendering\n"1359 " Enables OpenGL rendering\n")
1356 " *EXPERIMENTAL*\n")
1357#endif1360#endif
1358 <<1361 <<
1359 _1362 _
13601363
=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc 2011-11-30 21:38:37 +0000
+++ src/wui/mapview.cc 2012-02-20 16:00:42 +0000
@@ -31,6 +31,8 @@
31#include "graphic/graphic.h"31#include "graphic/graphic.h"
32#include "graphic/rendertarget.h"32#include "graphic/rendertarget.h"
33#include "graphic/render/gameview.h"33#include "graphic/render/gameview.h"
34#include "graphic/render/gameview_opengl.h"
35#include "graphic/render/gameview_sdl.h"
3436
35#include "upcast.h"37#include "upcast.h"
3638
@@ -93,12 +95,17 @@
9395
94 egbase.map().overlay_manager().load_graphics();96 egbase.map().overlay_manager().load_graphics();
9597
96 GameView gameview(dst);98 GameView * gameview;
99 if (g_opengl) {
100 gameview = new GameViewOpenGL(dst);
101 } else {
102 gameview = new GameViewSDL(dst);
103 }
97104
98 if (upcast(Interactive_Player const, interactive_player, &intbase()))105 if (upcast(Interactive_Player const, interactive_player, &intbase()))
99 gameview.rendermap(egbase, interactive_player->player(), m_viewpoint);106 gameview->rendermap(egbase, interactive_player->player(), m_viewpoint);
100 else107 else
101 gameview.rendermap(egbase, m_viewpoint);108 gameview->rendermap(egbase, m_viewpoint);
102109
103 m_complete_redraw_needed = false;110 m_complete_redraw_needed = false;
104 if (char const * const text = tooltip())111 if (char const * const text = tooltip())
105112
=== added file 'worlds/blackland/pics/edge.png'
106Binary files worlds/blackland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/blackland/pics/edge.png 2012-02-20 16:00:42 +0000 differ113Binary files worlds/blackland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/blackland/pics/edge.png 2012-02-20 16:00:42 +0000 differ
=== modified file 'worlds/blackland/pics/roadt_busy.png'
107Binary files worlds/blackland/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/blackland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ114Binary files worlds/blackland/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/blackland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ
=== modified file 'worlds/blackland/pics/roadt_normal.png'
108Binary files worlds/blackland/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/blackland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ115Binary files worlds/blackland/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/blackland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ
=== added file 'worlds/desert/pics/edge.png'
109Binary files worlds/desert/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/desert/pics/edge.png 2012-02-20 16:00:42 +0000 differ116Binary files worlds/desert/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/desert/pics/edge.png 2012-02-20 16:00:42 +0000 differ
=== modified file 'worlds/desert/pics/roadt_busy.png'
110Binary files worlds/desert/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/desert/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ117Binary files worlds/desert/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/desert/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ
=== modified file 'worlds/desert/pics/roadt_normal.png'
111Binary files worlds/desert/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/desert/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ118Binary files worlds/desert/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/desert/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ
=== added file 'worlds/greenland/pics/edge.png'
112Binary files worlds/greenland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/greenland/pics/edge.png 2012-02-20 16:00:42 +0000 differ119Binary files worlds/greenland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/greenland/pics/edge.png 2012-02-20 16:00:42 +0000 differ
=== modified file 'worlds/greenland/pics/roadt_busy.png'
113Binary files worlds/greenland/pics/roadt_busy.png 2011-10-03 15:11:25 +0000 and worlds/greenland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ120Binary files worlds/greenland/pics/roadt_busy.png 2011-10-03 15:11:25 +0000 and worlds/greenland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ
=== modified file 'worlds/greenland/pics/roadt_normal.png'
114Binary files worlds/greenland/pics/roadt_normal.png 2011-10-03 15:11:25 +0000 and worlds/greenland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ121Binary files worlds/greenland/pics/roadt_normal.png 2011-10-03 15:11:25 +0000 and worlds/greenland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ
=== modified file 'worlds/greenland/terrainconf'
--- worlds/greenland/terrainconf 2012-01-04 18:52:20 +0000
+++ worlds/greenland/terrainconf 2012-02-20 16:00:42 +0000
@@ -80,4 +80,3 @@
80[bergwiese]80[bergwiese]
81name="Mountain meadow"81name="Mountain meadow"
82is=green82is=green
83
8483
=== added file 'worlds/winterland/pics/edge.png'
85Binary files worlds/winterland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/winterland/pics/edge.png 2012-02-20 16:00:42 +0000 differ84Binary files worlds/winterland/pics/edge.png 1970-01-01 00:00:00 +0000 and worlds/winterland/pics/edge.png 2012-02-20 16:00:42 +0000 differ
=== modified file 'worlds/winterland/pics/roadt_busy.png'
86Binary files worlds/winterland/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/winterland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ85Binary files worlds/winterland/pics/roadt_busy.png 2011-08-21 14:24:10 +0000 and worlds/winterland/pics/roadt_busy.png 2012-02-20 16:00:42 +0000 differ
=== modified file 'worlds/winterland/pics/roadt_normal.png'
87Binary files worlds/winterland/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/winterland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ86Binary files worlds/winterland/pics/roadt_normal.png 2011-08-21 14:24:10 +0000 and worlds/winterland/pics/roadt_normal.png 2012-02-20 16:00:42 +0000 differ

Subscribers

People subscribed via source and target branches

to status/vote changes: