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


C++ Billboard類代碼示例

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


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

示例1: m_time

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

示例2: mNode

BillboardSprite::BillboardSprite(SceneNode* node, BillboardSet* bs, int row, int col, int unitWidth, int unitHeight)
	: mNode(node), mBillboards(bs), mRow(row), mCol(col), mUnitWidth(unitWidth), mUnitHeight(unitHeight),
	mIsFinished(false)
{
	mWidth = row * unitWidth;
	mHeight = col * unitHeight;
	Billboard* b = mBillboards->getBillboard(0);
	if (b)
		b->setTexcoordRect(0, 0, 1 / (float)mRow, 1 / (float)mCol);
}
開發者ID:kidsang,項目名稱:GlassTD2,代碼行數:10,代碼來源:BillboardSprite.cpp

示例3: addBillboard

bool addBillboard(AddBillboard::Request &req, AddBillboard::Response &res)
{
  ROS_INFO("ADDING BILLBOARD");

  InteractiveMarker tmp;
  if ((imServer->get(req.name, tmp)) || (primitives.count(req.name) != 0))
  {
    ROS_ERROR("Object with that name already exists! Please remove it first.");
    return false;
  }

  Billboard *billboard = new Billboard(imServer, req.frame_id, req.name);
  billboard->setType(req.type);
  billboard->setPoseType(req.pose_type);
  billboard->setPose(req.pose);
  billboard->setScale(req.scale);
  billboard->setDescription(req.description);
  billboard->setDirection(req.direction);
  billboard->setVelocity(req.velocity);
  billboard->insert();
  imServer->applyChanges();

  primitives.insert(make_pair(req.name, billboard));

  ROS_INFO("..... DONE");
  return true;
}
開發者ID:ankitasikdar,項目名稱:srs_public,代碼行數:27,代碼來源:service_server.cpp

示例4: checkCellType

void Monster::harmCheck(float timeSinceLastFrame)
{
	
	/// 先檢查地形,更新怪物信息
	checkCellType();
	checkMonsterIsChange();
	
	mCheckMethod->bulletHarmCheck(mMonsterState->getBulletState(), mBulletHarmValue, mBulletHarmTime, mBlood, mSpeedPre, mSpeedCurrent, mSpeedTemp, timeSinceLastFrame);
	mCheckMethod->terrainHarmCheck(mMonsterState->getTerrainState(), mTerrainHarmvalue, mBlood, mSpeedPre, mSpeedCurrent, mSpeedTemp, timeSinceLastFrame);
	/// 狀態恢複
	stateRecover();
	
	/// 判斷是否死亡
	//mIsDead = mCheckMethod->checkIsDead(mBlood);
	if (!mIsDead && mCheckMethod->checkIsDead(mBlood))
	{
		mIsDead = true;
		Stage::playSound("../Media/Sound/dead.wav", false);
	}
	/// 根據地形改地圖
	changeMazeByTerrain(mMonsterState->getTerrainState());
	/// 改變頭頂血量顯示
	Billboard* health = mHealthHUD->getBillboard(0);
	float healthPer = mBlood / mMaxBlood;
	float healthLength = healthPer * mHealthHUD->getDefaultWidth();
	health->setDimensions(healthLength, mHealthHUD->getDefaultHeight());
	ColourValue maxHealthCol = ColourValue(0, 0.8f, 0);
	ColourValue minHealthCol = ColourValue(1, 0, 0);
	ColourValue currHealthCol = maxHealthCol * healthPer + minHealthCol * (1 - healthPer);
	health->setColour(currHealthCol);

	// 設置是否顯示著火和冰凍
	if (!mFrozenPs)
		mFrozenPs = (ParticleSystem*)mNode->getAttachedObject(mNode->getName() + "frozen");
	if (!mBurnPs)
		mBurnPs = (ParticleSystem*)mNode->getAttachedObject(mNode->getName() + "burn");
	if (mMonsterState->getBulletState() == "ice")
	{
		mBurnPs->setVisible(false);
		mFrozenPs->setVisible(true);
	}
	else if (mMonsterState->getBulletState() == "fire")
	{
		mBurnPs->setVisible(true);
		mFrozenPs->setVisible(false);
	}
	else
	{
		mBurnPs->setVisible(false);
		mFrozenPs->setVisible(false);
	}
}
開發者ID:kidsang,項目名稱:GlassTD2,代碼行數:52,代碼來源:Monster.cpp

