mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 12:32:34 +00:00
- added interpolation for actor angles which for models is needed.
This commit is contained in:
parent
1884c8a98d
commit
c0ef052d07
3 changed files with 20 additions and 14 deletions
|
@ -1318,6 +1318,14 @@ public:
|
||||||
{
|
{
|
||||||
return Prev + (ticFrac * (Pos() - Prev));
|
return Prev + (ticFrac * (Pos() - Prev));
|
||||||
}
|
}
|
||||||
|
DRotator InterpolatedAngles(double ticFrac) const
|
||||||
|
{
|
||||||
|
DRotator result;
|
||||||
|
result.Yaw = PrevAngles.Yaw + deltaangle(PrevAngles.Yaw, Angles.Yaw) * ticFrac;
|
||||||
|
result.Pitch = PrevAngles.Pitch + deltaangle(PrevAngles.Pitch, Angles.Pitch) * ticFrac;
|
||||||
|
result.Roll = PrevAngles.Roll + deltaangle(PrevAngles.Roll, Angles.Roll) * ticFrac;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
DVector3 PosPlusZ(double zadd) const
|
DVector3 PosPlusZ(double zadd) const
|
||||||
{
|
{
|
||||||
return { X(), Y(), Z() + zadd };
|
return { X(), Y(), Z() + zadd };
|
||||||
|
|
|
@ -119,11 +119,11 @@ void GLSprite::CalculateVertices(FVector3 *v)
|
||||||
// Tilt the actor up or down based on pitch (increase 'somersaults' forward).
|
// Tilt the actor up or down based on pitch (increase 'somersaults' forward).
|
||||||
// Then counteract the roll and DO A BARREL ROLL.
|
// Then counteract the roll and DO A BARREL ROLL.
|
||||||
|
|
||||||
FAngle pitch = (float)-actor->Angles.Pitch.Degrees;
|
FAngle pitch = (float)-Angles.Pitch.Degrees;
|
||||||
pitch.Normalized180();
|
pitch.Normalized180();
|
||||||
|
|
||||||
mat.Translate(x, z, y);
|
mat.Translate(x, z, y);
|
||||||
mat.Rotate(0, 1, 0, 270. - actor->Angles.Yaw.Degrees);
|
mat.Rotate(0, 1, 0, 270. - Angles.Yaw.Degrees);
|
||||||
mat.Rotate(1, 0, 0, pitch.Degrees);
|
mat.Rotate(1, 0, 0, pitch.Degrees);
|
||||||
|
|
||||||
if (actor->renderflags & RF_ROLLCENTER)
|
if (actor->renderflags & RF_ROLLCENTER)
|
||||||
|
@ -132,12 +132,12 @@ void GLSprite::CalculateVertices(FVector3 *v)
|
||||||
float cy = (y1 + y2) * 0.5;
|
float cy = (y1 + y2) * 0.5;
|
||||||
|
|
||||||
mat.Translate(cx - x, 0, cy - y);
|
mat.Translate(cx - x, 0, cy - y);
|
||||||
mat.Rotate(0, 1, 0, - actor->Angles.Roll.Degrees);
|
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees);
|
||||||
mat.Translate(-cx, -z, -cy);
|
mat.Translate(-cx, -z, -cy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mat.Rotate(0, 1, 0, - actor->Angles.Roll.Degrees);
|
mat.Rotate(0, 1, 0, - Angles.Roll.Degrees);
|
||||||
mat.Translate(-x, -z, -y);
|
mat.Translate(-x, -z, -y);
|
||||||
}
|
}
|
||||||
v[0] = mat * FVector3(x2, z, y2);
|
v[0] = mat * FVector3(x2, z, y2);
|
||||||
|
@ -199,11 +199,11 @@ void GLSprite::CalculateVertices(FVector3 *v)
|
||||||
// [fgsfds] calculate yaw vectors
|
// [fgsfds] calculate yaw vectors
|
||||||
float yawvecX = 0, yawvecY = 0, rollDegrees = 0;
|
float yawvecX = 0, yawvecY = 0, rollDegrees = 0;
|
||||||
float angleRad = (270. - GLRenderer->mAngles.Yaw).Radians();
|
float angleRad = (270. - GLRenderer->mAngles.Yaw).Radians();
|
||||||
if (actor) rollDegrees = actor->Angles.Roll.Degrees;
|
if (actor) rollDegrees = Angles.Roll.Degrees;
|
||||||
if (isFlatSprite)
|
if (isFlatSprite)
|
||||||
{
|
{
|
||||||
yawvecX = actor->Angles.Yaw.Cos();
|
yawvecX = Angles.Yaw.Cos();
|
||||||
yawvecY = actor->Angles.Yaw.Sin();
|
yawvecY = Angles.Yaw.Sin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// [fgsfds] Rotate the sprite about the sight vector (roll)
|
// [fgsfds] Rotate the sprite about the sight vector (roll)
|
||||||
|
@ -712,10 +712,6 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (thing == camera)
|
|
||||||
{
|
|
||||||
int a = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't draw first frame of a player missile
|
// don't draw first frame of a player missile
|
||||||
if (thing->flags&MF_MISSILE)
|
if (thing->flags&MF_MISSILE)
|
||||||
|
@ -737,6 +733,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
||||||
int clipres = GLRenderer->mClipPortal->ClipPoint(thingpos);
|
int clipres = GLRenderer->mClipPortal->ClipPoint(thingpos);
|
||||||
if (clipres == GLPortal::PClip_InFront) return;
|
if (clipres == GLPortal::PClip_InFront) return;
|
||||||
}
|
}
|
||||||
|
Angles = thing->InterpolatedAngles(r_TicFracF);
|
||||||
|
|
||||||
player_t *player = &players[consoleplayer];
|
player_t *player = &players[consoleplayer];
|
||||||
FloatRect r;
|
FloatRect r;
|
||||||
|
@ -783,7 +780,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
||||||
}
|
}
|
||||||
else if (!(thing->renderflags & RF_FLATSPRITE))
|
else if (!(thing->renderflags & RF_FLATSPRITE))
|
||||||
{
|
{
|
||||||
patch = gl_GetSpriteFrame(spritenum, thing->frame, -1, (ang - (thing->Angles.Yaw + thing->SpriteRotation)).BAMs(), &mirror);
|
patch = gl_GetSpriteFrame(spritenum, thing->frame, -1, (ang - (Angles.Yaw + thing->SpriteRotation)).BAMs(), &mirror);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -854,8 +851,8 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RF_WALLSPRITE:
|
case RF_WALLSPRITE:
|
||||||
viewvecX = thing->Angles.Yaw.Cos();
|
viewvecX = Angles.Yaw.Cos();
|
||||||
viewvecY = thing->Angles.Yaw.Sin();
|
viewvecY = Angles.Yaw.Sin();
|
||||||
|
|
||||||
x1 = x + viewvecY*leftfac;
|
x1 = x + viewvecY*leftfac;
|
||||||
x2 = x + viewvecY*rightfac;
|
x2 = x + viewvecY*rightfac;
|
||||||
|
|
|
@ -376,6 +376,7 @@ public:
|
||||||
AActor * actor;
|
AActor * actor;
|
||||||
particle_t * particle;
|
particle_t * particle;
|
||||||
TArray<lightlist_t> *lightlist;
|
TArray<lightlist_t> *lightlist;
|
||||||
|
DRotator Angles;
|
||||||
|
|
||||||
void SplitSprite(sector_t * frontsector, bool translucent);
|
void SplitSprite(sector_t * frontsector, bool translucent);
|
||||||
void SetLowerParam();
|
void SetLowerParam();
|
||||||
|
|
Loading…
Reference in a new issue