本文整理汇总了C++中Matrix34类的典型用法代码示例。如果您正苦于以下问题:C++ Matrix34类的具体用法?C++ Matrix34怎么用?C++ Matrix34使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Matrix34类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DestroyPhysicsAreas
void CGameVolume_Water::CreatePhysicsArea(const uint32 segmentIndex, const Matrix34& baseMatrix, const Vec3* pVertices, uint32 vertexCount, const bool isRiver, const float streamSpeed)
{
//Destroy previous physics if any
if(segmentIndex == 0)
{
DestroyPhysicsAreas();
}
SWaterSegment& segment = m_segments[segmentIndex];
IWaterVolumeRenderNode* pWaterRenderNode = segment.m_pWaterRenderNode;
Vec3 waterFlow(ZERO);
CRY_ASSERT (segment.m_pWaterArea == NULL);
CRY_ASSERT (pWaterRenderNode != NULL);
pWaterRenderNode->SetMatrix( Matrix34::CreateIdentity() );
segment.m_pWaterArea = pWaterRenderNode->SetAndCreatePhysicsArea( &pVertices[0], vertexCount );
IPhysicalEntity* pWaterArea = segment.m_pWaterArea;
if( pWaterArea )
{
const Quat entityWorldRot = Quat(baseMatrix);
pe_status_pos posStatus;
pWaterArea->GetStatus( &posStatus );
const Vec3 areaPosition = baseMatrix.GetTranslation() + ((entityWorldRot * posStatus.pos) - posStatus.pos);
pe_params_pos position;
position.pos = areaPosition;
position.q = entityWorldRot;
pWaterArea->SetParams( &position);
pe_params_buoyancy pb;
pb.waterPlane.n = entityWorldRot * Vec3( 0, 0, 1 );
pb.waterPlane.origin = areaPosition;
if(isRiver)
{
int i = segmentIndex;
int j = vertexCount - 1 - segmentIndex;
pb.waterFlow = ((pVertices[1]-pVertices[0]).GetNormalized() + (pVertices[2]-pVertices[3]).GetNormalized()) / 2.f * streamSpeed;
}
pWaterArea->SetParams( &pb);
pe_params_foreign_data pfd;
pfd.pForeignData = pWaterRenderNode;
pfd.iForeignData = PHYS_FOREIGN_ID_WATERVOLUME;
pfd.iForeignFlags = 0;
pWaterArea->SetParams(&pfd);
segment.m_physicsLocalAreaCenter = posStatus.pos;
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:55,代码来源:GameVolume_Water.cpp
示例2: Quat
//------------------------------------------------------------------------
void CVehicleSeatActionRotateTurret::Serialize(TSerialize ser, EEntityAspects aspects)
{
// MR: for network, only turret parts are serialized
// for savegame, all parts are serialized (by CVehicle)
if (ser.GetSerializationTarget() == eST_Network)
{
for (int i = 0; i < eVTRT_NumRotationTypes; ++i)
{
if (m_rotations[i].m_pPart)
{
m_rotations[i].m_pPart->Serialize(ser, aspects);
}
}
}
else
{
// save rotation details
CryFixedStringT<16> tag;
for (int i = 0; i < eVTRT_NumRotationTypes; ++i)
{
if (m_rotations[i].m_pPart)
{
Quat q;
Matrix34 currentTM = m_rotations[i].m_pPart->GetLocalBaseTM();
if (ser.IsWriting())
q = Quat(currentTM);
tag = (i == eVTRT_Pitch) ? "rotation_pitch" : "rotation_yaw";
ser.Value(tag.c_str(), q, 'ori1');
if (ser.IsReading())
{
Matrix34 newTM(q);
newTM.SetTranslation(currentTM.GetTranslation());
m_rotations[i].m_pPart->SetLocalBaseTM(newTM);
m_rotations[i].m_orientation.Set(q);
}
}
}
}
}
示例3: GetEntity
//------------------------------------------------------------------------
void CItem::SetCharacterAttachmentWorldTM(int slot, const char *name, const Matrix34 &tm)
{
ICharacterInstance *pCharacter = GetEntity()->GetCharacter(slot);
if (!pCharacter)
return;
IAttachmentManager *pAttachmentManager = pCharacter->GetIAttachmentManager();
IAttachment *pAttachment = pAttachmentManager->GetInterfaceByName(name);
if (!pAttachment)
{
GameWarning("Item '%s' trying to set world TM on attachment '%s' which does not exist!", GetEntity()->GetName(), name);
return;
}
// Matrix34 boneWorldMatrix = GetEntity()->GetSlotWorldTM(slot) * pCharacter->GetISkeleton()->GetAbsJMatrixByID(pAttachment->GetBoneID());
Matrix34 boneWorldMatrix = GetEntity()->GetSlotWorldTM(slot) * Matrix34(pCharacter->GetISkeletonPose()->GetAbsJointByID(pAttachment->GetBoneID()) );
Matrix34 localAttachmentMatrix = (boneWorldMatrix.GetInverted()*tm);
pAttachment->SetAttRelativeDefault(QuatT(localAttachmentMatrix));
}
示例4: FUNCTION_PROFILER
//------------------------------------------------------------------------
void CVehicleHelper::GetReflectedWorldTM(Matrix34 &reflectedWorldTM) const
{
FUNCTION_PROFILER( gEnv->pSystem, PROFILE_ACTION );
Matrix34 tempMatrix = m_localTM;
tempMatrix.m03 = -tempMatrix.m03; // negate x coord of translation
const Matrix34& partWorldTM = m_pParentPart->GetWorldTM();
reflectedWorldTM = Matrix34(Matrix33(partWorldTM) * Matrix33(tempMatrix));
reflectedWorldTM.SetTranslation((partWorldTM * tempMatrix).GetTranslation());
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:13,代码来源:VehicleHelper.cpp
示例5: SetEffect
//------------------------------------------------------------------------
void CTracer::SetEffect(const char *name, float scale)
{
IParticleEffect *pEffect = gEnv->pParticleManager->FindEffect(name);
if (!pEffect)
{
return;
}
if (IEntity *pEntity = gEnv->pEntitySystem->GetEntity(m_entityId))
{
int slot = pEntity->LoadParticleEmitter(TRACER_FX_SLOT, pEffect, 0, true);
if (scale != 1.0f)
{
Matrix34 tm = Matrix34::CreateIdentity();
tm.Scale(Vec3(scale, scale, scale));
pEntity->SetSlotLocalTM(slot, tm);
}
}
}
示例6: cry_tanf
bool CCoherentInputEventListener::TraceMouse( int& outX, int& outY, CCoherentViewListener*& pViewListener )
{
if ( gCoherentUISystem == nullptr )
{
return false;
}
CCamera& camera = gEnv->pSystem->GetViewCamera();
int vpWidth = gEnv->pRenderer->GetWidth();
int vpHeight = gEnv->pRenderer->GetHeight();
float proj22 = 1.0f / cry_tanf( camera.GetFov() / 2.0f );
float proj11 = proj22 / camera.GetProjRatio();
float viewX = ( ( ( 2.0f * ( float )GetMouseX() ) / vpWidth ) - 1.0f ) / proj11;
float viewY = ( ( ( -2.0f * ( float )GetMouseY() ) / vpHeight ) + 1.0f ) / proj22;
Matrix34 invView = camera.GetMatrix();
Vec3 dir = invView.TransformVector( Vec3( viewX, 1.0f, viewY ) ); // Z is up
Vec3 origin = camera.GetPosition();
return gCoherentUISystem->RaycastClosestViewListenersGeometry( origin, dir, outX, outY, pViewListener );
}
示例7: Update
void CVehiclePartWaterRipplesGenerator::Update(const float frameTime)
{
//IVehicleMovement* pMovement = m_pVehicle->GetMovement();
const SVehicleStatus& status = m_pVehicle->GetStatus();
const bool movingFastEnough = (status.speed > m_minMovementSpeed);
if (movingFastEnough)
{
const Matrix34 vehicleWorldTM = m_pVehicle->GetEntity()->GetWorldTM();
// Check if moving backwards...
if (m_onlyMovingForward)
{
const float dotProduct = vehicleWorldTM.GetColumn1().Dot((status.vel / status.speed));
if (dotProduct < 0.0f)
return;
}
gEnv->pRenderer->EF_AddWaterSimHit( vehicleWorldTM.TransformPoint( m_localOffset ), m_waterRipplesScale, m_waterRipplesStrength );
}
}
示例8: GetEntity
void CGameVolume_Water::DebugDrawVolume()
{
IGameVolumes::VolumeInfo volumeInfo;
if (GetVolumeInfoForEntity(GetEntityId(), volumeInfo) == false)
return;
if (volumeInfo.verticesCount < 3)
return;
const Matrix34 worldTM = GetEntity()->GetWorldTM();
const Vec3 depthOffset = worldTM.GetColumn2().GetNormalized() * - m_volumeDepth;
IRenderAuxGeom* pRenderAux = gEnv->pRenderer->GetIRenderAuxGeom();
for (uint32 i = 0; i < volumeInfo.verticesCount - 1; ++i)
{
const Vec3 point1 = worldTM.TransformPoint(volumeInfo.pVertices[i]);
const Vec3 point2 = worldTM.TransformPoint(volumeInfo.pVertices[i + 1]);
pRenderAux->DrawLine( point1, Col_SlateBlue, point1 + depthOffset, Col_SlateBlue, 2.0f );
pRenderAux->DrawLine( point1 + depthOffset, Col_SlateBlue, point2 + depthOffset, Col_SlateBlue, 2.0f );
}
const Vec3 firstPoint = worldTM.TransformPoint(volumeInfo.pVertices[0]);
const Vec3 lastPoint = worldTM.TransformPoint(volumeInfo.pVertices[volumeInfo.verticesCount - 1]);
pRenderAux->DrawLine( lastPoint, Col_SlateBlue, lastPoint + depthOffset, Col_SlateBlue, 2.0f );
pRenderAux->DrawLine( lastPoint + depthOffset, Col_SlateBlue, firstPoint + depthOffset, Col_SlateBlue, 2.0f );
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:28,代码来源:GameVolume_Water.cpp
示例9: GetSlotHelperRotation
//--------------------------------------------
void CLaser::GetLaserPositionAndDirection(CWeapon* pParentWeapon, Vec3& pos, Vec3& dir)
{
const char* entityLocationHelper = m_laserHelperFP.c_str();
const char* laserTermHelper = "laser_term";
const bool relative = false;
const bool absolute = true;
const int slot = pParentWeapon->IsOwnerFP() ? eIGS_FirstPerson : eIGS_ThirdPerson;
Matrix34 entityLocation =
Matrix34::CreateTranslationMat(pParentWeapon->GetSlotHelperPos(slot, entityLocationHelper, absolute)) *
pParentWeapon->GetSlotHelperRotation(slot, entityLocationHelper, absolute);
Matrix34 helperLocation =
Matrix34::CreateTranslationMat(GetSlotHelperPos(slot, laserTermHelper, relative)) *
GetSlotHelperRotation(slot, laserTermHelper, relative);
Matrix34 finalLocation = entityLocation * helperLocation;
pos = finalLocation.GetTranslation();
dir = finalLocation.GetColumn1();
}
示例10: gunLocalTMXY
void CMountedGunController::UpdateGunnerLocation( CItem* pMountedGun, IEntity* pParent, const Vec3& bodyDirection )
{
const SMountParams* pMountParams = pMountedGun->GetMountedParams();
if (pMountParams)
{
f32 bodyDist = pMountParams->body_distance;
f32 groundDist = pMountParams->ground_distance;
Matrix34 gunLocalTM = pMountedGun->GetEntity()->GetLocalTM();
Matrix34 gunLocalTMXY(IDENTITY);
Matrix34 characterTM(IDENTITY);
Matrix34 newGunnerTM;
Vec3 playerOffset(0.0f, -bodyDist, -groundDist);
characterTM.SetTranslation(playerOffset);
IEntity* pControlledPlayerEntity = m_pControlledPlayer->GetEntity();
IVehicle *pVehicle = NULL;
if (gEnv->bMultiplayer && m_pControlledPlayer->IsClient() && m_pControlledPlayer->GetLinkedVehicle())
{
newGunnerTM = gunLocalTM;
newGunnerTM.SetTranslation(gunLocalTM.GetTranslation() + Quat(gunLocalTM) * playerOffset);
}
else
{
float rotZ = pMountedGun->GetEntity()->GetRotation().GetRotZ();
gunLocalTMXY.SetRotationZ(rotZ);
gunLocalTMXY.SetTranslation(gunLocalTM.GetTranslation());
newGunnerTM = gunLocalTMXY*characterTM;
}
pControlledPlayerEntity->SetLocalTM(newGunnerTM, ENTITY_XFORM_USER);
// CryWatch("Mount wrot: plr: %f vehicle: %f wpn: %f", pControlledPlayerEntity->GetWorldRotation().GetRotZ(), pParent ? pParent->GetWorldRotation().GetRotZ() : -99.0f, pMountedGun->GetEntity()->GetWorldRotation().GetRotZ());
// CryWatch("Mount lrot: plr: %f vehicle: %f wpn: %f", pControlledPlayerEntity->GetRotation().GetRotZ(), pParent ? pParent->GetRotation().GetRotZ() : -99.0f, pMountedGun->GetEntity()->GetRotation().GetRotZ());
}
}
示例11: rot
//-----------------------------------------------------------------------
void CVehiclePartLight::UpdateLight(const float frameTime)
{
if (m_slot == -1)
return;
// move to vehicle event change view?
if (m_diffuseMult[0] != m_diffuseMult[1])
{
SEntitySlotInfo info;
if (m_pVehicle->GetEntity()->GetSlotInfo(m_slot, info) && info.pLight)
{
CDLight& light = info.pLight->GetLightProperties();
IActor* pActor = CCryAction::GetCryAction()->GetClientActor();
bool localPlayer = (pActor != NULL) && (pActor->GetLinkedVehicle() == m_pVehicle);
IVehicleSeat* pSeat = pActor ? m_pVehicle->GetSeatForPassenger(pActor->GetEntityId()) : NULL;
IVehicleView* pView = pSeat? pSeat->GetView(pSeat->GetCurrentView()) : NULL;
bool isThirdPersonView = pView? pView->IsThirdPerson() : true;
if (localPlayer && !isThirdPersonView)
light.SetLightColor(ColorF(m_diffuseCol * m_diffuseMult[0], 1.f));
else
light.SetLightColor(ColorF(m_diffuseCol * m_diffuseMult[1], 1.f));
}
}
if (m_pHelper)
{
const static Matrix33 rot(Matrix33::CreateRotationXYZ(Ang3(0.f, 0.f, DEG2RAD(90.f))));
Matrix34 helperTM;
m_pHelper->GetVehicleTM(helperTM);
Matrix34 localTM = Matrix33(helperTM) * rot;
localTM.SetTranslation(helperTM.GetTranslation());
GetEntity()->SetSlotLocalTM(m_slot, localTM);
}
}
示例12: a
void Matrix34::Test()
{
Matrix34 a(Vector3(0,0,1), g_upVector, g_zeroVector);
Matrix34 b(Vector3(0,0,1), g_upVector, g_zeroVector);
Matrix34 c=a*b;
DebugOut("c = a * b\n");
c.WriteToDebugStream();
Vector3 front(10,20,2);
front.Normalise();
Vector3 up(0,1,0);
Vector3 right = up ^ front;
right.Normalise();
up = front ^ right;
up.Normalise();
Matrix34 d(front, up, Vector3(-1,2,-3));
DebugOut("d = \n");
d.WriteToDebugStream();
Matrix34 e = d * d;
DebugOut("e = d * d\n");
e.WriteToDebugStream();
}
示例13: 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
示例14: LogDeformPhysicalEntity
void LogDeformPhysicalEntity( const char * from, IPhysicalEntity * pEnt, const Vec3& p, const Vec3& n, float energy )
{
#if DEBUG_NET_BREAKAGE
if (!pEnt)
return;
if (CNetworkCVars::Get().BreakageLog)
{
CryLog("[brk] DeformPhysicalEntity on %s @ (%.8f,%.8f,%.8f); n=(%.8f,%.8f,%.8f); energy=%.8f", from, p.x, p.y, p.z, n.x, n.y, n.z, energy);
CryLog("[brk] selector is %s", CObjectSelector::GetDescription(pEnt).c_str());
switch (pEnt->GetiForeignData())
{
case PHYS_FOREIGN_ID_STATIC:
if (IRenderNode * pRN = (IRenderNode*)pEnt->GetForeignData(PHYS_FOREIGN_ID_STATIC))
{
CryLog("[brk] name is %s", pRN->GetName());
CryLog("[brk] entity class name is %s", pRN->GetEntityClassName());
CryLog("[brk] debug string is %s", pRN->GetDebugString().c_str());
}
break;
case PHYS_FOREIGN_ID_ENTITY:
if (IEntity * pEntity = (IEntity*)pEnt->GetForeignData(PHYS_FOREIGN_ID_ENTITY))
{
CryLog("[brk] name is %s", pEntity->GetName());
Matrix34 m = pEntity->GetWorldTM();
CryLog("[brk] world tm:");
for (int i=0; i<3; i++)
{
Vec4 row = m.GetRow4(i);
CryLog("[brk] %+12.8f %+12.8f %+12.8f %+12.8f", row[0], row[1], row[2], row[3]);
}
}
break;
}
}
#endif
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:37,代码来源:DeformingBreak.cpp
示例15: hitDir
void CBurnEffectManager::CreateBurnEffect(const EventPhysCollision& pCollision, CBurnEffectManager::SBurnPoint* pBurnPoint)
{
Vec3 surfaceNormal = pCollision.n;
Vec3 hitDir(ZERO);
if (pCollision.vloc[0].GetLengthSquared() > 1e-6f)
{
hitDir = pCollision.vloc[0].GetNormalized();
}
Vec3 surfacePosition = pCollision.pt;
Vec3 halfVector = (surfaceNormal + (-hitDir)).GetNormalized();
CItemParticleEffectCache& particleCache = g_pGame->GetGameSharedParametersStorage()->GetItemResourceCache().GetParticleEffectCache();
IParticleEffect* pParticleEffect = particleCache.GetCachedParticle(pBurnPoint->m_pBurnParams->m_effectName);
if (pParticleEffect)
{
Matrix34 loc;
loc.SetIdentity();
loc.SetTranslation(surfacePosition);
loc.SetRotation33(OrthoNormalVector(surfaceNormal));
IParticleEmitter* pEffect = pParticleEffect->Spawn(false, loc);
if(pEffect)
{
pEffect->AddRef();
pBurnPoint->m_effect = pEffect;
const ParticleParams& particleParams = pParticleEffect->GetParticleParams();
pBurnPoint->m_attachType = particleParams.eAttachType;
pBurnPoint->m_attachForm = particleParams.eAttachForm;
}
UpdateBurnEffect(pBurnPoint);
}
UpdateBurnEffect(pBurnPoint);
}