Skip to content

Commit

Permalink
Reduce number of multiply ops per frame and increase x-axis clipper r…
Browse files Browse the repository at this point in the history
…ange for orthographic projection.
  • Loading branch information
dileepvr authored and madame-rachelle committed Oct 28, 2024
1 parent 3c36102 commit dc6f116
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rendering/hwrenderer/scene/hw_clipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ angle_t Clipper::PointToPseudoOrthoAngle(double x, double y)
{
angle_t af = viewpoint->FrustAngle;
double xproj = disp.XY().Length() * deltaangle(disp.Angle(), viewpoint->Angles.Yaw).Sin();
xproj *= viewpoint->ScreenProj;
if (fabs(xproj) < r_viewwindow.WidescreenRatio*1.13) // 2.0)
xproj *= viewpoint->ScreenProjX;
if (fabs(xproj) < 1.13)
{
return AngleToPseudo( viewpoint->Angles.Yaw.BAMs() - xproj * 0.5 * af );
}
Expand Down
4 changes: 4 additions & 0 deletions src/rendering/r_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ FRenderViewpoint::FRenderViewpoint()
sector = nullptr;
FieldOfView = DAngle::fromDeg(90.); // Angles in the SCREENWIDTH wide window
ScreenProj = 0.0;
ScreenProjX = 0.0;
TicFrac = 0.0;
FrameTime = 0;
extralight = 0;
Expand Down Expand Up @@ -704,7 +705,10 @@ void FRenderViewpoint::SetViewAngle(const FViewWindow& viewWindow)
HWAngles.Yaw = FAngle::fromDeg(270.0 - Angles.Yaw.Degrees());

if (IsOrtho() && (camera->ViewPos->Offset.XY().Length() > 0.0))
{
ScreenProj = 1.34396 / camera->ViewPos->Offset.Length() / tan (FieldOfView.Radians()*0.5); // [DVR] Estimated. +/-1 should be top/bottom of screen.
ScreenProjX = ScreenProj * 0.5 / viewWindow.WidescreenRatio;
}

}

Expand Down
1 change: 1 addition & 0 deletions src/rendering/r_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct FRenderViewpoint
sector_t *sector; // [RH] keep track of sector viewing from
DAngle FieldOfView; // current field of view
double ScreenProj; // Screen projection factor for orthographic projection
double ScreenProjX; // Same for X-axis (screenspace)

double TicFrac; // fraction of tic for interpolation
uint32_t FrameTime; // current frame's time in tics.
Expand Down

0 comments on commit dc6f116

Please sign in to comment.