- partial consolidation of the EyePose classes.

The SBS versions can just as easily be handled with an additional parameter.
This commit is contained in:
Christoph Oelckers 2018-06-24 11:45:40 +02:00
parent 840c2c8958
commit 4ef7b66c4b
4 changed files with 8 additions and 24 deletions

View file

@ -92,7 +92,7 @@ const SideBySideFull& SideBySideFull::getInstance(float ipd)
}
SideBySideFull::SideBySideFull(double ipdMeters)
: leftEye(ipdMeters), rightEye(ipdMeters)
: leftEye(ipdMeters, 0.5f), rightEye(ipdMeters, 0.5f)
{
eye_ptrs.Push(&leftEye);
eye_ptrs.Push(&rightEye);

View file

@ -68,8 +68,8 @@ public:
SideBySideFull(double ipdMeters);
virtual void AdjustPlayerSprites(FDrawInfo *di) const override;
private:
SBSFLeftEyePose leftEye;
SBSFRightEyePose rightEye;
LeftEyePose leftEye;
RightEyePose rightEye;
};
class TopBottom3D : public SideBySideSquished

View file

@ -68,7 +68,7 @@ VSMatrix ShiftedEyePose::GetProjection(float fov, float aspectRatio, float fovRa
double frustumShift = zNear * getShift() / vr_screendist; // meters cancel, leaving doom units
// double frustumShift = 0; // Turning off shift for debugging
double fH = zNear * tan(DEG2RAD(fov) / 2) / fovRatio;
double fW = fH * aspectRatio;
double fW = fH * aspectRatio * squish;
double left = -fW - frustumShift;
double right = fW - frustumShift;
double bottom = -fH;

View file

@ -17,7 +17,7 @@ public:
class ShiftedEyePose : public EyePose
{
public:
ShiftedEyePose(float shift) : shift(shift) {};
ShiftedEyePose(float shift, float squish) : shift(shift), squish(squish) {};
float getShift() const;
virtual VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio) const;
virtual void GetViewShift(float yaw, float outViewShift[3]) const;
@ -27,13 +27,14 @@ protected:
private:
float shift;
float squish;
};
class LeftEyePose : public ShiftedEyePose
{
public:
LeftEyePose(float ipd) : ShiftedEyePose( -0.5f * ipd) {}
LeftEyePose(float ipd, float squish = 1.f) : ShiftedEyePose( -0.5f * ipd, squish) {}
void setIpd(float ipd) { setShift(-0.5f * ipd); }
};
@ -41,23 +42,6 @@ public:
class RightEyePose : public ShiftedEyePose
{
public:
RightEyePose(float ipd) : ShiftedEyePose(0.5f * ipd) {}
RightEyePose(float ipd, float squish = 1.f) : ShiftedEyePose(0.5f * ipd, squish) {}
void setIpd(float ipd) { setShift(0.5f * ipd); }
};
class SBSFLeftEyePose : public LeftEyePose {
public:
SBSFLeftEyePose(float ipdMeters) : LeftEyePose(ipdMeters) {}
virtual VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio) const override {
return LeftEyePose::GetProjection(fov, 0.5f * aspectRatio, fovRatio);
}
};
class SBSFRightEyePose : public RightEyePose {
public:
SBSFRightEyePose(float ipdMeters) : RightEyePose(ipdMeters) {}
virtual VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio) const override {
return RightEyePose::GetProjection(fov, 0.5f * aspectRatio, fovRatio);
}
};