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

void SphereEarthView::Render (  )  [virtual]

Render one frame.

Implements EarthView.

Definition at line 31 of file SphereEarthView.cc.

References Region::calc_proj(), Eye::h, EarthView::m_Eye, EarthView::m_MasterLayer, EarthView::m_ViewportHeight, EarthView::m_ViewportWidth, MasterLayer::RenderRegion(), Region::reset_proj_z(), Region::v, Region::w, Eye::x, Eye::y, and Eye::yfov().

                             {
      /* setup projection */
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluPerspective(m_Eye.yfov((double)m_ViewportWidth/(double)m_ViewportHeight)/M_PI*180.0, (double)m_ViewportWidth/(double)m_ViewportHeight, 0.001, 10);
      glTranslatef(0, 0, -1.0-m_Eye.h);
      glRotatef(-90.0 + m_Eye.y*360.0, 1, 0, 0);
      glRotatef(-m_Eye.x*360.0, 0, 0, 1);


      glEnable(GL_CULL_FACE);
      glEnable(GL_DEPTH_TEST);
      glEnable(GL_POLYGON_OFFSET_FILL);
      glPolygonOffset(2,2);

      double model[16];
      double proj[16];
      int view[4];

      glGetDoublev(GL_PROJECTION_MATRIX, proj);
      glGetDoublev(GL_MODELVIEW_MATRIX, model);
      glGetIntegerv(GL_VIEWPORT, view);

      Region rgn;
      int i, j;
      for (i = -180; i < 180; i += XSTEP) {
            for (j = -90+YSTEP; j < 90-YSTEP; j += YSTEP) {
                  rgn.v[0] = Vector3d( -sin((double)i * M_PI/180.0) * cos((double)j * M_PI/180.0),
                              cos((double)i * M_PI/180.0) * cos((double)j * M_PI/180.0),
                              sin((double)j * M_PI/180.0));

                  rgn.v[1] = Vector3d( -sin((double)(i+XSTEP) * M_PI/180.0) * cos((double)j * M_PI/180.0),
                              cos((double)(i+XSTEP) * M_PI/180.0) * cos((double)j * M_PI/180.0),
                              sin((double)j * M_PI/180.0));

                  rgn.v[2] = Vector3d(-sin((double)(i+XSTEP) * M_PI/180.0) * cos((double)(j+YSTEP) * M_PI/180.0),
                              cos((double)(i+XSTEP) * M_PI/180.0) * cos((double)(j+YSTEP) * M_PI/180.0),
                              sin((double)(j+YSTEP) * M_PI/180.0));

                  rgn.v[3] = Vector3d(-sin((double)i * M_PI/180.0) * cos((double)(j+YSTEP) * M_PI/180.0),
                              cos((double)i * M_PI/180.0) * cos((double)(j+YSTEP) * M_PI/180.0),
                              sin((double)(j+YSTEP) * M_PI/180.0));

                  rgn.w[0] = Vector2d((double)i / 360.0, (double)j / 360.0);
                  rgn.w[1] = Vector2d((double)(i+XSTEP) / 360.0, (double)(j+YSTEP) / 360.0);

                  rgn.calc_proj(model, proj, view);
                  rgn.reset_proj_z();

                  /* call master layer */
                  m_MasterLayer->RenderRegion(&rgn);
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index