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


C++ Matrix34::Set方法代码示例

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


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

示例1: AttachToEntity

bool CMFXParticleEffect::AttachToEntity( IEntity& targetEntity, const SMFXParticleEntry& particleParams, const SMFXRunTimeEffectParams& params, IParticleEffect* pParticleEffect, const Vec3& dir, float scale )
{
	if (pParticleEffect)
	{
		int effectSlot = targetEntity.LoadParticleEmitter(-1, pParticleEffect);
		if (effectSlot >= 0)
		{
			Matrix34 hitTM;
			hitTM.Set(Vec3(1.0f, 1.0f, 1.0f), Quat::CreateRotationVDir(dir), params.pos);

			Matrix34 localEffectTM = targetEntity.GetWorldTM().GetInverted() * hitTM;
			localEffectTM.ScaleColumn(Vec3(scale, scale, scale));

			CRY_ASSERT(localEffectTM.IsValid());

			targetEntity.SetSlotLocalTM(effectSlot, localEffectTM);

			return true;
		}
	}

	return false;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:23,代码来源:MFXParticleEffect.cpp

示例2: ProcessEvent

	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		
		switch (event)
		{
			case eFE_Initialize:
				{
					pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,false);
				}
			case eFE_Activate:
				{
					if(GetPortBool(pActInfo, 1)) {
						EntityId id = GetPortEntityId(pActInfo,EIP_EntityID);
						IEntity * entity = gEnv->pEntitySystem->GetEntity(id);
						if(entity)
						{
							Matrix34 trans; // = entity->GetWorldTM();
							trans.CreateIdentity();
															
							Quat quat =  entity->GetRotation();
							quat.v = GetPortVec3( pActInfo, EIP_Rotation_XYZ);
							quat.w = GetPortFloat( pActInfo, EIP_Rotation_W);
							
							//quat.NormalizeFast();
					
							Vec3 position = entity->GetPos();
							trans.Set(Vec3(1,1,1),quat.GetNormalized(),position);
							
							entity->SetPosRotScale(position,quat,Vec3(1,1,1));

							
						}
					}
				}
			}
	}
开发者ID:amyvmiwei,项目名称:CryVR,代码行数:36,代码来源:CryVR_EntitySimpleOrientation.cpp

示例3: ProcessEvent

	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		
		
		switch (event)
		{
		case eFE_Initialize:{
			pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,true);
		}
		case eFE_Activate:
			{
				pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,true);
			}
			break;
		
		case eFE_Update:
			{	
				//if (IsPortActive(pActInfo, PORT_IN_ENABLE))
				//{
					EntityId id = GetPortEntityId(pActInfo,EIP_EntityID);
					EntityId parentid = GetPortEntityId(pActInfo,EIP_ParentEntityID);
					//IGameObject *pGameObj = gEnv->pGameFramework->GetGameObject(id);
					IEntity * entity = gEnv->pEntitySystem->GetEntity(id);
					IEntity * parententity = gEnv->pEntitySystem->GetEntity(parentid);
					if(entity){
						Matrix34 trans; // = entity->GetWorldTM();
						trans.CreateIdentity();
						Matrix34 transparent;
						transparent.CreateIdentity(); 

						if (parententity){
							//quatParent = parententity->GetRotation();
							transparent = parententity->GetWorldTM();
							//CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn0().x,transparent.GetColumn0().y,transparent.GetColumn0().z);
							//CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn1().x,transparent.GetColumn1().y,transparent.GetColumn1().z);
							//CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn2().x,transparent.GetColumn2().y,transparent.GetColumn2().z);
							//CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn3().x,transparent.GetColumn3().y,transparent.GetColumn3().z);
							
						}
						
						Quat quat =  entity->GetRotation();
						quat.v = GetPortVec3( pActInfo, EIP_Rotation_XYZ);
						quat.w = GetPortFloat( pActInfo, EIP_Rotation_W);
						quat.NormalizeFast();
						

						Vec3 position = GetPortVec3(pActInfo, EIP_Position);
						
						trans.Set(Vec3(1,1,1),quat.GetNormalized(),position);
						//transparent.SetTranslation(Vec3(0,0,0));
						
						Vec3 positionlocal = transparent.TransformVector(position);

						trans = transparent * trans;

						//Matrix34 transresult ;
						//transresult.CreateIdentity();
						//transresult.Scale
						
						trans.SetTranslation(positionlocal+parententity->GetPos());

						if(trans.IsValid()){
							entity->SetWorldTM(trans);
						}
						else {
							//CryLogAlways("[%f,%f,%f]",trans.GetColumn0().x,trans.GetColumn0().y,trans.GetColumn0().z);
							//CryLogAlways("[%f,%f,%f]",trans.GetColumn1().x,trans.GetColumn1().y,trans.GetColumn1().z);
							//CryLogAlways("[%f,%f,%f]",trans.GetColumn2().x,trans.GetColumn2().y,trans.GetColumn2().z);
							//CryLogAlways("[%f,%f,%f]",trans.GetColumn3().x,trans.GetColumn3().y,trans.GetColumn3().z);
							//CryLogAlways("rot : [%f,%f,%f,%f]",trans.GetRo);
							//CryLogAlways("sca : [%f,%f,%f]",trans.GetColumn0().x,trans.GetColumn0().y,trans.GetColumn0().z);
						}
					}
					//CryLogAlways("%i",id);
				//}
			}
		}
	}
开发者ID:amyvmiwei,项目名称:CryVR,代码行数:78,代码来源:CryVR_EntityTransform.cpp


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