Exemplo n.º 1
0
/*
==================
SCR_UpdateScreen

This is called every frame, and can also be called explicitly to flush
text to the screen.

WARNING: be very careful calling this from elsewhere, because the refresh
needs almost the entire 256k of stack space!
==================
*/
void SCR_UpdateScreen (void)
{
	vid.numpages = (gl_triplebuffer.value) ? 3 : 2;

	if (scr_disabled_for_loading)
	{
		if (realtime - scr_disabled_time > 60)
		{
			scr_disabled_for_loading = false;
			Con_Printf ("load failed.\n");
		}
		else
			return;
	}

	if (!scr_initialized || !con_initialized)
		return;				// not initialized yet


	GL_BeginRendering (&glx, &gly, &glwidth, &glheight);

	//
	// determine size of refresh window
	//
	if (vid.recalc_refdef)
		SCR_CalcRefdef ();

//
// do 3D refresh drawing, and then update the screen
//
	SCR_SetUpToDrawConsole ();

	V_RenderView ();

	GL_Set2D ();

	//FIXME: only call this when needed
	SCR_TileClear ();

	if (scr_drawdialog) //new game confirm
	{
		if (con_forcedup)
			Draw_ConsoleBackground ();
		else
			Sbar_Draw ();
		Draw_FadeScreen ();
		SCR_DrawNotifyString ();
	}
	else if (scr_drawloading) //loading
	{
		SCR_DrawLoading ();
		Sbar_Draw ();
	}
	else if (cl.intermission == 1 && key_dest == key_game) //end of level
	{
		Sbar_IntermissionOverlay ();
	}
	else if (cl.intermission == 2 && key_dest == key_game) //end of episode
	{
		Sbar_FinaleOverlay ();
		SCR_CheckDrawCenterString ();
	}
	else
	{
		SCR_DrawCrosshair (); //johnfitz
		SCR_DrawRam ();
		SCR_DrawNet ();
		SCR_DrawTurtle ();
		SCR_DrawPause ();
		SCR_CheckDrawCenterString ();
		Sbar_Draw ();
		SCR_DrawDevStats (); //johnfitz
		SCR_DrawFPS (); //johnfitz
		SCR_DrawClock (); //johnfitz
		SCR_DrawConsole ();
		M_Draw ();
	}

	V_UpdateBlend (); //johnfitz -- V_UpdatePalette cleaned up and renamed

	GLSLGamma_GammaCorrect ();

	GL_EndRendering ();
}
/*	This is called every frame, and can also be called explicitly to flush
	text to the screen.

	WARNING: be very careful calling this from elsewhere, because the refresh
	needs almost the entire 256k of stack space!
*/
void SCR_UpdateScreen (void)
{
	if(scr_disabled_for_loading)
	{
		if(realtime-scr_disabled_time > 60.0f)
		{
			scr_disabled_for_loading = false;

			Con_Printf ("load failed.\n");
		}
		else
			return;
	}

	if(!bScreenInitialized || !bConsoleInitialized)
		return;				// not initialized yet

	GL_BeginRendering(&glx,&gly,&glwidth,&glheight);

	Video.iFrameCount++;
	// Don't let us exceed a limited count.
	if (Video.iFrameCount > 100000)
		Video.iFrameCount = 0;

	// determine size of refresh window
	if(oldfov != scr_fov.value)
	{
		oldfov = scr_fov.value;
		vid.bRecalcRefDef = true;
	}

	if (oldscreensize != scr_viewsize.value)
	{
		oldscreensize = scr_viewsize.value;
		vid.bRecalcRefDef = true;
	}

	//johnfitz -- added oldsbarscale and oldsbaralpha
	if (oldsbarscale != scr_sbarscale.value)
	{
		oldsbarscale = scr_sbarscale.value;
		vid.bRecalcRefDef = true;
	}

	if (oldsbaralpha != scr_sbaralpha.value)
	{
		oldsbaralpha = scr_sbaralpha.value;
		vid.bRecalcRefDef = true;
	}
	//johnfitz

	if (vid.bRecalcRefDef)
		Screen_UpdateSize();

	// do 3D refresh drawing, and then update the screen
	Screen_SetUpToDrawConsole();

	if (cv_video_msaasamples.iValue > 0)
		VideoLayer_Enable(VIDEO_MULTISAMPLE);

	V_RenderView ();

	if (cv_video_msaasamples.iValue > 0)
		VideoLayer_Disable(VIDEO_MULTISAMPLE);

	Draw_ResetCanvas();

	//FIXME: only call this when needed
	SCR_TileClear();

	if(bDrawDialog) //new game confirm
	{
		g_menu->Draw();

		Draw_FadeScreen();
		SCR_DrawNotifyString();
	}
	else if (g_menu->GetState() & MENU_STATE_LOADING) //loading
		g_menu->Draw();
	else if(cl.intermission == 1 && key_dest == key_game) //end of level
	{}
	else if(cl.intermission == 2 && key_dest == key_game) //end of episode
		SCR_CheckDrawCenterString ();
	else
	{
		g_menu->Draw();

#ifdef VIDEO_SUPPORT_SHADERS
#ifdef VIDEO_SUPPORT_FRAMEBUFFERS
		//VideoPostProcess_Draw();
		DEBUG_FrameBufferDraw();
#endif
#endif

		SCR_DrawNet();
		SCR_DrawTurtle();
		SCR_DrawPause();
		SCR_CheckDrawCenterString ();
		SCR_DrawDevStats(); //johnfitz
		SCR_DrawClock(); //johnfitz
		Screen_DrawConsole();
		Screen_DrawFPS(); //johnfitz
	}

	V_UpdateBlend(); //johnfitz -- V_UpdatePalette cleaned up and renamed
}
Exemplo n.º 3
0
void SCR_UpdateScreenContent (void)
{

//
// do 3D refresh drawing, and then update the screen
//
	V_RenderView ();

	// test draw in 3d
	
	if(vr_enabled.value && !con_forcedup)
	{
		DrawRift2d();
	}
	else
	{
		GL_Set2D ();

		//FIXME: only call this when needed
		SCR_TileClear ();

		if (scr_drawdialog) //new game confirm
		{
			if (con_forcedup)
				Draw_ConsoleBackground ();
			else
				Sbar_Draw ();
			Draw_FadeScreen ();
			SCR_DrawNotifyString ();
		}
		else if (scr_drawloading) //loading
		{
			SCR_DrawLoading ();
			Sbar_Draw ();
		}
		else if (cl.intermission == 1 && key_dest == key_game) //end of level
		{
			Sbar_IntermissionOverlay ();
		}
		else if (cl.intermission == 2 && key_dest == key_game) //end of episode
		{
			Sbar_FinaleOverlay ();
			SCR_CheckDrawCenterString ();
		}
		else
		{
			SCR_DrawCrosshair (); //johnfitz
			SCR_DrawRam ();
			SCR_DrawNet ();
			SCR_DrawTurtle ();
			SCR_DrawPause ();
			SCR_CheckDrawCenterString ();
			Sbar_Draw ();
			SCR_DrawDevStats (); //johnfitz
			SCR_DrawFPS (); //johnfitz
			SCR_DrawClock (); //johnfitz
			SCR_DrawConsole ();
			M_Draw ();
		}
	}

	V_UpdateBlend (); //johnfitz -- V_UpdatePalette cleaned up and renamed
}
Exemplo n.º 4
0
void DrawRift2d ()
{
	qboolean draw_sbar = false;
	vec3_t menu_angles, forward, right, up, target;
	float scale_hud = 0.13;

	int oldglwidth = glwidth, 
		oldglheight = glheight,
		oldconwidth = vid.conwidth,
		oldconheight = vid.conheight;

	glwidth = 320;
	glheight = 200;
	
	vid.conwidth = 320;
	vid.conheight = 200;

	// draw 2d elements 1m from the users face, centered
	glPushMatrix();
	glDisable (GL_DEPTH_TEST); // prevents drawing sprites on sprites from interferring with one another
	glEnable (GL_BLEND);

	VectorCopy(r_refdef.aimangles, menu_angles)

	if (vr_aimmode.value == VR_AIMMODE_HEAD_MYAW || vr_aimmode.value == VR_AIMMODE_HEAD_MYAW_MPITCH)
		menu_angles[PITCH] = 0;

	AngleVectors (menu_angles, forward, right, up);

	VectorMA (r_refdef.vieworg, 32, forward, target);

	glTranslatef (target[0],  target[1],  target[2]);
	
	glRotatef(menu_angles[YAW] - 90, 0, 0, 1); // rotate around z

	glRotatef(90 + menu_angles[PITCH], -1, 0, 0); // keep bar at constant angled pitch towards user

	glTranslatef (-(320.0 * scale_hud / 2), -(200.0 * scale_hud / 2), 0); // center the status bar

	glScalef(scale_hud, scale_hud, scale_hud);


	if (scr_drawdialog) //new game confirm
	{
		if (con_forcedup)
			Draw_ConsoleBackground ();
		else
			draw_sbar = true; //Sbar_Draw ();
		Draw_FadeScreen ();
		SCR_DrawNotifyString ();
	}
	else if (scr_drawloading) //loading
	{
		SCR_DrawLoading ();
		draw_sbar = true; //Sbar_Draw ();
	}
	else if (cl.intermission == 1 && key_dest == key_game) //end of level
	{
		Sbar_IntermissionOverlay ();
	}
	else if (cl.intermission == 2 && key_dest == key_game) //end of episode
	{
		Sbar_FinaleOverlay ();
		SCR_CheckDrawCenterString ();
	}
	else
	{
		//SCR_DrawCrosshair (); //johnfitz
		SCR_DrawRam ();
		SCR_DrawNet ();
		SCR_DrawTurtle ();
		SCR_DrawPause ();
		SCR_CheckDrawCenterString ();
		draw_sbar = true; //Sbar_Draw ();
		SCR_DrawDevStats (); //johnfitz
		SCR_DrawFPS (); //johnfitz
		SCR_DrawClock (); //johnfitz
		SCR_DrawConsole ();
		M_Draw ();
	}

	glDisable (GL_BLEND);
	glEnable (GL_DEPTH_TEST);
	glPopMatrix();

	if(draw_sbar)
		VR_Sbar_Draw();

	glwidth = oldglwidth;
	glheight = oldglheight;
	vid.conwidth = oldconwidth;
	vid.conheight =	oldconheight;
}
/*	This is called every frame, and can also be called explicitly to flush
	text to the screen.

	WARNING: be very careful calling this from elsewhere, because the refresh
	needs almost the entire 256k of stack space!
*/
void SCR_UpdateScreen (void)
{
	if(scr_disabled_for_loading)
	{
		if(realtime-scr_disabled_time > 60.0f)
		{
			scr_disabled_for_loading = false;

			Con_Printf ("load failed.\n");
		}
		else
			return;
	}

	if(!bScreenInitialized || !bConsoleInitialized)
		return;				// not initialized yet

	GL_BeginRendering(&glx,&gly,&glwidth,&glheight);

	// determine size of refresh window
	if(oldfov != scr_fov.value)
	{
		oldfov = scr_fov.value;
		vid.bRecalcRefDef = true;
	}

	if (oldscreensize != scr_viewsize.value)
	{
		oldscreensize = scr_viewsize.value;
		vid.bRecalcRefDef = true;
	}

	//johnfitz -- added oldsbarscale and oldsbaralpha
	if (oldsbarscale != scr_sbarscale.value)
	{
		oldsbarscale = scr_sbarscale.value;
		vid.bRecalcRefDef = true;
	}

	if (oldsbaralpha != scr_sbaralpha.value)
	{
		oldsbaralpha = scr_sbaralpha.value;
		vid.bRecalcRefDef = true;
	}
	//johnfitz

	if (vid.bRecalcRefDef)
		SCR_CalcRefdef ();

	// do 3D refresh drawing, and then update the screen
	SCR_SetUpToDrawConsole ();

	V_RenderView ();

	Draw_ResetCanvas();

	//FIXME: only call this when needed
	SCR_TileClear();

	if(bDrawDialog) //new game confirm
	{
		Menu->Draw();

		Draw_FadeScreen();
		SCR_DrawNotifyString();
	}
	else if(Menu->GetState() & MENU_STATE_LOADING) //loading
		Menu->Draw();
	else if(cl.intermission == 1 && key_dest == key_game) //end of level
	{}
	else if(cl.intermission == 2 && key_dest == key_game) //end of episode
		SCR_CheckDrawCenterString ();
	else
	{
		Menu->Draw();

		SCR_DrawNet();
		SCR_DrawTurtle();
		SCR_DrawPause();
		SCR_CheckDrawCenterString ();
		SCR_DrawDevStats(); //johnfitz
		Screen_DrawFPS(); //johnfitz
		SCR_DrawClock(); //johnfitz
		SCR_DrawConsole();
	}

	V_UpdateBlend(); //johnfitz -- V_UpdatePalette cleaned up and renamed
}