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


C++ VertexLayout::AddAttribute方法代码示例

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


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

示例1: Initialise

//----------------------------------------------------------------------
bool FontManager::Initialise(const glm::ivec2& screenResolution)
{
  this->screenResolution = screenResolution;

  if (!effect.Load("assets\\effects\\fonteffect.glsl", "RenderFont"))
  {
    LOG("did not load font rendering effect\n");
    return false;
  }
  // Since the screen resolution does not change at runtime, set this now...
  effect.ScreenSize->Set(glm::vec2(screenResolution));
  effect.GlyphTexture->Set(GlyphTextureSlot);

  sampler = boost::make_shared<Sampler2D>();
  sampler->SetMagFilter(GL_LINEAR);
  sampler->SetMinFilter(GL_LINEAR);
  sampler->SetWrapS(GL_CLAMP_TO_EDGE);
  sampler->SetWrapT(GL_CLAMP_TO_EDGE);

  VertexLayout vertexLayout;
  vertexLayout.AddAttribute(vertexAttribute);

  // Initialise vertex buffers for dynamic update...
  for (size_t i = 0; i < bufferCount; ++i)
  {
    boost::shared_ptr<VertexBuffer> vertexBuffer(new VertexBuffer());
    vertexBuffer->Initialise(vertexLayout, VerticesInBuffer, GL_DYNAMIC_DRAW);
    geometry[i].Initialise(vertexBuffer);
  }

  return true;
}
开发者ID:geoff-wode,项目名称:bfm,代码行数:33,代码来源:font.cpp

示例2: OnAttach

	bool Impl_SkyBox::OnAttach()
	{
		m_pRD = m_pManager->alloc_object<RenderData>();

		
		VertexLayout layout;
		layout.AddAttribute(G_FORMAT_R32G32B32_FLOAT);
		
		float size = 1.0f;
		int nVerts = 36;

		math::Vector3 verts[] = 
		{
			math::Vector3(-size, size, -size),
			math::Vector3(size, -size, -size),
			math::Vector3(size, size, -size),

			math::Vector3(-size, size, -size),
			math::Vector3(-size, -size, -size),
			math::Vector3(size, -size, -size),

			math::Vector3(-size, size, size),
			math::Vector3(size, size, size),
			math::Vector3(size, -size, size),

			math::Vector3(-size, size, size),
			math::Vector3(size, -size, size),
			math::Vector3(-size, -size, size),


			math::Vector3(-size, size, size),
			math::Vector3(size, size, -size),
			math::Vector3(size, size, size),

			math::Vector3(-size, size, size),
			math::Vector3(-size, size, -size),
			math::Vector3(size, size, -size),


			math::Vector3(-size, -size, size),
			math::Vector3(size, -size, size),
			math::Vector3(size, -size, -size),

			math::Vector3(-size, -size, size),
			math::Vector3(size, -size, -size),
			math::Vector3(-size, -size, -size),


			math::Vector3(-size, size, size),
			math::Vector3(-size, -size, -size),
			math::Vector3(-size, size, -size),

			math::Vector3(-size, size, size),
			math::Vector3(-size, -size, size),
			math::Vector3(-size, -size, -size),


			math::Vector3(size, size, size),
			math::Vector3(size, size, -size),
			math::Vector3(size, -size, -size),

			math::Vector3(size, size, size),
			math::Vector3(size, -size, -size),
			math::Vector3(size, -size, size),

		};

		m_pRD->geometry = m_pManager->GetRenderManager()->CreateGeometryData();

		m_pRD->geometry->BeginGeometry(PT_TRIANGLE_LIST);
		{
			m_pRD->geometry->AllocVertexBuffer(sizeof(math::Vector3) * 36, verts, false, layout);
		}
		m_pRD->geometry->EndGeometry();

		m_pRD->base_vertex = 0;
		m_pRD->index_count = 0;
		m_pRD->start_index = 0;
		m_pRD->vertex_count = 36;
		m_pRD->world_matrix.MakeIdentity();

		m_pRD->material = m_pManager->GetRenderManager()->CreateMaterialFromFile("./assets/standard/material/skybox.material");

		m_hFrustumCull = m_pManager->AddEventHandler(EV_FRUSTUM_CULL, boost::bind(&Impl_SkyBox::on_event_frustum_cull, this, _1));


		m_pTex = m_pManager->GetRenderManager()->CreateTextureFromFile("./assets/standard/texture/001.dds");

		MaterialParameterPtr pParam = m_pRD->material->GetParameterByName("sky_map");
		
		pParam->SetParameterTexture(m_pTex);
		
		m_pWorldPos = m_pRD->material->GetParameterByName("world_pos");
		return true;
	}
开发者ID:johndragon,项目名称:ld3d,代码行数:95,代码来源:Impl_SkyBox.cpp


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