00001 #ifndef BVH_HPP
00002 #define BVH_HPP
00003
00004 #include <iostream>
00005 #include <fstream>
00006 #include <iterator>
00007 #include <string>
00008 #include <vector>
00009
00010 #include "misc.hpp"
00011 #include "rigid.hpp"
00012
00013 using namespace std;
00014
00015 class ChannelError;
00016
00017
00018
00019 class bvhPart
00020 {
00021 public:
00022 enum channelTypes {Xpos,Ypos,Zpos,Zrot,Xrot,Yrot};
00023
00024 bvhPart();
00025
00026 string name;
00027
00028 vector3f offset;
00029
00030 vector<matrix16f> motion;
00031
00032
00033 rigid* objPart;
00034
00035 bvhPart* parent;
00036 vector<channelTypes> channels;
00037 vector<bvhPart*> child;
00038 };
00039
00040
00041 class bvh
00042 {
00043
00044 enum mode {NONE,OFFSET,CHANNELS,JOINT,ROOT,End,Site,MOTION,Frames,Frame,Time,MOTIONDATA};
00045
00046
00047 public:
00048 bvhPart *root;
00049 float frameTime;
00050
00051 private:
00052
00053
00054
00055
00056 bvhPart *current;
00057 vector <bvhPart*> bvhPartsLinear;
00058
00059 mode theMode;
00060 int vertIndex;
00061
00062 unsigned channelIndex;
00063 unsigned partIndex;
00064
00065
00066
00067 int data;
00069 unsigned channelsNum;
00070
00071 int framesNum;
00072 matrix16f tempMotion;
00073 matrix16f tempMotionY;
00074 matrix16f tempMotionX;
00075 matrix16f tempMotionZ;
00076
00077 public:
00078 bvh(string bvhFile);
00079
00080 void recurs(bvhPart* some);
00081 void process(string line);
00082 void init(string bvhFile);
00083
00084 };
00085
00086 #endif //BVH_HPP