plsm2 and mesh Entity conflict?

goldenhyl1

12-07-2006 03:38:32

I want add a mesh entity to plsm2 secene node?

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

HexiDave

12-07-2006 04:18:33

Try setting the node's position to where the camera is (or in front of it) and see if it shows up there. The node may be really far away from where the camera is (I'm not 100% sure how you have your application setup, so appologies if this isn't in line with your program.)

I don't know if PLSM2 does it automatically, but I'm pretty sure that when the terrain loads, the camera goes to a spot specified in the terrain file pointed to by paginglandscape2.cfg (BaseCameraPosition or something like that.)

goldenhyl1

13-07-2006 07:02:36

thanks, you are right!