This repository has been archived by the owner on Sep 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
phonon.cpp
65 lines (62 loc) · 1.43 KB
/
phonon.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <cstdint>
#include "dynamic.h"
extern "C"
{
__declspec(dllexport) bool __stdcall RequestDynamicInformation(const char* DynamicHash, const char* pkgsPath, int& MeshCount, bool& bHasSkeleton)
{
Dynamic dynamic = Dynamic(DynamicHash, pkgsPath);
int status = dynamic.RequestInfo(MeshCount, bHasSkeleton);
if (status)
{
return true;
}
else
{
return false;
}
}
__declspec(dllexport) bool __stdcall RequestSaveDynamicMeshData(const char* DynamicHash, const char* pkgsPath)
{
Dynamic dynamic = Dynamic(DynamicHash, pkgsPath);
int status = dynamic.RequestSaveDynamicMeshData();
if (status)
{
return true;
}
else
{
return false;
}
}
__declspec(dllexport) bool __stdcall RequestExportDynamic(const char* DynamicHash, const char* pkgsPath, const char* ExportPath, const char* ExportName, bool bTextures)
{
std::unordered_map<uint64_t, uint32_t> hash64Table;
std::ifstream f("h64");
if (f)
{
hash64Table = loadH64Table();
if (hash64Table.size() < 10000)
{
hash64Table = generateH64Table(pkgsPath);
saveH64Table(hash64Table);
}
}
else
{
hash64Table = generateH64Table(pkgsPath);
saveH64Table(hash64Table);
}
Dynamic dynamic = Dynamic(DynamicHash, hash64Table, pkgsPath, bTextures, -1);
int status = dynamic.get();
if (status)
{
dynamic.pack(ExportPath, false);
dynamic.save(ExportPath, ExportName);
return true;
}
else
{
return false;
}
}
}