mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-04-22 23:11:02 +00:00
Almost there..
though head tracking is borked
This commit is contained in:
parent
8a8631f03e
commit
380daf2711
21 changed files with 195 additions and 62 deletions
|
@ -133,7 +133,6 @@ LAMBDA1VR Stuff
|
|||
|
||||
qboolean RTCWVR_useScreenLayer()
|
||||
{
|
||||
//TODO
|
||||
return (qboolean)(showingScreenLayer ||
|
||||
(cls.state == CA_CINEMATIC) ||
|
||||
(cls.state == CA_LOADING) ||
|
||||
|
@ -707,7 +706,7 @@ void ovrRenderer_Create( int width, int height, ovrRenderer * renderer, const ov
|
|||
renderer->NumBuffers = VRAPI_FRAME_LAYER_EYE_MAX;
|
||||
|
||||
//Now using a symmetrical render target, based on the horizontal FOV
|
||||
vrFOV = vrapi_GetSystemPropertyInt( java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
|
||||
vr.fov = vrapi_GetSystemPropertyInt( java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
|
||||
|
||||
// Create the render Textures.
|
||||
for ( int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; eye++ )
|
||||
|
@ -721,7 +720,7 @@ void ovrRenderer_Create( int width, int height, ovrRenderer * renderer, const ov
|
|||
|
||||
// Setup the projection matrix.
|
||||
renderer->ProjectionMatrix = ovrMatrix4f_CreateProjectionFov(
|
||||
vrFOV, vrFOV, 0.0f, 0.0f, 1.0f, 0.0f );
|
||||
vr.fov, vr.fov, 0.0f, 0.0f, 1.0f, 0.0f );
|
||||
|
||||
}
|
||||
|
||||
|
@ -1289,7 +1288,15 @@ void Android_MessageBox(const char *title, const char *text)
|
|||
|
||||
void initialize_gl4es();
|
||||
|
||||
void VR_Init()
|
||||
void RTCWVR_ResyncClientYawWithGameYaw()
|
||||
{
|
||||
//Allow 3 frames for the yaw to sync, first is this frame which is the old yaw
|
||||
//second is the next frame which _should_ be the new yaw, but just in case it isn't
|
||||
//we resync on the 3rd frame as well
|
||||
resyncClientYawWithGameYaw = 3;
|
||||
}
|
||||
|
||||
void RTCWVR_Init()
|
||||
{
|
||||
//Initialise all our variables
|
||||
playerYaw = 0.0f;
|
||||
|
@ -1301,6 +1308,7 @@ void VR_Init()
|
|||
positional_movementForward = 0.0f;
|
||||
snapTurn = 0.0f;
|
||||
ducked = DUCK_NOTDUCKED;
|
||||
RTCWVR_ResyncClientYawWithGameYaw();
|
||||
|
||||
//init randomiser
|
||||
srand(time(NULL));
|
||||
|
@ -1314,7 +1322,6 @@ void VR_Init()
|
|||
vr_control_scheme = Cvar_Get( "vr_control_scheme", "0", CVAR_ARCHIVE);
|
||||
vr_height_adjust = Cvar_Get( "vr_height_adjust", "0.0", CVAR_ARCHIVE);
|
||||
vr_weaponscale = Cvar_Get( "vr_weaponscale", "0.56", CVAR_ARCHIVE);
|
||||
vr_weapon_stabilised = Cvar_Get( "vr_weapon_stabilised", "0.0", CVAR_LATCH);
|
||||
vr_lasersight = Cvar_Get( "vr_lasersight", "0", CVAR_LATCH);
|
||||
vr_comfort_mask = Cvar_Get( "vr_comfort_mask", "0.0", CVAR_ARCHIVE);
|
||||
}
|
||||
|
@ -1641,7 +1648,7 @@ void RTCWVR_submitFrame()
|
|||
layer.Textures[eye].SwapChainIndex = frameBuffer->ReadyTextureSwapChainIndex;
|
||||
|
||||
ovrMatrix4f projectionMatrix;
|
||||
projectionMatrix = ovrMatrix4f_CreateProjectionFov(vrFOV, vrFOV,
|
||||
projectionMatrix = ovrMatrix4f_CreateProjectionFov(vr.fov, vr.fov,
|
||||
0.0f, 0.0f, 0.1f, 0.0f);
|
||||
|
||||
layer.Textures[eye].TexCoordsFromTanAngles = ovrMatrix4f_TanAngleMatrixFromProjection(&projectionMatrix);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#if !defined(vrorientation_h)
|
||||
#define vrorientation_h
|
||||
|
||||
#include "mathlib.h"
|
||||
#if !defined(vr_client_info_h)
|
||||
#define vr_client_info_h
|
||||
|
||||
typedef struct {
|
||||
float fov;
|
||||
qboolean weapon_stabilised;
|
||||
|
||||
vec3_t worldPosition;
|
||||
|
||||
vec3_t hmdPosition;
|
||||
|
@ -15,6 +16,6 @@ typedef struct {
|
|||
|
||||
vec3_t flashlightangles;
|
||||
vec3_t flashlightoffset;
|
||||
} vr_orientation_t;
|
||||
} vr_client_info_t;
|
||||
|
||||
#endif //vrorientation_h
|
||||
#endif //vr_client_info_h
|
|
@ -6,7 +6,7 @@
|
|||
#include <android/log.h>
|
||||
|
||||
#include "mathlib.h"
|
||||
#include "VrOrientation.h"
|
||||
#include "VrClientInfo.h"
|
||||
|
||||
#define LOG_TAG "RTCWVR"
|
||||
|
||||
|
@ -30,7 +30,6 @@ float playerHeight;
|
|||
float playerYaw;
|
||||
|
||||
qboolean showingScreenLayer;
|
||||
float vrFOV;
|
||||
|
||||
ovrTracking2 tracking;
|
||||
|
||||
|
@ -40,8 +39,9 @@ ovrTracking2 tracking;
|
|||
int ducked;
|
||||
|
||||
qboolean player_moving;
|
||||
int resyncClientYawWithGameYaw;
|
||||
|
||||
vr_orientation_t vr;
|
||||
vr_client_info_t vr;
|
||||
|
||||
|
||||
float radians(float deg);
|
||||
|
@ -67,7 +67,7 @@ void RTCWVR_setUseScreenLayer(qboolean use);
|
|||
void RTCWVR_processHaptics();
|
||||
void RTCWVR_getHMDOrientation();
|
||||
void RTCWVR_getTrackedRemotesOrientation();
|
||||
|
||||
void RTCWVR_ResyncClientYawWithGameYaw();
|
||||
void RTCWVR_incrementFrameIndex();
|
||||
|
||||
void RTCWVR_prepareEyeBuffer(int eye );
|
||||
|
|
|
@ -151,8 +151,8 @@ ovrLayerCylinder2 BuildCylinderLayer( ovrRenderer * cylinderRenderer,
|
|||
|
||||
const float density = 4500.0f;
|
||||
const float rotateYaw = 0.0f;
|
||||
const float radius = 3.0f;
|
||||
const ovrVector3f translation = { 0.0f, playerHeight/2, -5.0f };
|
||||
const float radius = 4.0f;
|
||||
const ovrVector3f translation = { 0.0f, playerHeight/2, -3.5f };
|
||||
|
||||
ovrMatrix4f cylinderTransform =
|
||||
CylinderModelMatrix( textureWidth, textureHeight, translation,
|
||||
|
|
|
@ -7,5 +7,4 @@ cvar_t *vr_lasersight;
|
|||
cvar_t *vr_control_scheme;
|
||||
cvar_t *vr_height_adjust;
|
||||
cvar_t *vr_weaponscale;
|
||||
cvar_t *vr_weapon_stabilised;
|
||||
cvar_t *vr_comfort_mask;
|
||||
|
|
|
@ -19,7 +19,6 @@ Authors : Simon Brown
|
|||
#include "../rtcw/src/client/client.h"
|
||||
|
||||
cvar_t *sv_cheats;
|
||||
extern cvar_t *vr_weapon_stabilised;
|
||||
|
||||
|
||||
|
||||
|
@ -60,6 +59,34 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
static bool canUseQuickSave = false;
|
||||
if (pOffTracking->Status & (VRAPI_TRACKING_STATUS_POSITION_TRACKED | VRAPI_TRACKING_STATUS_POSITION_VALID)) {
|
||||
canUseQuickSave = false;
|
||||
}
|
||||
else if (!canUseQuickSave) {
|
||||
int channel = (vr_control_scheme->integer >= 10) ? 1 : 0;
|
||||
RTCWVR_Vibrate(40, channel, 0.5); // vibrate to let user know they can switch
|
||||
canUseQuickSave = true;
|
||||
}
|
||||
|
||||
if (canUseQuickSave)
|
||||
{
|
||||
if (((pOffTrackedRemoteNew->Buttons & offButton1) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton1)) &&
|
||||
(pOffTrackedRemoteNew->Buttons & offButton1)) {
|
||||
sendButtonActionSimple("savegame quicksave");
|
||||
}
|
||||
|
||||
if (((pOffTrackedRemoteNew->Buttons & offButton2) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton2)) &&
|
||||
(pOffTrackedRemoteNew->Buttons & offButton2)) {
|
||||
sendButtonActionSimple("loadgame quicksave");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
float distance = sqrtf(powf(pOffTracking->HeadPose.Pose.Position.x - pDominantTracking->HeadPose.Pose.Position.x, 2) +
|
||||
powf(pOffTracking->HeadPose.Pose.Position.y - pDominantTracking->HeadPose.Pose.Position.y, 2) +
|
||||
powf(pOffTracking->HeadPose.Pose.Position.z - pDominantTracking->HeadPose.Pose.Position.z, 2));
|
||||
|
@ -72,12 +99,12 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
{
|
||||
if (distance < 0.50f)
|
||||
{
|
||||
Cvar_Set("vr_weapon_stabilised", "1.0");
|
||||
vr.weapon_stabilised = qtrue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Cvar_Set("vr_weapon_stabilised", "0.0");
|
||||
vr.weapon_stabilised = qfalse;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +130,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
vr.weaponangles[ROLL] *= -1.0f;
|
||||
|
||||
|
||||
if (vr_weapon_stabilised->value == 1.0f)
|
||||
if (vr.weapon_stabilised)
|
||||
{
|
||||
float z = pOffTracking->HeadPose.Pose.Position.z - pDominantTracking->HeadPose.Pose.Position.z;
|
||||
float x = pOffTracking->HeadPose.Pose.Position.x - pDominantTracking->HeadPose.Pose.Position.x;
|
||||
|
@ -328,15 +355,19 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
remote_movementForward);
|
||||
|
||||
//Kick!
|
||||
if ((pOffTrackedRemoteNew->Buttons & offButton1) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton1)) {
|
||||
sendButtonAction("+kick", (pOffTrackedRemoteNew->Buttons & offButton1));
|
||||
if (!canUseQuickSave) {
|
||||
if ((pOffTrackedRemoteNew->Buttons & offButton1) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton1)) {
|
||||
sendButtonAction("+kick", (pOffTrackedRemoteNew->Buttons & offButton1));
|
||||
}
|
||||
}
|
||||
|
||||
//notebook
|
||||
if ((pOffTrackedRemoteNew->Buttons & offButton2) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton2)) {
|
||||
sendButtonActionSimple("notebook");
|
||||
if (!canUseQuickSave) {
|
||||
if ((pOffTrackedRemoteNew->Buttons & offButton2) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton2)) {
|
||||
sendButtonActionSimple("notebook");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -373,6 +404,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
{
|
||||
snapTurn += 360.f;
|
||||
}
|
||||
|
||||
RTCWVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
} else if (pDominantTrackedRemoteNew->Joystick.x < 0.4f) {
|
||||
increaseSnap = true;
|
||||
|
@ -394,6 +427,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
{
|
||||
snapTurn -= 360.f;
|
||||
}
|
||||
|
||||
RTCWVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
} else if (pDominantTrackedRemoteNew->Joystick.x > -0.4f)
|
||||
{
|
||||
|
|
|
@ -290,11 +290,10 @@ void Sys_Exit( int ex ) {
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
extern qboolean shutdown;
|
||||
void Sys_Quit( void ) {
|
||||
CL_Shutdown();
|
||||
|
||||
Sys_Exit( 0 );
|
||||
shutdown = qtrue;
|
||||
}
|
||||
|
||||
void Sys_Init( void ) {
|
||||
|
@ -1328,8 +1327,8 @@ void Sys_ParseArgs( int argc, char* argv[] ) {
|
|||
|
||||
#include "../client/client.h"
|
||||
extern clientStatic_t cls;
|
||||
void VR_Init();
|
||||
|
||||
void RTCWVR_Init();
|
||||
qboolean shutdown;
|
||||
int VR_main( int argc, char* argv[] ) {
|
||||
// int oldtime, newtime; // bk001204 - unused
|
||||
int len, i;
|
||||
|
@ -1364,14 +1363,15 @@ int VR_main( int argc, char* argv[] ) {
|
|||
|
||||
Com_Init( cmdline );
|
||||
NET_Init();
|
||||
VR_Init();
|
||||
RTCWVR_Init();
|
||||
|
||||
Sys_ConsoleInputInit();
|
||||
|
||||
|
||||
// fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) | FNDELAY );
|
||||
|
||||
while ( 1 )
|
||||
shutdown = qfalse;
|
||||
while ( !shutdown )
|
||||
{
|
||||
#ifdef __linux__
|
||||
Sys_ConfigureFPU();
|
||||
|
|
|
@ -31,14 +31,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "cg_local.h"
|
||||
#include "../ui/ui_shared.h"
|
||||
#include "../../../RTCWVR/VrOrientation.h"
|
||||
#include "../../../RTCWVR/VrClientInfo.h"
|
||||
|
||||
//----(SA) added to make it easier to raise/lower our statsubar by only changing one thing
|
||||
#define STATUSBARHEIGHT 452
|
||||
//----(SA) end
|
||||
|
||||
extern displayContextDef_t cgDC;
|
||||
extern vr_orientation_t cgVR;
|
||||
extern vr_client_info_t* cgVR;
|
||||
menuDef_t *menuScoreboard = NULL;
|
||||
|
||||
int sortedTeamPlayers[TEAM_MAXOVERLAY];
|
||||
|
@ -348,6 +348,9 @@ void CG_Draw3DModel( float x, float y, float w, float h, qhandle_t model, qhandl
|
|||
refdef.rdflags &= ~RDF_DRAWSKYBOX;
|
||||
}
|
||||
|
||||
//Indicate to renderer it should be trying any view angle adjustments
|
||||
refdef.viewangles[YAW] = -1000;
|
||||
|
||||
trap_R_ClearScene();
|
||||
trap_R_AddRefEntityToScene( &ent );
|
||||
trap_R_RenderScene( &refdef );
|
||||
|
@ -3563,12 +3566,14 @@ void CG_DrawActive( int stereoView ) {
|
|||
return;
|
||||
}
|
||||
|
||||
cg.refdef.stereoView = stereoView;
|
||||
separation = stereoView == 1 ?
|
||||
cg_worldScale.value * (-cg_stereoSeparation.value / 2) : //left
|
||||
cg_worldScale.value * (cg_stereoSeparation.value / 2); // right
|
||||
|
||||
|
||||
cg.refdef.worldscale = cg_worldScale.value;
|
||||
VectorCopy(cg.refdefViewAngles, cg.refdef.viewangles);
|
||||
|
||||
// clear around the rendered view if sized down
|
||||
// CG_TileClear(); // (SA) moved down
|
||||
|
@ -3579,9 +3584,11 @@ void CG_DrawActive( int stereoView ) {
|
|||
VectorMA( cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg );
|
||||
}
|
||||
|
||||
cg.refdef.vieworg[2] -= DEFAULT_VIEWHEIGHT;
|
||||
cg.refdef.vieworg[2] += (cgVR.hmdPosition[1] /*+ vr_height_adjust->value*/) * cg_worldScale.value;
|
||||
|
||||
//Vertical Positional Movement
|
||||
if (!cg.cameraMode) {
|
||||
cg.refdef.vieworg[2] -= DEFAULT_VIEWHEIGHT;
|
||||
cg.refdef.vieworg[2] += (cgVR->hmdPosition[1] /*+ vr_height_adjust->value*/) * cg_worldScale.value;
|
||||
}
|
||||
|
||||
cg.refdef.glfog.registered = 0; // make sure it doesn't use fog from another scene
|
||||
/*
|
||||
|
|
|
@ -36,10 +36,10 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "cg_local.h"
|
||||
#include "../ui/ui_shared.h"
|
||||
#include "../../../RTCWVR/VrOrientation.h"
|
||||
#include "../../../RTCWVR/VrClientInfo.h"
|
||||
|
||||
displayContextDef_t cgDC;
|
||||
vr_orientation_t cgVR;
|
||||
vr_client_info_t *cgVR;
|
||||
|
||||
int forceModelModificationCount = -1;
|
||||
|
||||
|
@ -91,8 +91,8 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a
|
|||
cgDC.cursory = cgs.cursorY;
|
||||
CG_MouseEvent( arg0, arg1 );
|
||||
return 0;
|
||||
case CG_SET_VR_ORIENTATION:
|
||||
memcpy(&cgVR, (vr_orientation_t*)arg0, sizeof(vr_orientation_t));
|
||||
case CG_SET_VR_CLIENT_INFO:
|
||||
cgVR = (vr_client_info_t*)arg0;
|
||||
return 0;
|
||||
default:
|
||||
CG_Error( "vmMain: unknown command %i", command );
|
||||
|
@ -311,7 +311,7 @@ cvarTable_t cvarTable[] = {
|
|||
{ &cg_viewsize, "cg_viewsize", "100", CVAR_ARCHIVE },
|
||||
{ &cg_letterbox, "cg_letterbox", "0", CVAR_TEMP }, //----(SA) added
|
||||
{ &cg_stereoSeparation, "cg_stereoSeparation", "0.065", CVAR_ARCHIVE },
|
||||
{ &cg_worldScale, "cg_worldScale", "35.0", CVAR_ARCHIVE },
|
||||
{ &cg_worldScale, "cg_worldScale", "37.5", CVAR_ARCHIVE },
|
||||
{ &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE },
|
||||
{ &cg_gibs, "cg_gibs", "1", CVAR_ARCHIVE },
|
||||
{ &cg_draw2D, "cg_draw2D", "1", CVAR_ARCHIVE },
|
||||
|
|
|
@ -271,7 +271,7 @@ typedef enum {
|
|||
CG_GET_TAG,
|
||||
// qboolean CG_GetTag( int clientNum, char *tagname, orientation_t *or );
|
||||
|
||||
CG_SET_VR_ORIENTATION,
|
||||
CG_SET_VR_CLIENT_INFO,
|
||||
|
||||
MAX_CGAME_EXPORT
|
||||
|
||||
|
|
|
@ -1419,6 +1419,9 @@ void CG_DrawSkyBoxPortal( void ) {
|
|||
|
||||
cg.refdef.time = cg.time;
|
||||
|
||||
//Indicate to renderer it should be trying any view angle adjustments
|
||||
cg.refdef.viewangles[YAW] = -1000;
|
||||
|
||||
// draw the skybox
|
||||
trap_R_RenderScene( &cg.refdef );
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
|
||||
#include "cg_local.h"
|
||||
#include "../../../RTCWVR/VrClientInfo.h"
|
||||
|
||||
int wolfkickModel;
|
||||
int hWeaponSnd;
|
||||
|
@ -41,6 +42,8 @@ int hflakWeaponSnd;
|
|||
int notebookModel;
|
||||
int propellerModel;
|
||||
|
||||
extern vr_client_info_t *cgVR;
|
||||
|
||||
vec3_t ejectBrassCasingOrigin;
|
||||
|
||||
//----(SA)
|
||||
|
@ -1753,12 +1756,33 @@ static void CG_WeaponAnimation( playerState_t *ps, weaponInfo_t *weapon, int *we
|
|||
// (SA) it wasn't used anyway
|
||||
|
||||
|
||||
void convertFromVR(vec3_t in, vec3_t offset, vec3_t out)
|
||||
{
|
||||
vec3_t vrSpace;
|
||||
VectorSet(vrSpace, -in[2], in[0], in[1]);
|
||||
vec3_t temp;
|
||||
VectorScale(vrSpace, cg_worldScale.value, temp);
|
||||
|
||||
if (offset) {
|
||||
VectorAdd(temp, offset, out);
|
||||
} else {
|
||||
VectorCopy(temp, out);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CG_CalculateWeaponPosition
|
||||
==============
|
||||
*/
|
||||
|
||||
|
||||
static void CG_CalculateWeaponPosition( vec3_t origin, vec3_t angles ) {
|
||||
|
||||
convertFromVR(cgVR->weaponoffset, cg.refdef.vieworg, origin);
|
||||
VectorCopy(cgVR->weaponangles, angles);
|
||||
return;
|
||||
|
||||
float scale;
|
||||
int delta;
|
||||
float fracsin, leanscale;
|
||||
|
@ -1855,7 +1879,6 @@ static void CG_CalculateWeaponPosition( vec3_t origin, vec3_t angles ) {
|
|||
|
||||
// RF, subtract the kickAngles
|
||||
VectorMA( angles, -1.0, cg.kickAngles, angles );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -214,7 +214,9 @@ typedef struct {
|
|||
int x, y, width, height;
|
||||
float fov_x, fov_y;
|
||||
vec3_t vieworg;
|
||||
vec3_t viewangles;
|
||||
vec3_t viewaxis[3]; // transformation matrix
|
||||
int stereoView;
|
||||
float worldscale;
|
||||
|
||||
int time; // time in milliseconds for shader effects and other time dependent rendering issues
|
||||
|
|
|
@ -31,9 +31,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "client.h"
|
||||
|
||||
#include "../game/botlib.h"
|
||||
#include "../../../RTCWVR/VrOrientation.h"
|
||||
#include "../../../RTCWVR/VrClientInfo.h"
|
||||
|
||||
extern vr_orientation_t vr;
|
||||
extern vr_client_info_t vr;
|
||||
|
||||
extern botlib_export_t *botlib_export;
|
||||
|
||||
|
@ -1059,8 +1059,8 @@ void CL_CGameRendering( stereoFrame_t stereo ) {
|
|||
CL_CGameRendering
|
||||
=====================
|
||||
*/
|
||||
void CL_CGameSetVROrientation( ) {
|
||||
VM_Call( cgvm, CG_SET_VR_ORIENTATION, &vr );
|
||||
void CL_CGameSetVRClientInfo() {
|
||||
VM_Call( cgvm, CG_SET_VR_CLIENT_INFO, &vr );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -494,7 +494,7 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
|
|||
// }
|
||||
case CA_LOADING:
|
||||
case CA_PRIMED:
|
||||
CL_CGameSetVROrientation();
|
||||
CL_CGameSetVRClientInfo();
|
||||
// draw the game information screen and loading progress
|
||||
CL_CGameRendering( stereoFrame );
|
||||
|
||||
|
@ -505,7 +505,7 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
|
|||
VM_Call( uivm, UI_DRAW_CONNECT_SCREEN, qtrue );
|
||||
break;
|
||||
case CA_ACTIVE:
|
||||
CL_CGameSetVROrientation();
|
||||
CL_CGameSetVRClientInfo();
|
||||
CL_CGameRendering( stereoFrame );
|
||||
SCR_DrawDemoRecording();
|
||||
break;
|
||||
|
|
|
@ -569,7 +569,7 @@ void CIN_CloseAllVideos( void );
|
|||
void CL_InitCGame( void );
|
||||
void CL_ShutdownCGame( void );
|
||||
qboolean CL_GameCommand( void );
|
||||
void CL_CGameSetVROrientation( );
|
||||
void CL_CGameSetVRClientInfo();
|
||||
void CL_CGameRendering( stereoFrame_t stereo );
|
||||
void CL_SetCGameTime( void );
|
||||
void CL_FirstSnapshot( void );
|
||||
|
|
|
@ -30,6 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#include "g_local.h"
|
||||
#include "../../../RTCWVR/VrClientInfo.h"
|
||||
|
||||
level_locals_t level;
|
||||
|
||||
|
@ -47,6 +48,7 @@ gentity_t g_entities[MAX_GENTITIES];
|
|||
gclient_t g_clients[MAX_CLIENTS];
|
||||
|
||||
gentity_t *g_camEnt = NULL; //----(SA) script camera
|
||||
vr_client_info_t* gVR;
|
||||
|
||||
gentity_t *g_autoAimEntity; //Added by Emile Belanger, trying to do proper autoaim
|
||||
unsigned int g_autoAimLastHitTime;
|
||||
|
@ -328,6 +330,10 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a
|
|||
return 0;
|
||||
case GAME_GETMODELINFO:
|
||||
return G_GetModelInfo( arg0, (char *)arg1, (animModelInfo_t **)arg2 );
|
||||
|
||||
case GAME_SET_VR_CLIENT_INFO:
|
||||
gVR = (vr_client_info_t*)arg0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
|
|
@ -248,6 +248,8 @@ typedef enum {
|
|||
|
||||
G_GETTAG,
|
||||
|
||||
G_SET_VR_CLIENT_INFO,
|
||||
|
||||
BOTLIB_SETUP = 200, // ( void );
|
||||
BOTLIB_SHUTDOWN, // ( void );
|
||||
BOTLIB_LIBVAR_SET,
|
||||
|
@ -470,7 +472,9 @@ typedef enum {
|
|||
// done.
|
||||
|
||||
GAME_RETRIEVE_MOVESPEEDS_FROM_CLIENT,
|
||||
GAME_GETMODELINFO
|
||||
GAME_GETMODELINFO,
|
||||
|
||||
GAME_SET_VR_CLIENT_INFO
|
||||
|
||||
} gameExport_t;
|
||||
|
||||
|
|
|
@ -473,7 +473,10 @@ typedef struct {
|
|||
int x, y, width, height;
|
||||
float fov_x, fov_y;
|
||||
vec3_t vieworg;
|
||||
vec3_t viewangles;
|
||||
vec3_t viewaxis[3]; // transformation matrix
|
||||
int stereoView;
|
||||
float worldscale;
|
||||
|
||||
int time; // time in milliseconds for shader effects and other time dependent rendering issues
|
||||
int rdflags; // RDF_NOWORLDMODEL, etc
|
||||
|
|
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include <src/client/client.h>
|
||||
#include "tr_local.h"
|
||||
#include "../../../RTCWVR/VrClientInfo.h"
|
||||
|
||||
int r_firstSceneDrawSurf;
|
||||
|
||||
|
@ -49,6 +50,8 @@ int r_numpolyverts;
|
|||
int skyboxportal;
|
||||
int drawskyboxportal;
|
||||
|
||||
extern vr_client_info_t vr;
|
||||
|
||||
/*
|
||||
====================
|
||||
R_ToggleSmpFrame
|
||||
|
@ -406,8 +409,8 @@ Rendering a scene may require multiple views to be rendered
|
|||
to handle mirrors,
|
||||
@@@@@@@@@@@@@@@@@@@@@
|
||||
*/
|
||||
extern vec3_t hmdPosition;
|
||||
extern cvar_t *vr_worldscale;
|
||||
qboolean RTCWVR_useScreenLayer();
|
||||
extern int resyncClientYawWithGameYaw;
|
||||
void RE_RenderScene( const refdef_t *fd ) {
|
||||
viewParms_t parms;
|
||||
int startTime;
|
||||
|
@ -527,10 +530,45 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
parms.fovY = tr.refdef.fov_y;
|
||||
|
||||
VectorCopy( fd->vieworg, parms.or.origin );
|
||||
//AnglesToAxis( cl.viewangles, parms.or.axis ); // Just use our known client view angles
|
||||
VectorCopy( fd->viewaxis[0], parms.or.axis[0] );
|
||||
VectorCopy( fd->viewaxis[1], parms.or.axis[1] );
|
||||
VectorCopy( fd->viewaxis[2], parms.or.axis[2] );
|
||||
|
||||
//This is just madness, but it makes for smooth head tracking
|
||||
static float yaw = 0;
|
||||
static float last_hmd_yaw = 0;
|
||||
if (fd->viewangles[YAW] == -1000) // MAGIC NUMBER!
|
||||
{
|
||||
//This is default behaviour for when this code
|
||||
//is called for rendering the weapon or the sky box
|
||||
VectorCopy( fd->viewaxis[0], parms.or.axis[0] );
|
||||
VectorCopy( fd->viewaxis[1], parms.or.axis[1] );
|
||||
VectorCopy( fd->viewaxis[2], parms.or.axis[2] );
|
||||
}
|
||||
else if ((RTCWVR_useScreenLayer() || resyncClientYawWithGameYaw > 0))
|
||||
{
|
||||
//Resyncing with known game yaw
|
||||
yaw = fd->viewangles[YAW];
|
||||
VectorCopy( fd->viewaxis[0], parms.or.axis[0] );
|
||||
VectorCopy( fd->viewaxis[1], parms.or.axis[1] );
|
||||
VectorCopy( fd->viewaxis[2], parms.or.axis[2] );
|
||||
if (fd->stereoView == 1 && resyncClientYawWithGameYaw > 0) resyncClientYawWithGameYaw--;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Normal "in-game" behaviour, use pitch and roll from HMD but use
|
||||
//a yaw that we believe is the same as the game server's yaw, adjusted by our last HMD movement
|
||||
vec3_t viewAngles;
|
||||
VectorCopy(vr.hmdorientation, viewAngles);
|
||||
|
||||
//Only update this for once per stereo pair
|
||||
if (fd->stereoView == 1)
|
||||
{
|
||||
float yawDelta = (vr.hmdorientation[YAW] - last_hmd_yaw);
|
||||
yaw += yawDelta;
|
||||
}
|
||||
|
||||
viewAngles[YAW] = yaw;
|
||||
AnglesToAxis(viewAngles, parms.or.axis);
|
||||
}
|
||||
last_hmd_yaw = vr.hmdorientation[YAW];
|
||||
|
||||
VectorCopy( fd->vieworg, parms.pvsOrigin );
|
||||
|
||||
|
|
|
@ -28,10 +28,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#include "server.h"
|
||||
#include "../../../RTCWVR/VrClientInfo.h"
|
||||
|
||||
serverStatic_t svs; // persistant server info
|
||||
server_t sv; // local server
|
||||
vm_t *gvm = NULL; // game virtual machine // bk001212 init
|
||||
extern vr_client_info_t vr;
|
||||
|
||||
cvar_t *sv_fps; // time rate for running non-clients
|
||||
cvar_t *sv_timeout; // seconds without any message
|
||||
|
@ -823,6 +825,9 @@ void SV_Frame( int msec ) {
|
|||
cvar_modifiedFlags &= ~CVAR_SYSTEMINFO;
|
||||
}
|
||||
|
||||
//Ensure the game library has our VR client info
|
||||
VM_Call( gvm, GAME_SET_VR_CLIENT_INFO, &vr );
|
||||
|
||||
if ( com_speeds->integer ) {
|
||||
startTime = Sys_Milliseconds();
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue