- blocked off direct access to TAngle’s internal storage.
This commit is contained in:
parent
3d2578820b
commit
4032576519
31 changed files with 123 additions and 235 deletions
|
|
@ -164,7 +164,7 @@ sector_t* RenderViewpoint(FRenderViewpoint& mainvp, AActor* camera, IntRect* bou
|
|||
// Stereo mode specific perspective projection
|
||||
di->VPUniforms.mProjectionMatrix = eye.GetProjection(fov, ratio, fovratio);
|
||||
// Stereo mode specific viewpoint adjustment
|
||||
vp.Pos += eye.GetViewShift(vp.HWAngles.Yaw.Degrees);
|
||||
vp.Pos += eye.GetViewShift(vp.HWAngles.Yaw.Degrees());
|
||||
di->SetupView(RenderState, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, false, false);
|
||||
|
||||
di->ProcessScene(toscreen);
|
||||
|
|
@ -280,7 +280,7 @@ void WriteSavePic(player_t* player, FileWriter* file, int width, int height)
|
|||
|
||||
// This shouldn't overwrite the global viewpoint even for a short time.
|
||||
FRenderViewpoint savevp;
|
||||
sector_t* viewsector = RenderViewpoint(savevp, players[consoleplayer].camera, &bounds, r_viewpoint.FieldOfView.Degrees, 1.6f, 1.6f, true, false);
|
||||
sector_t* viewsector = RenderViewpoint(savevp, players[consoleplayer].camera, &bounds, r_viewpoint.FieldOfView.Degrees(), 1.6f, 1.6f, true, false);
|
||||
RenderState.EnableStencil(false);
|
||||
RenderState.SetNoSoftLightLevel();
|
||||
|
||||
|
|
@ -394,7 +394,7 @@ sector_t* RenderView(player_t* player)
|
|||
|
||||
screen->ImageTransitionScene(true); // Only relevant for Vulkan.
|
||||
|
||||
retsec = RenderViewpoint(r_viewpoint, player->camera, NULL, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, true, true);
|
||||
retsec = RenderViewpoint(r_viewpoint, player->camera, NULL, r_viewpoint.FieldOfView.Degrees(), ratio, fovratio, true, true);
|
||||
}
|
||||
All.Unclock();
|
||||
return retsec;
|
||||
|
|
|
|||
|
|
@ -346,14 +346,14 @@ int HWDrawInfo::SetFullbrightFlags(player_t *player)
|
|||
|
||||
angle_t HWDrawInfo::FrustumAngle()
|
||||
{
|
||||
float tilt = fabs(Viewpoint.HWAngles.Pitch.Degrees);
|
||||
float tilt = fabs(Viewpoint.HWAngles.Pitch.Degrees());
|
||||
|
||||
// If the pitch is larger than this you can look all around at a FOV of 90°
|
||||
if (tilt > 46.0f) return 0xffffffff;
|
||||
|
||||
// ok, this is a gross hack that barely works...
|
||||
// but at least it doesn't overestimate too much...
|
||||
double floatangle = 2.0 + (45.0 + ((tilt / 1.9)))*Viewpoint.FieldOfView.Degrees*48.0 / AspectMultiplier(r_viewwindow.WidescreenRatio) / 90.0;
|
||||
double floatangle = 2.0 + (45.0 + ((tilt / 1.9)))*Viewpoint.FieldOfView.Degrees() * 48.0 / AspectMultiplier(r_viewwindow.WidescreenRatio) / 90.0;
|
||||
angle_t a1 = DAngle::fromDeg(floatangle).BAMs();
|
||||
if (a1 >= ANGLE_180) return 0xffffffff;
|
||||
return a1;
|
||||
|
|
@ -371,9 +371,9 @@ void HWDrawInfo::SetViewMatrix(const FRotator &angles, float vx, float vy, float
|
|||
float planemult = planemirror ? -Level->info->pixelstretch : Level->info->pixelstretch;
|
||||
|
||||
VPUniforms.mViewMatrix.loadIdentity();
|
||||
VPUniforms.mViewMatrix.rotate(angles.Roll.Degrees, 0.0f, 0.0f, 1.0f);
|
||||
VPUniforms.mViewMatrix.rotate(angles.Pitch.Degrees, 1.0f, 0.0f, 0.0f);
|
||||
VPUniforms.mViewMatrix.rotate(angles.Yaw.Degrees, 0.0f, mult, 0.0f);
|
||||
VPUniforms.mViewMatrix.rotate(angles.Roll.Degrees(), 0.0f, 0.0f, 1.0f);
|
||||
VPUniforms.mViewMatrix.rotate(angles.Pitch.Degrees(), 1.0f, 0.0f, 0.0f);
|
||||
VPUniforms.mViewMatrix.rotate(angles.Yaw.Degrees(), 0.0f, mult, 0.0f);
|
||||
VPUniforms.mViewMatrix.translate(vx * mult, -vz * planemult, -vy);
|
||||
VPUniforms.mViewMatrix.scale(-mult, planemult, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ struct HWSectorPlane
|
|||
Offs.Y = (float)sec->GetYOffset(ceiling);
|
||||
Scale.X = (float)sec->GetXScale(ceiling);
|
||||
Scale.Y = (float)sec->GetYScale(ceiling);
|
||||
Angle = (float)sec->GetAngle(ceiling).Degrees;
|
||||
Angle = (float)sec->GetAngle(ceiling).Degrees();
|
||||
texture = sec->GetTexture(ceiling);
|
||||
plane = sec->GetSecPlane(ceiling);
|
||||
Texheight = (float)((ceiling == sector_t::ceiling)? plane.fD() : -plane.fD());
|
||||
|
|
|
|||
|
|
@ -352,12 +352,12 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
// Tilt the actor up or down based on pitch (increase 'somersaults' forward).
|
||||
// Then counteract the roll and DO A BARREL ROLL.
|
||||
|
||||
FAngle pitch = FAngle::fromDeg(-Angles.Pitch.Degrees);
|
||||
FAngle pitch = FAngle::fromDeg(-Angles.Pitch.Degrees());
|
||||
pitch.Normalized180();
|
||||
|
||||
mat.Translate(x, z, y);
|
||||
mat.Rotate(0, 1, 0, 270. - Angles.Yaw.Degrees);
|
||||
mat.Rotate(1, 0, 0, pitch.Degrees);
|
||||
mat.Rotate(0, 1, 0, 270. - Angles.Yaw.Degrees());
|
||||
mat.Rotate(1, 0, 0, pitch.Degrees());
|
||||
|
||||
if (actor->renderflags & RF_ROLLCENTER)
|
||||
{
|
||||
|
|
@ -365,12 +365,12 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
float cy = (y1 + y2) * 0.5;
|
||||
|
||||
mat.Translate(cx - x, 0, cy - y);
|
||||
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees);
|
||||
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees());
|
||||
mat.Translate(-cx, -z, -cy);
|
||||
}
|
||||
else
|
||||
{
|
||||
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees);
|
||||
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees());
|
||||
mat.Translate(-x, -z, -y);
|
||||
}
|
||||
v[0] = mat * FVector3(x2, z, y2);
|
||||
|
|
@ -421,7 +421,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
float xrel = xcenter - vp->X;
|
||||
float yrel = ycenter - vp->Y;
|
||||
float absAngleDeg = RAD2DEG(atan2(-yrel, xrel));
|
||||
float counterRotationDeg = 270. - HWAngles.Yaw.Degrees; // counteracts existing sprite rotation
|
||||
float counterRotationDeg = 270. - HWAngles.Yaw.Degrees(); // counteracts existing sprite rotation
|
||||
float relAngleDeg = counterRotationDeg + absAngleDeg;
|
||||
|
||||
mat.Rotate(0, 1, 0, relAngleDeg);
|
||||
|
|
@ -430,7 +430,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
// [fgsfds] calculate yaw vectors
|
||||
float yawvecX = 0, yawvecY = 0, rollDegrees = 0;
|
||||
float angleRad = (FAngle::fromDeg(270.) - HWAngles.Yaw).Radians();
|
||||
if (actor) rollDegrees = Angles.Roll.Degrees;
|
||||
if (actor) rollDegrees = Angles.Roll.Degrees();
|
||||
if (isFlatSprite)
|
||||
{
|
||||
yawvecX = Angles.Yaw.Cos();
|
||||
|
|
@ -453,7 +453,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
if (useOffsets) mat.Translate(xx, zz, yy);
|
||||
if (drawWithXYBillboard)
|
||||
{
|
||||
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees);
|
||||
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
|
||||
}
|
||||
mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
|
||||
if (useOffsets) mat.Translate(-xx, -zz, -yy);
|
||||
|
|
@ -463,7 +463,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
|||
// Rotate the sprite about the vector starting at the center of the sprite
|
||||
// triangle strip and with direction orthogonal to where the player is looking
|
||||
// in the x/y plane.
|
||||
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees);
|
||||
mat.Rotate(-sin(angleRad), 0, cos(angleRad), -HWAngles.Pitch.Degrees());
|
||||
}
|
||||
|
||||
mat.Translate(-xcenter, -zcenter, -ycenter); // retreat from sprite center
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ bool HUDSprite::GetWeaponRect(HWDrawInfo *di, DPSprite *psp, float sx, float sy,
|
|||
// Handle PSPF_FLIP.
|
||||
if (flip) anchorx = 1.0 - anchorx;
|
||||
|
||||
FAngle rot = FAngle::fromDeg(float((flip) ? -psp->rotation.Degrees : psp->rotation.Degrees));
|
||||
FAngle rot = FAngle::fromDeg(float((flip) ? -psp->rotation.Degrees() : psp->rotation.Degrees()));
|
||||
const float cosang = rot.Cos();
|
||||
const float sinang = rot.Sin();
|
||||
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ void R_SetWindow (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, int wind
|
|||
// screen that would be visible on a 4:3 display has the requested FOV.
|
||||
if (viewwindow.centerxwide != viewwindow.centerx)
|
||||
{ // centerxwide is what centerx would be if the display was not widescreen
|
||||
fov = DAngle::ToDegrees(2 * atan(viewwindow.centerx * tan(fov.Radians()/2) / double(viewwindow.centerxwide)));
|
||||
fov = DAngle::fromRad(2 * atan(viewwindow.centerx * tan(fov.Radians()/2) / double(viewwindow.centerxwide)));
|
||||
if (fov > DAngle::fromDeg(170.)) fov = DAngle::fromDeg(170.);
|
||||
}
|
||||
viewwindow.FocalTangent = tan(fov.Radians() / 2);
|
||||
|
|
@ -599,7 +599,7 @@ void FRenderViewpoint::SetViewAngle (const FViewWindow &viewwindow)
|
|||
DVector2 v = Angles.Yaw.ToVector();
|
||||
ViewVector.X = v.X;
|
||||
ViewVector.Y = v.Y;
|
||||
HWAngles.Yaw = FAngle::fromDeg(270.0 - Angles.Yaw.Degrees);
|
||||
HWAngles.Yaw = FAngle::fromDeg(270.0 - Angles.Yaw.Degrees());
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1117,7 +1117,7 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
|||
double alen = sqrt(angx*angx + angy*angy);
|
||||
viewpoint.HWAngles.Pitch = FAngle::fromRad((float)asin(angy / alen));
|
||||
|
||||
viewpoint.HWAngles.Roll.Degrees = (float)viewpoint.Angles.Roll.Degrees; // copied for convenience.
|
||||
viewpoint.HWAngles.Roll = FAngle::fromDeg(viewpoint.Angles.Roll.Degrees()); // copied for convenience.
|
||||
|
||||
// ViewActor only gets set, if the camera actor should not be rendered
|
||||
if (actor->player && actor->player - players == consoleplayer &&
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ namespace swrenderer
|
|||
skyiscale = float(r_Yaspect / freelookviewheight);
|
||||
skyscale = freelookviewheight / r_Yaspect;
|
||||
|
||||
skyiscale *= float(thread->Viewport->viewpoint.FieldOfView.Degrees / 90.);
|
||||
skyscale *= float(90. / thread->Viewport->viewpoint.FieldOfView.Degrees);
|
||||
skyiscale *= float(thread->Viewport->viewpoint.FieldOfView.Degrees() / 90.);
|
||||
skyscale *= float(90. / thread->Viewport->viewpoint.FieldOfView.Degrees());
|
||||
}
|
||||
|
||||
if (Level->skystretch)
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ namespace swrenderer
|
|||
}
|
||||
|
||||
vis->pa.vpos = { (float)thread->Viewport->viewpoint.Pos.X, (float)thread->Viewport->viewpoint.Pos.Y, (float)thread->Viewport->viewpoint.Pos.Z };
|
||||
vis->pa.vang = FAngle::fromDeg(((float)thread->Viewport->viewpoint.Angles.Yaw.Degrees));
|
||||
vis->pa.vang = FAngle::fromDeg(((float)thread->Viewport->viewpoint.Angles.Yaw.Degrees()));
|
||||
|
||||
// killough 3/27/98: save sector for special clipping later
|
||||
vis->heightsec = heightsec;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue