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


C++ VertexData函数代码示例

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


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

示例1: QVector2D

void VertexDataHelper::BuildPathVertexData(APath aPath, QOpenGLBuffer* linesVbo, QOpenGLVertexArrayObject* linesVao, QVector3D vecCol)
{
	if (aPath.points.size() == 0) { return; }
	bool isInit = false;
	if (!linesVao->isCreated())
	{
		linesVao->create();
		linesVao->bind();
		isInit = true;
	}
	size_t path_length = aPath.points.size();
	QVector<VertexData> data;
	for (uint a = 0; a < path_length - 1; a++)
	{
		//if (a < _points.size() - 1) { lines.push_back(ALine(_points[a], _points[a + 1])); }
		//else { lines.push_back(ALine(_points[a], _points[0])); }
		data.append(VertexData(QVector3D(aPath.points[a].x, aPath.points[a].y, 0), QVector2D(), vecCol));
		data.append(VertexData(QVector3D(aPath.points[a + 1].x, aPath.points[a + 1].y, 0), QVector2D(), vecCol));
	}
	if (aPath.isClosed)
	{
		data.append(VertexData(QVector3D(aPath.points[path_length - 1].x, aPath.points[path_length - 1].y, 0), QVector2D(), vecCol));
		data.append(VertexData(QVector3D(aPath.points[0].x, aPath.points[0].y, 0), QVector2D(), vecCol));
	}
	BuildVboWithColor(data, linesVbo);
	if (isInit) { linesVao->release(); }
}
开发者ID:azer89,项目名称:IllustratorSimplePlugin,代码行数:27,代码来源:VertexDataHelper.cpp

示例2: initializeOpenGLFunctions

Scene::Scene()
{
    initializeOpenGLFunctions();

    this->setSkyBox(NULL);
    m_root.setName ("root");
    this->setRenderType (DEFERRED_SHADING);
    m_mainRenderTarget = new RenderTarget();
    m_mainRenderTarget->setType (RenderTarget::TargetType::ON_SCREEN);
    bloom_fbo1 = new RenderBuffer(1024,768);
    bloom_fbo2 = new RenderBuffer(1024,768);
    bloom_fbo3 = new RenderBuffer(1024,768);
    TMesh * mesh = new TMesh();
    mesh->pushVertex (VertexData(QVector3D(-1,-1,0),QVector2D(0,0)));
    mesh->pushVertex (VertexData(QVector3D(1,-1,0),QVector2D(1,0)));
    mesh->pushVertex (VertexData(QVector3D(1,1,0),QVector2D(1,1)));
    mesh->pushVertex (VertexData(QVector3D(-1,1,0),QVector2D(0,1)));
    mesh->pushIndex (0);
    mesh->pushIndex (1);
    mesh->pushIndex (2);
    mesh->pushIndex (0);
    mesh->pushIndex (2);
    mesh->pushIndex (3);
    mesh->setMaterial (MaterialPool::getInstance ()->createOrGetMaterial ("default"));
    mesh->finishWithoutNormal ();
    m_quad = new Entity();
    m_quad->addMesh (mesh);

    m_guiCamera = new Camera();
    m_guiCamera->setOrtho (0,1024,0,768,0.01,1000);
    m_guiCamera->setPos (QVector3D(0,0,0));

    m_renderType = DEFERRED_SHADING;
}
开发者ID:HeeroNight,项目名称:Cube-Engine,代码行数:34,代码来源:scene.cpp

示例3: VertexData

    void WireBoundingBox::_initWireBoundingBox()
    {
        mRenderOp.vertexData = OGRE_NEW VertexData();

        mRenderOp.indexData = 0;
        mRenderOp.vertexData->vertexCount = 24; 
        mRenderOp.vertexData->vertexStart = 0; 
        mRenderOp.operationType = RenderOperation::OT_LINE_LIST; 
        mRenderOp.useIndexes = false; 
        mRenderOp.useGlobalInstancingVertexBufferIsAvailable = false;

        VertexDeclaration* decl = mRenderOp.vertexData->vertexDeclaration;
        VertexBufferBinding* bind = mRenderOp.vertexData->vertexBufferBinding;

        decl->addElement(POSITION_BINDING, 0, VET_FLOAT3, VES_POSITION);


        HardwareVertexBufferSharedPtr vbuf = 
            HardwareBufferManager::getSingleton().createVertexBuffer(
                decl->getVertexSize(POSITION_BINDING),
                mRenderOp.vertexData->vertexCount,
                HardwareBuffer::HBU_STATIC_WRITE_ONLY);

        // Bind buffer
        bind->setBinding(POSITION_BINDING, vbuf);

        // set basic white material
        this->setMaterial("BaseWhiteNoLighting");


        
    }
