本文整理汇总了C++中Skeleton::numBones方法的典型用法代码示例。如果您正苦于以下问题:C++ Skeleton::numBones方法的具体用法?C++ Skeleton::numBones怎么用?C++ Skeleton::numBones使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skeleton
的用法示例。
在下文中一共展示了Skeleton::numBones方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendNetDataStream
void sendNetDataStream()
{
/*
Vector3D rightupperarm_pos, rightelbow_pos;
if (!anim_ctrl.getBonePosition("RightArm", rightupperarm_pos, rightelbow_pos))
cerr << "Failed to find bone \"RightArm\"" << endl;
char* send_buf = new char[buffer_len];
int i = anim_ctrl.getAnimationFrame() % 200;
printf("sending %d\n", i);
sprintf(send_buf, "%f,%f,%f,%f,%f,%f",
rightupperarm_pos.x, rightupperarm_pos.y, rightupperarm_pos.z,
rightelbow_pos.x, rightelbow_pos.y, rightelbow_pos.z);
if (!net_server->sendToAll(send_buf, buffer_len, NULL, 0))
logout << "network communication stream error" << endl;
delete [] send_buf;
*/
vector<BoneData> bones;
Skeleton* skel = anim_ctrl.getSkeleton();
for (int i = 0; i < skel->numBones(); i++)
{
Vector3D p1, p2;
skel->getBonePositions(i, p1, p2);
BoneData bone(i, p1, p2);
bones.push_back(bone);
}
stringstream data;
for (unsigned int i = 0; i < bones.size(); i++) {
if (i > 0) data << ";";
data << bones[i].id << ","
<< bones[i].p1.x << "," << bones[i].p1.y << "," << bones[i].p1.z << ","
<< bones[i].p2.x << "," << bones[i].p2.y << "," << bones[i].p2.z;
}
int buf_len = data.str().length() + 1;
char* send_buf = new char[buf_len];
strcpy(send_buf, data.str().c_str());
if (!net_server->sendToAll(send_buf, buf_len, NULL, 0))
logout << "network communication stream error" << endl;
delete[] send_buf;
}