Fix rendering skyboxes to a tile by altering renderSetTarget() & renderRestoreTarget() to set & reset xdim & ydim so that G_ShowView() can render while a render target is set,

and additionally modifying G_SetupCamTile() to call EVENT_DISPLAYROOMSCAMERATILE after calling renderSetTarget()

git-svn-id: https://svn.eduke32.com/eduke32@7852 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2019-08-01 00:08:00 +00:00 committed by Christoph Oelckers
parent fdaee03dfb
commit 5377b128a9
3 changed files with 9 additions and 11 deletions

View file

@ -11948,7 +11948,7 @@ void renderSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz)
//DRAWROOMS TO TILE BACKUP&SET CODE //DRAWROOMS TO TILE BACKUP&SET CODE
tilesiz[tilenume].x = xsiz; tilesiz[tilenume].y = ysiz; tilesiz[tilenume].x = xsiz; tilesiz[tilenume].y = ysiz;
bakxsiz[setviewcnt] = xsiz; bakysiz[setviewcnt] = ysiz; bakxsiz[setviewcnt] = xdim; bakysiz[setviewcnt] = ydim;
bakframeplace[setviewcnt] = frameplace; frameplace = waloff[tilenume]; bakframeplace[setviewcnt] = frameplace; frameplace = waloff[tilenume];
bakwindowxy1[setviewcnt] = windowxy1; bakwindowxy1[setviewcnt] = windowxy1;
bakwindowxy2[setviewcnt] = windowxy2; bakwindowxy2[setviewcnt] = windowxy2;
@ -11970,6 +11970,8 @@ void renderSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz)
setviewcnt++; setviewcnt++;
offscreenrendering = 1; offscreenrendering = 1;
xdim = ysiz;
ydim = xsiz;
videoSetViewableArea(0,0,ysiz-1,xsiz-1); videoSetViewableArea(0,0,ysiz-1,xsiz-1);
renderSetAspect(65536,65536); renderSetAspect(65536,65536);
@ -11994,14 +11996,16 @@ void renderRestoreTarget(void)
} }
#endif #endif
xdim = bakxsiz[setviewcnt];
ydim = bakysiz[setviewcnt];
videoSetViewableArea(bakwindowxy1[setviewcnt].x,bakwindowxy1[setviewcnt].y, videoSetViewableArea(bakwindowxy1[setviewcnt].x,bakwindowxy1[setviewcnt].y,
bakwindowxy2[setviewcnt].x,bakwindowxy2[setviewcnt].y); bakwindowxy2[setviewcnt].x,bakwindowxy2[setviewcnt].y);
copybufbyte(&bakumost[windowxy1.x],&startumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startumost[0])); copybufbyte(&bakumost[windowxy1.x],&startumost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startumost[0]));
copybufbyte(&bakdmost[windowxy1.x],&startdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startdmost[0])); copybufbyte(&bakdmost[windowxy1.x],&startdmost[windowxy1.x],(windowxy2.x-windowxy1.x+1)*sizeof(startdmost[0]));
frameplace = bakframeplace[setviewcnt]; frameplace = bakframeplace[setviewcnt];
calc_ylookup(bytesperline, calc_ylookup((setviewcnt == 0) ? bytesperline : bakxsiz[setviewcnt],
(setviewcnt == 0) ? bakxsiz[0] : max(bakxsiz[setviewcnt - 1], bakxsiz[setviewcnt])); bakysiz[setviewcnt]);
modechange=1; modechange=1;
} }

View file

@ -1175,13 +1175,6 @@ LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int sect, i
if (g_screenCapture) if (g_screenCapture)
return; return;
//POGOTODO: check if this has anything to do with cameras not rendering the skybox properly
if (offscreenrendering)
{
videoClearViewableArea(0);
return;
}
int x1 = min(ix1, ix2); int x1 = min(ix1, ix2);
int x2 = max(ix1, ix2); int x2 = max(ix1, ix2);
int y1 = min(iy1, iy2); int y1 = min(iy1, iy2);

View file

@ -377,7 +377,6 @@ int SetAnimation(int sectNum, int32_t *animPtr, int goalVal, int animVel)
static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio)
{ {
int const playerNum = screenpeek; int const playerNum = screenpeek;
int const noDraw = VM_OnEventWithReturn(EVENT_DISPLAYROOMSCAMERATILE, spriteNum, playerNum, 0);
vec3_t const camera = G_GetCameraPosition(spriteNum, smoothRatio); vec3_t const camera = G_GetCameraPosition(spriteNum, smoothRatio);
int const saveMirror = display_mirror; int const saveMirror = display_mirror;
@ -385,6 +384,8 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio)
//if (waloff[wn] == 0) loadtile(wn); //if (waloff[wn] == 0) loadtile(wn);
renderSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x); renderSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x);
int const noDraw = VM_OnEventWithReturn(EVENT_DISPLAYROOMSCAMERATILE, spriteNum, playerNum, 0);
if (noDraw == 1) if (noDraw == 1)
return; return;
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS