Skip to content

Commit

Permalink
* REFACTOR: [Engine] psHUD_FOV in degrees
Browse files Browse the repository at this point in the history
  • Loading branch information
yohjimane committed Dec 3, 2023
1 parent af1b18c commit 113e21d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Layers/xrRender/ParticleEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ void CParticleEffect::Render(CBackend& cmd_list, float, bool use_fast_geo)
Fmatrix FTold = Device.mFullTransform;
if (GetHudMode())
{
Device.mProject.build_projection(deg2rad(psHUD_FOV * Device.fFOV), Device.fASPECT, VIEWPORT_NEAR,
Device.mProject.build_projection(deg2rad(psHUD_FOV), Device.fASPECT, VIEWPORT_NEAR,
g_pGamePersistent->Environment().CurrentEnv.far_plane);

Device.mFullTransform.mul(Device.mProject, Device.mView);
Expand Down Expand Up @@ -847,7 +847,7 @@ void CParticleEffect::Render(float, bool)
Fmatrix FTold = Device.mFullTransform;
if (GetHudMode())
{
Device.mProject.build_projection(deg2rad(psHUD_FOV * Device.fFOV), Device.fASPECT, VIEWPORT_NEAR,
Device.mProject.build_projection(deg2rad(psHUD_FOV), Device.fASPECT, VIEWPORT_NEAR,
g_pGamePersistent->Environment().CurrentEnv.far_plane);

Device.mFullTransform.mul(Device.mProject, Device.mView);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/r__dsgraph_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class hud_transform_helper
// https://github.com/ShokerStlk/xray-16-SWM/commit/869de0b6e74ac05990f541e006894b6fe78bd2a5#diff-4199ef700b18ce4da0e2b45dee1924d0R83

Fmatrix prj_new;
prj_new.build_projection(deg2rad(psHUD_FOV * Device.fFOV /* *Device.fASPECT*/), Device.fASPECT,
prj_new.build_projection(deg2rad(psHUD_FOV), Device.fASPECT,
VIEWPORT_NEAR, g_pGamePersistent->Environment().CurrentEnv.far_plane);
cmd_list.set_xform_project(prj_new);

Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_R2/r2_rendertarget_accum_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void CRenderTarget::accum_point(CBackend& cmd_list, light* L)
extern ENGINE_API float psHUD_FOV;
Pold = Device.mProject;
FTold = Device.mFullTransform;
Device.mProject.build_projection(deg2rad(psHUD_FOV * Device.fFOV /* *Device.fASPECT*/), Device.fASPECT,
Device.mProject.build_projection(Device.fFOV /* *Device.fASPECT*/, Device.fASPECT,
VIEWPORT_NEAR, g_pGamePersistent->Environment().CurrentEnv.far_plane);

Device.mFullTransform.mul(Device.mProject, Device.mView);
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/xr_ioc_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ class CCC_Editor : public IConsole_Command
};

ENGINE_API float g_fov = 67.5f;
ENGINE_API float psHUD_FOV = 0.45f;
ENGINE_API float psHUD_FOV = 67.5f;

// extern int psSkeletonUpdate;
extern int rsDVB_Size;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/console_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,7 @@ void CCC_RegisterCommands()
CMD3(CCC_Mask, "hud_crosshair_dist", &psHUD_Flags, HUD_CROSSHAIR_DIST);
CMD3(CCC_Mask, "hud_left_handed", &psHUD_Flags, HUD_LEFT_HANDED);

CMD4(CCC_Float, "hud_fov", &psHUD_FOV, 0.1f, 1.0f);
CMD4(CCC_Float, "hud_fov", &psHUD_FOV, 5.0f, 180.f);
CMD4(CCC_Float, "fov", &g_fov, 5.0f, 180.0f);

// Demo
Expand Down

0 comments on commit 113e21d

Please sign in to comment.