void OgreSample8App::setupModes() { StringVector matNames; matNames.push_back("Examples/BumpMapping/MultiLight"); matNames.push_back("Examples/BumpMapping/MultiLightSpecular"); matNames.push_back("Examples/OffsetMapping/Specular"); matNames.push_back("Examples/ShowUV"); matNames.push_back("Examples/ShowNormals"); matNames.push_back("Examples/ShowTangents"); matNames.push_back("RTSS/NormalMapping_SinglePass"); matNames.push_back("RTSS/NormalMapping_MultiPass"); mPossibilities["ogrehead.mesh"] = matNames; mPossibilities["knot.mesh"] = matNames; matNames.clear(); matNames.push_back("Examples/Athene/NormalMapped"); matNames.push_back("Examples/Athene/NormalMappedSpecular"); matNames.push_back("Examples/Athene/NormalMappedSpecular"); matNames.push_back("Examples/ShowUV"); matNames.push_back("Examples/ShowNormals"); matNames.push_back("Examples/ShowTangents"); matNames.push_back("RTSS/Athene/NormalMapping_SinglePass"); matNames.push_back("RTSS/Athene/NormalMapping_MultiPass"); mPossibilities["athene.mesh"] = matNames; for (std::map<Ogre::String,Ogre::StringVector>::iterator it = mPossibilities.begin(); it != mPossibilities.end(); it++) { Ogre::MeshPtr mesh = MeshManager::getSingleton().load(it->first,ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY); unsigned short src,dest; if (!mesh->suggestTangentVectorBuildParams(VES_TANGENT,src,dest)) { mesh->buildTangentVectors(VES_TANGENT,src,dest); } Entity* ent = mSceneMgr->createEntity(mesh->getName(),mesh->getName()); ent->setMaterialName(it->second.front()); } mMeshMenu->addItem(new CEGUI::ListboxTextItem("athene.mesh")); mMeshMenu->addItem(new CEGUI::ListboxTextItem("ogrehead.mesh")); mMeshMenu->addItem(new CEGUI::ListboxTextItem("knot.mesh")); mMeshMenu->setItemSelectState(size_t(0),true); const char * a = mMeshMenu->getSelectedItem()->getText().c_str(); Ogre::StringVector::iterator it = mPossibilities[a].begin(); Ogre::StringVector::iterator itEnd = mPossibilities[mMeshMenu->getSelectedItem()->getText().c_str()].end(); for (; it != itEnd; it++) { mMaterialMenu->addItem(new ListboxTextItem(it->c_str())); } mMaterialMenu->setItemSelectState(size_t(0),true); mSceneMgr->getEntity(mMeshMenu->getSelectedItem()->getText().c_str())->setMaterialName(mMaterialMenu->getSelectedItem()->getText().c_str()); }
void LogMessageWindow::trimDisplayArea(const char* aMsg) { m_displaylog.append(Ogre::UTFString(CharToWchar(aMsg))); m_displaylog.append("\n"); Ogre::StringVector v = Ogre::StringUtil::split(m_displaylog,"\n"); while(v.size()>m_displaylinenum) { v.erase(v.begin()); m_displaylog.clear(); for (Ogre::StringVector::iterator i = v.begin(); i != v.end(); ++i) { m_displaylog.append(i->c_str()); m_displaylog.append("\n"); } v = Ogre::StringUtil::split(m_displaylog,"\n"); } }
bool OgreSample8App::handleItemSelected1(const CEGUI::EventArgs& args) { mObjectNode->detachAllObjects(); mObjectNode->attachObject(mSceneMgr->getEntity(mMeshMenu->getSelectedItem()->getText().c_str())); mMaterialMenu->clearAllSelections(); Ogre::StringVector::iterator it = mPossibilities[mMeshMenu->getSelectedItem()->getText().c_str()].begin(); Ogre::StringVector::iterator itEnd = mPossibilities[mMeshMenu->getSelectedItem()->getText().c_str()].end(); mMaterialMenu->clearAllSelections(); for (; it != itEnd; it++) { mMaterialMenu->addItem(new ListboxTextItem(it->c_str())); } mMaterialMenu->setItemSelectState(size_t(0),true); mSceneMgr->getEntity(mMeshMenu->getSelectedItem()->getText().c_str())->setMaterialName(mMaterialMenu->getSelectedItem()->getText().c_str()); return true; }
//----------------------------------------------------------------------------// size_t OgreResourceProvider::getResourceGroupFileNames( std::vector<String>& out_vec, const String& file_pattern, const String& resource_group) { // get list of files in the group that match the pattern. Ogre::StringVectorPtr vp = Ogre::ResourceGroupManager::getSingleton().findResourceNames( (resource_group.empty() ? d_defaultResourceGroup.c_str() : resource_group.c_str()), file_pattern.c_str()); size_t entries = 0; Ogre::StringVector::iterator i = vp->begin(); for (; i != vp->end(); ++i) { out_vec.push_back(i->c_str()); ++entries; } return entries; }