本文整理汇总了C++中OverlayElement::setMaterialName方法的典型用法代码示例。如果您正苦于以下问题:C++ OverlayElement::setMaterialName方法的具体用法?C++ OverlayElement::setMaterialName怎么用?C++ OverlayElement::setMaterialName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OverlayElement
的用法示例。
在下文中一共展示了OverlayElement::setMaterialName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QGraphicsScene
OgreQtOverlay::OgreQtOverlay(Ogre::Root *root, Ogre::RenderWindow *window, Ogre::uint w, Ogre::uint h, QObject *parent)
: QGraphicsScene(parent), _width(w), _height(h)
{
_root = root;
_window = window;
_time.start(); //start a timer for key events
//Connect redraw signal to this class
QObject::connect(this,SIGNAL(changed(QList<QRectF>)),this,SLOT(sceneChanged(QList<QRectF>)));
//qDebug() << "WIDTH:" << _width << "HEIGHT:" << _height;
//create a texture the size of the screen to draw into
_texture = TextureManager::getSingleton().createManual("OgreQtTexture",ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME
,TEX_TYPE_2D,_width,_height,0,PF_A8R8G8B8,TU_DYNAMIC_WRITE_ONLY).getPointer();
//save texture buffer for later
_buffer = _texture->getBuffer().getPointer();
//Create a material
MaterialPtr material = MaterialManager::getSingleton().create("DynamicTextureMaterial",ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
material->getTechnique(0)->getPass(0)->createTextureUnitState("OgreQtTexture");
material->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);
//Load overlay
_overlay = OverlayManager::getSingleton().getByName("MyOverlays/OgreQt");
OverlayElement *element = OverlayManager::getSingleton().getOverlayElement("MyOverlayElements/QtPanel");
element->setMaterialName("DynamicTextureMaterial");
//set the screen rect for the graphicsscene
float ratio = (float)_width / (float)_height;
setSceneRect(QRectF(0.0,0.0,_width,_height));
//Create Cursor Pixmap
_cursor = addPixmap(QPixmap(POINTER_FILE));
_cursor->scale(POINTER_SCALE_X,POINTER_SCALE_Y);
_cursor->setZValue(POINTER_Z);
//set some default values
_modifiers = Qt::NoModifier;
_lastkeytime=0;
_repeating=false;
_lastclicktime = 0;
_visible=false;
_overlay->hide();
}
示例2: createPanel
//-----------------------------------------------------------------------
OverlayElement* OverlayProfileSessionListener::createPanel(const String& name, Real width, Real height, Real top, Real left,
const String& materialName, bool show)
{
OverlayElement* panel =
OverlayManager::getSingleton().createOverlayElement("Panel", name);
panel->setMetricsMode(GMM_PIXELS);
panel->setWidth(width);
panel->setHeight(height);
panel->setTop(top);
panel->setLeft(left);
panel->setMaterialName(materialName);
if (show) {
panel->show();
}
else {
panel->hide();
}
return panel;
}