mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- voxel rotation.
This commit is contained in:
parent
55ad51ee1f
commit
d76c2ccc34
3 changed files with 15 additions and 5 deletions
|
@ -304,13 +304,15 @@ void HWDrawInfo::DispatchSprites()
|
|||
if ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT) != CSTAT_SPRITE_ALIGNMENT_SLAB && tiletovox[tspr->picnum] >= 0 && voxmodels[tiletovox[tspr->picnum]])
|
||||
{
|
||||
HWSprite hwsprite;
|
||||
if (hwsprite.ProcessVoxel(this, voxmodels[tiletovox[tspr->picnum]], tspr, §or[tspr->sectnum])) return;
|
||||
int num = tiletovox[tspr->picnum];
|
||||
if (hwsprite.ProcessVoxel(this, voxmodels[tiletovox[tspr->picnum]], tspr, §or[tspr->sectnum], voxrotate[num >> 3] & (1 << (num & 7)))) return;
|
||||
break;
|
||||
}
|
||||
else if ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_SLAB && tspr->picnum < MAXVOXELS && voxmodels[tspr->picnum])
|
||||
{
|
||||
HWSprite hwsprite;
|
||||
hwsprite.ProcessVoxel(this, voxmodels[tspr->picnum], tspr, §or[tspr->sectnum]);
|
||||
int num = tspr->picnum;
|
||||
hwsprite.ProcessVoxel(this, voxmodels[tspr->picnum], tspr, §or[tspr->sectnum], voxrotate[num >> 3] & (1 << (num & 7)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ public:
|
|||
void CreateVertices(HWDrawInfo* di);
|
||||
void PutSprite(HWDrawInfo *di, bool translucent);
|
||||
void Process(HWDrawInfo *di, spritetype* thing,sectortype * sector, int thruportal = false);
|
||||
bool ProcessVoxel(HWDrawInfo* di, voxmodel_t* voxel, spritetype* tspr, sectortype* sector);
|
||||
bool ProcessVoxel(HWDrawInfo* di, voxmodel_t* voxel, spritetype* tspr, sectortype* sector, bool rotate);
|
||||
|
||||
void DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent);
|
||||
};
|
||||
|
|
|
@ -468,7 +468,7 @@ void HWSprite::Process(HWDrawInfo* di, spritetype* spr, sectortype* sector, int
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, spritetype* spr, sectortype* sector)
|
||||
bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, spritetype* spr, sectortype* sector, bool rotate)
|
||||
{
|
||||
sprite = spr;
|
||||
|
||||
|
@ -481,6 +481,14 @@ bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, spritetype* spr, se
|
|||
visibility = sectorVisibility(sector);
|
||||
voxel = vox;
|
||||
|
||||
auto ang = spr->ang;
|
||||
if ((spr->cstat & CSTAT_SPRITE_MDLROTATE) || rotate)
|
||||
{
|
||||
int myclock = (PlayClock << 3) + MulScale(4 << 3, (int)di->Viewpoint.TicFrac, 16);
|
||||
ang = (ang + myclock) & 2047; // will be applied in md3_vox_calcmat_common.
|
||||
}
|
||||
|
||||
|
||||
if (!vox || (spr->cstat & CSTAT_SPRITE_ALIGNMENT) == CSTAT_SPRITE_ALIGNMENT_FLOOR) return false;
|
||||
|
||||
bool trans = (spr->cstat & CSTAT_SPRITE_TRANSLUCENT);
|
||||
|
@ -549,7 +557,7 @@ bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, spritetype* spr, se
|
|||
|
||||
rotmat.loadIdentity();
|
||||
rotmat.translate(x + translatevec.X, z - translatevec.Z, y - translatevec.Y);
|
||||
rotmat.rotate(buildang(spr->ang).asdeg() - 90.f, 0, 1, 0);
|
||||
rotmat.rotate(buildang(ang).asdeg() - 90.f, 0, 1, 0);
|
||||
rotmat.scale(scalevec.X, scalevec.Z, scalevec.Y);
|
||||
// Apply pivot last
|
||||
rotmat.translate(-voxel->piv.x, zoff, voxel->piv.y);
|
||||
|
|
Loading…
Reference in a new issue