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


C++ Shader::BindVertexChannel方法代码示例

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


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

示例1: InitializeGraphics

bool GameController::InitializeGraphics(const std::string &basePath)
{
	Log::LogT("Initializing Graphics");

	uint32_t screenWidth = TaxiGame::Environment::GetInstance()->GetScreenWidth();
	uint32_t screenHeight = TaxiGame::Environment::GetInstance()->GetScreenHeight();

	m_content = new Content(m_graphicsEngine);
	InterfaceProvider::m_content = m_content;
	m_content->LoadTextures(basePath + "data/gui/");
	m_content->LoadTextures(basePath + "data/textures/");
	m_content->LoadShaders(basePath + "data/shaders/");
	m_content->LoadModels(basePath + "data/models/");
	m_content->LoadAnimations(basePath + "data/animations/");
	m_content->LoadMaterials(basePath + "data/materials/");
	m_content->CombineResources();

	DrawingRoutines::Initialize();
	DrawingRoutines::SetProjectionMatrix(sm::Matrix::PerspectiveMatrix(45.0f, static_cast<float>(screenWidth) / static_cast<float>(screenHeight), 0.1f, 1000.0f));

	Shader *shader = m_content->Get<Shader>("sprite");

	SpriteBatch *spriteBatch = new SpriteBatch(shader, sm::Matrix::Ortho2DMatrix(0, screenWidth, screenHeight, 0));

	SpritesMap *spritesMap = new SpritesMap();
	if (!spritesMap->LoadFromFile(basePath + "data/gui/SpritesMap.xml", m_content))
		return false;

	InterfaceProvider::m_graphicsEngine = m_graphicsEngine;
	InterfaceProvider::m_spriteBatch = spriteBatch;
	InterfaceProvider::m_spritesMap = spritesMap;
	InterfaceProvider::m_fonts["digital_bold_24"] = FontRenderer::LoadFromFile((basePath + "data/fonts/digital_bold_24.xml").c_str(), spriteBatch);
	InterfaceProvider::m_fonts["fenix_18"] = FontRenderer::LoadFromFile((basePath + "data/fonts/fenix_18.xml").c_str(), spriteBatch);
	InterfaceProvider::m_fonts["fenix_26"] = FontRenderer::LoadFromFile((basePath + "data/fonts/fenix_26.xml").c_str(), spriteBatch);

	debugSphere = m_content->Get<Model>("debug_sphere");
	assert(debugSphere != NULL);

	Shader *spriteShader = m_content->Get<Shader>("Sprite2");
	assert(spriteShader != NULL);
	spriteShader->BindVertexChannel(0, "a_position");
	spriteShader->LinkProgram();

	Sprite::Initialize(spriteShader);

	Control::SetSpriteBatch(spriteBatch);
	
	return true;
}
开发者ID:asmCode,项目名称:taxibynight,代码行数:49,代码来源:GameController.cpp


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