本文整理汇总了C++中math::Matrix4::inverseRotate方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4::inverseRotate方法的具体用法?C++ Matrix4::inverseRotate怎么用?C++ Matrix4::inverseRotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类math::Matrix4
的用法示例。
在下文中一共展示了Matrix4::inverseRotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSkeleton
void EMIModel::setSkeleton(Skeleton *skel) {
if (_skeleton == skel) {
return;
}
_skeleton = skel;
if (!skel || !_numBoneInfos) {
return;
}
int boneVert = 0;
delete[] _vertexBoneInfo; _vertexBoneInfo = NULL;
delete[] _vertexBone; _vertexBone = NULL;
_vertexBoneInfo = new int[_numBoneInfos];
_vertexBone = new int[_numBoneInfos]; // Oversized, but yeah.
for (int i = 0; i < _numBoneInfos; i++) {
_vertexBoneInfo[i] = _skeleton->findJointIndex(_boneNames[_boneInfos[i]._joint], _skeleton->_numJoints);
if (_boneInfos[i]._incFac == 1) {
_vertexBone[boneVert] = i;
boneVert++;
}
}
Math::Vector3d vertex;
Math::Matrix4 mat;
for (int i = 0; i < _numVertices; i++) {
vertex = _vertices[i];
if (_vertexBoneInfo[_vertexBone[i]] != -1) {
mat = _skeleton->_joints[_vertexBoneInfo[_vertexBone[i]]]._absMatrix;
mat.inverseTranslate(&vertex);
mat.inverseRotate(&vertex);
}
_vertices[i] = vertex;
}
}
示例2: updatePosition
void SoundTrack::updatePosition() {
if (!_positioned)
return;
Set *set = g_grim->getCurrSet();
Set::Setup *setup = set->getCurrSetup();
Math::Vector3d cameraPos = setup->_pos;
Math::Vector3d vector = _pos - cameraPos;
float distance = vector.getMagnitude();
_attenuation = MAX(0.0f, 1.0f - distance / (_volume * 100.0f / Audio::Mixer::kMaxChannelVolume));
if (!isfinite(_attenuation)) {
_attenuation = 0.0f;
}
Math::Matrix4 worldRot = setup->_rot;
Math::Vector3d relPos = (_pos - setup->_pos);
Math::Vector3d p(relPos);
worldRot.inverseRotate(&p);
float angle = atan2(p.x(), p.z());
float pan = sin(angle);
_balance = (int)(pan * 127.0f);
if (_handle) {
g_system->getMixer()->setChannelBalance(*_handle, _balance);
g_system->getMixer()->setChannelVolume(*_handle, (byte)getEffectiveVolume());
}
}