void Game::notifyComboChange(MyGUI::ComboBox* _sender, size_t _index){ int st = static_cast<int>(Ogre::SHADOWTYPE_NONE); if( mUI.IsWidget(_sender,"shadow") ){ st = static_cast<int>(getShadowTechnique( _index )); if( st != static_cast<int>(Ogre::SHADOWTYPE_NONE) ){ try{ MyGUI::ComboBox* pcombo = mUI["lighting"]->castType<MyGUI::ComboBox>(false); size_t index = pcombo->getIndexSelected(); st |= static_cast<int>(getShadowMode( index )); }catch( out_of_range& e ){ WARNING_LOG(e.what()); } } }else if( mUI.IsWidget(_sender,"lighting") ){ try{ MyGUI::ComboBox* pcombo = mUI["shadow"]->castType< MyGUI::ComboBox>(false); int sel = pcombo->getIndexSelected(); st = static_cast<int>(getShadowTechnique( sel )); }catch( out_of_range& e ){ WARNING_LOG(e.what()); return; } if( st != static_cast<int>(Ogre::SHADOWTYPE_NONE) ) st |= static_cast<int>(getShadowMode( _index )); } setShadowTechnique( static_cast<Ogre::ShadowTechnique>(st) ); }
void SingleplayerGame::createScene(std::vector<std::string> partyNames){ auto scnMgr = mRenderer->mSceneManager; auto root = scnMgr->getRootSceneNode(); Ogre::Camera* camera = mRenderer->mCamera; mRoomRoot = root->createChildSceneNode(); scnMgr->setSkyBox(true, "Examples/MorningSkyBox", 5000, true); // Set ambient light scnMgr->setAmbientLight(Ogre::ColourValue(0.3, 0.3, 0.3)); scnMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE); // Create a light mMainLight = scnMgr->createLight(BaseGame::mainLightName); mMainLight->setPosition(0, 500, 0); mMainLight->setType(Ogre::Light::LT_POINT); mMainLight->setDiffuseColour(.5, .5, .5); // Create ground plane ground = new Plane(scnMgr, mRoomRoot); // Add test objects Player* p = new Player(scnMgr, mRoomRoot, mPlayerBank->getPlayerInfo(partyNames[0]), Ogre::Vector3(500, 0, 200), mSoundBank); myParty.push_back(p); Player* p2 = new Player(scnMgr, mRoomRoot, mPlayerBank->getPlayerInfo(partyNames[1]), Ogre::Vector3(500, 0, 0), mSoundBank); myParty.push_back(p2); Player* p3 = new Player(scnMgr, mRoomRoot, mPlayerBank->getPlayerInfo(partyNames[2]), Ogre::Vector3(500, 0, -200), mSoundBank); myParty.push_back(p3); Player* p4 = new Player(scnMgr, mRoomRoot, mPlayerBank->getPlayerInfo("Mecha-Scoot"), Ogre::Vector3(-500, 0, 200), mSoundBank); enemyParty.push_back(p4); Player* p5 = new Player(scnMgr, mRoomRoot, mPlayerBank->getPlayerInfo("SSJVirginia"), Ogre::Vector3(-500, 0, 0), mSoundBank); enemyParty.push_back(p5); Player* p6 = new Player(scnMgr, mRoomRoot, mPlayerBank->getPlayerInfo("Metal Scoot"), Ogre::Vector3(-500, 0, -200), mSoundBank); enemyParty.push_back(p6); // Set Camera Position cameraInitialPosition = Ogre::Vector3(1100, 250, 700); cameraInitialLookAt = Ogre::Vector3(0, 0, 0); camera->setPosition(cameraInitialPosition); camera->lookAt(cameraInitialLookAt); }
void Game::createScene() { mRegistry = new Registry(); //创建Geometry单一对象Singleton mGettextManager = new GettextManager(); mGeometry = new Geometry(); mObjectFactory = new ObjectFactory(); //创建RigidManager单一对象 mRigidManager = new RigidManager(); mRigidToolManager = new RigidToolManager(); mHotkeyManager = new HotkeyManager(); mLuaManager = new LuaManager(); mLuaC = new LuaControlet(); mLuaManager->setLuaLocation(""); for( LuaVector::iterator i = mPreLuaLocation.begin();i!=mPreLuaLocation.end();i++ ) { mLuaManager->addLuaLocation( *i ); } for( LuaVector::iterator j = mPreLuaScript.begin();j!=mPreLuaScript.end();j++ ) { mLuaManager->doFile( *j ); } for( LuaVector::iterator k = mPreLoad.begin();k!=mPreLoad.end();k++ ) { loadBase( *k ); } //打开阴影 setShadowTechnique( static_cast<Ogre::ShadowTechnique>( static_cast<int>(Ogre::SHADOWDETAILTYPE_STENCIL) | static_cast<int>(Ogre::SHADOWDETAILTYPE_MODULATIVE) ) ); if( mInfo ) mInfo->setVisible( false ); }