Make coord transfor for hs1 files optional
parent
104a70f845
commit
88cb1a2ea1
|
@ -63,7 +63,8 @@ struct HL1ImportSettings {
|
||||||
read_bone_controllers(false),
|
read_bone_controllers(false),
|
||||||
read_hitboxes(false),
|
read_hitboxes(false),
|
||||||
read_textures(false),
|
read_textures(false),
|
||||||
read_misc_global_info(false) {
|
read_misc_global_info(false),
|
||||||
|
transform_coord_system(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool read_animations;
|
bool read_animations;
|
||||||
|
@ -76,6 +77,7 @@ struct HL1ImportSettings {
|
||||||
bool read_hitboxes;
|
bool read_hitboxes;
|
||||||
bool read_textures;
|
bool read_textures;
|
||||||
bool read_misc_global_info;
|
bool read_misc_global_info;
|
||||||
|
bool transform_coord_system;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace HalfLife
|
} // namespace HalfLife
|
||||||
|
|
|
@ -146,6 +146,20 @@ const aiImporterDesc *MDLImporter::GetInfo() const {
|
||||||
return &desc;
|
return &desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
static void transformCoordinateSystem(const aiScene *pScene) {
|
||||||
|
if (pScene == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pScene->mRootNode->mTransformation = aiMatrix4x4(
|
||||||
|
0.f, -1.f, 0.f, 0.f,
|
||||||
|
0.f, 0.f, 1.f, 0.f,
|
||||||
|
-1.f, 0.f, 0.f, 0.f,
|
||||||
|
0.f, 0.f, 0.f, 1.f
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Imports the given file into the given scene structure.
|
// Imports the given file into the given scene structure.
|
||||||
void MDLImporter::InternReadFile(const std::string &pFile,
|
void MDLImporter::InternReadFile(const std::string &pFile,
|
||||||
|
@ -246,18 +260,16 @@ void MDLImporter::InternReadFile(const std::string &pFile,
|
||||||
". Magic word (", ai_str_toprintable((const char *)&iMagicWord, sizeof(iMagicWord)), ") is not known");
|
". Magic word (", ai_str_toprintable((const char *)&iMagicWord, sizeof(iMagicWord)), ") is not known");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_half_life){
|
if (is_half_life && mHL1ImportSettings.transform_coord_system) {
|
||||||
// Now rotate the whole scene 90 degrees around the z and x axes to convert to internal coordinate system
|
// Now rotate the whole scene 90 degrees around the z and x axes to convert to internal coordinate system
|
||||||
pScene->mRootNode->mTransformation = aiMatrix4x4(
|
transformCoordinateSystem(pScene);
|
||||||
0.f, -1.f, 0.f, 0.f,
|
} else {
|
||||||
0.f, 0.f, 1.f, 0.f,
|
|
||||||
-1.f, 0.f, 0.f, 0.f,
|
|
||||||
0.f, 0.f, 0.f, 1.f);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Now rotate the whole scene 90 degrees around the x axis to convert to internal coordinate system
|
// Now rotate the whole scene 90 degrees around the x axis to convert to internal coordinate system
|
||||||
pScene->mRootNode->mTransformation = aiMatrix4x4(1.f, 0.f, 0.f, 0.f,
|
pScene->mRootNode->mTransformation = aiMatrix4x4(
|
||||||
0.f, 0.f, 1.f, 0.f, 0.f, -1.f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f);
|
1.f, 0.f, 0.f, 0.f,
|
||||||
|
0.f, 0.f, 1.f, 0.f,
|
||||||
|
0.f, -1.f, 0.f, 0.f,
|
||||||
|
0.f, 0.f, 0.f, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteBufferAndCleanup();
|
DeleteBufferAndCleanup();
|
||||||
|
|
Loading…
Reference in New Issue