#include <ACG/Math/GLMatrixT.hh>
#include <ObjectTypes/Skeleton/BaseSkin.hh>
void skeletonTutorial2() {
int objectId = -1;
emit log(
LOGERR,
"Unable to create new Skeleton");
return;
}
int jointCount = 3;
for (int i=0; i < jointCount; i++){
std::string jointName = QString("Joint" + QString::number(i)).toStdString();
skeleton->
addJoint(currentParent, newJoint);
currentParent = newJoint;
}
double xOffset = 0.0;
xOffset += 1.0;
}
int frameCount = 100;
AnimationHandle animHandle = skeleton->addAnimation(
"Rotation", animation);
skeleton->animation(animHandle)->setFps(25);
double maxAngle = 90.0;
for (int i=0; i < frameCount; i++){
animHandle.setFrame(i);
rotationMatrix.
rotate( maxAngle / frameCount, axis);
}
objectId = -1;
emit log(
LOGERR,
"Unable to create new Mesh");
return;
}
mesh->add_property(propWeights, SKIN_WEIGHTS_PROP);
int steps = 50;
for (int i=0; i < jointCount; i++)
for (int j=0; j < steps; j++){
double xPos = (j / double(steps-1));
mesh->property(propWeights, vh1)[ i ] = 1.0 - xPos;
mesh->property(propWeights, vh2)[ i ] = 1.0 - xPos;
if ( i != 2 ){
mesh->property(propWeights, vh1)[ i+1 ] = xPos;
mesh->property(propWeights, vh2)[ i+1 ] = xPos;
} else
break;
}
RPC::callFunctionValue<bool, int, int>(
"skeletalanimation",
"attachSkin", skeletonObject->
id(), meshObject->
id());
}