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


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

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


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

示例1: AddForce

HRESULT CPartEmitter::AddForce(char *Name, CPartForce::TForceType Type, int PosX, int PosY, float Angle, float Strength) {
	CPartForce *Force = AddForceByName(Name);
	if (!Force) return E_FAIL;

	Force->m_Type = Type;
	Force->m_Pos = Vector2(PosX, PosY);

	Force->m_Direction = Vector2(0, Strength);
	Matrix4 MatRot;
	MatRot.RotationZ(DegToRad(CBUtils::NormalizeAngle(Angle - 180)));
	MatRot.TransformVector2(Force->m_Direction);

	return S_OK;
}
开发者ID:somaen,项目名称:Wintermute-git,代码行数:14,代码来源:PartEmitter.cpp

示例2: InitParticle

HRESULT CPartEmitter::InitParticle(CPartParticle* Particle, DWORD CurrentTime, DWORD TimerDelta)
{
	if(!Particle) return E_FAIL;
	if(m_Sprites.GetSize()==0) return E_FAIL;

	int PosX = CBUtils::RandomInt(m_PosX, m_PosX + m_Width);
	int PosY = CBUtils::RandomInt(m_PosY, m_PosY + m_Height);
	float PosZ = CBUtils::RandomFloat(0.0f, 100.0f);
	
	float Velocity;
	if(m_VelocityZBased) Velocity = m_Velocity1 + PosZ * (m_Velocity2 - m_Velocity1) / 100;
	else Velocity = CBUtils::RandomFloat(m_Velocity1, m_Velocity2);

	float Scale;
	if(m_ScaleZBased) Scale = m_Scale1 + PosZ * (m_Scale2 - m_Scale1) / 100;
	else Scale = CBUtils::RandomFloat(m_Scale1, m_Scale2);

	int LifeTime;
	if(m_LifeTimeZBased) LifeTime = m_LifeTime2 - PosZ * (m_LifeTime2 - m_LifeTime1) / 100;
	else LifeTime = CBUtils::RandomInt(m_LifeTime1, m_LifeTime2);
	
	float Angle = CBUtils::RandomAngle(m_Angle1, m_Angle2);	
	int SpriteIndex = CBUtils::RandomInt(0, m_Sprites.GetSize() - 1);

	float Rotation = CBUtils::RandomAngle(m_Rotation1, m_Rotation2);	
	float AngVelocity = CBUtils::RandomFloat(m_AngVelocity1, m_AngVelocity2);
	float GrowthRate = CBUtils::RandomFloat(m_GrowthRate1, m_GrowthRate2);

	if(!CBPlatform::IsRectEmpty(&m_Border))
	{
		int ThicknessLeft   = m_BorderThicknessLeft   - (float)m_BorderThicknessLeft   * PosZ / 100.0f;
		int ThicknessRight  = m_BorderThicknessRight  - (float)m_BorderThicknessRight  * PosZ / 100.0f;
		int ThicknessTop    = m_BorderThicknessTop    - (float)m_BorderThicknessTop    * PosZ / 100.0f;
		int ThicknessBottom = m_BorderThicknessBottom - (float)m_BorderThicknessBottom * PosZ / 100.0f;

		Particle->m_Border = m_Border;
		Particle->m_Border.left += ThicknessLeft;
		Particle->m_Border.right -= ThicknessRight;
		Particle->m_Border.top += ThicknessTop;
		Particle->m_Border.bottom -= ThicknessBottom;
	}

	Vector2 VecPos((float)PosX, (float)PosY);
	Vector2 VecVel(0, Velocity);

	Matrix4 MatRot;
	MatRot.RotationZ(DegToRad(CBUtils::NormalizeAngle(Angle - 180)));
	MatRot.TransformVector2(VecVel);

	if(m_AlphaTimeBased)
	{
		Particle->m_Alpha1 = m_Alpha1;
		Particle->m_Alpha2 = m_Alpha2;
	}
	else
	{
		int Alpha = CBUtils::RandomInt(m_Alpha1, m_Alpha2);
		Particle->m_Alpha1 = Alpha;
		Particle->m_Alpha2 = Alpha;		
	}

	Particle->m_CreationTime = CurrentTime;
	Particle->m_Pos = VecPos;
	Particle->m_PosZ = PosZ;
	Particle->m_Velocity = VecVel;
	Particle->m_Scale = Scale;
	Particle->m_LifeTime = LifeTime;
	Particle->m_Rotation = Rotation;
	Particle->m_AngVelocity = AngVelocity;
	Particle->m_GrowthRate = GrowthRate;
	Particle->m_ExponentialGrowth = m_ExponentialGrowth;
	Particle->m_IsDead = FAILED(Particle->SetSprite(m_Sprites[SpriteIndex]));
	Particle->FadeIn(CurrentTime, m_FadeInTime);


	if(Particle->m_IsDead) return E_FAIL;
	else return S_OK;
}
开发者ID:segafan,项目名称:wmelite_hcdaniel-repo,代码行数:78,代码来源:PartEmitter.cpp


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