Esempio n. 1
0
void Chain::draw() {
    Bone *current = this->root;
    int depth = 0;
    //Matrix4f transform;
    glPushMatrix();
    while (current != NULL) {
        glMultMatrixf(current->getTransformationMatrix().data());
        current->draw(BONE_RADIUS, BONE_FACES);
        //transform = current->getTransformationMatrix();
        current = current->getChild(0);
    }
    glPopMatrix();
}
Esempio n. 2
0
void Chain::addAngle(int depth, float theta) {
    int i;
    Bone *target = this->root;
    for (i = 0; i < depth; i++) {
        /* avoid null pointer dereference */
        if (target == NULL) return;

        /* move to next link in chain */
        target = target->getChild(0);
    }

    /* do the rotation */
    target->addAngle(theta);
}