Changes WIP

This commit is contained in:
Simon 2020-03-02 22:29:20 +00:00
parent a562866933
commit ad38c4fbdb
11 changed files with 138 additions and 49 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.qzdoom" package="com.drbeef.qzdoom"
android:versionCode="11" android:versionCode="1"
android:versionName="1.0.0" android:installLocation="auto" > android:versionName="0.0.1" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. --> <!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/> <uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -883,7 +883,7 @@ void getVROrigins(vec3_t _weaponoffset, vec3_t _weaponangles, vec3_t _hmdPositio
} }
void D_DoomMain (void); void VR_DoomMain(int argc, char** argv);
void VR_GetMove( float *forward, float *side, float *up, float *yaw, float *pitch, float *roll ) void VR_GetMove( float *forward, float *side, float *up, float *yaw, float *pitch, float *roll )
{ {
@ -1533,7 +1533,7 @@ void * AppThreadFunction(void * parm ) {
} }
//Should now be all set up and ready - start the Doom main loop //Should now be all set up and ready - start the Doom main loop
D_DoomMain(); VR_DoomMain(argc, argv);
//We are done, shutdown cleanly //We are done, shutdown cleanly
shutdownVR(); shutdownVR();

View file

@ -2339,7 +2339,14 @@ static void CheckCmdLine()
// //
//========================================================================== //==========================================================================
void D_DoomMain (void) void VR_DoomMain(int argc, char** argv)
{
Args = new FArgs(argc, argv);
C_InitConsole (80*8, 25*8, false);
D_DoomMain ();
}
void D_DoomMain ()
{ {
int p; int p;
const char *v; const char *v;

View file

@ -45,7 +45,9 @@ struct CRestartException
char dummy; char dummy;
}; };
extern "C" void D_DoomMain (void);
extern "C" void VR_DoomMain(int argc, char** argv);
void D_DoomMain (void);
void D_Display (); void D_Display ();

View file

@ -54,6 +54,16 @@ EXTERN_CVAR (Bool, r_drawplayersprites)
EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Float, transsouls)
EXTERN_CVAR(Int, gl_fuzztype) EXTERN_CVAR(Int, gl_fuzztype)
EXTERN_CVAR (Bool, r_deathcamera) EXTERN_CVAR (Bool, r_deathcamera)
EXTERN_CVAR(Int, r_PlayerSprites3DMode)
EXTERN_CVAR(Float, gl_fatItemWidth)
enum PlayerSprites3DMode
{
CROSSED,
BACK_ONLY,
ITEM_ONLY,
FAT_ITEM,
};
//========================================================================== //==========================================================================
@ -111,6 +121,7 @@ void GLSceneDrawer::DrawPSprite (player_t * player,DPSprite *psp, float sx, floa
// killough 12/98: fix psprite positioning problem // killough 12/98: fix psprite positioning problem
ftexturemid = 100.f - sy - r.top - psp->GetYAdjust(screenblocks >= 11); ftexturemid = 100.f - sy - r.top - psp->GetYAdjust(screenblocks >= 11);
AActor * wi=player->ReadyWeapon;
scale = (SCREENHEIGHT*vw) / (SCREENWIDTH * 200.0f); scale = (SCREENHEIGHT*vw) / (SCREENWIDTH * 200.0f);
y1 = viewwindowy + vh / 2 - (ftexturemid * scale); y1 = viewwindowy + vh / 2 - (ftexturemid * scale);
y2 = y1 + (r.height * scale) + 1; y2 = y1 + (r.height * scale) + 1;
@ -132,17 +143,103 @@ void GLSceneDrawer::DrawPSprite (player_t * player,DPSprite *psp, float sx, floa
} }
if (tex->GetTransparent() || OverrideShader != -1) if ((tex->GetTransparent() || OverrideShader != -1) && !s3d::Stereo3DMode::getCurrentMode().RenderPlayerSpritesCrossed())
{ {
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f); gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
} }
gl_RenderState.Apply(); gl_RenderState.Apply();
if (r_PlayerSprites3DMode != ITEM_ONLY && r_PlayerSprites3DMode != FAT_ITEM)
{
FQuadDrawer qd; FQuadDrawer qd;
qd.Set(0, x1, y1, 0, fU1, fV1); qd.Set(0, x1, y1, 0, fU1, fV1);
qd.Set(1, x1, y2, 0, fU1, fV2); qd.Set(1, x1, y2, 0, fU1, fV2);
qd.Set(2, x2, y1, 0, fU2, fV1); qd.Set(2, x2, y1, 0, fU2, fV1);
qd.Set(3, x2, y2, 0, fU2, fV2); qd.Set(3, x2, y2, 0, fU2, fV2);
qd.Render(GL_TRIANGLE_STRIP); qd.Render(GL_TRIANGLE_STRIP);
}
if (psp->GetID() == PSP_WEAPON && s3d::Stereo3DMode::getCurrentMode().RenderPlayerSpritesCrossed())
{
if (r_PlayerSprites3DMode == BACK_ONLY)
return;
FState* spawn = wi->FindState(NAME_Spawn);
lump = sprites[spawn->sprite].GetSpriteFrame(0, 0, 0., &mirror);
if (!lump.isValid()) return;
tex = FMaterial::ValidateTexture(lump, true, false);
if (!tex) return;
gl_RenderState.SetMaterial(tex, CLAMP_XY_NOMIP, 0, OverrideShader, alphatexture);
float z1 = 0.0f;
float z2 = (y2 - y1) * MIN(3, tex->GetWidth() / tex->GetHeight());
if (!(mirror) != !(psp->Flags & PSPF_FLIP))
{
fU2 = tex->GetSpriteUL();
fV1 = tex->GetSpriteVT();
fU1 = tex->GetSpriteUR();
fV2 = tex->GetSpriteVB();
}
else
{
fU1 = tex->GetSpriteUL();
fV1 = tex->GetSpriteVT();
fU2 = tex->GetSpriteUR();
fV2 = tex->GetSpriteVB();
}
if (r_PlayerSprites3DMode == FAT_ITEM)
{
x1 = vw / 2 + (x1 - vw / 2) * gl_fatItemWidth;
x2 = vw / 2 + (x2 - vw / 2) * gl_fatItemWidth;
for (float x = x1; x < x2; x += 1)
{
FQuadDrawer qd2;
qd2.Set(0, x, y1, -z1, fU1, fV1);
qd2.Set(1, x, y2, -z1, fU1, fV2);
qd2.Set(2, x, y1, -z2, fU2, fV1);
qd2.Set(3, x, y2, -z2, fU2, fV2);
qd2.Render(GL_TRIANGLE_STRIP);
}
}
else
{
float crossAt;
if (r_PlayerSprites3DMode == ITEM_ONLY)
{
crossAt = 0.0f;
sy = 0.0f;
}
else
{
sy = y2 - y1;
crossAt = sy * 0.25f;
}
y1 -= crossAt;
y2 -= crossAt;
FQuadDrawer qd2;
qd2.Set(0, vw / 2 - crossAt, y1, -z1, fU1, fV1);
qd2.Set(1, vw / 2 + sy / 2, y2, -z1, fU1, fV2);
qd2.Set(2, vw / 2 - crossAt, y1, -z2, fU2, fV1);
qd2.Set(3, vw / 2 + sy / 2, y2, -z2, fU2, fV2);
qd2.Render(GL_TRIANGLE_STRIP);
FQuadDrawer qd3;
qd3.Set(0, vw / 2 + crossAt, y1, -z1, fU1, fV1);
qd3.Set(1, vw / 2 - sy / 2, y2, -z1, fU1, fV2);
qd3.Set(2, vw / 2 + crossAt, y1, -z2, fU2, fV1);
qd3.Set(3, vw / 2 - sy / 2, y2, -z2, fU2, fV2);
qd3.Render(GL_TRIANGLE_STRIP);
}
}
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.5f); gl_RenderState.AlphaFunc(GL_GEQUAL, 0.5f);
} }
@ -218,8 +315,6 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
AActor * playermo=players[consoleplayer].camera; AActor * playermo=players[consoleplayer].camera;
player_t * player=playermo->player; player_t * player=playermo->player;
s3d::Stereo3DMode::getCurrentMode().AdjustPlayerSprites();
AActor *camera = r_viewpoint.camera; AActor *camera = r_viewpoint.camera;
// this is the same as the software renderer // this is the same as the software renderer
@ -230,6 +325,11 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
(r_deathcamera && camera->health <= 0)) (r_deathcamera && camera->health <= 0))
return; return;
if (!hudModelStep)
{
s3d::Stereo3DMode::getCurrentMode().AdjustPlayerSprites();
}
float bobx, boby, wx, wy; float bobx, boby, wx, wy;
DPSprite *weapon; DPSprite *weapon;
@ -482,11 +582,17 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
DrawPSprite(player, psp, sx, sy, hudModelStep, OverrideShader, !!(RenderStyle.Flags & STYLEF_RedIsAlpha)); DrawPSprite(player, psp, sx, sy, hudModelStep, OverrideShader, !!(RenderStyle.Flags & STYLEF_RedIsAlpha));
} }
} }
gl_RenderState.SetObjectColor(0xffffffff); gl_RenderState.SetObjectColor(0xffffffff);
gl_RenderState.SetAddColor(0); gl_RenderState.SetAddColor(0);
gl_RenderState.SetDynLight(0, 0, 0); gl_RenderState.SetDynLight(0, 0, 0);
gl_RenderState.EnableBrightmap(false); gl_RenderState.EnableBrightmap(false);
glset.lightmode = oldlightmode; glset.lightmode = oldlightmode;
if (!hudModelStep)
{
s3d::Stereo3DMode::getCurrentMode().UnAdjustPlayerSprites();
}
} }
//========================================================================== //==========================================================================

