mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-10 06:42:17 +00:00
Stereo Separation now working
This commit is contained in:
parent
62556d9b6b
commit
18f17c2bab
6 changed files with 57 additions and 17 deletions
|
@ -29,11 +29,14 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "cg_media.h"
|
||||
#include "../game/objectives.h"
|
||||
#include "../game/g_vehicles.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
extern vmCvar_t cg_debugHealthBars;
|
||||
|
||||
extern Vehicle_t *G_IsRidingVehicle( gentity_t *ent );
|
||||
|
||||
extern vr_client_info_t *vr;
|
||||
|
||||
void CG_DrawIconBackground(void);
|
||||
void CG_DrawMissionInformation( void );
|
||||
void CG_DrawInventorySelect( void );
|
||||
|
@ -4247,21 +4250,24 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
VectorNormalize( vright_n );
|
||||
VectorNormalize( vup_n );
|
||||
|
||||
cg.refdef.stereoView = stereoView;
|
||||
switch ( stereoView ) {
|
||||
case STEREO_CENTER:
|
||||
separation = 0;
|
||||
break;
|
||||
case STEREO_LEFT:
|
||||
separation = -cg_stereoSeparation.value / 2;
|
||||
separation = cg_worldScale.value * (-cg_stereoSeparation.value / 2);
|
||||
break;
|
||||
case STEREO_RIGHT:
|
||||
separation = cg_stereoSeparation.value / 2;
|
||||
separation = cg_worldScale.value * (cg_stereoSeparation.value / 2);
|
||||
break;
|
||||
default:
|
||||
separation = 0;
|
||||
CG_Error( "CG_DrawActive: Undefined stereoView" );
|
||||
}
|
||||
|
||||
cg.refdef.worldscale = cg_worldScale.value;
|
||||
VectorCopy(cg.refdefViewAngles, cg.refdef.viewangles);
|
||||
|
||||
// clear around the rendered view if sized down
|
||||
CG_TileClear();
|
||||
|
@ -4277,6 +4283,10 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
cgi_R_LAGoggles();
|
||||
}
|
||||
|
||||
//Vertical Positional Movement
|
||||
cg.refdef.vieworg[2] -= 64;
|
||||
cg.refdef.vieworg[2] += (vr->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
|
||||
|
||||
if ( (cg.snap->ps.forcePowersActive&(1<<FP_SEE)) )
|
||||
{
|
||||
cg.refdef.rdflags |= RDF_ForceSightOn;
|
||||
|
|
|
@ -627,6 +627,8 @@ extern vmCvar_t cg_thirdPersonTargetDamp;
|
|||
extern vmCvar_t cg_gunAutoFirst;
|
||||
|
||||
extern vmCvar_t cg_stereoSeparation;
|
||||
extern vmCvar_t cg_worldScale;
|
||||
extern vmCvar_t cg_heightAdjust;
|
||||
extern vmCvar_t cg_developer;
|
||||
extern vmCvar_t cg_timescale;
|
||||
extern vmCvar_t cg_skippingcin;
|
||||
|
|
|
@ -30,6 +30,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../qcommon/sstring.h"
|
||||
#include "qcommon/ojk_saved_game_helper.h"
|
||||
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
//NOTENOTE: Be sure to change the mirrored code in g_shared.h
|
||||
typedef std::map< sstring_t, unsigned char > namePrecache_m;
|
||||
extern namePrecache_m *as_preCacheMap;
|
||||
|
@ -86,6 +88,8 @@ const char *inv_names[] =
|
|||
|
||||
int force_icons[NUM_FORCE_POWERS];
|
||||
|
||||
extern vr_client_info_t *vr;
|
||||
|
||||
|
||||
void CG_DrawDataPadHUD( centity_t *cent );
|
||||
void CG_DrawDataPadObjectives(const centity_t *cent );
|
||||
|
@ -105,8 +109,10 @@ extern "C" Q_EXPORT intptr_t QDECL vmMain( intptr_t command, intptr_t arg0, intp
|
|||
centity_t *cent;
|
||||
|
||||
switch ( command ) {
|
||||
case CG_INIT:
|
||||
case CG_INIT: {
|
||||
vr = (vr_client_info_t *) (arg1);
|
||||
CG_Init(arg0);
|
||||
}
|
||||
return 0;
|
||||
case CG_SHUTDOWN:
|
||||
CG_Shutdown();
|
||||
|
@ -227,6 +233,8 @@ int cg_numpermanents = 0;
|
|||
weaponInfo_t cg_weapons[MAX_WEAPONS];
|
||||
itemInfo_t cg_items[MAX_ITEMS];
|
||||
|
||||
vr_client_info_t *vr;
|
||||
|
||||
typedef struct {
|
||||
qboolean registered; // Has the player picked it up
|
||||
qboolean active; // Is it the chosen inventory item
|
||||
|
@ -306,6 +314,8 @@ vmCvar_t cg_thirdPersonAutoAlpha;
|
|||
vmCvar_t cg_thirdPersonHorzOffset;
|
||||
|
||||
vmCvar_t cg_stereoSeparation;
|
||||
vmCvar_t cg_worldScale;
|
||||
vmCvar_t cg_heightAdjust;
|
||||
vmCvar_t cg_developer;
|
||||
vmCvar_t cg_timescale;
|
||||
vmCvar_t cg_skippingcin;
|
||||
|
@ -353,7 +363,9 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE },
|
||||
{ &cg_fov, "cg_fov", "80", CVAR_ARCHIVE },
|
||||
{ &cg_fovAspectAdjust, "cg_fovAspectAdjust", "0", CVAR_ARCHIVE },
|
||||
{ &cg_stereoSeparation, "cg_stereoSeparation", "0.4", CVAR_ARCHIVE },
|
||||
{ &cg_stereoSeparation, "cg_stereoSeparation", "0.065", CVAR_ARCHIVE },
|
||||
{ &cg_worldScale, "cg_worldScale", "37.5", CVAR_ARCHIVE },
|
||||
{ &cg_heightAdjust, "cg_heightAdjust", "0.0", CVAR_ARCHIVE },
|
||||
{ &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE },
|
||||
{ &cg_renderToTextureFX, "cg_renderToTextureFX", "1", CVAR_ARCHIVE },
|
||||
{ &cg_shadowCullDistance, "r_shadowRange", "1000", CVAR_ARCHIVE },
|
||||
|
@ -367,7 +379,7 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &cg_drawFPS, "cg_drawFPS", "0", CVAR_ARCHIVE },
|
||||
{ &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE },
|
||||
{ &cg_drawAmmoWarning, "cg_drawAmmoWarning", "1", CVAR_ARCHIVE },
|
||||
{ &cg_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE },
|
||||
{ &cg_drawCrosshair, "cg_drawCrosshair", "0", CVAR_ARCHIVE },
|
||||
{ &cg_dynamicCrosshair, "cg_dynamicCrosshair", "1", CVAR_ARCHIVE },
|
||||
// NOTE : I also create this in UI_Init()
|
||||
{ &cg_crosshairIdentifyTarget, "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE },
|
||||
|
|
|
@ -31,12 +31,16 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "FxScheduler.h"
|
||||
#include "../game/wp_saber.h"
|
||||
#include "../game/g_vehicles.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
#define MASK_CAMERACLIP (MASK_SOLID)
|
||||
#define CAMERA_SIZE 4
|
||||
|
||||
float cg_zoomFov;
|
||||
|
||||
extern vr_client_info_t *vr;
|
||||
|
||||
|
||||
//#define CG_CAM_ABOVE 2
|
||||
extern qboolean CG_OnMovingPlat( playerState_t *ps );
|
||||
extern Vehicle_t *G_IsRidingVehicle( gentity_t *ent );
|
||||
|
@ -1362,7 +1366,8 @@ static qboolean CG_CalcFov( void ) {
|
|||
if ( &g_entities[cg.snap->ps.viewEntity] &&
|
||||
g_entities[cg.snap->ps.viewEntity].NPC )
|
||||
{//FIXME: looks bad when take over a jedi... but never really do that, do we?
|
||||
fov_x = g_entities[cg.snap->ps.viewEntity].NPC->stats.hfov;
|
||||
//fov_x = g_entities[cg.snap->ps.viewEntity].NPC->stats.hfov;
|
||||
fov_x = vr ? vr->fov : 90.0f;
|
||||
//sanity-cap?
|
||||
if ( fov_x > 120 )
|
||||
{
|
||||
|
@ -1381,14 +1386,17 @@ static qboolean CG_CalcFov( void ) {
|
|||
}
|
||||
else
|
||||
{
|
||||
fov_x = 120;//FIXME: read from the NPC's fov stats?
|
||||
//fov_x = 120;//FIXME: read from the NPC's fov stats?
|
||||
fov_x = vr ? vr->fov : 90.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( (!cg.zoomMode || cg.zoomMode > 2) && (cg.snap->ps.forcePowersActive&(1<<FP_SPEED)) && player->client->ps.forcePowerDuration[FP_SPEED] )//cg.renderingThirdPerson &&
|
||||
{
|
||||
fov_x = CG_ForceSpeedFOV();
|
||||
//fov_x = CG_ForceSpeedFOV();
|
||||
fov_x = vr ? vr->fov : 90.0f;
|
||||
} else {
|
||||
/*
|
||||
// user selectable
|
||||
if ( cg.overrides.active & CG_OVERRIDE_FOV )
|
||||
{
|
||||
|
@ -1402,7 +1410,9 @@ static qboolean CG_CalcFov( void ) {
|
|||
fov_x = 1;
|
||||
} else if ( fov_x > 160 ) {
|
||||
fov_x = 160;
|
||||
}
|
||||
}*/
|
||||
|
||||
fov_x = vr ? vr->fov : 90.0f;
|
||||
|
||||
// Disable zooming when in third person
|
||||
if ( cg.zoomMode && cg.zoomMode < 3 )//&& !cg.renderingThirdPerson ) // light amp goggles do none of the zoom silliness
|
||||
|
|
|
@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
// leave this as first line for PCH reasons...
|
||||
//
|
||||
#include <JKVR/VrCommon.h>
|
||||
#include "../server/exe_headers.h"
|
||||
#include "../ui/ui_shared.h"
|
||||
|
||||
|
@ -1404,7 +1405,7 @@ void CL_InitCGame( void ) {
|
|||
cls.state = CA_LOADING;
|
||||
|
||||
// init for this gamestate
|
||||
VM_Call( CG_INIT, clc.serverCommandSequence );
|
||||
VM_Call( CG_INIT, clc.serverCommandSequence, (intptr_t)&vr );
|
||||
|
||||
// reset any CVAR_CHEAT cvars registered by cgame
|
||||
if ( !cl_connectedToCheatServer )
|
||||
|
|
|
@ -182,12 +182,21 @@ Ghoul2 Insert End
|
|||
#define MAX_RENDER_STRINGS 8
|
||||
#define MAX_RENDER_STRING_LENGTH 32
|
||||
|
||||
|
||||
typedef enum {
|
||||
STEREO_CENTER,
|
||||
STEREO_LEFT,
|
||||
STEREO_RIGHT
|
||||
} stereoFrame_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int x, y, width, height;
|
||||
float fov_x, fov_y;
|
||||
vec3_t vieworg;
|
||||
vec3_t viewaxis[3]; // transformation matrix
|
||||
int viewContents; // world contents at vieworg
|
||||
vec3_t viewangles;
|
||||
|
||||
// time in milliseconds for shader effects and other time dependent rendering issues
|
||||
int time;
|
||||
|
@ -199,15 +208,11 @@ typedef struct {
|
|||
|
||||
// text messages for deform text shaders
|
||||
// char text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH];
|
||||
stereoFrame_t stereoView;
|
||||
float worldscale;
|
||||
} refdef_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
STEREO_CENTER,
|
||||
STEREO_LEFT,
|
||||
STEREO_RIGHT
|
||||
} stereoFrame_t;
|
||||
|
||||
|
||||
/*
|
||||
** glconfig_t
|
||||
|
|
Loading…
Reference in a new issue