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

void Navigator::step ( float  steps = 0.1f )

Go one timestep or more by adding speed to the viewer coordinates. Since speed does not neccessarily goes in the same direction as direction, you have a certain amount of simulated inertia.

Definition at line 118 of file navigator.cpp.

References Geometry2D3DSphere::getPoint().

Referenced by GLTestWidget::navtimer().

                                {
  if (autoNavigation) {
    QTime currentTime = QTime::currentTime();    
    int timestep = autoNavTimeLastFrame.msecsTo(currentTime);
    if (timestep>1000) timestep = 1000;
    
    autoNavPos += autoNavStep*(float(timestep)/(1000./50.));
    if (autoNavPos>1) autoNavPos=1;

    autoNavTimeLastFrame = currentTime;

    Point3D newMark2D = sourceMark*(1.-autoNavPos) + targetMark*autoNavPos;
    double height = newMark2D.z;
    height += autoNavDistance*(-pow(fabs(0.5-autoNavPos),2)+0.25)*10;
    Point3D newMark3D = gSphere.getPoint(Point2D(newMark2D.x, newMark2D.y), height);
    setViewer(newMark3D);
    setDirection((sourceDir*(1.-autoNavPos) + targetDir*autoNavPos-getViewer()).normalize());
    setUp((sourceUp*(1.-autoNavPos) + targetUp*autoNavPos).normalize());

    if (autoNavPos>=1.) stopAutoNavigation();
  }
  else {
    /* reduce speed when the surface is near */
    float surfacedist = viewer.length()-1;
    viewer += direction*(speed*surfacedist)*steps;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index