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


C++ OverlayContainer::setMaterialName方法代码示例

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


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

示例1: multiplayer

void HUD::multiplayer()
{
	OverlayManager& overlayManager = OverlayManager::getSingleton();

	// Create a panel
	OverlayContainer* panel = static_cast<OverlayContainer*>(
	overlayManager.createOverlayElement("Panel", "MultiplayerPanel"));
	panel->setMetricsMode(Ogre::GMM_PIXELS);
	panel->setPosition(20, 20);
	panel->setDimensions(200, 250);
	panel->setMaterialName("PanelAchtergrondImage"); // Optional background material

	// Create a text area
	m_textMessages = static_cast<TextAreaOverlayElement*>(
	overlayManager.createOverlayElement("TextArea", "MultiplayerTextArea"));

	m_textMessages->setMetricsMode(Ogre::GMM_PIXELS);
	m_textMessages->setPosition(10, 50);
	m_textMessages->setDimensions(150, 100);
	m_textMessages->setCaption("GoClient 0.1");
	m_textMessages->setCharHeight(16);
	m_textMessages->setFontName("ArialFont");
	m_textMessages->setColourBottom(ColourValue(0.6, 0.6, 0.6));
	m_textMessages->setColourTop(ColourValue(1, 1, 1));

	// Create an overlay, and add the panel
	m_overlay = overlayManager.create("MultiplayerOverlay");
	m_overlay->add2D(panel);

	// Add the text area to the panel
	panel->addChild(m_textMessages);

	// Show the overlay
	m_overlay->show();
}
开发者ID:cheesecakenl,项目名称:git-c-plusplus,代码行数:35,代码来源:HUD.cpp

示例2: createContainer

    //-----------------------------------------------------------------------
    OverlayContainer* Profiler::createContainer() {

        OverlayContainer* container = (OverlayContainer*) 
			OverlayManager::getSingleton().createOverlayElement(
				"BorderPanel", "profiler");
        container->setMetricsMode(GMM_PIXELS);
        container->setMaterialName("Core/StatsBlockCenter");
        container->setHeight(mGuiHeight);
        container->setWidth(mGuiWidth * 2 + 15);
        container->setParameter("border_size", "1 1 1 1");
        container->setParameter("border_material", "Core/StatsBlockBorder");
        container->setParameter("border_topleft_uv", "0.0000 1.0000 0.0039 0.9961");
        container->setParameter("border_top_uv", "0.0039 1.0000 0.9961 0.9961");
        container->setParameter("border_topright_uv", "0.9961 1.0000 1.0000 0.9961");
        container->setParameter("border_left_uv","0.0000 0.9961 0.0039 0.0039");
        container->setParameter("border_right_uv","0.9961 0.9961 1.0000 0.0039");
        container->setParameter("border_bottomleft_uv","0.0000 0.0039 0.0039 0.0000");
        container->setParameter("border_bottom_uv","0.0039 0.0039 0.9961 0.0000");
        container->setParameter("border_bottomright_uv","0.9961 0.0039 1.0000 0.0000");
        container->setLeft(5);
        container->setTop(5);

        return container;

    }
开发者ID:Anti-Mage,项目名称:ogre,代码行数:26,代码来源:OgreProfiler.cpp

示例3: addTextureDebugOverlay

void GraphicsController::addTextureDebugOverlay(const Ogre::String& texname, size_t i)
{
    using namespace Ogre;
    Overlay* debugOverlay = OverlayManager::getSingleton().getByName("PRJZ/DebugOverlay");

	MaterialPtr debugMat = MaterialManager::getSingleton().getByName("PRJZ/BasicTexture", "PROJECT_ZOMBIE");
	if(debugMat.isNull())
		OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "PRJZ/BasicTexture material was not found.", "GraphicsController::addTextureDebugOverlay");
    debugMat->getTechnique(0)->getPass(0)->setLightingEnabled(false);
    TextureUnitState *t = debugMat->getTechnique(0)->getPass(0)->createTextureUnitState(texname);
    t->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);

    Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton().getByName(texname);
    Ogre::Real tWidth = tex->getWidth();
    Ogre::Real tHeight = tex->getHeight();

    //ratio 
    Ogre::Real ratio = tHeight / tWidth;
    OverlayContainer* debugPanel = (OverlayContainer*)
        (OverlayManager::getSingleton().createOverlayElement("Panel", "Ogre/DebugTexPanel" + StringConverter::toString(i)));
    debugPanel->_setPosition(0.0, 0.0);
    debugPanel->_setDimensions(0.5f, 0.5f * ratio);
    debugPanel->setMaterialName(debugMat->getName());
    debugOverlay->add2D(debugPanel);
}
开发者ID:beyzend,项目名称:OgrePRJZSample,代码行数:25,代码来源:GraphicsController.cpp

