Added 'NoPerPixelLighting' flag to models to force it to not use per-pixel lighting. Main use case is for voxels that have been converted to models.

This commit is contained in:
nashmuhandes 2021-10-21 15:55:57 +08:00 committed by Christoph Oelckers
parent 2420371c46
commit 1c3e0f1a75
3 changed files with 6 additions and 1 deletions

View file

@ -524,6 +524,10 @@ static void ParseModelDefLump(int Lump)
{ {
smf.flags |= MDL_USEACTORROLL; smf.flags |= MDL_USEACTORROLL;
} }
else if (sc.Compare("noperpixellighting"))
{
smf.flags |= MDL_NOPERPIXELLIGHTING;
}
else if (sc.Compare("rotating")) else if (sc.Compare("rotating"))
{ {
smf.flags |= MDL_ROTATING; smf.flags |= MDL_ROTATING;

View file

@ -55,6 +55,7 @@ enum
MDL_BADROTATION = 128, MDL_BADROTATION = 128,
MDL_DONTCULLBACKFACES = 256, MDL_DONTCULLBACKFACES = 256,
MDL_USEROTATIONCENTER = 512, MDL_USEROTATIONCENTER = 512,
MDL_NOPERPIXELLIGHTING = 1024, // forces a model to not use per-pixel lighting. useful for voxel-converted-to-model objects.
}; };
FSpriteModelFrame * FindModelFrame(const PClass * ti, int sprite, int frame, bool dropped); FSpriteModelFrame * FindModelFrame(const PClass * ti, int sprite, int frame, bool dropped);

View file

@ -482,7 +482,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
inline void HWSprite::PutSprite(HWDrawInfo *di, bool translucent) inline void HWSprite::PutSprite(HWDrawInfo *di, bool translucent)
{ {
// That's a lot of checks... // That's a lot of checks...
if (modelframe && !modelframe->isVoxel && RenderStyle.BlendOp != STYLEOP_Shadow && gl_light_sprites && di->Level->HasDynamicLights && !di->isFullbrightScene() && !fullbright) if (modelframe && !modelframe->isVoxel && !(modelframe->flags & MDL_NOPERPIXELLIGHTING) && RenderStyle.BlendOp != STYLEOP_Shadow && gl_light_sprites && di->Level->HasDynamicLights && !di->isFullbrightScene() && !fullbright)
{ {
hw_GetDynModelLight(actor, lightdata); hw_GetDynModelLight(actor, lightdata);
dynlightindex = screen->mLights->UploadLights(lightdata); dynlightindex = screen->mLights->UploadLights(lightdata);