mirror of
https://github.com/DrBeef/QuestZDoom.git
synced 2024-11-10 15:01:48 +00:00
VR Options Menu
This commit is contained in:
parent
73a2946a31
commit
d1f2ecb88a
9 changed files with 72 additions and 85 deletions
|
@ -57,7 +57,7 @@ vec3_t weaponangles;
|
|||
vec3_t weaponoffset;
|
||||
bool weaponStabilised;
|
||||
float vr_weapon_pitchadjust;
|
||||
bool vr_walkdirection;
|
||||
bool vr_moveuseoffhand;
|
||||
float vr_snapturn_angle;
|
||||
vec3_t offhandangles;
|
||||
vec3_t offhandoffset;
|
||||
|
|
|
@ -49,7 +49,7 @@ extern vec3_t weaponoffset;
|
|||
|
||||
extern bool weaponStabilised;
|
||||
extern float vr_weapon_pitchadjust;
|
||||
extern bool vr_walkdirection;
|
||||
extern bool vr_moveuseoffhand;
|
||||
extern float vr_snapturn_angle;
|
||||
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
vec3_t rotation = {0};
|
||||
QuatToYawPitchRoll(pOffTracking->HeadPose.Pose.Orientation, rotation, offhandangles);
|
||||
|
||||
if (vr_walkdirection == 0) {
|
||||
if (vr_moveuseoffhand != 0) {
|
||||
controllerYawHeading = offhandangles[YAW] - hmdorientation[YAW];
|
||||
}
|
||||
else
|
||||
|
|
|
@ -57,16 +57,23 @@ EXTERN_CVAR(Float, movebob);
|
|||
EXTERN_CVAR(Bool, gl_billboard_faces_camera);
|
||||
EXTERN_CVAR(Int, gl_multisample);
|
||||
EXTERN_CVAR(Float, vr_vunits_per_meter)
|
||||
EXTERN_CVAR(Float, vr_floor_offset)
|
||||
EXTERN_CVAR(Float, vr_height_adjust)
|
||||
|
||||
EXTERN_CVAR(Int, vr_control_scheme)
|
||||
EXTERN_CVAR(Bool, vr_moveFollowsOffHand)
|
||||
EXTERN_CVAR(Bool, vr_move_use_offhand)
|
||||
EXTERN_CVAR(Float, vr_weaponRotate);
|
||||
EXTERN_CVAR(Float, vr_snapTurn);
|
||||
EXTERN_CVAR(Float, vr_ipd);
|
||||
EXTERN_CVAR(Float, vr_weaponScale);
|
||||
EXTERN_CVAR(Bool, vr_teleport);
|
||||
|
||||
//HUD control
|
||||
EXTERN_CVAR(Float, vr_hud_scale);
|
||||
EXTERN_CVAR(Float, vr_hud_stereo);
|
||||
EXTERN_CVAR(Float, vr_hud_rotate);
|
||||
EXTERN_CVAR(Bool, vr_hud_fixed_pitch);
|
||||
EXTERN_CVAR(Bool, vr_hud_fixed_roll);
|
||||
|
||||
double P_XYMovement(AActor *mo, DVector2 scroll);
|
||||
extern "C" void VR_GetMove( float *joy_forward, float *joy_side, float *hmd_forward, float *hmd_side, float *up, float *yaw, float *pitch, float *roll );
|
||||
void I_Quit();
|
||||
|
@ -113,7 +120,7 @@ namespace s3d
|
|||
const player_t & player = players[consoleplayer];
|
||||
double vh = player.viewheight; // Doom thinks this is where you are
|
||||
double pixelstretch = level.info ? level.info->pixelstretch : 1.2;
|
||||
double hh = ((hmdPosition[1] - vr_floor_offset) * vr_vunits_per_meter) / pixelstretch; // HMD is actually here
|
||||
double hh = ((hmdPosition[1] + vr_height_adjust) * vr_vunits_per_meter) / pixelstretch; // HMD is actually here
|
||||
eyeOffset[2] += hh - vh;
|
||||
|
||||
outViewShift[0] = eyeOffset[0];
|
||||
|
@ -146,7 +153,7 @@ namespace s3d
|
|||
VSMatrix new_projection;
|
||||
new_projection.loadIdentity();
|
||||
|
||||
float stereo_separation = (vr_ipd * 0.5) * vr_vunits_per_meter * (eye == 1 ? -1.0 : 1.0);
|
||||
float stereo_separation = (vr_ipd * 0.5) * vr_vunits_per_meter * vr_hud_stereo * (eye == 1 ? -1.0 : 1.0);
|
||||
new_projection.translate(stereo_separation, 0, 0);
|
||||
|
||||
// doom_units from meters
|
||||
|
@ -157,27 +164,26 @@ namespace s3d
|
|||
double pixelstretch = level.info ? level.info->pixelstretch : 1.2;
|
||||
new_projection.scale(pixelstretch, pixelstretch, 1.0); // Doom universe is scaled by 1990s pixel aspect ratio
|
||||
|
||||
|
||||
// Follow HMD orientation, EXCEPT for roll angle (keep weapon upright)
|
||||
if (vr_hud_fixed_roll)
|
||||
{
|
||||
new_projection.rotate(-hmdorientation[ROLL], 0, 0, 1);
|
||||
}
|
||||
|
||||
{
|
||||
new_projection.rotate(-hmdorientation[PITCH], 1, 0, 0);
|
||||
}
|
||||
new_projection.rotate(vr_hud_rotate, 1, 0, 0);
|
||||
|
||||
new_projection.rotate(35, 1, 0, 0);
|
||||
if (vr_hud_fixed_pitch)
|
||||
{
|
||||
new_projection.rotate(-hmdorientation[PITCH], 1, 0, 0);
|
||||
}
|
||||
|
||||
// hmd coordinates (meters) from ndc coordinates
|
||||
// const float weapon_distance_meters = 0.55f;
|
||||
// const float weapon_width_meters = 0.3f;
|
||||
const float aspect = SCREENWIDTH / float(SCREENHEIGHT);
|
||||
new_projection.translate(0.0, 0.0, 1.0);
|
||||
new_projection.scale(
|
||||
-0.3,
|
||||
0.3,
|
||||
-0.3);
|
||||
-vr_hud_scale,
|
||||
vr_hud_scale,
|
||||
-vr_hud_scale);
|
||||
|
||||
// ndc coordinates from pixel coordinates
|
||||
new_projection.translate(-1.0, 1.0, 0);
|
||||
|
@ -292,8 +298,8 @@ namespace s3d
|
|||
|
||||
double pixelstretch = level.info ? level.info->pixelstretch : 1.2;
|
||||
if ((vr_control_scheme < 10 && hand == 1)
|
||||
|| (vr_control_scheme > 10 && hand == 0)) {
|
||||
mat->translate(-weaponoffset[0], (hmdPosition[1] + weaponoffset[1] - vr_floor_offset) / pixelstretch, weaponoffset[2]);
|
||||
|| (vr_control_scheme >= 10 && hand == 0)) {
|
||||
mat->translate(-weaponoffset[0], (hmdPosition[1] + weaponoffset[1] - vr_height_adjust) / pixelstretch, weaponoffset[2]);
|
||||
|
||||
mat->rotate(-90 + (doomYaw - hmdorientation[YAW]) + weaponangles[YAW], 0, 1, 0);
|
||||
mat->rotate(-weaponangles[PITCH], 1, 0, 0);
|
||||
|
@ -301,7 +307,7 @@ namespace s3d
|
|||
}
|
||||
else
|
||||
{
|
||||
mat->translate(-offhandoffset[0], (hmdPosition[1] + offhandoffset[1] - vr_floor_offset) / pixelstretch, offhandoffset[2]);
|
||||
mat->translate(-offhandoffset[0], (hmdPosition[1] + offhandoffset[1] - vr_height_adjust) / pixelstretch, offhandoffset[2]);
|
||||
|
||||
mat->rotate(-90 + (doomYaw - hmdorientation[YAW]) + offhandangles[YAW], 0, 1, 0);
|
||||
mat->rotate(-offhandangles[PITCH], 1, 0, 0);
|
||||
|
@ -417,7 +423,7 @@ namespace s3d
|
|||
//Set up stuff used in the tracking code
|
||||
vr_weapon_pitchadjust = vr_weaponRotate;
|
||||
vr_snapturn_angle = vr_snapTurn;
|
||||
vr_walkdirection = !vr_moveFollowsOffHand;
|
||||
vr_moveuseoffhand = !vr_move_use_offhand;
|
||||
QzDoom_getTrackedRemotesOrientation(vr_control_scheme);
|
||||
|
||||
//Some crazy stuff to ascertain the actual yaw that doom is using at the right times!
|
||||
|
@ -445,7 +451,7 @@ namespace s3d
|
|||
|
||||
player->mo->AttackPos.X = player->mo->X() - (weaponoffset[0] * vr_vunits_per_meter);
|
||||
player->mo->AttackPos.Y = player->mo->Y() - (weaponoffset[2] * vr_vunits_per_meter);
|
||||
player->mo->AttackPos.Z = player->mo->Z() + (((hmdPosition[1] + weaponoffset[1] + vr_floor_offset) * vr_vunits_per_meter) / pixelstretch);
|
||||
player->mo->AttackPos.Z = player->mo->Z() + (((hmdPosition[1] + weaponoffset[1] + vr_height_adjust) * vr_vunits_per_meter) / pixelstretch);
|
||||
|
||||
player->mo->AttackDir = MapAttackDir;
|
||||
}
|
||||
|
@ -457,7 +463,7 @@ namespace s3d
|
|||
FLineTraceData trace;
|
||||
if (trigger_teleport &&
|
||||
P_LineTrace(player->mo, yaw, 8192, pitch, TRF_ABSOFFSET,
|
||||
((hmdPosition[1] + weaponoffset[1] + vr_floor_offset) * vr_vunits_per_meter) / pixelstretch,
|
||||
((hmdPosition[1] + weaponoffset[1] + vr_height_adjust) * vr_vunits_per_meter) / pixelstretch,
|
||||
-(weaponoffset[2] * vr_vunits_per_meter),
|
||||
-(weaponoffset[0] * vr_vunits_per_meter), &trace) &&
|
||||
trace.HitType == TRACE_HitFloor) {
|
||||
|
|
|
@ -57,21 +57,21 @@ CVAR(Float, vr_screendist, 0.80f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // METERS
|
|||
|
||||
// default conversion between (vertical) DOOM units and meters
|
||||
CVAR(Float, vr_vunits_per_meter, 30.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // METERS
|
||||
|
||||
CVAR(Float, vr_floor_offset, 0.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // METERS
|
||||
|
||||
CVAR(Float, vr_height_adjust, 0.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // METERS
|
||||
CVAR(Int, vr_control_scheme, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
CVAR(Bool, vr_moveFollowsOffHand, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
CVAR(Bool, vr_move_use_offhand, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, vr_teleport, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
CVAR(Float, vr_weaponRotate, -30, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
CVAR(Float, vr_weaponScale, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
CVAR(Float, vr_snapTurn, 45.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
//HUD control
|
||||
CVAR(Float, vr_hud_scale, 0.5f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Float, vr_hud_stereo, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Float, vr_hud_rotate, 35.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, vr_hud_fixed_pitch, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, vr_hud_fixed_roll, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
// Manage changing of 3D modes:
|
||||
namespace s3d {
|
||||
|
||||
|
|
|
@ -2320,20 +2320,6 @@ VIDMNU_ENTERTEXT = "Press ENTER to set mode";
|
|||
VIDMNU_TESTTEXT1 = "T to test mode for 5 seconds";
|
||||
VIDMNU_TESTTEXT2 = "Please wait 5 seconds...";
|
||||
|
||||
// VR Options
|
||||
VRMNU_TITLE = "VIDEO MODE";
|
||||
VRMNU_FULLSCREEN = "Fullscreen";
|
||||
VRMNU_HIDPI = "Retina/HiDPI support";
|
||||
VRMNU_BRDLSS = "Borderless Windowed Mode";
|
||||
VRMNU_ASPECTRATIO = "Aspect ratio";
|
||||
VRMNU_FORCEASPECT = "Force aspect ratio";
|
||||
VRMNU_CROPASPECT = "Forced ratio style";
|
||||
VRMNU_5X4ASPECTRATIO = "Enable 5:4 aspect ratio";
|
||||
VRMNU_SCALEMODE = "Resolution scale";
|
||||
VRMNU_SCALEFACTOR = "Scale Factor";
|
||||
VRMNU_ENTERTEXT = "Press ENTER to set mode";
|
||||
VRMNU_TESTTEXT1 = "T to test mode for 5 seconds";
|
||||
VRMNU_TESTTEXT2 = "Please wait 5 seconds...";
|
||||
|
||||
// Network Options
|
||||
NETMNU_TITLE = "NETWORK OPTIONS";
|
||||
|
|
|
@ -352,6 +352,7 @@ OptionMenu "OptionsMenu" protected
|
|||
Submenu "$OPTMNU_SOUND", "SoundOptions"
|
||||
Submenu "$OPTMNU_DISPLAY", "VideoOptions"
|
||||
Submenu "$OPTMNU_VIDEO", "VideoModeMenu"
|
||||
Submenu "VR Options", "VROptionsMenu"
|
||||
Submenu "$OPTMNU_CHANGERENDER", "RendererMenu"
|
||||
StaticText " "
|
||||
Submenu "$OS_TITLE", "os_Menu"
|
||||
|
@ -998,14 +999,6 @@ OptionMenu "HUDOptions" protected
|
|||
Submenu "$HUDMNU_FLASH", "FlashOptions"
|
||||
Submenu "$DSPLYMNU_SCOREBOARD", "ScoreboardOptions"
|
||||
StaticText " "
|
||||
Option "$HUDMNU_CROSSHAIRON", "crosshairon", "OnOff"
|
||||
Option "$HUDMNU_CROSSHAIR", "crosshair", "Crosshairs"
|
||||
Option "$HUDMNU_FORCECROSSHAIR", "crosshairforce", "OnOff"
|
||||
Option "$HUDMNU_GROWCROSSHAIR", "crosshairgrow", "OnOff"
|
||||
ColorPicker "$HUDMNU_CROSSHAIRCOLOR", "crosshaircolor"
|
||||
Option "$HUDMNU_CROSSHAIRHEALTH", "crosshairhealth", "CrosshairHealthTypes"
|
||||
Slider "$HUDMNU_CROSSHAIRSCALE", "crosshairscale", 0.0, 2.0, 0.05, 2
|
||||
StaticText " "
|
||||
Option "$HUDMNU_NAMETAGS", "displaynametags", "DisplayTagsTypes"
|
||||
Option "$HUDMNU_NAMETAGCOLOR", "nametagcolor", "TextColors", "displaynametags"
|
||||
Option "$HUDMNU_OLDOUCH", "st_oldouch", "OnOff"
|
||||
|
@ -2271,35 +2264,37 @@ OptionMenu VideoModeMenu protected
|
|||
*=======================================*/
|
||||
|
||||
|
||||
OptionValue ControlScheme
|
||||
{
|
||||
0, "Right-Handed"
|
||||
10, "Left-Handed"
|
||||
}
|
||||
|
||||
OptionMenu VROptionsMenu protected
|
||||
{
|
||||
Title "$VRMNU_TITLE"
|
||||
Title "VR OPTIONS"
|
||||
|
||||
Option "$VRMNU_ASPECTRATIO", "menu_screenratios", "Ratios"
|
||||
Option "$VIDMNU_FORCEASPECT", "vid_aspect", "ForceRatios"
|
||||
Option "$VIDMNU_CROPASPECT", "vid_cropaspect", "CropAspect"
|
||||
Option "$VIDMNU_SCALEMODE", "vid_scalemode", "ScaleModes"
|
||||
Slider "$VIDMNU_SCALEFACTOR", "vid_scalefactor", 0.25, 2.0, 0.25, 2
|
||||
Slider "Height Adjust", "vr_height_adjust", 0.0, 1.0, 0.01, 2
|
||||
|
||||
StaticText " "
|
||||
Option "$DSPLYMNU_VSYNC", "vid_vsync", "OnOff"
|
||||
Option "$DSPLYMNU_CAPFPS", "cl_capfps", "OffOn"
|
||||
|
||||
Option "Control Scheme", "vr_control_scheme", "ControlScheme"
|
||||
Option "Off-hand Move Direction", "vr_move_use_offhand", "OffOn"
|
||||
Option "Use Teleport", "vr_teleport", "OnOff"
|
||||
Slider "Snap-turn Angle", "vr_snapTurn", 0.0, 90.0, 1.0, 2
|
||||
|
||||
StaticText " "
|
||||
ScreenResolution "res_0"
|
||||
ScreenResolution "res_1"
|
||||
ScreenResolution "res_2"
|
||||
ScreenResolution "res_3"
|
||||
ScreenResolution "res_4"
|
||||
ScreenResolution "res_5"
|
||||
ScreenResolution "res_6"
|
||||
ScreenResolution "res_7"
|
||||
ScreenResolution "res_8"
|
||||
ScreenResolution "res_9"
|
||||
StaticTextSwitchable "$VIDMNU_ENTERTEXT", "", "VMEnterText"
|
||||
Slider "Weapon Pitch Adjust", "vr_weaponRotate", -45, 45, 5, 2
|
||||
Slider "Weapon Scale", "vr_weaponScale", 0.1, 1.0, 0.01, 2
|
||||
|
||||
StaticText " "
|
||||
StaticTextSwitchable "$VIDMNU_TESTTEXT1", "$VIDMNU_TESTTEXT2", "VMTestText"
|
||||
class VideoModeMenu
|
||||
Option "Show VR HUD FPS", "vid_fps", "OnOff"
|
||||
|
||||
StaticText " "
|
||||
Slider "VR HUD Scale", "vr_hud_scale", 0.05, 1.0, 0.05, 2
|
||||
Slider "VR HUD Stereo", "vr_hud_stereo", 0.05, 2.0, 0.05, 2
|
||||
Slider "VR HUD Pitch Rotate", "vr_hud_rotate", 0.0, 50.0, 2.0, 2
|
||||
Option "VR HUD Fix Pitch", "vr_hud_fixed_pitch", "OnOff"
|
||||
Option "VR HUD Fix Roll", "vr_hud_fixed_roll", "OnOff"
|
||||
}
|
||||
|
||||
/*=======================================
|
||||
|
|
Binary file not shown.
|
@ -153,21 +153,21 @@ import android.support.v4.content.ContextCompat;
|
|||
|
||||
public void create()
|
||||
{
|
||||
copy_asset("/sdcard/QuestZDoom", "commandline.txt");
|
||||
copy_asset("/sdcard/QuestZDoom", "commandline.txt", false);
|
||||
|
||||
//Create all required folders
|
||||
new File("/sdcard/QuestZDoom/res").mkdirs();
|
||||
new File("/sdcard/QuestZDoom/mods").mkdirs();
|
||||
new File("/sdcard/QuestZDoom/audiopack/snd_fluidsynth").mkdirs();
|
||||
|
||||
copy_asset("/sdcard/QuestZDoom", "res/lzdoom.pk3");
|
||||
copy_asset("/sdcard/QuestZDoom", "res/lz_game_support.pk3");
|
||||
copy_asset("/sdcard/QuestZDoom", "res/lights.pk3");
|
||||
copy_asset("/sdcard/QuestZDoom", "res/brightmaps.pk3");
|
||||
copy_asset("/sdcard/QuestZDoom/audiopack", "snd_fluidsynth/fluidsynth.sf2");
|
||||
copy_asset("/sdcard/QuestZDoom", "res/lzdoom.pk3", true);
|
||||
copy_asset("/sdcard/QuestZDoom", "res/lz_game_support.pk3", true);
|
||||
copy_asset("/sdcard/QuestZDoom", "res/lights.pk3", true);
|
||||
copy_asset("/sdcard/QuestZDoom", "res/brightmaps.pk3", true);
|
||||
copy_asset("/sdcard/QuestZDoom/audiopack", "snd_fluidsynth/fluidsynth.sf2", false);
|
||||
|
||||
//Doom Sharware WAD
|
||||
copy_asset("/sdcard/QuestZDoom", "wads/DOOM1.WAD");
|
||||
copy_asset("/sdcard/QuestZDoom", "wads/DOOM1.WAD", false);
|
||||
|
||||
//Read these from a file and pass through
|
||||
commandLineParams = new String("doom");
|
||||
|
@ -197,9 +197,9 @@ import android.support.v4.content.ContextCompat;
|
|||
mNativeHandle = GLES3JNILib.onCreate( this, commandLineParams );
|
||||
}
|
||||
|
||||
public void copy_asset(String path, String name) {
|
||||
public void copy_asset(String path, String name, boolean force) {
|
||||
File f = new File(path + "/" + name);
|
||||
if (!f.exists()) {
|
||||
if (!f.exists() || force) {
|
||||
|
||||
//Ensure we have an appropriate folder
|
||||
String fullname = path + "/" + name;
|
||||
|
|
Loading…
Reference in a new issue