示例5: execSyncV

void BillboardBase::execSyncV(      FieldContainer    &oFrom,
                                        ConstFieldMaskArg  whichField,
                                        AspectOffsetStore &oOffsets,
                                        ConstFieldMaskArg  syncMode,
                                  const UInt32             uiSyncInfo)
{
    Billboard *pThis = static_cast<Billboard *>(this);

    pThis->execSync(static_cast<Billboard *>(&oFrom),
                    whichField,
                    oOffsets,
                    syncMode,
                    uiSyncInfo);
}
開發者ID:marcusl,項目名稱:OpenSG,代碼行數:14,代碼來源:OSGBillboardBase.cpp

示例6: Init

void Billboard_Test::Init(Scene * scene)
{
	BillboardPtr ptr = scene->AddBillboard();
	Billboard * b = ptr.Get();
	b->SetSize(20.0f, 20.0f);
	b->UseDiffuseTexture(true);
	b->SetDiffuseTexture("assets/fire.png");

	StaticVert verts[4];

	verts[0].pos = Vector3(-1.0f, -1.0f, 0.0f);
	verts[1].pos = Vector3(-1.0f, 1.0f, 0.0f);
	verts[2].pos = Vector3(1.0f, 1.0f, 0.0f);
	verts[3].pos = Vector3(1.0f, -1.0f, 0.0f);

	verts[0].u = 0.0f;
	verts[0].v = 1.0f;

	verts[1].u = 0.0f;
	verts[1].v = 0.0f;

	verts[2].u = 1.0f;
	verts[2].v = 0.0f;

	verts[3].u = 1.0f;
	verts[3].v = 1.0f;
	unsigned int ind[] = { 0, 1, 3, 1, 3, 2 };

	ModelCreator<StaticVert> creator;
	creator.StartMesh();
	creator.SetTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
	creator.SetDrawMethod(DM_DRAW_INDEXED);
	creator.SetVertexBuffer(verts, sizeof(verts), sizeof(StaticVert));
	creator.SetIndexBuffer(ind, 6);
	creator.EndMesh();

	StaticEntityPtr triPtr = scene->AddStaticEntity(creator, "tri");
	StaticEntity * tri = triPtr.Get();
	tri->Illuminate(false);
	tri->SetPosition(50.0f, 0.0f, 0.0f);
	tri->SetScale(20.0f, 20.0f, 2.0f);

	Material * mat = tri->GetMaterial(0);
	mat->UseDiffuseMap(true);
	mat->SetDiffuseMap("assets/fire.png");
	mat->SetEmmisivePower(1);
}
開發者ID:dgi09,項目名稱:D3D,代碼行數:47,代碼來源:Billboard_Test.cpp

示例7: m_time

NavLights::NavLights(SceneGraph::Model *model, float period)
: m_time(0.f)
, m_period(period)
, m_enabled(false)
{
	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(renderer, matBlue, vector3f(0.f), BILLBOARD_SIZE);
		Uint8 group = 0;
		Uint8 mask  = 0xff; //always on
		Uint8 color = NAVLIGHT_BLUE;

		if (mt->GetName().substr(9, 3) == "red") {
			bblight->SetMaterial(matRed);
			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
			group = atoi(mt->GetName().substr(12, 1).c_str());
			mask  = 0xf0;
		}
		bblight->SetMaterial(get_material(color));

		m_lights.push_back(LightBulb(group, mask, color, bblight));
		mt->SetNodeMask(SceneGraph::NODE_TRANSPARENT);
		mt->AddChild(bblight);
	}
}
開發者ID:Loki999,項目名稱:pioneer,代碼行數:46,代碼來源:NavLights.cpp

示例8: createBillboard

