本文整理汇总了C++中MFnDagNode::transformationMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnDagNode::transformationMatrix方法的具体用法?C++ MFnDagNode::transformationMatrix怎么用?C++ MFnDagNode::transformationMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnDagNode
的用法示例。
在下文中一共展示了MFnDagNode::transformationMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printTransformData
void RadiosityRenderer::printTransformData(const MDagPath& dagPath)
{
printf("got");
//This method simply determines the transformation information on the DAG node and prints it out.
MStatus status;
MObject transformNode = dagPath.transform(&status);
// This node has no transform - i.e., it’s the world node
if (!status && status.statusCode () == MStatus::kInvalidParameter)
return;
MFnDagNode transform (transformNode, &status);
if (!status) {
status.perror("MFnDagNode constructor");
return;
}
MTransformationMatrix matrix (transform.transformationMatrix());
//cout << " translation: " << matrix.translation(MSpace::kWorld)
//<< endl;
double threeDoubles[3];
MTransformationMatrix::RotationOrder rOrder;
matrix.getRotation (threeDoubles, rOrder, MSpace::kWorld);
cout << " rotation: ["
<< threeDoubles[0] << ", "
<< threeDoubles[1] << ", "
<< threeDoubles[2] << "]\n";
matrix.getScale (threeDoubles, MSpace::kWorld);
cout << " scale: ["
<< threeDoubles[0] << ", "
<< threeDoubles[1] << ", "
<< threeDoubles[2] << "]\n";
}
示例2: createSceneGraph
void Exporter::createSceneGraph(MFnDagNode& path, int parentIndex)
{
Node output;
std::vector<std::string> pathparts;
output.name = path.fullPathName().asChar();
splitStringToVector(output.name, pathparts, "|");
output.name = pathparts[pathparts.size() - 1];
if (!strcmp(output.name.c_str(), "persp"))
return;
else if (!strcmp(output.name.c_str(), "top"))
return;
else if (!strcmp(output.name.c_str(), "side"))
return;
else if (!strcmp(output.name.c_str(), "front"))
return;
output.parent = parentIndex;
output.transform = path.transformationMatrix().matrix;
scene_.sceneGraph.push_back(output);
int children = path.childCount();
int parent = scene_.sceneGraph.size() - 1;
for (int i = 0; i < children; i++)
{
cout << path.child(i).apiTypeStr() << endl;
if (!strcmp(path.child(i).apiTypeStr(), "kMesh")){
scene_.sceneGraph[parent].type = 1;
MFnMesh mesh(path.child(i));
MDagPath dag_path;
MItDag dag_iter(MItDag::kBreadthFirst, MFn::kMesh);
int y = 0;
while (!dag_iter.isDone())
{
if (dag_iter.getPath(dag_path))
{
MFnDagNode dag_node = dag_path.node();
if (!dag_node.isIntermediateObject())
{
if (!strcmp(mesh.partialPathName().asChar(), dag_node.partialPathName().asChar()))
scene_.sceneGraph[parent].mesh = y;
y++;
}
}
dag_iter.next();
}
}
// else if (!strcmp(path.child(i).apiTypeStr(), "kCamera")); kan l�gga till fler typer h�r
else
createSceneGraph(MFnDagNode(path.child(i)), parent);
}
}