Browse Source

modelloader weitergeschrieben

seba 12 years ago
parent
commit
956ce66c63
1 changed files with 27 additions and 1 deletions
  1. 27
    1
      models/load3ds.cpp

+ 27
- 1
models/load3ds.cpp View File

@@ -1,4 +1,5 @@
1 1
 #include "load3ds.h"
2
+#include "../punkt3d.h"
2 3
 
3 4
 Load3ds::Load3ds(std::string _fname, bool _parse) {
4 5
 	filename = _fname;
@@ -21,7 +22,6 @@ bool Load3ds::parse() {
21 22
 	
22 23
 	unsigned short ident;
23 24
 	unsigned int len;
24
-	unsigned char m, n;
25 25
 	std::cout << "size: " << sizeof(int) << std::endl;
26 26
 	while(!mfile.eof()) {
27 27
 		ident = len = 0;
@@ -40,7 +40,33 @@ bool Load3ds::parse() {
40 40
 				std::cout << "editorchunk" << std::endl;
41 41
 			break;
42 42
 			case 0x4000:
43
+			{
43 44
 				std::cout << "namechunk" << std::endl;
45
+				std::string name;
46
+				char c;
47
+				do {
48
+					mfile.read(&c, 1);
49
+					name += c;
50
+				} while(c!=0);
51
+				std::cout << "Name: " << name << std::endl;
52
+			}
53
+			break;
54
+			case 0x4100:
55
+			break;
56
+			case 0x4110:{
57
+				unsigned short panz;
58
+				Punkt3D p;
59
+				mfile.read((char*)&panz, 2);
60
+				glBegin(GL_LINE_LOOP);
61
+				for(unsigned int i=0; i<panz; i++) {
62
+					mfile.read((char*)&p.x, sizeof(float));
63
+					mfile.read((char*)&p.y, sizeof(float));
64
+					mfile.read((char*)&p.z, sizeof(float));
65
+// 					p.print("Punkt");
66
+					glVertex3f(p);
67
+				}
68
+				glEnd();
69
+			}
44 70
 			break;
45 71
 			default:
46 72
 				//Switch Chunk

Loading…
Cancel
Save