本文整理汇总了C++中IVideoDriver::addTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ IVideoDriver::addTexture方法的具体用法?C++ IVideoDriver::addTexture怎么用?C++ IVideoDriver::addTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVideoDriver
的用法示例。
在下文中一共展示了IVideoDriver::addTexture方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
IrrlichtDevice* irrDevice = createDevice(EDT_OPENGL,dimension2d<s32>(800,600),32,false,false,false,0);
IVideoDriver* irrVideo = irrDevice->getVideoDriver();
ISceneManager* irrSceneMgr = irrDevice->getSceneManager();
TMovie* movie = new TMovie(irrDevice->getTimer());
movie->LoadMovie("Mymovie.avi");
irrVideo->setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
u32 w = movie->getMovieWidth();
u32 h = movie->getMovieHeight();
ITexture* movTxtr = irrVideo->addTexture(dimension2d<s32>(w<513?512:1024,h<513?512:1024),"imovie");
irrSceneMgr->addCameraSceneNode(0, vector3df(0,0,-20), vector3df(0,0,0));
CSampleSceneNode* myNode = new CSampleSceneNode(irrSceneMgr->getRootSceneNode(), irrSceneMgr, 666);
myNode->setMaterialTexture( 0, movTxtr);
myNode->drop();
ISceneNodeAnimator* anim = irrSceneMgr->createRotationAnimator(vector3df(0,0.1f,0));
myNode->addAnimator(anim);
anim->drop();
while(irrDevice->run())
{
irrVideo->beginScene(true, true, SColor(0,200,200,200));
if (movie->NextMovieFrame())
movie->DrawMovie(0,0,movTxtr);
irrSceneMgr->drawAll();
irrVideo->endScene();
}
irrDevice->drop();
return 0;
}
示例2: Dialog
TextureDialog::TextureDialog(EditorState *pstate, Node *pnode, CubeSide pface):
Dialog(pstate),
node(pnode),
face(pface),
lb(NULL),
the_image(NULL),
context(NULL)
{
IVideoDriver *driver = state->device->getVideoDriver();
IGUIEnvironment *guienv = state->device->getGUIEnvironment();
// Window and basic items
win = guienv->addWindow(rect<s32>(340, 50, 340 + 74 * 3 + 10, 50 + 74 * 3 + 10), true,
narrow_to_wide(std::string(getCubeSideName(face)) + " texture").c_str());
guienv->addButton(rect<s32>(155, 30, 74*3, 55), win, ETD_GUI_ID_APPLY, L"Apply", L"Apply this texture selection to the node face");
guienv->addButton(rect<s32>(155, 60, 74*3, 85), win, ETD_GUI_ID_IMPORT, L"Import", L"Import images from files");
guienv->addButton(rect<s32>(84, 60, 150, 85), win, ETD_GUI_ID_ACTIONS, L"Actions");
// Fill out listbox
lb = guienv->addListBox(rect<s32>(10, 104, 74 * 3, 74 * 3), win, 502);
Media *media = &state->project->media;
std::map<std::string, Media::Image*>& images = media->getList();
int count = 1;
lb->addItem(L"");
lb->setSelected(0);
for (std::map<std::string, Media::Image*>::const_iterator it = images.begin();
it != images.end();
++it) {
if (!it->second) {
continue;
}
if (it->second->name == "default") {
lb->addItem(L"");
} else {
lb->addItem(narrow_to_wide(it->second->name + " [used " +
num_to_str(it->second->getHolders()) + " times]").c_str());
}
if (it->second == node->getTexture(face))
lb->setSelected(count);
count++;
}
Media::Image *image = node->getTexture(face);
if (image) {
the_image = driver->addTexture("tmpicon.png", image->get());
}
// Context menu
context = guienv->addContextMenu(rect<s32>(84, 85, 150, 180), win, ETD_GUI_ID_ACTIONS_CM);
context->addItem(L"Export", ETD_GUI_ID_EXPORT);
context->setCloseHandling(ECMC_HIDE);
context->setVisible(false);
context->setEventParent(win);
}
示例3: createSplattingImg
// ----------------------------------------------------------------------------
ITexture* Terrain::createSplattingImg()
{
IVideoDriver* vd = Editor::getEditor()->getVideoDriver();
auto img = autoDropped(
vd->createImage(ECF_A8R8G8B8, dimension2du(SPIMG_X, SPIMG_Y)));
for (u32 i = 0; i < SPIMG_X; i++)
for (u32 j = 0; j < SPIMG_Y; j++)
img->setPixel(i, j, SColor(255, 0, 0, 0));
return vd->addTexture("splatt.png", img.get());
} // initSplattingImg