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


C++ Matrix4::CalcRotationAroundAxis方法代码示例

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


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

示例1: SetPosV

void DecalMesh::SetPosV( const Vector3F& newPos, const Matrix4& _newRot )
{
	float zRot = _newRot.CalcRotationAroundAxis(2);
	zRot = NormalizeAngleDegrees( zRot );
	
	Matrix4 newRot;
	newRot.SetZRotation( zRot );

	// We don't need to ask the container (the TerrainMesh) where we
	// will be, since the decal is patched to the terrain.
	if ( newPos.x != pos.x || newPos.y != pos.y || newRot != rotation || !InList() )
	{
		pos = newPos;
		rotation = newRot;

		Rectangle3F base;
		base.Set( -size / 2.0f, -size / 2.0f, (TERRAIN_MIN+0.01f),
				  size / 2.0f,  size / 2.0f,  (TERRAIN_MAX-0.01f) );

		if ( InList() )
			ListRemove();

		ComputeTransform();
		CalcAABB( base );
		Lilith3D::Instance()->GetQuadTree()->AddMesh( this );

		// Compute the texture matrix for this decal.
		Matrix4 center, inverse, scale;

		Transform().Invert( &inverse );				// position the texture with the mesh
		center.SetTranslation( 0.5f, 0.5f, 0.5f );	// center the decal
		scale.SetScale( 1.0f / size );		

		texMat = center * scale * inverse;
	}
}
开发者ID:gefariasjr,项目名称:projetofinal1,代码行数:36,代码来源:mesh.cpp

示例2: if

void FluidTestScene::Tap3D(const grinliz::Vector2F& view, const grinliz::Ray& world)
{
	Vector3F at = { 0, 0, 0 };
	float t = 0;
	int result = IntersectRayAAPlane(world.origin, world.direction, 1, 0, &at, &t);
	if (result == INTERSECT) {
		Vector2I pos2i = ToWorld2I(at);
		Vector2I sector = { 0, 0 };
		CircuitSim* circuitSim = context.physicsSims->GetCircuitSim(sector);

		if (context.worldMap->Bounds().Contains(pos2i)) {

			bool trigger = false;
			if (!buildButton[BUTTON_DELETE].Down() && !buildButton[BUTTON_ROTATE].Down()) {
				Chit* building = context.chitBag->QueryPorch(pos2i);
				if (!building) {
					building = context.chitBag->QueryBuilding(IString(), pos2i, 0);
				}
				if (building) {
					if (building->GetItem()->IName() == ISC::detector) {
						circuitSim->TriggerDetector(pos2i);
						trigger = true;
					}
					else if (building->GetItem()->IName() == ISC::switchOn 
							 || building->GetItem()->IName() == ISC::switchOff) 
					{
						circuitSim->TriggerSwitch(pos2i);
						trigger = true;
					}
				}
			}

			int id = -1;
			if (!trigger) {
				for (int i = 0; i < NUM_BUTTONS; ++i) {
					if (buildButton[i].Down()) {
						id = i;
						break;
					}
				}
			}
			if (id >= 0) {
				Chit* chit = 0;
				switch (id) {
					case BUTTON_ROCK0:
					case BUTTON_ROCK1:
					case BUTTON_ROCK2:
					case BUTTON_ROCK3:
					context.worldMap->SetRock(pos2i.x, pos2i.y, id - BUTTON_ROCK0, false, WorldGrid::ROCK);
					break;

					case BUTTON_SWITCH_ON:
					chit = context.chitBag->NewBuilding(pos2i, "switchOn", TEAM_HOUSE);
					break;

					case BUTTON_SWITCH_OFF:
					chit = context.chitBag->NewBuilding(pos2i, "switchOff", TEAM_HOUSE);
					break;

					case BUTTON_TEMPLE:
					chit = context.chitBag->NewBuilding(pos2i, "temple", TEAM_HOUSE);
					break;

					case BUTTON_GATE:
					chit = context.chitBag->NewBuilding(pos2i, "gate", TEAM_HOUSE);
					break;

					case BUTTON_TIMED_GATE:
					chit = context.chitBag->NewBuilding(pos2i, "timedGate", TEAM_HOUSE);
					break;

					case BUTTON_DETECTOR:
					chit = context.chitBag->NewBuilding(pos2i, "detector", TEAM_HOUSE);
					break;

					case BUTTON_TURRET:
					chit = context.chitBag->NewBuilding(pos2i, "turret", TEAM_HOUSE);
					break;

					case BUTTON_DELETE:
					{
						Chit* building = context.chitBag->QueryBuilding(IString(), pos2i, 0);
						if (building) {
							building->QueueDelete();
						}
					}
					break;

					case BUTTON_ROTATE:
					{
						Chit* building = context.chitBag->QueryBuilding(IString(), pos2i, 0);
						if (building) {
							Matrix4 m;
							building->Rotation().ToMatrix(&m);
							float r = m.CalcRotationAroundAxis(1);
							r = NormalizeAngleDegrees(r + 90.0f);
							building->SetRotation(Quaternion::MakeYRotation(r));
						}

					}
//.........这里部分代码省略.........
开发者ID:fordream,项目名称:alteraorbis,代码行数:101,代码来源:fluidtestscene.cpp


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