#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;
double maxAngle = 90.0;
for (int i=0; i < frameCount; 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());
}
#define DATA_TRIANGLE_MESH
void rotate(Scalar angle, Scalar x, Scalar y, Scalar z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
void identity()
setup an identity matrix
A handle used to refer to an animation or to a specific frame in an animation.
void setFrame(size_t _iFrame)
Sets the current animation frame (not failsafe)
Represents a single joint in the skeleton.
size_t id() const
returns the joint id
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
SmartVertexHandle add_vertex(const Point _p)
A general pose, used to store the frames of the animation.
void setGlobalTranslation(unsigned int _joint, const Vector &_position, bool _keepGlobalChildPositions=true)
Sets the global translation vector.
void setGlobalMatrix(unsigned int _joint, const Matrix &_global, bool _keepGlobalChildPositions=true)
Sets the global coordinate system.
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
Iterator class for the skeleton.
Pose * referencePose()
Returns a pointer to the reference pose.
Iterator begin()
Iterator over joints of the skeletal tree in TOP-DOWN order (from root to leafs)
void addJoint(typename SkeletonT< PointT >::Joint *_pParent, typename SkeletonT< PointT >::Joint *_pJoint)
Adds a joint as child of a given parent joint.
AnimationHandle addAnimation(std::string _name, Animation *_animation)
Adds a new animation to the list.
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
Pose * pose(const AnimationHandle &_hAni)
Returns a pointer to the pose with the given animation handle.
Joint * joint(const size_t &_index)
Returns the joint with the given index.
Iterator end()
Compare an iterator with the return value of this method to test if it is done.
Type for a MeshObject containing a triangle mesh.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
DrawMode POINTS
draw unlighted points using the default base color
VectorT< double, 3 > Vec3d
SkeletonObject * skeletonObject(BaseObjectData *_object)
Cast an BaseObject to a SkeletonObject if possible.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
Skeleton * skeleton(BaseObjectData *_object)
Get a skeleton from an object.
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .
void viewAll(int _viewer)
View the whole scene.