Code: Select all
driver->beginScene(true, true, video::SColor(0,100,100,100));
smgr1->drawAll();
driver->endScene();
driver->beginScene(false, false, video::SColor(0,100,100,100));
smgr2->drawAll();
driver->endScene();
Code: Select all
driver->beginScene(true, true, video::SColor(0,100,100,100));
smgr1->drawAll();
driver->endScene();
driver->beginScene(false, false, video::SColor(0,100,100,100));
smgr2->drawAll();
driver->endScene();
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
return 1;
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
ISceneManager* smgr2 = smgr->createNewSceneManager();
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<s32>(10,10,260,22), true);
ICameraSceneNode *camera=smgr->addCameraSceneNodeFPS(0, 100.0f, .3f, -1, 0, 0, false, 3.f);
camera->setPosition(core::vector3df(0,0,-50));
camera->setTarget(core::vector3df(0,0,0));
device->getCursorControl()->setVisible(false);
smgr->addLightSceneNode(0, core::vector3df(200,200,200),
video::SColorf(.3f,.3f,.3f),2000);
//smgr->setAmbientLight(video::SColorf(0.3f,0.3f,0.3f));
ISceneNode* n1=smgr->addCubeSceneNode();
n1->setMaterialTexture(0, driver->getTexture("../../media/portal1.bmp"));
ISceneNode* n2=smgr2->addCubeSceneNode();
n2->setMaterialTexture(0, driver->getTexture("../../media/fire.bmp"));
ICameraSceneNode *camera2=smgr2->addCameraSceneNodeFPS(0, 100.0f, .3f, -1, 0, 0, false, 3.f);
camera2->setPosition(core::vector3df(0,0,-50));
camera2->setTarget(core::vector3df(0,0,0));
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
smgr2->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Code: Select all
smgr2->setActiveCamera( smgr1->getActiveCamera() );
Code: Select all
ICameraSceneNode *camera=smgr->addCameraSceneNodeFPS(0, 100.0f, .3f, -1, 0, 0, false, 3.f);
smgr->setActiveCamera( camera );
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
return 1;
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
ISceneManager* smgr2 = smgr->createNewSceneManager();
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<s32>(10,10,260,22), true);
ICameraSceneNode *camera=smgr->addCameraSceneNodeFPS(0, 100.0f, .3f, -1, 0, 0, false, 3.f);
camera->setPosition(core::vector3df(0,0,-50));
camera->setTarget(core::vector3df(0,0,0));
device->getCursorControl()->setVisible(false);
smgr->addLightSceneNode(0, core::vector3df(200,200,200),
video::SColorf(.3f,.3f,.3f),2000);
//smgr->setAmbientLight(video::SColorf(0.3f,0.3f,0.3f));
ISceneNode* n1=smgr->addCubeSceneNode();
n1->setMaterialTexture(0, driver->getTexture("../../media/portal1.bmp"));
ISceneNode * arrowX = smgr2->addAnimatedMeshSceneNode(smgr2->addArrowMesh("arrowX",
SColor(255, 255, 0, 0), SColor(255, 255, 0, 0),4,8,1.0f,0.6f,0.05f,0.2f));
arrowX->setMaterialFlag(video::EMF_LIGHTING, true);
arrowX->setScale(vector3df(10, 10, 10));
arrowX->setRotation(vector3df(0,0,-90));
arrowX->setMaterialFlag(video::EMF_ZBUFFER, false);
ICameraSceneNode *camera2=smgr2->addCameraSceneNodeFPS(0, 100.0f, .3f, -1, 0, 0, false, 3.f);
camera2->setPosition(core::vector3df(0,0,-50));
camera2->setTarget(core::vector3df(0,0,0));
smgr2->setActiveCamera( smgr->getActiveCamera() );
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
smgr2->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
Code: Select all
arrowX->setMaterialFlag(video::EMF_LIGHTING, false);