@@ -268,8 +268,8 @@ void HWDrawInfo::ClearBuffers()
268
268
void HWDrawInfo::UpdateCurrentMapSection ()
269
269
{
270
270
int mapsection = Level->PointInRenderSubsector (Viewpoint.Pos )->mapsection ;
271
- if (Viewpoint.IsAllowedOoB ())
272
- mapsection = Level->PointInRenderSubsector (Viewpoint.camera -> Pos () )->mapsection ;
271
+ if (Viewpoint.IsAllowedOoB () || Viewpoint. IsOrtho () )
272
+ mapsection = Level->PointInRenderSubsector (Viewpoint.OffPos )->mapsection ;
273
273
CurrentMapSections.Set (mapsection);
274
274
}
275
275
@@ -363,27 +363,48 @@ int HWDrawInfo::SetFullbrightFlags(player_t *player)
363
363
//
364
364
// -----------------------------------------------------------------------------
365
365
366
- angle_t HWDrawInfo::FrustumAngle ( )
366
+ angle_t OoBFrustumAngle (FRenderViewpoint* Viewpoint )
367
367
{
368
368
// If pitch is larger than this you can look all around at an FOV of 90 degrees
369
- if (fabs (Viewpoint.HWAngles .Pitch .Degrees ()) > 89.0 ) return 0xffffffff ;
370
- else if (fabs (Viewpoint.HWAngles .Pitch .Degrees ()) > 46.0 && !Viewpoint.IsAllowedOoB ()) return 0xffffffff ; // Just like 4.12.2 and older did
369
+ if (fabs (Viewpoint->HWAngles .Pitch .Degrees ()) > 89.0 ) return 0xffffffff ;
371
370
int aspMult = AspectMultiplier (r_viewwindow.WidescreenRatio ); // 48 == square window
372
- double absPitch = fabs (Viewpoint. HWAngles .Pitch .Degrees ());
371
+ double absPitch = fabs (Viewpoint-> HWAngles .Pitch .Degrees ());
373
372
// Smaller aspect ratios still clip too much. Need a better solution
374
373
if (aspMult > 36 && absPitch > 30.0 ) return 0xffffffff ;
375
374
else if (aspMult > 40 && absPitch > 25.0 ) return 0xffffffff ;
376
375
else if (aspMult > 45 && absPitch > 20.0 ) return 0xffffffff ;
377
376
else if (aspMult > 47 && absPitch > 10.0 ) return 0xffffffff ;
378
377
379
- double xratio = r_viewwindow.FocalTangent / Viewpoint. PitchCos ;
378
+ double xratio = r_viewwindow.FocalTangent / Viewpoint-> PitchCos ;
380
379
double floatangle = 0.05 + atan ( xratio ) * 48.0 / aspMult; // this is radians
381
380
angle_t a1 = DAngle::fromRad (floatangle).BAMs ();
382
381
383
382
if (a1 >= ANGLE_90) return 0xffffffff ;
384
383
return a1;
385
384
}
386
385
386
+ angle_t HWDrawInfo::FrustumAngle ()
387
+ {
388
+ if (Viewpoint.IsAllowedOoB ())
389
+ {
390
+ return OoBFrustumAngle (&Viewpoint);
391
+ }
392
+ else
393
+ {
394
+ float tilt = fabs (Viewpoint.HWAngles .Pitch .Degrees ());
395
+
396
+ // If the pitch is larger than this you can look all around at a FOV of 90°
397
+ if (tilt > 46 .0f ) return 0xffffffff ;
398
+
399
+ // ok, this is a gross hack that barely works...
400
+ // but at least it doesn't overestimate too much...
401
+ double floatangle = 2.0 + (45.0 + ((tilt / 1.9 )))*Viewpoint.FieldOfView .Degrees () * 48.0 / AspectMultiplier (r_viewwindow.WidescreenRatio ) / 90.0 ;
402
+ angle_t a1 = DAngle::fromDeg (floatangle).BAMs ();
403
+ if (a1 >= ANGLE_180) return 0xffffffff ;
404
+ return a1;
405
+ }
406
+ }
407
+
387
408
// -----------------------------------------------------------------------------
388
409
//
389
410
// Setup the modelview matrix
@@ -1043,8 +1064,8 @@ void HWDrawInfo::ProcessScene(bool toscreen)
1043
1064
portalState.BeginScene ();
1044
1065
1045
1066
int mapsection = Level->PointInRenderSubsector (Viewpoint.Pos )->mapsection ;
1046
- if (Viewpoint.IsAllowedOoB ())
1047
- mapsection = Level->PointInRenderSubsector (Viewpoint.camera -> Pos () )->mapsection ;
1067
+ if (Viewpoint.IsAllowedOoB () || Viewpoint. IsOrtho () )
1068
+ mapsection = Level->PointInRenderSubsector (Viewpoint.OffPos )->mapsection ;
1048
1069
CurrentMapSections.Set (mapsection);
1049
1070
DrawScene (toscreen ? DM_MAINVIEW : DM_OFFSCREEN);
1050
1071
0 commit comments