- object = new GL::Object;
- DataFile::load(*object, fn);
+ string fn = argv[i];
+ string ext = FS::extpart(fn);
+
+ if(ext==".mesh")
+ {
+ if(mesh || object)
+ throw usage_error("Only one mesh or object may be specified");
+
+ mesh = new GL::Mesh;
+ DataFile::load(*mesh, fn);
+ }
+ else if(ext==".object")
+ {
+ if(mesh || object)
+ throw usage_error("Only one mesh or object may be specified");
+
+ object = new GL::Object;
+ DataFile::load(*object, fn);
+ }
+ else if(ext==".anim")
+ {
+ if(!object)
+ throw usage_error("An object must be provided for animation");
+
+ animation = new GL::Animation;
+ DataFile::load(*animation, argv[2]);
+ anim_object = new GL::AnimatedObject(*object);
+ anim_player = new GL::AnimationPlayer;
+ anim_player->play(*anim_object, *animation);
+ }
+ else
+ throw usage_error("Don't know how to view this file");