creating an oFusion callback

yuriythebest

01-01-2008 13:52:57

right, I've successfully added oFusion to my project, however when I load my scene I can only see the background color

1.I have a light, yes
2. my camera in 3ds max is looking at some objects

I read this thread:
http://www.ogre3d.org/phpBB2addons/view ... lor+colour

and seems I have to enable the bounding box by using the oFusion callback. I've looked at the demo application yet I'm still confused where and how I should declare it. my project looks like so:



I've tried placing
class oSceneCallback : public OSMSceneCallbacks {
public:


};


in the header file of my application but I get this error:


error C2504: 'OSMSceneCallbacks' : base class undefined


I haven't set up a callback before so I'm very confused

Lioric

01-01-2008 19:45:51

You need to include the "IOSMSceneCallbacks.h" file in your header file for the compiler to locate the definition of the OSMSceneCallbacks interface

add this to your file (at the top of your header file):


#include "IOSMSceneCallbacks.h"


Then in your class derived form the callback interface you override (declare and implement in you class) the methods that you want to be notified on, if you want to be notified and do any process when each camera is loaded you override the "OnCameraCreate" method:


// We override the OnCreate method for cameras (See IXMLSceneCallbacks class)

void OnCameraCreate(Ogre::Camera* pCamera, TiXmlElement* pCameraDesc) {

// If a camera of name "FirstCamera" is loaded, it will be set as the default current
if(pCamera->getName() == "FirstCamera")
Ogre::Root::getSingleton().getAutoCreatedWindow()->getViewport(0)->setCamera(pCamera);
}


If you want to do any process to each entitiy as they are loaded, you override the "OnEntityCreate" method, here you can enable the bounding box display of selected entitites:


void OnEntityCreate(Ogre::Entity* pEntity, TiXmlElement* pEntityDesc) {
pEntity->getParentSceneNode()->showBoundingBox(true);
}