コード例 #1
0
// process a GL_TRIANGLE_STRIP list
void VRML_LAYER::processStrip( void )
{
    // note: (source: http://www.opengl.org/wiki/Primitive)
    // GL_TRIANGLE_STRIP​: Every group of 3 adjacent vertices forms a triangle.
    // The face direction of the strip is determined by the winding of the
    // first triangle. Each successive triangle will have its effective face
    // order reverse, so the system compensates for that by testing it in the
    // opposite way. A vertex stream of n length will generate n-2 triangles.

    if( vlist.size() < 3 )
        return;

    int i;
    int end = vlist.size();
    bool flip = false;

    for( i = 2; i < end; ++i )
    {
        if( flip )
        {
            addTriplet( vlist[i - 1], vlist[i - 2], vlist[i] );
            flip = false;
        }
        else
        {
            addTriplet( vlist[i - 2], vlist[i - 1], vlist[i] );
            flip = true;
        }
    }
}
コード例 #2
0
void ContactDialog::addEmail(const Email &em)
{
    addTriplet(emailCount, ui->layEmails, "Email", em.address);
    QComboBox* cbT = findChild<QComboBox*>(QString("cbEmailType%1").arg(emailCount));
    if (emailCount>MIN_VISIBLE_TRIPLETS)
        fillEmailTypes(cbT);
    addTypeList(emailCount, "Email", em.emTypes, Email::standardTypes);
}
コード例 #3
0
void ContactDialog::addPhone(const Phone& ph)
{
    addTriplet(phoneCount, ui->layPhones, "Phone", ph.number);
    QComboBox* cbT = findChild<QComboBox*>(QString("cbPhoneType%1").arg(phoneCount));
    if (phoneCount>MIN_VISIBLE_TRIPLETS)
        fillPhoneTypes(cbT);
    addTypeList(phoneCount, "Phone", ph.tTypes, Phone::standardTypes);
}
コード例 #4
0
// process a GL_TRIANGLES list
void VRML_LAYER::processTri( void )
{
    // notes:
    // 1. each successive group of 3 vertices is a triangle
    // 2. as per OpenGL specification, any incomplete triangles are to be ignored

    if( vlist.size() < 3 )
        return;

    int i;
    int end = vlist.size();

    for( i = 2; i < end; i += 3 )
        addTriplet( vlist[i - 2], vlist[i - 1], vlist[i] );
}
コード例 #5
0
// process a GL_TRIANGLE_FAN list
void VRML_LAYER::processFan( void )
{
    if( vlist.size() < 3 )
        return;

    VERTEX_3D* p0 = vlist[0];

    int i;
    int end = vlist.size();

    for( i = 2; i < end; ++i )
    {
        addTriplet( p0, vlist[i - 1], vlist[i] );
    }
}
コード例 #6
0
ファイル: tripletstore.cpp プロジェクト: NanoSim/Porto
/*!
  Create a triplestore from a CSV file

  \todo Should this be a constructor instead?
 */
void TripletStore::fromCSV(std::string const &csv) {
  const QString c(csv.c_str());
  const QStringList relations = c.split("\n", QString::SkipEmptyParts);
  for (QString r: relations) {
    const QStringList triplet = r.split(",", QString::SkipEmptyParts);
    if (triplet.size() == 3) {
      const std::string subject = triplet[0].toStdString();
      const std::string predicate = triplet[1].toStdString();
      const std::string object = triplet[2].toStdString();
      addTriplet(subject, predicate, object);
    }
    else {
      throw std::runtime_error("Malformed triplet");
    }
  }
}