本文整理汇总了C++中FaceList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ FaceList::end方法的具体用法?C++ FaceList::end怎么用?C++ FaceList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FaceList
的用法示例。
在下文中一共展示了FaceList::end方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addRawVerticePart
void ObjLoader::addRawVerticePart (ObjMesh *mesh, FaceList &faces, int num) {
std::vector<Face *>::iterator it = faces.begin();
// Etape 1 : construire la liste des faces
std::vector<int> triangleBuffer;
std::vector<int> quadBuffer;
std::vector<float> glVertexBuffer;
int reservedSize = faces.size();
triangleBuffer.reserve (reservedSize);
quadBuffer.reserve (reservedSize);
glVertexBuffer.reserve (3.*reservedSize);
int indexVertex = 0;
it = faces.begin();
do {
VertexObj v1 (*this, (*it)->vertices[0]);
VertexObj v2 (*this, (*it)->vertices[1]);
VertexObj v3 (*this, (*it)->vertices[2]);
glVertexBuffer.push_back (v1.vertex.x);
glVertexBuffer.push_back (v1.vertex.y);
glVertexBuffer.push_back (v1.vertex.z);
glVertexBuffer.push_back (v2.vertex.x);
glVertexBuffer.push_back (v2.vertex.y);
glVertexBuffer.push_back (v2.vertex.z);
glVertexBuffer.push_back (v3.vertex.x);
glVertexBuffer.push_back (v3.vertex.y);
glVertexBuffer.push_back (v3.vertex.z);
int index1 = indexVertex++;
int index2 = indexVertex++;
int index3 = indexVertex++;
if ( (*it)->type == TRIANGLE) {
triangleBuffer.push_back (index1);
triangleBuffer.push_back (index2);
triangleBuffer.push_back (index3);
} else {
VertexObj v4 (*this, (*it)->vertices[3]);
glVertexBuffer.push_back (v4.vertex.x);
glVertexBuffer.push_back (v4.vertex.y);
glVertexBuffer.push_back (v4.vertex.z);
int index4 = indexVertex++;
quadBuffer.push_back (index1);
quadBuffer.push_back (index2);
quadBuffer.push_back (index3);
quadBuffer.push_back (index4);
}
delete (*it);
} while (++it != faces.end());
// etape 2 : construire le Mesh pour le renderer
SmoothGroup *theSmoothGroup = new SmoothGroup (glVertexBuffer, triangleBuffer, quadBuffer, false, false);
mesh->addSmoothGroup (theSmoothGroup);
// On nettoie tout !
glVertexBuffer.erase (glVertexBuffer.begin(), glVertexBuffer.end());
triangleBuffer.erase (triangleBuffer.begin(), triangleBuffer.end());
quadBuffer.erase (quadBuffer.begin(), quadBuffer.end());
}
示例2: convertFacesToGeometry
bool PolyMesh::convertFacesToGeometry( FaceList faces, GEOMETRY_FIX* geom )
{
if ( !faces.size() || !geom ) return false;
osg::ref_ptr<osg::DrawElementsUInt> indices = new osg::DrawElementsUInt( osg::PrimitiveSet::TRIANGLES, 0 );
unsigned int i, index=0, firstIndex=0, lastIndex=0;
for ( FaceList::iterator itr=faces.begin();
itr!=faces.end();
++itr )
{
Face f = *(*itr);
unsigned int size=f._pts.size();
for ( i=0; i<size; ++i )
{
if ( i>2 )
{
indices->push_back( firstIndex );
indices->push_back( lastIndex );
}
indices->push_back( f(i) );
if ( !i ) firstIndex = indices->back();
lastIndex = indices->back();
}
}
geom->removePrimitiveSet( 0, geom->getPrimitiveSetList().size() );
geom->addPrimitiveSet( indices.get() );
geom->setTexCoordArray( 0, NULL ); // TEMP
NormalVisitor::buildNormal( *geom );
geom->dirtyDisplayList();
return true;
}
示例3: restore
void Brush::restore(const FaceList& faces) {
Utility::deleteAll(m_faces);
FaceList::const_iterator it, end;
for (it = faces.begin(), end = faces.end(); it != end; ++it) {
Face* face = *it;
face->setBrush(this);
m_faces.push_back(face);
}
rebuildGeometry();
}
示例4: MapObject
Brush::Brush(const BBoxf& worldBounds, bool forceIntegerFacePoints, const FaceList& faces) :
MapObject(),
m_geometry(NULL),
m_worldBounds(worldBounds),
m_forceIntegerFacePoints(forceIntegerFacePoints) {
init();
FaceList::const_iterator it, end;
for (it = faces.begin(), end = faces.end(); it != end; ++it) {
Face* face = *it;
face->setBrush(this);
m_faces.push_back(face);
}
rebuildGeometry();
}
示例5: loadSmileys
void CustomSmileyManager::loadSmileys( int groupIndex )
{
// clear the table first
for(int row = 0; row < tblFaceList->numRows(); row++){
tblFaceList->removeRow(row);
}
tblFaceList->setNumRows(0);
TQString dir = EvaMain::user->getSetting()->getCustomSmileyDir() + "/";
if(groupIndex>0)
dir += (m_Config->groupName( groupIndex) + "/");
FaceList list = m_Config->groupMembers( groupIndex );
int row = 0;
if(list.size()){
tblFaceList->setNumRows(list.size());
tblFaceList->horizontalHeader()->setLabel( 0, i18n("No." ) );
tblFaceList->horizontalHeader()->setLabel( 1, i18n("Smiley" ) );
tblFaceList->horizontalHeader()->setLabel( 2, i18n("Shortcut" ) );
for( FaceList::Iterator it = list.begin(); it != list.end(); ++it){
//tblFaceList->setText(row, 0, TQString::number( row + 1));
tblFaceList->setItem(row, 0,
new TQTableItem(tblFaceList, TQTableItem::Never,
TQString::number(row + 1)));
TQPixmap *pixmap = new TQPixmap(dir + (*it).fixed());
CustomItem *item = new CustomItem(tblFaceList, (*it).tip(), *pixmap);
tblFaceList->setItem(row, 1, item);
CustomItem *itemSC = new CustomItem(tblFaceList, (*it).shortcut() );
tblFaceList->setItem(row, 2, itemSC);
tblFaceList->setRowHeight(row, pixmap->width() + 2);
delete pixmap;
row++;
}
tblFaceList->setColumnWidth(0, 20);
tblFaceList->setColumnWidth(1, tblFaceList->visibleWidth() - 20 - 50 );
}
}
示例6: addVerticePart
void ObjLoader::addVerticePart (ObjMesh *mesh, FaceList &faces, int num) {
std::vector<Face *>::iterator it = faces.begin();
std::map<VertexObj, int> vertexBuffer;
// Etape 1 : construire la liste des sommets (vert) uniques
int addedVerticesNumber = 0;
do {
VertexObj v1 (*this, (*it)->vertices[0]);
vertexBuffer[v1] = ++addedVerticesNumber;
VertexObj v2 (*this, (*it)->vertices[1]);
vertexBuffer[v2] = ++addedVerticesNumber;
VertexObj v3 (*this, (*it)->vertices[2]);
vertexBuffer[v3] = ++addedVerticesNumber;
if ( (*it)->type == QUAD) {
VertexObj v4 (*this, (*it)->vertices[3]);
vertexBuffer[v4] = ++addedVerticesNumber;
}
} while (++it != faces.end());
// Etape 2 : numeroter les sommets
int newnumber = 0;
for (std::map<VertexObj, int>::iterator vm = vertexBuffer.begin(); vm != vertexBuffer.end(); ++vm)
vm->second = newnumber++;
// Etape 3 : construire la liste des faces
std::vector<int> triangleBuffer;
std::vector<int> quadBuffer;
int reservedSize = faces.size();
triangleBuffer.reserve (reservedSize);
quadBuffer.reserve (reservedSize);
it = faces.begin();
do {
VertexObj v1 (*this, (*it)->vertices[0]);
VertexObj v2 (*this, (*it)->vertices[1]);
VertexObj v3 (*this, (*it)->vertices[2]);
int index1 = vertexBuffer.find (v1)->second;
int index2 = vertexBuffer.find (v2)->second;
int index3 = vertexBuffer.find (v3)->second;
if ( (*it)->type == TRIANGLE) {
triangleBuffer.push_back (index1);
triangleBuffer.push_back (index2);
triangleBuffer.push_back (index3);
} else {
VertexObj v4 (*this, (*it)->vertices[3]);
int index4 = vertexBuffer.find (v4)->second;
quadBuffer.push_back (index1);
quadBuffer.push_back (index2);
quadBuffer.push_back (index3);
quadBuffer.push_back (index4);
}
delete (*it);
} while (++it != faces.end());
// etape4 : construire le tableau de sommet final
std::vector<float> glVertexBuffer;
for (std::map<VertexObj, int>::iterator vm = vertexBuffer.begin(); vm != vertexBuffer.end(); ++vm) {
glVertexBuffer.push_back (vm->first.vertex.x);
glVertexBuffer.push_back (vm->first.vertex.y);
glVertexBuffer.push_back (vm->first.vertex.z);
}
// etape 5 : construire le Mesh pour le renderer
SmoothGroup *theSmoothGroup = new SmoothGroup (glVertexBuffer, triangleBuffer, quadBuffer, false, false);
mesh->addSmoothGroup (theSmoothGroup);
// On nettoie tout !
glVertexBuffer.erase (glVertexBuffer.begin(), glVertexBuffer.end());
triangleBuffer.erase (triangleBuffer.begin(), triangleBuffer.end());
quadBuffer.erase (quadBuffer.begin(), quadBuffer.end());
vertexBuffer.erase (vertexBuffer.begin(), vertexBuffer.end());
}