Adding isometric camera mode with orthographic projection to current state of master branch of GZDoom.
This commit is contained in:
parent
278ebf3202
commit
d2c2c93cf1
10 changed files with 117 additions and 5 deletions
|
|
@ -54,3 +54,11 @@ EXTERN_CVAR(Int, gl_shadowmap_filter)
|
|||
EXTERN_CVAR(Bool, gl_brightfog)
|
||||
EXTERN_CVAR(Bool, gl_lightadditivesurfaces)
|
||||
EXTERN_CVAR(Bool, gl_notexturefill)
|
||||
|
||||
EXTERN_CVAR(Bool, r_isocam)
|
||||
EXTERN_CVAR(Int, r_isoviewpoint)
|
||||
EXTERN_CVAR(Float, r_iso_camdist)
|
||||
EXTERN_CVAR(Float, r_iso_dist)
|
||||
EXTERN_CVAR(Float, r_iso_pitch)
|
||||
EXTERN_CVAR(Bool, r_drawplayersprites)
|
||||
EXTERN_CVAR(Bool, r_orthographic)
|
||||
|
|
|
|||
|
|
@ -146,11 +146,27 @@ float VREyeInfo::getShift() const
|
|||
return vr_swap_eyes ? -res : res;
|
||||
}
|
||||
|
||||
VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio) const
|
||||
VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio, bool isocam) const
|
||||
{
|
||||
VSMatrix result;
|
||||
|
||||
if (mShiftFactor == 0)
|
||||
if (isocam) // Orthographic projection for isometric viewpoint
|
||||
{
|
||||
double zNear = -1.0; // screen->GetZNear();
|
||||
double zFar = screen->GetZFar();
|
||||
|
||||
double fH = r_iso_dist * tan(DEG2RAD(fov) / 2) / fovRatio;
|
||||
double fW = fH * aspectRatio * mScaleFactor;
|
||||
double left = -fW;
|
||||
double right = fW;
|
||||
double bottom = -fH;
|
||||
double top = fH;
|
||||
|
||||
VSMatrix fmat(1);
|
||||
fmat.ortho((float)left, (float)right, (float)bottom, (float)top, (float)zNear, (float)zFar);
|
||||
return fmat;
|
||||
}
|
||||
else if (mShiftFactor == 0)
|
||||
{
|
||||
float fovy = (float)(2 * RAD2DEG(atan(tan(DEG2RAD(fov) / 2) / fovRatio)));
|
||||
result.perspective(fovy, aspectRatio, screen->GetZNear(), screen->GetZFar());
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ struct VREyeInfo
|
|||
float mShiftFactor;
|
||||
float mScaleFactor;
|
||||
|
||||
VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio) const;
|
||||
VSMatrix GetProjection(float fov, float aspectRatio, float fovRatio, bool isocam) const;
|
||||
DVector3 GetViewShift(float yaw) const;
|
||||
private:
|
||||
float getShift() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue