• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Vertices类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Vertices类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: device_

Sphere::Sphere( float radius, unsigned tesselationLevel, D3D::GraphicDevice device, float freq,
			    const Material& material )
	: device_(device),
	  vertexDeclaration_(device, DefaultVertexDeclaration),
	  vertexBuffer_(device),
	  indexBuffer_(device),
	  shader_(device, L"sphere.vsh"),
	  radius_(radius),
	  tesselationLevel_(tesselationLevel),
	  freq_(freq),
	  material_(material)
{
	Vertices vertices;
	Indices indices;

	InitVertices(tesselationLevel, radius*sqrtf(2), vertices, indices);
	nVertices_ = vertices.size();
	nPrimitives_ = indices.size()/3;
	vertexBuffer_.SetVertices( &vertices[0], vertices.size() );
	indexBuffer_.SetIndices( &indices[0], indices.size() );
	SetPositionMatrix( UnityMatrix() );
	SetViewMatrix( UnityMatrix() );
	SetProjectiveMatrix( UnityMatrix() );
}
开发者ID:eas,项目名称:Lighting,代码行数:24,代码来源:sphere.cpp


示例2: color_sort

	void color_sort(Vertices &R){
		int j = 0, maxno = 1, min_k = max((int)QMAX.size() - (int)Q.size() + 1, 1);
		C[1].clear(), C[2].clear();
		for(int i = 0; i < (int)R.size(); i++) {
			int pi = R[i].i, k = 1;
			while(cut1(pi, C[k])) k++;
			if(k > maxno) maxno = k, C[maxno + 1].clear();
			C[k].push_back(pi);
			if(k < min_k) R[j++].i = pi;
		}
		if(j > 0) R[j - 1].d = 0;
		for(int k = min_k; k <= maxno; k++)
			for(int i = 0; i < (int)C[k].size(); i++)
				R[j].i = C[k][i], R[j++].d = k;
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:15,代码来源:MaximumClique.cpp


示例3:

bool SpatialModelMaximalRepulsion3D<CoordType>::checkHardcoreDistances(
  const Vector<CoordType>& vertex,
  const int v,
  const Vertices<CoordType>& vertices) const
{
  const Vector<CoordType>& hardcoreDistances = this->getHardcoreDistances();
  Vector<CoordType> triMeshVertex;
  if ( this->getTriMeshQuery().closestPoint(vertex,triMeshVertex) < hardcoreDistances[v] )
    return false;

  for (int i = 0; i < vertices.getNumVertices(); ++i)
    if ( i != v && vertices[i].distance(vertex) < hardcoreDistances[i] + hardcoreDistances[v] )
      return false;

  return true;
}
开发者ID:jarpon,项目名称:epitraits,代码行数:16,代码来源:spatialmodelmaximalrepulsion3d.cpp


示例4: insert

	bool BufferPrograms::insert(Vertices &vertices)
	{
		SCOPE_profile_cpu_function("RenderTimer");
		if (vertices.nbr_buffer() != _types.size()) {
			return (false);
		}
		for (auto index = 0ull; index < vertices.nbr_buffer(); ++index) {
			if (_types[index] != vertices.get_type(index)) {
				return (false);
			}
		}
		for (auto &buffer_targeted : _buffers) {
			vertices.set_block_memory(buffer_targeted->push_back(vertices.transfer_data(buffer_targeted->name())), buffer_targeted->name());
		}
		vertices.set_indices_block_memory(_indices_buffer.push_back(vertices.transfer_indices_data()));
		return (true);
	}
开发者ID:Another-Game-Engine,项目名称:AGE,代码行数:17,代码来源:BufferPrograms.cpp


示例5: writeToLog

    void writeToLog(Logging::Log* plog)
    {
        std::stringstream logmessage;

        using std::endl;
        using std::cout;

        logmessage << "MeshData:: " << std::endl << "Vertices : " << std::endl;
        for (int i = 0; i < m_Vertices.size(); i++)
        {
            logmessage << i << ": " << m_Vertices[i] << endl;
        }
        logmessage << "Indices & Normals : " << endl;
        for (int i = 0; i < m_Faces.size(); i++)
        {
            logmessage << i << ": " << m_Faces[i] << "\t n:" << m_Normals[i] << std::endl;
        }
        plog->logMessage(logmessage.str());
    };
开发者ID:gabyx,项目名称:GRSFramework,代码行数:19,代码来源:MeshData.hpp


示例6: addCone

/**
 * Add all the outgoing edges from the vertex v to the horizon edges.
 * Also, update the conflict graph for the newly added faces.
 */
void addCone(Arrangement &arr, Vertex *v, Edges &horizon, Vertices &vertices)
{
	int n = horizon.size();

	Edges spokes1;
	Edges spokes2;
	for (int i = 0; i < n; ++i) {
		Edge *e0 = horizon[i];

		Edge *e1 = arr.addHalfEdge(e0->tail, NULL, NULL, false);
		e1->id = edge_id++;
		Edge *e2 = arr.addHalfEdge(v, NULL, NULL, false);
		e2->id = edge_id++;
		e1->twin = e2;
		e2->twin = e1;
		spokes1.push_back(e1);
		spokes2.push_back(e2);
	}

	// order the edges around the vertex, i.e. set the next pointer correctly
	for (int i = 0; i < n; ++i) {
		Edge *e = horizon[i];
		e->twin->next = spokes1[(i + 1) % n];
		spokes1[i]->next = e;
		spokes2[i]->next = spokes2[(i - 1 + n) % n];
	}

	// Add the corresponding faces
	for (int i = 0; i < n; ++i) {
		Face *f = new Face;
		arr.faces.push_back(f);
		f->id = face_id++;
		arr.addBoundary(horizon[i], f);

		// Also, update the conflict graph for added faces.
		for (int j = 0; j < vertices.size(); ++j) {
			if (f->visible(vertices[j])) {
				f->visibleVertices.push_back(vertices[j]);
				vertices[j]->visibleFaces.push_back(f);
			}
		}
	}
}
开发者ID:gnishida,项目名称:Geometry3,代码行数:47,代码来源:hull3.C


示例7: listUpdateVertices

/**
 * List up all the vertices that have to be tested for the conflict graph.
 */
void listUpdateVertices(Arrangement &arr, Vertex *v, Edges &horizon, Vertices &vertices)
{
	map<Vertex*, bool> hashtable;

	for (int i = 0; i < horizon.size(); ++i) {
		Face* f1 = horizon[i]->face;
		Face* f2 = horizon[i]->twin->face;

		for (int j = 0; j < f1->visibleVertices.size(); ++j) {
			if (f1->visibleVertices[j] != v) {
				hashtable[f1->visibleVertices[j]] = true;
			}
		}
		for (int j = 0; j < f2->visibleVertices.size(); ++j) {
			if (f2->visibleVertices[j] != v) {
				hashtable[f2->visibleVertices[j]] = true;
			}
		}
	}

	for (map<Vertex*, bool>::iterator it = hashtable.begin(); it != hashtable.end(); ++it) {
		vertices.push_back((*it).first);
	}
}
开发者ID:gnishida,项目名称:Geometry3,代码行数:27,代码来源:hull3.C


示例8: expand_dyn

	void expand_dyn(Vertices &R){// diff -> diff with no dyn
		S[level].i1 = S[level].i1 + S[level - 1].i1 - S[level].i2;//diff
		S[level].i2 = S[level - 1].i1;//diff
		while((int)R.size()) {
			if((int)Q.size() + R.back().d > (int)QMAX.size()){
				Q.push_back(R.back().i); Vertices Rp; cut2(R, Rp);
				if((int)Rp.size()){
					if((float)S[level].i1 / ++pk < Tlimit) degree_sort(Rp);//diff
					color_sort(Rp);
					S[level].i1++, level++;//diff
					expand_dyn(Rp);
					level--;//diff
				}
				else if((int)Q.size() > (int)QMAX.size()) QMAX = Q;
				Q.pop_back();
			}
			else return;
			R.pop_back();
		}
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:20,代码来源:MaximumClique.cpp


示例9: gnuplot_print_vertices

void gnuplot_print_vertices(std::ostream& out, const Vertices& vertices)
{
    for (Vertex_iterator it = vertices.begin(); it != vertices.end(); ++it)
        out << (*it) << " " << it->unique_id() << endl;
}
开发者ID:SoumyajitG,项目名称:VolRoverN,代码行数:5,代码来源:print_utils.cpp


示例10: PCL_DEBUG

pcl::simulation::TriangleMeshModel::TriangleMeshModel (pcl::PolygonMesh::Ptr plg)
{
  Vertices vertices;
  Indices indices;

  bool found_rgb = false;
  for (size_t i=0; i < plg->cloud.fields.size () ; ++i)
    if (plg->cloud.fields[i].name.compare ("rgb") == 0)
      found_rgb = true;

  if (found_rgb)
  {
    pcl::PointCloud<pcl::PointXYZRGB> newcloud;
    pcl::fromROSMsg (plg->cloud, newcloud);

    PCL_DEBUG("RGB Triangle mesh: ");
    PCL_DEBUG("Mesh polygons: %ld", plg->polygons.size ());
    PCL_DEBUG("Mesh points: %ld", newcloud.points.size ());

    Eigen::Vector4f tmp;
    for(size_t i=0; i< plg->polygons.size (); ++i)
    { // each triangle/polygon
      pcl::Vertices apoly_in = plg->polygons[i];
      for(size_t j = 0; j < apoly_in.vertices.size (); ++j)
      { // each point
        uint32_t pt = apoly_in.vertices[j];
        tmp = newcloud.points[pt].getVector4fMap();
        vertices.push_back (Vertex (Eigen::Vector3f (tmp (0), tmp (1), tmp (2)),
                                    Eigen::Vector3f (newcloud.points[pt].r/255.0f,
                                                     newcloud.points[pt].g/255.0f,
                                                     newcloud.points[pt].b/255.0f)));
        indices.push_back (indices.size ());
      }
    }
  }
  else
  {
    pcl::PointCloud<pcl::PointXYZ> newcloud;
    pcl::fromROSMsg (plg->cloud, newcloud);
    Eigen::Vector4f tmp;
    for(size_t i=0; i< plg->polygons.size (); i++)
    { // each triangle/polygon
      pcl::Vertices apoly_in = plg->polygons[i];
      for(size_t j=0; j< apoly_in.vertices.size (); j++)
      { // each point
        uint32_t pt = apoly_in.vertices[j];
        tmp = newcloud.points[pt].getVector4fMap();
        vertices.push_back (Vertex (Eigen::Vector3f (tmp (0), tmp (1), tmp (2)),
                                    Eigen::Vector3f (1.0, 1.0, 1.0)));
        indices.push_back (indices.size ());
      }
    }
  }

  PCL_DEBUG("Vertices: %ld", vertices.size ());
  PCL_DEBUG("Indices: %ld", indices.size ());

  glGenBuffers (1, &vbo_);
  glBindBuffer (GL_ARRAY_BUFFER, vbo_);
  glBufferData (GL_ARRAY_BUFFER, vertices.size () * sizeof (vertices[0]), &(vertices[0]), GL_STATIC_DRAW);
  glBindBuffer (GL_ARRAY_BUFFER, 0);

  glGenBuffers (1, &ibo_);
  glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, ibo_);
  glBufferData (GL_ELEMENT_ARRAY_BUFFER, indices.size () * sizeof (indices[0]), &(indices[0]), GL_STATIC_DRAW);
  glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);

  if (indices.size () > std::numeric_limits<GLuint>::max ())
    PCL_THROW_EXCEPTION(PCLException, "Too many vertices");

  size_ = static_cast<GLuint>(indices.size ());
}
开发者ID:Bardo91,项目名称:pcl,代码行数:72,代码来源:model.cpp


