Changed all of the isometric functionality to mapinfo and playerinfo variables. Retained function of most of the CVars.
This commit is contained in:
parent
d2c2c93cf1
commit
dc897eacc0
15 changed files with 101 additions and 34 deletions
|
|
@ -163,28 +163,29 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
|
|||
di->Viewpoint.FieldOfView = DAngle::fromDeg(fov); // Set the real FOV for the current scene (it's not necessarily the same as the global setting in r_viewpoint)
|
||||
|
||||
// Switch viewpoint for isometric camera
|
||||
if(r_isocam && camera->player != NULL)
|
||||
if((r_isocam || (camera->Level->flags3 & LEVEL3_ISOMETRICMODE)) && camera->player != NULL)
|
||||
{
|
||||
float camdist = r_iso_dist;
|
||||
if (r_orthographic) camdist = r_iso_camdist;
|
||||
float camheight = camdist*FAngle::fromDeg(r_iso_pitch).Tan();
|
||||
camheight -= 0.5*camera->player->viewheight;
|
||||
int myisoviewpoint = 1;
|
||||
if (r_isoviewpoint > 0 && r_isoviewpoint < 9) myisoviewpoint = r_isoviewpoint - 1;
|
||||
else myisoviewpoint = camera->player->isoviewpoint % 8;
|
||||
if (myisoviewpoint < 0) myisoviewpoint = 0;
|
||||
if (r_isoviewpoint < 9) camera->player->isoyaw = 45.0 * myisoviewpoint; // The eight cardinal directions
|
||||
float camdist = camera->Level->iso_dist;
|
||||
float isocam_pitch = camera->Level->isocam_pitch;
|
||||
if (r_isoviewpoint > 0)
|
||||
{
|
||||
isocam_pitch = r_iso_pitch;
|
||||
camdist = r_iso_dist;
|
||||
camera->player->isoyaw = 45.0 * (r_isoviewpoint - 1); // The eight cardinal directions
|
||||
}
|
||||
float inv_iso_dist = 1.0f/camdist; // camdist can change in next line
|
||||
if (r_orthographic || (camera->Level->flags3 & LEVEL3_ORTHOGRAPHIC)) camdist = r_iso_camdist;
|
||||
vp.Pos.X -= camdist * DAngle::fromDeg(camera->player->isoyaw).Cos();
|
||||
vp.Pos.Y -= camdist * DAngle::fromDeg(camera->player->isoyaw).Sin();
|
||||
vp.Pos.Z += camheight;
|
||||
vp.HWAngles.Pitch = FAngle::fromDeg(r_iso_pitch);
|
||||
vp.Angles.Pitch = DAngle::fromDeg(r_iso_pitch);
|
||||
vp.Pos.Z += camdist * FAngle::fromDeg(isocam_pitch).Tan() - 0.5 * camera->player->viewheight;
|
||||
vp.HWAngles.Pitch = FAngle::fromDeg(isocam_pitch);
|
||||
vp.Angles.Pitch = DAngle::fromDeg(isocam_pitch);
|
||||
vp.Angles.Yaw = DAngle::fromDeg(camera->player->isoyaw);
|
||||
vp.Angles.Roll = DAngle::fromDeg(0);
|
||||
vp.showviewer = true; // Draw player sprite
|
||||
r_drawplayersprites = false; // Don't draw first-person hands/weapons
|
||||
// Stereo mode specific perspective projection
|
||||
di->VPUniforms.mProjectionMatrix = eye.GetProjection(fov, ratio, fovratio, r_orthographic);
|
||||
di->VPUniforms.mProjectionMatrix = eye.GetProjection(fov, ratio, fovratio * inv_iso_dist, r_orthographic || (camera->Level->flags3 & LEVEL3_ORTHOGRAPHIC));
|
||||
}
|
||||
else // Regular first-person viewpoint
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue