當前位置: 首頁>>代碼示例>>C++>>正文


C++ Billboard::SetColorUVoffset方法代碼示例

本文整理匯總了C++中Billboard::SetColorUVoffset方法的典型用法代碼示例。如果您正苦於以下問題:C++ Billboard::SetColorUVoffset方法的具體用法?C++ Billboard::SetColorUVoffset怎麽用?C++ Billboard::SetColorUVoffset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Billboard的用法示例。


在下文中一共展示了Billboard::SetColorUVoffset方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: lightFinder

NavLights::NavLights(SceneGraph::Model *model, float period)
: m_time(0.f)
, m_period(period)
, m_enabled(false)
{
	PROFILE_SCOPED();
	assert(g_initted);

	Graphics::Renderer *renderer = model->GetRenderer();

	using SceneGraph::Node;
	using SceneGraph::MatrixTransform;
	using SceneGraph::Billboard;

	//This will find all matrix transforms meant for navlights.
	SceneGraph::FindNodeVisitor lightFinder(SceneGraph::FindNodeVisitor::MATCH_NAME_STARTSWITH, "navlight_");
	model->GetRoot()->Accept(lightFinder);
	const std::vector<Node*> &results = lightFinder.GetResults();

	//attach light billboards
	for (unsigned int i=0; i < results.size(); i++) {
		MatrixTransform *mt = dynamic_cast<MatrixTransform*>(results.at(i));
		assert(mt);
		Billboard *bblight = new Billboard(model, renderer, BILLBOARD_SIZE);
		Uint32 group = 0;
		Uint8 mask  = 0xff; //always on
		Uint8 color = NAVLIGHT_BLUE;

		if (mt->GetName().substr(9, 3) == "red") {
			mask  = 0x0f;
			color = NAVLIGHT_RED;
		} else if (mt->GetName().substr(9, 5) == "green") {
			mask  = 0xf0;
			color = NAVLIGHT_GREEN;
		} else if (mt->GetName().substr(9, 3) == "pad") {
			//group by pad number
			// due to this problem: http://stackoverflow.com/questions/15825254/why-is-scanfhhu-char-overwriting-other-variables-when-they-are-local
			// where MSVC is still using a C89 compiler the format identifer %hhu is not recognised. Therefore I've switched to Uint32 for group.
			PiVerify(1 == sscanf(mt->GetName().c_str(), "navlight_pad%u", &group));
			mask  = 0xf0;
		}
		bblight->SetColorUVoffset(get_color(color));

		GroupLightsVecIter glit = std::find_if(m_groupLights.begin(), m_groupLights.end(), GroupMatch(group));
		if(glit == m_groupLights.end()) {
			// didn't find group, create a new one
			m_groupLights.push_back(TGroupLights(group));
			// now use it
			glit = (m_groupLights.end() - 1);
		}

		assert(glit != m_groupLights.end());
		glit->m_lights.push_back(LightBulb(group, mask, color, bblight));
		mt->SetNodeMask(SceneGraph::NODE_TRANSPARENT);
		mt->AddChild(bblight);
	}
}
開發者ID:Action-Committee,項目名稱:pioneer,代碼行數:57,代碼來源:NavLights.cpp


注:本文中的Billboard::SetColorUVoffset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。