Beispiel #1
0
Point3D update_sphere(float t, GLfloat* total)
{
        Point3D sphere_pos;
        sphere_pos.x = 0;
        sphere_pos.y = 0;
        sphere_pos.z = 0;
        T(60,0,0, trans);
        Ry(0.01*t, roty);
        Mult(roty, trans, total);
        T(125,0,125, trans);
        Mult(trans, total, total);
        MatrixMultPoint3D(total, &sphere_pos, &sphere_pos);
        return sphere_pos;
}
Beispiel #2
0
void mousedrag(int x, int y) {
    static const double scale = 10.0;
    static const double fiscale = 30.0;

    Point3D diff;
    diff.x = look_at.x - position.x;
    diff.y = look_at.y - position.y;
    diff.z = look_at.z - position.z;
    Ry((float)(x-mouse_click[0])/fiscale, &work[0]);
    MatrixMultPoint3D(&work[0], &diff, &diff);
    VectorAdd(&position, &diff, &look_at);
    look_at.y -= (float)(y-mouse_click[1])/scale;
    //printf("Dragged to (%d,%d) yielding (%f,%f)\n", x, y, look_at.x, look_at.z);
    mouse_click[0] = x;
    mouse_click[1] = y;
}