Skip to content

Commit

Permalink
Remove stereo support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kangz committed Nov 12, 2014
1 parent 6544a6b commit cda263d
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 137 deletions.
2 changes: 1 addition & 1 deletion src/engine/client/cg_api.h
Expand Up @@ -377,7 +377,7 @@ typedef enum
// command is not known to the game

CG_DRAW_ACTIVE_FRAME,
// void (*CG_DrawActiveFrame)( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback );
// void (*CG_DrawActiveFrame)( int serverTime, qboolean demoPlayback );
// Generates and draws a game scene and status information at the given time.
// If demoPlayback is set, local movement prediction will not be enabled

Expand Down
4 changes: 2 additions & 2 deletions src/engine/client/cl_cgame.cpp
Expand Up @@ -2751,7 +2751,7 @@ qboolean CL_GameConsoleText( void )
CL_CGameRendering
=====================
*/
void CL_CGameRendering( stereoFrame_t stereo )
void CL_CGameRendering( void )
{
/* static int x = 0;
if(!((++x) % 20)) {
Expand All @@ -2760,7 +2760,7 @@ void CL_CGameRendering( stereoFrame_t stereo )
} else {
}*/

VM_Call( cgvm, CG_DRAW_ACTIVE_FRAME, cl.serverTime, stereo, clc.demoplaying );
VM_Call( cgvm, CG_DRAW_ACTIVE_FRAME, cl.serverTime, clc.demoplaying );
VM_Debug( 0 );
}

Expand Down
2 changes: 1 addition & 1 deletion src/engine/client/cl_console.cpp
Expand Up @@ -1267,7 +1267,7 @@ void Con_RunAnimatedConsole( void )
/*
==================
Con_DrawConsole
runs each render-frame (possibly twice with stereo enabled)
runs each render-frame
==================
*/
void Con_DrawConsole( void )
Expand Down
31 changes: 8 additions & 23 deletions src/engine/client/cl_scrn.cpp
Expand Up @@ -670,13 +670,11 @@ void SCR_Init( void )
/*
==================
SCR_DrawScreenField
This will be called twice if rendering in stereo mode
==================
*/
void SCR_DrawScreenField( stereoFrame_t stereoFrame )
void SCR_DrawScreenField( void )
{
re.BeginFrame( stereoFrame );
re.BeginFrame();

// wide aspect ratio screens need to have the sides cleared
// unless they are displaying game renderings
Expand Down Expand Up @@ -715,15 +713,15 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame )
case CA_LOADING:
case CA_PRIMED:
// draw the game information screen and loading progress
CL_CGameRendering( stereoFrame );
CL_CGameRendering();

// also draw the connection information, so it doesn't
// flash away too briefly on local or LAN games
//if (!com_sv_running->value || Cvar_VariableIntegerValue("sv_cheats")) // Ridah, don't draw useless text if not in dev mode
break;