View file

@ -123,25 +123,11 @@ namespace s3d
/* virtual */ /* virtual */
VSMatrix OculusQuestEyePose::GetProjection(FLOATTYPE fov, FLOATTYPE aspectRatio, FLOATTYPE fovRatio) const VSMatrix OculusQuestEyePose::GetProjection(FLOATTYPE fov, FLOATTYPE aspectRatio, FLOATTYPE fovRatio) const
{ {
// Ignore those arguments and get the projection from the SDK return EyePose::GetProjection(fov, aspectRatio, fovRatio);
// VSMatrix vs1 = ShiftedEyePose::GetProjection(fov, aspectRatio, fovRatio);
return projectionMatrix;
} }
void OculusQuestEyePose::initialize() void OculusQuestEyePose::initialize()
{ {
float zNear = 5.0;
float zFar = 65536.0;
/* HmdMatrix44_t projection = vrsystem->GetProjectionMatrix(
EVREye(eye), zNear, zFar);
HmdMatrix44_t proj_transpose;
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
proj_transpose.m[i][j] = projection.m[j][i];
}
}*/
projectionMatrix.loadIdentity();
//projectionMatrix.multMatrix(&proj_transpose.m[0][0]);
} }
void OculusQuestEyePose::dispose() void OculusQuestEyePose::dispose()
@ -212,9 +198,9 @@ namespace s3d
new_projection.translate(-1.0, 1.0, 0); new_projection.translate(-1.0, 1.0, 0);
new_projection.scale(2.0 / SCREENWIDTH, -2.0 / SCREENHEIGHT, -1.0); new_projection.scale(2.0 / SCREENWIDTH, -2.0 / SCREENHEIGHT, -1.0);
VSMatrix proj(activeEye->projectionMatrix); // VSMatrix proj(activeEye->projectionMatrix);
proj.multMatrix(new_projection); // proj.multMatrix(new_projection);
new_projection = proj; // new_projection = proj;
return new_projection; return new_projection;
} }

