mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- made fov change for RRRA's drug mode work.
This commit is contained in:
parent
b60181eed5
commit
e6ca0f4817
3 changed files with 14 additions and 13 deletions
|
@ -192,7 +192,7 @@ void RenderViewpoint(FRenderViewpoint& mainvp, IntRect* bounds, float fov, float
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
FRenderViewpoint SetupViewpoint(DCoreActor* cam, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang)
|
||||
FRenderViewpoint SetupViewpoint(DCoreActor* cam, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, float fov = -1)
|
||||
{
|
||||
FRenderViewpoint r_viewpoint{};
|
||||
r_viewpoint.CameraActor = cam;
|
||||
|
@ -202,7 +202,7 @@ FRenderViewpoint SetupViewpoint(DCoreActor* cam, const vec3_t& position, int sec
|
|||
r_viewpoint.HWAngles.Yaw = -90.f + angle.asdeg();
|
||||
r_viewpoint.HWAngles.Pitch = -horizon.aspitch();
|
||||
r_viewpoint.HWAngles.Roll = -rollang.asdeg();
|
||||
r_viewpoint.FieldOfView = (float)r_fov;
|
||||
r_viewpoint.FieldOfView = fov > 0? fov : (float)r_fov;
|
||||
r_viewpoint.RotAngle = angle.asbam();
|
||||
double FocalTangent = tan(r_viewpoint.FieldOfView.Radians() / 2);
|
||||
DAngle an = 270. - r_viewpoint.HWAngles.Yaw.Degrees;
|
||||
|
@ -318,7 +318,7 @@ static void CheckTimer(FRenderState &state, uint64_t ShaderStartTime)
|
|||
void animatecamsprite(double s);
|
||||
|
||||
|
||||
void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, double smoothratio)
|
||||
void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, double smoothratio, float fov)
|
||||
{
|
||||
checkRotatedWalls();
|
||||
|
||||
|
@ -332,7 +332,7 @@ void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sect
|
|||
ResetProfilingData();
|
||||
|
||||
// Get this before everything else
|
||||
FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectnum, angle, horizon, rollang);
|
||||
FRenderViewpoint r_viewpoint = SetupViewpoint(playersprite, position, sectnum, angle, horizon, rollang, fov);
|
||||
if (cl_capfps) r_viewpoint.TicFrac = 1.;
|
||||
else r_viewpoint.TicFrac = smoothratio * (1/65536.);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
class FSerializer;
|
||||
struct IntRect;
|
||||
|
||||
void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, double smoothratio);
|
||||
void render_drawrooms(DCoreActor* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, double smoothratio, float fov = -1);
|
||||
void render_camtex(DCoreActor* playersprite, const vec3_t& position, sectortype* sect, binangle angle, fixedhoriz horizon, binangle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio);
|
||||
|
||||
struct PortalDesc
|
||||
|
|
|
@ -59,10 +59,10 @@ BEGIN_DUKE_NS
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void renderView(DDukeActor* playersprite, sectortype* sect, int x, int y, int z, binangle a, fixedhoriz h, binangle rotscrnang, double smoothratio, bool sceneonly)
|
||||
void renderView(DDukeActor* playersprite, sectortype* sect, int x, int y, int z, binangle a, fixedhoriz h, binangle rotscrnang, double smoothratio, bool sceneonly, float fov)
|
||||
{
|
||||
if (!sceneonly) drawweapon(smoothratio);
|
||||
render_drawrooms(playersprite, { x, y, z }, sectnum(sect), a, h, rotscrnang, smoothratio);
|
||||
render_drawrooms(playersprite, { x, y, z }, sectnum(sect), a, h, rotscrnang, smoothratio, fov);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -251,6 +251,8 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
|
||||
setgamepalette(BASEPAL);
|
||||
|
||||
float fov = r_fov;
|
||||
|
||||
if (ud.cameraactor)
|
||||
{
|
||||
auto act = ud.cameraactor;
|
||||
|
@ -263,16 +265,15 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
auto bh = buildhoriz(act->spr.yvel);
|
||||
auto cstat = act->spr.cstat;
|
||||
act->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
||||
renderView(act, act->sector(), act->spr.pos.X, act->spr.pos.Y, act->spr.pos.Z - (4 << 8), cang, bh, buildang(0), smoothratio, sceneonly);
|
||||
renderView(act, act->sector(), act->spr.pos.X, act->spr.pos.Y, act->spr.pos.Z - (4 << 8), cang, bh, buildang(0), smoothratio, sceneonly, fov);
|
||||
act->spr.cstat = cstat;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fixme: This should get the aspect ratio from the backend, not the current viewport size.
|
||||
int i = DivScale(1, isRR() ? 64 : p->GetActor()->spr.yrepeat + 28, 22);
|
||||
int viewingaspect = !isRRRA() || !p->DrugMode ? xs_CRoundToInt(double(i) * tan(r_fov * (pi::pi() / 360.))) : getdrugmode(p, i);
|
||||
// todo: transform this mess into something sane to feed to the renderer.
|
||||
if (isRRRA() && p->DrugMode)
|
||||
fov = atan(getdrugmode(p, 65536) * (1. / 65536.)) * (4 * r_fov / pi::pi());
|
||||
|
||||
|
||||
// The camera texture must be rendered with the base palette, so this is the only place where the current global palette can be set.
|
||||
// The setting here will be carried over to the rendering of the weapon sprites, but other 2D content will always default to the main palette.
|
||||
|
@ -380,7 +381,7 @@ void displayrooms(int snum, double smoothratio, bool sceneonly)
|
|||
|
||||
auto cstat = viewer->spr.cstat;
|
||||
if (camview) viewer->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
||||
renderView(viewer, sect, cposx, cposy, cposz, cang, choriz, rotscrnang, smoothratio, sceneonly);
|
||||
renderView(viewer, sect, cposx, cposy, cposz, cang, choriz, rotscrnang, smoothratio, sceneonly, fov);
|
||||
viewer->spr.cstat = cstat;
|
||||
}
|
||||
//GLInterface.SetMapFog(false);
|
||||
|
|
Loading…
Reference in a new issue