本文整理汇总了C++中TMatrix::SetTranslationMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ TMatrix::SetTranslationMatrix方法的具体用法?C++ TMatrix::SetTranslationMatrix怎么用?C++ TMatrix::SetTranslationMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMatrix
的用法示例。
在下文中一共展示了TMatrix::SetTranslationMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TranslateNode
bool CCharShape::TranslateNode (size_t node_name, const TVector3d& vec) {
TCharNode *node = GetNode (node_name);
if (node == NULL) return false;
TMatrix<4, 4> TransMatrix;
TransMatrix.SetTranslationMatrix(vec.x, vec.y, vec.z);
node->trans = node->trans * TransMatrix;
TransMatrix.SetTranslationMatrix(-vec.x, -vec.y, -vec.z);
node->invtrans = TransMatrix * node->invtrans;
if (newActions && useActions) AddAction (node_name, 0, vec, 0);
return true;
}
示例2: RefreshNode
void CCharShape::RefreshNode (size_t idx) {
if (idx >= numNodes) return;
TMatrix<4, 4> TempMatrix;
char caxis;
ETR_DOUBLE angle;
TCharNode *node = Nodes[idx];
TCharAction *act = node->action;
if (act == NULL) return;
if (act->num < 1) return;
node->trans.SetIdentity();
node->invtrans.SetIdentity();
for (size_t i=0; i<act->num; i++) {
int type = act->type[i];
const TVector3d& vec = act->vec[i];
ETR_DOUBLE dval = act->dval[i];
switch (type) {
case 0:
TempMatrix.SetTranslationMatrix(vec.x, vec.y, vec.z);
node->trans = node->trans * TempMatrix;
TempMatrix.SetTranslationMatrix(-vec.x, -vec.y, -vec.z);
node->invtrans = TempMatrix * node->invtrans;
break;
case 1:
caxis = 'x';
angle = dval;
TempMatrix.SetRotationMatrix(angle, caxis);
node->trans = node->trans * TempMatrix;
TempMatrix.SetRotationMatrix(-angle, caxis);
node->invtrans = TempMatrix * node->invtrans;
break;
case 2:
caxis = 'y';
angle = dval;
TempMatrix.SetRotationMatrix(angle, caxis);
node->trans = node->trans * TempMatrix;
TempMatrix.SetRotationMatrix(-angle, caxis);
node->invtrans = TempMatrix * node->invtrans;
break;
case 3:
caxis = 'z';
angle = dval;
TempMatrix.SetRotationMatrix(angle, caxis);
node->trans = node->trans * TempMatrix;
TempMatrix.SetRotationMatrix(-angle, caxis);
node->invtrans = TempMatrix * node->invtrans;
break;
case 4:
TempMatrix.SetScalingMatrix(vec.x, vec.y, vec.z);
node->trans = node->trans * TempMatrix;
TempMatrix.SetScalingMatrix(1.0 / vec.x, 1.0 / vec.y, 1.0 / vec.z);
node->invtrans = TempMatrix * node->invtrans;
break;
case 5:
VisibleNode (node->node_name, dval);
break;
default:
break;
}
}
}