From 103258e364aef3c59aba4906f3df8b77c32e5e1c Mon Sep 17 00:00:00 2001 From: Sryder13 Date: Sun, 23 Mar 2014 23:37:44 +0000 Subject: [PATCH] OpenGL Flipped Patch Drawing V_FLIP in OpenGL. --- src/hardware/hw_draw.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 168761a07..47fab579b 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -179,17 +179,37 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, if (option & V_NOSCALESTART) sdupx = sdupy = 2.0f; - v[0].x = v[3].x = (cx*sdupx-gpatch->leftoffset*pdupx)/vid.width - 1; - v[2].x = v[1].x = (cx*sdupx+(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1; - v[0].y = v[1].y = 1-(cy*sdupy-gpatch->topoffset*pdupy)/vid.height; - v[2].y = v[3].y = 1-(cy*sdupy+(gpatch->height-gpatch->topoffset)*pdupy)/vid.height; + if (option & V_FLIP) // Need to flip both this and sow + { + v[0].x = v[3].x = (cx*sdupx-(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1; + v[2].x = v[1].x = (cx*sdupx+gpatch->leftoffset*pdupx)/vid.width - 1; + v[0].y = v[1].y = 1-(cy*sdupy-gpatch->topoffset*pdupy)/vid.height; + v[2].y = v[3].y = 1-(cy*sdupy+(gpatch->height-gpatch->topoffset)*pdupy)/vid.height; + } + else + { + v[0].x = v[3].x = (cx*sdupx-gpatch->leftoffset*pdupx)/vid.width - 1; + v[2].x = v[1].x = (cx*sdupx+(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1; + v[0].y = v[1].y = 1-(cy*sdupy-gpatch->topoffset*pdupy)/vid.height; + v[2].y = v[3].y = 1-(cy*sdupy+(gpatch->height-gpatch->topoffset)*pdupy)/vid.height; + } v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; - v[0].sow = v[3].sow = 0.0f; - v[2].sow = v[1].sow = gpatch->max_s; - v[0].tow = v[1].tow = 0.0f; - v[2].tow = v[3].tow = gpatch->max_t; + if (option & V_FLIP) + { + v[0].sow = v[3].sow = gpatch->max_s; + v[2].sow = v[1].sow = 0.0f; + v[0].tow = v[1].tow = 0.0f; + v[2].tow = v[3].tow = gpatch->max_t; + } + else + { + v[0].sow = v[3].sow = 0.0f; + v[2].sow = v[1].sow = gpatch->max_s; + v[0].tow = v[1].tow = 0.0f; + v[2].tow = v[3].tow = gpatch->max_t; + } flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;