本文整理汇总了C++中Matrix4f::GetInverse方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4f::GetInverse方法的具体用法?C++ Matrix4f::GetInverse怎么用?C++ Matrix4f::GetInverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4f
的用法示例。
在下文中一共展示了Matrix4f::GetInverse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChangeRipple
bool Water::ChangeRipple(unsigned int element, const RippleWaterArgs& args)
{
assert(maxRipples > 0);
for (unsigned int i = 0; i < maxRipples; ++i)
{
if (rippleIDs[i] == element)
{
//Translate the source into object space.
Matrix4f inv;
MyMesh.Transform.GetWorldTransform(inv);
inv = inv.GetInverse();
Vector3f sourcePos = args.Source;
sourcePos = inv.Apply(sourcePos);
//Set the uniforms.
dp_tsc_h_p[i] = Vector4f(args.DropoffPoint, args.TimeSinceCreated,
args.Amplitude, args.Period);
sXY_sp[i] = Vector3f(sourcePos.x, sourcePos.y, args.Speed);
return true;
}
}
return false;
}
示例2: AddRipple
unsigned int Water::AddRipple(const RippleWaterArgs& args)
{
assert(maxRipples > 0);
RippleWaterArgs cpy(args);
//Translate the source into object space.
Matrix4f inv;
MyMesh.Transform.GetWorldTransform(inv);
inv = inv.GetInverse();
cpy.Source = inv.Apply(args.Source);
//Update tracking values.
unsigned int rippleID = nextRippleID;
nextRippleID += 1;
unsigned int index = currentRippleIndex;
currentRippleIndex += 1;
currentRippleIndex %= maxRipples;
//Make sure uniform values aren't invalid.
if (args.DropoffPoint <= 0.0f)
{
cpy.DropoffPoint = 9999.0f;
}
if (args.Period <= 0.0f)
{
cpy.Period = 5.0f;
}
if (args.Speed <= 0.0f)
{
cpy.Speed = 1.0f;
}
//Set the uniforms.
dp_tsc_h_p[index] = Vector4f(cpy.DropoffPoint, cpy.TimeSinceCreated,
cpy.Amplitude, cpy.Period);
sXY_sp[index] = Vector3f(cpy.Source.x, cpy.Source.y, cpy.Speed);
rippleIDs[index] = rippleID;
return rippleID;
}