本文整理汇总了C++中IVideoDriver::endScene方法的典型用法代码示例。如果您正苦于以下问题:C++ IVideoDriver::endScene方法的具体用法?C++ IVideoDriver::endScene怎么用?C++ IVideoDriver::endScene使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVideoDriver
的用法示例。
在下文中一共展示了IVideoDriver::endScene方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runTestWithDriver
/** The test loads a texture, renders it using draw2dimage, loads another
texture and renders the first one again. Due to the texture cache this
can lead to rendering of the second texture in second place. */
static bool runTestWithDriver(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<s32>(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();
ITexture* tex1 = driver->getTexture("../media/wall.bmp");
(void)smgr->addCameraSceneNode();
driver->beginScene(true, true, SColor(255,100,101,140));
driver->draw2DImage(tex1, position2di(0,0));
driver->endScene();
driver->getTexture("../media/tools.png");
driver->beginScene(true, true, SColor(255,100,101,140));
driver->draw2DImage(tex1, position2di(0,0));
driver->endScene();
bool result = takeScreenshotAndCompareAgainstReference(driver, "-textureRenderStates.png", 100);
device->drop();
return result;
}
示例2: main
int main(int argc, char** argv)
{
IrrlichtDevice* device = createDevice(video::EDT_OPENGL, dimension2d<u32>(800, 600), 16, false, false, false, 0);
if (!device) {
return 1;
}
device->setWindowCaption(L"boxes");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IMeshSceneNode* cube = smgr->addCubeSceneNode();
smgr->addCameraSceneNode(0);
while (device->run()) {
driver->beginScene();
smgr->drawAll();
driver->endScene();
}
return 0;
}
示例3: main
int main(int argc, char** argv) {
IrrlichtDevice *device=createDevice(EDT_OPENGL,dimension2d<s32>(1024,600),16,false,false,false,0);
device->setWindowCaption(L"FollowPathAnimator");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
smgr->loadScene("data/irrOdeMarble_level_.xml");
ICameraSceneNode *pCam=smgr->addCameraSceneNode(NULL,vector3df(0.0f,0.0f,0.0f),vector3df(1.0f,0.0f,0.0f));
CFollowPathAnimator *myAnimator=new CFollowPathAnimator(device,"pathToFollow",120,500);
pCam->addAnimator(myAnimator);
myAnimator->setCamParameter(pCam);
while(device->run()) {
driver->beginScene(true, true, SColor(0,200,200,200));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
示例4: main
int main()
{
IDevice* device = createDevice(EDT_DIRECT3D11, 800, 600);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->createSceneManager();
ITimer* timer = device->getTimer();
timer->reset();
// test
XMFLOAT4 plane(0, 1.0f, 0, 0);
XMFLOAT3 p(1.0f, 3.0f, -2.0f);
XMFLOAT3 p2 = math::ComputeMirrorPointAboutPlane(plane, p);
std::cout << p2.x << "," << p2.y << "," << p2.z << std::endl;
const f32 color[] = { 0, 1.0f, 0, 1.0f };
while (device->run()) {
driver->beginScene(true, true, color);
float dt = timer->tick();
smgr->update(dt);
smgr->drawAll();
driver->endScene();
}
smgr->destroy();
device->drop();
return 0;
}
示例5: main
int main()
{
IDevice* device = createDevice(EDT_DIRECT3D11, 800, 600);
IVideoDriver* driver = device->getVideoDriver();
IResourceGroupManager* resourceGroupManager = driver->getResourceGroupManager();
resourceGroupManager->init("Resources.cfg");
IInputDriver* input = device->getInputDriver();
ISceneManager* smgr = setupScene(device);
driver->setDeferredShading(true);
ITimer* timer = device->getTimer();
timer->reset();
const f32 color[] = { 0, 0, 0, 1.0f };
while (device->run()) {
float dt = timer->tick();
if (input->keyDown(GVK_ESCAPE))
break;
smgr->update(dt);
driver->beginScene(true, true, color);
smgr->drawAll();
driver->endScene();
}
smgr->destroy();
device->drop();
return 0;
}
示例6: irrUpdate
void CIrrWindow::irrUpdate()
{
// draw document
IVideoDriver* driver = m_driver;
ISceneManager* smgr = m_smgr;
// tick device
m_device->getTimer()->tick();
// update particle
m_particleObject->updateObject();
// draw 3d scene
driver->beginScene( true, true, 0, getIView()->getVideoData() );
// draw all scene
smgr->drawAll();
int fps = driver->getFPS();
core::stringw text(L"fps: ");
text += fps;
text += L" frame/second";
irr::gui::IGUIFont* font = smgr->getGUIEnvironment()->getBuiltInFont();
font->draw( text.c_str(), core::recti( 10, 10, 200, 20), video::SColor(255, 255,0,0) );
// end scene
driver->endScene();
}
示例7: drawDocument
// drawDocument
// draw documen by frame
void CDocument::drawDocument()
{
// draw document
IVideoDriver* driver = getIView()->getDriver();
ISceneManager* smgr = getIView()->getSceneMgr();
// draw 3d scene
driver->beginScene( true, true, SColor(255,30,30,30), getIView()->getVideoData() );
// draw all scene
smgr->drawAll();
// controller draw imp
CControllerManager::getInstance()->getCurrentController()->render();
int fps = driver->getFPS();
core::stringw text(L"fps: ");
text += fps;
text += L" frame/second \n";
int primitiveDraw = driver->getPrimitiveCountDrawn();
text += L"primitive: ";
text += primitiveDraw;
irr::gui::IGUIFont* font = smgr->getGUIEnvironment()->getBuiltInFont();
font->draw( text.c_str(), core::recti( 10, 10, 200, 20), video::SColor(255, 255,0,0) );
// end scene
driver->endScene();
}
示例8: burningsVideo
/** Tests the Burning Video driver */
bool burningsVideo(void)
{
IrrlichtDevice *device = createDevice(video::EDT_BURNINGSVIDEO,
core::dimension2di(160,120), 32);
if (!device)
return false;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
smgr->addCubeSceneNode(10.f, 0, -1, core::vector3df(0.f, 0.f, 20.f));
smgr->addCameraSceneNode();
// Test that ambient lighting works when there are no other lights in the scene
smgr->setAmbientLight(video::SColorf(.7f, .1f, .1f, 1.f));
bool result = false;
device->run();
if (driver->beginScene(true, true, video::SColor(0, 80, 80, 80)))
{
smgr->drawAll();
driver->endScene();
result = takeScreenshotAndCompareAgainstReference(driver, "-ambient-lighting.png", 100);
}
device->drop();
return result;
}
示例9: 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;
}
示例10: runTestWithDriver
static bool runTestWithDriver(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<s32>(640, 480));
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();
// Draw a cube to 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(true, true, SColor(255,100,101,140));
smgr->drawAll();
// Test for offscreen values as well as onscreen.
for(s32 x = -10; x < 650; ++x)
{
s32 y = 480 * x / 640;
driver->drawPixel((u32)x, (u32)y, SColor(255, 255 * x / 640, 255 * (640 - x) / 640, 0));
y = 480 - y;
driver->drawPixel((u32)x, (u32)y, SColor(255 * x / 640, 0, 255, 255));
}
driver->endScene();
bool result = takeScreenshotAndCompareAgainstReference(driver, "-drawPixel.jpg");
device->drop();
return result;
}
示例11: 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;
}
示例12: main
int main()
{
int rows = 10, colums = 10;
printf("Number of stack rows: ");
cin >> rows;
printf("\nNumber of stack colums: ");
cin >> colums;
CReceiver receiver;
IrrlichtDevice *device = createDevice(EDT_DIRECT3D9, dimension2d<u32>(640, 480), 16, false, false, false, &receiver);
IVideoDriver *driver = device->getVideoDriver();
ISceneManager *smgr = device->getSceneManager();
IGUIEnvironment *guienv = device->getGUIEnvironment();
device->setWindowCaption(L"HelloWorld");
irrBulletWorld * world = createIrrBulletWorld(device, true, true);
world->setDebugMode(EPDM_DrawAabb | EPDM_DrawContactPoints);
world->setGravity(core::vector3df(0, -10, 0));
createWorld(rows, colums, device, world);
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
camera->setPosition(core::vector3df(50, 15, 200));
u32 then = device->getTimer()->getTime();
while (device->run())
{
const u32 now = device->getTimer()->getTime();
const f32 frameDeltaTime = (f32)(now - then) / 1000.f; // в секундах
then = now;
if (receiver.isMouseDown(EMIE_RMOUSE_PRESSED_DOWN))
{
core::vector3df pos(camera->getPosition().X, camera->getPosition().Y, camera->getPosition().Z);
scene::ISceneNode *Node = smgr->addCubeSceneNode();
Node->setScale(core::vector3df(0.2, 0.2, 0.2));
Node->setPosition(pos);
Node->setMaterialFlag(video::EMF_LIGHTING, false);
Node->setMaterialTexture(0, driver->getTexture("../rockwall.jpg"));
ICollisionShape *shape = new IBoxShape(Node, 1, true);
IRigidBody *body = world->addRigidBody(shape);
body->setDamping(0.2, 0.2);
body->setFriction(0.4f);
body->setGravity(core::vector3df(0, -10, 0));
core::vector3df rot = camera->getRotation();
core::matrix4 mat;
mat.setRotationDegrees(rot);
core::vector3df forwardDir(core::vector3df(mat[8], mat[9], mat[10]) * 120);
body->setLinearVelocity(forwardDir);
}
driver->beginScene(true, true, video::SColor(255, 100, 101, 140));
world->stepSimulation(frameDeltaTime, 120);
world->debugDrawWorld(true);
world->debugDrawProperties(true);
smgr->drawAll();
guienv->drawAll();
driver->endScene();
if (world) delete world;
device->drop();
return 0;
}
}
示例13: main
int main()
{
//创建设备,颜色深度16,
IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<u32>(640, 480), 16,
false/*不全屏*/, false/*关闭stencil buffer*/, false/*不与视频同步*/, 0);
if (!device)
return 1;
device->setWindowCaption(L"不停变化的背景色");
IVideoDriver* driver = device->getVideoDriver();
f32 bg_r = 255.0f;
f32 bg_g = 255.0f;
f32 bg_b = 255.0f;
bool fadeOut = true;
int lastFPS = -1;
u32 then = device->getTimer()->getTime();
const f32 fadeRate = 0.1f;
while(device->run())
{
const u32 now = device->getTimer()->getTime();
const f32 frameDeltaTime = (f32)(now - then);
then = now;
if (bg_r <= 0.0f) fadeOut = false;
else if (bg_r >= 255.0f) fadeOut = true;
if (fadeOut)
{
bg_r-= fadeRate * frameDeltaTime;
bg_g-= fadeRate * frameDeltaTime;
bg_b-= fadeRate * frameDeltaTime;
}
else
{
bg_r+= fadeRate * frameDeltaTime;
bg_g+= fadeRate * frameDeltaTime;
bg_b+= fadeRate * frameDeltaTime;
}
driver->beginScene(true, true, SColor(255, (u32)bg_r, (u32)bg_g, (u32)bg_b));
driver->endScene();
}
device->drop();
return 0;
}
示例14: 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;
}
示例15: main
int main()
{
SDeviceContextSettings settings;
settings.MultiSamplingCount = 4;
settings.MultiSamplingQuality = 32;
IApplication* device = createDevice(EDT_DIRECT3D11, 800, 600, EWS_NONE, true, settings);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->createSceneManager();
IMeshManager* meshManager = driver->getMeshManager();
IResourceGroupManager* resourceGroupManager = driver->getResourceGroupManager();
resourceGroupManager->init("Resources.cfg");
//resourceGroupManager->loadResourceGroup("General");
XMFLOAT3 vertices[4];
vertices[0] = XMFLOAT3(-10.0f, 0.0f, 10.0f);
vertices[1] = XMFLOAT3(10.0f, 0.0f, 10.0f);
vertices[2] = XMFLOAT3(-10.0f, 0.0f, -10.0f);
vertices[3] = XMFLOAT3(10.0f, 0.0f, -10.0f);
ISimpleMesh* mesh = meshManager->createSimpleMesh("pointlist", EVF_POSITION,
vertices, NULL, 4, sizeof(XMFLOAT3), 0, math::SAxisAlignedBox(), false);
IMeshNode* meshNode = smgr->addMeshNode(mesh, nullptr, nullptr);
meshNode->setMaterialName("test/ts_material");
meshNode->setNeedCulling(false);
ICameraNode* camera = smgr->addFpsCameraNode(1, nullptr, XMFLOAT3(0, 1.0f, -4.0f), XMFLOAT3(0, 1.0f, 0.0f));
char caption[200];
ITimer* timer = device->getTimer();
timer->reset();
while (device->run())
{
const float clearColor[] = { 0.0f, 0.0f, 0.0f, 1.0f };
driver->beginScene(true, true, clearColor);
float dt = timer->tick() * 0.001f;
updateCamera(camera, dt);
smgr->update(dt);
smgr->drawAll();
driver->endScene();
sprintf(caption, "FPS:%f", getFps(dt));
device->setWindowCaption(caption);
}
device->drop();
return 0;
}