- 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) SideBySideFull::SideBySideFull(double ipdMeters)
: leftEye(ipdMeters), rightEye(ipdMeters) : leftEye(ipdMeters, 0.5f), rightEye(ipdMeters, 0.5f)
{ {
eye_ptrs.Push(&leftEye); eye_ptrs.Push(&leftEye);
eye_ptrs.Push(&rightEye); eye_ptrs.Push(&rightEye);

View File

@ -68,8 +68,8 @@ public:
SideBySideFull(double ipdMeters); SideBySideFull(double ipdMeters);
virtual void AdjustPlayerSprites(FDrawInfo *di) const override; virtual void AdjustPlayerSprites(FDrawInfo *di) const override;
private: private:
SBSFLeftEyePose leftEye; LeftEyePose leftEye;
SBSFRightEyePose rightEye; RightEyePose rightEye;
}; };
class TopBottom3D : public SideBySideSquished 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 = zNear * getShift() / vr_screendist; // meters cancel, leaving doom units
// double frustumShift = 0; // Turning off shift for debugging // double frustumShift = 0; // Turning off shift for debugging
double fH = zNear * tan(DEG2RAD(fov) / 2) / fovRatio; double fH = zNear * tan(DEG2RAD(fov) / 2) / fovRatio;
double fW = fH * aspectRatio; double fW = fH * aspectRatio * squish;
double left = -fW - frustumShift; double left = -fW - frustumShift;
double right = fW - frustumShift; double right = fW - frustumShift;
double bottom = -fH; double bottom = -fH;

View File

@ -17,7 +17,7 @@ public:
class ShiftedEyePose : public EyePose class ShiftedEyePose : public EyePose
{ {
public: public:
ShiftedEyePose(float shift) : shift(shift) {}; ShiftedEyePose(float shift, float squish) : shift(shift), squish(squish) {};
float getShift() const; float getShift() const;
virtual VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio) const; virtual VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio) const;
virtual void GetViewShift(float yaw, float outViewShift[3]) const; virtual void GetViewShift(float yaw, float outViewShift[3]) const;
@ -27,13 +27,14 @@ protected:
private: private:
float shift; float shift;
float squish;
}; };
class LeftEyePose : public ShiftedEyePose class LeftEyePose : public ShiftedEyePose
{ {
public: 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); } void setIpd(float ipd) { setShift(-0.5f * ipd); }
}; };
@ -41,23 +42,6 @@ public:
class RightEyePose : public ShiftedEyePose class RightEyePose : public ShiftedEyePose
{ {
public: 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); } 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);
}
};