case CA_ACTIVE:
CL_CGameRendering( stereoFrame );
CL_CGameRendering();
SCR_DrawDemoRecording();
#ifdef USE_VOIP
SCR_DrawVoipMeter();
Expand Down Expand Up @@ -773,25 +771,12 @@ void SCR_UpdateScreen( void )
// that case.
if ( cgvm || com_dedicated->integer )
{
// XXX
// extern cvar_t* r_anaglyphMode;
// if running in stereo, we need to draw the frame twice
if ( cls.glconfig.stereoEnabled )
{
SCR_DrawScreenField( STEREO_LEFT );
SCR_DrawConsoleAndPointer();
SCR_DrawScreenField( STEREO_RIGHT );
SCR_DrawConsoleAndPointer();
}
else
{
SCR_DrawScreenField( STEREO_CENTER );
SCR_DrawScreenField();

VM_Call( cgvm, CG_ROCKET_FRAME );
VM_Call( cgvm, CG_ROCKET_FRAME );

Rocket_Render();
SCR_DrawConsoleAndPointer();
}
Rocket_Render();
SCR_DrawConsoleAndPointer();

if ( com_speeds->integer )
{
Expand Down
2 changes: 1 addition & 1 deletion src/engine/client/client.h
Expand Up @@ -849,7 +849,7 @@ void CL_InitCGameCVars( void );
void CL_ShutdownCGame( void );
void CL_GameCommandHandler( void );
qboolean CL_GameConsoleText( void );
void CL_CGameRendering( stereoFrame_t stereo );
void CL_CGameRendering( void );
void CL_SetCGameTime( void );
void CL_FirstSnapshot( void );
void CL_ShaderStateChanged( void );
Expand Down
2 changes: 1 addition & 1 deletion src/engine/null/null_renderer.cpp
Expand Up @@ -129,7 +129,7 @@ void RE_StretchPicGradient( float x, float y, float w, float h, float s1, float
void RE_2DPolyies( polyVert_t *polys, int numverts, qhandle_t hShader ) { }
void RE_StretchRaw( int x, int y, int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty ) { }
void RE_UploadCinematic( int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty ) { }
void RE_BeginFrame( stereoFrame_t stereoFrame ) { }
void RE_BeginFrame( void ) { }
void RE_EndFrame( int *frontEndMsec, int *backEndMsec ) { }
int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projection, int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t *fragmentBuffer )
{
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_bsp.cpp
Expand Up @@ -6737,7 +6737,7 @@ void R_BuildCubeMaps( void )
tr.refdef.pixelTargetWidth = REF_CUBEMAP_SIZE;
tr.refdef.pixelTargetHeight = REF_CUBEMAP_SIZE;

RE_BeginFrame( STEREO_CENTER );
RE_BeginFrame();
RE_RenderScene( &rf );
RE_EndFrame( &ii, &jj );

Expand Down
34 changes: 4 additions & 30 deletions src/engine/renderer/tr_cmds.cpp
Expand Up @@ -721,12 +721,9 @@ void RE_StretchPicGradient( float x, float y, float w, float h,
/*
====================
RE_BeginFrame
If running in stereo, RE_BeginFrame will be called twice
for each RE_EndFrame
====================
*/
void RE_BeginFrame( stereoFrame_t stereoFrame )
void RE_BeginFrame( void )
{
drawBufferCommand_t *cmd;

Expand Down Expand Up @@ -846,36 +843,13 @@ void RE_BeginFrame( stereoFrame_t stereoFrame )

cmd->commandId = RC_DRAW_BUFFER;

if ( glConfig.stereoEnabled )
if ( !Q_stricmp( r_drawBuffer->string, "GL_FRONT" ) )
{
if ( stereoFrame == STEREO_LEFT )
{
cmd->buffer = ( int ) GL_BACK_LEFT;
}
else if ( stereoFrame == STEREO_RIGHT )
{
cmd->buffer = ( int ) GL_BACK_RIGHT;
}
else
{
ri.Error( ERR_FATAL, "RE_BeginFrame: Stereo is enabled, but stereoFrame was %i", stereoFrame );
}
cmd->buffer = ( int ) GL_FRONT;
}
else
{
if ( stereoFrame != STEREO_CENTER )
{
ri.Error( ERR_FATAL, "RE_BeginFrame: Stereo is disabled, but stereoFrame was %i", stereoFrame );
}

if ( !Q_stricmp( r_drawBuffer->string, "GL_FRONT" ) )
{
cmd->buffer = ( int ) GL_FRONT;
}
else
{
cmd->buffer = ( int ) GL_BACK;
}
cmd->buffer = ( int ) GL_BACK;
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/engine/renderer/tr_init.cpp
Expand Up @@ -118,7 +118,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
cvar_t *r_colorbits;
cvar_t *r_alphabits;
cvar_t *r_ext_multisample;
cvar_t *r_stereo;

cvar_t *r_drawBuffer;
cvar_t *r_shadows;
Expand Down Expand Up @@ -1108,7 +1107,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
r_colorMipLevels = ri.Cvar_Get( "r_colorMipLevels", "0", CVAR_LATCH );
r_colorbits = ri.Cvar_Get( "r_colorbits", "0", CVAR_LATCH );
r_alphabits = ri.Cvar_Get( "r_alphabits", "0", CVAR_LATCH );
r_stereo = ri.Cvar_Get( "r_stereo", "0", CVAR_LATCH );
r_stencilbits = ri.Cvar_Get( "r_stencilbits", "8", CVAR_LATCH );
r_depthbits = ri.Cvar_Get( "r_depthbits", "0", CVAR_LATCH );
r_ext_multisample = ri.Cvar_Get( "r_ext_multisample", "0", CVAR_LATCH | CVAR_ARCHIVE );
Expand Down
9 changes: 2 additions & 7 deletions src/engine/renderer/tr_local.h
Expand Up @@ -1417,8 +1417,6 @@ static inline float halfToFloat( int16_t in ) {
vec3_t viewaxis[ 3 ]; // transformation matrix
vec3_t blurVec;

stereoFrame_t stereoFrame;

int time; // time in milliseconds for shader effects and other time dependent rendering issues
int rdflags; // RDF_NOWORLDMODEL, etc

Expand Down Expand Up @@ -1575,8 +1573,6 @@ static inline float halfToFloat( int16_t in ) {

int numInteractions;
struct interaction_s *interactions;

stereoFrame_t stereoFrame;
} viewParms_t;

/*
Expand Down Expand Up @@ -2904,7 +2900,6 @@ static inline float halfToFloat( int16_t in ) {
extern cvar_t *r_depthbits; // number of desired depth bits
extern cvar_t *r_colorbits; // number of desired color bits, only relevant for fullscreen
extern cvar_t *r_alphabits; // number of desired depth bits
extern cvar_t *r_stereo; // desired pixelformat stereo flag

extern cvar_t *r_ext_multisample; // desired number of MSAA samples

Expand Down Expand Up @@ -3277,7 +3272,7 @@ static inline float halfToFloat( int16_t in ) {
void RE_StretchRaw( int x, int y, int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty );
void RE_UploadCinematic( int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty );

void RE_BeginFrame( stereoFrame_t stereoFrame );
void RE_BeginFrame( void );
qboolean RE_BeginRegistration( glconfig_t *glconfig, glconfig2_t *glconfig2 );
void RE_LoadWorldMap( const char *mapname );
void RE_SetWorldVisData( const byte *vis );
Expand Down Expand Up @@ -4071,7 +4066,7 @@ static inline float halfToFloat( int16_t in ) {
void RE_ScissorEnable( qboolean enable );
void RE_ScissorSet( int x, int y, int w, int h );

void RE_BeginFrame( stereoFrame_t stereoFrame );
void RE_BeginFrame( void );
void RE_EndFrame( int *frontEndMsec, int *backEndMsec );

void LoadTGA( const char *name, byte **pic, int *width, int *height, int *numLayers, int *numMips, int *bits, byte alphaByte );
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_public.h
Expand Up @@ -127,7 +127,7 @@ typedef struct
qboolean dirty );
void ( *UploadCinematic )( int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty );

void ( *BeginFrame )( stereoFrame_t stereoFrame );
void ( *BeginFrame )( void );

// if the pointers are not NULL, timing info will be returned
void ( *EndFrame )( int *frontEndMsec, int *backEndMsec );
Expand Down
2 changes: 0 additions & 2 deletions src/engine/renderer/tr_scene.cpp
Expand Up @@ -707,8 +707,6 @@ void RE_RenderScene( const refdef_t *fd )
parms.fovX = tr.refdef.fov_x;
parms.fovY = tr.refdef.fov_y;

parms.stereoFrame = tr.refdef.stereoFrame;

VectorCopy( fd->vieworg, parms.orientation.origin );
VectorCopy( fd->viewaxis[ 0 ], parms.orientation.axis[ 0 ] );
VectorCopy( fd->viewaxis[ 1 ], parms.orientation.axis[ 1 ] );
Expand Down
8 changes: 0 additions & 8 deletions src/engine/renderer/tr_types.h
Expand Up @@ -343,13 +343,6 @@ typedef struct
vec4_t gradingWeights;
} refdef_t;

typedef enum
{
STEREO_CENTER,
STEREO_LEFT,
STEREO_RIGHT
} stereoFrame_t;

// XreaL BEGIN

// cg_shadows modes
Expand Down Expand Up @@ -448,7 +441,6 @@ typedef struct
// synonymous with "does rendering consume the entire screen?", therefore
// a Win32 ICD that used CDS will have this set to TRUE
qboolean isFullscreen;
qboolean stereoEnabled;
qboolean smpActive; // dual processor
} glconfig_t;

Expand Down
39 changes: 1 addition & 38 deletions src/gamelogic/cgame/cg_draw.c
Expand Up @@ -717,59 +717,22 @@ CG_DrawActive
Perform all drawing needed to completely fill the screen
=====================
*/
void CG_DrawActive( stereoFrame_t stereoView )
void CG_DrawActive( void )
{
float separation;
vec3_t baseOrg;

// optionally draw the info screen instead
if ( !cg.snap )
{
return;
}

switch ( stereoView )
{
case STEREO_CENTER:
separation = 0;
break;

case STEREO_LEFT:
separation = -cg_stereoSeparation.value / 2;
break;

case STEREO_RIGHT:
separation = cg_stereoSeparation.value / 2;
break;

default:
separation = 0;
CG_Error( "CG_DrawActive: Undefined stereoView" );
}

// clear around the rendered view if sized down
CG_TileClear();

// offset vieworg appropriately if we're doing stereo separation
VectorCopy( cg.refdef.vieworg, baseOrg );

if ( separation != 0 )
{
VectorMA( cg.refdef.vieworg, -separation, cg.refdef.viewaxis[ 1 ],
cg.refdef.vieworg );
}

CG_DrawBinaryShadersFinalPhases();

// draw 3D view
trap_R_RenderScene( &cg.refdef );

// restore original viewpoint if running stereo
if ( separation != 0 )
{
VectorCopy( baseOrg, cg.refdef.vieworg );
}

// first person blend blobs, done after AnglesToAxis
if ( !cg.renderingThirdPerson )
{
Expand Down
5 changes: 2 additions & 3 deletions src/gamelogic/cgame/cg_local.h
Expand Up @@ -1820,7 +1820,6 @@ extern vmCvar_t cg_thirdPersonShoulderViewMode;
extern vmCvar_t cg_staticDeathCam;
extern vmCvar_t cg_thirdPersonPitchFollow;
extern vmCvar_t cg_thirdPersonRange;
extern vmCvar_t cg_stereoSeparation;
extern vmCvar_t cg_lagometer;
extern vmCvar_t cg_drawSpeed;
extern vmCvar_t cg_maxSpeedTimeWindow;
Expand Down Expand Up @@ -1965,7 +1964,7 @@ void CG_TestModelPrevSkin_f( void );
void CG_AddBufferedSound( sfxHandle_t sfx );
qboolean CG_CullBox(vec3_t mins, vec3_t maxs);
qboolean CG_CullPointAndRadius(const vec3_t pt, vec_t radius);
void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback );
void CG_DrawActiveFrame( int serverTime, qboolean demoPlayback );
void CG_OffsetFirstPersonView( void );
void CG_OffsetThirdPersonView( void );
void CG_OffsetShoulderView( void );
Expand Down Expand Up @@ -2016,7 +2015,7 @@ void CG_AddLagometerFrameInfo( void );
void CG_AddLagometerSnapshotInfo( snapshot_t *snap );
void CG_AddSpeed( void );
void CG_CenterPrint( const char *str, int y, int charWidth );
void CG_DrawActive( stereoFrame_t stereoView );
void CG_DrawActive( void );
void CG_OwnerDraw( rectDef_t *rect, float text_x,
float text_y, int ownerDraw, int ownerDrawFlags,
int align, int textalign, int textvalign,
Expand Down
4 changes: 1 addition & 3 deletions src/gamelogic/cgame/cg_main.c
Expand Up @@ -70,7 +70,7 @@ intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4,
return 0;

case CG_DRAW_ACTIVE_FRAME:
CG_DrawActiveFrame( arg0, (stereoFrame_t) arg1, arg2 );
CG_DrawActiveFrame( arg0, arg1 );
return 0;

case CG_CROSSHAIR_PLAYER:
Expand Down Expand Up @@ -183,7 +183,6 @@ vmCvar_t cg_thirdPersonShoulderViewMode;
vmCvar_t cg_staticDeathCam;
vmCvar_t cg_thirdPersonPitchFollow;
vmCvar_t cg_thirdPersonRange;
vmCvar_t cg_stereoSeparation;
vmCvar_t cg_lagometer;
vmCvar_t cg_drawSpeed;
vmCvar_t cg_maxSpeedTimeWindow;
Expand Down Expand Up @@ -309,7 +308,6 @@ static const cvarTable_t cvarTable[] =
{
{ &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE },
{ &cg_viewsize, "cg_viewsize", "100", 0 },
{ &cg_stereoSeparation, "cg_stereoSeparation", "0.4", 0 },
{ &cg_shadows, "cg_shadows", "1", CVAR_LATCH | CVAR_ARCHIVE },
{ &cg_playerShadows, "cg_playerShadows", "1", 0 },
{ &cg_buildableShadows, "cg_buildableShadows", "0", 0 },
Expand Down

0 comments on commit cda263d

Please sign in to comment.