1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-04-26 22:02:36 +02:00

fix shadow for split-screen mode, minor fixes

This commit is contained in:
XProger 2019-08-27 01:50:28 +03:00
parent 3557e9363c
commit 860b7d3756
4 changed files with 15 additions and 6 deletions

View File

@ -1422,7 +1422,7 @@ struct Lara : Character {
// flip left and right by relative target direction
if (count > 1) {
int side[2] = { 0, 0 };
float side[2] = { 0, 0 };
vec3 dir = getDir();
dir.y = 0.0f;

View File

@ -80,6 +80,8 @@ struct Level : IGame {
vec4 underwaterFogParams;
vec4 levelFogParams;
mat4 mLightProj[2];
// IGame implementation ========
virtual void loadLevel(TR::LevelID id) {
sndWater = sndTrack = NULL;
@ -2538,7 +2540,8 @@ struct Level : IGame {
Core::mView = Core::mViewInv.inverseOrtho();
Core::mProj = GAPI::perspective(90.0f, 1.0f, znear, zfar, 0.0f);
Core::mLightProj = Core::mProj * Core::mView;
mat4 &m = mLightProj[player->camera->cameraIndex];
m = Core::mProj * Core::mView;
mat4 bias;
bias.identity();
@ -2546,7 +2549,9 @@ struct Level : IGame {
#if defined(_GAPI_D3D9) || defined(_GAPI_GXM)
bias.e11 = -bias.e11;
#endif
Core::mLightProj = bias * Core::mLightProj;
m = bias * m;
Core::mLightProj = m;
camera->frustum->pos = Core::viewPos.xyz();
camera->frustum->calcPlanes(Core::mViewProj);
@ -3033,6 +3038,8 @@ struct Level : IGame {
player = players[view];
camera = player->camera;
Core::mLightProj = mLightProj[view];
Core::pass = Core::passCompose;
setDefaultTarget(eye, view, invBG);

View File

@ -661,7 +661,9 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
}
//VR Support
#define VR_SUPPORT
#ifdef _GAPI_GL
#define VR_SUPPORT
#endif
#ifdef VR_SUPPORT
// TODO: fix depth precision

View File

@ -129,8 +129,8 @@ inline const T& clamp(const T &x, const T &a, const T &b) {
}
template <class T>
inline const int sign(const T &x) {
return x > 0 ? 1 : (x < 0 ? -1 : 0);
inline const T sign(const T &x) {
return (T)(x > 0 ? 1 : (x < 0 ? -1 : 0));
}
template <class T>