-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmd5.cpp
90 lines (65 loc) · 1.78 KB
/
md5.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <iostream>
#include <fstream>
#include <vector>
#include <md5/meshfile.hpp>
#include <md5/animfile.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/System/Vector3.hpp>
typedef sf::Vector2f vec2f;
typedef sf::Vector3f vec3f;
BOOST_FUSION_ADAPT_STRUCT
(
sf::Vector2f,
(float, x)
(float, y)
)
BOOST_FUSION_ADAPT_STRUCT
(
sf::Vector3f,
(float, x)
(float, y)
(float, z)
)
/*
* md5::meshfile< vec2i, vec3f > m("test.md5mesh");
* md5::animfile< vec2i, vec3f > a("text.md5mesh");
*
* m.load() ? "geladen" : "failed";
* m.parse() ? "geparsed" : "nicht geparsed";
* md5::check_files(m,a);
* md5::model model(m,a);
*
* model.valid() ? "jupp" : "nopp";
*
*
*
*
*
*/
int main(int argc, const char *argv[])
{
md5::meshfile< vec2f, vec3f > mesh("boblampclean.md5mesh");
md5::animfile< vec3f > anim("boblampclean.md5anim");
std::cout << "[*] Meshfile" << std::endl;
if (! mesh.load() ) {
std::cout << "Could not load meshfile" << std::endl;
return 1;
}
if (mesh.parse()) std::cout << " => Parse succeded.." << std::endl;
else std::cout << " => Parse failed.." << std::endl;
std::cout << "[*] Animfile" << std::endl;
if (! anim.load() ) {
std::cout << "Could not load animfile" << std::endl;
return 1;
}
if (anim.parse()) std::cout << " => Parse succeded.." << std::endl;
else std::cout << " => Parse failed.." << std::endl;
std::cout << "testing my own md5 loader implementation :)" << std::endl;
return 0;
}