mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
Add option to use Rotation-Center for an actor's normal pitch/angle/roll rotation.
This commit is contained in:
parent
6e8dbb590d
commit
bba3027d37
2 changed files with 16 additions and 0 deletions
|
@ -125,9 +125,17 @@ void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *s
|
|||
|
||||
// Applying model transformations:
|
||||
// 1) Applying actor angle, pitch and roll to the model
|
||||
if (smf->flags & MDL_USEROTATIONCENTER)
|
||||
{
|
||||
objectToWorldMatrix.translate(smf->rotationCenterX, smf->rotationCenterZ, smf->rotationCenterY);
|
||||
}
|
||||
objectToWorldMatrix.rotate(-angle, 0, 1, 0);
|
||||
objectToWorldMatrix.rotate(pitch, 0, 0, 1);
|
||||
objectToWorldMatrix.rotate(-roll, 1, 0, 0);
|
||||
if (smf->flags & MDL_USEROTATIONCENTER)
|
||||
{
|
||||
objectToWorldMatrix.translate(-smf->rotationCenterX, -smf->rotationCenterZ, -smf->rotationCenterY);
|
||||
}
|
||||
|
||||
// 2) Applying Doomsday like rotation of the weapon pickup models
|
||||
// The rotation angle is based on the elapsed time.
|
||||
|
@ -789,6 +797,13 @@ void gl_InitModels()
|
|||
{
|
||||
smf.flags |= MDL_DONTCULLBACKFACES;
|
||||
}
|
||||
else if (sc.Compare("userotationcenter"))
|
||||
{
|
||||
smf.flags |= MDL_USEROTATIONCENTER;
|
||||
smf.rotationCenterX = 0.;
|
||||
smf.rotationCenterY = 0.;
|
||||
smf.rotationCenterZ = 0.;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptMessage("Unrecognized string \"%s\"", sc.String);
|
||||
|
|
|
@ -447,6 +447,7 @@ enum
|
|||
MDL_USEACTORROLL = 64,
|
||||
MDL_BADROTATION = 128,
|
||||
MDL_DONTCULLBACKFACES = 256,
|
||||
MDL_USEROTATIONCENTER = 512,
|
||||
};
|
||||
|
||||
struct FSpriteModelFrame
|
||||
|
|
Loading…
Reference in a new issue