void BillboardSetComponent::createBillboard(const PonykartParsers::BillboardBlock* const block)
{
	Billboard* bb = billboardSet->createBillboard(block->getVectorProperty("Position")); // make our billboard
	// set its color if it has one, and a rotation
	auto quatIt=block->getQuatTokens().find("colour");
	if (quatIt != block->getQuatTokens().end())
		bb->setColour(toColourValue(quatIt->second));
	bb->setRotation(Degree(block->getFloatProperty("Rotation", 0)));

	auto rectQIt = block->getQuatTokens().find("texturecoords");
	if (rectQIt != block->getQuatTokens().end())
		bb->setTexcoordRect(rectQIt->second.x, rectQIt->second.y, rectQIt->second.z, rectQIt->second.w);

	// It's best to not do this unless we really need to since it makes it less efficient
	auto fTokens = block->getFloatTokens();
	auto heightIt=fTokens.find("height"), widthIt=fTokens.find("width");
	if (heightIt!=fTokens.end() && widthIt!=fTokens.end())
		bb->setDimensions(widthIt->second, heightIt->second);
}
開發者ID:Nuke928,項目名稱:PonyKart,代碼行數:19,代碼來源:BillboardSetComponent.cpp

示例9: assert

void DemoState::Draw()
{

	Game::iterator it = Game::iterator("Camera");
	if (!it.seekName("DemoCam"))
	{
		assert(0);
	}
	GameObject* GO = it;
	((Camera*)GO)->Use();
	Game::instance()->DrawObjects();
	timer += DisplayManager::instance()->getDtSecs();
	if (timer < 0)
	{
		glDisable(GL_DEPTH_TEST);
		glDepthMask(GL_FALSE);
		glMatrixMode(GL_PROJECTION);
		GLfloat f[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
		glGetFloatv(GL_PROJECTION_MATRIX,f);
		glLoadIdentity();
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();

		Splash->UseThisTexture();
		Billboard b;
		b.Draw();
		Splash->UseNoTexture();
		glEnable(GL_DEPTH_TEST);
		glDepthMask(GL_TRUE);
		glMatrixMode(GL_PROJECTION);
		glLoadMatrixf(f);

	}
	if (timer > 1)
	{
		timer = -1;
	}



}
開發者ID:VileLasagna,項目名稱:WarpDrive,代碼行數:41,代碼來源:DemoState.cpp

示例10: billboardRenderEnter

OSG_USING_NAMESPACE

Action::ResultE ShadingCallbacks::billboardRenderEnter(CNodePtr &pNode, 
                                                       Action   *action)
{
    ShadingAction *pAct = dynamic_cast<ShadingAction *>(action         );
    Billboard     *pBB  = dynamic_cast<Billboard     *>(pNode.getCPtr());

    Matrix mMat;

//    cerr << "BB::render" << std::endl;

    pBB->calcMatrix(pAct, pAct->top_matrix(), mMat);

    pAct->push_matrix(mMat);

// !!! can't use visibles, as ToWorld gives garbage leading to wrong culling
//    pAct->selectVisibles();

    return Action::Continue;
}
開發者ID:mlimper,項目名稱:OpenSG1x,代碼行數:21,代碼來源:OSGShadingCallbacks.cpp

示例11: GetPos

bool FuelCell::Load(File*)
{
  Vec3f p = GetPos();
  float s = 5.0f; // TODO CONFIG

  m_aabb.Set(p.x - s, p.x + s, p.y - s, p.y + s, p.z - s, p.z + s); 
  FuelNode* sm = new FuelNode;
  sm->SetAABB(m_aabb);

  SetSceneNode(sm);

  Billboard* bb = new Billboard;
  Texture* tex = (Texture*)TheResourceManager::Instance()->GetRes("flare.png");
  bb->SetTexture(tex);
  bb->SetSize(30.0f); // TODO CONFIG
  bb->SetAABB(m_aabb);

  sm->AddChild(bb);

  return true;
}
開發者ID:jason-amju,項目名稱:amjulib,代碼行數:21,代碼來源:FuelCell.cpp

示例12: GetEditor

void EntityEx::Create( const String& entityName, const String& meshName, const String& mtlName )
{
	mpSceneMgr = GetEditor()->GetSceneManager();
	// create main model
	msEntityName = entityName;
	mpSceneNode = mpSceneMgr->getRootSceneNode()->createChildSceneNode();
	mpEntity = mpSceneMgr->createEntity( msEntityName, meshName );
	mpEntity->setUserAny( Ogre::Any(this) );
	mbVisible = false;

	mpTipNode = static_cast<SceneNode*>(mpSceneNode->createChild());
	msBillboardName = entityName + "bbinfo";
	mpTipBoard = mpSceneMgr->createBillboardSet(msBillboardName);
	Billboard* pTip = mpTipBoard->createBillboard(Vector3(0, 50, 0));
	pTip->setDimensions( 20.0f, 20.0f );

	if ( mtlName != "NULL" )
	{
		mpEntity->setMaterialName(mtlName);
		mpTipBoard->setMaterialName(mtlName);
	}
}
開發者ID:sdfwds4,項目名稱:ogre3d-game-editor,代碼行數:22,代碼來源:EntityEx.cpp

示例13: apply

void IntersectVisitor::apply(Billboard& node)
{
    if (!enterNode(node)) return;

    // IntersectVisitor doesn't have getEyeLocal(), can we use NodeVisitor::getEyePoint()?
    const Vec3& eye_local = getEyePoint();

    for(unsigned int i = 0; i < node.getNumDrawables(); i++ )
    {
        const Vec3& pos = node.getPosition(i);
        osg::ref_ptr<RefMatrix> billboard_matrix = new RefMatrix;
        node.computeMatrix(*billboard_matrix,eye_local,pos);

        pushMatrix(billboard_matrix.get(), osg::Transform::RELATIVE_RF);

        intersect(*node.getDrawable(i));

        popMatrix();

    }

    leaveNode();
}
開發者ID:151706061,項目名稱:OpenSceneGraph,代碼行數:23,代碼來源:IntersectVisitor.cpp

示例14: GetElapsedTime

//----------------------------------------------------------------------------
bool BillboardController::Update (double applicationTime)
{
	// module update
	if (!EffectableController::Update(applicationTime))
		return false;

	Billboard *billboard = DynamicCast<Billboard>(mObject);
	float elapsedTime = GetElapsedTime();

	if (IsPlaying())
	{
		if (!mBillboardObject)
		{
			mBillboardObject = new0 EffectObject();

			EffectableController::OnNewAEffectObject(mBillboardObject);
		}

		ModulesUpdateEffectObject(mBillboardObject);
		mBillboardObject->Update(billboard, elapsedTime);
	}
	else if (billboard->IsDoAlphaDisAfterStop())
	{
		if (mBillboardObject)
		{
			float curAlpha = mBillboardObject->Alpha;
			float speed = billboard->GetDoAlphaDisAfterStopSpeed();
			if (curAlpha > 0.0f)
			{
				curAlpha -= speed*elapsedTime;
				if (curAlpha < 0.0f)
					curAlpha = 0.0f;
				mBillboardObject->Alpha = curAlpha;
			}
		}
	}
	
	if (billboard->IsDynamic())
	{
		billboard->GenBuffers();
	}
	else 
	{
		if (!billboard->IsBufferEverGenerated())
		{
			billboard->GenBuffers();
		}
	}

	return true;
}
開發者ID:SylviaTanenbaum,項目名稱:3d-simulation-and-game,代碼行數:52,代碼來源:PX2BillboardController.cpp

示例15: onTimeStep

void Projectile::onTimeStep() {
	Object::onTimeStep();

	Billboard* billboard = billboards_->getBillboard(0);
	billboard->setRotation(billboard->getRotation() + Radian(0.2f));

	time_ += 0.1f;

	float width = billboard->getOwnWidth();
	float height = billboard->getOwnWidth();

	if (hit_) {
		if (target_) node_->setPosition(target_->getPosition());
		width = min(2.0f, width + 0.2f); // Grow the projectile
		height = min(2.0f, height + 0.2f);
	} else {
		width = 0.2f * sinf(time_) + 1.0f; // Make the projectile oscillate in size
		height = 0.2f * sinf(time_) + 1.0f;
	}

	billboard->setDimensions(width, height);
}
開發者ID:mfichman,項目名稱:warp,代碼行數:22,代碼來源:Projectile.cpp


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