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; }
static bool loadScene(void) { IrrlichtDevice *device = createDevice(video::EDT_BURNINGSVIDEO, core::dimension2du(160,120), 32); if (!device) return false; IVideoDriver* driver = device->getVideoDriver(); ISceneManager* smgr = device->getSceneManager(); // load scene from example, with correct relative path device->getFileSystem()->changeWorkingDirectoryTo("results"); smgr->loadScene("../../media/example.irr"); smgr->addCameraSceneNode(0, core::vector3df(0,0,-50)); device->getFileSystem()->changeWorkingDirectoryTo(".."); bool result = false; device->run(); device->getTimer()->setTime(666); // scene has animations and current scene seems to be saved at that time ... really - best result with just that number :-) if (driver->beginScene(true, true, video::SColor(0, 80, 80, 80))) { smgr->drawAll(); driver->endScene(); // we need to be very sloppy, because the animators will produce a different // start depending on the actual loading time. 97% seems to be safe, as removing // an object produces values around 95% result = takeScreenshotAndCompareAgainstReference(driver, "-loadScene.png", 97.4f); if (!result) logTestString("Rendering the loaded scene failed.\n"); } ISceneNode* node = smgr->getSceneNodeFromId(128); if (!node) result=false; else if (result) // only check if scene was correctly loaded { result &= (node->getChildren().size()==0); if (!result) logTestString("Node has an illegal child node.\n"); device->getSceneManager()->loadScene("results/scene2.irr", 0, node); result &= (node->getChildren().size()!=0); if (!result) logTestString("Loading second scene as child failed.\n"); } device->closeDevice(); device->run(); device->drop(); return result; }
int main() { int idCenario = 0; int quadId; vector3df p1, p2, p3, p4; SMatrix mtxCenario; CArquivoMatrizes *_fileMtx = new CArquivoMatrizes(); CSampleSceneNode *myQuad[2500]; CGerEventos eventos; IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<s32>(800, 600), 16, false,false,false, &eventos); device->setWindowCaption(L"Editor de matrizes - Warbugs"); IVideoDriver* driver = device->getVideoDriver(); ISceneManager* smgr = device->getSceneManager(); smgr->addCameraSceneNodeFPS(); //smgr->addCameraSceneNode(0, vector3df(0,100,0), vector3df(0,0,0)); smgr->loadScene(pathCenario[idCenario]); mtxCenario = _fileMtx->getMatrix(idCenario); ITerrainSceneNode *sceneTerrain = (ITerrainSceneNode*)smgr->getSceneNodeFromType(ESNT_TERRAIN, 0); ITriangleSelector *sceneTris = smgr->createTerrainTriangleSelector(sceneTerrain, 0); sceneTerrain->setTriangleSelector(sceneTris); for(int i=0; i<50; i++) // z { for(int j=0; j<50;j++) // x { //if( //{ p1.X = 10.0; p1.Y = 1.0; p1.Z = 0.0; p2.X = 10.0; p2.Y = 1.0; p2.Z = 500.0; p3.X = 0.0; p3.Y = 1.0; p3.Z = 500.0; p4.X = 0.0; p4.Y = 1.0; p4.Z = 0.0; quadId = j + (i * 10); myQuad[quadId] = new CSampleSceneNode(smgr->getRootSceneNode(), smgr, quadId, p1, p2, p3, p4); //} } } while(device->run()) { driver->beginScene(true, true, SColor(0,100,100,100)); smgr->drawAll(); driver->endScene(); } device->drop(); return 0; }