1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 // Based on Benjamin Haischs work on sklb-files.
24 
25 #include <fstream>
26 #include <string>
27 #include <iostream>
28 #include "filetools.h"
29 #include "tools/lab.h"
30 
31 using namespace std;
32 
main(int argc,char ** argv)33 int main(int argc, char **argv) {
34 	if (argc < 2) {
35 		std::cout << "Error: filename not specified" << std::endl;
36 		return 0;
37 	}
38 
39 	Lab *lab = NULL;
40 	std::string filename;
41 
42 	if (argc > 2) {
43 		lab = new Lab(argv[1]);
44 		filename = argv[2];
45 	} else {
46 		filename = argv[1];
47 	}
48 
49 	std::istream *file = getFile(filename, lab);
50 
51 	if (!file) {
52 		std::cout << "Unable to open file " << filename << std::endl;
53 		return 0;
54 	}
55 	int numBones = readInt(*file);
56 
57 	char boneString[32];
58 	char parentString[32];
59 
60 	float angle = 0;
61 	// Bones are listed in the same order as in the meshb.
62 	Vector3d *vec = 0;
63 	for (int i = 0; i < numBones; i++) {
64 		file->read((char *)&boneString, 32);
65 		file->read((char *)&parentString, 32);
66 
67 		std::cout << "# BoneName " << boneString << "\twith parent: " << parentString << "\t";
68 		std::cout << " position: ";
69 		vec = readVector3d(*file);
70 		std::cout << vec->toString();
71 		delete vec;
72 		std::cout << " rotation: ";
73 		vec = readVector3d(*file);
74 		std::cout << vec->toString();
75 		delete vec;
76 		angle = readFloat(*file);
77 		std::cout << angle << std::endl;
78 
79 	}
80 }
81