goldenhyl1
12-07-2006 03:38:32
I want add a mesh entity to plsm2 secene node?
just as following:
it has no error but the entity does not appear,
however it we change the secene type to:
mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "ExampleSMInstance");
it can work normally.
I am not sure whether plsm2 can work with mesh entity or not?
who can give me confidence and better for some advice, thanks
just as following:
chooseSceneManager(void)
{
bool notFound = true;
SceneManagerEnumerator::MetaDataIterator it = mRoot->getSceneManagerMetaDataIterator();
while (it.hasMoreElements ())
{
const SceneManagerMetaData* metaData = it.getNext ();
if (metaData->sceneTypeMask == ST_EXTERIOR_REAL_FAR &&
metaData->worldGeometrySupported == true &&
metaData->typeName == "PagingLandScapeSceneManager")
{
notFound = false;
break;
}
}
if (notFound)
{
OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "Could not find Paging Landscape plugin. Check if it's in plugins.cfg.",
"chooseSceneManager");
}
mSceneMgr = mRoot->createSceneManager("PagingLandScapeSceneManager", "MyVR_PLAT" );
mSceneMgr->setWorldGeometry( Ogre::String("paginglandscape2.cfg") );
}
handleModelComboChanged(const CEGUI::EventArgs& e)
{
using namespace CEGUI;
CEGUI::ListboxItem* item = ((Combobox*)((const WindowEventArgs&)e).window)->getSelectedItem();
Ogre::String meshName(item->getText().c_str());
if (mCurrentEntity)
{
mCurrentEntity->setVisible(false);
mMainNode->detachObject(mCurrentEntity->getName());
}
try
{
mCurrentEntity = mSceneMgr->getEntity( meshName );
}
catch (Ogre::Exception e)
{
Ogre::MeshPtr pMesh = Ogre::MeshManager::getSingleton().load(meshName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME ); mCurrentEntity = mSceneMgr->createEntity(meshName, meshName);
}
mCurrentEntity->setVisible(true);
mMainNode->attachObject(mCurrentEntity);
mCurrentEntity->setMaterialName(mMaterialControlsContainer[mCurrentMaterial].getMaterialName());
configureShaderControls();
return true;
}
it has no error but the entity does not appear,
however it we change the secene type to:
mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "ExampleSMInstance");
it can work normally.
I am not sure whether plsm2 can work with mesh entity or not?
who can give me confidence and better for some advice, thanks