void AnimSkeleton::dump() const { qCDebug(animation) << "["; for (int i = 0; i < getNumJoints(); i++) { qCDebug(animation) << " {"; qCDebug(animation) << " index =" << i; qCDebug(animation) << " name =" << getJointName(i); qCDebug(animation) << " absBindPose =" << getAbsoluteBindPose(i); qCDebug(animation) << " relBindPose =" << getRelativeBindPose(i); qCDebug(animation) << " absDefaultPose =" << getAbsoluteDefaultPose(i); qCDebug(animation) << " relDefaultPose =" << getRelativeDefaultPose(i); #ifdef DUMP_FBX_JOINTS qCDebug(animation) << " fbxJoint ="; qCDebug(animation) << " isFree =" << _joints[i].isFree; qCDebug(animation) << " freeLineage =" << _joints[i].freeLineage; qCDebug(animation) << " parentIndex =" << _joints[i].parentIndex; qCDebug(animation) << " translation =" << _joints[i].translation; qCDebug(animation) << " preTransform =" << _joints[i].preTransform; qCDebug(animation) << " preRotation =" << _joints[i].preRotation; qCDebug(animation) << " rotation =" << _joints[i].rotation; qCDebug(animation) << " postRotation =" << _joints[i].postRotation; qCDebug(animation) << " postTransform =" << _joints[i].postTransform; qCDebug(animation) << " transform =" << _joints[i].transform; qCDebug(animation) << " rotationMin =" << _joints[i].rotationMin << ", rotationMax =" << _joints[i].rotationMax; qCDebug(animation) << " inverseDefaultRotation" << _joints[i].inverseDefaultRotation; qCDebug(animation) << " inverseBindRotation" << _joints[i].inverseBindRotation; qCDebug(animation) << " bindTransform" << _joints[i].bindTransform; qCDebug(animation) << " isSkeletonJoint" << _joints[i].isSkeletonJoint; #endif if (getParentIndex(i) >= 0) { qCDebug(animation) << " parent =" << getJointName(getParentIndex(i)); } qCDebug(animation) << " },"; } qCDebug(animation) << "]"; }
void AnimSkeleton::dump() const { qCDebug(animation) << "["; for (int i = 0; i < getNumJoints(); i++) { qCDebug(animation) << " {"; qCDebug(animation) << " index =" << i; qCDebug(animation) << " name =" << getJointName(i); qCDebug(animation) << " absBindPose =" << getAbsoluteBindPose(i); qCDebug(animation) << " relBindPose =" << getRelativeBindPose(i); if (getParentIndex(i) >= 0) { qCDebug(animation) << " parent =" << getJointName(getParentIndex(i)); } qCDebug(animation) << " },"; } qCDebug(animation) << "]"; }
void ramNodeArray::updateWithOscMessage(const ofxOscMessage &m) { const int nNodes = m.getArgAsInt32(1); for (int i = 0; i < nNodes; i++) { const string name = m.getArgAsString(i * 8 + 0 + 2); const float vx = m.getArgAsFloat(i * 8 + 1 + 2); const float vy = m.getArgAsFloat(i * 8 + 2 + 2); const float vz = m.getArgAsFloat(i * 8 + 3 + 2); const float angle = m.getArgAsFloat(i * 8 + 4 + 2); const float ax = m.getArgAsFloat(i * 8 + 5 + 2); const float ay = m.getArgAsFloat(i * 8 + 6 + 2); const float az = m.getArgAsFloat(i * 8 + 7 + 2); const ofVec3f axis(ax, ay, az); const ofVec3f vec(vx, vy, vz); const ofQuaternion quat(angle, axis); ramNode &node = getNode(i); node.node_id = i; node.name = isActor() ? getJointName(i) : "Node " + ofToString(i); node.setGlobalPosition(vec); node.setGlobalOrientation(quat); node.accelerometer.update(vec, quat); } last_timestamp = current_timestamp; current_timestamp = m.getArgAsFloat(2 + nNodes * 8); last_update_client_time = ofGetElapsedTimef(); }
void AnimSkeleton::dump(const AnimPoseVec& poses) const { qCDebug(animation) << "["; for (int i = 0; i < getNumJoints(); i++) { qCDebug(animation) << " {"; qCDebug(animation) << " index =" << i; qCDebug(animation) << " name =" << getJointName(i); qCDebug(animation) << " absDefaultPose =" << getAbsoluteDefaultPose(i); qCDebug(animation) << " relDefaultPose =" << getRelativeDefaultPose(i); qCDebug(animation) << " pose =" << poses[i]; if (getParentIndex(i) >= 0) { qCDebug(animation) << " parent =" << getJointName(getParentIndex(i)); } qCDebug(animation) << " },"; } qCDebug(animation) << "]"; }
StringArray HuboDescription::getJointNames() const { StringArray result; for(size_t i=0; i<getJointCount(); ++i) { result.push_back(getJointName(i)); } return result; }
StringArray HuboDescription::getJointNames(IndexArray joints) const { StringArray result; for(size_t i=0; i<joints.size(); ++i) { result.push_back(getJointName(joints[i])); } return result; }
vector<string> ramActor::getJointNames() { vector<string> names; names.clear(); names.resize(ramActor::NUM_JOINTS); for (int i = 0; i < names.size(); i++) names.at(i) = getJointName(i); return names; }
void dWorldExportDIF (dWorldID w, FILE *file, const char *prefix) { PrintingContext c; c.file = file; #if defined(dSINGLE) c.precision = 7; #else c.precision = 15; #endif c.indent = 1; fprintf (file,"-- Dynamics Interchange Format v0.1\n\n%sworld = dynamics.world {\n",prefix); c.print ("gravity",w->gravity); c.print ("ODE = {"); c.indent++; c.print ("ERP",w->global_erp); c.print ("CFM",w->global_cfm); c.print ("auto_disable = {"); c.indent++; c.print ("linear_threshold",w->adis.linear_average_threshold); c.print ("angular_threshold",w->adis.angular_average_threshold); c.print ("average_samples",(int)w->adis.average_samples); c.print ("idle_time",w->adis.idle_time); c.print ("idle_steps",w->adis.idle_steps); fprintf (file,"\t\t},\n\t},\n}\n"); c.indent -= 3; // bodies int num = 0; fprintf (file,"%sbody = {}\n",prefix); for (dxBody *b=w->firstbody; b; b=(dxBody*)b->next) { b->tag = num; fprintf (file,"%sbody[%d] = dynamics.body {\n\tworld = %sworld,\n",prefix,num,prefix); c.indent++; c.print ("pos",b->posr.pos); c.print ("q",b->q,4); c.print ("lvel",b->lvel); c.print ("avel",b->avel); c.print ("mass",b->mass.mass); fprintf (file,"\tI = {{"); for (int i=0; i<3; i++) { for (int j=0; j<3; j++) { c.printReal (b->mass.I[i*4+j]); if (j < 2) fputc (',',file); } if (i < 2) fprintf (file,"},{"); } fprintf (file,"}},\n"); c.printNonzero ("com",b->mass.c); c.print ("ODE = {"); c.indent++; if (b->flags & dxBodyFlagFiniteRotation) c.print ("finite_rotation",1); if (b->flags & dxBodyDisabled) c.print ("disabled",1); if (b->flags & dxBodyNoGravity) c.print ("no_gravity",1); if (b->flags & dxBodyAutoDisable) { c.print ("auto_disable = {"); c.indent++; c.print ("linear_threshold",b->adis.linear_average_threshold); c.print ("angular_threshold",b->adis.angular_average_threshold); c.print ("average_samples",(int)b->adis.average_samples); c.print ("idle_time",b->adis.idle_time); c.print ("idle_steps",b->adis.idle_steps); c.print ("time_left",b->adis_timeleft); c.print ("steps_left",b->adis_stepsleft); c.indent--; c.print ("},"); } c.printNonzero ("facc",b->facc); c.printNonzero ("tacc",b->tacc); if (b->flags & dxBodyFlagFiniteRotationAxis) { c.print ("finite_rotation_axis",b->finite_rot_axis); } c.indent--; c.print ("},"); if (b->geom) { c.print ("geometry = {"); c.indent++; for (dxGeom *g=b->geom; g; g=g->body_next) { c.print ("{"); c.indent++; printGeom (c,g); c.indent--; c.print ("},"); } c.indent--; c.print ("},"); } c.indent--; c.print ("}"); num++; } // joints num = 0; fprintf (file,"%sjoint = {}\n",prefix); for (dxJoint *j=w->firstjoint; j; j=(dxJoint*)j->next) { c.indent++; const char *name = getJointName (j); fprintf (file, "%sjoint[%d] = dynamics.%s_joint {\n" "\tworld = %sworld,\n" "\tbody = {" ,prefix,num,name,prefix); if ( j->node[0].body ) fprintf (file,"%sbody[%d]",prefix,j->node[0].body->tag); if ( j->node[1].body ) fprintf (file,",%sbody[%d]",prefix,j->node[1].body->tag); fprintf (file,"}\n"); switch (j->type()) { case dJointTypeBall: printBall (c,j); break; case dJointTypeHinge: printHinge (c,j); break; case dJointTypeSlider: printSlider (c,j); break; case dJointTypeContact: printContact (c,j); break; case dJointTypeUniversal: printUniversal (c,j); break; case dJointTypeHinge2: printHinge2 (c,j); break; case dJointTypeFixed: printFixed (c,j); break; case dJointTypeAMotor: printAMotor (c,j); break; case dJointTypeLMotor: printLMotor (c,j); break; case dJointTypePR: printPR (c,j); break; case dJointTypePU: printPU (c,j); break; case dJointTypePiston: printPiston (c,j); break; default: c.print("unknown joint"); } c.indent--; c.print ("}"); num++; } }