ofusion- the next step

yuriythebest

20-08-2006 16:08:52

Ok- I've got the whole ofusion system up an running, and I'm at the stage where I can easily load .osm file in the demo app. What I'm trying to do now- integrate that with the other ogre stuff I've been learning, mainly exampleApplication. However, when I try the following I get no errors, nor does the code affect the result in any way. Therefore I assume the following will look like a bad joke to someone who knows better:

OSceneLibDemo



#include "oSceneLibDemo.h"
#include "ExampleApplication.h"

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char **argv)
#endif
{
// Create application object
oSceneLibApplication app;
class TutorialApplication : public ExampleApplication
{
protected:
public:
TutorialApplication()
{
}

~TutorialApplication()
{
}
protected:
virtual void createViewports(void)
{
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue( 0,0,24));
mCamera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
}
void createScene(void)
{

mSceneMgr->setAmbientLight( ColourValue( 1, 1, 1 ) );
Entity *ent1 = mSceneMgr->createEntity( "Robot", "robot.mesh" );
SceneNode *node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode( "RobotNode" );
node1->attachObject( ent1 );

}
};


try {
app.go();
} catch( Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
std::cerr << "An exception has occured: " << e.getFullDescription();
#endif
}


return 0;
}

#ifdef __cplusplus
}
#endif

Lioric

20-08-2006 18:34:52

Why you put a class declaration inside a function?

I would be better if you use the demo application and add your changes or modifications there

You will need the latest scene loader demo as there are differences with previous (i.e. in the new, viewports are auto created)

yuriythebest

20-08-2006 19:22:27

Why you put a class declaration inside a function?

I would be better if you use the demo application and add your changes or modifications there

You will need the latest scene loader demo as there are differences with previous (i.e. in the new, viewports are auto created)


thank you- got my problem- out of the 2 files in the project I chose the wrong one, it was supposed to be OgreOSMScene. Placing createScene the code in OSMScene::~OSMScene works perfectly.

what I still don't know is how to access the createViewport equivallent in sceneloader. I wouln'd have to but ofusion seems to ignore my choice of background color, and when I select any sky that is not 'none' ogre complains that there is no such sky. I have the latest oFusion max plugin and osceneloader (last week's anyway).