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


C++ VertexList类代码示例

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


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

示例1: m_id

Mesh::Mesh(VertexList const& vertices)
: m_id(afth::UUID::v4())
{
    size_t size = vertices.size() * 3;
    float* arr = new float[size];
    VertexList::const_iterator it = vertices.begin(), end = vertices.end();
    for (size_t i = 0; it != end; ++it, i += 3)
    {
        std::memcpy(arr + i, (*it).coordinates().arr().data(), 3 * sizeof(float));
    }

    //glGenVertexArrays(1, &m_vertexArray);
    //glGenBuffers(1, &m_vertexBuffer);

    //glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer);
    //glBufferData(GL_ARRAY_BUFFER, size * sizeof(float), arr, GL_STATIC_DRAW);

    //glBindVertexArray(m_vertexArray);

    //GLint positionIndex = glGetAttribLocation(glProgramUniform1, "position");
    //glEnableVertexAttribArray(0);
    //glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);

    //glBindBuffer(GL_ARRAY_BUFFER, 0);
    //glBindVertexArray(0);

    delete [] arr;
}
开发者ID:lyell,项目名称:aegis,代码行数:28,代码来源:agta_mesh.cpp

示例2: buildTopCap

void Cylinder::buildTopCap(VertexList& vertices, IndexList& indices)
{
	UINT baseIndex = (UINT)vertices.size();

	// Duplicate cap vertices because the texture coordinates and normals differ.
	float y = 0.5f*mHeight;

	// vertices of ring
	float dTheta = 2.0f*PI/mNumSlices;
	for(UINT i = 0; i <= mNumSlices; ++i)
	{
		float x = mTopRadius*cosf(i*dTheta);
		float z = mTopRadius*sinf(i*dTheta);

		// Map [-1,1]-->[0,1] for planar texture coordinates.
		float u = +0.5f*x/mTopRadius + 0.5f;
		float v = -0.5f*z/mTopRadius + 0.5f;

		vertices.push_back( Vertex(x, y, z, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, u, v) );
	}

	// cap center vertex
	vertices.push_back( Vertex(0.0f, y, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.5f, 0.5f) );

	// index of center vertex
	UINT centerIndex = (UINT)vertices.size()-1;

	for(UINT i = 0; i < mNumSlices; ++i)
	{
		indices.push_back(centerIndex);
		indices.push_back(baseIndex + i+1);
		indices.push_back(baseIndex + i);
	}
}
开发者ID:benloong,项目名称:Deferred-Rendering-Demo,代码行数:34,代码来源:Cylinder.cpp

示例3: ClosestPointPoly

Vector ClosestPointPoly ( Vector const & V, VertexList const & vertices )
{
	if(vertices.size() == 0) return V;

	if(vertices.size() == 1) return vertices[0];

	if(vertices.size() == 2) return ClosestPointSeg( V, Segment3d(vertices[0],vertices[1]) );

	// ----------

	Vector closest = ClosestPointTri( V, Triangle3d(vertices[0],vertices[1],vertices[2]) );

	int nTris = vertices.size() - 2;

	for(int i = 1; i < nTris; i++)
	{
		Triangle3d tri( vertices[0], vertices[i+1], vertices[i+2] );

		Vector temp = ClosestPointTri(V,tri);

		closest = selectCloser(V,closest,temp);
	}

	return closest;
}
开发者ID:Mesagoppinmypants,项目名称:NGELinux,代码行数:25,代码来源:Distance3d.cpp

示例4: init

void ConeRenderer::init(ShaderProgram* prog)
{
	if(_vbo) {
	    _vbo->bind();
	    _vbo->setPointer();
	    return;
	}
	_vbo = make_resource<VBO>(getResourceManager(),
	                          "P");
	_vbo->overrideIndex(getResourceManager()->geometryCache()->getIndexForAttribute("P"));
	_vbo->bind();
	prog->bindAttributeLocation(_vbo.get());

	VertexList verts;

    //cone
    verts.push_back(glm::vec3(0, 1, 0));
    for(int i=0; i <= _segments; i++) {
        float pni = 2 * PI * float(i) / _segments;
        verts.push_back(glm::vec3(sin(pni), 0, cos(pni)));
    }
    //disc
    verts.push_back(glm::vec3());
    for(int i=_segments; i >= 0; i--) {
        float pni = 2 * PI * float(i) / _segments;
        verts.push_back(glm::vec3(sin(pni), 0, cos(pni)));
    }

    _vbo->data(verts);
    _vbo->setPointer();
}
开发者ID:frigge,项目名称:MindTree,代码行数:31,代码来源:primitive_renderer.cpp

