Browse Source

modelloader update

seba 13 years ago
parent
commit
3c583f6527
1 changed files with 18 additions and 6 deletions
  1. 18
    6
      models/load3ds.cpp

+ 18
- 6
models/load3ds.cpp View File

@@ -20,24 +20,36 @@ bool Load3ds::parse() {
20 20
 	}
21 21
 	
22 22
 	unsigned short ident;
23
+	unsigned int len;
23 24
 	unsigned char m, n;
24
-	
25
+	std::cout << "size: " << sizeof(int) << std::endl;
25 26
 	while(!mfile.eof()) {
26
-		ident = m = n = 0;
27
+		ident = len = 0;
27 28
 		mfile.read((char *)&ident, 2);
28
-		mfile.read((char *)&m, 1);
29
-		mfile.read((char *)&n, 1);
30
-		std::cout << "Chunk: " << ident << " (" << (int)m << ", " << (int)n << ")" << std::endl;
29
+		mfile.read((char *)&len, 4);
30
+// 		mfile.read((char *)&m, 1);
31
+// 		mfile.read((char *)&n, 1);
32
+		std::cout << "Chunk: 0x" << std::hex << ident << " (" << std::dec << len << ")" << std::endl;
31 33
 		switch(ident) {
32 34
 			case 0x4d4d:
35
+				// Main Chunk
33 36
 				std::cout << "yeah!" << std::endl;
34 37
 			break;
38
+			case 0x3d3d:
39
+				// 3D Editor Chunk
40
+				std::cout << "editorchunk" << std::endl;
41
+			break;
42
+			case 0x4000:
43
+				std::cout << "namechunk" << std::endl;
44
+			break;
35 45
 			default:
36 46
 				//Switch Chunk
37
-				mfile.ignore(m+n);
47
+				std::cout << "einfach ignorieren..." << std::endl;
48
+				mfile.ignore(len-6);
38 49
 			break;
39 50
 		}
40 51
 	}
52
+	mfile.close();
41 53
 
42 54
 	return true;
43 55
 }

Loading…
Cancel
Save