mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- partial consolidation of the EyePose classes.
The SBS versions can just as easily be handled with an additional parameter.
This commit is contained in:
parent
840c2c8958
commit
4ef7b66c4b
4 changed files with 8 additions and 24 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue