mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-03-10 11:11:51 +00:00
IQM 4.9 Last patch
- Improved performance of YZ axis swap matrix calculations by calculating them with the initial matrix calculations. - IQMs with no bones will no longer crash
This commit is contained in:
parent
303e751a81
commit
9063bc8ef6
1 changed files with 81 additions and 84 deletions
|
@ -59,11 +59,11 @@ bool IQMModel::Load(const char* path, int lumpnum, const char* buffer, int lengt
|
||||||
uint32_t num_extensions = reader.ReadUInt32();
|
uint32_t num_extensions = reader.ReadUInt32();
|
||||||
uint32_t ofs_extensions = reader.ReadUInt32();
|
uint32_t ofs_extensions = reader.ReadUInt32();
|
||||||
|
|
||||||
if (num_joints <= 0)
|
/*if (num_joints <= 0)
|
||||||
{
|
{
|
||||||
Printf("Invalid model: \"%s%s\", no joint data is present\n", path, fileSystem.GetLongName(mLumpNum).GetChars());
|
Printf("Invalid model: \"%s%s\", no joint data is present\n", path, fileSystem.GetLongName(mLumpNum).GetChars());
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (num_text == 0)
|
if (num_text == 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -513,10 +513,11 @@ const TArray<TRS>* IQMModel::AttachAnimationData()
|
||||||
const TArray<VSMatrix> IQMModel::CalculateBones(int frame1, int frame2, double inter, const TArray<TRS>& animationData, AActor* actor, int index)
|
const TArray<VSMatrix> IQMModel::CalculateBones(int frame1, int frame2, double inter, const TArray<TRS>& animationData, AActor* actor, int index)
|
||||||
{
|
{
|
||||||
const TArray<TRS>& animationFrames = &animationData ? animationData : TRSData;
|
const TArray<TRS>& animationFrames = &animationData ? animationData : TRSData;
|
||||||
|
if (Joints.Size() > 0)
|
||||||
|
{
|
||||||
int numbones = Joints.Size();
|
int numbones = Joints.Size();
|
||||||
|
|
||||||
if(actor->boneComponentData->trscomponents[index].Size() != numbones)
|
if (actor->boneComponentData->trscomponents[index].Size() != numbones)
|
||||||
actor->boneComponentData->trscomponents[index].Resize(numbones);
|
actor->boneComponentData->trscomponents[index].Resize(numbones);
|
||||||
if (actor->boneComponentData->trsmatrix[index].Size() != numbones)
|
if (actor->boneComponentData->trsmatrix[index].Size() != numbones)
|
||||||
actor->boneComponentData->trsmatrix[index].Resize(numbones);
|
actor->boneComponentData->trsmatrix[index].Resize(numbones);
|
||||||
|
@ -580,27 +581,23 @@ const TArray<VSMatrix> IQMModel::CalculateBones(int frame1, int frame2, double i
|
||||||
if (Joints[i].Parent >= 0)
|
if (Joints[i].Parent >= 0)
|
||||||
{
|
{
|
||||||
result = bones[Joints[i].Parent];
|
result = bones[Joints[i].Parent];
|
||||||
|
result.multMatrix(swapYZ);
|
||||||
result.multMatrix(baseframe[Joints[i].Parent]);
|
result.multMatrix(baseframe[Joints[i].Parent]);
|
||||||
result.multMatrix(m);
|
result.multMatrix(m);
|
||||||
result.multMatrix(inversebaseframe[i]);
|
result.multMatrix(inversebaseframe[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = m;
|
result.loadMatrix(swapYZ);
|
||||||
|
result.multMatrix(m);
|
||||||
result.multMatrix(inversebaseframe[i]);
|
result.multMatrix(inversebaseframe[i]);
|
||||||
}
|
}
|
||||||
|
result.multMatrix(swapYZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
actor->boneComponentData->trsmatrix[index] = bones;
|
actor->boneComponentData->trsmatrix[index] = bones;
|
||||||
|
|
||||||
for (int j = 0; j < numbones; j++)
|
|
||||||
{
|
|
||||||
VSMatrix m;
|
|
||||||
m.loadMatrix(swapYZ);
|
|
||||||
m.multMatrix(bones[j]);
|
|
||||||
m.multMatrix(swapYZ);
|
|
||||||
bones[j] = m;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bones;
|
return bones;
|
||||||
|
}
|
||||||
|
return {};
|
||||||
}
|
}
|
Loading…
Reference in a new issue