本文整理汇总了C++中Joint::getPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Joint::getPos方法的具体用法?C++ Joint::getPos怎么用?C++ Joint::getPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Joint
的用法示例。
在下文中一共展示了Joint::getPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Joint
Joint * SkeletonData::readJoint(JsonTree joint, Joint * parent) {
Joint * j = new Joint();
if(parent != nullptr){
parent->addChild(j);
}
std::vector<NodeChild *> children;
std::vector<Voxel *> voxels;
j->id = joint.getChild( "id" ).getValue<int>();
app::console() << "id: " << j->id << std::endl;
// Transform: Object
JsonTree transform = joint.getChild("transform");
JsonTree pos = transform.getChild("pos");
app::console() << " jt_pos: x = " << pos.getChild("x").getValue<float>() << " y = " << pos.getChild("y").getValue<float>() << " pos: z = " << pos.getChild("z").getValue<float>() << std::endl;
j->setPos(glm::vec3(pos.getChild("x").getValue<float>(), pos.getChild("y").getValue<float>(), pos.getChild("z").getValue<float>()), false);
app::console() << " pos: x = " << j->getPos().x << " y = " << j->getPos().y << " pos: z = " << j->getPos().z << std::endl;
JsonTree orientation = transform.getChild("orientation");
j->transform->orientation = glm::quat(orientation.getChild("w").getValue<float>(), orientation.getChild("x").getValue<float>(), orientation.getChild("y").getValue<float>(), orientation.getChild("z").getValue<float>());
app::console() << " orientation: x = " << j->transform->orientation.x << " y = " << j->transform->orientation.y << " z = " << j->transform->orientation.z << " w = " << j->transform->orientation.w << std::endl;
JsonTree scale = transform.getChild("scaleVector");
j->transform->scaleVector = glm::vec3(scale.getChild("x").getValue<float>(), scale.getChild("y").getValue<float>(), scale.getChild("z").getValue<float>());
app::console() << " scale: x = " << j->transform->scaleVector.x << " y = " << j->transform->scaleVector.y << " z = " << j->transform->scaleVector.z << std::endl;
// Voxels: Array
JsonTree voxelsJson = joint.getChild("voxels");
unsigned int voxel_index = 0;
for (JsonTree::ConstIter voxel = voxelsJson.begin(); voxel != voxelsJson.end(); ++voxel) {
// Apparently, getKey DOESN't return an index if there is no key?
//JsonTree cJson = childrenJson.getChild(child->getKey());
JsonTree vJson = voxelsJson.getChild(voxel_index);
readVoxel(vJson, j);
voxel_index++;
}
// Animations: Objects
readAnimations(joint.getChild("animations"), j);
// Children: Array
JsonTree childrenJson = joint.getChild("children");
unsigned int children_index = 0;
for( JsonTree::ConstIter child = childrenJson.begin(); child != childrenJson.end(); ++child ) {
// Apparently, getKey DOESN't return an index if there is no key?
//JsonTree cJson = childrenJson.getChild(child->getKey());
JsonTree cJson = childrenJson.getChild(children_index);
Joint * c = readJoint(cJson, j);
children.push_back(c);
children_index++;
}
j->children = children;
return j;
}