modelloader weitergeschrieben

This commit is contained in:
seba 2008-04-10 22:03:45 +02:00
parent 3c583f6527
commit 956ce66c63
1 changed files with 27 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#include "load3ds.h" #include "load3ds.h"
#include "../punkt3d.h"
Load3ds::Load3ds(std::string _fname, bool _parse) { Load3ds::Load3ds(std::string _fname, bool _parse) {
filename = _fname; filename = _fname;
@ -21,7 +22,6 @@ bool Load3ds::parse() {
unsigned short ident; unsigned short ident;
unsigned int len; unsigned int len;
unsigned char m, n;
std::cout << "size: " << sizeof(int) << std::endl; std::cout << "size: " << sizeof(int) << std::endl;
while(!mfile.eof()) { while(!mfile.eof()) {
ident = len = 0; ident = len = 0;
@ -40,7 +40,33 @@ bool Load3ds::parse() {
std::cout << "editorchunk" << std::endl; std::cout << "editorchunk" << std::endl;
break; break;
case 0x4000: case 0x4000:
{
std::cout << "namechunk" << std::endl; std::cout << "namechunk" << std::endl;
std::string name;
char c;
do {
mfile.read(&c, 1);
name += c;
} while(c!=0);
std::cout << "Name: " << name << std::endl;
}
break;
case 0x4100:
break;
case 0x4110:{
unsigned short panz;
Punkt3D p;
mfile.read((char*)&panz, 2);
glBegin(GL_LINE_LOOP);
for(unsigned int i=0; i<panz; i++) {
mfile.read((char*)&p.x, sizeof(float));
mfile.read((char*)&p.y, sizeof(float));
mfile.read((char*)&p.z, sizeof(float));
// p.print("Punkt");
glVertex3f(p);
}
glEnd();
}
break; break;
default: default:
//Switch Chunk //Switch Chunk