Strip WebVR support. Any new stuff should be using WebXR instead.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6087 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
15bd67c8f0
commit
f76fd58f3f
5 changed files with 27 additions and 147 deletions
|
@ -6458,10 +6458,6 @@ double Host_Frame (double time)
|
|||
extern cvar_t r_stereo_method;
|
||||
r_refdef.warndraw = false;
|
||||
r_refdef.stereomethod = r_stereo_method.ival;
|
||||
#ifdef FTE_TARGET_WEB
|
||||
if (emscriptenfte_getvrframedata())
|
||||
r_refdef.stereomethod = STEREO_WEBVR;
|
||||
#endif
|
||||
{
|
||||
RSpeedMark();
|
||||
vid.ime_allow = false;
|
||||
|
|
|
@ -223,10 +223,6 @@ typedef enum {
|
|||
STEREO_RED_GREEN,
|
||||
STEREO_CROSSEYED,
|
||||
|
||||
#ifdef FTE_TARGET_WEB
|
||||
STEREO_WEBVR,
|
||||
#endif
|
||||
|
||||
//these are internal methods and do not form part of any public API
|
||||
STEREO_LEFTONLY,
|
||||
STEREO_RIGHTONLY
|
||||
|
|
|
@ -1258,10 +1258,6 @@ static void V_CalcAFov(float afov, float *x, float *y, float w, float h)
|
|||
extern cvar_t scr_fov_mode;
|
||||
extern cvar_t r_stereo_separation;
|
||||
int mode = scr_fov_mode.ival;
|
||||
#ifdef FTE_TARGET_WEB
|
||||
if (r_refdef.stereomethod == STEREO_WEBVR)
|
||||
w *= 0.5;
|
||||
#endif
|
||||
if (r_refdef.stereomethod == STEREO_CROSSEYED && r_stereo_separation.value)
|
||||
w *= 0.5;
|
||||
|
||||
|
|
|
@ -544,11 +544,7 @@ static void R_SetupGL (vec3_t eyeangorg[2], vec4_t fovoverrides, float projmatri
|
|||
w = x2 - x;
|
||||
h = y2 - y;
|
||||
|
||||
/* if (r_refdef.stereomethod == STEREO_CROSSEYED
|
||||
#ifdef FTE_TARGET_WEB
|
||||
|| r_refdef.stereomethod == STEREO_WEBVR
|
||||
#endif
|
||||
)
|
||||
/* if (r_refdef.stereomethod == STEREO_CROSSEYED)
|
||||
{
|
||||
w /= 2;
|
||||
if (i)
|
||||
|
@ -858,22 +854,6 @@ static void R_RenderScene (void)
|
|||
R_SetupGL (NULL, NULL, NULL, NULL);
|
||||
R_RenderScene_Internal();
|
||||
}
|
||||
#ifdef FTE_TARGET_WEB
|
||||
else if (r_refdef.stereomethod == STEREO_WEBVR)
|
||||
{
|
||||
float projmatrix[16], eyematrix[16];
|
||||
GL_ForceDepthWritable();
|
||||
qglClear (GL_DEPTH_BUFFER_BIT);
|
||||
r_framecount++;
|
||||
|
||||
for (i = 0; i < stereoframes; i++)
|
||||
{
|
||||
emscriptenfte_getvreyedata(i, projmatrix, eyematrix);
|
||||
R_SetupGL (eyematrix, NULL, projmatrix, NULL);
|
||||
R_RenderScene_Internal();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else for (i = 0; i < stereoframes; i++)
|
||||
{
|
||||
r_refdef.colourmask = 0u;
|
||||
|
@ -910,11 +890,6 @@ static void R_RenderScene (void)
|
|||
else
|
||||
r_refdef.colourmask = (SBITS_MASK_RED|SBITS_MASK_BLUE);
|
||||
break;
|
||||
#ifdef FTE_TARGET_WEB
|
||||
case STEREO_WEBVR:
|
||||
stereooffset[i] = 0; //webgl overrides our separation.
|
||||
break;
|
||||
#endif
|
||||
case STEREO_CROSSEYED: //eyestrain
|
||||
break;
|
||||
case STEREO_LEFTONLY:
|
||||
|
|
|
@ -82,7 +82,8 @@ mergeInto(LibraryManager.library,
|
|||
loadfile:0,
|
||||
jbutton:0,
|
||||
jaxis:0,
|
||||
wantfullscreen:0
|
||||
wantfullscreen:0,
|
||||
frame:0
|
||||
},
|
||||
|
||||
loadurl : function(url, mime, arraybuf)
|
||||
|
@ -103,6 +104,26 @@ mergeInto(LibraryManager.library,
|
|||
}
|
||||
},
|
||||
|
||||
step : function(timestamp)
|
||||
{
|
||||
var dovsync = false;
|
||||
if (FTEC.aborted)
|
||||
return;
|
||||
|
||||
try //this try is needed to handle Host_EndGame properly.
|
||||
{
|
||||
dovsync = {{{makeDynCall('if')}}}(FTEC.evcb.frame,timestamp);
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
if (dovsync)
|
||||
Browser.requestAnimationFrame(FTEC.step);
|
||||
else
|
||||
setTimeout(FTEC.step, 0, performance.now());
|
||||
},
|
||||
|
||||
handleevent : function(event)
|
||||
{
|
||||
switch(event.type)
|
||||
|
@ -158,12 +179,6 @@ mergeInto(LibraryManager.library,
|
|||
FTEC.pointerislocked = -1; //don't repeat the request on every click. firefox has a fit at that, so require the mouse to leave the element or something before we retry.
|
||||
Module['canvas'].requestPointerLock({unadjustedMovement: true});
|
||||
}
|
||||
|
||||
if (FTEC.usevr)
|
||||
if (FTEC.vrDisplay)
|
||||
if (!FTEC.vrDisplay.isPresenting)
|
||||
FTEC.vrDisplay.requestPresent([{ source: Module['canvas'] }]).then(function (){console.log("zomg, presenting!");}, function (err){FTEC.usevr = false;console.log("cannot vrdisplay!");});
|
||||
|
||||
//fallthrough
|
||||
case 'mouseup':
|
||||
if (FTEC.evcb.button != 0)
|
||||
|
@ -286,27 +301,6 @@ mergeInto(LibraryManager.library,
|
|||
console.log("Pointer lock now " + FTEC.pointerislocked);
|
||||
break;
|
||||
|
||||
case 'vrdisplaypresentchange':
|
||||
console.log("vr present changed");
|
||||
console.log(event);
|
||||
break;
|
||||
case 'vrdisplayactivate':
|
||||
console.log("vr display active");
|
||||
if (event.display == FTEC.vrDisplay)
|
||||
{
|
||||
FTEC.usevr = true;
|
||||
if (!FTEC.vrDisplay.isPresenting)
|
||||
FTEC.vrDisplay.requestPresent([{ source: Module['canvas'] }]).then(function (){console.log("zomg, presenting!");}, function (err){FTEC.usevr = false;console.log("cannot vrdisplay!");});
|
||||
}
|
||||
break;
|
||||
case 'vrdisplaydeactivate':
|
||||
console.log("vr display inactive");
|
||||
if (event.display == FTEC.vrDisplay)
|
||||
{
|
||||
FTEC.vrDisplay.exitPresent()
|
||||
FTEC.usevr = false;
|
||||
}
|
||||
break;
|
||||
case 'beforeunload':
|
||||
event.preventDefault();
|
||||
return 'quit this game like everything else?';
|
||||
|
@ -316,37 +310,6 @@ mergeInto(LibraryManager.library,
|
|||
}
|
||||
}
|
||||
},
|
||||
emscriptenfte_getvrframedata : function()
|
||||
{
|
||||
if (!FTEC.vrDisplay)
|
||||
return 0;
|
||||
return FTEC.vrDisplay.isPresenting;
|
||||
// FTEC.vrframeData
|
||||
},
|
||||
emscriptenfte_getvreyedata : function (eye, ptr_proj, ptr_view)
|
||||
{
|
||||
var pm;
|
||||
var vm;
|
||||
if (eye)
|
||||
{
|
||||
pm = FTEC.vrframeData.leftProjectionMatrix;
|
||||
vm = FTEC.vrframeData.leftViewMatrix;
|
||||
}
|
||||
else
|
||||
{
|
||||
pm = FTEC.vrframeData.rightProjectionMatrix;
|
||||
vm = FTEC.vrframeData.rightViewMatrix;
|
||||
}
|
||||
|
||||
var i;
|
||||
ptr_proj /= 4;
|
||||
ptr_view /= 4;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
HEAPF32[ptr_proj + i] = pm[i];
|
||||
HEAPF32[ptr_view + i] = vm[i];
|
||||
}
|
||||
},
|
||||
emscriptenfte_updatepointerlock : function(wantlock, softcursor)
|
||||
{
|
||||
FTEC.pointerwantlock = wantlock;
|
||||
|
@ -416,20 +379,6 @@ mergeInto(LibraryManager.library,
|
|||
FTEC.evcb.jaxis = evjaxis;
|
||||
FTEC.evcb.wantfullscreen = evwantfullscreen;
|
||||
|
||||
if (navigator.getVRDisplays)
|
||||
{
|
||||
FTEC.vrframeData = new VRFrameData();
|
||||
navigator.getVRDisplays().then(function (displays)
|
||||
{
|
||||
if (displays.length > 0)
|
||||
{
|
||||
FTEC.vrDisplay = displays[0];
|
||||
// if (vrDisplay.capabilities.canPresent)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if ('GamepadEvent' in window)
|
||||
FTEH.gamepads = []; //don't bother ever trying to poll if we can use gamepad events. this will hopefully avoid weirdness.
|
||||
|
||||
|
@ -455,7 +404,7 @@ mergeInto(LibraryManager.library,
|
|||
document.addEventListener(event, FTEC.handleevent, true);
|
||||
});
|
||||
|
||||
var windowevents = ['message','vrdisplaypresentchange','vrdisplayactivate','vrdisplaydeactivate','gamepadconnected', 'gamepaddisconnected', 'beforeunload'];
|
||||
var windowevents = ['message','gamepadconnected', 'gamepaddisconnected', 'beforeunload'];
|
||||
windowevents.forEach(function(event)
|
||||
{
|
||||
window.addEventListener(event, FTEC.handleevent, true);
|
||||
|
@ -532,42 +481,10 @@ mergeInto(LibraryManager.library,
|
|||
Module['noExitRuntime'] = true;
|
||||
FTEC.aborted = false;
|
||||
|
||||
function step(timestamp)
|
||||
{
|
||||
var dovsync = false;
|
||||
var vr = false;
|
||||
if (FTEC.aborted)
|
||||
return;
|
||||
|
||||
if (FTEC.vrDisplay)
|
||||
{
|
||||
vr = FTEC.vrDisplay.isPresenting;
|
||||
FTEC.vrDisplay.getFrameData(FTEC.vrframeData);
|
||||
}
|
||||
|
||||
try //this try is needed to handle Host_EndGame properly.
|
||||
{
|
||||
dovsync = {{{makeDynCall('if')}}}(fnc,timestamp);
|
||||
}
|
||||
catch(err)
|
||||
{
|
||||
console.log(err);
|
||||
}
|
||||
if (vr)
|
||||
FTEC.vrDisplay.submitFrame();
|
||||
if (dovsync)
|
||||
{
|
||||
if (FTEC.vrDisplay)
|
||||
FTEC.vrDisplay.requestAnimationFrame(Module["sched"]);
|
||||
else
|
||||
Browser.requestAnimationFrame(Module["sched"]);
|
||||
}
|
||||
else
|
||||
setTimeout(Module["sched"], 0, performance.now());
|
||||
};
|
||||
Module["sched"] = step;
|
||||
Module["sched"] = FTEC.step;
|
||||
FTEC.evcb.frame = fnc
|
||||
//don't start it instantly, so we can distinguish between types of errors (emscripten sucks!).
|
||||
setTimeout(step, 1, performance.now());
|
||||
setTimeout(FTEC.step, 1, performance.now());
|
||||
},
|
||||
|
||||
emscriptenfte_ticks_ms : function()
|
||||
|
|
Loading…
Reference in a new issue