/** -------------------------------------------- * @brief BVHロード * @param filename * @return void * --------------------------------------------*/ private void loadBVH(string filename) { _mode = Mode.BVH; _isPlay = false; _nodeList.Clear(); _bvh = new BVHParser(); _bvh.Load(filename); setBVH(); // フレームレート変更 _fps = 1f / _bvh.FrameSpan; label_fps.Text = "FPS : " + _fps.ToString("0.0"); _frame = 0; // control trackBar1.Minimum = 0; trackBar1.Maximum = _bvh.FrameNum - 1; }
/** -------------------------------------------- * @brief BVH側のノードから指定フレームの回転行列を返却 * @param node * @param frame * @return Matrix4 * --------------------------------------------*/ private Matrix4 GetRotMatrixFromBVHNode(BVHParser.Node node, int frame) { Matrix4 matrix = Matrix4.Identity; float deg2rad = (float)(Math.PI / 180.0); var euler = node.GetMotionRot(frame); for (int i = node.Channnels.Count - 1; i >= 0; i--) { var channel = node.Channnels[i]; switch (channel) { case BVHParser.Node.Channel.Xrotation: matrix = matrix * Matrix4.CreateRotationX(euler.X * deg2rad); break; case BVHParser.Node.Channel.Yrotation: matrix = matrix * Matrix4.CreateRotationY(euler.Y * deg2rad); break; case BVHParser.Node.Channel.Zrotation: matrix = matrix * Matrix4.CreateRotationZ(euler.Z * deg2rad); break; default: break; } } return matrix; }