示例4: createScene

void Splash::createScene()
{
	log("[Loading] Creating the splash screen...");
	// Loading picture
	overlayManager = &OverlayManager::getSingleton();
	overlay = overlayManager->create("LoadingOverlay");
	((MaterialPtr)MaterialManager::getSingleton().create("LoadingMaterial","splash"))->getTechnique(0)->getPass(0)->createTextureUnitState("loading.png");
	OverlayContainer* panel = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","LoadingPanel"));
	panel->setMaterialName("LoadingMaterial");
	panel->setDimensions(1,0.96f);

	// Progess bar
	OverlayContainer* progressBar = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","ProgressBar"));
	progressBar->setDimensions(1,0.04f);
	progressBar->setPosition(0,0.96f);
	MaterialPtr progressBGMat = MaterialManager::getSingleton().create("progressBG","splash");
	progressBGMat->getTechnique(0)->getPass(0)->createTextureUnitState()->setColourOperationEx(LBX_SOURCE1,LBS_MANUAL,LBS_CURRENT,ColourValue(0.9f, 0.9f, 0.9f));;
	MaterialPtr progressFGMat = MaterialManager::getSingleton().create("progressFG","splash");
	progressFGMat->getTechnique(0)->getPass(0)->createTextureUnitState()->setColourOperationEx(LBX_SOURCE1,LBS_MANUAL,LBS_CURRENT,ColourValue(0.23f, 0.88f, 0.5f));;
	progressBG = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","ProgressBarBG"));
	progressBG->setMaterialName("progressBG");
	progressBG->setDimensions(1,1);
	progressFG = static_cast<OverlayContainer*>(overlayManager->createOverlayElement("Panel","ProgressBarFG"));
	progressFG->setMaterialName("progressFG");
	progressFG->setDimensions(0,1);

	// Loading text
	FontManager::getSingleton().getByName("BlueHighway")->load(); // HACK: Workaround for bug #324 in Ogre
	progressText = static_cast<TextAreaOverlayElement*>(overlayManager->createOverlayElement("TextArea", "text"));
	progressText->setMetricsMode(GuiMetricsMode::GMM_RELATIVE);
	progressText->setLeft(0.01f);
	progressText->setTop(0.01f);
	progressText->setHorizontalAlignment(GHA_LEFT);
	progressText->setVerticalAlignment(GVA_TOP);
	progressText->setFontName("BlueHighway");
	progressText->setCharHeight(0.03f);
	progressText->setColour(Ogre::ColourValue(0,0,0));

	progressBar->addChild(progressBG);
	progressBar->addChild(progressFG);
	progressBar->addChild(progressText);
	overlay->add2D(panel);
	overlay->add2D(progressBar);
	overlay->show();
}
开发者ID:Nuke928,项目名称:PonyKart,代码行数:45,代码来源:Splash.cpp

示例5: updateShadowTechnique

int ShadowManager::updateShadowTechnique()
{
    float scoef = 0.5;
    gEnv->sceneManager->setShadowColour(Ogre::ColourValue(0.563 + scoef, 0.578 + scoef, 0.625 + scoef));
    gEnv->sceneManager->setShowDebugShadows(false);

    RoR::App::GfxShadowType type = RoR::App::GetGfxShadowType();

    if (type == RoR::App::GFX_SHADOW_TYPE_TEXTURE)
    {
        gEnv->sceneManager->setShadowFarDistance(RoR::App::GetGfxSightRange());
        processTextureShadows();
    }
    else if (type == RoR::App::GFX_SHADOW_TYPE_PSSM)
    {
        processPSSM();
        if (gEnv->sceneManager->getShowDebugShadows())
        {
            // add the overlay elements to show the shadow maps:
            // init overlay elements
            OverlayManager& mgr = Ogre::OverlayManager::getSingleton();
            Overlay* overlay = mgr.create("DebugOverlay");

            for (int i = 0; i < PSSM_Shadows.ShadowsTextureNum; ++i)
            {
                TexturePtr tex = gEnv->sceneManager->getShadowTexture(i);

                // Set up a debug panel to display the shadow
                MaterialPtr debugMat = MaterialManager::getSingleton().create("Ogre/DebugTexture" + StringConverter::toString(i), ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
                debugMat->getTechnique(0)->getPass(0)->setLightingEnabled(false);
                TextureUnitState* t = debugMat->getTechnique(0)->getPass(0)->createTextureUnitState(tex->getName());
                t->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);

                OverlayContainer* debugPanel = (OverlayContainer*)(OverlayManager::getSingleton().createOverlayElement("Panel", "Ogre/DebugTexPanel" + StringConverter::toString(i)));
                debugPanel->_setPosition(0.8, i * 0.25);
                debugPanel->_setDimensions(0.2, 0.24);
                debugPanel->setMaterialName(debugMat->getName());
                debugPanel->setEnabled(true);
                overlay->add2D(debugPanel);
                overlay->show();
            }
        }
    }
    return 0;
}
开发者ID:fidoj,项目名称:rigs-of-rods,代码行数:45,代码来源:ShadowManager.cpp