示例5: insertSites

void IncrementalDelaunayTriangulator::insertSites(const VertexList& vertices)
{
	for (VertexList::const_iterator x=vertices.begin(); 
			x != vertices.end(); ++x) {
		insertSite(*x);
	}
}
开发者ID:drownedout,项目名称:datamap,代码行数:7,代码来源:IncrementalDelaunayTriangulator.cpp

示例6: cvZero

void Reprojector::projectCloud( IplImage *image )
{
	cvZero( image );

	if( !this->projVertices.size() )
		return;

	VertexList tempList;
	tempList.resize( this->projVertices.size() );

	transform3DTo2D( this->projVertices.size(), &( this->projVertices[0] ), &( tempList[0] ), this->cxProjector, this->cyProjector, this->focalLengthProjector, false );

	unsigned short val = 0;
	unsigned short *tempPtr = NULL;

	for( VertexList::const_iterator it = tempList.begin(); it != tempList.end(); ++it )
	{
		unsigned int x = it->X;
		unsigned int y = it->Y;
		unsigned short depth = -( it->Z );

		if( x >= image->width || y >= image->height )
			continue;

		val = depth;
		tempPtr = (unsigned short*)( image->imageData ) + x + y * image->width;

		if( !( *tempPtr ) || *tempPtr > val )	//z-test
			*tempPtr = val;
	}
}
开发者ID:cadet,项目名称:hydraNI,代码行数:31,代码来源:FrameProcessor.cpp

示例7: CreateDrawable

