Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
  • Jisk/srb-2-beef-jerky
117 results
Select Git revision
Show changes
Commits on Source (3)
Showing
with 574 additions and 45 deletions
File added
File added
File added
File added
File added
File added
File added
File added
File added
......@@ -9,9 +9,11 @@ opts+=-DUNIXCOMMON -DLUA_USE_POSIX
# instead of addresses
libs+=-lm -rdynamic
ifndef NOHW
opts+=-I/usr/X11R6/include
libs+=-L/usr/X11R6/lib
#libs+=-L../../libs/openvr/libopenvr_api.so
endif
SDL?=1
......
......@@ -25,6 +25,30 @@ opts+=-DDIRECTFULLSCREEN -DHAVE_SDL
ifndef NOHW
sources+=sdl/ogl_sdl.c
sources+=openvr/openvr_common.c openvr/openvr_common.h openvr/openvr_capi.h
endif
#LINK OPENVR LIBRARIES TO SDL/OPENGL
libs+=-lopenvr_api
ifdef LINUX
ifdef LINUX64
ifdef ARM64
LDFLAGS+=-L../libs/openvr/linuxarm64
else
LDFLAGS+=-L../libs/openvr/linux64
endif
else
LDFLAGS+=-L../libs/openvr/linux32
endif
endif
ifdef MINGW
ifdef MINGW64
LDFLAGS+=-L../libs/openvr/win64
else
LDFLAGS+=-L../libs/openvr/win32
endif
endif
ifdef NOMIXER
......
......@@ -60,7 +60,7 @@ endif
ifdef GCC45
WFLAGS+=-Wlogical-op
endif
WFLAGS+=-Waggregate-return
#WFLAGS+=-Waggregate-return
ifdef HAIKU
ifdef GCC41
#WFLAGS+=-Wno-attributes
......
......@@ -81,6 +81,7 @@
#ifdef HWRENDER
#include "hardware/hw_main.h" // 3D View Rendering
#include "openvr/openvr_common.h"
#endif
#ifdef _WINDOWS
......@@ -695,6 +696,13 @@ static void D_Display(void)
I_FinishUpdate(); // page flip or blit buffer
PS_STOP_TIMING(ps_swaptime);
}
#ifdef HWRENDER
if(vrPendingErrorMessage[0])
{
CONS_Alert(CONS_ERROR, "%s", vrPendingErrorMessage);
vrPendingErrorMessage[0] = 0;
}
#endif
}
// =========================================================================
......
......@@ -76,6 +76,7 @@
#include "../r_state.h"
#include "../tables.h"
#include "r_opengl/r_opengl.h"
#include "../openvr/openvr_common.h"
#ifdef HAVE_SPHEREFRUSTRUM
static GLdouble viewMatrix[16];
......@@ -329,7 +330,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
// NEWCLIP TODO: SRB2CBTODO: make a global render_fov for this function
float render_fov = FIXED_TO_FLOAT(cv_fov.value);
float render_fov = FIXED_TO_FLOAT(openvr_started ? 120 * FRACUNIT : cv_fov.value);
float render_fovratio = (float)BASEVIDWIDTH / (float)BASEVIDHEIGHT; // SRB2CBTODO: NEWCLIPTODO: Is this right?
float render_multiplier = 64.0f / render_fovratio / RMUL;
......
......@@ -64,6 +64,11 @@ EXPORT void HWRAPI(DrawIntermissionBG) (void);
EXPORT void HWRAPI(MakeScreenTexture) (void);
EXPORT void HWRAPI(MakeScreenFinalTexture) (void);
EXPORT void HWRAPI(DrawScreenFinalTexture) (int width, int height);
EXPORT void HWRAPI(MakeViewTexture) (void);
EXPORT void HWRAPI(SetEye) (int);
EXPORT void HWRAPI(SubmitTextureToHMD) (void);
EXPORT void HWRAPI(ProjectUI)(int width, int height);
#define SCREENVERTS 10
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
......@@ -118,7 +123,8 @@ struct hwdriver_s
DrawIntermissionBG pfnDrawIntermissionBG;
MakeScreenTexture pfnMakeScreenTexture;
MakeScreenFinalTexture pfnMakeScreenFinalTexture;
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
MakeViewTexture pfnMakeViewTexture;
CompileShaders pfnCompileShaders;
CleanShaders pfnCleanShaders;
......@@ -127,6 +133,10 @@ struct hwdriver_s
SetShaderInfo pfnSetShaderInfo;
LoadCustomShader pfnLoadCustomShader;
SetEye pfnSetEye;
SubmitTextureToHMD pfnSubmitTextureToHMD;
ProjectUI pfnProjectUI;
};
extern struct hwdriver_s hwdriver;
......
......@@ -42,6 +42,7 @@
#include "../d_main.h"
#include "../p_slopes.h"
#include "hw_md2.h"
#include "../openvr/openvr_common.h"
#ifdef NEWCLIP
#include "hw_clip.h"
......@@ -172,6 +173,8 @@ boolean gl_maploaded = false;
boolean gl_sessioncommandsadded = false;
boolean gl_shadersavailable = true;
boolean is_drawing_sky = false;
// ==========================================================================
// Lighting
// ==========================================================================
......@@ -5876,6 +5879,8 @@ void HWR_BuildSkyDome(void)
static void HWR_DrawSkyBackground(player_t *player)
{
if(cv_vrcomfortmode.value) return;
HWD.pfnSetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
if (cv_glskydome.value)
......@@ -6039,6 +6044,15 @@ static inline void HWR_ClearView(void)
// HWD.pfnGClipRect(0, 0, vid.width, vid.height);
}
// -----------------+
// HWR_SetEye : set vr eye frame buffer
// -----------------+
void HWR_SetEye(int eye)
{
HWD.pfnSetEye(eye);
}
// -----------------+
// HWR_SetViewSize : set projection and scaling values
......@@ -6216,7 +6230,15 @@ void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player)
{
angle_t a1 = gld_FrustumAngle(gl_aimingangle);
gld_clipper_Clear();
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
// Modify the viewangle based on the HMD's look direction.
// Use atan2 to get the angle (in radians) from HMD pose,
// then normalize and multiply by ANGLE_MAX so the game can use it.
if(openvr_started && cv_vrspriterotate.value)
{
viewangle -= ANGLE_MAX * atan2(vrHMDPoseMatrix[8], vrHMDPoseMatrix[0]) / M_PI * 0.5;
}
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
#ifdef HAVE_SPHEREFRUSTRUM
gld_FrustrumSetup();
#endif
......@@ -6333,6 +6355,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
if (viewnumber == 0) // Only do it if it's the first screen being rendered
HWD.pfnClearBuffer(true, false, &ClearColor); // Clear the Color Buffer, stops HOMs. Also seems to fix the skybox issue on Intel GPUs.
is_drawing_sky = true;
PS_START_TIMING(ps_hw_skyboxtime);
if (skybox && drawsky) // If there's a skybox and we should be drawing the sky, draw the skybox
HWR_RenderSkyboxView(viewnumber, player); // This is drawn before everything else so it is placed behind
......@@ -6348,6 +6371,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
HWR_SetLights(viewnumber);
#endif
}
is_drawing_sky = false;
// note: sets viewangle, viewx, viewy, viewz
R_SetupFrame(player);
......@@ -6417,8 +6441,10 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
//------------------------------------------------------------------------
HWR_ClearView(); // Clears the depth buffer and resets the view I believe
is_drawing_sky = true;
if (!skybox && drawsky) // Don't draw the regular sky if there's a skybox
HWR_DrawSkyBackground(player);
is_drawing_sky = false;
//Hurdler: it doesn't work in splitscreen mode
drawsky = splitscreen;
......@@ -6432,10 +6458,17 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
{
angle_t a1 = gld_FrustumAngle(gl_aimingangle);
gld_clipper_Clear();
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
// Modify the viewangle based on the HMD's look direction.
// Use atan2 to get the angle (in radians) from HMD pose,
// then normalize and multiply by ANGLE_MAX so the game can use it.
if(openvr_started && cv_vrspriterotate.value)
{
viewangle -= ANGLE_MAX * atan2(vrHMDPoseMatrix[8], vrHMDPoseMatrix[0]) / M_PI * 0.5;
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
#ifdef HAVE_SPHEREFRUSTRUM
gld_FrustrumSetup();
gld_FrustrumSetup();
#endif
}
}
#else
HWR_ClearClipSegs();
......@@ -6535,6 +6568,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
// added by Hurdler for correct splitscreen
// moved here by hurdler so it works with the new near clipping plane
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE);
if(openvr_started) HWD.pfnMakeViewTexture();
}
void HWR_LoadLevel(void)
......@@ -6950,6 +6984,9 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
return;
HWR_GetFadeMask(wipelumpnum);
if(openvr_started)
openvr_compositor()->ClearLastSubmittedFrame();
HWD.pfnDoScreenWipe();
}
......@@ -6969,6 +7006,16 @@ void HWR_DrawScreenFinalTexture(int width, int height)
HWD.pfnDrawScreenFinalTexture(width, height);
}
void HWR_SubmitTextureToHMD(void)
{
HWD.pfnSubmitTextureToHMD();
}
void HWR_ProjectUI(int width, int height)
{
HWD.pfnProjectUI(width, height);
}
static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum)
{
UINT16 i;
......
......@@ -38,6 +38,7 @@ void HWR_BuildSkyDome(void);
void HWR_DrawViewBorder(INT32 clearlines);
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
void HWR_InitTextureMapping(void);
void HWR_SetEye(int eye);
void HWR_SetViewSize(void);
void HWR_DrawPatch(patch_t *gpatch, INT32 x, INT32 y, INT32 option);
void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap);
......@@ -75,6 +76,9 @@ FBITFIELD HWR_GetBlendModeFlag(INT32 style);
FBITFIELD HWR_SurfaceBlend(INT32 style, INT32 transtablenum, FSurfaceInfo *pSurf);
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
void HWR_SubmitTextureToHMD(void);
void HWR_ProjectUI(int width, int height);
boolean HWR_CompileShaders(void);
void HWR_LoadAllCustomShaders(void);
......
This diff is collapsed.
......@@ -51,6 +51,12 @@ void I_StartupGraphics(void);
/** \brief shutdown video mode
*/
void I_ShutdownGraphics(void);
#ifdef HWRENDER
void I_StartupVR(void);
void I_ChangeVRRenderSize(int mode);
void I_ChangeVRRenderScale(int mode);
void I_ShutdownVR(void);
#endif
/** \brief The I_SetPalette function
......
......@@ -326,7 +326,8 @@ static void M_VideoOptions(INT32 choice);
menu_t OP_VideoOptionsDef, OP_VideoModeDef, OP_ColorOptionsDef;
#ifdef HWRENDER
static void M_OpenGLOptionsMenu(void);
menu_t OP_OpenGLOptionsDef;
static void M_OpenVROptionsMenu(void);
menu_t OP_OpenGLOptionsDef, OP_VROptionsDef;
#ifdef ALAM_LIGHTING
menu_t OP_OpenGLLightingDef;
#endif // ALAM_LIGHTING
......@@ -1286,6 +1287,7 @@ enum
#endif
op_video_vsync,
op_video_renderer,
op_video_vr
};
static menuitem_t OP_VideoOptionsMenu[] =
......@@ -1342,8 +1344,9 @@ static menuitem_t OP_VideoOptionsMenu[] =
#ifdef HWRENDER
{IT_HEADER, NULL, "Renderer", NULL, 208},
{IT_CALL | IT_STRING, NULL, "OpenGL Options...", M_OpenGLOptionsMenu, 214},
{IT_STRING | IT_CVAR, NULL, "FPS Cap", &cv_fpscap, 219},
{IT_CALL | IT_STRING, NULL, "OpenGL Options...", M_OpenGLOptionsMenu, 214},
{IT_CALL | IT_STRING, NULL, "VR Options...", M_OpenVROptionsMenu, 219},
{IT_STRING | IT_CVAR, NULL, "FPS Cap", &cv_fpscap, 224},
#endif
};
......@@ -1394,6 +1397,20 @@ static menuitem_t OP_ColorOptionsMenu[] =
};
#ifdef HWRENDER
static menuitem_t OP_VROptionsMenu[] =
{
{IT_STRING | IT_CVAR, NULL, "Virtual Reality", &cv_vrenabled, 10},
{IT_STRING | IT_CVAR, NULL, "World Scale", &cv_vrscale, 30},
{IT_STRING | IT_CVAR, NULL, "Scale World With Player", &cv_vrplayerscale, 40},
{IT_STRING | IT_CVAR, NULL, "UI Distance", &cv_vruidistance, 50},
{IT_STRING | IT_CVAR, NULL, "UI Scale", &cv_vruiscale, 60},
{IT_STRING | IT_CVAR, NULL, "Rotate Sprites With HMD", &cv_vrspriterotate, 70},
{IT_STRING | IT_CVAR, NULL, "Desktop Render Mode", &cv_vrviewmode, 80},
{IT_STRING | IT_CVAR, NULL, "Lock Camera Forward", &cv_glshearing, 90},
{IT_STRING | IT_CVAR, NULL, "Disable Skybox Stereoscopy", &cv_vrdisableskystereo, 100},
{IT_STRING | IT_CVAR, NULL, "Disable Skyboxes", &cv_vrcomfortmode, 110}
};
static menuitem_t OP_OpenGLOptionsMenu[] =
{
{IT_HEADER, NULL, "3D Models", NULL, 0},
......@@ -1418,6 +1435,18 @@ static menuitem_t OP_OpenGLOptionsMenu[] =
#endif
};
static void M_OpenVROptionsMenu(void)
{
if (rendermode == render_opengl)
M_SetupNextMenu(&OP_VROptionsDef);
else
M_StartMessage(M_GetText("You must be in OpenGL mode\nto access this menu.\n\n(Press a key)\n"), NULL, MM_NOTHING);
}
menu_t OP_VROptionsDef = DEFAULTMENUSTYLE(
MTREE3(MN_OP_MAIN, MN_OP_VIDEO, MN_OP_OPENVR),
"M_VIDEO", OP_VROptionsMenu, &OP_VideoOptionsDef, 30, 30);
#ifdef ALAM_LIGHTING
static menuitem_t OP_OpenGLLightingMenu[] =
{
......@@ -3911,6 +3940,14 @@ void M_Init(void)
quitmsg[QUIT3MSG5] = M_GetText("You'll be back to play soon, though...\n......right?\n\n(Press 'Y' to quit)");
quitmsg[QUIT3MSG6] = M_GetText("Aww, is Egg Rock Zone too\ndifficult for you?\n\n(Press 'Y' to quit)");
#ifdef HWRENDER
// Permanently hide some options based on render mode
if (rendermode == render_soft)
{
OP_VideoOptionsMenu[op_video_vr].status = IT_DISABLED;
}
#endif
/*
Well the menu sucks for forcing us to have an item set
at all if every item just calls the same function, and
......