示例6: changeShadows


//.........这里部分代码省略.........
		}
		
		mSceneMgr->setShadowTextureSelfShadow(bDepth ? true : false);  //-?
		mSceneMgr->setShadowCasterRenderBackFaces((bDepth && !bSoft) ? true : false);

		mSceneMgr->setShadowTextureCasterMaterial(bDepth ? "shadowcaster_default" : "");
	}

	mSceneMgr->setShadowColour(Ogre::ColourValue(0,0,0,1));


#if 0  /// TEST overlays
	//  add overlay elements to show shadow or terrain maps
	OverlayManager& mgr = OverlayManager::getSingleton();
	Overlay* overlay = mgr.getByName("DebugOverlay");
	if (overlay)
		mgr.destroy(overlay);
	overlay = mgr.create("DebugOverlay");
	TexturePtr tex;

	#if 0  /// shadow
	for (int i = 0; i < pSet->shadow_count; ++i)
	{	
		TexturePtr tex = mSceneMgr->getShadowTexture(i);
	#else  /// terrain
	for (int i = 0; i < 2/*pSet->shadow_count*/; ++i)
	{	
		TexturePtr tex = !terrain ? mSceneMgr->getShadowTexture(i) :
			i==0 ? terrain->getCompositeMap() : terrain->getLightmap();
	#endif
		// Set up a debug panel to display the shadow
		if (MaterialManager::getSingleton().resourceExists("Ogre/DebugTexture" + toStr(i)))
			MaterialManager::getSingleton().remove("Ogre/DebugTexture" + toStr(i));
		MaterialPtr debugMat = MaterialManager::getSingleton().create(
			"Ogre/DebugTexture" + toStr(i), rgDef);
			
		debugMat->getTechnique(0)->getPass(0)->setLightingEnabled(false);
		TextureUnitState *t = debugMat->getTechnique(0)->getPass(0)->createTextureUnitState(tex->getName());
		t->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);

		OverlayContainer* debugPanel;
		
		// destroy container if exists
		try
		{
			if (debugPanel = static_cast<OverlayContainer*>(mgr.getOverlayElement("Ogre/DebugTexPanel" + toStr(i))))
				mgr.destroyOverlayElement(debugPanel);
		}
		catch (Ogre::Exception&) {}
		
		debugPanel = (OverlayContainer*)
			(OverlayManager::getSingleton().createOverlayElement("Panel", "Ogre/DebugTexPanel" + StringConverter::toString(i)));
		debugPanel->_setPosition(0.8, i*0.31);  //aspect.. 0.25 0.24
		debugPanel->_setDimensions(0.2, 0.3);
		debugPanel->setMaterialName(debugMat->getName());
		debugPanel->show();
		overlay->add2D(debugPanel);
		overlay->show();
	}
#endif
	
	UpdPSSMMaterials();


	//  rebuild static geom after materials change
	if (vdrTrack)
	{
		vdrTrack->destroy();
		vdrTrack->build();
	}

	LogO(String("::: Time Shadows: ") + fToStr(ti.getMilliseconds(),0,3) + " ms");
}


/// . . . . . . . . 
void CScene::UpdPSSMMaterials()
{
	if (app->pSet->shadow_type == Sh_None)  return;
	
	if (app->pSet->shadow_count == 1)  // 1 tex
	{
		float dist = app->pSet->shadow_dist;
		sh::Vector3* splits = new sh::Vector3(dist, 0,0);  //dist*2, dist*3);
		sh::Factory::getInstance().setSharedParameter("pssmSplitPoints", sh::makeProperty<sh::Vector3>(splits));
		return;
	}
	
	if (!mPSSMSetup.get())  return;
	
	//--  pssm params
	PSSMShadowCameraSetup* pssmSetup = static_cast<PSSMShadowCameraSetup*>(mPSSMSetup.get());
	const PSSMShadowCameraSetup::SplitPointList& sp = pssmSetup->getSplitPoints();
	const int last = sp.size()-1;

	sh::Vector3* splits = new sh::Vector3(
		sp[std::min(1,last)], sp[std::min(2,last)], sp[std::min(3,last)] );

	sh::Factory::getInstance().setSharedParameter("pssmSplitPoints", sh::makeProperty<sh::Vector3>(splits));
}
开发者ID:ddxxpp,项目名称:stuntrally,代码行数:101,代码来源:Shadows.cpp


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