Ejemplo n.º 1
0
void SDLwindow::draw()
{
    if (scene->getDefaultCamera() == scene->getCamera()){
        hrp::BodyPtr target = scene->targetObject();
        double yaw = pan;
        double x,y,z;
        if (target){
            GLlink *root = (GLlink *)target->rootLink();
            root->getPosition(x,y,z);
            hrp::Matrix33 R;
            root->getRotation(R);
            hrp::Vector3 rpy = hrp::rpyFromRot(R);
            yaw += rpy[2];
        }else{
            x = xCenter; y = yCenter; z = zCenter;
        }
        double xEye = x + radius*cos(tilt)*cos(yaw);
        double yEye = y + radius*cos(tilt)*sin(yaw);
        double zEye = z + radius*sin(tilt);
        scene->getCamera()->setViewTarget(x,y,z);
        scene->getCamera()->setViewPoint(xEye, yEye, zEye);
    }
    scene->setView();
    
    glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);

    scene->draw();
}