modelloader update

This commit is contained in:
seba 2008-04-10 18:55:31 +02:00
parent e4d98e5434
commit 3c583f6527
1 changed files with 18 additions and 6 deletions

View File

@ -20,24 +20,36 @@ bool Load3ds::parse() {
} }
unsigned short ident; unsigned short ident;
unsigned int len;
unsigned char m, n; unsigned char m, n;
std::cout << "size: " << sizeof(int) << std::endl;
while(!mfile.eof()) { while(!mfile.eof()) {
ident = m = n = 0; ident = len = 0;
mfile.read((char *)&ident, 2); mfile.read((char *)&ident, 2);
mfile.read((char *)&m, 1); mfile.read((char *)&len, 4);
mfile.read((char *)&n, 1); // mfile.read((char *)&m, 1);
std::cout << "Chunk: " << ident << " (" << (int)m << ", " << (int)n << ")" << std::endl; // mfile.read((char *)&n, 1);
std::cout << "Chunk: 0x" << std::hex << ident << " (" << std::dec << len << ")" << std::endl;
switch(ident) { switch(ident) {
case 0x4d4d: case 0x4d4d:
// Main Chunk
std::cout << "yeah!" << std::endl; std::cout << "yeah!" << std::endl;
break; break;
case 0x3d3d:
// 3D Editor Chunk
std::cout << "editorchunk" << std::endl;
break;
case 0x4000:
std::cout << "namechunk" << std::endl;
break;
default: default:
//Switch Chunk //Switch Chunk
mfile.ignore(m+n); std::cout << "einfach ignorieren..." << std::endl;
mfile.ignore(len-6);
break; break;
} }
} }
mfile.close();
return true; return true;
} }