Initialize variables in ModelTypes

This commit is contained in:
sukibaby
2024-08-07 00:52:04 -07:00
committed by teejusb
parent b30bf85399
commit a1c316cfc7
2 changed files with 48 additions and 45 deletions
+2 -2
View File
@@ -303,7 +303,7 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
if (sscanf (sLine, "%f %f %f %f", &fTime, &Position[0], &Position[1], &Position[2]) != 4)
THROW;
msPositionKey key;
msPositionKey key = {};
key.fTime = fTime;
key.Position = RageVector3( Position[0], Position[1], Position[2] );
Bone.PositionKeys[j] = key;
@@ -328,7 +328,7 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
THROW;
Rotation = RadianToDegree(Rotation);
msRotationKey key;
msRotationKey key = {};
key.fTime = fTime;
Rotation = RageVector3( Rotation[0], Rotation[1], Rotation[2] );
RageQuatFromHPR( &key.Rotation, Rotation );
+19 -16
View File
@@ -8,7 +8,6 @@
#include <cstdint>
#include <vector>
struct msTriangle
{
std::uint16_t nVertexIndices[3];
@@ -32,7 +31,6 @@ struct msMesh
class RageTexture;
// merge this into Sprite?
class AnimatedTexture
{
public:
@@ -40,16 +38,16 @@ public:
~AnimatedTexture();
void LoadBlank();
void Load( const RString &sTexOrIniFile );
void Load(const RString &sTexOrIniFile);
void Unload();
void Update( float fDelta );
void Update(float fDelta);
RageTexture* GetCurrentTexture();
int GetNumStates() const;
void SetState( int iNewState );
void SetState(int iNewState);
float GetAnimationLengthSeconds() const;
void SetSecondsIntoAnimation( float fSeconds );
void SetSecondsIntoAnimation(float fSeconds);
float GetSecondsIntoAnimation() const;
RageVector2 GetTextureTranslate();
@@ -66,13 +64,10 @@ private:
float m_fSecsIntoFrame;
struct AnimatedTextureState
{
AnimatedTextureState(
RageTexture* pTexture_,
float fDelaySecs_,
RageVector2 vTranslate_
):
pTexture(pTexture_), fDelaySecs(fDelaySecs_),
vTranslate(vTranslate_) {}
AnimatedTextureState(RageTexture* pTexture_, float fDelaySecs_, RageVector2 vTranslate_)
: pTexture(pTexture_), fDelaySecs(fDelaySecs_), vTranslate(vTranslate_)
{
}
RageTexture* pTexture;
float fDelaySecs;
@@ -102,12 +97,16 @@ struct msPositionKey
{
float fTime;
RageVector3 Position;
msPositionKey() : fTime(0.0f) {}
};
struct msRotationKey
{
float fTime;
RageVector4 Rotation;
msRotationKey() : fTime(0.0f) {}
};
struct msBone
@@ -120,22 +119,26 @@ struct msBone
std::vector<msPositionKey> PositionKeys;
std::vector<msRotationKey> RotationKeys;
msBone() : nFlags(0) {}
};
struct msAnimation
{
int FindBoneByName( const RString &sName ) const
{
for( unsigned i=0; i<Bones.size(); i++ )
if( Bones[i].sName == sName )
for (unsigned i = 0; i < Bones.size(); i++)
{
if (Bones[i].sName == sName)
return i;
}
return -1;
}
bool LoadMilkshapeAsciiBones( RString sAniName, RString sPath );
std::vector<msBone> Bones;
int nTotalFrames;
int nTotalFrames = 0;
};
struct myBone_t