-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbmdinfo.cpp
61 lines (52 loc) · 1.19 KB
/
bmdinfo.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
#include <iostream>
#include <cstdarg>
using namespace std;
#include "bmdread.h"
#include "openfile.h"
#include "addons/exportTexture.h"
#include "addons/export3ds.h"
//has to be implemented (TODO...)
void setStartupText(const std::string& s)
{
cout << s << endl;
}
//dito (TODO...)
void warn(const char* msg, ...)
{
va_list argList;
va_start(argList, msg);
char buff[161];
vsnprintf(buff, 161, msg, argList);
va_end(argList);
cout << buff << endl;
}
int main(int argc, char* argv[])
{
if(argc < 2)
return -1;
OpenedFile* f = openFile(argv[1]);
if(f == 0)
return -2;
#if 1
writeBmdInfo(f->f, cout);
#elif 0
BModel* mod = loadBmd(f->f);
exportTextures(TGA, mod->tex1, string("testdata/tex") + strchr(argv[1], '/'));
delete mod;
#elif 1
BModel* mod = loadBmd(f->f);
exportAs3ds(*mod, string("testdata/3ds")
+ strchr(argv[1], '/') + string(".3ds"));
delete mod;
#else
BModel* mod = loadBmd(f->f);
for(int i = 0; i < mod->tex1.images.size(); ++i)
{
Image& img = mod->tex1.images[i];
cout << img.originalFormat << ' ' << img.paletteFormat << ' '
<< img.width << ' ' << img.height << endl;
}
delete mod;
#endif
closeFile(f);
}