本文整理汇总了C++中Bone::getAttachedVertices方法的典型用法代码示例。如果您正苦于以下问题:C++ Bone::getAttachedVertices方法的具体用法?C++ Bone::getAttachedVertices怎么用?C++ Bone::getAttachedVertices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bone
的用法示例。
在下文中一共展示了Bone::getAttachedVertices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveBones
/**
* Creates XML objects for all the bones in a skeleton.
**/
void IO::saveBones(TiXmlElement *parent, vector<Bone *> *bones,
vector<Joint *> *joints, vector<Vertex *> *vertices)
{
TiXmlElement *bonesXML = new TiXmlElement("bones");
parent->LinkEndChild(bonesXML);
vector<Bone *>::iterator i = bones->begin();
for (; i < bones->end(); i++)
{
Bone *b = *i;
TiXmlElement *boneXML = new TiXmlElement("bone");
const char *name = b->getName();
if (name[0] != 0) // save name only for named bones
boneXML->SetAttribute("name", name);
// find vertex indices in mesh and set attributes
boneXML->SetAttribute("j0",
index(joints->begin(), joints->end(), b->j0));
boneXML->SetAttribute("j1",
index(joints->begin(), joints->end(), b->j1));
boneXML->SetDoubleAttribute("stiffness", b->damp);
boneXML->SetDoubleAttribute("lm", b->getLengthMult());
boneXML->SetDoubleAttribute("lmmin", b->getLengthMultMin());
boneXML->SetDoubleAttribute("lmmax", b->getLengthMultMax());
boneXML->SetDoubleAttribute("tempo", b->getTempo());
boneXML->SetDoubleAttribute("time", b->getTime());
boneXML->SetDoubleAttribute("size", b->getOrigSize());
boneXML->SetAttribute("selected", b->selected);
boneXML->SetDoubleAttribute("radius", b->getRadiusMult());
bonesXML->LinkEndChild(boneXML);
// save attached vertices
float *dsts, *weights, *ca, *sa;
vector<Vertex *> *attachedVertices =
b->getAttachedVertices(&dsts, &weights, &ca, &sa);
int count = attachedVertices->size();
if (!count) // no vertices attached
continue;
TiXmlElement *attachedXML = new TiXmlElement("attached");
boneXML->LinkEndChild(attachedXML);
for (int j = 0; j < count; j++)
{
Vertex *v = (*attachedVertices)[j];
TiXmlElement *vertexXML = new TiXmlElement("vertex");
// find and set vertex index
vertexXML->SetAttribute("id",
index(vertices->begin(), vertices->end(), v));
vertexXML->SetDoubleAttribute("d", dsts[j]); // distance
vertexXML->SetDoubleAttribute("w", weights[j]); // weight
vertexXML->SetDoubleAttribute("ca", ca[j]); // cosinus
vertexXML->SetDoubleAttribute("sa", sa[j]); // sinus
attachedXML->LinkEndChild(vertexXML);
}
}
}