Drawable RenderingEngine::CreateDrawable(const ParametricSurface& surface, int flags) const
{
    // Create the VBO for the vertices.
    VertexList vertices;
    surface.GenerateVertices(vertices, flags);
    GLuint vertexBuffer;
    glGenBuffers(1, &vertexBuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
    glBufferData(GL_ARRAY_BUFFER,
                 vertices.size() * sizeof(vertices[0]),
                 &vertices[0],
                 GL_STATIC_DRAW);
    
    // Create a new VBO for the indices if needed.
    int indexCount = surface.GetTriangleIndexCount();
    GLuint indexBuffer;
    IndexList indices(indexCount);
    surface.GenerateTriangleIndices(indices);
    glGenBuffers(1, &indexBuffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER,
                 indexCount * sizeof(GLushort),
                 &indices[0],
                 GL_STATIC_DRAW);
    
    // Fill in a descriptive struct and return it.
    Drawable drawable;
    drawable.IndexBuffer = indexBuffer;
    drawable.VertexBuffer = vertexBuffer;
    drawable.IndexCount = indexCount;
    drawable.Flags = flags;
    return drawable;
}
开发者ID:Thomas-Xu,项目名称:iPhone3D,代码行数:33,代码来源:RenderingEngine.ES2.cpp

示例8: print_out

void print_out (VertexList V)
{
   // print out
   for (VertexList::iterator i = V.begin(); i != V.end(); ++i)
   {
      cout << i->first << " spe:" << i->second.spe << " pi:" << i->second.pi << endl;
   }
}
开发者ID:palmerc,项目名称:lab,代码行数:8,代码来源:main.cpp

示例9: CreatePath

iGraphic* CreatePath(float fromx,float fromy, float fromz, 
		   float tox,float toy, float toz){
    VertexList<Vertex>* vertexList = 
     (VertexList<Vertex>*)CreateVertexList<Vertex>(LINE_LIST, 1);
        vertexList->add(Vertex(Vector((float)fromx, (float)fromy, (float)fromz),Vector( 0, 1, 0)));
		vertexList->add(Vertex(Vector((float)tox, (float)toy, (float)toz),Vector( 0, 1, 0)));
	return vertexList;
}
开发者ID:cathyatseneca,项目名称:gam671-astar,代码行数:8,代码来源:Graphic.cpp

示例10: VertexListToBufP

	void VertexListToBufP(std::vector<float> &dst,const VertexList &list){
		dst.clear();
		dst.reserve(list.size()*3);
		for(VertexList::const_iterator i = list.begin();i!=list.end();i++){
			dst.push_back((*i).pos.x);
			dst.push_back((*i).pos.y);
			dst.push_back((*i).pos.z);
		}
	}
开发者ID:omochi,项目名称:gluttest,代码行数:9,代码来源:Vertex.cpp

示例11: copyPointListToVertexList

void copyPointListToVertexList(const PointList& in,VertexList& out)
{
    out.reserve(in.size());
    for(PointList::const_iterator itr=in.begin();
        itr!=in.end();
        ++itr)
    {
        out.push_back(itr->second);
    }
}
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:10,代码来源:ShadowVolumeOccluder.cpp

示例12: copyVertexListToPointList

// copyVertexListToPointList a vector for Vec3 into a vector of Point's.
void copyVertexListToPointList(const VertexList& in,PointList& out)
{
    out.reserve(in.size());
    for(VertexList::const_iterator itr=in.begin();
        itr!=in.end();
        ++itr)
    {
        out.push_back(Point(0,*itr));
    }
}
开发者ID:BlitzMaxModules,项目名称:osg.mod,代码行数:11,代码来源:ShadowVolumeOccluder.cpp

示例13: findNeighbors

void PolyMesh::findNeighbors( osg::Vec3 p, VertexList& vlist )
{
    for ( EdgeMap::iterator itr=_edges.begin(); itr!=_edges.end(); ++itr )
    {
        if ( equivalent(itr->first.first,p) )
            vlist.push_back( itr->first.second );
        else if ( equivalent(itr->first.second,p) )
            vlist.push_back( itr->first.first );
    }
}
开发者ID:kapecp,项目名称:osgmodeling,代码行数:10,代码来源:PolyMesh.cpp

示例14: numberOfTriangles

VertexList<Vertex>* Mesh::build(bool normalize) {
  if (normalize) normalizeSize(buildScale);
  VertexList<Vertex>* vertexList = (VertexList<Vertex>*) 
    CreateVertexList<Vertex>(TRIANGLE_LIST, numberOfTriangles());
  for (unsigned i=0; i<faces.size(); ++i)
    addFace(vertexList, faces[i]);
  vertexList->calcAABB();
  cachedMesh = vertexList;
  return vertexList;
}
开发者ID:d10p,项目名称:gundam-style,代码行数:10,代码来源:Mesh.cpp

示例15: Subdivide

//***************************************************************************************
// Name: Subdivide
// Desc: Function subdivides every input triangle into four triangles of equal area.
//***************************************************************************************
void Subdivide(VertexList& vertices, IndexList& indices)
{
	VertexList vin = vertices;
	IndexList  iin = indices;

	vertices.resize(0);
	indices.resize(0);

	//       v1
	//       *
	//      / \
	//     /   \
	//  m0*-----*m1
	//   / \   / \
	//  /   \ /   \
	// *-----*-----*
	// v0    m2     v2

	UINT numTris = (UINT)iin.size()/3;
	for(UINT i = 0; i < numTris; ++i)
	{
		D3DXVECTOR3 v0 = vin[ iin[i*3+0] ];
		D3DXVECTOR3 v1 = vin[ iin[i*3+1] ];
		D3DXVECTOR3 v2 = vin[ iin[i*3+2] ];

		D3DXVECTOR3 m0 = 0.5f*(v0 + v1);
		D3DXVECTOR3 m1 = 0.5f*(v1 + v2);
		D3DXVECTOR3 m2 = 0.5f*(v0 + v2);

		vertices.push_back(v0); // 0
		vertices.push_back(v1); // 1
		vertices.push_back(v2); // 2
		vertices.push_back(m0); // 3
		vertices.push_back(m1); // 4
		vertices.push_back(m2); // 5
 
		indices.push_back(i*6+0);
		indices.push_back(i*6+3);
		indices.push_back(i*6+5);

		indices.push_back(i*6+3);
		indices.push_back(i*6+4);
		indices.push_back(i*6+5);

		indices.push_back(i*6+5);
		indices.push_back(i*6+4);
		indices.push_back(i*6+2);

		indices.push_back(i*6+3);
		indices.push_back(i*6+1);
		indices.push_back(i*6+4);
	}
}
开发者ID:softwarekid,项目名称:DXFunctionDraw,代码行数:57,代码来源:d3dUtil.cpp


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