开发者ID:digimatic,项目名称:ogre,代码行数:32,代码来源:OgreWireBoundingBox.cpp

示例4: setSize

	//-------------------------------------------------------------------------------//
	void OverlayPanelElement::initialise(const String& texName, float width, float height, float left, float top)
	{
		mTexture = TextureMgr::getSingletonPtr()->getByName(texName);
		setSize(width, height);
		setPosition(left, top);
		mIsVisible = true;

		if(!mIsInitialised)
		{
			mRenderData.vertexData = TITAN_NEW VertexData();
			VertexDeclaration* decl = mRenderData.vertexData->vertexDecl;
			decl->addElement(0,0, VET_FLOAT3, VES_POSITION);

			mRenderData.vertexData->vertexStart = 0;
			mRenderData.vertexData->vertexCount = 4;

			VertexBufferPtr vbuf = HardwareBufferMgr::getSingletonPtr()->createVertexBuffer(decl->getVertexSize(0), mRenderData.vertexData->vertexCount,
				HardwareBuffer::HBU_STATIC_WRITE_ONLY, false);
			mRenderData.vertexData->vertexBufferBinding->setBinding(0, vbuf);

			mRenderData.useIndex = false;
			mRenderData.operationType = OT_TRIANGLE_STRIP;

			mIsInitialised = true;
		}

		notifyGeometryOld();
	}
开发者ID:cty41,项目名称:Titan,代码行数:29,代码来源:TiOverlayPanelElement.cpp

示例5: mMaxElementsPerChain

	//-----------------------------------------------------------------------
	BillboardChain::BillboardChain(const String& name, size_t maxElements,
		size_t numberOfChains, bool useTextureCoords, bool useColours, bool dynamic)
		:MovableObject(name),
		mMaxElementsPerChain(maxElements),
		mChainCount(numberOfChains),
		mUseTexCoords(useTextureCoords),
		mUseVertexColour(useColours),
		mDynamic(dynamic),
		mVertexDeclDirty(true),
		mBuffersNeedRecreating(true),
		mBoundsDirty(true),
		mIndexContentDirty(true),
		mRadius(0.0f),
		mTexCoordDir(TCD_U),
		mFaceCamera(true),
		mNormalBase(Vector3::UNIT_X)
	{
		mVertexData = OGRE_NEW VertexData();
		mIndexData = OGRE_NEW IndexData();

		mOtherTexCoordRange[0] = 0.0f;
		mOtherTexCoordRange[1] = 1.0f;

		setupChainContainers();

		mVertexData->vertexStart = 0;
		// index data set up later
		// set basic white material
		//this->setMaterialName("BaseWhiteNoLighting");

	}
开发者ID:dryadf68116,项目名称:vuforia-gamekit-integration,代码行数:32,代码来源:OgreBillboardChain.cpp

示例6: VertexData

    //---------------------------------------------------------------------
    void PanelOverlayElement::initialise(void)
    {
        bool init = !mInitialised;

        OverlayContainer::initialise();
        if (init)
        {
            // Setup render op in advance
            mRenderOp.vertexData = OGRE_NEW VertexData();
            // Vertex declaration: 1 position, add texcoords later depending on #layers
            // Create as separate buffers so we can lock & discard separately
            VertexDeclaration* decl = mRenderOp.vertexData->vertexDeclaration;
            decl->addElement(POSITION_BINDING, 0, VET_FLOAT3, VES_POSITION);

            // Basic vertex data
            mRenderOp.vertexData->vertexStart = 0;
            mRenderOp.vertexData->vertexCount = 4;
            // No indexes & issue as a strip
            mRenderOp.useIndexes = false;
            mRenderOp.operationType = RenderOperation::OT_TRIANGLE_STRIP;
            mRenderOp.useGlobalInstancingVertexBufferIsAvailable = false;

            mInitialised = true;

            _restoreManualHardwareResources();
        }
    }