View file

@ -57,10 +57,6 @@ public:
bool submitFrame() const; bool submitFrame() const;
protected: protected:
VSMatrix projectionMatrix;
VSMatrix eyeToHeadTransform;
VSMatrix otherEyeToHeadTransform;
mutable uint32_t framebuffer; mutable uint32_t framebuffer;
int eye; int eye;

View file

@ -126,7 +126,7 @@ ColorSetList ColorSets;
PainFlashList PainFlashes; PainFlashList PainFlashes;
// [Nash] FOV cvar setting // [Nash] FOV cvar setting
CUSTOM_CVAR(Float, fov, 90.f, CVAR_ARCHIVE | CVAR_USERINFO | CVAR_NOINITCALL) CUSTOM_CVAR(Float, fov, 104.f, CVAR_ARCHIVE | CVAR_USERINFO | CVAR_NOINITCALL)
{ {
player_t *p = &players[consoleplayer]; player_t *p = &players[consoleplayer];
p->SetFOV(fov); p->SetFOV(fov);

View file

@ -104,6 +104,8 @@ CVAR (Bool, r_deathcamera, false, CVAR_ARCHIVE)
CVAR (Int, r_clearbuffer, 0, 0) CVAR (Int, r_clearbuffer, 0, 0)
CVAR (Bool, r_drawvoxels, true, 0) CVAR (Bool, r_drawvoxels, true, 0)
CVAR (Bool, r_drawplayersprites, true, 0) // [RH] Draw player sprites? CVAR (Bool, r_drawplayersprites, true, 0) // [RH] Draw player sprites?
CVAR(Int, r_PlayerSprites3DMode, 0, CVAR_ARCHIVE);
CVAR(Float, gl_fatItemWidth, 0.5f, CVAR_ARCHIVE);
CUSTOM_CVAR(Float, r_quakeintensity, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CUSTOM_CVAR(Float, r_quakeintensity, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
{ {
if (self < 0.f) self = 0.f; if (self < 0.f) self = 0.f;

1
assets/commandline.txt Normal file
View file

@ -0,0 +1 @@
qzdoom --supersampling 1.4 -iwad freedom2.wad

View file

@ -161,17 +161,6 @@ import static android.system.Os.setenv;
public void create() public void create()
{ {
//This will copy the shareware version of quake2 if user doesn't have anything installed
/* copy_asset("/sdcard/QzDoom", "pak0.pak");
copy_asset("/sdcard/QzDoom", "config.cfg");
copy_asset("/sdcard/QzDoom", "autoexec.cfg");
//The custom weapon PAK file
copy_asset("/sdcard/QzDoom", "pak6.pak");
copy_asset("/sdcard/QzDoom", "pak99.pak");
*/
copy_asset("/sdcard/QzDoom", "commandline.txt"); copy_asset("/sdcard/QzDoom", "commandline.txt");
//Read these from a file and pass through //Read these from a file and pass through