void ScoreScreen::LoadLevel(Ogre::String levelName) { ResetCamera(); Ogre::DotSceneLoader a; a.parseDotScene(levelName + ".scene", "General", mSceneMgr.get()); labels.clear(); for (unsigned int i = 0; i < mGameClient->raceResults.size(); ++i) { //make the node char name[128]; sprintf_s(name, 128, "playerResult%i", i); if (mSceneMgr->hasSceneNode(name)) mSceneMgr->destroySceneNode(name); Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode(name); Ogre::Entity* ent = mSceneMgr->createEntity("checkBox.mesh"); //Make the text char words[128]; sprintf_s(words, 128, "Player %i = %d:%d.%d", i + 1, mGameClient->raceResults[i].minutes, mGameClient->raceResults[i].seconds, mGameClient->raceResults[i].ms); Ogre::MovableText* text = new Ogre::MovableText(name, words); text->setTextAlignment(Ogre::MovableText::H_LEFT, Ogre::MovableText::V_CENTER); node->setPosition(-3, 1.5 - (i*0.6), -5); node->scale(1, 0.5, 1); std::shared_ptr<PlayerLabel> p = std::shared_ptr<PlayerLabel>(new PlayerLabel(node, ent, text)); labels.push_back(p); } //Reset the server mGameClient->SendString("reset"); //Reset the local client stuff mGameClient->raceComplete = false; mGameClient->raceResults.clear(); mGameClient->allReady = false; mGameClient->allDoneLoading = false; mGameClient->startingIndex = 999; mGameClient->totalPlayers = 0; mGameClient->mConnectedPlayers = NULL; mGameClient->id = 0; }
/* Load additional info */ void Test::loadAditionalData(void) { createLevelManager(); createPlayer(); createBombs(); createCivils(); createZombies(); createBillboardSet(); createCollectable(); Ogre::DotSceneLoader dsl; // dsl.parseDotScene("metros.scene", "Popular", GLOBAL_SCN_MNGR); dsl.parseDotScene("generic.scene", "Popular", GLOBAL_SCN_MNGR); }
void Ogre3DRendererPlugin::createScene() { mCamera2 = mSceneMgr->createCamera("PlayerCam2"); mCamera2->setCustomProjectionMatrix(true, mCamera->getProjectionMatrix()); mCamera2->setCustomViewMatrix(true, mCamera->getViewMatrix()); mWindow->removeAllViewports(); Ogre::Viewport* vp = mWindow->addViewport(mCamera2); Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh"); Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("HeadNode"); // headNode->attachObject(ogreHead); // Water // Define a plane mesh that will be used for the ocean surface Ogre::Plane oceanSurface; oceanSurface.normal = Ogre::Vector3::UNIT_Y; oceanSurface.d = 20; Ogre::MeshManager::getSingleton().createPlane("OceanSurface", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, oceanSurface, 5000, 5000, 50, 50, true, 1, 1, 1, Ogre::Vector3::UNIT_Z); Entity *pWaterEntity = mSceneMgr->createEntity( "OceanSurface", "OceanSurface" ); mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pWaterEntity); pWaterEntity->setMaterialName("Ocean2_HLSL_GLSL"); // pWaterEntity->setMaterialName("OceanHLSL_GLSL"); Ogre::Light* light = mSceneMgr->createLight( "MainLight" ); light->setPosition(20, 80, 50); light->setPosition(0, 0, 50); Ogre::DotSceneLoader l; l.parseDotScene("first_terrain.scene", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, mSceneMgr); // mSceneMgr->showBoundingBoxes(true); mSceneMgr->setSkyDome(true, "Examples/CloudySky", 5, 8); // mSceneMgr->setSkyBox(true, "Examples/SpaceSkyBox"); createDesktopObject(); setupRTT(); }
void createScene(){ ///////////////////////////////////////////////////////////////////////////////// //// HERE BE THE USEFUL CODE ///////////////////////////////////////////////////////////////////////////////// std::ifstream in; std::ofstream out; std::string name; char actualScene[256]; char size[256]; unsigned int sfSize; in.open("scenefiles"); if(!in.is_open()){ std::cout << "Error trying to open the scene list file\n"; } in.getline(size,256,'\n'); sfSize = atoi(size); for (int i=0; i<sfSize ;i++){ std::stringstream data; std::cout << "infor\n"; in.getline(actualScene,256,'\n'); //outfile name = "collobjConfig-"; name += actualScene; std::cout << name << "\n"; out.open(name.c_str()); if(!out.is_open()){ std::cout << "Error trying to open the config file\n"; } // import .scene Ogre::SceneNode* _LoaderNode; _LoaderNode = _sceneManager->getRootSceneNode()->createChildSceneNode(name); Loader.parseDotScene(actualScene,Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME, _sceneManager, _LoaderNode); std::cout << "cantidad de children de LoaderNode " << _LoaderNode->numChildren() << "\n"; // show all the nodes // (if any node except _LoaderNode has more than 1 entity, the scene is f****d up) std::cout << "\n\n\n" << DumpNodes(_LoaderNode) << "\n\n\n"; data << CollObjExporter::sceneExtractor(_LoaderNode); std::cout << "EXPORTER\n\n" << data.str(); out << data.str(); out.close(); DestroyAllAttachedMovableObjects(_LoaderNode); _LoaderNode->removeAndDestroyAllChildren(); std::cout << "\n\n\n" << DumpNodes(_LoaderNode) << "\n\n\n"; _sceneManager->getRootSceneNode()->removeChild(name); } std::cout << "export finished \n"; }