示例11: assert

void MDAL::Driver3Di::populateFacesAndVertices( Vertices &vertices, Faces &faces )
{
  assert( vertices.empty() );
  size_t faceCount = mDimensions.size( CFDimensions::Face2D );
  faces.resize( faceCount );
  size_t verticesInFace = mDimensions.size( CFDimensions::MaxVerticesInFace );
  size_t arrsize = faceCount * verticesInFace;
  std::map<std::string, size_t> xyToVertex2DId;

  // X coordinate
  int ncidX = mNcFile.getVarId( "Mesh2DContour_x" );
  double fillX = mNcFile.getFillValue( ncidX );
  std::vector<double> faceVerticesX( arrsize );
  if ( nc_get_var_double( mNcFile.handle(), ncidX, faceVerticesX.data() ) ) throw MDAL_Status::Err_UnknownFormat;

  // Y coordinate
  int ncidY = mNcFile.getVarId( "Mesh2DContour_y" );
  double fillY = mNcFile.getFillValue( ncidY );
  std::vector<double> faceVerticesY( arrsize );
  if ( nc_get_var_double( mNcFile.handle(), ncidY, faceVerticesY.data() ) ) throw MDAL_Status::Err_UnknownFormat;

  // now populate create faces and backtrack which vertices
  // are used in multiple faces
  for ( size_t faceId = 0; faceId < faceCount; ++faceId )
  {
    Face face;

    for ( size_t faceVertexId = 0; faceVertexId < verticesInFace; ++faceVertexId )
    {
      size_t arrId = faceId * verticesInFace + faceVertexId;
      Vertex vertex;
      vertex.x = faceVerticesX[arrId];
      vertex.y = faceVerticesY[arrId];
      vertex.z = 0;

      if ( MDAL::equals( vertex.x, fillX ) || MDAL::equals( vertex.y, fillY ) )
        break;


      size_t vertexId;

      std::string key = std::to_string( vertex.x ) + "," + std::to_string( vertex.y );
      const auto it = xyToVertex2DId.find( key );
      if ( it == xyToVertex2DId.end() )
      {
        // new vertex
        vertexId = vertices.size();
        xyToVertex2DId[key] = vertexId;
        vertices.push_back( vertex );
      }
      else
      {
        // existing vertex
        vertexId = it->second;
      }

      face.push_back( vertexId );

    }

    faces[faceId] = face;
  }

  // Only now we have number of vertices, since we identified vertices that
  // are used in multiple faces
  mDimensions.setDimension( CFDimensions::Vertex2D, vertices.size() );
}
开发者ID:FERRATON,项目名称:QGIS,代码行数:67,代码来源:mdal_3di.cpp