开发者ID:OGRECave,项目名称:ogre,代码行数:28,代码来源:OgrePanelOverlayElement.cpp

示例7: VertexData

    void TextAreaOverlayElement::initialise(void)
    {
        if (!mInitialised)
        {
            // Set up the render op
            // Combine positions and texture coords since they tend to change together
            // since character sizes are different
            mRenderOp.vertexData = OGRE_NEW VertexData();
            VertexDeclaration* decl = mRenderOp.vertexData->vertexDeclaration;
            size_t offset = 0;
            // Positions
            decl->addElement(POS_TEX_BINDING, offset, VET_FLOAT3, VES_POSITION);
            offset += VertexElement::getTypeSize(VET_FLOAT3);
            // Texcoords
            decl->addElement(POS_TEX_BINDING, offset, VET_FLOAT2, VES_TEXTURE_COORDINATES, 0);
            // Colours - store these in a separate buffer because they change less often
            decl->addElement(COLOUR_BINDING, 0, VET_COLOUR, VES_DIFFUSE);

            mRenderOp.operationType = RenderOperation::OT_TRIANGLE_LIST;
            mRenderOp.useIndexes = false;
            mRenderOp.vertexData->vertexStart = 0;
            mRenderOp.useGlobalInstancingVertexBufferIsAvailable = false;
            // Vertex buffer will be created in checkMemoryAllocation
            mRenderOp.srcRenderable = this;
            checkMemoryAllocation( DEFAULT_INITIAL_CHARS );

            mInitialised = true;
        }

    }
开发者ID:whztt07,项目名称:ogre3d,代码行数:30,代码来源:OgreTextAreaOverlayElement.cpp

示例8: add_vertex

 /** 
  * \brief Creates a vertex containing the vertex data and returns the id
  * of the new vertex id. Vertex ids are assigned in increasing order with
  * the first vertex having id 0.
  * Vertices are placed in atom vid % num_atoms
  */
 vertex_id_type add_vertex(const VertexData& vdata = VertexData()) {
   vertex_id_type v = numv.inc_ret_last();
   uint16_t owner = v % atoms.size();
   atoms[owner]->add_vertex(v, owner, vdata);
   atoms[owner]->set_owner(v, owner);
   return v;
 }
开发者ID:greeness,项目名称:graphlab_CMU,代码行数:13,代码来源:disk_graph.hpp

示例9: VertexData

    //---------------------------------------------------------------------
    void PanelOverlayElement::initialise(void)
    {
		bool init = !mInitialised;

		OverlayContainer::initialise();
		if (init)
		{
			// Setup render op in advance
			mRenderOp.vertexData = OGRE_NEW VertexData();
			// Vertex declaration: 1 position, add texcoords later depending on #layers
			// Create as separate buffers so we can lock & discard separately
			VertexDeclaration* decl = mRenderOp.vertexData->vertexDeclaration;
			decl->addElement(POSITION_BINDING, 0, VET_FLOAT3, VES_POSITION);

			// Basic vertex data
			mRenderOp.vertexData->vertexStart = 0;
			mRenderOp.vertexData->vertexCount = 4;

			// Vertex buffer #1
			HardwareVertexBufferSharedPtr vbuf =
				HardwareBufferManager::getSingleton().createVertexBuffer(
				decl->getVertexSize(POSITION_BINDING), mRenderOp.vertexData->vertexCount,
				HardwareBuffer::HBU_STATIC_WRITE_ONLY// mostly static except during resizing
				);
			// Bind buffer
			mRenderOp.vertexData->vertexBufferBinding->setBinding(POSITION_BINDING, vbuf);

			// No indexes & issue as a strip
			mRenderOp.useIndexes = false;
			mRenderOp.operationType = RenderOperation::OT_TRIANGLE_STRIP;

			mInitialised = true;
		}
    }
开发者ID:jjiezheng,项目名称:pap_full,代码行数:35,代码来源:OgrePanelOverlayElement.cpp

