本文整理汇总了C++中TMatrix::SetScalingMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ TMatrix::SetScalingMatrix方法的具体用法?C++ TMatrix::SetScalingMatrix怎么用?C++ TMatrix::SetScalingMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMatrix
的用法示例。
在下文中一共展示了TMatrix::SetScalingMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScaleNode
void CCharShape::ScaleNode (size_t node_name, const TVector3d& vec) {
TCharNode *node = GetNode(node_name);
if (node == NULL) return;
TMatrix<4, 4> matrix;
matrix.SetScalingMatrix(vec.x, vec.y, vec.z);
node->trans = node->trans * matrix;
matrix.SetScalingMatrix(1.0 / vec.x, 1.0 / vec.y, 1.0 / vec.z);
node->invtrans = matrix * node->invtrans;
if (newActions && useActions) AddAction (node_name, 4, vec, 0);
}
示例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;
}
}
}