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) if (sscanf (sLine, "%f %f %f %f", &fTime, &Position[0], &Position[1], &Position[2]) != 4)
THROW; THROW;
msPositionKey key; msPositionKey key = {};
key.fTime = fTime; key.fTime = fTime;
key.Position = RageVector3( Position[0], Position[1], Position[2] ); key.Position = RageVector3( Position[0], Position[1], Position[2] );
Bone.PositionKeys[j] = key; Bone.PositionKeys[j] = key;
@@ -328,7 +328,7 @@ bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath )
THROW; THROW;
Rotation = RadianToDegree(Rotation); Rotation = RadianToDegree(Rotation);
msRotationKey key; msRotationKey key = {};
key.fTime = fTime; key.fTime = fTime;
Rotation = RageVector3( Rotation[0], Rotation[1], Rotation[2] ); Rotation = RageVector3( Rotation[0], Rotation[1], Rotation[2] );
RageQuatFromHPR( &key.Rotation, Rotation ); RageQuatFromHPR( &key.Rotation, Rotation );
+13 -10
View File
@@ -8,7 +8,6 @@
#include <cstdint> #include <cstdint>
#include <vector> #include <vector>
struct msTriangle struct msTriangle
{ {
std::uint16_t nVertexIndices[3]; std::uint16_t nVertexIndices[3];
@@ -32,7 +31,6 @@ struct msMesh
class RageTexture; class RageTexture;
// merge this into Sprite?
class AnimatedTexture class AnimatedTexture
{ {
public: public:
@@ -66,13 +64,10 @@ private:
float m_fSecsIntoFrame; float m_fSecsIntoFrame;
struct AnimatedTextureState struct AnimatedTextureState
{ {
AnimatedTextureState( AnimatedTextureState(RageTexture* pTexture_, float fDelaySecs_, RageVector2 vTranslate_)
RageTexture* pTexture_, : pTexture(pTexture_), fDelaySecs(fDelaySecs_), vTranslate(vTranslate_)
float fDelaySecs_, {
RageVector2 vTranslate_ }
):
pTexture(pTexture_), fDelaySecs(fDelaySecs_),
vTranslate(vTranslate_) {}
RageTexture* pTexture; RageTexture* pTexture;
float fDelaySecs; float fDelaySecs;
@@ -102,12 +97,16 @@ struct msPositionKey
{ {
float fTime; float fTime;
RageVector3 Position; RageVector3 Position;
msPositionKey() : fTime(0.0f) {}
}; };
struct msRotationKey struct msRotationKey
{ {
float fTime; float fTime;
RageVector4 Rotation; RageVector4 Rotation;
msRotationKey() : fTime(0.0f) {}
}; };
struct msBone struct msBone
@@ -120,6 +119,8 @@ struct msBone
std::vector<msPositionKey> PositionKeys; std::vector<msPositionKey> PositionKeys;
std::vector<msRotationKey> RotationKeys; std::vector<msRotationKey> RotationKeys;
msBone() : nFlags(0) {}
}; };
struct msAnimation struct msAnimation
@@ -127,15 +128,17 @@ struct msAnimation
int FindBoneByName( const RString &sName ) const int FindBoneByName( const RString &sName ) const
{ {
for (unsigned i = 0; i < Bones.size(); i++) for (unsigned i = 0; i < Bones.size(); i++)
{
if (Bones[i].sName == sName) if (Bones[i].sName == sName)
return i; return i;
}
return -1; return -1;
} }
bool LoadMilkshapeAsciiBones( RString sAniName, RString sPath ); bool LoadMilkshapeAsciiBones( RString sAniName, RString sPath );
std::vector<msBone> Bones; std::vector<msBone> Bones;
int nTotalFrames; int nTotalFrames = 0;
}; };
struct myBone_t struct myBone_t