示例12: main

int main(int argc, char** argv)
{
  if(argc != 3)
    return usage(argv[0]);
  mark_tag vertex_index(1), vertex_x(2), vertex_y(3), vertex_z(4);

  sregex tface_re = bos >> *space >> "TFACE" >> *space >> eos;

  sregex vertex_re = bos >> *space >> "VRTX" 
			 >> +space >> (vertex_index=+_d)
			 >> +space >> (vertex_x=+(digit|'-'|'+'|'.'))
			 >> +space >> (vertex_y=+(digit|'-'|'+'|'.'))
			 >> +space >> (vertex_z=+(digit|'-'|'+'|'.'))
			 >> eos;

  sregex triangle_re = bos >> *space >> "TRGL"
			   >> +space >> (s1=+digit)
			   >> +space >> (s2=+digit)
			   >> +space >> (s3=+digit)
			   >> eos;
  sregex end_re = bos >> *space >> "END" >> *space >> eos;

  std::ifstream input(argv[1]);
  std::ofstream output(argv[2]);

  if(!input) {
    std::cerr << "Cannot read \"" << argv[1] << "\"!\n";
    return EXIT_FAILURE;
  }
  if(!output) {
    std::cerr << "Cannot write to \"" << argv[2] << "\"!\n";
    return EXIT_FAILURE;
  }

  std::string line;
  std::getline(input, line);
  smatch results;
  while(input && ! regex_match(line, tface_re)) // search line "TFACE"
  {
    std::getline(input, line);
  }
  std::getline(input, line);
  while(input && regex_match(line, results, vertex_re)) {
    vertices.push_back(boost::make_tuple(results[vertex_x],
					 results[vertex_y],
					 results[vertex_z]));
    std::getline(input, line);
  }
  while(input && regex_match(line, results, triangle_re)) {
    std::stringstream s;
    int i, j, k;
    s << results[1] << " " << results[2] << " " << results[3];
    s >> i >> j >> k;
    faces.push_back(boost::make_tuple(i, j, k));
    std::getline(input, line);
  }
  if(!input || !regex_match(line, end_re))
    return incorrect_input("premature end of file!");

  output << "OFF " << vertices.size() << " " << faces.size() << " " << "0\n";
  for(Vertices::const_iterator vit = vertices.begin(), vend = vertices.end();
      vit != vend; ++vit)
    output << boost::get<0>(*vit) << " "
	   << boost::get<1>(*vit) << " "
	   << boost::get<2>(*vit) << "\n";
  for(Faces::const_iterator fit = faces.begin(), fend = faces.end();
      fit != fend; ++fit)
    output << "3 " << boost::get<0>(*fit)
	   << " " << boost::get<1>(*fit)
	   << " " << boost::get<2>(*fit) << "\n";
  if(output)
    return EXIT_SUCCESS;
  else
    return EXIT_FAILURE;
};
开发者ID:ArcEarth,项目名称:cgal,代码行数:75,代码来源:GOCAD_xyz_to_OFF.cpp


