当前位置: 首页>>代码示例>>C++>>正文


C++ FaceList类代码示例

本文整理汇总了C++中FaceList的典型用法代码示例。如果您正苦于以下问题:C++ FaceList类的具体用法?C++ FaceList怎么用?C++ FaceList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FaceList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
开发者ID:Exoria,项目名称:Fac,代码行数:60,代码来源:objloader.cpp

示例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;
}
开发者ID:kapecp,项目名称:osgmodeling,代码行数:35,代码来源:PolyMesh.cpp

示例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();
        }
开发者ID:WakaLakaLake,项目名称:TrenchBroom,代码行数:12,代码来源:Brush.cpp

示例4: f_handler

bool PLY2Reader::loadPLY2Mesh(std::shared_ptr<Shape> shape, std::string fname)
{
  std::ifstream f_handler(fname);
  if (!f_handler)
  {
    std::cout << "Open file failed.\n";
    return false;
  }

  std::string line;
  std::stringstream ss;

  int num_vertex = 0;
  int num_face = 0;
  VertexList vertexList;
  FaceList faceList;
  STLVectorf UVList;

  getline(f_handler, line);
  ss.str(line);
  ss >> num_vertex;
  getline(f_handler, line);
  ss.str(line);
  ss >> num_face;

  for (int i = 0; i < num_vertex; ++i)
  {
    float v;
    for (int j = 0; j < 3; ++j)
    {
      getline(f_handler, line);
      ss.str(line);
      ss >> v;
      vertexList.push_back(v);
    }
  }

  for (int i = 0; i < num_face; ++i)
  {
    int f;
    for (int j = 0; j < 3; ++j)
    {
      getline(f_handler, line);
      ss.str(line);
      ss >> f;
      faceList.push_back(f);
    }
  }

  shape->init(vertexList, faceList, UVList);
  return true;
}
开发者ID:xiaojhl,项目名称:Image-2-Shape,代码行数:52,代码来源:PLY2Reader.cpp

示例5: postProcessRGB

void GestureContext::postProcessRGB()
{
	GreyscaleImage grey = m_last_rgb_image->greyscale();
	FaceList *faces = m_face_detector->detect(grey, m_face_list->best());
	//FaceList *faces = m_face_detector->detect(grey);
	m_face_list->insert(*faces);
	Face *f = m_face_list->best();
	if (!faces->contains(f)) {
		m_face_list->miss(f);
	}
	faces->clear();
	delete(faces);
}
开发者ID:darrikmazey,项目名称:libgesture,代码行数:13,代码来源:gesturecontext.cpp

示例6: FaceList

/**
 * Prints the polyhedra on the screen by calculating the intersection of three meshes 
 * each time.
 */
FaceList *
Polyhedron::print()
{
    FaceList * printing = new FaceList();
    FaceList::iterator iter;

    /* Going through the list of points and copy them into the new list. */
    for (iter = faces.begin(); iter != faces.end(); iter++) {
        printing->push_back((*iter)->transform(org, angle));
    }

    return printing;
}
开发者ID:fenixGames,项目名称:GEngine,代码行数:17,代码来源:geometry3D.cpp

示例7: assert

        void Brush::restore(const Brush& brushTemplate, bool checkId) {
            if (checkId)
                assert(uniqueId() == brushTemplate.uniqueId());

            Utility::deleteAll(m_faces);

            const FaceList templateFaces = brushTemplate.faces();
            for (size_t i = 0; i < templateFaces.size(); i++) {
                Face* face = new Face(m_worldBounds, m_forceIntegerFacePoints, *templateFaces[i]);
                face->setBrush(this);
                m_faces.push_back(face);
            }

            rebuildGeometry();
        }
开发者ID:WakaLakaLake,项目名称:TrenchBroom,代码行数:15,代码来源:Brush.cpp

示例8: insert

int FaceList::insert(FaceList &other)
{
	for (std::map< Face*, int >::iterator it = other.m_faces.begin(); it != other.m_faces.end(); it++) {
		insert(it->first, it->second);
	}
	return(other.size());
}
开发者ID:darrikmazey,项目名称:libgesture,代码行数:7,代码来源:facelist.cpp

示例9: 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();
        }
开发者ID:WakaLakaLake,项目名称:TrenchBroom,代码行数:16,代码来源:Brush.cpp

示例10: build

	void WaterList::build(FaceList& waterFaces, Float32 waveHeight)
	{
		this->waveHeight = waveHeight;
		vertexes.clear();
		for (Vertex& vertex : waterFaces.getVertexes())
		{
			if (vertex.getFlag() == Vertex::Flag::Flow)
			{
				vertexes.push_back(WaterVertex(vertex, waveHeight));
			}
		}
	}
开发者ID:marcellus-trixus,项目名称:duel6r,代码行数:12,代码来源:WaterList.cpp

示例11: i18n

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 );
	}
}
开发者ID:MagicGroup,项目名称:eva,代码行数:40,代码来源:createsmileywindow.cpp

示例12: getEdge

void PolyMesh::findNeighbors( Face* f, FaceList& flist )
{
    unsigned int size = f->_pts.size();
    for ( unsigned int i=0; i<size; ++i )
    {
        Edge* edge = getEdge( (*f)[i%size], (*f)[(i+1)%size], _edges );
        if ( !edge ) continue;

        for ( FaceList::iterator itr=edge->_faces.begin();
            itr!=edge->_faces.end();
            ++itr )
        {
            if ( *itr!=f )
                flist.push_back( *itr );
        }
    }
}
开发者ID:kapecp,项目名称:osgmodeling,代码行数:17,代码来源:PolyMesh.cpp

示例13: initEdgeGraph

