- replace a few constant values with GL macros in tr_cmds.c

- tidy up top of tr_types.h a bit, change flags to hex representation
- make ROM cvar enforcing really work
- remove cg_stereoSeparation from cgame as it is obsolete.
- Add CG_DrawCrosshair3D so people see crosshair correctly when stereoseparation is enabled
This commit is contained in:
Thilo Schulz 2008-05-01 14:56:57 +00:00
parent 65938da5ae
commit 10ed996784
10 changed files with 173 additions and 89 deletions

View file

@ -521,7 +521,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
int fogNum, oldFogNum;
int entityNum, oldEntityNum;
int dlighted, oldDlighted;
qboolean depthRange, oldDepthRange;
qboolean depthRange, oldDepthRange, isCrosshair, wasCrosshair;
int i;
drawSurf_t *drawSurf;
int oldSort;
@ -539,6 +539,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
oldShader = NULL;
oldFogNum = -1;
oldDepthRange = qfalse;
wasCrosshair = qfalse;
oldDlighted = qfalse;
oldSort = -1;
depthRange = qfalse;
@ -573,7 +574,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
// change the modelview matrix if needed
//
if ( entityNum != oldEntityNum ) {
depthRange = qfalse;
depthRange = isCrosshair = qfalse;
if ( entityNum != ENTITYNUM_WORLD ) {
backEnd.currentEntity = &backEnd.refdef.entities[entityNum];
@ -590,9 +591,13 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
R_TransformDlights( backEnd.refdef.num_dlights, backEnd.refdef.dlights, &backEnd.or );
}
if ( backEnd.currentEntity->e.renderfx & RF_DEPTHHACK ) {
if(backEnd.currentEntity->e.renderfx & RF_DEPTHHACK)
{
// hack the depth range to prevent view model from poking into walls
depthRange = qtrue;
if(backEnd.currentEntity->e.renderfx & RF_CROSSHAIR)
isCrosshair = qtrue;
}
} else {
backEnd.currentEntity = &tr.worldEntity;
@ -610,26 +615,40 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
// change depthrange. Also change projection matrix so first person weapon does not look like coming
// out of the screen.
//
if (oldDepthRange != depthRange)
if (oldDepthRange != depthRange || wasCrosshair != isCrosshair)
{
if (depthRange)
{
if(backEnd.viewParms.stereoFrame != STEREO_CENTER)
{
viewParms_t temp = backEnd.viewParms;
R_SetupProjection(&temp, r_znear->value, qfalse);
if(isCrosshair)
{
if(oldDepthRange)
{
// was not a crosshair but now is, change back proj matrix
qglMatrixMode(GL_PROJECTION);
qglLoadMatrixf(backEnd.viewParms.projectionMatrix);
qglMatrixMode(GL_MODELVIEW);
}
}
else
{
viewParms_t temp = backEnd.viewParms;
qglMatrixMode(GL_PROJECTION);
qglLoadMatrixf(temp.projectionMatrix);
qglMatrixMode(GL_MODELVIEW);
R_SetupProjection(&temp, r_znear->value, qfalse);
qglMatrixMode(GL_PROJECTION);
qglLoadMatrixf(temp.projectionMatrix);
qglMatrixMode(GL_MODELVIEW);
}
}
qglDepthRange (0, 0.3);
if(!oldDepthRange)
qglDepthRange (0, 0.3);
}
else
{
if(backEnd.viewParms.stereoFrame != STEREO_CENTER)
if(!wasCrosshair && backEnd.viewParms.stereoFrame != STEREO_CENTER)
{
qglMatrixMode(GL_PROJECTION);
qglLoadMatrixf(backEnd.viewParms.projectionMatrix);
@ -640,6 +659,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
}
oldDepthRange = depthRange;
wasCrosshair = isCrosshair;
}
oldEntityNum = entityNum;