本文整理汇总了C++中ogre::OverlayContainer::setMaterialName方法的典型用法代码示例。如果您正苦于以下问题:C++ OverlayContainer::setMaterialName方法的具体用法?C++ OverlayContainer::setMaterialName怎么用?C++ OverlayContainer::setMaterialName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::OverlayContainer
的用法示例。
在下文中一共展示了OverlayContainer::setMaterialName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showDialogue
void Menu::showDialogue(const std::string& first, const std::vector<std::string>& options)
{
Ogre::OverlayManager& om = Ogre::OverlayManager::getSingleton();
std::cout << "getByName(overlay)\n";
Ogre::Overlay* dialOverlay = om.getByName(cDialogueOverlay);
if (dialOverlay == NULL)
{
std::cout << "create(overlay)\n";
dialOverlay = om.create(cDialogueOverlay);
}
Ogre::OverlayContainer* dialCont = NULL;
std::cout << "getOE(Box)\n";
dialCont = static_cast<Ogre::OverlayContainer*> (om.getOverlayElement(cDialogueOverlay+"/Box"));
if (dialCont == NULL)
{
std::cout << "createOE(Box)\n";
dialCont = static_cast<Ogre::OverlayContainer*>
(om.createOverlayElement("Panel", cDialogueOverlay+"/Box"));
dialCont->setPosition(0.0, 0.75);
dialCont->setDimensions(1.0, 0.25);
dialCont->setMaterialName("Dusk/Dialogue/Black");
}
std::cout << "getOE(Box/First)\n";
Ogre::OverlayElement* dialElem;
dialElem = om.getOverlayElement(cDialogueOverlay+"/Box/First");
if (dialElem==NULL)
{
std::cout << "createOE(Box/First)\n";
dialElem = om.createOverlayElement("TextArea", cDialogueOverlay+"/Box/First");
dialElem->setDimensions(1.0, 0.0625);
dialElem->setPosition(0.0, 0.0);
dialElem->setMaterialName("Dusk/Dialogue/Element");
dialCont->addChild(dialElem);
}
dialElem->setCaption(first);
dialElem->show();
unsigned int elemCount = options.size();
if (elemCount > cMaxDialogueOptions)
{
elemCount = cMaxDialogueOptions;
}
killDialogueOverlayLines();
unsigned int i;
const float elemHeight = 0.8/(float)elemCount;
for (i=0; i<elemCount; i=i+1)
{
//dialElem = om.createOverlayElement("TextArea", cDialogueOverlay+"/Box/Line"+IntToString(i));
dialElem = om.createOverlayElementFromTemplate(cDialogueOverlay+"/LineTemplate", "TextArea", cDialogueOverlay+"/Box/Line"+IntToString(i));
dialElem->setPosition(0.1, dialCont->getHeight()*(0.2+i*elemHeight));
dialElem->setDimensions(0.8, elemHeight*dialCont->getHeight());
dialElem->setCaption(IntToString(i+1)+": "+options[i]);
dialElem->show();
dialCont->addChild(dialElem);
m_DialogueLineCount = i+1;
}//for
dialOverlay->show();
}
示例2: opendir
//-------------------------------------------------------------------------------------
///Load all songs, initializes overlay and play first
Sound::Sound(const char* path, int width, int height):volumeDiff(1),actualSongNumber(0),overlayIsShowed(false),durationOverlay(0),startVolume(5)
{
volume = startVolume; //50%
engine = irrklang::createIrrKlangDevice();
struct dirent *entry;
DIR *dp;
dp = opendir(path);
std::string stringName;
if (dp == NULL) {
perror("opendir: Path does not exist or could not be read.");
}else{
while ((entry = readdir(dp))){
stringName = entry->d_name;
if(!(!strcmp(".", stringName.c_str())||!strcmp("..",stringName.c_str()))){
songNames.push_back(std::string(path)+ '/'+ entry->d_name);
}
}
}
song = engine->play2D(songNames[0].c_str(), false, false, true);
song->setVolume(volume);
closedir(dp);
//Event Listener
song->setSoundStopEventReceiver(this);
//overlay
Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
//Create a panel
Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "MusicPanel"));
panel->setMetricsMode(Ogre::GMM_PIXELS);
panel->setDimensions(width*9/10, 50);
panel->setLeft((width - panel->getWidth()) / 2);
panel->setMaterialName("Core/StatsBlockCenter"); // Optional background material
// Create a text area
musicTextArea = static_cast<Ogre::TextAreaOverlayElement*>(overlayManager.createOverlayElement("TextArea", "MusicTextArea"));
musicTextArea->setMetricsMode(Ogre::GMM_PIXELS);
musicTextArea->setTop(5);
musicTextArea->setLeft((( panel->getWidth())) / 4);
musicTextArea->setCharHeight(14);
musicTextArea->setFontName("StarWars");
// Add the text area to the panel
panel->addChild(musicTextArea);
// Create an overlay, and add the panel
overlay = overlayManager.create("MusicBox");
overlay->add2D((panel));
actualSong();
}
示例3: createOverlay
void DirectShowControl::createOverlay()
{
mOverlay = Ogre::OverlayManager::getSingleton().create(mName);
Ogre::OverlayContainer *mContainer = (Ogre::OverlayContainer*)
(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Ogre/DebugTexPanel" +mName));
mContainer->setMetricsMode(Ogre::GMM_PIXELS);
mContainer->setDimensions(mVp->getActualWidth(),mVp->getActualHeight());
mContainer->setMaterialName(mMaterial->getName());
mOverlay->add2D(mContainer);
mOverlay->show();
PlayMovie();
}
示例4: _updateOverlays
void ViargoOgreKinectTrackingCalibrationMetaphor::_updateOverlays(bool state) {
_overlay->show();
_backgroundOverlayContainer->show();
// Update overlay for each marker
for (unsigned int i = 0; i < _markers.size(); i++) {
Ogre::OverlayContainer* currentMarkerOverlay = _markers[i];
if (_calibrationProgress == i) {
if (state) {
currentMarkerOverlay->setMaterialName("kinecttrackingCalibrationGreenMat");
}
else {
currentMarkerOverlay->setMaterialName("kinecttrackingCalibrationYellowMat");
}
}
else {
currentMarkerOverlay->setMaterialName("kinecttrackingCalibrationRedMat");
}
currentMarkerOverlay->show();
}
}
开发者ID:Instinctlol,项目名称:gamelab2014,代码行数:23,代码来源:viargo_ogre_kinect_tracking_calibration_metaphor.cpp
示例5:
/**
* @inheritDoc
*/
BrowserWindow::BrowserWindow() {
m_texture = Ogre::TextureManager::getSingleton().createManual("HUDTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, 500, 500, 0, Ogre::PF_BYTE_BGRA, Ogre::TU_DYNAMIC);
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("HUDMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
material->getTechnique(0)->getPass(0)->createTextureUnitState("HUDTexture");
material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
m_overlay = overlayManager.create("OverlayName");
Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "PanelName"));
panel->setPosition(0.0, 0.0);
panel->setDimensions(1.0, 1.0);
panel->setMaterialName("HUDMaterial");
m_overlay->add2D(panel);
m_overlay->show();
}
示例6: createBrowser
void SalamancerApplication::createBrowser(){
Ogre::TexturePtr renderTexture = Ogre::TextureManager::getSingleton().createManual(
"texture",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, mWindow->getWidth(), mWindow->getHeight(), 0, Ogre::PF_A8R8G8B8, Ogre::TU_WRITE_ONLY);
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingletonPtr()->create("BrowserMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
material->getTechnique(0)->getPass(0)->setCullingMode(Ogre::CULL_CLOCKWISE); // print both sides of the polygones
material->getTechnique(0)->getPass(0)->createTextureUnitState("texture");
material->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);
material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
Ogre::Overlay *overlay = Ogre::OverlayManager::getSingletonPtr()->create("BrowserOverlay");
Ogre::OverlayContainer* panel = static_cast<OverlayContainer*>(Ogre::OverlayManager::getSingletonPtr()->createOverlayElement("Panel", "BrowserPanel"));
panel->setPosition(0.0, 0.0);
panel->setDimensions(1.0, 1.0);
panel->setMaterialName("BrowserMaterial");
overlay->add2D(panel);
overlay->show();
this->windowInfo.SetAsWindowless(0, true);
this->clientHandler = new ClientHandler(renderTexture, this->mRoot->getAutoCreatedWindow(), mMouse, this->mCamera, this->mSceneMgr, this->world, this->context);
browserSettings.web_security = STATE_DISABLED;
this->browser = CefBrowserHost::CreateBrowserSync(windowInfo, this->clientHandler.get(),
"file:///home/nathan/Projects/salamancer/dist/bin/hud/index.html",
browserSettings,
NULL);
this->clientHandler->SetBrowser(this->browser);
mRoot->addFrameListener(this->clientHandler.get());
}
示例7: _buildPattern
void ViargoOgreKinectTrackingCalibrationMetaphor::_buildPattern() {
// Horizontal and vertical offets
float horizontalOffset = _offsets.x + _offsets.z;
float verticalOffset = _offsets.y + _offsets.w;
// Step in horizontal and vertical direction
double widthStep = (1.0 - horizontalOffset) / (_patternSize - 1);
double heightStep = (1.0 - verticalOffset) / (_patternSize - 1);
// Clear old positions
_screenPositions.clear();
_screenPositions3D.clear();
// Build new 2d screen positions
for (int j = 0; j < _patternSize; j++) {
for (int i = 0; i < _patternSize; i++) {
double positionX = _offsets.x + i * widthStep;
double positionY = _offsets.y + j * heightStep;
// Add to list
_screenPositions.push_back(cv::Point2d(positionX, positionY));
}
}
// Transform 2d screen positions into world space relative to window center
for (unsigned int i = 0; i < _screenPositions.size(); i++) {
cv::Point3f worldPosition = cv::Point3f(0, 0, 0);
// Scale to window size and correct position for [0,0] in window center
worldPosition.x = _screenPositions[i].x * _windowSize.x - _windowSize.x / 2.0f;
worldPosition.y = -(_screenPositions[i].y * _windowSize.y - _windowSize.y / 2.0f); // Flipped
_screenPositions3D.push_back(worldPosition);
}
// Build pattern as overlays
Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
// Main overlay, specific overlay containers are inserted here
_overlay = overlayManager.create("KinectTrackingCalibrationOverlay");
_overlay->hide();
_backgroundOverlayContainer = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "KinectTrackingCalibrationBG"));
_backgroundOverlayContainer->setPosition(0.0, 0.0);
_backgroundOverlayContainer->setDimensions(1.0, 1.0);
_backgroundOverlayContainer->setMaterialName("kinecttrackingCalibrationBlackMat");
_backgroundOverlayContainer->hide();
// Add background first
_overlay->add2D(_backgroundOverlayContainer);
char overlayName[100];
// Build overlay for each marker
for (unsigned int i = 0; i < _screenPositions.size(); i++) {
Ogre::Vector2 screenPostion = Ogre::Vector2(_screenPositions[i].x, _screenPositions[i].y);
sprintf(overlayName, "KinectTrackingCalibration_%d", i);
Ogre::OverlayContainer* container = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", std::string(overlayName)));
container->setPosition(screenPostion.x - _markerSize.x / (Ogre::Real)2.0, screenPostion.y - _markerSize.y / (Ogre::Real)2.0);
container->setDimensions(_markerSize.x, _markerSize.y);
container->setMaterialName("kinecttrackingCalibrationRedMat");
container->hide();
// Add overlay item
_overlay->add2D(container);
// Add to list
_markers.push_back(container);
}
}
开发者ID:Instinctlol,项目名称:gamelab2014,代码行数:72,代码来源:viargo_ogre_kinect_tracking_calibration_metaphor.cpp
示例8: showQuestLog
void Menu::showQuestLog(const bool visible)
{
Ogre::OverlayManager* om = Ogre::OverlayManager::getSingletonPtr();
if (om==NULL) return;
//Do we actually need to do something?
if (visible==isQuestLogVisible()) return;
if (visible)
{
//show it
// -- create basic overlay
Ogre::Overlay* ol = om->create(cQuestLogOverlay);
// -- create container - panel
Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(
om->createOverlayElement("Panel", cQuestLogOverlay+"/Panel"));
panel->setMetricsMode(Ogre::GMM_RELATIVE);
panel->setPosition(0.0, 0.0);
panel->setDimensions(1.0, 1.0);
/*set material via panel->setMaterialName(...)?*/
panel->setMaterialName("QuestLog/Transparency");
//add panel to overlay
ol->add2D(panel);
//create elements
// -- "vorwärts blättern"
Ogre::TextAreaOverlayElement* text_elem = static_cast<Ogre::TextAreaOverlayElement*>(
om->createOverlayElement("TextArea", cQuestLogOverlay+"/Plus"));
text_elem->setMetricsMode(Ogre::GMM_RELATIVE);
text_elem->setPosition(0.125, 0.9);
text_elem->setDimensions(0.25, 0.1);
text_elem->setCaption("+ (Next)");
text_elem->setAlignment(Ogre::TextAreaOverlayElement::Center);
text_elem->setFontName("Console");
text_elem->setColour(Ogre::ColourValue(1.0, 0.5, 0.0));
text_elem->setCharHeight(cQuestLogCharHeight);
panel->addChild(text_elem);
//-- "rückwärts blättern"
text_elem = static_cast<Ogre::TextAreaOverlayElement*>(
om->createOverlayElement("TextArea", cQuestLogOverlay+"/Minus"));
text_elem->setMetricsMode(Ogre::GMM_RELATIVE);
text_elem->setPosition(0.425, 0.9);
text_elem->setDimensions(0.25, 0.1);
text_elem->setCaption("- (Previous)");
text_elem->setAlignment(Ogre::TextAreaOverlayElement::Center);
text_elem->setFontName("Console");
text_elem->setColour(Ogre::ColourValue(1.0, 0.5, 0.0));
text_elem->setCharHeight(cQuestLogCharHeight);
panel->addChild(text_elem);
//lists all entries that fit onto the page
showQuestLogEntries();
// -- page number
text_elem = static_cast<Ogre::TextAreaOverlayElement*>(
om->createOverlayElement("TextArea", cQuestLogOverlay+"/Page"));
text_elem->setMetricsMode(Ogre::GMM_RELATIVE);
text_elem->setPosition(0.725, 0.9);
text_elem->setDimensions(0.25, 0.1);
text_elem->setCaption("Page "+IntToString(m_QuestLogOffset/cQuestLogEntriesPerPage+1));
text_elem->setAlignment(Ogre::TextAreaOverlayElement::Center);
text_elem->setFontName("Console");
text_elem->setColour(Ogre::ColourValue(1.0, 0.5, 0.0));
text_elem->setCharHeight(cQuestLogCharHeight);
panel->addChild(text_elem);
//show the overlay
ol->show();
}//if visible
else
{
//destroy all elements
unsigned int i;
// destroy entries
for (i=0; i<m_QuestLogEntryCount; ++i)
{
om->destroyOverlayElement(cQuestLogOverlay+"/"+IntToString(i));
}//for
m_QuestLogEntryCount = 0;
//destroy navigation elements
om->destroyOverlayElement(cQuestLogOverlay+"/Plus");
om->destroyOverlayElement(cQuestLogOverlay+"/Minus");
om->destroyOverlayElement(cQuestLogOverlay+"/Page");
//destroy panel
om->destroyOverlayElement(cQuestLogOverlay+"/Panel");
//destroy overlay
om->destroy(cQuestLogOverlay);
}//else
}//function
示例9: InitStartScene
static void InitStartScene()
{
if(app.state.CurentState > 0)
{
return;
}
Ogre::RTShader::ShaderGenerator::initialize();
Ogre::RTShader::ShaderGenerator::getSingletonPtr()->setTargetLanguage("glsles");
gMatListener = new Ogre::ShaderGeneratorTechniqueResolverListener();
Ogre::MaterialManager::getSingleton().addListener(gMatListener);
LOGW("Create SceneManager");
gSceneMgr = gRoot->createSceneManager(Ogre::ST_GENERIC);
Ogre::RTShader::ShaderGenerator::getSingletonPtr()->addSceneManager(gSceneMgr);
camera = gSceneMgr->createCamera("MyCam");
camera->setNearClipDistance(1.0f);
camera->setFarClipDistance(100000.0f);
camera->setPosition(0,0,20.0f);
camera->lookAt(0,0,0);
camera->setAutoAspectRatio(true);
vp = gRenderWnd->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(1.0f, 1.0f, 1.0f));
vp->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
/**
* http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Creating+Overlays+via+Code
* http://www.ogre3d.org/forums/viewtopic.php?f=2&t=78278#p492027
*/
LOGW("Create OverlaySystem");
Ogre::OverlaySystem *mOverlaySystem = OGRE_NEW Ogre::OverlaySystem();
gSceneMgr->addRenderQueueListener(mOverlaySystem);
LOGW("Create overlayManager");
Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
loadResources("resources.cfg");
Ogre::ResourceGroupManager::getSingletonPtr()->initialiseResourceGroup("Start");
LOGW("Create a img overlay panel");
Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>( overlayManager.createOverlayElement( "Panel", "PanelLogo" ) );
panel->setPosition( vp->getActualWidth()/2 - 64, vp->getActualHeight()/2 - 64 - 20 );
panel->setDimensions( 128, 64 );
panel->setMaterialName("overlay_image_material");
panel->setMetricsMode(Ogre::GMM_PIXELS);
Ogre::Overlay* LogoOverlay = overlayManager.create( "OverlayLogo" );
LogoOverlay->add2D( panel );
LogoOverlay->show();
LOGW("Create a text overlay panel");
textArea = static_cast<Ogre::TextAreaOverlayElement*>(overlayManager.createOverlayElement("TextArea", "TextAreaName"));
textArea->setMetricsMode(Ogre::GMM_PIXELS);
textArea->setPosition(0, 0);
textArea->setDimensions(100, 100);
textArea->setCaption("Hello, World!");
textArea->setCharHeight(48);
textArea->setFontName("QWcuckoo");
textArea->setColourBottom(Ogre::ColourValue(0.0f, 0.0f, 1.0f));
textArea->setColourTop(Ogre::ColourValue(1.0f, 0.0f, 0.0f));
Ogre::OverlayContainer* TextPanel = static_cast<Ogre::OverlayContainer*>( overlayManager.createOverlayElement( "Panel", "PanelText" ) );
TextPanel->setPosition( vp->getActualWidth()/2 - 128, vp->getActualHeight()/2 + 20 );
TextPanel->setDimensions( 256, 64 );
TextPanel->setMaterialName("overlay_text_material");
TextPanel->setMetricsMode(Ogre::GMM_PIXELS);
TextPanel->addChild(textArea);
Ogre::Overlay* TextOverlay = overlayManager.create( "OverlayText" );
TextOverlay->add2D( TextPanel );
TextOverlay->show();
app.state.CurentState = 1;
}