You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
803 B

#include "load3ds.h"
Load3ds::Load3ds(std::string _fname, bool _parse) {
filename = _fname;
parsed = false;
error = false;
if(_parse)
parse();
}
bool Load3ds::parse() {
if(parsed)
unload();
std::ifstream mfile(filename.c_str(), std::ios::binary);
if(!mfile) {
return false;
}
unsigned short ident;
unsigned char m, n;
while(!mfile.eof()) {
ident = m = n = 0;
mfile.read((char *)&ident, 2);
mfile.read((char *)&m, 1);
mfile.read((char *)&n, 1);
std::cout << "Chunk: " << ident << " (" << (int)m << ", " << (int)n << ")" << std::endl;
switch(ident) {
case 0x4d4d:
std::cout << "yeah!" << std::endl;
break;
default:
//Switch Chunk
mfile.ignore(m+n);
break;
}
}
return true;
}
void Load3ds::unload() {
parsed = false;
error = false;
}