当前位置: 首页>>代码示例>>C++>>正文


C++ Bone::getAttachedVertices方法代码示例

本文整理汇总了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);
		}
	}
}
开发者ID:BruceJawn,项目名称:animata,代码行数:58,代码来源:IO.cpp


注:本文中的Bone::getAttachedVertices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。