示例10: VertexData

    //---------------------------------------------------------------------
    void BorderPanelOverlayElement::initialise(void)
    {
        bool init = !mInitialised;

        // init mRenderOp2 before calling superclass, as virtual _restoreManualHardwareResources would be called within
        if (init)
        {
            // Setup render op in advance
            mRenderOp2.vertexData = OGRE_NEW VertexData();
            mRenderOp2.vertexData->vertexCount = 4 * 8; // 8 cells, can't necessarily share vertices cos
                                                        // texcoords may differ
            mRenderOp2.vertexData->vertexStart = 0;

            // Vertex declaration
            VertexDeclaration* decl = mRenderOp2.vertexData->vertexDeclaration;
            // Position and texture coords each have their own buffers to allow
            // each to be edited separately with the discard flag
            decl->addElement(POSITION_BINDING, 0, VET_FLOAT3, VES_POSITION);
            decl->addElement(TEXCOORD_BINDING, 0, VET_FLOAT2, VES_TEXTURE_COORDINATES, 0);

            // Index data
            mRenderOp2.operationType = RenderOperation::OT_TRIANGLE_LIST;
            mRenderOp2.useIndexes = true;
            mRenderOp2.indexData = OGRE_NEW IndexData();
            mRenderOp2.indexData->indexCount = 8 * 6;
            mRenderOp2.indexData->indexStart = 0;
            mRenderOp2.useGlobalInstancingVertexBufferIsAvailable = false;

            // Create sub-object for rendering border
            mBorderRenderable = OGRE_NEW BorderRenderable(this);
        }

        // superclass will handle the interior panel area and call _restoreManualHardwareResources
        PanelOverlayElement::initialise();
    }
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:36,代码来源:OgreBorderPanelOverlayElement.cpp

示例11: VertexData

/// add vertex, associate given Octnode with the vertex, and return index
unsigned int GLData::addVertex(GLVertex v, Octnode* n) {
    // add vertex with empty polygon-list.
    unsigned int idx = vertexArray[workIndex].size();
    vertexArray[workIndex].append(v);
    vertexDataArray.append( VertexData() );
    vertexDataArray[idx].node = n;
    assert( vertexArray[workIndex].size() == vertexDataArray.size() );
    return idx; // return index of newly appended vertex
}
开发者ID:jCandlish,项目名称:cutsim,代码行数:10,代码来源:gldata.cpp

示例12: VertexData

void GUIFrame::setRenderRect()
{
    m_mesh->clear();
	unsigned short indices[] = {
         0,1,2,  0,2,3,
    };
    auto w = m_contentSize.x;
    auto h = m_contentSize.y;
    VertexData vertices[] = {
        // front
		VertexData(vec3(0, 0,  -1.0f), m_color),  // v0
        VertexData(vec3( w,  0,  -1.0f), m_color), // v1
        VertexData(vec3( w,  h,  -1.0f), m_color),  // v2
        VertexData(vec3( 0, h,  -1.0f), m_color)// v3
    };
    m_mesh->addVertices(vertices,sizeof(vertices)/sizeof(VertexData));
    m_mesh->addIndices(indices,sizeof(indices)/sizeof(unsigned short));
    m_mesh->finish();
}
开发者ID:tangziwen,项目名称:Cube-Engine,代码行数:19,代码来源:GUIFrame.cpp