void FastMassSpring::initEdgeGraph(
  FaceList& face_list,
  VertexList& vertex_list,
  AdjList& vertex_share_faces)
{
  this->P_Num = vertex_list.size() / 3;

  // building edge graph
  this->strech_edges.clear();
  {
    int ptid[3] = {0, 0, 0};
    for (decltype(face_list.size()) i = 0; i < face_list.size() / 3; ++i)
    {
      ptid[0] = face_list[3 * i + 0];
      ptid[1] = face_list[3 * i + 1];
      ptid[2] = face_list[3 * i + 2];
      // the order of start point and end point doesn't matter
      this->strech_edges.push_back(
        ptid[0] < ptid[1] ? Edge(ptid[0], ptid[1]) : Edge(ptid[1], ptid[0]));
      this->strech_edges.push_back(
        ptid[1] < ptid[2] ? Edge(ptid[1], ptid[2]) : Edge(ptid[2], ptid[1]));
      this->strech_edges.push_back(
        ptid[2] < ptid[0] ? Edge(ptid[2], ptid[0]) : Edge(ptid[0], ptid[2]));
    }
    std::sort(this->strech_edges.begin(), this->strech_edges.end());
    std::vector<Edge>::iterator iter = 
      std::unique(this->strech_edges.begin(), this->strech_edges.end());
    this->strech_edges.erase(iter, strech_edges.end());
    this->strech_edges.shrink_to_fit();

    // store rest length
    float cur_r = 0.0;
    this->strech_r_length.clear();
    for (auto& i : this->strech_edges)
    {
      cur_r = 0.0;
      for (int j = 0; j < 3; ++j)
      {
        cur_r += pow(vertex_list[3 * i.first + j] - vertex_list[ 3 * i.second + j], 2);
      }
      this->strech_r_length.push_back(sqrt(cur_r));
    }
  }

  this->bending_edges.clear();
  {
    for (auto& i : this->strech_edges)
    {
      int cross_pi = -1;
      int cross_pj = -1;
      if (findShareVertex(
        cross_pi, cross_pj, i.first, i.second, vertex_share_faces, face_list))
      {
        this->bending_edges.push_back(
          cross_pi < cross_pj ? 
            Edge(cross_pi, cross_pj) : Edge(cross_pj, cross_pi));
      }
    }

    // store rest length
    float cur_r = 0.0;
    this->bending_r_length.clear();
    for (auto& i : this->bending_edges)
    {
      cur_r = 0.0;
      for (int j = 0; j < 3; ++j)
      {
        cur_r += pow(vertex_list[3 * i.first + j] - vertex_list[ 3 * i.second + j], 2);
      }
      this->bending_r_length.push_back(sqrt(cur_r));
    }
  }

  // init d vector
  this->computedVector();
}
开发者ID:LegendGraphics,项目名称:FastMassSpring,代码行数:76,代码来源:FastMassSpring.cpp

示例14: 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());
}
开发者ID:Exoria,项目名称:Fac,代码行数:74,代码来源:objloader.cpp

示例15: dir

/** remove one group, 2 options:
      1: remove all smileys in this group, then remove the group itself
      2: move all sub items into another group, then remove the empty group

     NOTE: this operation is un-recoverable.
*/
void CustomSmileyManager::slotRemoveGroupClicked( )
{
	if(!m_Config) return;

	TQListViewItem *item = lvGroups->selectedItem();
	if(item){
		if(item == lvGroups->firstChild()) return; // never remove default group

		int index = m_Config->groupIndex( item->text( 0 ) );
		if(index <= -1) return;

		TQString path = EvaMain::user->getSetting()->getCustomSmileyDir() + "/";
		TQDir dir( path + item->text(0) );
		FaceList list = m_Config->groupMembers( index);
		int result = -2;
		if(list.size() > 0 ){
			result = RmSmileyGroupDialog::QueryDialog( index, m_Config, this);
			switch(result){
				case -2: // abort
					return;
					break;
				case -1:  // remove all
					break;
				default: // otherwise, move to result
				{
					if(dir.exists()){
						dir.setFilter( TQDir::Files | TQDir::Hidden | TQDir::NoSymLinks );
						const TQFileInfoList *list = dir.entryInfoList();
						TQFileInfoListIterator it( *list);
						TQFileInfo *fi;
						TQString destDir = path;
						if(result>0)
							destDir += ( m_Config->groupName( result ) + "/") ;
						while( (fi = it.current() ) != 0 ){
							EvaHelper::copyFile(fi->absFilePath(), (destDir + fi->fileName()) );
							++it;
						}
					}
					m_Config->moveChildrenTo(index, result);
					m_IsChanged = true;
				}
			}
		}

		if(dir.exists()){
			// update the in-memory config
			if(m_Config->removeGroup( index )){
				lvGroups->takeItem( item);
				delete item;
				m_IsChanged = true;
			} else return;

			dir.setFilter( TQDir::Files | TQDir::Hidden | TQDir::NoSymLinks );
			const TQFileInfoList *list = dir.entryInfoList();
			TQFileInfoListIterator it( *list);
			TQFileInfo *fi;
			while( (fi = it.current() ) != 0 ){
				dir.remove( fi->absFilePath() );
				++it;
			}
			// as all files have been deleted,  we need keep the config file up to date.
			m_Config->saveXML();
			if( ! dir.rmdir( dir.path(), true)){
				KMessageBox::error( this, i18n( "Remove directory \"%1\" failed. " ).arg( dir.path() ),
							i18n( "Remove Directory!" ) );
			}
		}
	}
}
开发者ID:MagicGroup,项目名称:eva,代码行数:75,代码来源:createsmileywindow.cpp


注:本文中的FaceList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。