mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- Added 'ScaleWeaponFOV' flag to MODELDEF. Affects weapon models only; will scale the model along with the user's FOV to reduce distortion.
- Additionally, a 'cl_scaleweaponfov' CVar has been added to allow users to further fine-tune the weapon model scale with higher FOVs
This commit is contained in:
parent
ab27d1dd33
commit
1785788bdc
3 changed files with 18 additions and 1 deletions
|
@ -161,3 +161,5 @@ CUSTOM_CVAR(String, language, "auto", CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOB
|
|||
UpdateGenericUI(ui_generic);
|
||||
I_UpdateWindowTitle();
|
||||
}
|
||||
|
||||
CVAR(Float, cl_scaleweaponfov, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
|
|
@ -193,8 +193,16 @@ void RenderHUDModel(FModelRenderer *renderer, DPSprite *psp, float ofsX, float o
|
|||
// but we need to position it correctly in the world for light to work properly.
|
||||
VSMatrix objectToWorldMatrix = renderer->GetViewToWorldMatrix();
|
||||
|
||||
// [Nash] Optional scale weapon FOV
|
||||
float fovscale = 1.0f;
|
||||
if (smf->flags & MDL_SCALEWEAPONFOV)
|
||||
{
|
||||
fovscale = tan(players[consoleplayer].DesiredFOV * (0.5f * M_PI / 180.f));
|
||||
fovscale = 1.f + (fovscale - 1.f) * cl_scaleweaponfov;
|
||||
}
|
||||
|
||||
// Scaling model (y scale for a sprite means height, i.e. z in the world!).
|
||||
objectToWorldMatrix.scale(smf->xscale, smf->zscale, smf->yscale);
|
||||
objectToWorldMatrix.scale(smf->xscale, smf->zscale, smf->yscale / fovscale);
|
||||
|
||||
// Aplying model offsets (model offsets do not depend on model scalings).
|
||||
objectToWorldMatrix.translate(smf->xoffset / smf->xscale, smf->zoffset / smf->zscale, smf->yoffset / smf->yscale);
|
||||
|
@ -528,6 +536,10 @@ static void ParseModelDefLump(int Lump)
|
|||
{
|
||||
smf.flags |= MDL_NOPERPIXELLIGHTING;
|
||||
}
|
||||
else if (sc.Compare("scaleweaponfov"))
|
||||
{
|
||||
smf.flags |= MDL_SCALEWEAPONFOV;
|
||||
}
|
||||
else if (sc.Compare("rotating"))
|
||||
{
|
||||
smf.flags |= MDL_ROTATING;
|
||||
|
|
|
@ -56,6 +56,7 @@ enum
|
|||
MDL_DONTCULLBACKFACES = 256,
|
||||
MDL_USEROTATIONCENTER = 512,
|
||||
MDL_NOPERPIXELLIGHTING = 1024, // forces a model to not use per-pixel lighting. useful for voxel-converted-to-model objects.
|
||||
MDL_SCALEWEAPONFOV = 2048, // scale weapon view model with higher user FOVs
|
||||
};
|
||||
|
||||
FSpriteModelFrame * FindModelFrame(const PClass * ti, int sprite, int frame, bool dropped);
|
||||
|
@ -109,4 +110,6 @@ void BSPWalkCircle(FLevelLocals *Level, float x, float y, float radiusSquared, c
|
|||
void RenderModel(FModelRenderer* renderer, float x, float y, float z, FSpriteModelFrame* smf, AActor* actor, double ticFrac);
|
||||
void RenderHUDModel(FModelRenderer* renderer, DPSprite* psp, float ofsX, float ofsY);
|
||||
|
||||
EXTERN_CVAR(Float, cl_scaleweaponfov)
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue