aboutsummaryrefslogtreecommitdiffstats
path: root/code/renderer
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-05-01 14:56:57 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-05-01 14:56:57 +0000
commitb863dd098c133889a2c66b60218306e2b3b81fb4 (patch)
tree353a5737cc8fd3d3b22e8fc54217ad960e404186 /code/renderer
parente02f31a31c7cf4bccb2bbaaf5cbc0565be173552 (diff)
downloadioquake3-aero-b863dd098c133889a2c66b60218306e2b3b81fb4.tar.gz
ioquake3-aero-b863dd098c133889a2c66b60218306e2b3b81fb4.zip
- 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 git-svn-id: svn://svn.icculus.org/quake3/trunk@1335 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/renderer')
-rw-r--r--code/renderer/tr_backend.c46
-rw-r--r--code/renderer/tr_cmds.c4
-rw-r--r--code/renderer/tr_main.c21
-rw-r--r--code/renderer/tr_types.h40
4 files changed, 70 insertions, 41 deletions
diff --git a/code/renderer/tr_backend.c b/code/renderer/tr_backend.c
index 904c7d4..15e32c5 100644
--- a/code/renderer/tr_backend.c
+++ b/code/renderer/tr_backend.c
@@ -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);
-
- qglMatrixMode(GL_PROJECTION);
- qglLoadMatrixf(temp.projectionMatrix);
- qglMatrixMode(GL_MODELVIEW);
+ 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;
+
+ 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;
diff --git a/code/renderer/tr_cmds.c b/code/renderer/tr_cmds.c
index 06a18e8..d506986 100644
--- a/code/renderer/tr_cmds.c
+++ b/code/renderer/tr_cmds.c
@@ -319,9 +319,9 @@ void R_SetColorMode(GLboolean *rgba, stereoFrame_t stereoFrame, int colormode)
rgba[0] = GL_FALSE;
if(colormode == MODE_RED_BLUE)
- rgba[1] = 0;
+ rgba[1] = GL_FALSE;
else if(colormode == MODE_RED_GREEN)
- rgba[2] = 0;
+ rgba[2] = GL_FALSE;
}
}
diff --git a/code/renderer/tr_main.c b/code/renderer/tr_main.c
index c5996ba..feda105 100644
--- a/code/renderer/tr_main.c
+++ b/code/renderer/tr_main.c
@@ -456,7 +456,7 @@ void R_SetupFrustum (viewParms_t *dest, float xmin, float xmax, float ymax, floa
float oppleg, adjleg, length;
int i;
- if(stereoSep == 0)
+ if(stereoSep == 0 && xmin != -xmax)
{
// symmetric case can be simplified
VectorCopy(dest->or.origin, ofsorigin);
@@ -513,19 +513,22 @@ R_SetupProjection
void R_SetupProjection(viewParms_t *dest, float zProj, qboolean computeFrustum)
{
float xmin, xmax, ymin, ymax;
- float width, height, stereoSep;
+ float width, height, stereoSep = r_stereoSeparation->value;
/*
* offset the view origin of the viewer for stereo rendering
* by setting the projection matrix appropriately.
*/
-
- if(dest->stereoFrame == STEREO_LEFT)
- stereoSep = zProj / r_stereoSeparation->value;
- else if(dest->stereoFrame == STEREO_RIGHT)
- stereoSep = zProj / -r_stereoSeparation->value;
- else
- stereoSep = 0;
+
+ if(stereoSep != 0)
+ {
+ if(dest->stereoFrame == STEREO_LEFT)
+ stereoSep = zProj / r_stereoSeparation->value;
+ else if(dest->stereoFrame == STEREO_RIGHT)
+ stereoSep = zProj / -r_stereoSeparation->value;
+ else
+ stereoSep = 0;
+ }
ymax = zProj * tan(dest->fovY * M_PI / 360.0f);
ymin = -ymax;
diff --git a/code/renderer/tr_types.h b/code/renderer/tr_types.h
index bb917cf..2a10342 100644
--- a/code/renderer/tr_types.h
+++ b/code/renderer/tr_types.h
@@ -24,27 +24,33 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define __TR_TYPES_H
-#define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces
-#define MAX_ENTITIES 1023 // can't be increased without changing drawsurf bit packing
+#define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces
+#define MAX_ENTITIES 1023 // can't be increased without changing drawsurf bit packing
// renderfx flags
-#define RF_MINLIGHT 1 // allways have some light (viewmodel, some items)
-#define RF_THIRD_PERSON 2 // don't draw through eyes, only mirrors (player bodies, chat sprites)
-#define RF_FIRST_PERSON 4 // only draw through eyes (view weapon, damage blood blob)
-#define RF_DEPTHHACK 8 // for view weapon Z crunching
-#define RF_NOSHADOW 64 // don't add stencil shadows
-
-#define RF_LIGHTING_ORIGIN 128 // use refEntity->lightingOrigin instead of refEntity->origin
- // for lighting. This allows entities to sink into the floor
- // with their origin going solid, and allows all parts of a
- // player to get the same lighting
-#define RF_SHADOW_PLANE 256 // use refEntity->shadowPlane
-#define RF_WRAP_FRAMES 512 // mod the model frames by the maxframes to allow continuous
- // animation without needing to know the frame count
+#define RF_MINLIGHT 0x0001 // allways have some light (viewmodel, some items)
+#define RF_THIRD_PERSON 0x0002 // don't draw through eyes, only mirrors (player bodies, chat sprites)
+#define RF_FIRST_PERSON 0x0004 // only draw through eyes (view weapon, damage blood blob)
+#define RF_DEPTHHACK 0x0008 // for view weapon Z crunching
+
+#define RF_CROSSHAIR 0x0010 // This item is a cross hair and will draw over everything similar to
+ // DEPTHHACK in stereo rendering mode, with the difference that the
+ // projection matrix won't be hacked to reduce the stereo separation as
+ // is done for the gun.
+
+#define RF_NOSHADOW 0x0040 // don't add stencil shadows
+
+#define RF_LIGHTING_ORIGIN 0x0080 // use refEntity->lightingOrigin instead of refEntity->origin
+ // for lighting. This allows entities to sink into the floor
+ // with their origin going solid, and allows all parts of a
+ // player to get the same lighting
+
+#define RF_SHADOW_PLANE 0x0100 // use refEntity->shadowPlane
+#define RF_WRAP_FRAMES 0x0200 // mod the model frames by the maxframes to allow continuous
// refdef flags
-#define RDF_NOWORLDMODEL 1 // used for player configuration screen
-#define RDF_HYPERSPACE 4 // teleportation effect
+#define RDF_NOWORLDMODEL 0x0001 // used for player configuration screen
+#define RDF_HYPERSPACE 0x0004 // teleportation effect
typedef struct {
vec3_t xyz;