コード例 #1
0
ファイル: bvh.cpp プロジェクト: yorung/dx11bvh
void Bvh::CalcAnimation(double time)
{
	int frame = (int)(time / frameTime);
	frame %= motionFrames;

	const float* mot = &rawMotion[frame * channels];
	const Pose& pose = motion.poses[frame];

	for (BONE_ID i = 0; i < (BONE_ID)m_frames.size(); i++) {
		auto& it = m_frames[i];
		Vec3 translate;
		Quat q = pose.quats[i];
		if (it.posIndices.x >= 0) {
			translate = Vec3(mot[it.posIndices.x], mot[it.posIndices.y], -mot[it.posIndices.z]);
		} else {
			translate = it.offset;
		}
		
		it.frameTransformMatrix = q2m(q) * v2m(translate);
	}
	CalcFrameMatrices();
}
コード例 #2
0
/*!  */
inline dgemat3 rotate(const dgemat3& m, const dquater& q)
{VERBOSE_REPORT;
  dgemat3 R(q2m(q));
  return R*m*t(R);
}