本文整理汇总了C++中idMat3::Identity方法的典型用法代码示例。如果您正苦于以下问题:C++ idMat3::Identity方法的具体用法?C++ idMat3::Identity怎么用?C++ idMat3::Identity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idMat3
的用法示例。
在下文中一共展示了idMat3::Identity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupTransforms
void idSimpleWindow::SetupTransforms( float x, float y )
{
static idMat3 trans;
static idVec3 org;
trans.Identity();
org.Set( origin.x + x, origin.y + y, 0 );
if( rotate )
{
static idRotation rot;
static idVec3 vec( 0, 0, 1 );
rot.Set( org, vec, rotate );
trans = rot.ToMat3();
}
static idMat3 smat;
smat.Identity();
if( shear.x() || shear.y() )
{
smat[0][1] = shear.x();
smat[1][0] = shear.y();
trans *= smat;
}
if( !trans.IsIdentity() )
{
dc->SetTransformInfo( org, trans );
}
}
示例2: GetMatrixForKey
/*
=======================================================================================================================
=======================================================================================================================
*/
bool GetMatrixForKey(entity_t *ent, const char *key, idMat3 &mat)
{
const char *k;
k = ValueForKey(ent, key);
if (k && strlen(k) > 0)
{
sscanf
(
k,
"%f %f %f %f %f %f %f %f %f ",
&mat[0][0],
&mat[0][1],
&mat[0][2],
&mat[1][0],
&mat[1][1],
&mat[1][2],
&mat[2][0],
&mat[2][1],
&mat[2][2]
);
return true;
}
else
{
mat.Identity();
}
return false;
}
示例3: GetMatrix
/*
================
idDict::GetMatrix
================
*/
bool idDict::GetMatrix( const char *key, const char *defaultString, idMat3 &out ) const {
const char *s;
bool found;
if( !defaultString ) {
defaultString = "1 0 0 0 1 0 0 0 1";
}
found = GetString( key, defaultString, &s );
out.Identity(); // sccanf has a bug in it on Mac OS 9. Sigh.
sscanf( s, "%f %f %f %f %f %f %f %f %f", &out[0].x, &out[0].y, &out[0].z, &out[1].x, &out[1].y, &out[1].z, &out[2].x, &out[2].y, &out[2].z );
return found;
}
示例4: GetMassProperties
/*
============
idTraceModel::GetMassProperties
============
*/
void idTraceModel::GetMassProperties( const float density, float &mass, idVec3 ¢erOfMass, idMat3 &inertiaTensor ) const {
volumeIntegrals_t integrals;
// if polygon trace model
if ( type == TRM_POLYGON ) {
idTraceModel trm;
VolumeFromPolygon( trm, 1.0f );
trm.GetMassProperties( density, mass, centerOfMass, inertiaTensor );
return;
}
VolumeIntegrals( integrals );
// if no volume
if ( integrals.T0 == 0.0f ) {
mass = 1.0f;
centerOfMass.Zero();
inertiaTensor.Identity();
return;
}
// mass of model
mass = density * integrals.T0;
// center of mass
centerOfMass = integrals.T1 / integrals.T0;
// compute inertia tensor
inertiaTensor[0][0] = density * (integrals.T2[1] + integrals.T2[2]);
inertiaTensor[1][1] = density * (integrals.T2[2] + integrals.T2[0]);
inertiaTensor[2][2] = density * (integrals.T2[0] + integrals.T2[1]);
inertiaTensor[0][1] = inertiaTensor[1][0] = - density * integrals.TP[0];
inertiaTensor[1][2] = inertiaTensor[2][1] = - density * integrals.TP[1];
inertiaTensor[2][0] = inertiaTensor[0][2] = - density * integrals.TP[2];
// translate inertia tensor to center of mass
inertiaTensor[0][0] -= mass * (centerOfMass[1]*centerOfMass[1] + centerOfMass[2]*centerOfMass[2]);
inertiaTensor[1][1] -= mass * (centerOfMass[2]*centerOfMass[2] + centerOfMass[0]*centerOfMass[0]);
inertiaTensor[2][2] -= mass * (centerOfMass[0]*centerOfMass[0] + centerOfMass[1]*centerOfMass[1]);
inertiaTensor[0][1] = inertiaTensor[1][0] += mass * centerOfMass[0] * centerOfMass[1];
inertiaTensor[1][2] = inertiaTensor[2][1] += mass * centerOfMass[1] * centerOfMass[2];
inertiaTensor[2][0] = inertiaTensor[0][2] += mass * centerOfMass[2] * centerOfMass[0];
}
示例5: GetPhysicsToSoundTransform
bool CFrobHandle::GetPhysicsToSoundTransform(idVec3 &origin, idMat3 &axis)
{
idVec3 eyePos = gameLocal.GetLocalPlayer()->GetEyePosition();
const idBounds& bounds = GetPhysics()->GetAbsBounds();
//gameRenderWorld->DebugBounds(colorLtGrey, bounds, vec3_origin, 5000);
// greebo: Choose the corner which is nearest to the player's eyeposition
origin.x = (idMath::Fabs(bounds[0].x - eyePos.x) < idMath::Fabs(bounds[1].x - eyePos.x)) ? bounds[0].x : bounds[1].x;
origin.y = (idMath::Fabs(bounds[0].y - eyePos.y) < idMath::Fabs(bounds[1].y - eyePos.y)) ? bounds[0].y : bounds[1].y;
origin.z = (idMath::Fabs(bounds[0].z - eyePos.z) < idMath::Fabs(bounds[1].z - eyePos.z)) ? bounds[0].z : bounds[1].z;
// The called expects the origin in local space
origin -= GetPhysics()->GetOrigin();
axis.Identity();
//gameRenderWorld->DebugArrow(colorWhite, GetPhysics()->GetOrigin() + origin, eyePos, 0, 5000);
return true;
}
示例6: GetPhysicsToSoundTransform
/*
================
hhSound::GetPhysicsToSoundTransform
================
*/
bool hhSound::GetPhysicsToSoundTransform( idVec3 &origin, idMat3 &axis ) {
origin = positionOffset;
axis.Identity();
return true;
}