本文整理汇总了C++中ogre::MeshPtr::createManualLodLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshPtr::createManualLodLevel方法的具体用法?C++ MeshPtr::createManualLodLevel怎么用?C++ MeshPtr::createManualLodLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MeshPtr
的用法示例。
在下文中一共展示了MeshPtr::createManualLodLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadSceneFile
void World::LoadSceneFile(string sceneFile)
{
Ogre::LogManager::getSingleton().setLogDetail(Ogre::LL_LOW);
Ogre::SceneNode* worldNode = m_sceneMgr->getRootSceneNode()->createChildSceneNode();
worldNode->rotate(Ogre::Vector3::UNIT_X, Ogre::Degree(-90.0f));
string meshName;
float fDrawDistance;
bool bIsLod;
Ogre::Vector3 position;
Ogre::Quaternion rotation;
ifstream sceneStream(sceneFile);
// skip the title and the table title of the file
string strline;
int i = 0;
while (!sceneStream.eof())
{
getline(sceneStream, strline);
if (strline.length() == 0)
continue;
std::istringstream ss(strline);
std::string token;
getline(ss, token, ',');
boost::trim(token);
meshName = token;
getline(ss, token, ',');
boost::trim(token);
fDrawDistance = lexical_cast<float>(token);
getline(ss, token, ',');
boost::trim(token);
bIsLod = lexical_cast<bool>(token);
getline(ss, token, ',');
boost::trim(token);
position.x = lexical_cast<float>(token);
getline(ss, token, ',');
boost::trim(token);
position.y = lexical_cast<float>(token);
getline(ss, token, ',');
boost::trim(token);
position.z = lexical_cast<float>(token);
getline(ss, token, ',');
boost::trim(token);
rotation.w = lexical_cast<float>(token);
getline(ss, token, ',');
boost::trim(token);
rotation.x = lexical_cast<float>(token);
getline(ss, token, ',');
boost::trim(token);
rotation.y = lexical_cast<float>(token);
getline(ss, token, ',');
boost::trim(token);
rotation.z = lexical_cast<float>(token);
Ogre::MeshPtr mesh;
Ogre::Entity* entity;
Ogre::Entity* realEntity = m_sceneMgr->createEntity(meshName);
if (fDrawDistance > 300.0f && !bIsLod)
continue;
if (bIsLod)
{
mesh = Ogre::MeshManager::getSingleton().createManual(meshName + "lod" + std::to_string(i), "General"); // empty mesh
mesh->createManualLodLevel(0, "NULL");
mesh->createManualLodLevel(700, meshName);
mesh->_setBounds( realEntity->getMesh()->getBounds());
mesh->_setBoundingSphereRadius(realEntity->getMesh()->getBoundingSphereRadius());
mesh->load();
entity->setRenderingDistance(fDrawDistance);
entity = m_sceneMgr->createEntity(mesh->getName());
}
else
{
mesh = Ogre::MeshManager::getSingleton().getByName(meshName);
entity = m_sceneMgr->createEntity(meshName);
entity->setRenderingDistance(fDrawDistance);
}
m_sceneMgr->destroyEntity(realEntity);
Ogre::SceneNode* sceneNode = worldNode->createChildSceneNode();
sceneNode->attachObject(entity);
fix_gta_coord(rotation);
sceneNode->rotate(rotation);
sceneNode->setPosition(position);
i++;
//.........这里部分代码省略.........