float fog_height_texcoordscale;
char fogheighttexturename[64]; // detects changes to active fog height texture
- qboolean draw2dstage;
+ int draw2dstage; // 0 = no, 1 = yes, other value = needs setting up again
// true during envmap command capture
qboolean envmap;
case VF_MIN:
r_refdef.view.x = (int)(f[0]);
r_refdef.view.y = (int)(f[1]);
+ DrawQ_RecalcView();
break;
case VF_MIN_X:
r_refdef.view.x = (int)(k);
+ DrawQ_RecalcView();
break;
case VF_MIN_Y:
r_refdef.view.y = (int)(k);
+ DrawQ_RecalcView();
break;
case VF_SIZE:
r_refdef.view.width = (int)(f[0]);
r_refdef.view.height = (int)(f[1]);
+ DrawQ_RecalcView();
break;
case VF_SIZE_X:
r_refdef.view.width = (int)(k);
+ DrawQ_RecalcView();
break;
case VF_SIZE_Y:
r_refdef.view.height = (int)(k);
+ DrawQ_RecalcView();
break;
case VF_VIEWPORT:
r_refdef.view.x = (int)(f[0]);
f = PRVM_G_VECTOR(OFS_PARM2);
r_refdef.view.width = (int)(f[0]);
r_refdef.view.height = (int)(f[1]);
+ DrawQ_RecalcView();
break;
case VF_FOV:
r_refdef.view.frustum_x = tan(f[0] * M_PI / 360.0);r_refdef.view.ortho_x = f[0];
// resets r_refdef.draw2dstage
void DrawQ_Finish(void);
void DrawQ_ProcessDrawFlag(int flags, qboolean alpha); // sets GL_DepthMask and GL_BlendFunc
+void DrawQ_RecalcView(void); // use this when changing r_refdef.view.* from e.g. csqc
void R_DrawGamma(void);
static void _DrawQ_Setup(void)
{
r_viewport_t viewport;
- if (r_refdef.draw2dstage)
+ if (r_refdef.draw2dstage == 1)
return;
- r_refdef.draw2dstage = true;
+ r_refdef.draw2dstage = 1;
CHECKGLERROR
R_Viewport_InitOrtho(&viewport, &identitymatrix, r_refdef.view.x, vid.height - r_refdef.view.y - r_refdef.view.height, r_refdef.view.width, r_refdef.view.height, 0, 0, vid_conwidth.integer, vid_conheight.integer, -10, 100, NULL);
R_SetViewport(&viewport);
void DrawQ_Finish(void)
{
- r_refdef.draw2dstage = false;
+ r_refdef.draw2dstage = 0;
+}
+
+void DrawQ_RecalcView(void)
+{
+ if(r_refdef.draw2dstage)
+ r_refdef.draw2dstage = -1; // next draw call will set viewport etc. again
}
static float blendvertex3f[9] = {-5000, -5000, 10, 10000, -5000, 10, -5000, 10000, 10};