示例13:

CoordSystem3 Quadrangle3::getCoordinateSystem(const Vertices& vertices) const {
	auto newX = (vertices.at(1) - vertices.at(0)).ort();
	auto newY = (vertices.at(3) - vertices.at(0)).ort();
	auto newZ = (newX & newY).ort();
	return {vertices.at(0), newX, newY, newZ};
}
开发者ID:frostoov,项目名称:treklibs,代码行数:6,代码来源:quadrangle3.cpp


示例14: if

/// Read an event and fill a vector of MCParticles.
Geant4EventReader::EventReaderStatus
Geant4EventReaderGuineaPig::readParticles(int /* event_number */, 
                                          Vertices& vertices,
                                          vector<Particle*>& particles)   {


  // if no number of particles per event set, we will read the whole file
  if ( m_part_num < 0 )
    m_part_num = std::numeric_limits<int>::max() ; 



  // First check the input file status
  if ( m_input.eof() )   {
    return EVENT_READER_EOF;
  }
  else if ( !m_input.good() )   {
    return EVENT_READER_IO_ERROR;
  }

  double Energy;
  double betaX;
  double betaY;
  double betaZ;
  double posX;
  double posY;
  double posZ;

  //  Loop over particles
  for( int counter = 0; counter < m_part_num ; ++counter ){      

    // need to check for NAN as not all ifstream implementations can handle this directly
    std::string lineStr ;
    std::getline( m_input, lineStr ) ;

    if( m_input.eof() ) {
      if( counter==0 ) { 
        return EVENT_READER_IO_ERROR ;  // reading first particle of event failed 
      } else{
        ++m_currEvent;
        return EVENT_READER_OK ; // simply EOF
      }
    }

    std::transform(lineStr.begin(), lineStr.end(), lineStr.begin(), ::tolower);
    if( lineStr.find("nan") != std::string::npos){

      printout(WARNING,"EventReader","### Read line with 'nan' entries - particle will be ignored  ! " ) ;
      continue ;
    }
    std::stringstream m_input_str( lineStr ) ;

    m_input_str  >> Energy
		 >> betaX   >> betaY >> betaZ
		 >> posX    >> posY  >> posZ ;

    
    //    printf(" ------- %e  %e  %e  %e  %e  %e  %e \n", Energy,betaX, betaY,betaZ,posX,posY,posZ ) ;

    //
    //  Create a MCParticle and fill it from stdhep info
    Particle* p = new Particle(counter);
    PropertyMask status(p->status);

    //  PDGID: If Energy positive (negative) particle is electron (positron)
    p->pdgID  = 11;
    p->charge = -1;
    if(Energy < 0.0) {
      p->pdgID = -11;
      p->charge = +1;
    }

    //  Momentum vector
    p->pex = p->psx = betaX*TMath::Abs(Energy)*GeV;
    p->pey = p->psy = betaY*TMath::Abs(Energy)*GeV;
    p->pez = p->psz = betaZ*TMath::Abs(Energy)*GeV;

    //  Mass
    p->mass = 0.0005109989461*GeV;
    //


    //  Creation time (note the units [1/c_light])
    // ( not information in GuineaPig files )
    p->time       = 0.0;
    p->properTime = 0.0;


    //  Vertex
    p->vsx = posX*nm;
    p->vsy = posY*nm;
    p->vsz = posZ*nm;

    Vertex* vtx = new Vertex ;
    vtx->x = p->vsx ;
    vtx->y = p->vsy ;
    vtx->z = p->vsz ;
    vtx->time = p->time ;

//.........这里部分代码省略.........
开发者ID:AIDASoft,项目名称:DD4hep,代码行数:101,代码来源:Geant4EventReaderGuineaPig.cpp


示例15: degree_sort

	void degree_sort(Vertices &R){
		set_degrees(R); sort(R.begin(), R.end(), desc_degree);
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:3,代码来源:MaximumClique.cpp


示例16: main


//.........这里部分代码省略.........
            EdgeProperties
        > Graph;
        //typedef boost::graph_traits<Graph>::vertex_iterator VertexIter;
        //typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
        //typedef boost::property_map<Graph, boost::vertex_index_t>::type IndexMap;

        // Fix number of vertices, and add one edge at a time.
        int num_vertices = 3;
        Graph g(num_vertices);
        boost::add_edge(0, 1, g);
        boost::add_edge(1, 2, g);

        // Fix number of vertices, and add one edge array.
        {
            int num_vertices = 3;
            typedef std::pair<int, int> Edge;
            std::vector<Edge> edges{
                {0, 1},
                {1, 2},
            };
            Graph g(edges.data(), edges.data() + edges.size(), num_vertices);
        }

        // It is also possible to add vertices with #add_vertex.

        //#vertices
        {
            // Number of vertices.
            boost::graph_traits<Graph>::vertices_size_type num_vertices = boost::num_vertices(g);
            assert(num_vertices == 3u);

            //#vertices() Returns a begin() end() vertex iterator pair so we know where to stop.
            {
                typedef std::vector<boost::graph_traits<Graph>::vertex_descriptor> Vertices;
                Vertices vertices;
                vertices.reserve(num_vertices);
                //IndexMap
                auto index = boost::get(boost::vertex_index, g);
                //std::pair<vertex_iter, vertex_iter> vp
                for (auto vp = boost::vertices(g); vp.first != vp.second; ++vp.first) {
                    // Vertex
                    auto v = *vp.first;
                    vertices.push_back(index[v]);
                }
                assert((vertices == Vertices{0, 1, 2}));
            }

            // The iterator is a ranom access iterator.
            {
                auto index = boost::get(boost::vertex_index, g);
                auto it = boost::vertices(g).first;
                assert(index[it[2]] == 2);
                assert(index[it[1]] == 1);
            }
        }

        //#edges
        {
            // It seems that only AdjencyMatrix has a method to get an edge given two vertices:
            //edge(u, v, g)
        }
    }

    //#source is also a global function: <http://stackoverflow.com/questions/16114616/why-is-boost-graph-librarys-source-a-global-function>

    //#dijikstra
开发者ID:cirosantilli,项目名称:cpp-cheat,代码行数:67,代码来源:graph.cpp


示例17: cut2

	void cut2(const Vertices &A, Vertices &B){
		for(int i = 0; i < (int)A.size() - 1; i++)
			if(e[A.back().i][A[i].i])
				B.push_back(A[i].i);
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:5,代码来源:MaximumClique.cpp


示例18: set_degrees

	void set_degrees(Vertices &v){
		for(int i = 0, j; i < (int)v.size(); i++)
			for(v[i].d = j = 0; j < int(v.size()); j++)
				v[i].d += e[v[i].i][v[j].i];
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:5,代码来源:MaximumClique.cpp


示例19: init_colors

	void init_colors(Vertices &v){
		const int max_degree = v[0].d;
		for(int i = 0; i < (int)v.size(); i++) v[i].d = min(i, max_degree) + 1;
	}
开发者ID:FTRobbin,项目名称:Dreadnought-Standard-Code-Library,代码行数:4,代码来源:MaximumClique.cpp


示例20: reRender

void reRender(REid render)
{
  // initialize variables
  Render* r = (Render*)render;
  if(r == null)
    return; //error
  if(r->scene == null)
    return; //error
  GlRasScene& scene = *(GlRasScene*)r->scene;

  //todo: scene.background.render()
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  // temporary: render everything in white
  glColor3f(1.0f, 1.0f, 1.0f);

  // set up window
  {
    glViewport(0, 0, 800, 600);
  }

  //todo: set up camera
  {
    glMatrixMode(GL_PROJECTION);
    if(r->camera)
    //if(false)
    {
      Matrix4 transformation;
      r->camera->getTransform(transformation);
      glLoadMatrixf(transformation);
    }
    else
    {
      //TEMP:
      glLoadIdentity();
      gluPerspective(45.0f, 800.0f/600.0f,0.1f,100.0f); // todo: replace with custom function
      //todo: set backplane to world max and front plane to geom closest to camera??? (This will allow best z-buffer precision)

      /*float rotX, rotY, rotZ;
      camera.rotation.get(rotX, rotY, rotZ);
      glRotatef(-rotX*180.0/PI, 1.0f, 0.0f, 0.0f);
      glRotatef(-rotY*180.0/PI, 0.0f, 1.0f, 0.0f);
      glRotatef(-rotZ*180.0/PI, 0.0f, 0.0f, 1.0f);*/

      /*float locX, locY, locZ;
      camera.location.get(locX, locY, locZ);
      glTranslatef(-locX, -locY, -locZ);*/
      glTranslatef(0.0f, -0.0f, -20.0f);
    }
  }

  // todo: set up world
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

  //// render test quad
  //{
  //  glColor3f(0.5f, 0.5f, 0.5f);
  //  glBegin(GL_QUADS);
  //    glVertex3f(-1.0f, 1.0f, 0.0f);
  //    glVertex3f( 1.0f, 1.0f, 0.0f);
  //    glVertex3f( 1.0f,-1.0f, 0.0f);
  //    glVertex3f(-1.0f,-1.0f, 0.0f);
  //  glEnd();
  //  glColor3f(1.0f, 1.0f, 1.0f);
  //}

  // render scene
  {
    // enable render options
    glEnable(GL_DEPTH_TEST);

    // clear background & zbuffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  }

  // old: precalculate ambient occlusion data (now done in endscene)
  for(list<Geometry*>::iterator i = scene.geometry.begin(); i != scene.geometry.end(); ++i)
  {
    // initialize variables
    if((*i)->type != MESH_GEOMETRY)
      continue;
    Mesh& geometry          = *(Mesh*)*i;
    Points* points          = geometry.points;
    Vertices* vertices      = geometry.vertices;
    Edges* edges            = geometry.edges;
    Primitives* primitives  = geometry.primitives;
    Map* map                = geometry.map;

    if(vertices == null)
      continue; // error - no vertices

    // retrieve attributes
    GlRasElements* locationElements = null,
                 * indexElements = null,
                 * normAreaElements = null;
    GlStream* vertexStream = null,
            * indexStream = null,
            * normAreaStream = null;

//.........这里部分代码省略.........
开发者ID:rehno-lindeque,项目名称:osi-glrasre,代码行数:101,代码来源:api.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VfsPath类代码示例发布时间:2022-05-31
下一篇:
C++ VerticalLayout类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap