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; }
quint64 SegmentationProxy::subobject_at_location(const QList<int> & position) { return readVoxel({position}); }