Code: Select all
#include <windows.h>
#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
//IrrlichtDevice* device = irr::createDevice( video::EDT_OPENGL, core::dimension2d<s32>(800,600) );
IrrlichtDevice* device = irr::createDevice( video::EDT_DIRECT3D9, core::dimension2d<s32>(800,600) );
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* scene = device->getSceneManager();
scene::ICameraSceneNode* camera0 = scene->addCameraSceneNode();
scene::ICameraSceneNode* camera1 = scene->addCameraSceneNode();
scene::ICameraSceneNode* camera2 = scene->addCameraSceneNode();
scene::ICameraSceneNode* camera3 = scene->addCameraSceneNodeMaya();
// Move camera0-2 and point at origin.
camera0->setPosition( core::vector3df( 0.0f, 0.0f, -50.0f ) );
camera0->setTarget( core::vector3df( 0.0f, 0.0f, 0.0f ) );
camera1->setPosition( core::vector3df( 0.0f, 50.0f, -50.0f ) );
camera1->setTarget( core::vector3df( 0.0f, 0.0f, 0.0f ) );
camera2->setPosition( core::vector3df( -50.0f, 50.0f, 0.0f ) );
camera2->setTarget( core::vector3df( 0.0f, 0.0f, 0.0f ) );
// Add a cube.
scene::IMeshSceneNode* cube = scene->addCubeSceneNode();
while ( device->run() )
{
// Get screen size.
core::dimension2d<s32> screensize = driver->getScreenSize();
// Begin scene.
driver->beginScene( true, true, video::SColor( 255, 255, 255, 255 ) );
// First camera.
scene->setActiveCamera( camera0 );
driver->setViewPort( core::rect<s32>( 0, 0, screensize.Width / 2, screensize.Height / 2 ) );
scene->drawAll();
// Second camera.
scene->setActiveCamera( camera1 );
driver->setViewPort( core::rect<s32>( screensize.Width / 2, 0, screensize.Width / 2, screensize.Height / 2 ) );
scene->drawAll();
// Third camera.
scene->setActiveCamera( camera2 );
driver->setViewPort( core::rect<s32>( 0, screensize.Height / 2, screensize.Width / 2, screensize.Height / 2 ) );
scene->drawAll();
// Fourth camera.
scene->setActiveCamera( camera3 );
driver->setViewPort( core::rect<s32>( screensize.Width / 2, screensize.Height / 2, screensize.Width / 2, screensize.Height / 2 ) );
scene->drawAll();
// End scene.
driver->endScene();
device->yield();
}
return 0;
}