Problems loading .osm ("You have not created a camera y

Nowec

28-03-2006 12:28:33

When running this code
OSMScene oScene;
oScene.initialise("scene.osm");
oScene.createScene();
SceneManager* sm = oScene.getSceneManager();
Camera* cam = createCamera(sm); // my own method
createViewport(cam); // my own method

I get this exception
Function: TerrainRenderable::_calculateCFactor
Description: You have not created a camera yet!.
File: d:\ogredev\dagon\plugins\octreescenemanager\src\ogreterrainrenderable.cpp
Line: 658

because there's no camera created between the sceneManager is created, and setWorldGeometry() is used in this code
// void OSMScene::setSceneProperties(TiXmlElement* sceneProp) in OgreOSMScene.cpp
mSceneMgr = Ogre::Root::getSingleton().createSceneManager(sceneType);
assert(mSceneMgr);

const char* worldGeometry = sceneMgrElem->Attribute("worldGeometry");
if(worldGeometry != NULL)
mSceneMgr->setWorldGeometry(worldGeometry);

There's not camera in the osm-file I'm trying to load, but that shouldn't be needed according to
// Create a default camera in case no cameras were saved in the scene
mCamera = mSceneMgr->createCamera("PlayerCam");

How come I get this exception?

It works if I put in the code for adding a camera and viewport, between creating the sceneManager and calling setWorldGeometry().
So it's not really a problem for me, but I guess others would eventually run into this problem too. (had the same problem with the previous version of the oSceneLoaderLib too)

Is it just me missing something? :)