From 8a010ab871129712b9e9552c72ec090dbbaf56ab Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Apr 2016 11:58:26 +0200 Subject: [PATCH] =?UTF-8?q?-=20allow=2090=C2=B0=20rotations=20in=20skybox?= =?UTF-8?q?=20sectors.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gl/scene/gl_flats.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 2a5ef712e9..bdb57813a6 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -339,33 +339,37 @@ void GLFlat::DrawSkyboxSector(int pass, bool processlights) } float z = plane.plane.ZatPoint(0., 0.) + dz; + static float uvals[] = { 0, 0, 1, 1 }; + static float vvals[] = { 1, 0, 0, 1 }; + int rot = -xs_FloorToInt(plane.Angle / 90.f); + ptr->x = minx; ptr->z = z; ptr->y = miny; - ptr->u = 0; - ptr->v = 1; + ptr->u = uvals[rot & 3]; + ptr->v = vvals[rot & 3]; ptr++; ptr->x = minx; ptr->z = z; ptr->y = maxy; - ptr->u = 0; - ptr->v = 0; + ptr->u = uvals[(rot + 1) & 3]; + ptr->v = vvals[(rot + 1) & 3]; ptr++; ptr->x = maxx; ptr->z = z; ptr->y = maxy; - ptr->u = 1; - ptr->v = 0; + ptr->u = uvals[(rot + 2) & 3]; + ptr->v = vvals[(rot + 2) & 3]; ptr++; ptr->x = maxx; ptr->z = z; ptr->y = miny; - ptr->u = 1; - ptr->v = 1; + ptr->u = uvals[(rot + 3) & 3]; + ptr->v = vvals[(rot + 3) & 3]; ptr++; GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);