add scr_showdisk cvar, to show the disk icon for a little time whenever something is accessed from disk.
try to fix the recent network issues, the slightly more sane way. added a r_viewmodel_fov cvar, to optionally control the viewmodel's fov separately from view fov. updatesound now auto-starts the sound if it wasn't already playing, but only if a sound name was specified. small optimisation for xonotic. Delay the actual fopen until the first read. This avoids the worst of the hitches every time a footstep sound is played (no more zlib decompression). r_lightprepass now respects rtlight modes. optimised some rtlight pvs bits. should hopefully be slightly more efficient. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5186 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
0b3a11335a
commit
cd4412e807
28 changed files with 336 additions and 163 deletions
|
@ -1720,6 +1720,7 @@ void CL_SendCmd (double frametime, qboolean mainloop)
|
|||
float usetime; //how many msecs we can use for the new frame
|
||||
int msecstouse; //usetime truncated to network precision (how much we'll actually eat)
|
||||
float framemsecs; //how long we're saying the input frame should be (differs from realtime with nq as we want to send frames reguarly, but note this might end up with funny-duration frames).
|
||||
qboolean xonoticworkaround;
|
||||
|
||||
clcmdbuf_t *next;
|
||||
|
||||
|
@ -1824,7 +1825,8 @@ void CL_SendCmd (double frametime, qboolean mainloop)
|
|||
buf.data = data;
|
||||
buf.prim = cls.netchan.message.prim;
|
||||
|
||||
if (cls.protocol == CP_NETQUAKE && cl.time && !cl.paused)
|
||||
xonoticworkaround = cls.protocol == CP_NETQUAKE && CPNQ_IS_DP && cl.time && !cl.paused;
|
||||
if (xonoticworkaround)
|
||||
{
|
||||
if (cl.movesequence_time > cl.time + 0.5)
|
||||
cl.movesequence_time = cl.time + 0.5; //shouldn't really happen
|
||||
|
@ -1833,7 +1835,7 @@ void CL_SendCmd (double frametime, qboolean mainloop)
|
|||
framemsecs = (cl.time - cl.movesequence_time)*1000;
|
||||
|
||||
wantfps = cl_netfps.value;
|
||||
usetime = CL_FilterTime(framemsecs, wantfps, 1.5, false);
|
||||
usetime = CL_FilterTime(framemsecs, wantfps, 5, false);
|
||||
if (usetime > 0)
|
||||
{
|
||||
usetime = framemsecs - usetime;
|
||||
|
@ -1844,7 +1846,8 @@ void CL_SendCmd (double frametime, qboolean mainloop)
|
|||
usetime = framemsecs - usetime;
|
||||
fullsend = false;
|
||||
}
|
||||
framemsecs = usetime;
|
||||
msecstouse = usetime;
|
||||
framemsecs = msecstouse;
|
||||
msecs = 0;
|
||||
}
|
||||
else
|
||||
|
@ -1881,7 +1884,7 @@ void CL_SendCmd (double frametime, qboolean mainloop)
|
|||
if (!runningindepphys && (cl_netfps.value > 0 || !fullsend))
|
||||
{
|
||||
float spare;
|
||||
spare = CL_FilterTime(msecs, wantfps, (cls.protocol == CP_NETQUAKE?0:1.5), false);
|
||||
spare = CL_FilterTime(msecs, wantfps, (/*cls.protocol == CP_NETQUAKE*/0?0:1.5), false);
|
||||
usetime = msecsround + (msecs - spare);
|
||||
msecstouse = (int)usetime;
|
||||
if (!spare)
|
||||
|
@ -1914,11 +1917,10 @@ void CL_SendCmd (double frametime, qboolean mainloop)
|
|||
if (usetime <= 0)
|
||||
return; //infinite frame times = weirdness.
|
||||
|
||||
cl.movesequence_time = cl.time;
|
||||
framemsecs = msecstouse;
|
||||
|
||||
if (cls.protocol == CP_NETQUAKE)
|
||||
framemsecs = 0;
|
||||
framemsecs = 1000*(cl.time - cl.movesequence_time);
|
||||
}
|
||||
|
||||
#ifdef HLCLIENT
|
||||
|
@ -1956,7 +1958,7 @@ void CL_SendCmd (double frametime, qboolean mainloop)
|
|||
if (fullsend && (cl_pendingcmd[plnum].msec > 12.9 && cl_pendingcmd[plnum].msec < 13) && cls.maxfps == 77)
|
||||
cl_pendingcmd[plnum].msec = 13;
|
||||
}
|
||||
msecstouse = cl_pendingcmd[0].msec;
|
||||
// msecstouse = cl_pendingcmd[0].msec;
|
||||
|
||||
//the main loop isn't allowed to send
|
||||
if (runningindepphys && mainloop)
|
||||
|
@ -2030,7 +2032,10 @@ void CL_SendCmd (double frametime, qboolean mainloop)
|
|||
}
|
||||
}
|
||||
|
||||
cl.movesequence_time += framemsecs/1000.0;
|
||||
if (xonoticworkaround)
|
||||
cl.movesequence_time += msecstouse/1000.0;
|
||||
else
|
||||
cl.movesequence_time = cl.time;
|
||||
switch (cls.protocol)
|
||||
{
|
||||
#ifdef NQPROT
|
||||
|
|
|
@ -206,6 +206,7 @@ extern cvar_t scr_sshot_compression;
|
|||
extern cvar_t crosshair;
|
||||
extern cvar_t scr_consize;
|
||||
cvar_t scr_neticontimeout = CVAR("scr_neticontimeout", "0.3");
|
||||
cvar_t scr_diskicontimeout = CVAR("scr_diskicontimeout", "0.3");
|
||||
|
||||
qboolean scr_initialized; // ready to draw
|
||||
|
||||
|
@ -223,8 +224,6 @@ qboolean scr_disabled_for_loading;
|
|||
qboolean scr_drawloading;
|
||||
float scr_disabled_time;
|
||||
|
||||
float oldsbar = 0;
|
||||
|
||||
cvar_t con_stayhidden = CVARFD("con_stayhidden", "0", CVAR_NOTFROMSERVER, "0: allow console to pounce on the user\n1: console stays hidden unless explicitly invoked\n2:toggleconsole command no longer works\n3: shift+escape key no longer works");
|
||||
cvar_t show_fps = CVARFD("show_fps", "0", CVAR_ARCHIVE, "Displays the current framerate on-screen.\n1: framerate average over a second.\n2: Slowest frame over the last second (the game will play like shit if this is significantly lower than the average).\n3: Shows the rate of the fastest frame (not very useful).\n4: Shows the current frame's timings (this depends upon timer precision).\n5: Display a graph of how long it took to render each frame, large spikes are BAD BAD BAD.\n6: Displays the standard deviation of the frame times, if its greater than 3 then something is probably badly made, or you've a virus scanner running...\n7: Framegraph, for use with slower frames.");
|
||||
cvar_t show_fps_x = CVAR("show_fps_x", "-1");
|
||||
|
@ -238,6 +237,9 @@ cvar_t show_gameclock_y = CVAR("cl_gameclock_y", "-1");
|
|||
cvar_t show_speed = CVAR("show_speed", "0");
|
||||
cvar_t show_speed_x = CVAR("show_speed_x", "-1");
|
||||
cvar_t show_speed_y = CVAR("show_speed_y", "-9");
|
||||
cvar_t scr_showdisk = CVAR("scr_showdisk", "0");
|
||||
cvar_t scr_showdisk_x = CVAR("scr_showdisk_x", "-24");
|
||||
cvar_t scr_showdisk_y = CVAR("scr_showdisk_y", "0");
|
||||
cvar_t scr_showobituaries = CVAR("scr_showobituaries", "0");
|
||||
|
||||
cvar_t scr_loadingrefresh = CVARD("scr_loadingrefresh", "0", "Force redrawing of the loading screen, in order to display EVERY resource that is loaded");
|
||||
|
@ -283,6 +285,10 @@ void CLSCR_Init(void)
|
|||
Cvar_Register(&show_speed_x, cl_screengroup);
|
||||
Cvar_Register(&show_speed_y, cl_screengroup);
|
||||
Cvar_Register(&scr_neticontimeout, cl_screengroup);
|
||||
Cvar_Register(&scr_showdisk, cl_screengroup);
|
||||
Cvar_Register(&scr_showdisk_x, cl_screengroup);
|
||||
Cvar_Register(&scr_showdisk_y, cl_screengroup);
|
||||
Cvar_Register(&scr_diskicontimeout, cl_screengroup);
|
||||
Cvar_Register(&scr_showobituaries, cl_screengroup);
|
||||
|
||||
|
||||
|
@ -1536,57 +1542,6 @@ void SCR_SizeDown_f (void)
|
|||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawTurtle
|
||||
==============
|
||||
*/
|
||||
void SCR_DrawTurtle (void)
|
||||
{
|
||||
static int count;
|
||||
|
||||
if (!scr_showturtle.ival || !scr_turtle)
|
||||
return;
|
||||
|
||||
if (host_frametime <= 1.0/scr_turtlefps.value)
|
||||
{
|
||||
count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
count++;
|
||||
if (count < 3)
|
||||
return;
|
||||
|
||||
R2D_ScalePic (scr_vrect.x, scr_vrect.y, 64, 64, scr_turtle);
|
||||
}
|
||||
|
||||
void SCR_DrawDisk (void)
|
||||
{
|
||||
// if (!draw_disc)
|
||||
return;
|
||||
|
||||
// if (!COM_HasWork())
|
||||
// return;
|
||||
|
||||
// R2D_ScalePic (scr_vrect.x + vid.width-24, scr_vrect.y, 24, 24, draw_disc);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawNet
|
||||
==============
|
||||
*/
|
||||
void SCR_DrawNet (void)
|
||||
{
|
||||
if (realtime - cls.netchan.last_received < scr_neticontimeout.value)
|
||||
return;
|
||||
if (cls.demoplayback || !scr_net)
|
||||
return;
|
||||
|
||||
R2D_ScalePic (scr_vrect.x+64, scr_vrect.y, 64, 64, scr_net);
|
||||
}
|
||||
|
||||
void SCR_StringXY(char *str, float x, float y)
|
||||
{
|
||||
char *s2;
|
||||
|
@ -1616,6 +1571,60 @@ void SCR_StringXY(char *str, float x, float y)
|
|||
Font_EndString(font_default);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawTurtle
|
||||
==============
|
||||
*/
|
||||
void SCR_DrawTurtle (void)
|
||||
{
|
||||
static int count;
|
||||
|
||||
if (!scr_showturtle.ival || !scr_turtle)
|
||||
return;
|
||||
|
||||
if (host_frametime <= 1.0/scr_turtlefps.value)
|
||||
{
|
||||
count = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
count++;
|
||||
if (count < 3)
|
||||
return;
|
||||
|
||||
R2D_ScalePic (scr_vrect.x, scr_vrect.y, 64, 64, scr_turtle);
|
||||
}
|
||||
|
||||
void SCR_DrawDisk (void)
|
||||
{
|
||||
extern float fs_accessed_time;
|
||||
if ((float)realtime - fs_accessed_time > scr_diskicontimeout.value)
|
||||
return;
|
||||
if (!draw_disc || !scr_showdisk.ival)
|
||||
return;
|
||||
|
||||
if (!R_GetShaderSizes(draw_disc, NULL, NULL, true))
|
||||
SCR_StringXY("FS", scr_showdisk_x.value, scr_showdisk_y.value);
|
||||
else
|
||||
R2D_ScalePic (scr_showdisk_x.value + (scr_showdisk_x.value<0?vid.width:0), scr_showdisk_y.value + (scr_showdisk_y.value<0?vid.height:0), 24, 24, draw_disc);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawNet
|
||||
==============
|
||||
*/
|
||||
void SCR_DrawNet (void)
|
||||
{
|
||||
if (realtime - cls.netchan.last_received < scr_neticontimeout.value)
|
||||
return;
|
||||
if (cls.demoplayback || !scr_net)
|
||||
return;
|
||||
|
||||
R2D_ScalePic (scr_vrect.x+64, scr_vrect.y, 64, 64, scr_net);
|
||||
}
|
||||
|
||||
void SCR_DrawFPS (void)
|
||||
{
|
||||
extern cvar_t show_fps;
|
||||
|
@ -3322,6 +3331,7 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
|
|||
}
|
||||
else if (nohud)
|
||||
{
|
||||
SCR_DrawDisk();
|
||||
SCR_DrawFPS ();
|
||||
SCR_CheckDrawCenterString ();
|
||||
}
|
||||
|
|
|
@ -3817,20 +3817,20 @@ void R_ObliqueNearClip(float *viewmat, mplane_t *wplane)
|
|||
// transform it into camera space by multiplying it
|
||||
// by the inverse of the projection matrix
|
||||
|
||||
q[0] = (sgn(vplane[0]) + r_refdef.m_projection[8]) / r_refdef.m_projection[0];
|
||||
q[1] = (sgn(vplane[1]) + fabs(r_refdef.m_projection[9])) / fabs(r_refdef.m_projection[5]);
|
||||
q[0] = (sgn(vplane[0]) + r_refdef.m_projection_std[8]) / r_refdef.m_projection_std[0];
|
||||
q[1] = (sgn(vplane[1]) + fabs(r_refdef.m_projection_std[9])) / fabs(r_refdef.m_projection_std[5]);
|
||||
q[2] = -1.0F;
|
||||
q[3] = (1.0F + r_refdef.m_projection[10]) / r_refdef.m_projection[14];
|
||||
q[3] = (1.0F + r_refdef.m_projection_std[10]) / r_refdef.m_projection_std[14];
|
||||
|
||||
// Calculate the scaled plane vector
|
||||
f = 2.0F / DotProduct4(vplane, q);
|
||||
Vector4Scale(vplane, f, c);
|
||||
|
||||
// Replace the third row of the projection matrix
|
||||
r_refdef.m_projection[2] = c[0];
|
||||
r_refdef.m_projection[6] = c[1];
|
||||
r_refdef.m_projection[10] = c[2] + 1.0F;
|
||||
r_refdef.m_projection[14] = c[3];
|
||||
r_refdef.m_projection_std[2] = c[0];
|
||||
r_refdef.m_projection_std[6] = c[1];
|
||||
r_refdef.m_projection_std[10] = c[2] + 1.0F;
|
||||
r_refdef.m_projection_std[14] = c[3];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -260,6 +260,7 @@ typedef struct
|
|||
vec3_t eyeoffset; /*world space, for vr screenies*/
|
||||
|
||||
float fov_x, fov_y, afov;
|
||||
float fovv_x, fovv_y; //viewmodel fovs
|
||||
float mindist, maxdist; //maxdist may be 0, for 'infinite', in which case mindist probably isn't valid either.
|
||||
|
||||
qboolean drawsbar;
|
||||
|
@ -273,7 +274,8 @@ typedef struct
|
|||
float time;
|
||||
// float waterheight; //updated by the renderer. stuff sitting at this height generate ripple effects
|
||||
|
||||
float m_projection[16];
|
||||
float m_projection_std[16]; //projection matrix for normal stuff
|
||||
float m_projection_view[16]; //projection matrix for the viewmodel. because people are weird.
|
||||
float m_view[16];
|
||||
qbyte *scenevis; /*this is the vis that's currently being draw*/
|
||||
|
||||
|
|
|
@ -224,6 +224,8 @@ cvar_t scr_conspeed = CVAR ("scr_conspeed", "2000");
|
|||
// 10 - 170
|
||||
cvar_t scr_fov = CVARFCD("fov", "90", CVAR_ARCHIVE, SCR_Fov_Callback,
|
||||
"field of vision, 1-170 degrees, standard fov is 90, nquake defaults to 108.");
|
||||
cvar_t scr_fov_viewmodel = CVARFCD("r_viewmodel_fov", "", CVAR_ARCHIVE, SCR_Fov_Callback,
|
||||
"field of vision, 1-170 degrees, standard fov is 90, nquake defaults to 108.");
|
||||
cvar_t scr_printspeed = CVAR ("scr_printspeed", "16");
|
||||
cvar_t scr_showpause = CVAR ("showpause", "1");
|
||||
cvar_t scr_showturtle = CVAR ("showturtle", "0");
|
||||
|
@ -877,6 +879,7 @@ void Renderer_Init(void)
|
|||
|
||||
Cvar_Register(&scr_viewsize, SCREENOPTIONS);
|
||||
Cvar_Register(&scr_fov, SCREENOPTIONS);
|
||||
Cvar_Register(&scr_fov_viewmodel, SCREENOPTIONS);
|
||||
// Cvar_Register(&scr_chatmodecvar, SCREENOPTIONS);
|
||||
|
||||
Cvar_Register (&scr_sshot_type, SCREENOPTIONS);
|
||||
|
|
|
@ -30,6 +30,7 @@ extern int clearnotify; // set to 0 whenever notify text is drawn
|
|||
extern qboolean scr_disabled_for_loading;
|
||||
|
||||
extern cvar_t scr_fov;
|
||||
extern cvar_t scr_fov_viewmodel;
|
||||
extern cvar_t scr_viewsize;
|
||||
|
||||
qboolean SCR_RSShot (void);
|
||||
|
|
|
@ -2880,6 +2880,7 @@ float S_UpdateSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, vec3_
|
|||
int result = 0;
|
||||
int cards = 0;
|
||||
soundcardinfo_t *sc;
|
||||
channel_t *chan;
|
||||
|
||||
if (cls.demoseeking)
|
||||
return result;
|
||||
|
@ -2896,6 +2897,14 @@ float S_UpdateSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, vec3_
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//start it if we couldn't find it.
|
||||
if (i == sc->total_chans && sfx)
|
||||
{
|
||||
chan = SND_PickChannel(sc, entnum, entchannel);
|
||||
if (chan)
|
||||
S_UpdateSoundCard(sc, false, chan, entnum, entchannel, sfx, origin, velocity, fvol, attenuation, timeofs, pitchadj, flags);
|
||||
}
|
||||
}
|
||||
S_UnlockMixer();
|
||||
if (!cards)
|
||||
|
|
|
@ -1199,6 +1199,44 @@ void V_ApplyAFov(playerview_t *pv)
|
|||
r_refdef.fov_x = CalcFov(r_refdef.fov_y, r_refdef.vrect.height, r_refdef.vrect.width*ws);
|
||||
}
|
||||
}
|
||||
|
||||
if (!r_refdef.fovv_x || !r_refdef.fovv_y)
|
||||
{
|
||||
extern cvar_t r_stereo_separation;
|
||||
float ws;
|
||||
|
||||
float afov = scr_fov_viewmodel.value;
|
||||
if (afov)
|
||||
{
|
||||
afov = bound(0.001, afov, 170);
|
||||
|
||||
ws = 1;
|
||||
#ifdef FTE_TARGET_WEB
|
||||
if (r_refdef.stereomethod == STEREO_WEBVR)
|
||||
ws = 0.5;
|
||||
#endif
|
||||
if (r_refdef.stereomethod == STEREO_CROSSEYED && r_stereo_separation.value)
|
||||
ws = 0.5;
|
||||
|
||||
//attempt to retain a classic fov
|
||||
if (ws*r_refdef.vrect.width < (r_refdef.vrect.height*640)/432)
|
||||
{
|
||||
r_refdef.fovv_y = CalcFov(afov, (ws*r_refdef.vrect.width*r_refdef.pxrect.width)/vid.fbvwidth, (r_refdef.vrect.height*r_refdef.pxrect.height)/vid.fbvheight);
|
||||
r_refdef.fovv_x = afov;//CalcFov(r_refdef.fov_y, 432, 640);
|
||||
}
|
||||
else
|
||||
{
|
||||
r_refdef.fovv_y = CalcFov(afov, 640, 432);
|
||||
r_refdef.fovv_x = CalcFov(r_refdef.fovv_y, r_refdef.vrect.height, r_refdef.vrect.width*ws);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
r_refdef.fovv_x = r_refdef.fov_x;
|
||||
r_refdef.fovv_y = r_refdef.fov_y;
|
||||
}
|
||||
}
|
||||
|
||||
if (r_refdef.useperspective)
|
||||
{
|
||||
if (r_refdef.mindist < 1)
|
||||
|
@ -1405,6 +1443,8 @@ void V_ClearRefdef(playerview_t *pv)
|
|||
r_refdef.afov = scr_fov.value; //will have a better value applied if fov is bad. this allows setting.
|
||||
r_refdef.fov_x = 0;
|
||||
r_refdef.fov_y = 0;
|
||||
r_refdef.fovv_x = 0;
|
||||
r_refdef.fovv_y = 0;
|
||||
|
||||
r_refdef.drawsbar = cl.intermissionmode == IM_NONE;
|
||||
r_refdef.flags = 0;
|
||||
|
@ -1579,8 +1619,6 @@ The player's clipping box goes from (-16 -16 -24) to (16 16 32) from
|
|||
the entity origin, so any view position inside that will be valid
|
||||
==================
|
||||
*/
|
||||
extern vrect_t scr_vrect;
|
||||
|
||||
qboolean r_secondaryview;
|
||||
#ifdef SIDEVIEWS
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ qboolean fs_readonly;
|
|||
int waitingformanifest;
|
||||
static unsigned int fs_restarts;
|
||||
void *fs_thread_mutex;
|
||||
float fs_accessed_time; //timestamp of read (does not include flocates, which should normally happen via a cache).
|
||||
|
||||
cvar_t com_fs_cache = CVARF("fs_cache", IFMINIMAL("2","1"), CVAR_ARCHIVE);
|
||||
cvar_t fs_noreexec = CVARD("fs_noreexec", "0", "Disables automatic re-execing configs on gamedir switches.\nThis means your cvar defaults etc may be from the wrong mod, and cfg_save will leave that stuff corrupted!");
|
||||
|
@ -1877,6 +1878,8 @@ vfsfile_t *FS_OpenVFS(const char *filename, const char *mode, enum fs_relative r
|
|||
|
||||
//eventually, this function will be the *ONLY* way to get at files
|
||||
|
||||
fs_accessed_time = realtime;
|
||||
|
||||
if (relativeto == FS_SYSTEM)
|
||||
return VFSOS_Open(filename, mode);
|
||||
|
||||
|
@ -2135,6 +2138,8 @@ qbyte *COM_LoadFile (const char *path, int usehunk, size_t *filesize)
|
|||
if (loc.len > 0x7fffffff) //don't malloc 5000gb sparse files or anything crazy on a 32bit system...
|
||||
return NULL;
|
||||
|
||||
fs_accessed_time = realtime;
|
||||
|
||||
f = loc.search->handle->OpenVFS(loc.search->handle, &loc, "rb");
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
|
|
@ -26,6 +26,7 @@ extern int fs_hash_dups; //for tracking efficiency. no functional use.
|
|||
extern int fs_hash_files; //for tracking efficiency. no functional use.
|
||||
extern qboolean fs_readonly; //if true, fopen(, "w") should always fail.
|
||||
extern void *fs_thread_mutex;
|
||||
extern float fs_accessed_time;
|
||||
|
||||
struct searchpath_s;
|
||||
struct searchpathfuncs_s
|
||||
|
|
|
@ -1894,6 +1894,7 @@ void pf_hash_purge(void) //restart command was used. revert to the state at the
|
|||
|
||||
typedef struct {
|
||||
char name[256];
|
||||
vfsfile_t *file;
|
||||
char *data;
|
||||
size_t bufferlen;
|
||||
size_t len;
|
||||
|
@ -1940,7 +1941,7 @@ void QCBUILTIN PF_fopen (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals
|
|||
Con_DPrintf("qcfopen(\"%s\", %i) called\n", name, fmode);
|
||||
|
||||
for (i = 0; i < MAX_QC_FILES; i++)
|
||||
if (!pf_fopen_files[i].data)
|
||||
if (!pf_fopen_files[i].prinst)
|
||||
break;
|
||||
|
||||
if (i == MAX_QC_FILES) //too many already open
|
||||
|
@ -2000,7 +2001,30 @@ void QCBUILTIN PF_fopen (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals
|
|||
pf_fopen_files[i].prinst = prinst;
|
||||
}
|
||||
break;
|
||||
case FRIK_FILE_READ: //read
|
||||
case FRIK_FILE_READ:
|
||||
case FRIK_FILE_READ_DELAY:
|
||||
{
|
||||
pf_fopen_files[i].accessmode = FRIK_FILE_READ_DELAY;
|
||||
pf_fopen_files[i].file = FS_OpenVFS(pf_fopen_files[i].name, "rb", FS_GAME);
|
||||
if (!pf_fopen_files[i].file && fallbackread)
|
||||
{
|
||||
Q_strncpyz(pf_fopen_files[i].name, fallbackread, sizeof(pf_fopen_files[i].name));
|
||||
pf_fopen_files[i].file = FS_OpenVFS(pf_fopen_files[i].name, "rb", FS_GAME);
|
||||
}
|
||||
pf_fopen_files[i].ofs = 0;
|
||||
if (pf_fopen_files[i].file)
|
||||
{
|
||||
pf_fopen_files[i].len = VFS_GETLEN(pf_fopen_files[i].file);
|
||||
|
||||
G_FLOAT(OFS_RETURN) = i + FIRST_QC_FILE_INDEX;
|
||||
pf_fopen_files[i].prinst = prinst;
|
||||
}
|
||||
else
|
||||
G_FLOAT(OFS_RETURN) = -1;
|
||||
}
|
||||
break;
|
||||
|
||||
// case FRIK_FILE_READ: //read
|
||||
case FRIK_FILE_READNL: //read whole file
|
||||
fsize = FS_LoadFile(pf_fopen_files[i].name, (void**)&pf_fopen_files[i].data);
|
||||
if (!pf_fopen_files[i].data && fallbackread)
|
||||
|
@ -2060,7 +2084,7 @@ void PF_fclose_i (int fnum)
|
|||
return; //out of range
|
||||
}
|
||||
|
||||
if (!pf_fopen_files[fnum].data)
|
||||
if (!pf_fopen_files[fnum].prinst)
|
||||
{
|
||||
Con_Printf("PF_fclose: File is not open\n");
|
||||
return; //not open
|
||||
|
@ -2075,18 +2099,23 @@ void PF_fclose_i (int fnum)
|
|||
pf_fopen_files[fnum].prinst->AddressableFree(pf_fopen_files[fnum].prinst, pf_fopen_files[fnum].data);
|
||||
break;
|
||||
|
||||
case FRIK_FILE_READ_DELAY:
|
||||
VFS_CLOSE(pf_fopen_files[fnum].file);
|
||||
break;
|
||||
|
||||
case FRIK_FILE_READ:
|
||||
case 4:
|
||||
case FRIK_FILE_READNL:
|
||||
BZ_Free(pf_fopen_files[fnum].data);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case FRIK_FILE_APPEND:
|
||||
case FRIK_FILE_WRITE:
|
||||
COM_WriteFile(pf_fopen_files[fnum].name, FS_GAMEONLY, pf_fopen_files[fnum].data, pf_fopen_files[fnum].len);
|
||||
BZ_Free(pf_fopen_files[fnum].data);
|
||||
break;
|
||||
case 3:
|
||||
case FRIK_FILE_INVALID:
|
||||
break;
|
||||
}
|
||||
pf_fopen_files[fnum].file = NULL;
|
||||
pf_fopen_files[fnum].data = NULL;
|
||||
pf_fopen_files[fnum].prinst = NULL;
|
||||
}
|
||||
|
@ -2101,6 +2130,12 @@ void QCBUILTIN PF_fclose (pubprogfuncs_t *prinst, struct globalvars_s *pr_global
|
|||
return; //out of range
|
||||
}
|
||||
|
||||
if (!pf_fopen_files[fnum].prinst)
|
||||
{
|
||||
Con_Printf("PF_fclose: File is not open\n");
|
||||
return; //not open
|
||||
}
|
||||
|
||||
if (pf_fopen_files[fnum].prinst != prinst)
|
||||
{
|
||||
PF_Warningf(prinst, "PF_fclose: File is from wrong instance\n");
|
||||
|
@ -2124,7 +2159,7 @@ void QCBUILTIN PF_fgets (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals
|
|||
return; //out of range
|
||||
}
|
||||
|
||||
if (!pf_fopen_files[fnum].data)
|
||||
if (!pf_fopen_files[fnum].prinst)
|
||||
{
|
||||
PR_BIError(prinst, "PF_fgets: File is not open\n");
|
||||
return; //not open
|
||||
|
@ -2136,6 +2171,16 @@ void QCBUILTIN PF_fgets (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals
|
|||
return; //this just isn't ours.
|
||||
}
|
||||
|
||||
if (pf_fopen_files[fnum].accessmode == FRIK_FILE_READ_DELAY)
|
||||
{ //on first read, convert into a regular file.
|
||||
pf_fopen_files[fnum].accessmode = FRIK_FILE_READ;
|
||||
pf_fopen_files[fnum].data = BZ_Malloc(pf_fopen_files[fnum].len+1);
|
||||
pf_fopen_files[fnum].data[pf_fopen_files[fnum].len] = 0;
|
||||
pf_fopen_files[fnum].len = pf_fopen_files[fnum].bufferlen = VFS_READ(pf_fopen_files[fnum].file, pf_fopen_files[fnum].data, pf_fopen_files[fnum].len);
|
||||
VFS_CLOSE(pf_fopen_files[fnum].file);
|
||||
pf_fopen_files[fnum].file = NULL;
|
||||
}
|
||||
|
||||
if (pf_fopen_files[fnum].accessmode == FRIK_FILE_MMAP_READ || pf_fopen_files[fnum].accessmode == FRIK_FILE_MMAP_RW)
|
||||
{
|
||||
G_INT(OFS_RETURN) = PR_SetString(prinst, pf_fopen_files[fnum].data);
|
||||
|
@ -2232,7 +2277,7 @@ static int PF_fwrite_internal (pubprogfuncs_t *prinst, int fnum, const char *msg
|
|||
return 0; //out of range
|
||||
}
|
||||
|
||||
if (!pf_fopen_files[fnum].data)
|
||||
if (!pf_fopen_files[fnum].prinst)
|
||||
{
|
||||
PF_Warningf(prinst, "PF_fwrite: File is not open\n");
|
||||
return 0; //not open
|
||||
|
@ -2276,7 +2321,7 @@ static int PF_fread_internal (pubprogfuncs_t *prinst, int fnum, char *msg, size_
|
|||
return 0; //out of range
|
||||
}
|
||||
|
||||
if (!pf_fopen_files[fnum].data)
|
||||
if (!pf_fopen_files[fnum].prinst)
|
||||
{
|
||||
PF_Warningf(prinst, "PF_fread: File is not open\n");
|
||||
return 0; //not open
|
||||
|
@ -2347,7 +2392,7 @@ void QCBUILTIN PF_fseek (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals
|
|||
PF_Warningf(prinst, "PF_fread: File out of range\n");
|
||||
return; //out of range
|
||||
}
|
||||
if (!pf_fopen_files[fnum].data)
|
||||
if (!pf_fopen_files[fnum].prinst)
|
||||
{
|
||||
PF_Warningf(prinst, "PF_fread: File is not open\n");
|
||||
return; //not open
|
||||
|
@ -2373,7 +2418,7 @@ void QCBUILTIN PF_fsize (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals
|
|||
PF_Warningf(prinst, "PF_fsize: File out of range\n");
|
||||
return; //out of range
|
||||
}
|
||||
if (!pf_fopen_files[fnum].data)
|
||||
if (!pf_fopen_files[fnum].prinst)
|
||||
{
|
||||
PF_Warningf(prinst, "PF_fsize: File is not open\n");
|
||||
return; //not open
|
||||
|
|
|
@ -719,6 +719,8 @@ typedef enum
|
|||
#define FRIK_FILE_MMAP_READ 5 /*fgets returns a pointer. memory is not guarenteed to be released.*/
|
||||
#define FRIK_FILE_MMAP_RW 6 /*fgets returns a pointer. file is written upon close. memory is not guarenteed to be released.*/
|
||||
|
||||
#define FRIK_FILE_READ_DELAY (7) /*internal special mode where the file is not read until the first read. this avoids extra slowness with xonotic*/
|
||||
|
||||
#define MASK_DELTA 1
|
||||
#define MASK_STDVIEWMODEL 2
|
||||
|
||||
|
|
|
@ -2778,10 +2778,10 @@ void D3D11BE_SetupViewCBuffer(void)
|
|||
//d3d uses 0 to 1 depth.
|
||||
//so we scale the projection matrix by a bias
|
||||
#if 1
|
||||
Matrix4_Multiply(projgltod3d, r_refdef.m_projection, cbv->m_projection);
|
||||
Matrix4_Multiply(projgltod3d, r_refdef.m_projection_std, cbv->m_projection);
|
||||
#else
|
||||
memcpy(cbv->m_projection, r_refdef.m_projection, sizeof(cbv->m_projection));
|
||||
cbv->m_projection[10] = r_refdef.m_projection[10] * 0.5;
|
||||
memcpy(cbv->m_projection, r_refdef.m_projection_std, sizeof(cbv->m_projection));
|
||||
cbv->m_projection[10] = r_refdef.m_projection_std[10] * 0.5;
|
||||
#endif
|
||||
memcpy(cbv->m_view, r_refdef.m_view, sizeof(cbv->m_view));
|
||||
VectorCopy(r_origin, cbv->v_eyepos);
|
||||
|
@ -3403,7 +3403,7 @@ static void R_DrawPortal(batch_t *batch, batch_t **blist)
|
|||
|
||||
|
||||
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
/*FIXME: we need to borrow pretty much everything about portal positioning from the gl renderer. make it common code or something, because this is horrendous.
|
||||
if (r_refdef.frustum_numplanes < MAXFRUSTUMPLANES)
|
||||
{
|
||||
|
@ -3439,7 +3439,7 @@ static void R_DrawPortal(batch_t *batch, batch_t **blist)
|
|||
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
|
||||
VectorCopy (r_refdef.vieworg, r_origin);
|
||||
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
shaderstate.curentity = NULL;
|
||||
|
||||
D3D11BE_SetupViewCBuffer();
|
||||
|
|
|
@ -3121,7 +3121,7 @@ static void R_RenderScene(void)
|
|||
{
|
||||
IDirect3DDevice8_SetTransform(pD3DDev8, D3DTS_PROJECTION, (D3DMATRIX*)d3d_trueprojection);
|
||||
IDirect3DDevice8_SetTransform(pD3DDev8, D3DTS_VIEW, (D3DMATRIX*)r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
Surf_DrawWorld();
|
||||
}
|
||||
|
||||
|
@ -3237,7 +3237,7 @@ static void R_DrawPortal(batch_t *batch, batch_t **blist)
|
|||
|
||||
IDirect3DDevice8_SetTransform(pD3DDev8, D3DTS_PROJECTION, (D3DMATRIX*)d3d_trueprojection);
|
||||
IDirect3DDevice8_SetTransform(pD3DDev8, D3DTS_VIEW, (D3DMATRIX*)r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
}
|
||||
|
||||
static void BE_SubmitMeshesPortals(batch_t **worldlist, batch_t *dynamiclist)
|
||||
|
|
|
@ -3381,7 +3381,7 @@ static void R_RenderScene(void)
|
|||
{
|
||||
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_PROJECTION, (D3DMATRIX*)d3d_trueprojection);
|
||||
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_VIEW, (D3DMATRIX*)r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
Surf_DrawWorld();
|
||||
}
|
||||
|
||||
|
@ -3493,7 +3493,7 @@ static void R_DrawPortal(batch_t *batch, batch_t **blist)
|
|||
|
||||
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_PROJECTION, (D3DMATRIX*)d3d_trueprojection);
|
||||
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_VIEW, (D3DMATRIX*)r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
}
|
||||
|
||||
static void BE_SubmitMeshesPortals(batch_t **worldlist, batch_t *dynamiclist)
|
||||
|
|
|
@ -1249,14 +1249,14 @@ static void D3D9_SetupViewPortProjection(void)
|
|||
/*d3d projection matricies scale depth to 0 to 1*/
|
||||
Matrix4x4_CM_Projection_Far(d3d_trueprojection, fov_x, fov_y, r_refdef.mindist/2, r_refdef.maxdist);
|
||||
/*ogl projection matricies scale depth to -1 to 1, and I would rather my code used consistant culling*/
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection, fov_x, fov_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection_std, fov_x, fov_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*d3d projection matricies scale depth to 0 to 1*/
|
||||
Matrix4x4_CM_Projection_Inf(d3d_trueprojection, fov_x, fov_y, r_refdef.mindist/2);
|
||||
/*ogl projection matricies scale depth to -1 to 1, and I would rather my code used consistant culling*/
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, r_refdef.mindist);
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection_std, fov_x, fov_y, r_refdef.mindist);
|
||||
}
|
||||
|
||||
d3d9error(IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_PROJECTION, (D3DMATRIX*)d3d_trueprojection));
|
||||
|
@ -1299,7 +1299,7 @@ static void (D3D9_R_RenderView) (void)
|
|||
// else
|
||||
d3d9error(IDirect3DDevice9_Clear(pD3DDev9, 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1, 0));
|
||||
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
RQ_BeginFrame();
|
||||
if (!(r_refdef.flags & RDF_NOWORLDMODEL))
|
||||
{
|
||||
|
|
|
@ -1187,7 +1187,7 @@ void D3D11_Set2D (void)
|
|||
D3D11_VIEWPORT vport;
|
||||
|
||||
// Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0 + (0.5*vid.width/vid.pixelwidth), vid.width + (0.5*vid.width/vid.pixelwidth), 0 + (0.5*vid.height/vid.pixelheight), vid.height + (0.5*vid.height/vid.pixelheight), 0, 100);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0, vid.width, vid.height, 0, 0, 99999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, 0, vid.width, vid.height, 0, 0, 99999);
|
||||
Matrix4x4_Identity(r_refdef.m_view);
|
||||
|
||||
vport.TopLeftX = 0;
|
||||
|
@ -1443,9 +1443,9 @@ static void D3D11_SetupViewPort(void)
|
|||
/*view matrix*/
|
||||
Matrix4x4_CM_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_refdef.vieworg);
|
||||
if (r_refdef.maxdist)
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection, fov_x, fov_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection_std, fov_x, fov_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
else
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, r_refdef.mindist);
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection_std, fov_x, fov_y, r_refdef.mindist);
|
||||
}
|
||||
|
||||
static void (D3D11_R_RenderView) (void)
|
||||
|
@ -1499,7 +1499,7 @@ static void (D3D11_R_RenderView) (void)
|
|||
|
||||
//fixme: waterwarp fov
|
||||
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
RQ_BeginFrame();
|
||||
// if (!(r_refdef.flags & Q2RDF_NOWORLDMODEL))
|
||||
// {
|
||||
|
|
|
@ -1294,14 +1294,14 @@ static void D3D8_SetupViewPortProjection(void)
|
|||
/*d3d projection matricies scale depth to 0 to 1*/
|
||||
Matrix4x4_CM_Projection_Far(d3d_trueprojection, fov_x, fov_y, r_refdef.mindist/2, r_refdef.maxdist);
|
||||
/*ogl projection matricies scale depth to -1 to 1, and I would rather my code used consistant culling*/
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection, fov_x, fov_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection_std, fov_x, fov_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*d3d projection matricies scale depth to 0 to 1*/
|
||||
Matrix4x4_CM_Projection_Inf(d3d_trueprojection, fov_x, fov_y, r_refdef.mindist/2);
|
||||
/*ogl projection matricies scale depth to -1 to 1, and I would rather my code used consistant culling*/
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, r_refdef.mindist);
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection_std, fov_x, fov_y, r_refdef.mindist);
|
||||
}
|
||||
|
||||
d3d8error(IDirect3DDevice8_SetTransform(pD3DDev8, D3DTS_PROJECTION, (D3DMATRIX*)d3d_trueprojection));
|
||||
|
@ -1337,7 +1337,7 @@ static void (D3D8_R_RenderView) (void)
|
|||
// else
|
||||
d3d8error(IDirect3DDevice8_Clear(pD3DDev8, 0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1, 0));
|
||||
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
RQ_BeginFrame();
|
||||
if (!(r_refdef.flags & RDF_NOWORLDMODEL))
|
||||
{
|
||||
|
|
|
@ -134,6 +134,7 @@ struct {
|
|||
float modelmatrix[16];
|
||||
float modelmatrixinv[16];
|
||||
float modelviewmatrix[16];
|
||||
float projectionmatrix[16];
|
||||
|
||||
int colourarraytype;
|
||||
vec4_t pendingcolourflat;
|
||||
|
@ -919,7 +920,7 @@ void GLBE_RenderShadowBuffer(unsigned int numverts, int vbo, vecV_t *verts, unsi
|
|||
if (shaderstate.allblackshader.glsl.handle != shaderstate.lastuniform && shaderstate.allblack_mvp != -1)
|
||||
{
|
||||
float m16[16];
|
||||
Matrix4_Multiply(r_refdef.m_projection, shaderstate.modelviewmatrix, m16);
|
||||
Matrix4_Multiply(shaderstate.projectionmatrix, shaderstate.modelviewmatrix, m16);
|
||||
qglUniformMatrix4fvARB(shaderstate.allblack_mvp, 1, false, m16);
|
||||
}
|
||||
shaderstate.lastuniform = shaderstate.allblackshader.glsl.handle;
|
||||
|
@ -3213,7 +3214,7 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
|
|||
qglUniformMatrix4fvARB(ph, 1, false, r_refdef.m_view);
|
||||
break;
|
||||
case SP_M_PROJECTION:
|
||||
qglUniformMatrix4fvARB(ph, 1, false, r_refdef.m_projection);
|
||||
qglUniformMatrix4fvARB(ph, 1, false, shaderstate.projectionmatrix);
|
||||
break;
|
||||
case SP_M_MODELVIEW:
|
||||
qglUniformMatrix4fvARB(ph, 1, false, shaderstate.modelviewmatrix);
|
||||
|
@ -3221,14 +3222,14 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
|
|||
case SP_M_MODELVIEWPROJECTION:
|
||||
{
|
||||
float m16[16];
|
||||
Matrix4_Multiply(r_refdef.m_projection, shaderstate.modelviewmatrix, m16);
|
||||
Matrix4_Multiply(shaderstate.projectionmatrix, shaderstate.modelviewmatrix, m16);
|
||||
qglUniformMatrix4fvARB(ph, 1, false, m16);
|
||||
}
|
||||
break;
|
||||
case SP_M_INVMODELVIEWPROJECTION:
|
||||
{
|
||||
float m16[16], inv[16];
|
||||
Matrix4_Multiply(r_refdef.m_projection, shaderstate.modelviewmatrix, m16);
|
||||
Matrix4_Multiply(shaderstate.projectionmatrix, shaderstate.modelviewmatrix, m16);
|
||||
Matrix4_Invert(m16, inv);
|
||||
qglUniformMatrix4fvARB(ph, 1, false, inv);
|
||||
}
|
||||
|
@ -3247,7 +3248,7 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
|
|||
case SP_M_INVVIEWPROJECTION:
|
||||
{
|
||||
float m16[16], inv[16];
|
||||
Matrix4_Multiply(r_refdef.m_projection, r_refdef.m_view, m16);
|
||||
Matrix4_Multiply(shaderstate.projectionmatrix, r_refdef.m_view, m16);
|
||||
Matrix4_Invert(m16, inv);
|
||||
qglUniformMatrix4fvARB(ph, 1, false, inv);
|
||||
}
|
||||
|
@ -3436,7 +3437,7 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
|
|||
v[3] = 1;
|
||||
|
||||
Matrix4x4_CM_Transform4(shaderstate.modelviewmatrix, v, tempv);
|
||||
Matrix4x4_CM_Transform4(r_refdef.m_projection, tempv, v);
|
||||
Matrix4x4_CM_Transform4(shaderstate.projectionmatrix, tempv, v);
|
||||
|
||||
v[3] *= 2;
|
||||
v[0] = (v[0]/v[3]) + 0.5;
|
||||
|
@ -3822,6 +3823,17 @@ void GLBE_SelectEntity(entity_t *ent)
|
|||
nd = 1;
|
||||
if (shaderstate.depthrange != nd)
|
||||
{
|
||||
if (nd < 1)
|
||||
memcpy(shaderstate.projectionmatrix, r_refdef.m_projection_view, sizeof(shaderstate.projectionmatrix));
|
||||
else
|
||||
memcpy(shaderstate.projectionmatrix, r_refdef.m_projection_std, sizeof(shaderstate.projectionmatrix));
|
||||
if (qglLoadMatrixf)
|
||||
{
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglLoadMatrixf(shaderstate.projectionmatrix);
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
shaderstate.depthrange = nd;
|
||||
if (qglDepthRange)
|
||||
qglDepthRange (gldepthmin, gldepthmin + shaderstate.depthrange*(gldepthmax-gldepthmin));
|
||||
|
@ -4313,7 +4325,7 @@ static void DrawMeshes(void)
|
|||
if (shaderstate.allblackshader.glsl.handle != shaderstate.lastuniform && shaderstate.allblack_mvp != -1)
|
||||
{
|
||||
float m16[16];
|
||||
Matrix4_Multiply(r_refdef.m_projection, shaderstate.modelviewmatrix, m16);
|
||||
Matrix4_Multiply(shaderstate.projectionmatrix, shaderstate.modelviewmatrix, m16);
|
||||
qglUniformMatrix4fvARB(shaderstate.allblack_mvp, 1, false, m16);
|
||||
}
|
||||
BE_SubmitMeshChain(shaderstate.allblackshader.glsl.usetesselation);
|
||||
|
|
|
@ -186,7 +186,7 @@ void GL_Set2D (qboolean flipped)
|
|||
w = fabs(cos(rad)) * (vid.width) + fabs(sin(rad)) * (vid.height);
|
||||
h = fabs(sin(rad)) * (vid.width) + fabs(cos(rad)) * (vid.height);
|
||||
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, w/-2.0f, w/2.0f, h/2.0f, h/-2.0f, -99999, 99999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, w/-2.0f, w/2.0f, h/2.0f, h/-2.0f, -99999, 99999);
|
||||
|
||||
Matrix4x4_Identity(tmp);
|
||||
Matrix4_Multiply(Matrix4x4_CM_NewTranslation((vid.width/-2.0f), (vid.height/-2.0f), 0), tmp, tmp2);
|
||||
|
@ -197,9 +197,9 @@ void GL_Set2D (qboolean flipped)
|
|||
w = vid.fbvwidth;
|
||||
h = vid.fbvheight;
|
||||
if (flipped)
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0, w, 0, h, -99999, 99999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, 0, w, 0, h, -99999, 99999);
|
||||
else
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0, w, h, 0, -99999, 99999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, 0, w, h, 0, -99999, 99999);
|
||||
Matrix4x4_Identity(r_refdef.m_view);
|
||||
}
|
||||
//current physical position on the current render target.
|
||||
|
@ -215,7 +215,7 @@ void GL_Set2D (qboolean flipped)
|
|||
if (qglLoadMatrixf)
|
||||
{
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglLoadMatrixf(r_refdef.m_projection);
|
||||
qglLoadMatrixf(r_refdef.m_projection_std);
|
||||
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
qglLoadMatrixf(r_refdef.m_view);
|
||||
|
|
|
@ -439,7 +439,7 @@ void R_RenderDlights (void)
|
|||
v[2] = l->origin[2];
|
||||
v[3] = 1;
|
||||
|
||||
Matrix4_Multiply(r_refdef.m_projection, r_refdef.m_view, mvp);
|
||||
Matrix4_Multiply(r_refdef.m_projection_std, r_refdef.m_view, mvp);
|
||||
Matrix4x4_CM_Transform4(mvp, v, tempv);
|
||||
|
||||
tempv[0] /= tempv[3];
|
||||
|
@ -596,9 +596,20 @@ void R_GenDlightBatches(batch_t *batches[])
|
|||
dlight_t *l;
|
||||
batch_t *b;
|
||||
int lmode;
|
||||
unsigned modes;
|
||||
extern cvar_t r_shadow_realtime_dlight;
|
||||
extern cvar_t r_shadow_realtime_world;
|
||||
if (!r_lightprepass)
|
||||
return;
|
||||
|
||||
if (r_shadow_realtime_dlight.ival)
|
||||
modes |= LFLAG_NORMALMODE;
|
||||
if (r_shadow_realtime_world.ival)
|
||||
modes |= LFLAG_REALTIMEMODE;
|
||||
if (!modes)
|
||||
return;
|
||||
|
||||
|
||||
if (!deferredlight_shader[0])
|
||||
{
|
||||
const char *deferredlight_shader_code =
|
||||
|
@ -626,6 +637,9 @@ void R_GenDlightBatches(batch_t *batches[])
|
|||
if (!l->radius)
|
||||
continue;
|
||||
|
||||
if (!(modes & l->flags))
|
||||
continue;
|
||||
|
||||
if (R_CullSphere(l->origin, l->radius))
|
||||
{
|
||||
RQuantAdd(RQUANT_RTLIGHT_CULL_FRUSTUM, 1);
|
||||
|
@ -658,7 +672,7 @@ void R_GenDlightBatches(batch_t *batches[])
|
|||
b->lightmap[j] = -1;
|
||||
b->surf_first = i;
|
||||
b->surf_count = lmode;
|
||||
b->flags |= BEF_NOSHADOWS;
|
||||
b->flags |= BEF_NOSHADOWS|BEF_NODLIGHT; //that would be weeird
|
||||
b->vbo = NULL;
|
||||
b->next = batches[sort];
|
||||
batches[sort] = b;
|
||||
|
|
|
@ -424,6 +424,7 @@ void R_SetupGL (float stereooffset, int i)
|
|||
vec3_t newa;
|
||||
|
||||
float fov_x, fov_y;
|
||||
float fovv_x, fovv_y;
|
||||
|
||||
if (!r_refdef.recurse)
|
||||
{
|
||||
|
@ -524,19 +525,25 @@ void R_SetupGL (float stereooffset, int i)
|
|||
r_refdef.pxrect.height = h;
|
||||
r_refdef.pxrect.maxheight = vid.fbpheight;
|
||||
}
|
||||
fov_x = r_refdef.fov_x;//+sin(cl.time)*5;
|
||||
fov_y = r_refdef.fov_y;//-sin(cl.time+1)*5;
|
||||
fov_x = r_refdef.fov_x;
|
||||
fov_y = r_refdef.fov_y;
|
||||
fovv_x = r_refdef.fovv_x;
|
||||
fovv_y = r_refdef.fovv_y;
|
||||
|
||||
if ((*r_refdef.rt_destcolour[0].texname || *r_refdef.rt_depth.texname) && strcmp(r_refdef.rt_destcolour[0].texname, "megascreeny"))
|
||||
{
|
||||
r_refdef.pxrect.y = r_refdef.pxrect.maxheight - (r_refdef.pxrect.height+r_refdef.pxrect.y);
|
||||
fov_y *= -1;
|
||||
fovv_y *= -1;
|
||||
r_refdef.flipcull ^= SHADER_CULL_FLIP;
|
||||
}
|
||||
else if ((r_refdef.flags & RDF_UNDERWATER) && !(r_refdef.flags & RDF_WATERWARP))
|
||||
{
|
||||
fov_x *= 1 + (((sin(cl.time * 4.7) + 1) * 0.015) * r_waterwarp.value);
|
||||
fov_y *= 1 + (((sin(cl.time * 3.0) + 1) * 0.015) * r_waterwarp.value);
|
||||
|
||||
fovv_x *= 1 + (((sin(cl.time * 4.7) + 1) * 0.015) * r_waterwarp.value);
|
||||
fovv_y *= 1 + (((sin(cl.time * 3.0) + 1) * 0.015) * r_waterwarp.value);
|
||||
}
|
||||
|
||||
GL_ViewportUpdate();
|
||||
|
@ -545,7 +552,8 @@ void R_SetupGL (float stereooffset, int i)
|
|||
if (r_refdef.stereomethod == STEREO_WEBVR)
|
||||
{
|
||||
float vm[16], em[16];
|
||||
emscriptenfte_getvreyedata(i, r_refdef.m_projection, em);
|
||||
emscriptenfte_getvreyedata(i, r_refdef.m_projection_std, em);
|
||||
memcpy(r_refdef.m_projection_view, r_refdef.m_projection_std, sizeof(r_refdef.m_projection_view));
|
||||
Matrix4x4_Identity(em);
|
||||
|
||||
Matrix4x4_CM_ModelViewMatrixFromAxis(vm, vpn, vright, vup, r_origin);
|
||||
|
@ -568,16 +576,19 @@ void R_SetupGL (float stereooffset, int i)
|
|||
// yfov = 2*atan((float)r_refdef.vrect.height/r_refdef.vrect.width)*(scr_fov.value*2)/M_PI;
|
||||
// MYgluPerspective (yfov, screenaspect, 4, 4096);
|
||||
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection, fov_x, fov_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection_std, fov_x, fov_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection_view, fovv_x, fovv_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
}
|
||||
else
|
||||
{
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, r_refdef.mindist);
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection_std, fov_x, fov_y, r_refdef.mindist);
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection_view, fovv_x, fovv_y, r_refdef.mindist);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, -fov_x/2, fov_x/2, -fov_y/2, fov_y/2, r_refdef.mindist, r_refdef.maxdist?r_refdef.maxdist:9999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, -fov_x/2, fov_x/2, -fov_y/2, fov_y/2, r_refdef.mindist, r_refdef.maxdist?r_refdef.maxdist:9999);
|
||||
memcpy(r_refdef.m_projection_view, r_refdef.m_projection_std, sizeof(r_refdef.m_projection_view));
|
||||
}
|
||||
|
||||
Matrix4x4_CM_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_origin);
|
||||
|
@ -587,7 +598,7 @@ void R_SetupGL (float stereooffset, int i)
|
|||
if (qglLoadMatrixf)
|
||||
{
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglLoadMatrixf(r_refdef.m_projection);
|
||||
qglLoadMatrixf(r_refdef.m_projection_std);
|
||||
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
qglLoadMatrixf(r_refdef.m_view);
|
||||
|
@ -739,7 +750,7 @@ void R_RenderScene (void)
|
|||
|
||||
TRACE(("dbg: calling R_SetFrustrum\n"));
|
||||
if (!r_refdef.recurse)
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
|
||||
RQ_BeginFrame();
|
||||
|
||||
|
@ -1203,7 +1214,7 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist, batch_t *depthmasklist[2],
|
|||
qglEnable(GL_CLIP_PLANE0);
|
||||
}
|
||||
*/ //fixme: we can probably scissor a smaller frusum
|
||||
R_SetFrustum (r_refdef.m_projection, vmat);
|
||||
R_SetFrustum (r_refdef.m_projection_std, vmat);
|
||||
if (r_refdef.frustum_numplanes < MAXFRUSTUMPLANES)
|
||||
{
|
||||
extern int SignbitsForPlane (mplane_t *out);
|
||||
|
@ -1237,7 +1248,7 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist, batch_t *depthmasklist[2],
|
|||
if (qglLoadMatrixf)
|
||||
{
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglLoadMatrixf(r_refdef.m_projection);
|
||||
qglLoadMatrixf(r_refdef.m_projection_std);
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
//portals to mask are relative to the old view still.
|
||||
|
@ -1278,7 +1289,7 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist, batch_t *depthmasklist[2],
|
|||
r_refdef.flipcull |= SHADER_CULL_FLIP;
|
||||
else
|
||||
r_refdef.flipcull &= ~SHADER_CULL_FLIP;
|
||||
if (r_refdef.m_projection[5]<0)
|
||||
if (r_refdef.m_projection_std[5]<0)
|
||||
r_refdef.flipcull ^= SHADER_CULL_FLIP;
|
||||
|
||||
Surf_SetupFrame();
|
||||
|
@ -1310,7 +1321,7 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist, batch_t *depthmasklist[2],
|
|||
{
|
||||
/*put GL back the way it was*/
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglLoadMatrixf(r_refdef.m_projection);
|
||||
qglLoadMatrixf(r_refdef.m_projection_std);
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
GLBE_SelectEntity(&r_worldentity);
|
||||
|
|
|
@ -1430,16 +1430,16 @@ static struct shadowmesh_s *SHM_BuildShadowMesh(dlight_t *dl, unsigned char *lvi
|
|||
if (!lvis)
|
||||
{
|
||||
int clus;
|
||||
// if ((type == SMT_SHADOWLESS || dl->lightcolourscales[0]) && cl.worldmodel->funcs.ClustersInSphere)
|
||||
if ((type == SMT_SHADOWLESS || dl->lightcolourscales[0]) && cl.worldmodel->funcs.ClustersInSphere)
|
||||
//shadowless lights don't cast shadows, so they're seen through everything - their vis must reflect that.
|
||||
// lvis = cl.worldmodel->funcs.ClustersInSphere(cl.worldmodel, dl->origin, dl->radius, &lvisb, NULL);
|
||||
// else
|
||||
lvis = cl.worldmodel->funcs.ClustersInSphere(cl.worldmodel, dl->origin, dl->radius, &lvisb, NULL);
|
||||
else
|
||||
{
|
||||
clus = cl.worldmodel->funcs.ClusterForPoint(cl.worldmodel, dl->origin);
|
||||
lvis = cl.worldmodel->funcs.ClusterPVS(cl.worldmodel, clus, &lvisb, PVM_FAST);
|
||||
|
||||
// if (cl.worldmodel->funcs.ClustersInSphere)
|
||||
// lvis = cl.worldmodel->funcs.ClustersInSphere(cl.worldmodel, dl->origin, dl->radius, &lvisb2, lvis);
|
||||
if (cl.worldmodel->funcs.ClustersInSphere)
|
||||
lvis = cl.worldmodel->funcs.ClustersInSphere(cl.worldmodel, dl->origin, dl->radius, &lvisb2, lvis);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1814,7 +1814,7 @@ static qboolean Sh_ScissorForBox(vec3_t mins, vec3_t maxs, srect_t *r)
|
|||
{
|
||||
vert[i][3] = 1;
|
||||
Matrix4x4_CM_Transform4(r_refdef.m_view, vert[i], tv);
|
||||
Matrix4x4_CM_Transform4(r_refdef.m_projection, tv, v);
|
||||
Matrix4x4_CM_Transform4(r_refdef.m_projection_std, tv, v);
|
||||
|
||||
x = v[0] / v[3];
|
||||
y = v[1] / v[3];
|
||||
|
@ -2401,12 +2401,12 @@ qboolean Sh_GenShadowMap (dlight_t *l, vec3_t axis[3], qbyte *lvis, int smsize)
|
|||
if (!sidevisible)
|
||||
return false;
|
||||
|
||||
memcpy(oproj, r_refdef.m_projection, sizeof(oproj));
|
||||
memcpy(oproj, r_refdef.m_projection_std, sizeof(oproj));
|
||||
memcpy(oview, r_refdef.m_view, sizeof(oview));
|
||||
oprect = r_refdef.pxrect;
|
||||
smesh = SHM_BuildShadowMesh(l, lvis, SMT_SHADOWMAP);
|
||||
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection, l->fov?l->fov:90, l->fov?l->fov:90, r_shadow_shadowmapping_nearclip.value, l->radius);
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection_std, l->fov?l->fov:90, l->fov?l->fov:90, r_shadow_shadowmapping_nearclip.value, l->radius);
|
||||
|
||||
switch(qrenderer)
|
||||
{
|
||||
|
@ -2474,7 +2474,7 @@ qboolean Sh_GenShadowMap (dlight_t *l, vec3_t axis[3], qbyte *lvis, int smsize)
|
|||
if (!gl_config.nofixedfunc)
|
||||
{
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglLoadMatrixf(r_refdef.m_projection);
|
||||
qglLoadMatrixf(r_refdef.m_projection_std);
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
break;
|
||||
|
@ -2504,18 +2504,18 @@ qboolean Sh_GenShadowMap (dlight_t *l, vec3_t axis[3], qbyte *lvis, int smsize)
|
|||
if (sidevisible & (1u<<f))
|
||||
{
|
||||
RQuantAdd(RQUANT_SHADOWSIDES, 1);
|
||||
Sh_GenShadowFace(l, axis, smesh, f, smsize, r_refdef.m_projection);
|
||||
Sh_GenShadowFace(l, axis, smesh, f, smsize, r_refdef.m_projection_std);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(r_refdef.m_view, oview, sizeof(r_refdef.m_view));
|
||||
memcpy(r_refdef.m_projection, oproj, sizeof(r_refdef.m_projection));
|
||||
memcpy(r_refdef.m_projection_std, oproj, sizeof(r_refdef.m_projection_std));
|
||||
|
||||
r_refdef.pxrect = oprect;
|
||||
|
||||
r_refdef.flipcull = oldflip;
|
||||
r_refdef.externalview = oldexternalview;
|
||||
R_SetFrustum(r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum(r_refdef.m_projection_std, r_refdef.m_view);
|
||||
|
||||
switch(qrenderer)
|
||||
{
|
||||
|
@ -2528,7 +2528,7 @@ qboolean Sh_GenShadowMap (dlight_t *l, vec3_t axis[3], qbyte *lvis, int smsize)
|
|||
if (!gl_config.nofixedfunc)
|
||||
{
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglLoadMatrixf(r_refdef.m_projection);
|
||||
qglLoadMatrixf(r_refdef.m_projection_std);
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
qglLoadMatrixf(r_refdef.m_view);
|
||||
}
|
||||
|
@ -2675,8 +2675,8 @@ static void Sh_DrawShadowMapLight(dlight_t *l, vec3_t colour, vec3_t axis[3], qb
|
|||
clus = cl.worldmodel->funcs.ClusterForPoint(cl.worldmodel, l->origin);
|
||||
lvis = cl.worldmodel->funcs.ClusterPVS(cl.worldmodel, clus, &lvisb, PVM_FAST);
|
||||
//FIXME: surely we can use the phs for this?
|
||||
// if (cl.worldmodel->funcs.ClustersInSphere)
|
||||
// lvis = cl.worldmodel->funcs.ClustersInSphere(cl.worldmodel, l->origin, l->radius, &lvisb2, lvis);
|
||||
if (cl.worldmodel->funcs.ClustersInSphere)
|
||||
lvis = cl.worldmodel->funcs.ClustersInSphere(cl.worldmodel, l->origin, l->radius, &lvisb2, lvis);
|
||||
|
||||
if (!Sh_VisOverlaps(lvis, vvis)) //The two viewing areas do not intersect.
|
||||
{
|
||||
|
@ -3544,8 +3544,16 @@ void Sh_PreGenerateLights(void)
|
|||
else
|
||||
shadowtype = SMT_STENCILVOLUME;
|
||||
|
||||
leaf = cl.worldmodel->funcs.ClusterForPoint(cl.worldmodel, dl->origin);
|
||||
lvis = cl.worldmodel->funcs.ClusterPVS(cl.worldmodel, leaf, &lvisb, PVM_FAST);
|
||||
//shadowless and lights with an ambient term pass through walls, so need to affect EVERY leaf withing the sphere.
|
||||
if (shadowtype == SMT_SHADOWLESS || dl->lightcolourscales[0])
|
||||
lvis = cl.worldmodel->funcs.ClustersInSphere(cl.worldmodel, dl->origin, dl->radius, &lvisb2, NULL);
|
||||
else
|
||||
{ //other lights only want to use the source leaf's pvs (clamped by the sphere)
|
||||
leaf = cl.worldmodel->funcs.ClusterForPoint(cl.worldmodel, dl->origin);
|
||||
lvis = cl.worldmodel->funcs.ClusterPVS(cl.worldmodel, leaf, &lvisb, PVM_FAST);
|
||||
if (cl.worldmodel->funcs.ClustersInSphere)
|
||||
lvis = cl.worldmodel->funcs.ClustersInSphere(cl.worldmodel, dl->origin, dl->radius, &lvisb2, lvis);
|
||||
}
|
||||
|
||||
SHM_BuildShadowMesh(dl, lvis, shadowtype);
|
||||
continue;
|
||||
|
|
|
@ -8089,7 +8089,7 @@ void SVNQ_ReadClientMove (usercmd_t *move)
|
|||
move->fservertime = cltime;
|
||||
move->servertime = move->fservertime*1000;
|
||||
|
||||
frame->ping_time = sv.time - cltime;
|
||||
frame->ping_time = sv.time - cltime;
|
||||
|
||||
|
||||
if (frame->ping_time*1000 > sv_minping.value+1)
|
||||
|
@ -8331,7 +8331,9 @@ void SVNQ_ExecuteClientMessage (client_t *cl)
|
|||
if (cl->delta_sequence == -1 && cl->pendingdeltabits)
|
||||
cl->pendingdeltabits[0] = UF_REMOVE;
|
||||
SV_AckEntityFrame(cl, cl->delta_sequence);
|
||||
cl->frameunion.frames[cl->delta_sequence&UPDATE_MASK].ping_time = realtime - cl->frameunion.frames[cl->delta_sequence&UPDATE_MASK].senttime;
|
||||
// if (cl->frameunion.frames[cl->delta_sequence&UPDATE_MASK].sequence == cl->delta_sequence)
|
||||
// if (cl->frameunion.frames[cl->delta_sequence&UPDATE_MASK].ping_time < 0)
|
||||
// cl->frameunion.frames[cl->delta_sequence&UPDATE_MASK].ping_time = realtime - cl->frameunion.frames[cl->delta_sequence&UPDATE_MASK].senttime;
|
||||
break;
|
||||
case clcdp_ackdownloaddata:
|
||||
SV_DarkPlacesDownloadAck(cl);
|
||||
|
|
|
@ -590,7 +590,7 @@ void SWBE_Set2D(void)
|
|||
w = fabs(cos(rad)) * (vid.width) + fabs(sin(rad)) * (vid.height);
|
||||
h = fabs(sin(rad)) * (vid.width) + fabs(cos(rad)) * (vid.height);
|
||||
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, w/-2.0f, w/2.0f, h/2.0f, h/-2.0f, -99999, 99999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, w/-2.0f, w/2.0f, h/2.0f, h/-2.0f, -99999, 99999);
|
||||
|
||||
Matrix4x4_Identity(tmp);
|
||||
Matrix4_Multiply(Matrix4x4_CM_NewTranslation((vid.width/-2.0f), (vid.height/-2.0f), 0), tmp, tmp2);
|
||||
|
@ -599,13 +599,13 @@ void SWBE_Set2D(void)
|
|||
else
|
||||
{
|
||||
if (0)
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0, vid.width, 0, vid.height, 0, 99999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, 0, vid.width, 0, vid.height, 0, 99999);
|
||||
else
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0, vid.width, vid.height, 0, 0, 99999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, 0, vid.width, vid.height, 0, 0, 99999);
|
||||
Matrix4x4_Identity(r_refdef.m_view);
|
||||
}
|
||||
|
||||
memcpy(shaderstate.m_mvp, r_refdef.m_projection, sizeof(shaderstate.m_mvp));
|
||||
memcpy(shaderstate.m_mvp, r_refdef.m_projection_std, sizeof(shaderstate.m_mvp));
|
||||
|
||||
shaderstate.viewplane[0] = -r_refdef.m_view[0*4+2];
|
||||
shaderstate.viewplane[1] = -r_refdef.m_view[1*4+2];
|
||||
|
@ -830,7 +830,7 @@ void SWBE_SelectEntity(struct entity_s *ent)
|
|||
shaderstate.curentity = ent;
|
||||
|
||||
SWR_RotateForEntity(modelmatrix, modelviewmatrix, shaderstate.curentity, shaderstate.curentity->model);
|
||||
Matrix4_Multiply(r_refdef.m_projection, modelviewmatrix, shaderstate.m_mvp);
|
||||
Matrix4_Multiply(r_refdef.m_projection_std, modelviewmatrix, shaderstate.m_mvp);
|
||||
shaderstate.viewplane[0] = vpn[0];//-modelviewmatrix[0];//0*4+2];
|
||||
shaderstate.viewplane[1] = vpn[1];//-modelviewmatrix[1];//1*4+2];
|
||||
shaderstate.viewplane[2] = vpn[2];//-modelviewmatrix[2];//2*4+2];
|
||||
|
|
|
@ -930,16 +930,16 @@ void SW_R_RenderView(void)
|
|||
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
|
||||
VectorCopy (r_refdef.vieworg, r_origin);
|
||||
if (r_refdef.useperspective)
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection, r_refdef.fov_x, r_refdef.fov_y, r_refdef.mindist);
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection_std, r_refdef.fov_x, r_refdef.fov_y, r_refdef.mindist);
|
||||
else
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, -r_refdef.fov_x/2, r_refdef.fov_x/2, -r_refdef.fov_y/2, r_refdef.fov_y/2, r_refdef.mindist, r_refdef.maxdist>=1?r_refdef.maxdist:9999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, -r_refdef.fov_x/2, r_refdef.fov_x/2, -r_refdef.fov_y/2, r_refdef.fov_y/2, r_refdef.mindist, r_refdef.maxdist>=1?r_refdef.maxdist:9999);
|
||||
VectorCopy(r_refdef.viewangles, newa);
|
||||
newa[0] = r_refdef.viewangles[0];
|
||||
newa[1] = r_refdef.viewangles[1];
|
||||
newa[2] = r_refdef.viewangles[2] + gl_screenangle.value;
|
||||
Matrix4x4_CM_ModelViewMatrix(r_refdef.m_view, newa, r_refdef.vieworg);
|
||||
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
|
||||
RQ_BeginFrame();
|
||||
|
||||
|
|
|
@ -4223,6 +4223,7 @@ static void BE_RotateForEntity (const entity_t *e, const model_t *mod)
|
|||
float ndr;
|
||||
float modelmatrix[16];
|
||||
float *m = modelmatrix;
|
||||
float *proj;
|
||||
vkcbuf_entity_t *cbe = VKBE_AllocateBufferSpace(DB_UBO, (sizeof(*cbe) + 0x0ff) & ~0xff, &shaderstate.ubo_entity.buffer, &shaderstate.ubo_entity.offset);
|
||||
shaderstate.ubo_entity.range = sizeof(*cbe);
|
||||
|
||||
|
@ -4234,6 +4235,8 @@ static void BE_RotateForEntity (const entity_t *e, const model_t *mod)
|
|||
float em[16];
|
||||
float vm[16];
|
||||
|
||||
proj = r_refdef.m_projection_view;
|
||||
|
||||
if (e->flags & RF_WEAPONMODELNOBOB)
|
||||
{
|
||||
vm[0] = vpn[0];
|
||||
|
@ -4303,6 +4306,8 @@ static void BE_RotateForEntity (const entity_t *e, const model_t *mod)
|
|||
}
|
||||
else
|
||||
{
|
||||
proj = r_refdef.m_projection_std;
|
||||
|
||||
m[0] = e->axis[0][0];
|
||||
m[1] = e->axis[0][1];
|
||||
m[2] = e->axis[0][2];
|
||||
|
@ -4387,7 +4392,7 @@ static void BE_RotateForEntity (const entity_t *e, const model_t *mod)
|
|||
{
|
||||
float modelview[16];
|
||||
Matrix4_Multiply(r_refdef.m_view, m, modelview);
|
||||
Matrix4_Multiply(r_refdef.m_projection, modelview, cbe->m_modelviewproj);
|
||||
Matrix4_Multiply(proj, modelview, cbe->m_modelviewproj);
|
||||
}
|
||||
memcpy(cbe->m_model, m, sizeof(cbe->m_model));
|
||||
Matrix4_Invert(modelmatrix, cbe->m_modelinv);
|
||||
|
@ -5548,7 +5553,7 @@ static void R_DrawPortal(batch_t *batch, batch_t **blist, batch_t *depthmasklist
|
|||
qglEnable(GL_CLIP_PLANE0);
|
||||
}
|
||||
*/ //fixme: we can probably scissor a smaller frusum
|
||||
R_SetFrustum (r_refdef.m_projection, vmat);
|
||||
R_SetFrustum (r_refdef.m_projection_std, vmat);
|
||||
if (r_refdef.frustum_numplanes < MAXFRUSTUMPLANES)
|
||||
{
|
||||
extern int SignbitsForPlane (mplane_t *out);
|
||||
|
@ -5621,7 +5626,7 @@ static void R_DrawPortal(batch_t *batch, batch_t **blist, batch_t *depthmasklist
|
|||
r_refdef.flipcull |= SHADER_CULL_FLIP;
|
||||
else
|
||||
r_refdef.flipcull &= ~SHADER_CULL_FLIP;
|
||||
if (r_refdef.m_projection[5]<0)
|
||||
if (r_refdef.m_projection_std[5]<0)
|
||||
r_refdef.flipcull ^= SHADER_CULL_FLIP;
|
||||
|
||||
VKBE_SelectEntity(&r_worldentity);
|
||||
|
|
|
@ -1557,9 +1557,9 @@ void VK_SetupViewPortProjection(qboolean flipy)
|
|||
r_refdef.flipcull = 0;
|
||||
}
|
||||
if (r_refdef.maxdist)
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection, fov_x, fov_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection_std, fov_x, fov_y, r_refdef.mindist, r_refdef.maxdist);
|
||||
else
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, r_refdef.mindist);
|
||||
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection_std, fov_x, fov_y, r_refdef.mindist);
|
||||
}
|
||||
|
||||
void VK_Set2D(void)
|
||||
|
@ -1628,9 +1628,9 @@ void VK_Set2D(void)
|
|||
VKBE_Set2D(true);
|
||||
|
||||
if (0)
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0, vid.fbvwidth, 0, vid.fbvheight, -99999, 99999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, 0, vid.fbvwidth, 0, vid.fbvheight, -99999, 99999);
|
||||
else
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0, vid.fbvwidth, vid.fbvheight, 0, -99999, 99999);
|
||||
Matrix4x4_CM_Orthographic(r_refdef.m_projection_std, 0, vid.fbvwidth, vid.fbvheight, 0, -99999, 99999);
|
||||
Matrix4x4_Identity(r_refdef.m_view);
|
||||
|
||||
BE_SelectEntity(&r_worldentity);
|
||||
|
@ -1984,7 +1984,7 @@ static qboolean VK_R_RenderScene_Cubemap(struct vk_rendertarg *fb)
|
|||
|
||||
VKBE_SelectEntity(&r_worldentity);
|
||||
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
RQ_BeginFrame();
|
||||
if (!(r_refdef.flags & RDF_NOWORLDMODEL))
|
||||
{
|
||||
|
@ -2206,7 +2206,7 @@ void VK_R_RenderView (void)
|
|||
|
||||
VKBE_SelectEntity(&r_worldentity);
|
||||
|
||||
R_SetFrustum (r_refdef.m_projection, r_refdef.m_view);
|
||||
R_SetFrustum (r_refdef.m_projection_std, r_refdef.m_view);
|
||||
RQ_BeginFrame();
|
||||
if (!(r_refdef.flags & RDF_NOWORLDMODEL))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue