コード例 #1
0
ファイル: Viewer.cpp プロジェクト: skyopener/OSCCAR-dev
void Viewer::draw()
{
    LCC &m = *scene->lcc;

    if ( m.is_empty() ) return;

    for (LCC::Attribute_range<3>::type::iterator
            it=m.attributes<3>().begin(),
            itend=m.attributes<3>().end(); it!=itend; ++it )
    {
        if ( it->info().is_visible() )
        {
            // TODO allow to select one volume ?
            // if(selectedVolumeIndex == (int)i) glLineWidth(5.0f);
            draw_one_vol(it->dart(), it->info().is_filled());
            // if(selectedVolumeIndex == (int)i) glLineWidth(1.4f);

            if(vertices)
            {
                for( LCC::One_dart_per_incident_cell_range<0,3>::iterator
                        it2(m, it->dart()); it2.cont(); ++it2)
                {
                    LCC::Point p = m.point(it2);
                    glBegin(GL_POINTS);
                    glColor3f(.6f,.2f,.8f);
                    glVertex3f( p.x(),p.y(),p.z());
                    glEnd();
                }
            }
        }
    }
}
コード例 #2
0
ファイル: Viewer.cpp プロジェクト: ooici-dm/CGAL-Mesh
void Viewer::draw()
{
  LCC &m = *scene->lcc;

  if ( m.is_empty() ) return;

  for(unsigned int i = 0; i < pVolumeDartIndex->size(); i++)
  {
    if( ::isVisible((*pVolumeProperties)[i]))
    {
      if(selectedVolumeIndex == (int)i) glLineWidth(5.0f);
      draw_one_vol((*pVolumeDartIndex)[i].second,
                   ::isFilled((*pVolumeProperties)[i]));
      if(selectedVolumeIndex == (int)i) glLineWidth(1.4f);

      if(vertices)
      {
        for( LCC::One_dart_per_incident_cell_range<0,3>::iterator
               it(m, (*pVolumeDartIndex)[i].second); it.cont(); ++it)
        {
          LCC::Point p = m.point(it);
          glBegin(GL_POINTS);
          glColor3f(.6f,.2f,.8f);
          glVertex3f( p.x(),p.y(),p.z());
          glEnd();
        }
      }
    }
  }
}
コード例 #3
0
ファイル: Viewer.cpp プロジェクト: skyopener/OSCCAR-dev
void Viewer::drawFacet(Dart_const_handle ADart)
{
    LCC &m = *scene->lcc;
    ::glBegin(GL_POLYGON);
    CGAL_assertion( ADart->attribute<3>()!=NULL );

    //  double r = (double)ADart->attribute<3>()->info().r()/255.0;
    double r = (double)ADart->attribute<3>()->info().color().r()/255.0;
    double g = (double)ADart->attribute<3>()->info().color().g()/255.0;
    double b = (double)ADart->attribute<3>()->info().color().b()/255.0;
    if ( !ADart->is_free(3) )
    {
        r += (double)ADart->beta(3)->attribute<3>()->info().color().r()/255.0;
        g += (double)ADart->beta(3)->attribute<3>()->info().color().g()/255.0;
        b += (double)ADart->beta(3)->attribute<3>()->info().color().b()/255.0;
        r /= 2;
        g /= 2;
        b /= 2;
    }

    ::glColor3f(r,g,b);

    // If Flat shading: 1 normal per polygon
    if (flatShading)
    {
        LCC::Vector n = CGAL::compute_normal_of_cell_2(m,ADart);
        n = n/(CGAL::sqrt(n*n));
        ::glNormal3d(n.x(),n.y(),n.z());
    }

    for ( LCC::Dart_of_orbit_range<1>::const_iterator it(m,ADart);
            it.cont(); ++it)
    {
        // If Gouraud shading: 1 normal per vertex
        if (!flatShading)
        {
            LCC::Vector n = CGAL::compute_normal_of_cell_0<LCC>(m,it);
            n = n/(CGAL::sqrt(n*n));
            ::glNormal3d(n.x(),n.y(),n.z());
        }

        LCC::Point p = m.point(it);
        ::glVertex3d( p.x(),p.y(),p.z());
    }
    ::glEnd();
}
コード例 #4
0
ファイル: Viewer.cpp プロジェクト: skyopener/OSCCAR-dev
/// Draw all the edge of the facet given by ADart
void Viewer::drawEdges(Dart_const_handle ADart)
{
    LCC &m = *scene->lcc;
    glBegin(GL_LINES);
    glColor3f(.2f,.2f,.6f);
    for ( LCC::Dart_of_orbit_range<1>::const_iterator it(m,ADart);
            it.cont(); ++it)
    {
        LCC::Point p = m.point(it);
        Dart_const_handle d2 = it->other_extremity();
        if ( d2!=NULL )
        {
            LCC::Point p2 = m.point(d2);
            glVertex3f( p.x(),p.y(),p.z());
            glVertex3f( p2.x(),p2.y(),p2.z());
        }
    }
    glEnd();
}