- use standard sprite lighting for voxels.

Per-pixel lighting requires normals which voxels do not have.
This commit is contained in:
Christoph Oelckers 2018-10-31 12:28:10 +01:00
parent 3a6f186aa0
commit 41fd34e424
3 changed files with 3 additions and 1 deletions

View File

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

View File

@ -509,6 +509,7 @@ void InitModels()
FVoxelModel *md = (FVoxelModel*)Models[VoxelDefs[i]->Voxel->VoxelIndex]; FVoxelModel *md = (FVoxelModel*)Models[VoxelDefs[i]->Voxel->VoxelIndex];
FSpriteModelFrame smf; FSpriteModelFrame smf;
memset(&smf, 0, sizeof(smf)); memset(&smf, 0, sizeof(smf));
smf.isVoxel = true;
smf.modelIDs[1] = smf.modelIDs[2] = smf.modelIDs[3] = -1; smf.modelIDs[1] = smf.modelIDs[2] = smf.modelIDs[3] = -1;
smf.modelIDs[0] = VoxelDefs[i]->Voxel->VoxelIndex; smf.modelIDs[0] = VoxelDefs[i]->Voxel->VoxelIndex;
smf.skinIDs[0] = md->GetPaletteTexture(); smf.skinIDs[0] = md->GetPaletteTexture();

View File

@ -475,6 +475,7 @@ struct FSpriteModelFrame
float angleoffset; float angleoffset;
// added pithoffset, rolloffset. // added pithoffset, rolloffset.
float pitchoffset, rolloffset; // I don't want to bother with type transformations, so I made this variables float. float pitchoffset, rolloffset; // I don't want to bother with type transformations, so I made this variables float.
bool isVoxel;
}; };
FSpriteModelFrame * FindModelFrame(const PClass * ti, int sprite, int frame, bool dropped); FSpriteModelFrame * FindModelFrame(const PClass * ti, int sprite, int frame, bool dropped);