当前位置: 首页>>代码示例>>C++>>正文


C++ Matrix3f::MakeRotation方法代码示例

本文整理汇总了C++中Matrix3f::MakeRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3f::MakeRotation方法的具体用法?C++ Matrix3f::MakeRotation怎么用?C++ Matrix3f::MakeRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix3f的用法示例。


在下文中一共展示了Matrix3f::MakeRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnSpecialKeyDown

//----------------------------------------------------------------------------
bool DrawImplicitSurface::OnSpecialKeyDown (int key, int, int)
{
	// TODO:  These are chosen for the specific functions in this
	// application.  Allow the application to modify these, either by key
	// strokes or automatically.
	const float trnDelta = 0.25f, rotDelta = 0.1f;
	bool moved = false;
	float length;
	Matrix3f rot;

	if (key == KEY_UP_ARROW)
	{
		// Translate forward in camera direction.
		mTracer.Location += trnDelta*mTracer.DVector;
		moved = true;
	}
	else if (key == KEY_DOWN_ARROW)
	{
		// Translate backward in camera direction.
		mTracer.Location -= trnDelta*mTracer.DVector;
		moved = true;
	}
	else if (key == KEY_F1)
	{
		// Rotate about camera right, move up on view sphere.
		length = mTracer.Location.Length();
		rot.MakeRotation(mTracer.RVector, rotDelta);
		mTracer.DVector = rot*mTracer.DVector;
		mTracer.UVector = rot*mTracer.UVector;
		mTracer.Location = -length*mTracer.DVector;
		moved = true;
	}
	else if (key == KEY_F2)
	{
		// Rotate about camera right, move down on view sphere.
		length = mTracer.Location.Length();
		rot.MakeRotation(mTracer.RVector, -rotDelta);
		mTracer.DVector = rot*mTracer.DVector;
		mTracer.UVector = rot*mTracer.UVector;
		mTracer.Location = -length*mTracer.DVector;
		moved = true;
	}
	else if (key == KEY_F3)
	{
		// Rotate about camera up, move right on view sphere.
		length = mTracer.Location.Length();
		rot.MakeRotation(mTracer.UVector, rotDelta);
		mTracer.DVector = rot*mTracer.DVector;
		mTracer.RVector = rot*mTracer.RVector;
		mTracer.Location = -length*mTracer.DVector;
		moved = true;
	}
	else if (key == KEY_F4)
	{
		// Rotate about camera up, move left on view sphere.
		length = mTracer.Location.Length();
		rot.MakeRotation(mTracer.UVector, -rotDelta);
		mTracer.DVector = rot*mTracer.DVector;
		mTracer.RVector = rot*mTracer.RVector;
		mTracer.Location = -length*mTracer.DVector;
		moved = true;
	}
	else if (key == KEY_F5)
	{
		// Rotate about camera direction, roll counterclockwise.
		length = mTracer.Location.Length();
		rot.MakeRotation(mTracer.DVector, rotDelta);
		mTracer.UVector = rot*mTracer.UVector;
		mTracer.RVector = rot*mTracer.RVector;
		moved = true;
	}
	else if (key == KEY_F6)
	{
		// Rotate about camera direction, roll clockwise.
		length = mTracer.Location.Length();
		rot.MakeRotation(mTracer.DVector, -rotDelta);
		mTracer.UVector = rot*mTracer.UVector;
		mTracer.RVector = rot*mTracer.RVector;
		moved = true;
	}

	if (moved)
	{
		mTracer.DrawSurface(mNumSamples, mTracer.DVector, mBlur);
		OnDisplay();
	}

	return true;
}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:90,代码来源:DrawImplicitSurface.cpp


注:本文中的Matrix3f::MakeRotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。