Logo Search packages:      
Sourcecode: earth3d version File versions  Download package

void GLTestWidget::navtimer (  ) [virtual, slot]

continuous redraw while moving

Definition at line 704 of file gltest.cpp.

References Navigator::step().

                            {
  navMutex.lock();
  navtime_nowtime = QTime::currentTime();
  float step;
  if (frameByFrame) {
    step = 1;
  }
  else {
    step = navtime_ctime.msecsTo(navtime_nowtime)/100.;
    if (step>10) step=10;
  }
  nav.step(step/10);

  if (flyMode) {
    // gravitation
    Point3D axis = nav.viewer.crossproduct(nav.direction).normalize();
    float matrix[16];
    Quaternion quat;
    quat.createFromAxisAngle(axis.x, axis.y, axis.z, -1);
    quat.createMatrix(matrix);
    nav.setDirection(Matrix::multvector(matrix, nav.direction));
    nav.up = Matrix::multvector(matrix, nav.up);

//     nav.setViewer(nav.viewer-(nav.viewer.normalize()/6000.));
//     if (nav.viewer.length()<1) nav.viewer = nav.viewer.normalize();
    /* rotate around x */
    nav.rotate(roll);
//     float matrix[16];
//     Quaternion quat;
//     quat.createFromAxisAngle(nav.up.x, nav.up.y, nav.up.z, (mx-omx)/10.);
//     quat.createMatrix(matrix);
//     nav.setDirection(Matrix::multvector(matrix, nav.direction));
//     nav.up = Matrix::multvector(matrix, nav.up);      
    
    /* rotate around y */
    nav.elevate(pitch);
//     Point3D axis = nav.direction.crossproduct(nav.up);
//     quat.createFromAxisAngle(axis.x, axis.y, axis.z, (my-omy)/10.);
//     quat.createMatrix(matrix);
//     nav.setDirection(Matrix::multvector(matrix, nav.direction));
//     nav.up = Matrix::multvector(matrix, nav.up);
  }

  navMutex.unlock();

  //    repaint();
#ifdef DAVE
  if(dave->isServer()) { 
    Point3D mousedir;
    while(!dave->isStopped()) { 
      printf("Hallo\n");

      davedata *dd = (davedata *) dave->getSyncBuffer();
      switch(dave->getMouseButton()) {
      case 1:
      dd->rtri += 10;
      break;
      case 3:
      // move forward
      mousedir.x = dave->getMouseZ().x/3.;
      mousedir.y = dave->getMouseZ().y/3.;
      mousedir.z = dave->getMouseZ().z/3.;
      nav.setViewer(nav.getViewer()+mousedir);
      break;
      case 2:
      dd->rtri += 350;
      break;
      }
      dd->rtri = dd->rtri % 360;
      dd->viewer = nav.viewer;
      dd->direction = nav.direction;
      dd->up = nav.up;

      dave->synchronize(); 
    }
  }
  else {
    updateScreen();
  }
#else

#ifdef LINUX
#ifdef JOYSTICK
  checkJoystick();
#endif
#endif

  /** continuous redraw while moving */
  if (nav.speed || needRedraw) {
    needRedraw = false;
    //       rendering.lock();
    drawFinished = false;
    updateScreen();
#ifdef WIN32
    // due to some reason windows needs *both* commands to redraw
    //       updateGL();
#endif
    //       rendering.unlock();
    //      if (!drawFinished) rendered.wait();
  }
  else {
    usleep(10000);
  }
#endif

  navtime_ctime = navtime_nowtime;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index