示例13: VertexData

	//---------------------------------------------------------------------
	void PrefabFactory::createPlane(Mesh* mesh)
	{
		SubMesh* sub = mesh->createSubMesh();
		float vertices[32] = {
			-100, -100, 0,	// pos
			0,0,1,			// normal
			0,1,			// texcoord
			100, -100, 0,
			0,0,1,
			1,1,
			100,  100, 0,
			0,0,1,
			1,0,
			-100,  100, 0 ,
			0,0,1,
			0,0 
		};
		mesh->sharedVertexData = OGRE_NEW VertexData();
		mesh->sharedVertexData->vertexCount = 4;
		VertexDeclaration* decl = mesh->sharedVertexData->vertexDeclaration;
		VertexBufferBinding* bind = mesh->sharedVertexData->vertexBufferBinding;

		size_t offset = 0;
		decl->addElement(0, offset, VET_FLOAT3, VES_POSITION);
		offset += VertexElement::getTypeSize(VET_FLOAT3);
		decl->addElement(0, offset, VET_FLOAT3, VES_NORMAL);
		offset += VertexElement::getTypeSize(VET_FLOAT3);
		decl->addElement(0, offset, VET_FLOAT2, VES_TEXTURE_COORDINATES, 0);
		offset += VertexElement::getTypeSize(VET_FLOAT2);

		HardwareVertexBufferSharedPtr vbuf = 
			HardwareBufferManager::getSingleton().createVertexBuffer(
			offset, 4, HardwareBuffer::HBU_STATIC_WRITE_ONLY);
		bind->setBinding(0, vbuf);

		vbuf->writeData(0, vbuf->getSizeInBytes(), vertices, true);

		sub->useSharedVertices = true;
		HardwareIndexBufferSharedPtr ibuf = HardwareBufferManager::getSingleton().
			createIndexBuffer(
			HardwareIndexBuffer::IT_16BIT, 
			6, 
			HardwareBuffer::HBU_STATIC_WRITE_ONLY);

		unsigned short faces[6] = {0,1,2,
			0,2,3 };
		sub->indexData->indexBuffer = ibuf;
		sub->indexData->indexCount = 6;
		sub->indexData->indexStart =0;
		ibuf->writeData(0, ibuf->getSizeInBytes(), faces, true);

		mesh->_setBounds(AxisAlignedBox(-100,-100,0,100,100,0), true);
		mesh->_setBoundingSphereRadius(Math::Sqrt(100*100+100*100));
	}
开发者ID:terminus510,项目名称:OgreBulletTest,代码行数:55,代码来源:OgrePrefabFactory.cpp

示例14: QVector2D

void GLWidget::PrepareLinesVBO(std::vector<ALine> lines, QOpenGLBuffer* linesVbo, QOpenGLVertexArrayObject* linesVao, QVector3D vecCol)
{    
    bool isInit = false;
    if(!linesVao->isCreated())
    {
        linesVao->create();
        linesVao->bind();
        isInit = true;
    }

    QVector<VertexData> data;
    for(uint a = 0; a < lines.size(); a++)
    {
        data.append(VertexData(QVector3D(lines[a].XA, lines[a].YA,  0), QVector2D(), vecCol));
        data.append(VertexData(QVector3D(lines[a].XB, lines[a].YB,  0), QVector2D(), vecCol));
    }

    linesVbo->create();
    linesVbo->bind();
    linesVbo->allocate(data.data(), data.size() * sizeof(VertexData));

    quintptr offset = 0;

    _shaderProgram->enableAttributeArray(_vertexLocation);
    _shaderProgram->setAttributeBuffer(_vertexLocation, GL_FLOAT, 0, 3, sizeof(VertexData));

    offset += sizeof(QVector3D);
    offset += sizeof(QVector2D);

    _shaderProgram->enableAttributeArray(_colorLocation);
    _shaderProgram->setAttributeBuffer(_colorLocation, GL_FLOAT, offset, 3, sizeof(VertexData));

    if(isInit)
    {
        linesVao->release();
    }
}
开发者ID:azer89,项目名称:CelticKnots,代码行数:37,代码来源:GLWidget.cpp

示例15: VertexData

std::shared_ptr<TextField> TextField::create(std::shared_ptr<Skin> skin, std::shared_ptr<WrappableText> default_text, std::shared_ptr<WrappableText> typed_text, glm::vec4 background_color, float padding, float screen_width, float screen_height, float x_pos, float y_pos, float width, float height, const unsigned int layer) {
    auto vertex_data = VertexData();
    vertex_data.addVec(VertexData::DATA_TYPE::GEOMETRY, generateRect(screen_width, screen_height, 0, 0, width, height));
    vertex_data.addVec(VertexData::DATA_TYPE::TEX_COORDS, basisTexCoords());

    default_text->setSize(width - (2.0 * padding), height - (2.0 * padding));
    typed_text->setSize(width - (2.0 * padding), height - (2.0 * padding));
    typed_text->setText("");

    auto field = std::make_shared<TextField>(default_text, typed_text, vertex_data, skin, layer);
    field->setColor(background_color);
    field->setAnchorPoint(glm::vec2(x_pos, y_pos));
    field->setWidth(width);
    field->setHeight(height);
    field->setTextPadding(padding);

    return field;
}
开发者ID:sainteos,项目名称:project-spero,代码行数:18,代码来源:text_field.cpp


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