Merge lp:~widelands-dev/widelands/rotate_terrains into lp:widelands

Proposed by SirVer
Status: Merged
Merged at revision: 7718
Proposed branch: lp:~widelands-dev/widelands/rotate_terrains
Merge into: lp:widelands
Diff against target: 17 lines (+5/-1)
1 file modified
src/graphic/game_renderer.cc (+5/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/rotate_terrains
Reviewer Review Type Date Requested Status
kaputtnik (community) Approve
Review via email: mp+283389@code.launchpad.net

Commit message

Fixes an error in converting from pixel space to opengl space which flipped all textures vertically when drawn on screen.

Description of the change

A one byte fix for the flipped terrains.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Hi, I am bunnybot (https://github.com/widelands/bunnybot).

I am keeping the source branch lp:~widelands-dev/widelands/rotate_terrains mirrored to https://github.com/widelands/widelands/tree/_widelands_dev_widelands_rotate_terrains

You can give me commands by starting a line with @bunnybot <command>. I understand:
 merge: Merges the source branch into the target branch, closing the merge proposal. I will use the proposed commit message if it is set.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Travis build 326 has changed state to: passed. Details: https://travis-ci.org/widelands/widelands/builds/103784662.

Revision history for this message
kaputtnik (franku) wrote :

Wonderful :-)

Such a small change... I would suggest to have a comment in there describing why x isn't negative but y is.

review: Approve
Revision history for this message
SirVer (sirver) wrote :

Added a comment.

Thanks for testing and code review!

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/graphic/game_renderer.cc'
2--- src/graphic/game_renderer.cc 2016-01-10 11:36:05 +0000
3+++ src/graphic/game_renderer.cc 2016-01-21 21:11:01 +0000
4@@ -187,8 +187,12 @@
5 map.normalize_coords(coords);
6 const FCoords& fcoords = map.get_fcoords(coords);
7
8+ // Texture coordinates for pseudo random tiling of terrain and road
9+ // graphics. Since screen space X increases top-to-bottom and OpenGL
10+ // increases bottom-to-top we flip the y coordinate to not have
11+ // terrains and road graphics vertically mirrorerd.
12 f.texture_x = float(x) / kTextureSideLength;
13- f.texture_y = float(y) / kTextureSideLength;
14+ f.texture_y = -float(y) / kTextureSideLength;
15
16 f.gl_x = f.pixel_x = x + surface_offset.x;
17 f.gl_y = f.pixel_y = y + surface_offset.y - fcoords.field->get_height() * HEIGHT_FACTOR;

Subscribers

People subscribed via source and target branches

to status/vote changes: