本文整理汇总了C++中IVideoDriver::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ IVideoDriver::getName方法的具体用法?C++ IVideoDriver::getName怎么用?C++ IVideoDriver::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVideoDriver
的用法示例。
在下文中一共展示了IVideoDriver::getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testTransparentVertexAlphaMore
bool testTransparentVertexAlphaMore(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice(driverType, dimension2d<u32>(160, 120));
if (!device)
return true;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
if (driver->getColorFormat() != video::ECF_A8R8G8B8)
{
device->closeDevice();
device->run();
device->drop();
return true;
}
logTestString("Testing driver %ls\n", driver->getName());
IAnimatedMesh* mesh = smgr->getMesh("../media/sydney.md2");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
IMeshSceneNode* cube = smgr->addCubeSceneNode(10.0f,0,-1,vector3df(-5,3,-15));
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setFrameLoop(0, 310);
node->setMaterialTexture( 0, driver->getTexture("../media/sydney.bmp") );
}
if (cube)
{
cube->getMaterial(0).MaterialType = EMT_TRANSPARENT_VERTEX_ALPHA;
cube->setMaterialTexture(0, driver->getTexture("../media/wall.bmp"));
cube->setMaterialFlag(EMF_LIGHTING, false);
smgr->getMeshManipulator()->setVertexColorAlpha(cube->getMesh(),128);
}
// second cube without texture
cube = smgr->addCubeSceneNode(10.0f,0,-1,vector3df(5,3,-15));
if (cube)
{
cube->getMaterial(0).MaterialType = EMT_TRANSPARENT_VERTEX_ALPHA;
cube->setMaterialFlag(EMF_LIGHTING, false);
smgr->getMeshManipulator()->setVertexColorAlpha(cube->getMesh(),128);
}
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
driver->beginScene(true, true, SColor(0,200,200,200));
smgr->drawAll();
driver->endScene();
bool result = takeScreenshotAndCompareAgainstReference(driver, "-transparentVertexAlphaChannelMore.png", 99.18f);
device->closeDevice();
device->run();
device->drop();
return result;
}
示例2: main
int main()
{
// we'll use the OGL driver
IrrlichtDevice *device =
createDevice(EDT_OPENGL, dimension2du(640, 480), 16,
false, false, false, 0);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
// load sydney
IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
// squash her!
CSquashingMeshSceneNode* node = new CSquashingMeshSceneNode( mesh->getMesh(0), 0, smgr, 0 );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setPosition( vector3df(0,0,50));
node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
}
smgr->addCameraSceneNodeFPS();
int lastFPS = -1;
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
node->render();
node->OnPostRender(device->getTimer()->getTime());
smgr->drawAll();
guienv->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Irrlicht Mesh Deformation Contest [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
device->drop();
return 0;
}
示例3: drawLine
// this test draws lines of different lengths and compares
// them with pixel placement
// grey pixels denote start and end of the white drawn lines
// black pixels only make those grey points better visible
// yellow and magenta lines should start and end next toa black pixel,
// yellow one right to the last black pixel down, magenta below the last
// black pixel to the right
// white lines are always double drawn, lines back and forth.
static bool drawLine(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
if (!device)
return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs
IVideoDriver* driver = device->getVideoDriver();
stabilizeScreenBackground(driver);
logTestString("Testing driver %ls\n", driver->getName());
device->getSceneManager()->addCameraSceneNode();
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140));
// horizontal lines
for (u32 i=0; i<20; ++i)
{
driver->draw2DLine(core::vector2di(10,10+3*i), core::vector2di(10+2*i,10+3*i));
// mark start point
driver->drawPixel(9,10+3*i+1, video::SColor(0xff000000));
driver->drawPixel(10,10+3*i+1, video::SColor(0xff888888));
driver->drawPixel(11,10+3*i+1, video::SColor(0xff000000));
// mark end point
driver->drawPixel(9+2*i,10+3*i+1, video::SColor(0xff000000));
driver->drawPixel(10+2*i,10+3*i+1, video::SColor(0xff888888));
driver->drawPixel(11+2*i,10+3*i+1, video::SColor(0xff000000));
driver->draw2DLine(core::vector2di(10+2*i,10+3*i+2), core::vector2di(10,10+3*i+2));
}
// vertical lines
for (u32 i=0; i<20; ++i)
{
driver->draw2DLine(core::vector2di(11+3*i,10), core::vector2di(11+3*i,10+2*i));
// mark start point
driver->drawPixel(11+3*i+1,9, video::SColor(0xff000000));
driver->drawPixel(11+3*i+1,10, video::SColor(0xff888888));
driver->drawPixel(11+3*i+1,11, video::SColor(0xff000000));
// mark end point
driver->drawPixel(11+3*i+1,9+2*i, video::SColor(0xff000000));
driver->drawPixel(11+3*i+1,10+2*i, video::SColor(0xff888888));
driver->drawPixel(11+3*i+1,11+2*i, video::SColor(0xff000000));
driver->draw2DLine(core::vector2di(11+3*i+2,10+2*i), core::vector2di(11+3*i+2, 10));
}
// diagonal lines
driver->draw2DLine(core::vector2di(14,14),core::vector2di(50,68), video::SColor(0xffffff00));
driver->draw2DLine(core::vector2di(15,14),core::vector2di(69,50), video::SColor(0xffff00ff));
driver->endScene();
bool result = takeScreenshotAndCompareAgainstReference(driver, "-drawLine.png");
device->closeDevice();
device->run();
device->drop();
return result;
}
示例4: pixelAccuracy
// this test draws alternating white and black borders with
// increasing thickness. Intended use of this test is to ensure
// the corect pixel alignment within the render window.
static bool pixelAccuracy(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
if (!device)
return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs
IVideoDriver* driver = device->getVideoDriver();
stabilizeScreenBackground(driver);
logTestString("Testing driver %ls\n", driver->getName());
device->getSceneManager()->addCameraSceneNode();
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140));
u32 start=0;
for (u32 count=1; count<10; ++count)
{
for (u32 j=0; j<count; ++j)
{
for (u32 x=0; x<100-start; ++x)
{
driver->drawPixel(start+x, start, (count%2==1)?0xffffffff:0xff000000);
}
++start;
}
}
start=0;
for (u32 count=1; count<10; ++count)
{
for (u32 j=0; j<count; ++j)
{
for (u32 x=0; x<100-start; ++x)
{
driver->drawPixel(start, start+x, (count%2==1)?0xffffffff:0xff000000);
}
++start;
}
}
for (u32 x=0; x<100; ++x)
{
driver->drawPixel(x, x, 0xffff0000);
}
driver->endScene();
bool result = takeScreenshotAndCompareAgainstReference(driver, "-pixelAccuracy.png");
device->closeDevice();
device->run();
device->drop();
return result;
}
示例5: runTestWithDriver
//! Tests lightmaps under all drivers that support them
static bool runTestWithDriver(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
if (!device)
return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs
IVideoDriver* driver = device->getVideoDriver();
ISceneManager * smgr = device->getSceneManager();
logTestString("Testing driver %ls\n", driver->getName());
if (driver->getDriverAttributes().getAttributeAsInt("MaxTextures")<2)
{
device->closeDevice();
device->run();
device->drop();
return true;
}
stabilizeScreenBackground(driver);
bool result = true;
bool added = device->getFileSystem()->addFileArchive("../media/map-20kdm2.pk3");
assert_log(added);
if(added)
{
ISceneNode * node = smgr->addOctreeSceneNode(smgr->getMesh("20kdm2.bsp")->getMesh(0), 0, -1, 1024);
assert_log(node);
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setPosition(core::vector3df(-1300,-820,-1249));
node->setScale(core::vector3df(1, 5, 1));
(void)smgr->addCameraSceneNode(0, core::vector3df(0,0,0), core::vector3df(40,100,30));
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,255,0));
smgr->drawAll();
driver->endScene();
result = takeScreenshotAndCompareAgainstReference(driver, "-lightmaps.png", 96);
}
}
device->closeDevice();
device->run();
device->drop();
return result;
}
示例6: viewPortText
/** The result should be as follows: We have three times the same image, a billboard with a cube and the text in front.
They are replicated three times, one centered in the screen without viewport, one in the upper left (qurter screen) and
one on the right (half screen). The latter is stretched due to the changed aspect ratio.
The two viewport scenes get the texture drawn over the center as well, using draw2dimage. This should mark the proper
image position with the top left corner of the texture.
Finally, each scene has a checkbox drawn at the left side, vertically centered. This will show whether GUI elements adhere
to viewports as well. */
static bool viewPortText(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
if (!device)
return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs
IVideoDriver* driver = device->getVideoDriver();
ISceneManager * smgr = device->getSceneManager();
IGUIEnvironment* env = smgr->getGUIEnvironment();
stabilizeScreenBackground(driver);
env->addCheckBox(true, core::recti(10,60,28,82));
logTestString("Testing driver %ls\n", driver->getName());
IBillboardSceneNode * bnode = smgr->addBillboardSceneNode(0,dimension2d<f32>(32,32),core::vector3df(0,0,10));
bnode->setMaterialFlag(video::EMF_LIGHTING, false);
bnode->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
bnode->setMaterialTexture(0, driver->getTexture("../media/fire.bmp"));
smgr->addTextSceneNode(device->getGUIEnvironment()->getBuiltInFont(), L"TEST", video::SColor(255,255,255,255), 0);
smgr->addCubeSceneNode();
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140));
smgr->drawAll();
env->drawAll();
driver->setViewPort(rect<s32>(0,0,160/2,120/2));
smgr->drawAll();
env->drawAll();
driver->draw2DImage(driver->getTexture("../media/fire.bmp"), core::vector2di(160/2,120/2));
driver->setViewPort(rect<s32>(160/2,0,160,120));
smgr->drawAll();
env->drawAll();
driver->draw2DImage(driver->getTexture("../media/fire.bmp"), core::vector2di(160/2,120/2));
driver->endScene();
bool result = takeScreenshotAndCompareAgainstReference(driver, "-viewPortText.png", 98.71f);
device->closeDevice();
device->run();
device->drop();
return result;
}
示例7: lineRender
/** Expect to see two diagonal lines overlaying a wall texture cube.
One line should run from green at the top left to red at the bottom right.
The other should run from cyan 100% transparent at the bottom left to
cyan 100% opaque at the top right. */
static bool lineRender(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
if (!device)
return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs
IVideoDriver* driver = device->getVideoDriver();
ISceneManager * smgr = device->getSceneManager();
stabilizeScreenBackground(driver);
logTestString("Testing driver %ls\n", driver->getName());
// Draw a cube background so that we can check that the pixels' alpha is working.
ISceneNode * cube = smgr->addCubeSceneNode(50.f, 0, -1, vector3df(0, 0, 60));
cube->setMaterialTexture(0, driver->getTexture("../media/wall.bmp"));
cube->setMaterialFlag(video::EMF_LIGHTING, false);
(void)smgr->addCameraSceneNode();
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140));
smgr->drawAll();
// Test for benign handling of offscreen pixel values as well as onscreen ones.
for(s32 x = -10; x < 170; ++x)
{
s32 y = 120 * x / 160;
driver->drawPixel((u32)x, (u32)y, SColor(255, 255 * x / 640, 255 * (640 - x) / 640, 0));
y = 120 - y;
driver->drawPixel((u32)x, (u32)y, SColor(255 * x / 640, 0, 255, 255));
}
driver->endScene();
bool result = takeScreenshotAndCompareAgainstReference(driver, "-drawPixel.png", 98.81f);
device->closeDevice();
device->run();
device->drop();
return result;
}
示例8: main
int main(int argc, char **argv) {
BSPdungeon dun(50,50,5);
IrrlichtDevice *device =createDevice( video::EDT_OPENGL, dimension2d<u32>(1280,720), 16,false, false, false, 0);
if (!device)
return 1;
device->setWindowCaption(L"Pangolin Kwest");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
smgr->setAmbientLight(video::SColorf(0.1,0.1,0.1,1));
ILightSceneNode* mylight1 = smgr->addLightSceneNode( 0, core::vector3df(00,00,00), video::SColorf(0.3f,0.3f,0.3f), 30.0f, 1 );
//IGUIFont* myfont=guienv->getFont("./myfont.xml");
//if(myfont==0)exit(93);
//guienv->addMessageBox(L"Alertz!",L"You pangolin are been createrized. You totalleh ready to bash monstaz etc.!");
mylight1->enableCastShadow(true);
//guienv->addStaticText(L"Pangolin Kwest 3D",rect<s32>(10,10,260,22), true);
//-------------------------------------------
int x,y,z;
for(x=0;x<50;x++){
for(y=0;y<50;y++){
if(dun.map[x][y]==NIL){
for(z=0;z<3;z++){
ISceneNode* cueb=smgr->addCubeSceneNode(10);
cueb->setMaterialFlag(EMF_LIGHTING, true);
cueb->setMaterialTexture( 0, driver->getTexture("media/stdwall.jpg") );
// cueb->getMaterial(0).getTextureMatrix(0).setTextureTranslate(0.25,0.5);
// cueb->getMaterial(0).getTextureMatrix(0).setTextureScale(0.0625,0.0625);
cueb->setPosition(vector3df(x*10,z*10,y*10));
}
}
// ISceneNode* cueb=smgr->addCubeSceneNode(10);
// cueb->setMaterialFlag(EMF_LIGHTING, true);
// cueb->setMaterialTexture( 0, driver->getTexture("media/stdfloor.jpg") );
// cueb->setPosition(vector3df(x*10,-10,y*10));
ISceneNode* cueb=smgr->addCubeSceneNode(10);
cueb->setMaterialFlag(EMF_LIGHTING, true);
cueb->setMaterialTexture( 0, driver->getTexture("media/stdup.jpg") );
cueb->setPosition(vector3df(x*10,30,y*10));
}
}
ISceneNode* cueb=smgr->addCubeSceneNode(500);
cueb->setMaterialFlag(EMF_LIGHTING, true);
cueb->setMaterialTexture( 0, driver->getTexture("media/stdfloor.jpg") );
cueb->setPosition(vector3df(250,-255,250));
//cueb->getMaterial(0).getTextureMatrix(0).setTextureTranslate(0.25,0.5);
cueb->getMaterial(0).getTextureMatrix(0).setTextureScale(50,50);
//cueb->setScale(vector3df(0,-5,0));
//cueb->addshadowVolumeSceneNode();
//-------------------------------------------
int lastFPS;
//smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
ICameraSceneNode* mycam;
mycam=smgr->addCameraSceneNodeFPS(0,100.0f,0.025f);
mycam->setFOV(45);
mylight1->setParent(mycam);
while(device->run())
{
//mylight1->setPosition();
//mylight1->
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Pangolin Kwest 3D [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
//.........这里部分代码省略.........
示例9: runTestWithDriver
//! Tests projection matrices
static bool runTestWithDriver(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
if (!device)
return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs
IVideoDriver* driver = device->getVideoDriver();
stabilizeScreenBackground(driver);
logTestString("Testing driver %ls\n", driver->getName());
bool result = true;
driver->beginScene(true, false, SColor(255,0,0,0));
SMaterial mat;
mat.MaterialType = EMT_SOLID;
mat.Lighting = false;
mat.ZBuffer = false;
mat.ZWriteEnable = false;
mat.Thickness = 1;
driver->setMaterial(mat);
core::dimension2d<f32> dims(driver->getCurrentRenderTargetSize());
//apply custom projection, no offset
core::matrix4 pmtx = matrix4().buildProjectionMatrixOrthoLH(dims.Width, dims.Height, 0, 100);
driver->setTransform(ETS_PROJECTION, pmtx);
driver->setTransform(ETS_VIEW, matrix4());
driver->setTransform(ETS_WORLD, matrix4());
//the red cross appears at center
for (u32 i=0; i<10; ++i)
{
driver->draw3DLine(vector3df(0.f+i,-50.f,1.f), vector3df(0.f+i,50.f,1.f), SColor(255,255,0,0));
driver->draw3DLine(vector3df(-50.f,0.f+i,1.f), vector3df(50.f,0.f+i,1.f), SColor(255,255,0,0));
}
//apply custom projection, offset to right-top
pmtx.setTranslation(vector3df(0.7f, 0.7f, 0.f));
driver->setTransform(ETS_PROJECTION, pmtx);
driver->setTransform(ETS_VIEW, matrix4());
driver->setTransform(ETS_WORLD, matrix4());
//The green cross must be in right-top corner. But for OpenGL driver it is in left-top corner
for (u32 i=0; i<10; ++i)
{
driver->draw3DLine(vector3df(0.f+i,-50,1), vector3df(0.f+i,50,1), SColor(255,0,255,0));
driver->draw3DLine(vector3df(-50,0.f+i,1), vector3df(50,0.f+i,1), SColor(255,0,255,0));
}
driver->endScene();
result = takeScreenshotAndCompareAgainstReference(driver, "-projMat.png", 98.71f);
device->closeDevice();
device->run();
device->drop();
return result;
}