-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathImportMorphMesh.cpp
45 lines (34 loc) · 1.27 KB
/
ImportMorphMesh.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "ImportMorphMesh.hpp"
#include "ImportStaticMesh.hpp"
#include <zenload/zCMorphMesh.h>
using namespace bs;
using namespace BsZenLib;
// - Implementation --------------------------------------------------------------------------------
Res::HMeshWithMaterials BsZenLib::ImportAndCacheMorphMesh(const bs::String& originalFileName,
const VDFS::FileIndex& vdfs)
{
bs::String actualName = originalFileName;
enum
{
CompareCaseSensitive = false,
ConvertToLowerCase = true,
};
// Resolve uncompiled file extension
if (bs::StringUtil::endsWith(originalFileName, ".mms", ConvertToLowerCase))
{
actualName = originalFileName.substr(0, originalFileName.size() - 4) + ".MMB";
}
ZenLoad::zCMorphMesh mesh(originalFileName.c_str(), vdfs);
if (mesh.getMesh().getNumSubmeshes() == 0) return {};
ZenLoad::PackedMesh packedMesh;
mesh.getMesh().packMesh(packedMesh, 0.01f);
return ImportAndCacheStaticMesh(originalFileName, packedMesh, vdfs);
}
Res::HMeshWithMaterials BsZenLib::LoadCachedMorphMesh(const bs::String& originalFileName)
{
return LoadCachedStaticMesh(originalFileName);
}
bool BsZenLib::HasCachedMorphMesh(const bs::String& originalFileName)
{
return HasCachedStaticMesh(originalFileName);
}