mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-10 14:52:00 +00:00
Changes for PCVR build
This commit is contained in:
parent
5010b6ff54
commit
e0b65748a0
13 changed files with 220 additions and 47 deletions
|
@ -27,7 +27,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../rd-common/tr_font.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
extern refimport_t *ri;
|
||||
extern refimport_t ri;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -28,6 +28,7 @@ if(BuildSPRdVanilla OR BuildJK2SPRdVanilla)
|
|||
${SharedDir}
|
||||
${SPRDVanillaRendererIncludeDirectories}
|
||||
"${SPDir}/rd-vanilla"
|
||||
"${JKXRDir}"
|
||||
"${GSLIncludeDirectory}"
|
||||
)
|
||||
|
||||
|
|
|
@ -697,6 +697,14 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
// Record The Extents Of The World Incase No Other Weather Zones Exist
|
||||
//---------------------------------------------------------------------
|
||||
if (!mWeatherZones.size())
|
||||
{
|
||||
Com_Printf("WARNING: No Weather Zones Encountered\n");
|
||||
AddWeatherZone(tr.world->bmodels[0].bounds[0], tr.world->bmodels[0].bounds[1]);
|
||||
}
|
||||
|
||||
// all this piece of code does really is fill in the bool "SWeatherZone::mMarkedOutside", plus the mPointCache[] for each zone,
|
||||
// so we can diskload those. Maybe.
|
||||
fileHandle_t f = ReadCachedWeatherFile();
|
||||
|
@ -720,15 +728,6 @@ public:
|
|||
uint32_t contents;
|
||||
uint32_t bit;
|
||||
|
||||
|
||||
// Record The Extents Of The World Incase No Other Weather Zones Exist
|
||||
//---------------------------------------------------------------------
|
||||
if (!mWeatherZones.size())
|
||||
{
|
||||
Com_Printf("WARNING: No Weather Zones Encountered\n");
|
||||
AddWeatherZone(tr.world->bmodels[0].bounds[0], tr.world->bmodels[0].bounds[1]);
|
||||
}
|
||||
|
||||
f = WriteCachedWeatherFile();
|
||||
|
||||
// Iterate Over All Weather Zones
|
||||
|
@ -1969,8 +1968,13 @@ void R_WorldEffectCommand(const char *command)
|
|||
COM_EndParseSession();
|
||||
return;
|
||||
}
|
||||
int count = 1000;
|
||||
const char* tempStr;
|
||||
COM_ParseString(&command, &tempStr);
|
||||
COM_ParseInt(&command, &count);
|
||||
|
||||
CParticleCloud& nCloud = mParticleClouds.push_back();
|
||||
nCloud.Initialize(1000, "gfx/effects/snowflake1.bmp");
|
||||
nCloud.Initialize(count, "gfx/effects/snowflake1.tga");
|
||||
nCloud.mBlendMode = 1;
|
||||
nCloud.mRotationChangeNext = 0;
|
||||
nCloud.mColor = 0.75f;
|
||||
|
|
|
@ -493,7 +493,8 @@ static void RB_BeginDrawingView (void) {
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( r_fastsky->integer && !( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) && !g_bRenderGlowingObjects )
|
||||
if ((!hasskybox || r_fastsky->integer) &&
|
||||
!( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) && !g_bRenderGlowingObjects )
|
||||
{
|
||||
if (tr.world && tr.world->globalFog != -1)
|
||||
{
|
||||
|
@ -647,6 +648,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
int entityNum, oldEntityNum;
|
||||
int dlighted, oldDlighted;
|
||||
int depthRange, oldDepthRange;
|
||||
int isVRViewModel, oldIsVRViewModel;
|
||||
int i;
|
||||
drawSurf_t *drawSurf;
|
||||
unsigned int oldSort;
|
||||
|
@ -672,10 +674,15 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
oldShader = NULL;
|
||||
oldFogNum = -1;
|
||||
oldDepthRange = qfalse;
|
||||
isVRViewModel = qfalse;
|
||||
oldIsVRViewModel = qfalse;
|
||||
oldDlighted = qfalse;
|
||||
oldSort = (unsigned int) -1;
|
||||
depthRange = qfalse;
|
||||
|
||||
GLint oldFaceCullMode;
|
||||
GLboolean oldFaceCullEnabled;
|
||||
|
||||
backEnd.pc.c_surfaces += numDrawSurfs;
|
||||
|
||||
for (i = 0, drawSurf = drawSurfs ; i < numDrawSurfs ; i++, drawSurf++) {
|
||||
|
@ -774,6 +781,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
//
|
||||
if ( entityNum != oldEntityNum ) {
|
||||
depthRange = qfalse;
|
||||
isVRViewModel = qfalse;
|
||||
|
||||
if ( entityNum != REFENTITYNUM_WORLD ) {
|
||||
backEnd.currentEntity = &backEnd.refdef.entities[entityNum];
|
||||
|
@ -795,6 +803,10 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
// hack the depth range to prevent view model from poking into walls
|
||||
depthRange = qtrue;
|
||||
}
|
||||
|
||||
if (backEnd.currentEntity->e.renderfx & RF_VRVIEWMODEL) {
|
||||
isVRViewModel = qtrue;
|
||||
}
|
||||
} else {
|
||||
backEnd.currentEntity = &tr.worldEntity;
|
||||
backEnd.refdef.floatTime = originalTime;
|
||||
|
@ -826,6 +838,25 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
|
|||
oldDepthRange = depthRange;
|
||||
}
|
||||
|
||||
if (isVRViewModel != oldIsVRViewModel) {
|
||||
if (isVRViewModel) {
|
||||
qglGetBooleanv(GL_CULL_FACE, &oldFaceCullEnabled);
|
||||
qglGetIntegerv(GL_CULL_FACE_MODE, &oldFaceCullMode);
|
||||
|
||||
//Draw all faces on weapons
|
||||
qglDisable(GL_CULL_FACE);
|
||||
} else{
|
||||
if (!oldFaceCullEnabled)
|
||||
{
|
||||
qglDisable(GL_CULL_FACE);
|
||||
} else{
|
||||
qglEnable(GL_CULL_FACE);
|
||||
}
|
||||
qglCullFace( oldFaceCullMode );
|
||||
}
|
||||
oldIsVRViewModel = isVRViewModel;
|
||||
}
|
||||
|
||||
oldEntityNum = entityNum;
|
||||
}
|
||||
|
||||
|
@ -1403,7 +1434,8 @@ const void *RB_DrawBuffer( const void *data ) {
|
|||
|
||||
cmd = (const drawBufferCommand_t *)data;
|
||||
|
||||
qglDrawBuffer( cmd->buffer );
|
||||
|
||||
//qglDrawBuffer( cmd->buffer );
|
||||
|
||||
// clear screen for debugging
|
||||
if (!( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) && tr.world && tr.refdef.rdflags & RDF_doLAGoggles)
|
||||
|
@ -1522,6 +1554,32 @@ void RB_ShowImages( void ) {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
RB_Flush
|
||||
|
||||
=============
|
||||
*/
|
||||
const void *RB_Flush( const void *data ) {
|
||||
const swapBuffersCommand_t *cmd;
|
||||
|
||||
// finish any 2D drawing if needed
|
||||
if ( tess.numIndexes ) {
|
||||
RB_EndSurface();
|
||||
}
|
||||
|
||||
// texture swapping test
|
||||
if ( r_showImages->integer ) {
|
||||
RB_ShowImages();
|
||||
}
|
||||
|
||||
cmd = (const swapBuffersCommand_t *)data;
|
||||
|
||||
backEnd.projection2D = qfalse;
|
||||
|
||||
return (const void *)( cmd + 1 );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
RB_SwapBuffers
|
||||
|
@ -1637,6 +1695,9 @@ void RB_ExecuteRenderCommands( const void *data ) {
|
|||
case RC_WORLD_EFFECTS:
|
||||
data = RB_WorldEffects( data );
|
||||
break;
|
||||
case RC_FLUSH:
|
||||
data = RB_Flush( data );
|
||||
break;
|
||||
case RC_END_OF_LIST:
|
||||
default:
|
||||
// stop rendering
|
||||
|
|
|
@ -1342,6 +1342,7 @@ void RE_LoadWorldMap_Actual( const char *name, world_t &worldData, int index ) {
|
|||
if (!index)
|
||||
{
|
||||
skyboxportal = 0;
|
||||
hasskybox = 0;
|
||||
|
||||
tr.sunDirection[0] = 0.45f;
|
||||
tr.sunDirection[1] = 0.3f;
|
||||
|
|
|
@ -457,23 +457,13 @@ void RE_BeginFrame( stereoFrame_t stereoFrame ) {
|
|||
}
|
||||
cmd->commandId = RC_DRAW_BUFFER;
|
||||
|
||||
if ( glConfig.stereoEnabled ) {
|
||||
{
|
||||
if ( stereoFrame == STEREO_LEFT ) {
|
||||
cmd->buffer = (int)GL_BACK_LEFT;
|
||||
cmd->buffer = (int)0;
|
||||
} else if ( stereoFrame == STEREO_RIGHT ) {
|
||||
cmd->buffer = (int)GL_BACK_RIGHT;
|
||||
cmd->buffer = (int)1;
|
||||
} else {
|
||||
Com_Error( ERR_FATAL, "RE_BeginFrame: Stereo is enabled, but stereoFrame was %i", stereoFrame );
|
||||
}
|
||||
} else {
|
||||
if ( stereoFrame != STEREO_CENTER ) {
|
||||
Com_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;
|
||||
ri.Error( ERR_FATAL, "RE_BeginFrame: Stereo is enabled, but stereoFrame was %i", stereoFrame );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -487,26 +477,30 @@ Returns the number of msec spent in the back end
|
|||
=============
|
||||
*/
|
||||
void RE_EndFrame( int *frontEndMsec, int *backEndMsec ) {
|
||||
swapBuffersCommand_t *cmd;
|
||||
swapBuffersCommand_t *cmd;
|
||||
|
||||
if ( !tr.registered ) {
|
||||
return;
|
||||
}
|
||||
cmd = (swapBuffersCommand_t *) R_GetCommandBufferReserved( sizeof( *cmd ), 0 );
|
||||
if ( !cmd ) {
|
||||
|
||||
cmd = (swapBuffersCommand_t*)R_GetCommandBuffer(sizeof(*cmd));
|
||||
if (!cmd) {
|
||||
return;
|
||||
}
|
||||
cmd->commandId = RC_SWAP_BUFFERS;
|
||||
|
||||
R_IssueRenderCommands( qtrue );
|
||||
cmd->commandId = RC_FLUSH;
|
||||
|
||||
R_InitNextFrame();
|
||||
R_IssueRenderCommands( qfalse );
|
||||
|
||||
if ( frontEndMsec ) {
|
||||
// use the other buffers next frame, because another CPU
|
||||
// may still be rendering into the current ones
|
||||
R_InitNextFrame();
|
||||
|
||||
if (frontEndMsec) {
|
||||
*frontEndMsec = tr.frontEndMsec;
|
||||
}
|
||||
tr.frontEndMsec = 0;
|
||||
if ( backEndMsec ) {
|
||||
if (backEndMsec) {
|
||||
*backEndMsec = backEnd.pc.msec;
|
||||
}
|
||||
backEnd.pc.msec = 0;
|
||||
|
@ -516,3 +510,20 @@ void RE_EndFrame( int *frontEndMsec, int *backEndMsec ) {
|
|||
styleUpdated[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
void RE_SubmitStereoFrame( ) {
|
||||
swapBuffersCommand_t *cmd;
|
||||
|
||||
if ( !tr.registered ) {
|
||||
return;
|
||||
}
|
||||
|
||||
cmd = (swapBuffersCommand_t*)R_GetCommandBuffer(sizeof(*cmd));
|
||||
if (!cmd) {
|
||||
return;
|
||||
}
|
||||
|
||||
cmd->commandId = RC_SWAP_BUFFERS;
|
||||
|
||||
R_IssueRenderCommands( qtrue );
|
||||
}
|
||||
|
|
|
@ -729,7 +729,7 @@ static void InitOpenGL( void )
|
|||
|
||||
// set default state
|
||||
GL_SetDefaultState();
|
||||
R_Splash(); //get something on screen asap
|
||||
//R_Splash(); //get something on screen asap
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2038,6 +2038,7 @@ extern "C" Q_EXPORT refexport_t* QDECL GetRefAPI ( int apiVersion, refimport_t *
|
|||
|
||||
REX(BeginFrame);
|
||||
REX(EndFrame);
|
||||
REX(SubmitStereoFrame);
|
||||
|
||||
REX(ProcessDissolve);
|
||||
REX(InitDissolve);
|
||||
|
|
|
@ -74,6 +74,7 @@ typedef struct {
|
|||
// as well as the locally generated scene information
|
||||
typedef struct {
|
||||
int x, y, width, height;
|
||||
bool override_fov;
|
||||
float fov_x, fov_y;
|
||||
vec3_t vieworg;
|
||||
vec3_t viewaxis[3]; // transformation matrix
|
||||
|
@ -1309,7 +1310,7 @@ void RE_GetScreenShot(byte *data, int w, int h);
|
|||
byte* RE_TempRawImage_ReadFromFile(const char *psLocalFilename, int *piWidth, int *piHeight, byte *pbReSampleBuffer, qboolean qbVertFlip);
|
||||
void RE_TempRawImage_CleanUp();
|
||||
|
||||
void RE_BeginRegistration( glconfig_t *glconfig );
|
||||
void RE_BeginRegistration( glconfig_t *glconfig, intptr_t pVrClientInfo );
|
||||
void RE_LoadWorldMap( const char *mapname );
|
||||
void RE_SetWorldVisData( const byte *vis );
|
||||
qhandle_t RE_RegisterModel( const char *name );
|
||||
|
@ -1778,6 +1779,7 @@ typedef enum {
|
|||
RC_DRAW_BUFFER,
|
||||
RC_SWAP_BUFFERS,
|
||||
RC_WORLD_EFFECTS,
|
||||
RC_FLUSH
|
||||
} renderCommand_t;
|
||||
|
||||
|
||||
|
@ -1818,6 +1820,7 @@ void RE_LAGoggles( void );
|
|||
void RE_Scissor ( float x, float y, float w, float h);
|
||||
void RE_BeginFrame( stereoFrame_t stereoFrame );
|
||||
void RE_EndFrame( int *frontEndMsec, int *backEndMsec );
|
||||
void RE_SubmitStereoFrame( );
|
||||
qboolean RE_ProcessDissolve(void);
|
||||
qboolean RE_InitDissolve(qboolean bForceCircularExtroWipe);
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../server/exe_headers.h"
|
||||
|
||||
#include "tr_local.h"
|
||||
#include <VrClientInfo.h>
|
||||
|
||||
#if !defined(G2_H_INC)
|
||||
#include "../ghoul2/G2.h"
|
||||
|
@ -34,6 +35,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
trGlobals_t tr;
|
||||
|
||||
vr_client_info_t *vr;
|
||||
|
||||
static float s_flipMatrix[16] = {
|
||||
// convert from our coordinate system (looking down X)
|
||||
// to OpenGL's coordinate system (looking down -Z)
|
||||
|
@ -525,7 +528,7 @@ R_SetupProjection
|
|||
void R_SetupProjection( void ) {
|
||||
float xmin, xmax, ymin, ymax;
|
||||
float width, height, depth;
|
||||
float zNear, zFar;
|
||||
float zNear, zFar, zZoomX, zZoomY;
|
||||
|
||||
// dynamically compute far clip plane distance
|
||||
SetFarClip();
|
||||
|
@ -535,6 +538,20 @@ void R_SetupProjection( void ) {
|
|||
//
|
||||
zNear = r_znear->value;
|
||||
zFar = tr.viewParms.zFar;
|
||||
zZoomX = 1.0f;
|
||||
zZoomY = 1.0f;
|
||||
|
||||
if (tr.refdef.override_fov || vr->cgzoommode)
|
||||
{
|
||||
zZoomX = vr->fov_x / tr.refdef.fov_x;
|
||||
zZoomY = vr->fov_y / tr.refdef.fov_y;
|
||||
}
|
||||
|
||||
if (ri.TBXR_GetVRProjection(vr->eye, zNear, zFar, zZoomX, zZoomY, tr.viewParms.projectionMatrix))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ymax = zNear * tan( tr.refdef.fov_y * M_PI / 360.0f );
|
||||
ymin = -ymax;
|
||||
|
|
|
@ -30,6 +30,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "tr_local.h"
|
||||
#include "qcommon/matcomp.h"
|
||||
#include "../qcommon/sstring.h"
|
||||
#include <VrClientInfo.h>
|
||||
|
||||
#define LL(x) x=LittleLong(x)
|
||||
#define LS(x) x=LittleShort(x)
|
||||
|
@ -977,12 +978,13 @@ void CM_SetupShaderProperties(void);
|
|||
/*
|
||||
** RE_BeginRegistration
|
||||
*/
|
||||
void RE_BeginRegistration( glconfig_t *glconfigOut ) {
|
||||
void RE_BeginRegistration( glconfig_t *glconfigOut, intptr_t pVrClientInfo ) {
|
||||
ri.Hunk_ClearToMark();
|
||||
|
||||
R_Init();
|
||||
|
||||
*glconfigOut = glConfig;
|
||||
vr = (vr_client_info_t*)pVrClientInfo;
|
||||
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../server/exe_headers.h"
|
||||
|
||||
#include "tr_local.h"
|
||||
#include <VrClientInfo.h>
|
||||
|
||||
int r_firstSceneDrawSurf;
|
||||
|
||||
|
@ -41,6 +42,7 @@ int r_numpolyverts;
|
|||
|
||||
int skyboxportal;
|
||||
int drawskyboxportal;
|
||||
int hasskybox; // Used to indicate whether the BSP contains a skybox (if not, then use fog colour if applicable)
|
||||
|
||||
/*
|
||||
====================
|
||||
|
@ -293,9 +295,15 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
tr.refdef.y = fd->y;
|
||||
tr.refdef.width = fd->width;
|
||||
tr.refdef.height = fd->height;
|
||||
tr.refdef.override_fov = fd->override_fov;
|
||||
tr.refdef.fov_x = fd->fov_x;
|
||||
tr.refdef.fov_y = fd->fov_y;
|
||||
|
||||
memset( &parms, 0, sizeof( parms ) );
|
||||
VectorCopy( fd->viewaxis[0], parms.ori.axis[0] );
|
||||
VectorCopy( fd->viewaxis[1], parms.ori.axis[1] );
|
||||
VectorCopy( fd->viewaxis[2], parms.ori.axis[2] );
|
||||
|
||||
VectorCopy( fd->vieworg, tr.refdef.vieworg );
|
||||
VectorCopy( fd->viewaxis[0], tr.refdef.viewaxis[0] );
|
||||
VectorCopy( fd->viewaxis[1], tr.refdef.viewaxis[1] );
|
||||
|
@ -384,7 +392,6 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
// The refdef takes 0-at-the-top y coordinates, so
|
||||
// convert to GL's 0-at-the-bottom space
|
||||
//
|
||||
memset( &parms, 0, sizeof( parms ) );
|
||||
parms.viewportX = tr.refdef.x;
|
||||
parms.viewportY = glConfig.vidHeight - ( tr.refdef.y + tr.refdef.height );
|
||||
parms.viewportWidth = tr.refdef.width;
|
||||
|
@ -395,9 +402,9 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
parms.fovY = tr.refdef.fov_y;
|
||||
|
||||
VectorCopy( fd->vieworg, parms.ori.origin );
|
||||
VectorCopy( fd->viewaxis[0], parms.ori.axis[0] );
|
||||
VectorCopy( fd->viewaxis[1], parms.ori.axis[1] );
|
||||
VectorCopy( fd->viewaxis[2], parms.ori.axis[2] );
|
||||
// VectorCopy( fd->viewaxis[0], parms.ori.axis[0] );
|
||||
// VectorCopy( fd->viewaxis[1], parms.ori.axis[1] );
|
||||
// VectorCopy( fd->viewaxis[2], parms.ori.axis[2] );
|
||||
|
||||
VectorCopy( fd->vieworg, parms.pvsOrigin );
|
||||
|
||||
|
|
|
@ -805,6 +805,11 @@ void RB_StageIteratorSky( void ) {
|
|||
return;
|
||||
}
|
||||
|
||||
//Don't need to use the following in JK3
|
||||
#ifdef JK2_MODE
|
||||
hasskybox = 1;
|
||||
#endif
|
||||
|
||||
// go through all the polygons and project them onto
|
||||
// the sky box to see which blocks on each side need
|
||||
// to be drawn
|
||||
|
|
|
@ -26,6 +26,24 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "sys/sys_local.h"
|
||||
#include "sdl_icon.h"
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
// OpenXR Header
|
||||
#define XR_USE_GRAPHICS_API_OPENGL
|
||||
#define XR_USE_PLATFORM_WIN32
|
||||
#include <Unknwn.h>
|
||||
#include <openxr.h>
|
||||
#include <openxr_platform.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
#define GL_RGBA16F 0x881A
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
enum rserr_t
|
||||
{
|
||||
RSERR_OK,
|
||||
|
@ -142,11 +160,20 @@ void GLimp_Minimize(void)
|
|||
SDL_MinimizeWindow( screen );
|
||||
}
|
||||
|
||||
|
||||
void WIN_SwapWindow()
|
||||
{
|
||||
SDL_GL_SwapWindow(screen);
|
||||
}
|
||||
|
||||
void TBXR_submitFrame();
|
||||
|
||||
void WIN_Present( window_t *window )
|
||||
{
|
||||
if ( window->api == GRAPHICS_API_OPENGL )
|
||||
{
|
||||
SDL_GL_SwapWindow(screen);
|
||||
TBXR_submitFrame();
|
||||
|
||||
|
||||
if ( r_swapInterval->modified )
|
||||
{
|
||||
|
@ -315,6 +342,8 @@ static bool GLimp_DetectAvailableModes(void)
|
|||
GLimp_SetMode
|
||||
===============
|
||||
*/
|
||||
|
||||
void TBXR_GetScreenRes(int*, int*);
|
||||
static rserr_t GLimp_SetMode(glconfig_t *glConfig, const windowDesc_t *windowDesc, const char *windowTitle, int mode, qboolean fullscreen, qboolean noborder)
|
||||
{
|
||||
int perChannelColorBits;
|
||||
|
@ -395,6 +424,7 @@ static rserr_t GLimp_SetMode(glconfig_t *glConfig, const windowDesc_t *windowDes
|
|||
SDL_FreeSurface( icon );
|
||||
return RSERR_INVALID_MODE;
|
||||
}
|
||||
|
||||
Com_Printf( " %d %d\n", glConfig->vidWidth, glConfig->vidHeight);
|
||||
|
||||
// Center window
|
||||
|
@ -723,6 +753,31 @@ static qboolean GLimp_StartDriverAndSetMode(glconfig_t *glConfig, const windowDe
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
|
||||
bool xr_result(XrInstance instance, XrResult result, const char* format, ...)
|
||||
{
|
||||
if (XR_SUCCEEDED(result))
|
||||
return true;
|
||||
|
||||
char resultString[XR_MAX_RESULT_STRING_SIZE];
|
||||
xrResultToString(instance, result, resultString);
|
||||
|
||||
size_t len1 = strlen(format);
|
||||
size_t len2 = strlen(resultString) + 1;
|
||||
char* formatRes = new char[len1 + len2 + 4]; // + " []\n"
|
||||
sprintf(formatRes, "%s [%s]\n", format, resultString);
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vprintf(formatRes, args);
|
||||
va_end(args);
|
||||
|
||||
delete[] formatRes;
|
||||
return false;
|
||||
}
|
||||
|
||||
void VR_Init();
|
||||
|
||||
window_t WIN_Init( const windowDesc_t *windowDesc, glconfig_t *glConfig )
|
||||
{
|
||||
Cmd_AddCommand("modelist", R_ModeList_f);
|
||||
|
@ -745,9 +800,9 @@ window_t WIN_Init( const windowDesc_t *windowDesc, glconfig_t *glConfig )
|
|||
|
||||
// Window render surface cvars
|
||||
r_stencilbits = Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE_ND|CVAR_LATCH );
|
||||
r_depthbits = Cvar_Get( "r_depthbits", "24", CVAR_ARCHIVE_ND|CVAR_LATCH );
|
||||
r_colorbits = Cvar_Get( "r_colorbits", "32", CVAR_ARCHIVE_ND|CVAR_LATCH );
|
||||
r_ignorehwgamma = Cvar_Get( "r_ignorehwgamma", "1", CVAR_ARCHIVE|CVAR_LATCH );
|
||||
r_depthbits = Cvar_Get( "r_depthbits", "0", CVAR_ARCHIVE_ND|CVAR_LATCH );
|
||||
r_colorbits = Cvar_Get( "r_colorbits", "0", CVAR_ARCHIVE_ND|CVAR_LATCH );
|
||||
r_ignorehwgamma = Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE_ND|CVAR_LATCH );
|
||||
r_ext_multisample = Cvar_Get( "r_ext_multisample", "0", CVAR_ARCHIVE_ND|CVAR_LATCH );
|
||||
Cvar_Get( "r_availableModes", "", CVAR_ROM );
|
||||
|
||||
|
@ -778,6 +833,7 @@ window_t WIN_Init( const windowDesc_t *windowDesc, glconfig_t *glConfig )
|
|||
|
||||
window.api = windowDesc->api;
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION(&info.version);
|
||||
|
@ -793,6 +849,10 @@ window_t WIN_Init( const windowDesc_t *windowDesc, glconfig_t *glConfig )
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
VR_Init();
|
||||
TBXR_GetScreenRes(&glConfig->vidWidth, &glConfig->vidHeight);
|
||||
|
||||
#endif
|
||||
|
||||
return window;
|
||||
|
|
Loading…
Reference in a new issue